From e0e2c76d2ffb7acea3569296ef115abee4c744e6 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Wed, 7 Jun 2023 11:05:47 -0700 Subject: [PATCH 01/22] vulkan: minor fixes (#6874) - flush() and wait() before destroying a swapchain - Make sure the debug marker extension is enabled under correct circumstances. - Change shared_ptrs to unique_ptrs and raw pointers. - Rename most teardown methods to terminate() --- filament/backend/src/vulkan/VulkanBlitter.cpp | 8 +-- filament/backend/src/vulkan/VulkanBlitter.h | 9 ++- filament/backend/src/vulkan/VulkanBuffer.cpp | 3 +- filament/backend/src/vulkan/VulkanBuffer.h | 6 +- filament/backend/src/vulkan/VulkanContext.h | 67 +------------------ .../backend/src/vulkan/VulkanDisposer.cpp | 2 +- filament/backend/src/vulkan/VulkanDisposer.h | 2 +- filament/backend/src/vulkan/VulkanDriver.cpp | 63 ++++++++--------- filament/backend/src/vulkan/VulkanDriver.h | 4 +- .../backend/src/vulkan/VulkanFboCache.cpp | 2 +- filament/backend/src/vulkan/VulkanHandles.cpp | 18 ++--- filament/backend/src/vulkan/VulkanHandles.h | 6 +- .../src/vulkan/VulkanPipelineCache.cpp | 4 +- .../backend/src/vulkan/VulkanPipelineCache.h | 2 +- .../backend/src/vulkan/VulkanSamplerCache.cpp | 2 +- .../backend/src/vulkan/VulkanSamplerCache.h | 2 +- .../backend/src/vulkan/VulkanStagePool.cpp | 7 +- filament/backend/src/vulkan/VulkanStagePool.h | 6 +- .../backend/src/vulkan/VulkanSwapChain.cpp | 13 ++-- filament/backend/src/vulkan/VulkanSwapChain.h | 19 +++--- filament/backend/src/vulkan/VulkanTexture.cpp | 4 +- filament/backend/src/vulkan/VulkanTexture.h | 27 ++++---- .../src/vulkan/platform/VulkanPlatform.cpp | 9 ++- 23 files changed, 111 insertions(+), 174 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanBlitter.cpp b/filament/backend/src/vulkan/VulkanBlitter.cpp index 7302f76db6..a67c75a86c 100644 --- a/filament/backend/src/vulkan/VulkanBlitter.cpp +++ b/filament/backend/src/vulkan/VulkanBlitter.cpp @@ -116,8 +116,7 @@ VulkanBlitter::VulkanBlitter(VulkanStagePool& stagePool, VulkanPipelineCache& pi mSamplerCache(samplerCache) {} void VulkanBlitter::initialize(VkPhysicalDevice physicalDevice, VkDevice device, - VmaAllocator allocator, std::shared_ptr commands, - std::shared_ptr emptyTexture) noexcept { + VmaAllocator allocator, VulkanCommands* commands, VulkanTexture* emptyTexture) noexcept { mPhysicalDevice = physicalDevice; mDevice = device; mAllocator = allocator; @@ -181,7 +180,7 @@ void VulkanBlitter::blitDepth(BlitArgs args) { args.dstRectPair); } -void VulkanBlitter::shutdown() noexcept { +void VulkanBlitter::terminate() noexcept { if (mDevice) { delete mDepthResolveProgram; mDepthResolveProgram = nullptr; @@ -198,9 +197,6 @@ void VulkanBlitter::shutdown() noexcept { mParamsBuffer = nullptr; } } - - mCommands.reset(); - mEmptyTexture.reset(); } // If we created these shader modules in the constructor, the device might not be ready yet. diff --git a/filament/backend/src/vulkan/VulkanBlitter.h b/filament/backend/src/vulkan/VulkanBlitter.h index 18527770e2..2c2b70bc68 100644 --- a/filament/backend/src/vulkan/VulkanBlitter.h +++ b/filament/backend/src/vulkan/VulkanBlitter.h @@ -36,8 +36,7 @@ public: VulkanFboCache& fboCache, VulkanSamplerCache& samplerCache) noexcept; void initialize(VkPhysicalDevice physicalDevice, VkDevice device, VmaAllocator allocator, - std::shared_ptr commands, - std::shared_ptr emptyTexture) noexcept; + VulkanCommands* commands, VulkanTexture* emptyTexture) noexcept; struct BlitArgs { const VulkanRenderTarget* dstTarget; @@ -51,7 +50,7 @@ public: void blitColor(BlitArgs args); void blitDepth(BlitArgs args); - void shutdown() noexcept; + void terminate() noexcept; private: void lazyInit() noexcept; @@ -67,8 +66,8 @@ private: UTILS_UNUSED VkPhysicalDevice mPhysicalDevice; VkDevice mDevice; VmaAllocator mAllocator; - std::shared_ptr mCommands; - std::shared_ptr mEmptyTexture; + VulkanCommands* mCommands; + VulkanTexture* mEmptyTexture; VulkanStagePool& mStagePool; VulkanPipelineCache& mPipelineCache; diff --git a/filament/backend/src/vulkan/VulkanBuffer.cpp b/filament/backend/src/vulkan/VulkanBuffer.cpp index 7d9ba47910..bf60ee51cd 100644 --- a/filament/backend/src/vulkan/VulkanBuffer.cpp +++ b/filament/backend/src/vulkan/VulkanBuffer.cpp @@ -23,7 +23,7 @@ using namespace bluevk; namespace filament::backend { -VulkanBuffer::VulkanBuffer(VmaAllocator allocator, std::shared_ptr commands, +VulkanBuffer::VulkanBuffer(VmaAllocator allocator, VulkanCommands* commands, VulkanStagePool& stagePool, VkBufferUsageFlags usage, uint32_t numBytes) : mAllocator(allocator), mCommands(commands), mStagePool(stagePool), mUsage(usage) { @@ -51,7 +51,6 @@ void VulkanBuffer::terminate() { vmaDestroyBuffer(mAllocator, mGpuBuffer, mGpuMemory); mGpuMemory = VK_NULL_HANDLE; mGpuBuffer = VK_NULL_HANDLE; - mCommands.reset(); } void VulkanBuffer::loadFromCpu(const void* cpuData, uint32_t byteOffset, uint32_t numBytes) const { diff --git a/filament/backend/src/vulkan/VulkanBuffer.h b/filament/backend/src/vulkan/VulkanBuffer.h index a5cef97cc9..4d80e56a4a 100644 --- a/filament/backend/src/vulkan/VulkanBuffer.h +++ b/filament/backend/src/vulkan/VulkanBuffer.h @@ -25,15 +25,15 @@ namespace filament::backend { // Encapsulates a Vulkan buffer, its attached DeviceMemory and a staging area. class VulkanBuffer { public: - VulkanBuffer(VmaAllocator allocator, std::shared_ptr commands, - VulkanStagePool& stagePool, VkBufferUsageFlags usage, uint32_t numBytes); + VulkanBuffer(VmaAllocator allocator, VulkanCommands* commands, VulkanStagePool& stagePool, + VkBufferUsageFlags usage, uint32_t numBytes); ~VulkanBuffer(); void terminate(); void loadFromCpu(const void* cpuData, uint32_t byteOffset, uint32_t numBytes) const; VkBuffer getGpuBuffer() const { return mGpuBuffer; } private: VmaAllocator mAllocator; - std::shared_ptr mCommands; + VulkanCommands* mCommands; VulkanStagePool& mStagePool; VmaAllocation mGpuMemory = VK_NULL_HANDLE; diff --git a/filament/backend/src/vulkan/VulkanContext.h b/filament/backend/src/vulkan/VulkanContext.h index 0fbed1154b..713abdc8fc 100644 --- a/filament/backend/src/vulkan/VulkanContext.h +++ b/filament/backend/src/vulkan/VulkanContext.h @@ -39,73 +39,8 @@ struct VulkanTexture; class VulkanStagePool; struct VulkanTimerQuery; -// TODO: We used std::shared_ptr in various places across the vulkan backend, but VulkanTexture* -// also maps to HwTexture so it's not possible to switch in VulkanAttachment. Hence we introduce -// this temporary class. We need to revisit the ownership pattern and use of smart pointer in the -// vulkan backend, in particular std::shared_ptr uses atomic, which is overhead we do not need. -struct TexturePointer { - TexturePointer() = default; - explicit TexturePointer(VulkanTexture* tex) :mTexture(tex) {} - explicit TexturePointer(std::shared_ptr tex) :mTexture(tex) {} - - inline TexturePointer& operator=(VulkanTexture* tex) { - mTexture = tex; - return *this; - } - - inline TexturePointer& operator=(std::shared_ptr tex) { - mTexture = tex; - return *this; - } - - // Be careful not to leak here. Should only be used in local scope. - explicit operator VulkanTexture*() const { - if (mTexture.index() == 0) { - return std::get<0>(mTexture); - } - return std::get<1>(mTexture).get(); - } - - // Be careful not to leak here. Should only be used in local scope. - explicit operator VulkanTexture const*() const { - if (mTexture.index() == 0) { - return std::get<0>(mTexture); - } - return std::get<1>(mTexture).get(); - } - - explicit operator std::shared_ptr() const { - assert_invariant(mTexture.index() == 1); - return std::get<1>(mTexture); - } - - inline operator bool() const { - if (mTexture.index() == 0) { - return std::get<0>(mTexture) != nullptr; - } - return (bool) std::get<1>(mTexture); - } - - inline VulkanTexture* operator->() { - if (mTexture.index() == 0) { - return std::get<0>(mTexture); - } - return std::get<1>(mTexture).get(); - } - - inline VulkanTexture const* operator->() const { - if (mTexture.index() == 0) { - return std::get<0>(mTexture); - } - return std::get<1>(mTexture).get(); - } - -private: - std::variant> mTexture; -}; - struct VulkanAttachment { - TexturePointer texture; + VulkanTexture* texture; uint8_t level = 0; uint16_t layer = 0; VkImage getImage() const; diff --git a/filament/backend/src/vulkan/VulkanDisposer.cpp b/filament/backend/src/vulkan/VulkanDisposer.cpp index 12774cc23c..d0cbf93ae5 100644 --- a/filament/backend/src/vulkan/VulkanDisposer.cpp +++ b/filament/backend/src/vulkan/VulkanDisposer.cpp @@ -84,7 +84,7 @@ void VulkanDisposer::gc() noexcept { disposables.swap(mDisposables); } -void VulkanDisposer::reset() noexcept { +void VulkanDisposer::terminate() noexcept { #ifndef NDEBUG utils::slog.i << mDisposables.size() << " disposables are outstanding." << utils::io::endl; #endif diff --git a/filament/backend/src/vulkan/VulkanDisposer.h b/filament/backend/src/vulkan/VulkanDisposer.h index a8ac5b1968..ea6f39defb 100644 --- a/filament/backend/src/vulkan/VulkanDisposer.h +++ b/filament/backend/src/vulkan/VulkanDisposer.h @@ -44,7 +44,7 @@ public: void gc() noexcept; // Invokes the destructor function for all disposables, regardless of reference count. - void reset() noexcept; + void terminate() noexcept; private: struct Disposable { diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 9d3f42bb27..05a866b4ae 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -92,12 +92,11 @@ VmaAllocator createAllocator(VkInstance instance, VkPhysicalDevice physicalDevic return allocator; } -std::shared_ptr createEmptyTexture(VkDevice device, VkPhysicalDevice physicalDevice, - VulkanContext const& context, VmaAllocator allocator, - std::shared_ptr commands, VulkanStagePool& stagePool) { - std::shared_ptr emptyTexture = std::make_shared(device, - physicalDevice, context, allocator, commands, SamplerType::SAMPLER_2D, 1, - TextureFormat::RGBA8, 1, 1, 1, 1, +VulkanTexture* createEmptyTexture(VkDevice device, VkPhysicalDevice physicalDevice, + VulkanContext const& context, VmaAllocator allocator, VulkanCommands* commands, + VulkanStagePool& stagePool) { + VulkanTexture* emptyTexture = new VulkanTexture(device, physicalDevice, context, allocator, + commands, SamplerType::SAMPLER_2D, 1, TextureFormat::RGBA8, 1, 1, 1, 1, TextureUsage::DEFAULT | TextureUsage::COLOR_ATTACHMENT | TextureUsage::SUBPASS_INPUT, stagePool); uint32_t black = 0; @@ -186,22 +185,22 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform, VulkanContext const& contex } #endif mTimestamps = std::make_unique(mPlatform->getDevice()); - mCommands = std::make_shared(mPlatform->getDevice(), + mCommands = std::make_unique(mPlatform->getDevice(), mPlatform->getGraphicsQueue(), mPlatform->getGraphicsQueueFamilyIndex()); mCommands->setObserver(&mPipelineCache); mPipelineCache.setDevice(mPlatform->getDevice(), mAllocator); // TOOD: move them all to be initialized by constructor - mStagePool.initialize(mAllocator, mCommands); + mStagePool.initialize(mAllocator, mCommands.get()); mFramebufferCache.initialize(mPlatform->getDevice()); mSamplerCache.initialize(mPlatform->getDevice()); - mEmptyTexture = createEmptyTexture(mPlatform->getDevice(), mPlatform->getPhysicalDevice(), - mContext, mAllocator, mCommands, mStagePool); + mEmptyTexture.reset(createEmptyTexture(mPlatform->getDevice(), mPlatform->getPhysicalDevice(), + mContext, mAllocator, mCommands.get(), mStagePool)); mPipelineCache.setDummyTexture(mEmptyTexture->getPrimaryImageView()); mBlitter.initialize(mPlatform->getPhysicalDevice(), mPlatform->getDevice(), mAllocator, - mCommands, mEmptyTexture); + mCommands.get(), mEmptyTexture.get()); } VulkanDriver::~VulkanDriver() noexcept = default; @@ -225,20 +224,22 @@ ShaderModel VulkanDriver::getShaderModel() const noexcept { } void VulkanDriver::terminate() { - mEmptyTexture.reset(); + // Command buffers should come first since it might have commands depending on resources that + // are about to be destroyed. mCommands.reset(); + mEmptyTexture.reset(); mTimestamps.reset(); - mBlitter.shutdown(); + mBlitter.terminate(); // Allow the stage pool and disposer to clean up. mStagePool.gc(); - mDisposer.reset(); + mDisposer.terminate(); - mStagePool.reset(); - mPipelineCache.destroyCache(); + mStagePool.terminate(); + mPipelineCache.terminate(); mFramebufferCache.reset(); - mSamplerCache.reset(); + mSamplerCache.terminate(); vmaDestroyAllocator(mAllocator); @@ -335,7 +336,7 @@ void VulkanDriver::destroyVertexBuffer(Handle vbh) { void VulkanDriver::createIndexBufferR(Handle ibh, ElementType elementType, uint32_t indexCount, BufferUsage usage) { auto elementSize = (uint8_t) getElementTypeSize(elementType); - auto indexBuffer = construct(ibh, mAllocator, mCommands, mStagePool, + auto indexBuffer = construct(ibh, mAllocator, mCommands.get(), mStagePool, elementSize, indexCount); mDisposer.createDisposable(indexBuffer, [this, ibh]() { destructBuffer(ibh); }); @@ -350,7 +351,7 @@ void VulkanDriver::destroyIndexBuffer(Handle ibh) { void VulkanDriver::createBufferObjectR(Handle boh, uint32_t byteCount, BufferObjectBinding bindingType, BufferUsage usage) { - auto bufferObject = construct(boh, mAllocator, mCommands, mStagePool, + auto bufferObject = construct(boh, mAllocator, mCommands.get(), mStagePool, byteCount, bindingType, usage); mDisposer.createDisposable(bufferObject, [this, boh]() { destructBuffer(boh); }); @@ -374,8 +375,8 @@ void VulkanDriver::createTextureR(Handle th, SamplerType target, uint TextureFormat format, uint8_t samples, uint32_t w, uint32_t h, uint32_t depth, TextureUsage usage) { auto vktexture = construct(th, mPlatform->getDevice(), - mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands, target, levels, format, - samples, w, h, depth, usage, mStagePool); + mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands.get(), target, levels, + format, samples, w, h, depth, usage, mStagePool); mDisposer.createDisposable(vktexture, [this, th]() { destruct(th); }); } @@ -386,8 +387,8 @@ void VulkanDriver::createTextureSwizzledR(Handle th, SamplerType targ TextureSwizzle swizzleArray[] = {r, g, b, a}; const VkComponentMapping swizzleMap = getSwizzleMap(swizzleArray); auto vktexture = construct(th, mPlatform->getDevice(), - mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands, target, levels, format, - samples, w, h, depth, usage, mStagePool, swizzleMap); + mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands.get(), target, levels, + format, samples, w, h, depth, usage, mStagePool, swizzleMap); mDisposer.createDisposable(vktexture, [this, th]() { destruct(th); }); @@ -441,7 +442,7 @@ void VulkanDriver::createRenderTargetR(Handle rth, for (int i = 0; i < MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT; i++) { if (color[i].handle) { colorTargets[i] = { - .texture = TexturePointer(handle_cast(color[i].handle)), + .texture = handle_cast(color[i].handle), .level = color[i].level, .layer = color[i].layer, }; @@ -455,7 +456,7 @@ void VulkanDriver::createRenderTargetR(Handle rth, VulkanAttachment depthStencil[2] = {}; if (depth.handle) { depthStencil[0] = { - .texture = TexturePointer(handle_cast(depth.handle)), + .texture = handle_cast(depth.handle), .level = depth.level, .layer = depth.layer, }; @@ -467,7 +468,7 @@ void VulkanDriver::createRenderTargetR(Handle rth, if (stencil.handle) { depthStencil[1] = { - .texture = TexturePointer(handle_cast(stencil.handle)), + .texture = handle_cast(stencil.handle), .level = stencil.level, .layer = stencil.layer, }; @@ -484,8 +485,8 @@ void VulkanDriver::createRenderTargetR(Handle rth, assert_invariant(tmin.x >= width && tmin.y >= height); auto renderTarget = construct(rth, mPlatform->getDevice(), - mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands, width, height, samples, - colorTargets, depthStencil, mStagePool); + mPlatform->getPhysicalDevice(), mContext, mAllocator, mCommands.get(), width, height, + samples, colorTargets, depthStencil, mStagePool); mDisposer.createDisposable(renderTarget, [this, rth]() { destruct(rth); }); } @@ -510,15 +511,15 @@ void VulkanDriver::createSyncR(Handle sh, int) { } void VulkanDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t flags) { - construct(sch, mPlatform, mContext, mAllocator, mCommands, mStagePool, + construct(sch, mPlatform, mContext, mAllocator, mCommands.get(), mStagePool, nativeWindow, flags); } void VulkanDriver::createSwapChainHeadlessR(Handle sch, uint32_t width, uint32_t height, uint64_t flags) { assert_invariant(width > 0 && height > 0 && "Vulkan requires non-zero swap chain dimensions."); - construct(sch, mPlatform, mContext, mAllocator, mCommands, mStagePool, nullptr, - flags, VkExtent2D{width, height}); + construct(sch, mPlatform, mContext, mAllocator, mCommands.get(), mStagePool, + nullptr, flags, VkExtent2D{width, height}); } void VulkanDriver::createTimerQueryR(Handle tqh, int) { diff --git a/filament/backend/src/vulkan/VulkanDriver.h b/filament/backend/src/vulkan/VulkanDriver.h index 5d1b4e19f6..f6dae95e4b 100644 --- a/filament/backend/src/vulkan/VulkanDriver.h +++ b/filament/backend/src/vulkan/VulkanDriver.h @@ -138,9 +138,9 @@ private: void collectGarbage(); VulkanPlatform* mPlatform = nullptr; - std::shared_ptr mCommands; + std::unique_ptr mCommands; std::unique_ptr mTimestamps; - std::shared_ptr mEmptyTexture; + std::unique_ptr mEmptyTexture; VulkanSwapChain* mCurrentSwapChain = nullptr; VulkanRenderTarget* mDefaultRenderTarget = nullptr; diff --git a/filament/backend/src/vulkan/VulkanFboCache.cpp b/filament/backend/src/vulkan/VulkanFboCache.cpp index c01e6b5753..1943dce87a 100644 --- a/filament/backend/src/vulkan/VulkanFboCache.cpp +++ b/filament/backend/src/vulkan/VulkanFboCache.cpp @@ -68,7 +68,7 @@ void VulkanFboCache::initialize(VkDevice device) noexcept { mDevice = device; } VulkanFboCache::~VulkanFboCache() { ASSERT_POSTCONDITION(mFramebufferCache.empty() && mRenderPassCache.empty(), - "Please explicitly call reset() while the VkDevice is still alive."); + "Please explicitly call terminate() while the VkDevice is still alive."); } VkFramebuffer VulkanFboCache::getFramebuffer(FboKey config) noexcept { diff --git a/filament/backend/src/vulkan/VulkanHandles.cpp b/filament/backend/src/vulkan/VulkanHandles.cpp index d67a9113eb..e68183d068 100644 --- a/filament/backend/src/vulkan/VulkanHandles.cpp +++ b/filament/backend/src/vulkan/VulkanHandles.cpp @@ -132,15 +132,15 @@ VulkanRenderTarget::VulkanRenderTarget() : HwRenderTarget(0, 0), mOffscreen(fals void VulkanRenderTarget::bindToSwapChain(VulkanSwapChain& swapChain) { assert_invariant(!mOffscreen); VkExtent2D const extent = swapChain.getExtent(); - mColor[0] = { .texture = TexturePointer(swapChain.getCurrentColor()) }; - mDepth = { .texture = TexturePointer(swapChain.getDepth()) }; + mColor[0] = { .texture = swapChain.getCurrentColor() }; + mDepth = { .texture = swapChain.getDepth() }; width = extent.width; height = extent.height; } VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physicalDevice, VulkanContext const& context, VmaAllocator allocator, - std::shared_ptr commands, uint32_t width, uint32_t height, uint8_t samples, + VulkanCommands* commands, uint32_t width, uint32_t height, uint8_t samples, VulkanAttachment color[MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT], VulkanAttachment depthStencil[2], VulkanStagePool& stagePool) : HwRenderTarget(width, height), mOffscreen(true), mSamples(samples) { @@ -167,13 +167,13 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica if (texture && texture->samples == 1) { auto msTexture = texture->getSidecar(); if (UTILS_UNLIKELY(!msTexture)) { - msTexture = std::make_shared(device, physicalDevice, context, + msTexture = new VulkanTexture(device, physicalDevice, context, allocator, commands, texture->target, ((VulkanTexture const*) texture)->levels, texture->format, samples, texture->width, texture->height, texture->depth, texture->usage, stagePool); texture->setSidecar(msTexture); } - mMsaaAttachments[index] = {.texture = TexturePointer(msTexture)}; + mMsaaAttachments[index] = {.texture = msTexture}; } if (texture && texture->samples > 1) { mMsaaAttachments[index] = mColor[index]; @@ -194,9 +194,9 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica uint8_t const msLevel = 1; // Create sidecar MSAA texture for the depth attachment if it does not already exist. - std::shared_ptr msTexture = depthTexture->getSidecar(); + VulkanTexture* msTexture = depthTexture->getSidecar(); if (UTILS_UNLIKELY(!msTexture)) { - msTexture = std::make_shared(device, physicalDevice, context, allocator, + msTexture = new VulkanTexture(device, physicalDevice, context, allocator, commands, depthTexture->target, msLevel, depthTexture->format, samples, depthTexture->width, depthTexture->height, depthTexture->depth, depthTexture->usage, stagePool); @@ -204,7 +204,7 @@ VulkanRenderTarget::VulkanRenderTarget(VkDevice device, VkPhysicalDevice physica } mMsaaDepthAttachment = { - .texture = TexturePointer(msTexture), + .texture = msTexture, .level = msLevel, .layer = mDepth.layer, }; @@ -264,7 +264,7 @@ VulkanVertexBuffer::VulkanVertexBuffer(VulkanContext& context, VulkanStagePool& buffers(bufferCount, nullptr) {} VulkanBufferObject::VulkanBufferObject(VmaAllocator allocator, - std::shared_ptr commands, VulkanStagePool& stagePool, uint32_t byteCount, + VulkanCommands* commands, VulkanStagePool& stagePool, uint32_t byteCount, BufferObjectBinding bindingType, BufferUsage usage) : HwBufferObject(byteCount), buffer(allocator, commands, stagePool, getBufferObjectUsage(bindingType), byteCount), diff --git a/filament/backend/src/vulkan/VulkanHandles.h b/filament/backend/src/vulkan/VulkanHandles.h index 40a7a3ccfb..751c4a2c91 100644 --- a/filament/backend/src/vulkan/VulkanHandles.h +++ b/filament/backend/src/vulkan/VulkanHandles.h @@ -53,7 +53,7 @@ struct VulkanRenderTarget : private HwRenderTarget { // Creates an offscreen render target. VulkanRenderTarget(VkDevice device, VkPhysicalDevice physicalDevice, VulkanContext const& context, VmaAllocator allocator, - std::shared_ptr commands, uint32_t width, uint32_t height, + VulkanCommands* commands, uint32_t width, uint32_t height, uint8_t samples, VulkanAttachment color[MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT], VulkanAttachment depthStencil[2], VulkanStagePool& stagePool); @@ -90,7 +90,7 @@ struct VulkanVertexBuffer : public HwVertexBuffer { }; struct VulkanIndexBuffer : public HwIndexBuffer { - VulkanIndexBuffer(VmaAllocator allocator, std::shared_ptr commands, + VulkanIndexBuffer(VmaAllocator allocator, VulkanCommands* commands, VulkanStagePool& stagePool, uint8_t elementSize, uint32_t indexCount) : HwIndexBuffer(elementSize, indexCount), buffer(allocator, commands, stagePool, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, @@ -102,7 +102,7 @@ struct VulkanIndexBuffer : public HwIndexBuffer { }; struct VulkanBufferObject : public HwBufferObject { - VulkanBufferObject(VmaAllocator allocator, std::shared_ptr commands, + VulkanBufferObject(VmaAllocator allocator, VulkanCommands* commands, VulkanStagePool& stagePool, uint32_t byteCount, BufferObjectBinding bindingType, BufferUsage usage); void terminate() { diff --git a/filament/backend/src/vulkan/VulkanPipelineCache.cpp b/filament/backend/src/vulkan/VulkanPipelineCache.cpp index 3ea2fa9a48..27091c6b5a 100644 --- a/filament/backend/src/vulkan/VulkanPipelineCache.cpp +++ b/filament/backend/src/vulkan/VulkanPipelineCache.cpp @@ -86,7 +86,7 @@ VulkanPipelineCache::VulkanPipelineCache() : mCurrentRasterState(createDefaultRa } VulkanPipelineCache::~VulkanPipelineCache() { - // This does nothing because VulkanDriver::terminate() calls destroyCache() in order to + // This does nothing because VulkanDriver::terminate() calls terminate() in order to // be explicit about teardown order of various components. } @@ -639,7 +639,7 @@ void VulkanPipelineCache::bindInputAttachment(uint32_t bindingIndex, mDescriptorRequirements.inputAttachments[bindingIndex] = targetInfo; } -void VulkanPipelineCache::destroyCache() noexcept { +void VulkanPipelineCache::terminate() noexcept { // Symmetric to createLayoutsAndDescriptors. destroyLayoutsAndDescriptors(); for (auto& iter : mPipelines) { diff --git a/filament/backend/src/vulkan/VulkanPipelineCache.h b/filament/backend/src/vulkan/VulkanPipelineCache.h index ed203c9c56..2c1e63a9c5 100644 --- a/filament/backend/src/vulkan/VulkanPipelineCache.h +++ b/filament/backend/src/vulkan/VulkanPipelineCache.h @@ -169,7 +169,7 @@ public: // NOTE: In theory we should proffer "unbindSampler" but in practice we never destroy samplers. // Destroys all managed Vulkan objects. This should be called before changing the VkDevice. - void destroyCache() noexcept; + void terminate() noexcept; // vkCmdBindPipeline and vkCmdBindDescriptorSets establish bindings to a specific command // buffer; they are not global to the device. Therefore we need to be notified when a diff --git a/filament/backend/src/vulkan/VulkanSamplerCache.cpp b/filament/backend/src/vulkan/VulkanSamplerCache.cpp index 6ebe235640..b57b739d3a 100644 --- a/filament/backend/src/vulkan/VulkanSamplerCache.cpp +++ b/filament/backend/src/vulkan/VulkanSamplerCache.cpp @@ -127,7 +127,7 @@ VkSampler VulkanSamplerCache::getSampler(SamplerParams params) noexcept { return sampler; } -void VulkanSamplerCache::reset() noexcept { +void VulkanSamplerCache::terminate() noexcept { for (auto pair : mCache) { vkDestroySampler(mDevice, pair.second, VKALLOC); } diff --git a/filament/backend/src/vulkan/VulkanSamplerCache.h b/filament/backend/src/vulkan/VulkanSamplerCache.h index 5ce7ad2dc1..f85592117f 100644 --- a/filament/backend/src/vulkan/VulkanSamplerCache.h +++ b/filament/backend/src/vulkan/VulkanSamplerCache.h @@ -29,7 +29,7 @@ class VulkanSamplerCache { public: void initialize(VkDevice device); VkSampler getSampler(SamplerParams params) noexcept; - void reset() noexcept; + void terminate() noexcept; private: VkDevice mDevice; tsl::robin_map mCache; diff --git a/filament/backend/src/vulkan/VulkanStagePool.cpp b/filament/backend/src/vulkan/VulkanStagePool.cpp index 3a136852d7..cb0f79b7e7 100644 --- a/filament/backend/src/vulkan/VulkanStagePool.cpp +++ b/filament/backend/src/vulkan/VulkanStagePool.cpp @@ -26,8 +26,7 @@ static constexpr uint32_t TIME_BEFORE_EVICTION = VK_MAX_COMMAND_BUFFERS; namespace filament::backend { -void VulkanStagePool::initialize(VmaAllocator allocator, - std::shared_ptr commands) noexcept { +void VulkanStagePool::initialize(VmaAllocator allocator, VulkanCommands* commands) noexcept { mAllocator = allocator; mCommands = commands; } @@ -185,7 +184,7 @@ void VulkanStagePool::gc() noexcept { } } -void VulkanStagePool::reset() noexcept { +void VulkanStagePool::terminate() noexcept { for (auto stage : mUsedStages) { vmaDestroyBuffer(mAllocator, stage->buffer, stage->memory); delete stage; @@ -209,8 +208,6 @@ void VulkanStagePool::reset() noexcept { delete image; } mFreeStages.clear(); - - mCommands.reset(); } } // namespace filament::backend diff --git a/filament/backend/src/vulkan/VulkanStagePool.h b/filament/backend/src/vulkan/VulkanStagePool.h index 95f32f7e02..65a67b0ce7 100644 --- a/filament/backend/src/vulkan/VulkanStagePool.h +++ b/filament/backend/src/vulkan/VulkanStagePool.h @@ -45,7 +45,7 @@ struct VulkanStageImage { // This class manages two types of host-mappable staging areas: buffer stages and image stages. class VulkanStagePool { public: - void initialize(VmaAllocator allocator, std::shared_ptr commands) noexcept; + void initialize(VmaAllocator allocator, VulkanCommands* commands) noexcept; // Finds or creates a stage whose capacity is at least the given number of bytes. // The stage is automatically released back to the pool after TIME_BEFORE_EVICTION frames. @@ -60,11 +60,11 @@ public: // Destroys all unused stages and asserts that there are no stages currently in use. // This should be called while the context's VkDevice is still alive. - void reset() noexcept; + void terminate() noexcept; private: VmaAllocator mAllocator; - std::shared_ptr mCommands; + VulkanCommands* mCommands; // Use an ordered multimap for quick (capacity => stage) lookups using lower_bound(). std::multimap mFreeStages; diff --git a/filament/backend/src/vulkan/VulkanSwapChain.cpp b/filament/backend/src/vulkan/VulkanSwapChain.cpp index f563f61514..cd996c0de5 100644 --- a/filament/backend/src/vulkan/VulkanSwapChain.cpp +++ b/filament/backend/src/vulkan/VulkanSwapChain.cpp @@ -26,8 +26,8 @@ using namespace utils; namespace filament::backend { VulkanSwapChain::VulkanSwapChain(VulkanPlatform* platform, VulkanContext const& context, - VmaAllocator allocator, std::shared_ptr commands, - VulkanStagePool& stagePool, void* nativeWindow, uint64_t flags, VkExtent2D extent) + VmaAllocator allocator, VulkanCommands* commands, VulkanStagePool& stagePool, + void* nativeWindow, uint64_t flags, VkExtent2D extent) : mPlatform(platform), mCommands(commands), mAllocator(allocator), @@ -48,6 +48,11 @@ VulkanSwapChain::VulkanSwapChain(VulkanPlatform* platform, VulkanContext const& } VulkanSwapChain::~VulkanSwapChain() { + // Must wait for the inflight command buffers to finish since they might contain the images + // we're about to destroy. + mCommands->flush(); + mCommands->wait(); + mPlatform->destroy(swapChain); vkDestroySemaphore(mPlatform->getDevice(), mImageReady, VKALLOC); } @@ -60,11 +65,11 @@ void VulkanSwapChain::update() { VkDevice const device = mPlatform->getDevice(); for (auto const color: bundle.colors) { - mColors.push_back(std::make_shared(device, mAllocator, mCommands, color, + mColors.push_back(std::make_unique(device, mAllocator, mCommands, color, bundle.colorFormat, 1, bundle.extent.width, bundle.extent.height, TextureUsage::COLOR_ATTACHMENT, mStagePool)); } - mDepth = std::make_shared(device, mAllocator, mCommands, bundle.depth, + mDepth = std::make_unique(device, mAllocator, mCommands, bundle.depth, bundle.depthFormat, 1, bundle.extent.width, bundle.extent.height, TextureUsage::DEPTH_ATTACHMENT, mStagePool); diff --git a/filament/backend/src/vulkan/VulkanSwapChain.h b/filament/backend/src/vulkan/VulkanSwapChain.h index 4e593fc759..e89d75f598 100644 --- a/filament/backend/src/vulkan/VulkanSwapChain.h +++ b/filament/backend/src/vulkan/VulkanSwapChain.h @@ -37,7 +37,7 @@ struct VulkanSurfaceSwapChain; // A wrapper around the platform implementation of swapchain. struct VulkanSwapChain : public HwSwapChain { VulkanSwapChain(VulkanPlatform* platform, VulkanContext const& context, VmaAllocator allocator, - std::shared_ptr commands, VulkanStagePool& stagePool, + VulkanCommands* commands, VulkanStagePool& stagePool, void* nativeWindow, uint64_t flags, VkExtent2D extent = {0, 0}); ~VulkanSwapChain(); @@ -46,12 +46,12 @@ struct VulkanSwapChain : public HwSwapChain { void acquire(bool& reized); - inline std::shared_ptr getCurrentColor() const noexcept { - return mColors[mCurrentSwapIndex]; + inline VulkanTexture* getCurrentColor() const noexcept { + return mColors[mCurrentSwapIndex].get(); } - inline std::shared_ptr getDepth() const noexcept { - return mDepth; + inline VulkanTexture* getDepth() const noexcept { + return mDepth.get(); } inline bool isFirstRenderPass() const noexcept { @@ -70,16 +70,15 @@ private: void update(); VulkanPlatform* mPlatform; - std::shared_ptr mCommands; + VulkanCommands* mCommands; VmaAllocator mAllocator; VulkanStagePool& mStagePool; bool const mHeadless; // We create VulkanTextures based on VkImages. VulkanTexture has facilities for doing layout - // transitions, which are useful here. We use std::shared_ptr because they will be shared with - // VulkanRenderTarget. - utils::FixedCapacityVector> mColors; - std::shared_ptr mDepth; + // transitions, which are useful here. + utils::FixedCapacityVector> mColors; + std::unique_ptr mDepth; VkExtent2D mExtent; VkSemaphore mImageReady; uint32_t mCurrentSwapIndex; diff --git a/filament/backend/src/vulkan/VulkanTexture.cpp b/filament/backend/src/vulkan/VulkanTexture.cpp index c0bdf45ec6..98ec6d739f 100644 --- a/filament/backend/src/vulkan/VulkanTexture.cpp +++ b/filament/backend/src/vulkan/VulkanTexture.cpp @@ -30,7 +30,7 @@ namespace filament::backend { using ImgUtil = VulkanImageUtility; VulkanTexture::VulkanTexture(VkDevice device, VmaAllocator allocator, - std::shared_ptr commands, VkImage image, VkFormat format, uint8_t samples, + VulkanCommands* commands, VkImage image, VkFormat format, uint8_t samples, uint32_t width, uint32_t height, TextureUsage tusage, VulkanStagePool& stagePool) : HwTexture(SamplerType::SAMPLER_2D, 1, samples, width, height, 1, TextureFormat::UNUSED, tusage), @@ -47,7 +47,7 @@ VulkanTexture::VulkanTexture(VkDevice device, VmaAllocator allocator, VulkanTexture::VulkanTexture(VkDevice device, VkPhysicalDevice physicalDevice, VulkanContext const& context, VmaAllocator allocator, - std::shared_ptr commands, SamplerType target, uint8_t levels, + VulkanCommands* commands, SamplerType target, uint8_t levels, TextureFormat tformat, uint8_t samples, uint32_t w, uint32_t h, uint32_t depth, TextureUsage tusage, VulkanStagePool& stagePool, VkComponentMapping swizzle) : HwTexture(target, levels, samples, w, h, depth, tformat, tusage), diff --git a/filament/backend/src/vulkan/VulkanTexture.h b/filament/backend/src/vulkan/VulkanTexture.h index 1d8f338c0a..05eafae6b5 100644 --- a/filament/backend/src/vulkan/VulkanTexture.h +++ b/filament/backend/src/vulkan/VulkanTexture.h @@ -28,17 +28,15 @@ namespace filament::backend { struct VulkanTexture : public HwTexture { // Standard constructor for user-facing textures. VulkanTexture(VkDevice device, VkPhysicalDevice physicalDevice, VulkanContext const& context, - VmaAllocator allocator, std::shared_ptr commands, SamplerType target, - uint8_t levels, TextureFormat tformat, uint8_t samples, uint32_t w, uint32_t h, - uint32_t depth, TextureUsage tusage, VulkanStagePool& stagePool, - VkComponentMapping swizzle={}); + VmaAllocator allocator, VulkanCommands* commands, SamplerType target, uint8_t levels, + TextureFormat tformat, uint8_t samples, uint32_t w, uint32_t h, uint32_t depth, + TextureUsage tusage, VulkanStagePool& stagePool, VkComponentMapping swizzle = {}); // Specialized constructor for internally created textures (e.g. from a swap chain) // The texture will never destroy the given VkImage, but it does manages its subresources. - VulkanTexture(VkDevice device, - VmaAllocator allocator, std::shared_ptr commands, VkImage image, - VkFormat format, uint8_t samples, uint32_t width, uint32_t height, TextureUsage tusage, - VulkanStagePool& stagePool); + VulkanTexture(VkDevice device, VmaAllocator allocator, VulkanCommands* commands, VkImage image, + VkFormat format, uint8_t samples, uint32_t width, uint32_t height, TextureUsage tusage, + VulkanStagePool& stagePool); ~VulkanTexture(); @@ -68,12 +66,12 @@ struct VulkanTexture : public HwTexture { VulkanLayout getLayout(uint32_t layer, uint32_t level) const; - void setSidecar(std::shared_ptr sidecar) { - mSidecarMSAA = sidecar; + void setSidecar(VulkanTexture* sidecar) { + mSidecarMSAA.reset(sidecar); } - std::shared_ptr getSidecar() const { - return mSidecarMSAA; + VulkanTexture* getSidecar() const { + return mSidecarMSAA.get(); } void transitionLayout(VkCommandBuffer commands, const VkImageSubresourceRange& range, @@ -96,7 +94,8 @@ private: void updateImageWithBlit(const PixelBufferDescriptor& hostData, uint32_t width, uint32_t height, uint32_t depth, uint32_t miplevel); - std::shared_ptr mSidecarMSAA; + // The texture with the sidecar owns the sidecar. + std::unique_ptr mSidecarMSAA; const VkFormat mVkFormat; const VkImageViewType mViewType; const VkComponentMapping mSwizzle; @@ -114,7 +113,7 @@ private: VulkanStagePool& mStagePool; VkDevice mDevice; VmaAllocator mAllocator; - std::shared_ptr mCommands; + VulkanCommands* mCommands; }; } // namespace filament::backend diff --git a/filament/backend/src/vulkan/platform/VulkanPlatform.cpp b/filament/backend/src/vulkan/platform/VulkanPlatform.cpp index 1373620112..9a8e36669d 100644 --- a/filament/backend/src/vulkan/platform/VulkanPlatform.cpp +++ b/filament/backend/src/vulkan/platform/VulkanPlatform.cpp @@ -198,7 +198,7 @@ ExtensionSet getDeviceExtensions(VkPhysicalDevice device) { return exts; } -VkInstance createInstance(const ExtensionSet& requiredExts) { +VkInstance createInstance(ExtensionSet const& requiredExts) { VkInstance instance; VkInstanceCreateInfo instanceCreateInfo = {}; bool validationFeaturesSupported = false; @@ -363,6 +363,13 @@ std::tuple pruneExtensions(VkPhysicalDevice device, && newDeviceExts.find(VK_EXT_DEBUG_MARKER_EXTENSION_NAME) != newDeviceExts.end()) { newDeviceExts.erase(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); } + + // debugMarker must also request debugReport the instance extension. So check if that's present. + if (newDeviceExts.find(VK_EXT_DEBUG_MARKER_EXTENSION_NAME) != newDeviceExts.end() + && newInstExts.find(VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == newInstExts.end()) { + newDeviceExts.erase(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); + } + return std::tuple(newInstExts, newDeviceExts); } From c2b10859c9cc0a4d81ab4d038e89ad48d6330241 Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Wed, 7 Jun 2023 19:30:31 -0500 Subject: [PATCH 02/22] Temporarily disable Metal relaxed to half pass due to spirv-cross bug (#6880) --- libs/filamat/src/GLSLPostProcessor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp index 629340c560..e1187a6d23 100644 --- a/libs/filamat/src/GLSLPostProcessor.cpp +++ b/libs/filamat/src/GLSLPostProcessor.cpp @@ -568,12 +568,13 @@ std::shared_ptr GLSLPostProcessor::createOptimizer( } else if (optimization == MaterialBuilder::Optimization::PERFORMANCE) { registerPerformancePasses(*optimizer, config); // Metal doesn't support relaxed precision, but does have support for float16 math operations. - if (config.targetApi == MaterialBuilder::TargetApi::METAL) { - optimizer->RegisterPass(CreateConvertRelaxedToHalfPass()); - optimizer->RegisterPass(CreateSimplificationPass()); - optimizer->RegisterPass(CreateRedundancyEliminationPass()); - optimizer->RegisterPass(CreateAggressiveDCEPass()); - } + // TODO(bendoherty): investgiate recent half fp breakage with spirv-cross + // if (config.targetApi == MaterialBuilder::TargetApi::METAL) { + // optimizer->RegisterPass(CreateConvertRelaxedToHalfPass()); + // optimizer->RegisterPass(CreateSimplificationPass()); + // optimizer->RegisterPass(CreateRedundancyEliminationPass()); + // optimizer->RegisterPass(CreateAggressiveDCEPass()); + // } } return optimizer; From 11adcbed256950bab7af3a4161ca85cc6a529d73 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 7 Jun 2023 21:57:17 -0700 Subject: [PATCH 03/22] fix VSM's high precision option on mobile (#6873) the math needs to be maintained in highp, including during the blur pass. we add the ability to specify a "precision" qualifier to the "output" of a post-process material. we also remove the mediump clamping we used to do on mobile, it shouldn't be done automatically behind the scenes, it's up to the shaders to do it if it makes sense. --- NEW_RELEASE_NOTES.md | 2 ++ .../src/materials/separableGaussianBlur.fs | 6 ++--- .../src/materials/separableGaussianBlur.mat | 13 ++++++--- .../filamat/include/filamat/MaterialBuilder.h | 9 ++++--- libs/filamat/src/MaterialBuilder.cpp | 7 ++--- libs/filamat/src/shaders/CodeGenerator.cpp | 17 +++++++----- libs/filamat/src/shaders/CodeGenerator.h | 1 + libs/filamat/src/shaders/ShaderGenerator.cpp | 2 +- shaders/src/depth_main.fs | 2 +- shaders/src/post_process.fs | 27 ------------------- shaders/src/post_process_inputs.fs | 16 +++++------ shaders/src/shadowing.fs | 4 +-- tools/matc/src/matc/ParametersProcessor.cpp | 20 +++++++++++++- 13 files changed, 65 insertions(+), 61 deletions(-) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index 4a1a9c7fa7..d5fa37e154 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -7,3 +7,5 @@ for next branch cut* header. appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut + +- matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] diff --git a/filament/src/materials/separableGaussianBlur.fs b/filament/src/materials/separableGaussianBlur.fs index a3d9a9b32b..1667eae239 100644 --- a/filament/src/materials/separableGaussianBlur.fs +++ b/filament/src/materials/separableGaussianBlur.fs @@ -2,7 +2,7 @@ float vmax(const float v) { return v; } -vec4 sourceTexLod(const highp vec2 p, float m, float l) { +highp vec4 sourceTexLod(const highp vec2 p, float m, float l) { // This condition is optimized away at compile-time. if (materialConstants_arraySampler) { return textureLod(materialParams_sourceArray, vec3(p, l), m); @@ -12,12 +12,12 @@ vec4 sourceTexLod(const highp vec2 p, float m, float l) { } void tap(inout highp vec4 sum, const float weight, const highp vec2 position) { - vec4 s = sourceTexLod(position, materialParams.level, materialParams.layer); + highp vec4 s = sourceTexLod(position, materialParams.level, materialParams.layer); sum += s * weight; } void tapReinhard(inout highp vec4 sum, inout float totalWeight, const float weight, const highp vec2 position) { - vec4 s = sourceTexLod(position, materialParams.level, materialParams.layer); + highp vec4 s = sourceTexLod(position, materialParams.level, materialParams.layer); float w = weight / (1.0 + vmax(s)); totalWeight += w; sum += s * w; diff --git a/filament/src/materials/separableGaussianBlur.mat b/filament/src/materials/separableGaussianBlur.mat index c1649c999a..1276ea90e8 100644 --- a/filament/src/materials/separableGaussianBlur.mat +++ b/filament/src/materials/separableGaussianBlur.mat @@ -4,12 +4,12 @@ material { { type : sampler2d, name : source, - precision: medium + precision: high }, { type : sampler2dArray, name : sourceArray, - precision: medium + precision: high }, { type : float2, @@ -36,6 +36,13 @@ material { name : kernel } ], + outputs : [ + { + type : float4, + name : color, + precision : high + } + ], constants : [ { type : bool, @@ -61,7 +68,5 @@ vertex { } fragment { - #include "separableGaussianBlur.fs" - } diff --git a/libs/filamat/include/filamat/MaterialBuilder.h b/libs/filamat/include/filamat/MaterialBuilder.h index 9c129ed7e5..c48adb7921 100644 --- a/libs/filamat/include/filamat/MaterialBuilder.h +++ b/libs/filamat/include/filamat/MaterialBuilder.h @@ -576,7 +576,7 @@ public: MaterialBuilder& shaderDefine(const char* name, const char* value) noexcept; //! Add a new fragment shader output variable. Only valid for materials in the POST_PROCESS domain. - MaterialBuilder& output(VariableQualifier qualifier, OutputTarget target, + MaterialBuilder& output(VariableQualifier qualifier, OutputTarget target, Precision precision, OutputType type, const char* name, int location = -1) noexcept; MaterialBuilder& enableFramebufferFetch() noexcept; @@ -650,13 +650,14 @@ public: struct Output { Output() noexcept = default; Output(const char* outputName, VariableQualifier qualifier, OutputTarget target, - OutputType type, int location) noexcept - : name(outputName), qualifier(qualifier), target(target), type(type), - location(location) { } + Precision precision, OutputType type, int location) noexcept + : name(outputName), qualifier(qualifier), target(target), precision(precision), + type(type), location(location) { } utils::CString name; VariableQualifier qualifier; OutputTarget target; + Precision precision; OutputType type; int location; }; diff --git a/libs/filamat/src/MaterialBuilder.cpp b/libs/filamat/src/MaterialBuilder.cpp index 2aeedb6515..63237de7df 100644 --- a/libs/filamat/src/MaterialBuilder.cpp +++ b/libs/filamat/src/MaterialBuilder.cpp @@ -1006,7 +1006,7 @@ bool MaterialBuilder::generateShaders(JobSystem& jobSystem, const std::vectorgetType() != JsonishValue::STRING) { + std::cerr << "parameters: precision must be a STRING." << std::endl; + return false; + } + + auto precisionString = precisionValue->toJsonString(); + if (!Enums::isValid(precisionString->getString())){ + return logEnumIssue("parameters", *precisionString, Enums::map()); + } + } + const JsonishValue* typeValue = jsonObject.getValue("type"); if (typeValue) { if (typeValue->getType() != JsonishValue::STRING) { @@ -860,6 +873,11 @@ static bool processOutput(MaterialBuilder& builder, const JsonishObject& jsonObj target = Enums::toEnum(targetValue->toJsonString()->getString()); } + ParameterPrecision precision = ParameterPrecision::DEFAULT; + if (precisionValue) { + precision = Enums::toEnum(precisionValue->toJsonString()->getString()); + } + OutputType type = OutputType::FLOAT4; if (target == OutputTarget::DEPTH) { // The default type for depth targets is float. @@ -879,7 +897,7 @@ static bool processOutput(MaterialBuilder& builder, const JsonishObject& jsonObj location = static_cast(locationValue->toJsonNumber()->getFloat()); } - builder.output(qualifier, target, type, name, location); + builder.output(qualifier, target, precision, type, name, location); return true; } From 8030a078ff2cb0c4b82e9ecdf50a905058297ede Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Thu, 8 Jun 2023 10:06:52 -0700 Subject: [PATCH 04/22] vulkan: sRGB swapchain (#6879) --- NEW_RELEASE_NOTES.md | 1 + .../backend/platforms/VulkanPlatform.h | 9 +++++ filament/backend/src/vulkan/VulkanContext.h | 19 ---------- filament/backend/src/vulkan/VulkanDriver.cpp | 18 +++++++-- .../src/vulkan/platform/VulkanPlatform.cpp | 14 +------ .../platform/VulkanPlatformSwapChainImpl.cpp | 37 ++++++++++++------- .../platform/VulkanPlatformSwapChainImpl.h | 5 ++- 7 files changed, 53 insertions(+), 50 deletions(-) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index d5fa37e154..82ba62a10f 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -9,3 +9,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut - matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] +- vulkan: support sRGB swap chain \ No newline at end of file diff --git a/filament/backend/include/backend/platforms/VulkanPlatform.h b/filament/backend/include/backend/platforms/VulkanPlatform.h index f3d37d8da9..87ffc44c5d 100644 --- a/filament/backend/include/backend/platforms/VulkanPlatform.h +++ b/filament/backend/include/backend/platforms/VulkanPlatform.h @@ -110,6 +110,15 @@ public: // -------- End platform customization options -------- // ---------------------------------------------------- + /** + * Returns whether the platform supports sRGB swapchain. This is true by default, and the client + * needs to override this method to specify otherwise. + * @return Whether the platform supports sRGB swapchain. + */ + virtual bool isSRGBSwapChainSupported() const { + return true; + } + /** * Get the images handles and format of the memory backing the swapchain. This should be called * after createSwapChain() or after recreateIfResized(). diff --git a/filament/backend/src/vulkan/VulkanContext.h b/filament/backend/src/vulkan/VulkanContext.h index 713abdc8fc..0355ed4c4e 100644 --- a/filament/backend/src/vulkan/VulkanContext.h +++ b/filament/backend/src/vulkan/VulkanContext.h @@ -123,22 +123,6 @@ public: inline bool isDebugUtilsSupported() const noexcept { return mDebugUtilsSupported; } - inline bool isPortabilitySubsetSupported() const noexcept { - return mPortabilitySubsetSupported; - } - inline bool isPortabilityEnumerationSupported() const noexcept { - return mPortabilityEnumerationSupported; - } - - inline bool isMaintenance1Supported() const noexcept { - return mMaintenanceSupported[0]; - } - inline bool isMaintenance2Supported() const noexcept { - return mMaintenanceSupported[1]; - } - inline bool isMaintenance3Supported() const noexcept { - return mMaintenanceSupported[2]; - } private: VkPhysicalDeviceMemoryProperties mMemoryProperties = {}; @@ -146,9 +130,6 @@ private: VkPhysicalDeviceFeatures mPhysicalDeviceFeatures = {}; bool mDebugMarkersSupported = false; bool mDebugUtilsSupported = false; - bool mPortabilitySubsetSupported = false; - bool mPortabilityEnumerationSupported = false; - bool mMaintenanceSupported[3] = {}; VkFormat mDepthFormat; diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 05a866b4ae..132609672c 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -511,12 +511,24 @@ void VulkanDriver::createSyncR(Handle sh, int) { } void VulkanDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t flags) { + if ((flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0 && + !isSRGBSwapChainSupported()) { + utils::slog.w << "sRGB swapchain requested, but Platform does not support it" + << utils::io::endl; + flags = flags | ~(backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE); + } construct(sch, mPlatform, mContext, mAllocator, mCommands.get(), mStagePool, nativeWindow, flags); } void VulkanDriver::createSwapChainHeadlessR(Handle sch, uint32_t width, uint32_t height, uint64_t flags) { + if ((flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0 && + !isSRGBSwapChainSupported()) { + utils::slog.w << "sRGB swapchain requested, but Platform does not support it" + << utils::io::endl; + flags = flags | ~(backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE); + } assert_invariant(width > 0 && height > 0 && "Vulkan requires non-zero swap chain dimensions."); construct(sch, mPlatform, mContext, mAllocator, mCommands.get(), mStagePool, nullptr, flags, VkExtent2D{width, height}); @@ -747,8 +759,7 @@ bool VulkanDriver::isAutoDepthResolveSupported() { } bool VulkanDriver::isSRGBSwapChainSupported() { - // TODO: implement SWAP_CHAIN_CONFIG_SRGB_COLORSPACE - return false; + return mPlatform->isSRGBSwapChainSupported(); } bool VulkanDriver::isWorkaroundNeeded(Workaround workaround) { @@ -1439,7 +1450,8 @@ void VulkanDriver::readPixels(Handle src, uint32_t x, uint32_t y VulkanTexture* srcTexture = (VulkanTexture*) srcTarget->getColor(0).texture; assert_invariant(srcTexture); const VkFormat srcFormat = srcTexture->getVkFormat(); - const bool swizzle = srcFormat == VK_FORMAT_B8G8R8A8_UNORM; + const bool swizzle = srcFormat == VK_FORMAT_B8G8R8A8_UNORM || + srcFormat == VK_FORMAT_B8G8R8A8_SRGB; // Create a host visible, linearly tiled image as a staging area. VkImageCreateInfo imageInfo { diff --git a/filament/backend/src/vulkan/platform/VulkanPlatform.cpp b/filament/backend/src/vulkan/platform/VulkanPlatform.cpp index 9a8e36669d..2fdda1888f 100644 --- a/filament/backend/src/vulkan/platform/VulkanPlatform.cpp +++ b/filament/backend/src/vulkan/platform/VulkanPlatform.cpp @@ -659,18 +659,8 @@ Driver* VulkanPlatform::createDriver(void* sharedContext, // Store the extension support in the context context.mDebugUtilsSupported = instExts.find(VK_EXT_DEBUG_UTILS_EXTENSION_NAME) != instExts.end(); - context.mPortabilityEnumerationSupported - = instExts.find(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) != instExts.end(); context.mDebugMarkersSupported = deviceExts.find(VK_EXT_DEBUG_MARKER_EXTENSION_NAME) != deviceExts.end(); - context.mPortabilitySubsetSupported - = deviceExts.find(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) != deviceExts.end(); - context.mMaintenanceSupported[0] - = deviceExts.find(VK_KHR_MAINTENANCE1_EXTENSION_NAME) != deviceExts.end(); - context.mMaintenanceSupported[1] - = deviceExts.find(VK_KHR_MAINTENANCE2_EXTENSION_NAME) != deviceExts.end(); - context.mMaintenanceSupported[2] - = deviceExts.find(VK_KHR_MAINTENANCE3_EXTENSION_NAME) != deviceExts.end(); // Choose a depth format that meets our requirements. Take care not to include stencil formats // just yet, since that would require a corollary change to the "aspect" flags for the VkImage. @@ -728,7 +718,7 @@ SwapChainPtr VulkanPlatform::createSwapChain(void* nativeWindow, uint64_t flags, bool const headless = extent.width != 0 && extent.height != 0; if (headless) { VulkanPlatformHeadlessSwapChain* swapchain = new VulkanPlatformHeadlessSwapChain( - mImpl->mContext, mImpl->mDevice, mImpl->mGraphicsQueue, extent); + mImpl->mContext, mImpl->mDevice, mImpl->mGraphicsQueue, extent, flags); mImpl->mHeadlessSwapChains.insert(swapchain); return swapchain; } @@ -737,7 +727,7 @@ SwapChainPtr VulkanPlatform::createSwapChain(void* nativeWindow, uint64_t flags, // The VulkanPlatformSurfaceSwapChain now `owns` the surface. VulkanPlatformSurfaceSwapChain* swapchain = new VulkanPlatformSurfaceSwapChain(mImpl->mContext, mImpl->mPhysicalDevice, mImpl->mDevice, mImpl->mGraphicsQueue, mImpl->mInstance, - surface, fallbackExtent); + surface, fallbackExtent, flags); mImpl->mSurfaceSwapChains.insert(swapchain); return swapchain; } diff --git a/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.cpp b/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.cpp index 2eb564b8bf..41a4f89111 100644 --- a/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.cpp +++ b/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.cpp @@ -19,6 +19,8 @@ #include "vulkan/VulkanConstants.h" #include "vulkan/VulkanUtility.h" +#include + using namespace bluevk; using namespace utils; @@ -102,12 +104,13 @@ VkImage VulkanPlatformSwapChainImpl::createImage(VkExtent2D extent, VkFormat for VulkanPlatformSurfaceSwapChain::VulkanPlatformSurfaceSwapChain(VulkanContext const& context, VkPhysicalDevice physicalDevice, VkDevice device, VkQueue queue, VkInstance instance, - VkSurfaceKHR surface, VkExtent2D fallbackExtent) + VkSurfaceKHR surface, VkExtent2D fallbackExtent, uint64_t flags) : VulkanPlatformSwapChainImpl(context, device, queue), mInstance(instance), mPhysicalDevice(physicalDevice), mSurface(surface), - mFallbackExtent(fallbackExtent) { + mFallbackExtent(fallbackExtent), + mUsesRGB((flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0) { assert_invariant(surface); create(); } @@ -141,18 +144,22 @@ VkResult VulkanPlatformSurfaceSwapChain::create() { } // Find a suitable surface format. - if (surfaceFormat.format == VK_FORMAT_UNDEFINED) { - FixedCapacityVector const surfaceFormats - = enumerate(vkGetPhysicalDeviceSurfaceFormatsKHR, mPhysicalDevice, mSurface); - surfaceFormat = surfaceFormats[0]; - for (const VkSurfaceFormatKHR& format: surfaceFormats) { - if (format.format == VK_FORMAT_R8G8B8A8_UNORM - || format.format == VK_FORMAT_B8G8R8A8_UNORM) { - surfaceFormat = format; - break; - } + FixedCapacityVector const surfaceFormats + = enumerate(vkGetPhysicalDeviceSurfaceFormatsKHR, mPhysicalDevice, mSurface); + FixedCapacityVector expectedFormats + = {VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM}; + if (mUsesRGB) { + expectedFormats = {VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_B8G8R8A8_SRGB}; + } + for (VkSurfaceFormatKHR const& format: surfaceFormats) { + if (std::any_of(expectedFormats.begin(), expectedFormats.end(), + [&format](VkFormat f) { return f == format.format; })) { + surfaceFormat = format; + break; } } + ASSERT_POSTCONDITION(surfaceFormat.format != VK_FORMAT_UNDEFINED, + "Cannot find suitable swapchain format"); // Verify that our chosen present mode is supported. In practice all devices support the FIFO // mode, but we check for it anyway for completeness. (and to avoid validation warnings) @@ -281,11 +288,13 @@ VkResult VulkanPlatformSurfaceSwapChain::recreate() { } VulkanPlatformHeadlessSwapChain::VulkanPlatformHeadlessSwapChain(VulkanContext const& context, - VkDevice device, VkQueue queue, VkExtent2D extent) + VkDevice device, VkQueue queue, VkExtent2D extent, uint64_t flags) : VulkanPlatformSwapChainImpl(context, device, queue), mCurrentIndex(0) { mSwapChainBundle.extent = extent; - mSwapChainBundle.colorFormat = VK_FORMAT_R8G8B8A8_UNORM; + mSwapChainBundle.colorFormat = (flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0 + ? VK_FORMAT_R8G8B8A8_SRGB + : VK_FORMAT_R8G8B8A8_UNORM; auto& images = mSwapChainBundle.colors; images.reserve(HEADLESS_SWAPCHAIN_SIZE); diff --git a/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.h b/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.h index 0e92f532d1..ae2d022bb4 100644 --- a/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.h +++ b/filament/backend/src/vulkan/platform/VulkanPlatformSwapChainImpl.h @@ -81,7 +81,7 @@ protected: struct VulkanPlatformSurfaceSwapChain : public VulkanPlatformSwapChainImpl { VulkanPlatformSurfaceSwapChain(VulkanContext const& context, VkPhysicalDevice physicalDevice, VkDevice device, VkQueue queue, VkInstance instance, VkSurfaceKHR surface, - VkExtent2D fallbackExtent); + VkExtent2D fallbackExtent, uint64_t flags); ~VulkanPlatformSurfaceSwapChain(); @@ -107,6 +107,7 @@ private: VkSwapchainKHR mSwapchain = VK_NULL_HANDLE; VkExtent2D const mFallbackExtent; + bool mUsesRGB = false; bool mSuboptimal; }; @@ -114,7 +115,7 @@ struct VulkanPlatformHeadlessSwapChain : public VulkanPlatformSwapChainImpl { static constexpr size_t const HEADLESS_SWAPCHAIN_SIZE = 2; VulkanPlatformHeadlessSwapChain(VulkanContext const& context, VkDevice device, VkQueue queue, - VkExtent2D extent); + VkExtent2D extent, uint64_t flags); ~VulkanPlatformHeadlessSwapChain(); From c1f164190b659eb53348785b5f36d7a411928e3a Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Thu, 8 Jun 2023 14:00:05 -0500 Subject: [PATCH 05/22] Re-enable Metal half conversion, only register SimplificationPasses for Metal (#6883) --- libs/filamat/src/GLSLPostProcessor.cpp | 86 ++++++++++++++------------ 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp index e1187a6d23..a538d02118 100644 --- a/libs/filamat/src/GLSLPostProcessor.cpp +++ b/libs/filamat/src/GLSLPostProcessor.cpp @@ -568,13 +568,12 @@ std::shared_ptr GLSLPostProcessor::createOptimizer( } else if (optimization == MaterialBuilder::Optimization::PERFORMANCE) { registerPerformancePasses(*optimizer, config); // Metal doesn't support relaxed precision, but does have support for float16 math operations. - // TODO(bendoherty): investgiate recent half fp breakage with spirv-cross - // if (config.targetApi == MaterialBuilder::TargetApi::METAL) { - // optimizer->RegisterPass(CreateConvertRelaxedToHalfPass()); - // optimizer->RegisterPass(CreateSimplificationPass()); - // optimizer->RegisterPass(CreateRedundancyEliminationPass()); - // optimizer->RegisterPass(CreateAggressiveDCEPass()); - // } + if (config.targetApi == MaterialBuilder::TargetApi::METAL) { + optimizer->RegisterPass(CreateConvertRelaxedToHalfPass()); + optimizer->RegisterPass(CreateSimplificationPass()); + optimizer->RegisterPass(CreateRedundancyEliminationPass()); + optimizer->RegisterPass(CreateAggressiveDCEPass()); + } } return optimizer; @@ -609,40 +608,49 @@ void GLSLPostProcessor::registerPerformancePasses(Optimizer& optimizer, Config c // (https://github.com/KhronosGroup/SPIRV-Cross/issues/2162) // - generally it makes the code more complicated, e.g.: replacing for loops with // while-if-break, unclear if it helps for anything. + // However, the simplification passes below are necessary when targeting Metal, otherwise the + // result is mismatched half / float assignments in MSL. - optimizer.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()) - ; + auto RegisterPass = [&](spvtools::Optimizer::PassToken&& pass, + MaterialBuilder::TargetApi apiFilter = + MaterialBuilder::TargetApi::ALL) { + if (!(config.targetApi & apiFilter)) { + return; + } + optimizer.RegisterPass(std::move(pass)); + }; + 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(), MaterialBuilder::TargetApi::METAL); + RegisterPass(CreateVectorDCEPass()); + RegisterPass(CreateDeadInsertElimPass()); + RegisterPass(CreateDeadBranchElimPass()); + RegisterPass(CreateSimplificationPass(), MaterialBuilder::TargetApi::METAL); + RegisterPass(CreateIfConversionPass()); + RegisterPass(CreateCopyPropagateArraysPass()); + RegisterPass(CreateReduceLoadSizePass()); + RegisterPass(CreateAggressiveDCEPass()); + RegisterPass(CreateBlockMergePass()); + RegisterPass(CreateRedundancyEliminationPass()); + RegisterPass(CreateDeadBranchElimPass()); + RegisterPass(CreateBlockMergePass()); + RegisterPass(CreateSimplificationPass(), MaterialBuilder::TargetApi::METAL); } void GLSLPostProcessor::registerSizePasses(Optimizer& optimizer, Config const& config) { From e306856c4fbb3da48826e25aef3adafdf0d6308d Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 9 Jun 2023 12:08:03 -0700 Subject: [PATCH 06/22] update spirv-cross (#6881) --- .../spirv-cross/.github/workflows/main.yml | 12 +- third_party/spirv-cross/CMakeLists.txt | 18 +- third_party/spirv-cross/main.cpp | 4 + .../pkg-config/spirv-cross-c-shared.pc.in | 2 +- .../pkg-config/spirv-cross-c.pc.in | 15 + .../asm/comp/access-chain-invalidate.asm.comp | 19 + .../asm/comp/atomic-decrement.asm.comp | 22 + .../asm/comp/atomic-increment.asm.comp | 22 + .../asm/comp/bitcast_icmp.asm.comp | 20 + .../asm/comp/block-name-alias-global.asm.comp | 39 + .../asm/comp/control-flow-hints.asm.comp | 41 + .../comp/global-parameter-name-alias.asm.comp | 9 + .../asm/comp/nmin-max-clamp.asm.comp | 87 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 30 + ...ctured-buffers.structured.fxconly.asm.frag | 26 + .../asm/frag/cbuffer-stripped.asm.frag | 26 + .../asm/frag/combined-sampler-reuse.asm.frag | 30 + .../asm/frag/empty-struct.asm.frag | 8 + .../opt/shaders-hlsl/asm/frag/frem.asm.frag | 29 + .../asm/frag/function-overload-alias.asm.frag | 19 + .../asm/frag/image-extract-reuse.asm.frag | 31 + .../asm/frag/implicit-read-dep-phi.asm.frag | 57 + .../asm/frag/inf-nan-constant.asm.frag | 19 + .../asm/frag/line-directive.line.asm.frag | 91 + .../frag/lut-promotion-initializer.asm.frag | 57 + ...d-unpack-uint2.fxconly.nofxc.sm60.asm.frag | 19 + .../asm/frag/pass-by-value.asm.frag | 25 + .../asm/frag/sample-and-compare.asm.frag | 30 + .../frag/single-function-private-lut.asm.frag | 63 + .../opt/shaders-hlsl/asm/frag/srem.asm.frag | 29 + .../storage-class-output-initializer.asm.frag | 23 + .../structured-buffer.structured.asm.frag | 26 + .../asm/frag/texel-fetch-no-lod.asm.frag | 30 + .../asm/frag/texture-sampling-fp16.asm.frag | 29 + .../asm/frag/unknown-depth-state.asm.frag | 31 + .../asm/frag/unreachable.asm.frag | 40 + ...act-transposed-matrix-from-struct.asm.vert | 45 + .../vert/spec-constant-op-composite.asm.vert | 42 + .../vert/uint-vertex-id-instance-id.asm.vert | 28 + .../asm/vert/vertex-id-instance-id.asm.vert | 28 + .../comp/access-chain-load-composite.comp | 108 + .../opt/shaders-hlsl/comp/access-chains.comp | 23 + .../comp/access-chains.force-uav.comp | 23 + .../shaders-hlsl/comp/address-buffers.comp | 17 + .../opt/shaders-hlsl/comp/atomic.comp | 91 + .../opt/shaders-hlsl/comp/barriers.comp | 26 + .../opt/shaders-hlsl/comp/builtins.comp | 11 + .../comp/composite-array-initialization.comp | 50 + .../shaders-hlsl/comp/globallycoherent.comp | 18 + .../opt/shaders-hlsl/comp/image.comp | 66 + .../comp/image.nonwritable-uav-texture.comp | 66 + .../opt/shaders-hlsl/comp/inverse.comp | 124 + .../comp/num-workgroups-alone.comp | 19 + .../comp/num-workgroups-with-builtins.comp | 26 + .../opt/shaders-hlsl/comp/outer-product.comp | 50 + .../comp/rayquery.nofxc.fxconly.comp | 242 + .../opt/shaders-hlsl/comp/rmw-matrix.comp | 22 + .../shaders-hlsl/comp/rwbuffer-matrix.comp | 93 + ...alar-std450-distance-length-normalize.comp | 16 + .../opt/shaders-hlsl/comp/shared.comp | 29 + .../comp/spec-constant-op-member-array.comp | 51 + .../comp/spec-constant-work-group-size.comp | 43 + .../shaders-hlsl/comp/ssbo-array-length.comp | 17 + .../opt/shaders-hlsl/comp/ssbo-array.comp | 11 + .../shaders-hlsl/flatten/array.flatten.vert | 28 + .../shaders-hlsl/flatten/basic.flatten.vert | 35 + .../shaders-hlsl/flatten/copy.flatten.vert | 50 + .../shaders-hlsl/flatten/dynamic.flatten.vert | 49 + .../flatten/matrix-conversion.flatten.frag | 29 + .../flatten/matrixindex.flatten.vert | 41 + .../flatten/multiindex.flatten.vert | 28 + .../flatten/push-constant.flatten.vert | 35 + .../flatten/rowmajor.flatten.vert | 28 + .../shaders-hlsl/flatten/struct.flatten.vert | 44 + .../flatten/struct.rowmajor.flatten.vert | 43 + .../shaders-hlsl/flatten/swizzle.flatten.vert | 45 + .../shaders-hlsl/flatten/types.flatten.frag | 23 + .../frag/array-lut-no-loop-variable.frag | 27 + .../frag/basic-color-3comp.sm30.frag | 26 + .../frag/basic-color-3comp.sm50.frag | 26 + .../opt/shaders-hlsl/frag/basic.frag | 32 + .../shaders-hlsl/frag/bit-conversions.frag | 26 + .../opt/shaders-hlsl/frag/boolean-mix.frag | 27 + .../opt/shaders-hlsl/frag/builtins.frag | 34 + .../shaders-hlsl/frag/bvec-operations.frag | 29 + .../shaders-hlsl/frag/clip-cull-distance.frag | 30 + .../combined-texture-sampler-parameter.frag | 24 + .../frag/combined-texture-sampler-shadow.frag | 23 + .../complex-expression-in-access-chain.frag | 38 + .../frag/constant-composites.frag | 38 + .../control-dependent-in-branch.desktop.frag | 55 + .../shaders-hlsl/frag/demote-to-helper.frag | 9 + .../shaders-hlsl/frag/depth-greater-than.frag | 19 + .../shaders-hlsl/frag/depth-less-than.frag | 19 + .../frag/dual-source-blending.frag | 23 + .../frag/early-fragment-test.frag | 9 + .../frag/for-loop-continue-control-flow.frag | 25 + .../opt/shaders-hlsl/frag/fp16-packing.frag | 44 + .../opt/shaders-hlsl/frag/front-facing.frag | 39 + .../opt/shaders-hlsl/frag/hyperbolic.frag | 65 + .../frag/image-query-selective.frag | 8 + .../shaders-hlsl/frag/image-query-uav.frag | 8 + ...age-query-uav.nonwritable-uav-texture.frag | 8 + .../opt/shaders-hlsl/frag/image-query.frag | 8 + .../frag/input-attachment-ms.frag | 33 + .../shaders-hlsl/frag/input-attachment.frag | 30 + .../opt/shaders-hlsl/frag/io-block.frag | 34 + .../frag/legacy-tex-modifiers.sm30.frag | 32 + .../opt/shaders-hlsl/frag/lut-promotion.frag | 55 + .../opt/shaders-hlsl/frag/matrix-input.frag | 26 + .../reference/opt/shaders-hlsl/frag/mod.frag | 67 + .../reference/opt/shaders-hlsl/frag/mrt.frag | 31 + .../opt/shaders-hlsl/frag/no-return.frag | 8 + .../opt/shaders-hlsl/frag/no-return2.frag | 8 + ...orm-qualifier.nonuniformresource.sm51.frag | 111 + .../frag/partial-write-preserve.frag | 8 + .../pixel-interlock-ordered.sm51.fxconly.frag | 24 + .../shaders-hlsl/frag/point-coord-compat.frag | 19 + .../shaders-hlsl/frag/query-lod.desktop.frag | 31 + .../readonly-coherent-ssbo.force-uav.frag | 21 + .../frag/readonly-coherent-ssbo.frag | 21 + .../opt/shaders-hlsl/frag/resources.frag | 41 + .../frag/row-major-layout-in-struct.frag | 38 + .../frag/sample-cmp-level-zero.frag | 41 + .../frag/sample-mask-in-and-out.frag | 30 + .../opt/shaders-hlsl/frag/sample-mask-in.frag | 32 + .../shaders-hlsl/frag/sample-mask-out.frag | 23 + .../opt/shaders-hlsl/frag/sampler-array.frag | 31 + .../frag/sampler-image-arrays.frag | 39 + .../frag/scalar-refract-reflect.frag | 49 + .../separate-combined-fake-overload.sm30.frag | 22 + .../frag/spec-constant-block-size.frag | 37 + .../frag/spec-constant-ternary.frag | 26 + .../frag/switch-unreachable-break.frag | 49 + .../frag/switch-unsigned-case.frag | 38 + .../opt/shaders-hlsl/frag/swizzle-scalar.frag | 41 + .../shaders-hlsl/frag/tex-sampling-ms.frag | 34 + .../opt/shaders-hlsl/frag/tex-sampling.frag | 69 + .../shaders-hlsl/frag/tex-sampling.sm30.frag | 54 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 32 + .../frag/texture-proj-shadow.frag | 52 + .../texture-size-combined-image-sampler.frag | 30 + .../opt/shaders-hlsl/frag/unary-enclose.frag | 26 + .../frag/unorm-snorm-packing.frag | 111 + .../shaders-hlsl/frag/various-glsl-ops.frag | 26 + ...-shader-basic-lines.spv14.vk.nocompat.mesh | 90 + ...ader-basic-triangle.spv14.vk.nocompat.mesh | 90 + .../task/task-basic.spv14.vk.nocompat.task | 24 + .../opt/shaders-hlsl/vert/basic.vert | 39 + .../shaders-hlsl/vert/clip-cull-distance.vert | 28 + .../opt/shaders-hlsl/vert/instancing.vert | 28 + .../opt/shaders-hlsl/vert/invariant.vert | 39 + .../vert/legacy-int-attribute.sm30.vert | 36 + .../opt/shaders-hlsl/vert/locations.vert | 75 + .../shaders-hlsl/vert/matrix-attribute.vert | 35 + .../opt/shaders-hlsl/vert/matrix-output.vert | 23 + .../opt/shaders-hlsl/vert/no-contraction.vert | 39 + .../opt/shaders-hlsl/vert/no-input.vert | 18 + .../shaders-hlsl/vert/point-size-compat.vert | 20 + .../shaders-hlsl/vert/point-size.sm30.vert | 26 + .../opt/shaders-hlsl/vert/qualifiers.vert | 56 + .../vert/read-from-row-major-array.vert | 36 + .../opt/shaders-hlsl/vert/return-array.vert | 26 + .../shaders-hlsl/vert/sampler-buffers.vert | 22 + .../vert/struct-composite-decl.vert | 44 + .../opt/shaders-hlsl/vert/texture_buffer.vert | 21 + .../amd/shader_trinary_minmax.msl21.comp | 11 + .../asm/comp/atomic-decrement.asm.comp | 27 + .../asm/comp/atomic-increment.asm.comp | 27 + .../asm/comp/bitcast_iadd.asm.comp | 29 + .../asm/comp/bitcast_icmp.asm.comp | 29 + .../shaders-msl/asm/comp/bitcast_sar.asm.comp | 31 + .../asm/comp/bitcast_sdiv.asm.comp | 31 + .../shaders-msl/asm/comp/bitcast_slr.asm.comp | 31 + .../asm/comp/block-name-alias-global.asm.comp | 46 + .../comp/buffer-write-relative-addr.asm.comp | 29 + .../asm/comp/buffer-write.asm.comp | 24 + .../comp/copy-object-ssbo-to-ssbo.asm.comp | 23 + .../asm/comp/copy-object-ubo-to-ssbo.asm.comp | 24 + .../asm/comp/duplicate-spec-id.asm.comp | 20 + .../comp/global-parameter-name-alias.asm.comp | 9 + ...e-load-store-short-vector.invalid.asm.comp | 22 + .../asm/comp/multiple-entry.asm.comp | 29 + ...p-spec-constant-op-vector-related.asm.comp | 110 + .../shaders-msl/asm/comp/quantize.asm.comp | 34 + .../asm/comp/relaxed-block-layout.asm.comp | 22 + ...specialization-constant-workgroup.asm.comp | 21 + .../struct-resource-name-aliasing.asm.comp | 16 + .../asm/comp/uint_smulextended.asm.comp | 25 + .../undefined-constant-composite.asm.comp | 28 + ...undefined-spec-constant-composite.asm.comp | 31 + .../asm/comp/variable-pointers-2.asm.comp | 51 + ...ariable-pointers-store-forwarding.asm.comp | 25 + .../vector-builtin-type-cast-func.asm.comp | 28 + .../comp/vector-builtin-type-cast.asm.comp | 28 + .../asm/frag/combined-sampler-reuse.asm.frag | 23 + .../asm/frag/default-member-names.asm.frag | 19 + .../depth-image-color-format-fetch.asm.frag | 33 + .../depth-image-color-format-sampled.asm.frag | 33 + .../frag/descriptor-array-unnamed.asm.frag | 48 + ...isable-renamed-output.frag-output.asm.frag | 35 + .../asm/frag/empty-struct.asm.frag | 9 + .../extract-packed-from-composite.asm.frag | 30 + .../opt/shaders-msl/asm/frag/frem.asm.frag | 23 + .../asm/frag/function-overload-alias.asm.frag | 17 + .../asm/frag/image-extract-reuse.asm.frag | 17 + .../asm/frag/implicit-read-dep-phi.asm.frag | 50 + .../asm/frag/inf-nan-constant.asm.frag | 17 + .../interpolation-qualifiers-struct.asm.frag | 47 + .../asm/frag/line-directive.line.asm.frag | 87 + .../asm/frag/locations-components.asm.frag | 35 + .../frag/lut-promotion-initializer.asm.frag | 94 + .../asm/frag/min-lod.msl22.asm.frag | 22 + .../asm/frag/op-constant-null.asm.frag | 17 + .../asm/frag/op-image-sampled-image.asm.frag | 22 + .../asm/frag/pass-by-value.asm.frag | 22 + .../asm/frag/phi-loop-variable.asm.frag | 9 + .../pull-model-interpolation.asm.msl23.frag | 181 + .../asm/frag/sample-and-compare.asm.frag | 22 + .../frag/single-function-private-lut.asm.frag | 79 + .../opt/shaders-msl/asm/frag/srem.asm.frag | 23 + .../storage-class-output-initializer.asm.frag | 65 + .../asm/frag/switch-different-sizes.asm.frag | 9 + .../asm/frag/switch-long-case.asm.msl22.frag | 9 + .../switch-unsigned-long-case.asm.msl22.frag | 9 + .../asm/frag/texel-fetch-no-lod.asm.frag | 17 + .../asm/frag/texture-atomics.asm.frag | 121 + ...re-atomics.asm.graphics-robust-access.frag | 122 + .../asm/frag/texture-sampling-fp16.asm.frag | 22 + .../asm/frag/undef-variable-store.asm.frag | 17 + .../asm/frag/unknown-depth-state.asm.frag | 22 + .../asm/frag/unord-relational-op.asm.frag | 22 + .../unord-relational-op.relax-nan.asm.frag | 22 + .../shaders-msl/asm/frag/unreachable.asm.frag | 36 + .../asm/frag/vector-shuffle-oom.asm.frag | 277 + .../asm/tesc/tess-level-overrun.asm.tesc | 23 + .../tess-level-overrun.multi-patch.asm.tesc | 24 + .../asm/tese/unnamed-builtin-array.asm.tese | 73 + .../clip-distance-plain-variable.asm.vert | 29 + ...ce-plain-variable.no-user-varying.asm.vert | 25 + .../asm/vert/copy-memory-interface.asm.vert | 25 + ...act-transposed-matrix-from-struct.asm.vert | 35 + .../asm/vert/fake-builtin-input.asm.vert | 23 + .../asm/vert/invariant.msl21.asm.vert | 17 + .../asm/vert/packed-bool-to-uint.asm.vert | 38 + .../packed-bool2-to-packed_uint2.asm.vert | 38 + .../asm/vert/packing-test.asm.vert | 9 + .../vert/spec-constant-op-composite.asm.vert | 35 + .../vert/uint-vertex-id-instance-id.asm.vert | 17 + .../access-private-workgroup-in-function.comp | 11 + ...ffers-discrete.msl2.argument.discrete.comp | 42 + ...rs-image-load-store.ios.msl2.argument.comp | 11 + ...uffers-image-load-store.msl2.argument.comp | 17 + .../opt/shaders-msl/comp/array-length.comp | 31 + .../array-length.msl2.argument.discrete.comp | 56 + .../shaders-msl/comp/atomic-float.msl3.comp | 20 + .../opt/shaders-msl/comp/atomic.comp | 72 + .../opt/shaders-msl/comp/barriers.comp | 22 + .../reference/opt/shaders-msl/comp/basic.comp | 35 + .../shaders-msl/comp/basic.dispatchbase.comp | 38 + .../comp/basic.dispatchbase.msl11.comp | 36 + .../comp/basic.inline-block.msl2.comp | 53 + ...-vec-and-cast-to-and-from-uvec2.msl23.comp | 28 + ...dress-recursive-struct-pointers.msl23.comp | 96 + .../comp/buffer_device_address.msl2.comp | 56 + .../opt/shaders-msl/comp/builtins.comp | 11 + .../comp/cfg-preserve-parameter.comp | 9 + .../opt/shaders-msl/comp/coherent-block.comp | 17 + .../opt/shaders-msl/comp/coherent-image.comp | 17 + .../complex-composite-constant-array.comp | 59 + .../shaders-msl/comp/complex-type-alias.comp | 56 + .../comp/composite-array-initialization.comp | 78 + ...ray-initialization.force-native-array.comp | 148 + .../shaders-msl/comp/composite-construct.comp | 66 + .../comp/copy-array-of-arrays.comp | 20 + ...py-array-of-arrays.force-native-array.comp | 20 + .../opt/shaders-msl/comp/culling.comp | 35 + .../opt/shaders-msl/comp/defer-parens.comp | 24 + .../opt/shaders-msl/comp/dowhile.comp | 42 + .../comp/force-recompile-hooks.swizzle.comp | 73 + .../opt/shaders-msl/comp/functions.comp | 9 + ...vocation-id-writable-ssbo-in-function.comp | 26 + .../comp/global-invocation-id.comp | 26 + ...omic-automatic-bindings.argument.msl2.comp | 37 + .../comp/image-atomic-automatic-bindings.comp | 28 + .../comp/image-cube-array-load-store.comp | 12 + .../reference/opt/shaders-msl/comp/image.comp | 13 + .../opt/shaders-msl/comp/insert.comp | 18 + .../opt/shaders-msl/comp/inverse.comp | 130 + .../shaders-msl/comp/local-invocation-id.comp | 26 + .../comp/local-invocation-index.comp | 26 + .../comp/local-size-duplicate-spec-id.comp | 23 + .../comp/mat3-row-maj-read-write-const.comp | 20 + .../reference/opt/shaders-msl/comp/mat3.comp | 17 + .../reference/opt/shaders-msl/comp/mod.comp | 33 + .../reference/opt/shaders-msl/comp/modf.comp | 24 + .../opt/shaders-msl/comp/outer-product.comp | 40 + .../opt/shaders-msl/comp/packing-test-1.comp | 28 + .../opt/shaders-msl/comp/packing-test-2.comp | 28 + ....discrete.device-argument-buffer.msl2.comp | 116 + ...iptor-aliasing.argument.discrete.msl2.comp | 116 + .../comp/ray-query.nocompat.spv14.vk.comp | 91 + ...ray-query.spv14.vk.ios.msl24..invalid.comp | 71 + .../opt/shaders-msl/comp/read-write-only.comp | 31 + .../opt/shaders-msl/comp/rmw-matrix.comp | 24 + .../opt/shaders-msl/comp/rmw-opt.comp | 27 + ...alar-std450-distance-length-normalize.comp | 25 + .../comp/shared-array-of-arrays.comp | 20 + .../comp/shared-matrix-array-of-array.comp | 1353 ++ .../shaders-msl/comp/shared-matrix-cast.comp | 1017 + .../shared-matrix-nested-struct-array.comp | 1369 ++ .../comp/shared-matrix-nested-struct.comp | 1443 ++ .../comp/shared-struct-bool-cast.comp | 63 + .../opt/shaders-msl/comp/shared.comp | 25 + .../comp/spec-constant-op-member-array.comp | 49 + .../comp/spec-constant-work-group-size.comp | 75 + .../storage-buffer-std140-vector-array.comp | 91 + .../opt/shaders-msl/comp/struct-layout.comp | 27 + .../opt/shaders-msl/comp/struct-nested.comp | 27 + .../opt/shaders-msl/comp/struct-packing.comp | 152 + .../comp/threadgroup-boolean-workaround.comp | 20 + .../opt/shaders-msl/comp/torture-loop.comp | 44 + .../opt/shaders-msl/comp/type-alias.comp | 37 + .../comp/type_casting_i64.msl22.comp | 27 + .../reference/opt/shaders-msl/comp/udiv.comp | 22 + .../opt/shaders-msl/comp/writable-ssbo.comp | 26 + .../comp/extended-arithmetic.desktop.comp | 179 + .../desktop-only/frag/image-ms.desktop.frag | 11 + .../frag/query-levels.desktop.frag | 17 + .../frag/sampler-ms-query.desktop.frag | 17 + .../tesc/arrayed-output.desktop.sso.tesc | 85 + .../tesc/basic.desktop.sso.multi-patch.tesc | 39 + .../desktop-only/tesc/basic.desktop.sso.tesc | 39 + .../struct-copy.desktop.sso.multi-patch.tesc | 36 + .../tesc/struct-copy.desktop.sso.tesc | 40 + .../tese/triangle.desktop.sso.tese | 27 + .../desktop-only/vert/basic.desktop.sso.vert | 30 + ...ull-distance..no-user-varying.desktop.vert | 20 + .../vert/clip-cull-distance.desktop.vert | 24 + ...ader-draw-parameters.desktop.for-tess.vert | 20 + .../vert/shader-draw-parameters.desktop.vert | 17 + .../shaders-msl/flatten/basic.flatten.vert | 30 + .../flatten/multiindex.flatten.vert | 27 + .../flatten/push-constant.flatten.vert | 32 + .../shaders-msl/flatten/rowmajor.flatten.vert | 29 + .../shaders-msl/flatten/struct.flatten.vert | 40 + .../shaders-msl/flatten/swizzle.flatten.vert | 47 + .../shaders-msl/flatten/types.flatten.frag | 35 + .../frag/argument-buffers.msl2.argument.frag | 73 + .../shaders-msl/frag/array-component-io.frag | 99 + .../frag/array-lut-no-loop-variable.frag | 66 + .../shaders-msl/frag/array-of-array-lut.frag | 68 + ...niform.msl2.argument.discrete.swizzle.frag | 105 + ...zzle-nonconstant-uniform.msl2.swizzle.frag | 96 + ...wizzle.msl2.argument.discrete.swizzle.frag | 97 + ...array-of-texture-swizzle.msl2.swizzle.frag | 86 + .../frag/barycentric-nv-nopersp.msl22.frag | 28 + .../frag/barycentric-nv.msl22.frag | 28 + .../shaders-msl/frag/basic.force-sample.frag | 23 + .../reference/opt/shaders-msl/frag/basic.frag | 23 + .../binary-func-unpack-pack-arguments.frag | 28 + .../frag/binary-unpack-pack-arguments.frag | 28 + .../shaders-msl/frag/bitcasting.1d-as-2d.frag | 26 + .../opt/shaders-msl/frag/bitcasting.frag | 26 + .../shaders-msl/frag/buffer-read-write.frag | 27 + ...ead-write.texture-buffer-native.msl21.frag | 18 + .../opt/shaders-msl/frag/builtins.frag | 24 + .../frag/clip-distance-varying.frag | 67 + .../complex-expression-in-access-chain.frag | 29 + .../composite-extract-forced-temporary.frag | 24 + .../opt/shaders-msl/frag/constant-array.frag | 76 + .../shaders-msl/frag/constant-composites.frag | 74 + .../control-dependent-in-branch.desktop.frag | 45 + .../frag/cull-distance-varying.frag | 67 + ...exture-lod.lod-as-grad.1d-as-2d.msl23.frag | 23 + .../shaders-msl/frag/depth-greater-than.frag | 17 + .../opt/shaders-msl/frag/depth-less-than.frag | 17 + .../frag/depth-out-early-frag-tests.frag | 19 + .../frag/depth-out-no-early-frag-tests.frag | 19 + .../frag/disable-frag-output.frag-output.frag | 35 + .../frag/dual-source-blending.frag | 19 + .../frag/early-fragment-tests.frag | 17 + .../opt/shaders-msl/frag/false-loop-init.frag | 28 + .../opt/shaders-msl/frag/flush_params.frag | 17 + .../frag/for-loop-continue-control-flow.frag | 23 + .../opt/shaders-msl/frag/for-loop-init.frag | 71 + .../opt/shaders-msl/frag/fp16-packing.frag | 25 + ...ag-demote-checks.discard-checks.msl23.frag | 65 + ...s-continue-block.discard-checks.msl23.frag | 40 + ...g-discard-checks.discard-checks.msl23.frag | 64 + ...agment-component-padding.pad-fragment.frag | 76 + .../opt/shaders-msl/frag/front-facing.frag | 30 + .../opt/shaders-msl/frag/gather-dref.frag | 22 + .../opt/shaders-msl/frag/gather-offset.frag | 17 + .../frag/helper-invocation.msl21.frag | 31 + ....device-argument-buffer.argument.msl2.frag | 44 + .../shaders-msl/frag/illegal-name-test-0.frag | 17 + .../frag/image-query-lod.msl22.frag | 70 + .../opt/shaders-msl/frag/in_block.frag | 32 + ...ck_with_multiple_structs_of_same_type.frag | 105 + .../opt/shaders-msl/frag/in_mat.frag | 37 + ...t-attachment-ms.arrayed-subpass.msl21.frag | 18 + .../shaders-msl/frag/input-attachment-ms.frag | 18 + .../input-attachment-ms.multiview.msl21.frag | 19 + .../input-attachment.arrayed-subpass.frag | 17 + .../shaders-msl/frag/input-attachment.frag | 17 + .../frag/input-attachment.multiview.frag | 18 + .../frag/interpolation-qualifiers-block.frag | 47 + .../frag/interpolation-qualifiers.frag | 28 + .../opt/shaders-msl/frag/lut-promotion.frag | 92 + .../reference/opt/shaders-msl/frag/mix.frag | 28 + .../frag/modf-access-tracking-function.frag | 24 + .../opt/shaders-msl/frag/mrt-array.frag | 82 + .../frag/nonuniform-qualifier.msl2.frag | 53 + .../packed-expression-vector-shuffle.frag | 27 + .../opt/shaders-msl/frag/packing-test-3.frag | 28 + ...pixel-interlock-ordered.msl2.argument.frag | 53 + .../frag/pixel-interlock-ordered.msl2.frag | 41 + .../reference/opt/shaders-msl/frag/pls.frag | 31 + .../frag/post-depth-coverage.ios.msl2.frag | 17 + .../frag/post-depth-coverage.msl23.frag | 17 + ...rivate-variable-prototype-declaration.frag | 17 + ...ery-object-in-function.spv14.vk.msl24.frag | 45 + .../read-cull-clip-distance-in-function.frag | 72 + .../opt/shaders-msl/frag/readonly-ssbo.frag | 22 + ...return-value-after-discard-terminator.frag | 25 + ...e-depth-propagate-state-from-resource.frag | 23 + .../sample-depth-separate-image-sampler.frag | 17 + ...nd-out.fixed-sample-mask.force-sample.frag | 20 + ...ple-mask-in-and-out.fixed-sample-mask.frag | 20 + ...ample-mask-not-used.fixed-sample-mask.frag | 19 + .../frag/sample-mask.fixed-sample-mask.frag | 20 + .../opt/shaders-msl/frag/sample-mask.frag | 19 + .../frag/sample-position-func.frag | 23 + .../opt/shaders-msl/frag/sample-position.frag | 18 + .../sample-rate-frag-coord-sample-id.frag | 19 + .../sample-rate-frag-coord-sample-input.frag | 24 + .../sample-rate-frag-coord-sample-pos.frag | 19 + .../sample-rate-frag-coord.force-sample.frag | 18 + .../frag/sampler-1d-lod.1d-as-2d.frag | 22 + .../opt/shaders-msl/frag/sampler-1d-lod.frag | 22 + .../sampler-compare-bias.msl23.1d-as-2d.frag | 22 + .../sampler-compare-cascade-gradient.frag | 22 + .../sampler-compare-cascade-gradient.ios.frag | 22 + ...ampler-compare-cascade-gradient.msl23.frag | 22 + .../frag/sampler-image-arrays.msl2.frag | 28 + .../opt/shaders-msl/frag/sampler-ms.frag | 18 + .../opt/shaders-msl/frag/sampler.frag | 23 + .../frag/scalar-refract-reflect.frag | 49 + .../frag/separate-image-sampler-argument.frag | 17 + .../frag/shader-arithmetic-8bit.frag | 53 + .../frag/spec-constant-block-size.frag | 32 + .../frag/spec-constant-ternary.frag | 22 + .../frag/stencil-export.msl21.frag | 22 + .../frag/subgroup-builtins.msl22.frag | 18 + .../frag/subgroup-globals-extract.msl22.frag | 56 + .../frag/switch-unreachable-break.frag | 43 + .../frag/switch-unsigned-case.frag | 35 + .../opt/shaders-msl/frag/swizzle.frag | 30 + .../frag/texel-fetch-offset.1d-as-2d.frag | 18 + .../shaders-msl/frag/texel-fetch-offset.frag | 19 + .../shaders-msl/frag/texture-cube-array.frag | 22 + ...ure-cube-array.ios.emulate-cube-array.frag | 58 + .../frag/texture-multisample-array.msl21.frag | 23 + .../shaders-msl/frag/texture-proj-shadow.frag | 30 + .../opt/shaders-msl/frag/ubo_layout.frag | 37 + .../opt/shaders-msl/frag/unary-enclose.frag | 22 + .../frag/vecsize-mismatch.shader-inputs.frag | 75 + .../frag/write-depth-in-function.frag | 19 + .../intel/shader-integer-functions2.asm.comp | 31 + .../legacy/vert/transpose.legacy.vert | 29 + ...rays.mask-location-0.msl2.multi-patch.tesc | 188 + .../copy-arrays.mask-location-0.msl2.tesc | 191 + ...rays.mask-location-1.msl2.multi-patch.tesc | 79 + .../copy-arrays.mask-location-1.msl2.tesc | 83 + ...utputs-block.mask-location-0.for-tess.vert | 35 + ...te-outputs-block.mask-location-0.msl2.tesc | 41 + ...lock.mask-location-0.multi-patch.msl2.tesc | 44 + .../write-outputs-block.mask-location-0.vert | 34 + ...utputs-block.mask-location-1.for-tess.vert | 35 + ...te-outputs-block.mask-location-1.msl2.tesc | 41 + ...lock.mask-location-1.multi-patch.msl2.tesc | 44 + .../write-outputs-block.mask-location-1.vert | 34 + .../write-outputs.mask-clip-distance.vert | 67 + ...rite-outputs.mask-location-0.for-tess.vert | 68 + .../write-outputs.mask-location-0.msl2.tesc | 34 + ...e-outputs.mask-location-0.multi-patch.tesc | 81 + .../write-outputs.mask-location-0.tesc | 78 + .../write-outputs.mask-location-0.vert | 30 + ...rite-outputs.mask-location-1.for-tess.vert | 68 + .../write-outputs.mask-location-1.msl2.tesc | 33 + ...e-outputs.mask-location-1.multi-patch.tesc | 40 + .../write-outputs.mask-location-1.tesc | 37 + .../write-outputs.mask-location-1.vert | 30 + ...rite-outputs.mask-point-size.for-tess.vert | 68 + ...e-outputs.mask-point-size.multi-patch.tesc | 89 + .../write-outputs.mask-point-size.tesc | 86 + .../write-outputs.mask-point-size.vert | 30 + ...ite-outputs.mask-position.multi-patch.tesc | 89 + .../masking/write-outputs.mask-position.tesc | 86 + .../tesc/arrayed-block-io.multi-patch.tesc | 123 + .../shaders-msl/tesc/basic.multi-patch.tesc | 23 + .../reference/opt/shaders-msl/tesc/basic.tesc | 22 + ...control-point-inout-types.multi-patch.tesc | 128 + .../complex-control-point-inout-types.tesc | 132 + .../tesc/complex-patch-out-types.tesc | 107 + ...rol-point-array-of-matrix.multi-patch.tesc | 24 + .../load-control-point-array-of-matrix.tesc | 30 + ...rol-point-array-of-struct.multi-patch.tesc | 73 + .../load-control-point-array-of-struct.tesc | 81 + .../load-control-point-array.multi-patch.tesc | 25 + .../tesc/load-control-point-array.tesc | 26 + .../tesc/matrix-output.multi-patch.tesc | 41 + .../tesc/reload-tess-level.multi-patch.tesc | 35 + .../shaders-msl/tesc/reload-tess-level.tesc | 35 + .../tesc/struct-output.multi-patch.tesc | 48 + .../tesc/water_tess.multi-patch.tesc | 91 + .../opt/shaders-msl/tesc/water_tess.tesc | 93 + .../tese/in-array-of-struct.raw-tess-in.tese | 72 + ...-block-with-nested-struct.raw-tess-in.tese | 38 + .../tese/in-block-with-nested-struct.tese | 43 + .../opt/shaders-msl/tese/input-array.tese | 29 + .../tese/input-types.raw-tess-in.tese | 70 + .../opt/shaders-msl/tese/input-types.tese | 76 + .../load-control-point-array-of-matrix.tese | 85 + .../tese/load-control-point-array.tese | 78 + .../opt/shaders-msl/tese/quad.domain.tese | 74 + .../reference/opt/shaders-msl/tese/quad.tese | 73 + .../read-tess-level-in-func-quad.msl2.tese | 72 + ...s-level-in-func-quad.raw-tess-in.msl2.tese | 66 + .../tese/read-tess-level-in-func.msl2.tese | 69 + ...d-tess-level-in-func.raw-tess-in.msl2.tese | 64 + .../shaders-msl/tese/set-from-function.tese | 55 + .../shaders-msl/tese/triangle-tess-level.tese | 69 + .../opt/shaders-msl/tese/triangle.tese | 17 + .../tese/water_tess.raw-tess-in.tese | 46 + .../opt/shaders-msl/tese/water_tess.tese | 45 + .../vert/array-component-io.for-tess.vert | 98 + .../shaders-msl/vert/array-component-io.vert | 100 + .../opt/shaders-msl/vert/basic.capture.vert | 29 + .../opt/shaders-msl/vert/basic.for-tess.vert | 31 + .../reference/opt/shaders-msl/vert/basic.vert | 30 + .../vert/buffer_device_address.msl2.vert | 62 + .../clip-distance-block.no-user-varying.vert | 25 + .../shaders-msl/vert/clip-distance-block.vert | 29 + .../opt/shaders-msl/vert/copy.flatten.vert | 45 + .../opt/shaders-msl/vert/dynamic.flatten.vert | 45 + .../vert/float-math.invariant-float-math.vert | 137 + .../opt/shaders-msl/vert/float-math.vert | 88 + .../opt/shaders-msl/vert/functions.vert | 122 + .../shaders-msl/vert/implicit-position-1.vert | 18 + .../shaders-msl/vert/implicit-position-2.vert | 9 + .../shaders-msl/vert/in_out_array_mat.vert | 108 + .../interface-block-block-composites.frag | 99 + .../interface-block-block-composites.vert | 105 + .../interface-block-single-element-array.vert | 79 + .../vert/interpolation-qualifiers-block.vert | 55 + .../vert/interpolation-qualifiers.vert | 36 + .../opt/shaders-msl/vert/invariant.msl21.vert | 25 + .../vert/leaf-function.capture.vert | 29 + .../vert/leaf-function.for-tess.vert | 31 + .../opt/shaders-msl/vert/no-contraction.vert | 88 + .../no-disable-vertex-out.frag-output.vert | 28 + .../vert/no_stage_out.for-tess.vert | 23 + .../opt/shaders-msl/vert/no_stage_out.vert | 20 + .../vert/no_stage_out.write_buff.vert | 37 + .../vert/no_stage_out.write_buff_atomic.vert | 30 + .../vert/no_stage_out.write_tex.vert | 27 + .../out-block-with-nested-struct-array.vert | 88 + .../vert/out-block-with-struct-array.vert | 83 + .../opt/shaders-msl/vert/out_block.vert | 41 + .../shaders-msl/vert/packed-bool-to-uint.vert | 38 + .../vert/packed-bool2-to-packed_uint2.vert | 38 + .../opt/shaders-msl/vert/packed_matrix.vert | 47 + .../opt/shaders-msl/vert/pointsize.vert | 33 + .../vert/read-from-row-major-array.vert | 29 + .../vert/resource-arrays-leaf.ios.vert | 42 + .../shaders-msl/vert/resource-arrays.ios.vert | 42 + .../vert/return-array.force-native-array.vert | 22 + .../opt/shaders-msl/vert/return-array.vert | 22 + .../shaders-msl/vert/set_builtin_in_func.vert | 19 + .../opt/shaders-msl/vert/sign-int-types.vert | 60 + .../signedness-mismatch.shader-inputs.vert | 74 + ...re_buffer.texture-buffer-native.msl21.vert | 17 + .../opt/shaders-msl/vert/texture_buffer.vert | 26 + .../opt/shaders-msl/vert/ubo.alignment.vert | 38 + .../reference/opt/shaders-msl/vert/ubo.vert | 30 + .../uniform-struct-out-of-order-offests.vert | 32 + .../vert/uniform-struct-packing-nested.vert | 52 + .../opt/shaders-msl/vert/unused-position.vert | 18 + ...asic.multiview.no-layered.nocompat.vk.frag | 73 + .../frag/basic.multiview.nocompat.vk.frag | 73 + ...lper-forwarding.asm.vk.nocompat.msl23.frag | 24 + .../demote-to-helper.vk.nocompat.msl23.frag | 13 + ...emote-to-helper.vk.nocompat.msl23.ios.frag | 13 + .../vulkan/frag/push-constant.vk.frag | 28 + .../vulkan/frag/spec-constant.msl11.vk.frag | 26 + .../vulkan/frag/spec-constant.vk.frag | 22 + ...oup.multiview.viewfromdev.nocompat.vk.vert | 19 + .../vulkan/vert/device-group.nocompat.vk.vert | 18 + ...view.multiview.no-layered.nocompat.vk.vert | 28 + .../vert/multiview.multiview.nocompat.vk.vert | 31 + .../vulkan/vert/multiview.nocompat.vk.vert | 29 + .../vulkan/vert/small-storage.vk.vert | 48 + .../vulkan/vert/vulkan-vertex.vk.vert | 17 + .../asm/frag/depth-compare.asm.frag | 321 + .../asm/frag/global-constant-arrays.asm.frag | 1073 + .../padded-float-array-member-defef.asm.frag | 1121 + .../asm/frag/sample-mask-not-array.asm.frag | 503 + ...bpass-input.ios.framebuffer-fetch.asm.frag | 213 + ...ass-input.msl23.framebuffer-fetch.asm.frag | 213 + .../texture-atomics.asm.argument.msl2.frag | 84 + .../asm/frag/texture-atomics.asm.frag | 76 + ...re-atomics.asm.graphics-robust-access.frag | 77 + .../hs-incorrect-base-type.invalid.asm.tesc | 395 + .../hs-input-array-access.invalid.asm.tesc | 463 + .../tesc/hs-texcoord-array.invalid.asm.tesc | 407 + ...actor-must-be-threadgroup.invalid.asm.tesc | 174 + .../asm/tese/ds-double-gl-in-deref.asm.tese | 418 + .../asm/tese/ds-patch-input-fixes.asm.tese | 416 + .../asm/tese/ds-patch-inputs.asm.tese | 215 + .../asm/vert/array-missing-copies.asm.vert | 457 + .../asm/vert/texture-buffer.asm.vert | 387 + .../reference/opt/shaders/amd/gcn_shader.comp | 15 + .../opt/shaders/amd/shader_ballot.comp | 33 + .../opt/shaders/amd/shader_group_vote.comp | 14 + .../shaders/amd/shader_trinary_minmax.comp | 8 + .../asm/comp/atomic-decrement.asm.comp | 16 + .../asm/comp/atomic-increment.asm.comp | 16 + .../shaders/asm/comp/bitcast_iadd.asm.comp | 27 + .../shaders/asm/comp/bitcast_icmp.asm.comp | 27 + .../shaders/asm/comp/bitcast_iequal.asm.comp | 33 + .../opt/shaders/asm/comp/bitcast_sar.asm.comp | 29 + .../shaders/asm/comp/bitcast_sdiv.asm.comp | 29 + .../opt/shaders/asm/comp/bitcast_slr.asm.comp | 29 + .../asm/comp/block-name-alias-global.asm.comp | 37 + .../asm/comp/builtin-compute-bitcast.asm.comp | 13 + .../asm/comp/control-flow-hints.asm.comp | 58 + .../asm/comp/decoration-group.asm.comp | 38 + .../comp/global-parameter-name-alias.asm.comp | 7 + .../asm/comp/hlsl-functionality.asm.comp | 19 + .../opt/shaders/asm/comp/logical.asm.comp | 7 + .../shaders/asm/comp/multiple-entry.asm.comp | 27 + .../shaders/asm/comp/nmin-max-clamp.asm.comp | 47 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 42 + .../opt/shaders/asm/comp/op-phi-swap.asm.comp | 39 + .../opt/shaders/asm/comp/quantize.asm.comp | 19 + .../asm/comp/recompile-block-naming.asm.comp | 35 + ...specialization-constant-workgroup.asm.comp | 21 + .../comp/switch-break-ladder.asm.invalid.comp | 64 + .../undefined-constant-composite.asm.comp | 26 + .../frag/combined-sampler-reuse.vk.asm.frag | 13 + .../combined-sampler-reuse.vk.asm.frag.vk | 14 + .../frag/complex-name-workarounds.asm.frag | 15 + ...osite-construct-struct-no-swizzle.asm.frag | 12 + .../asm/frag/default-member-names.asm.frag | 11 + .../frag/do-while-statement-fallback.asm.frag | 9 + .../shaders/asm/frag/empty-struct.asm.frag | 6 + .../frag/for-loop-phi-only-continue.asm.frag | 17 + .../opt/shaders/asm/frag/frem.asm.frag | 13 + .../asm/frag/function-overload-alias.asm.frag | 11 + .../hlsl-sample-cmp-level-zero-cube.asm.frag | 11 + .../frag/hlsl-sample-cmp-level-zero.asm.frag | 14 + .../asm/frag/image-extract-reuse.asm.frag | 11 + .../frag/image-fetch-no-sampler.asm.vk.frag | 13 + .../image-fetch-no-sampler.asm.vk.frag.vk | 14 + ...etch-no-sampler.no-samplerless.asm.vk.frag | 13 + ...h-no-sampler.no-samplerless.asm.vk.frag.vk | 14 + ...uery-no-sampler.no-samplerless.vk.asm.frag | 6 + ...y-no-sampler.no-samplerless.vk.asm.frag.vk | 6 + .../frag/image-query-no-sampler.vk.asm.frag | 6 + .../image-query-no-sampler.vk.asm.frag.vk | 6 + .../asm/frag/implicit-read-dep-phi.asm.frag | 40 + .../asm/frag/inf-nan-constant-double.asm.frag | 17 + .../asm/frag/inf-nan-constant.asm.frag | 11 + .../shaders/asm/frag/invalidation.asm.frag | 11 + .../asm/frag/line-directive.line.asm.frag | 76 + .../asm/frag/locations-components.asm.frag | 23 + ...op-body-dominator-continue-access.asm.frag | 83 + .../asm/frag/loop-header-to-continue.asm.frag | 46 + .../frag/lut-promotion-initializer.asm.frag | 42 + .../asm/frag/multi-for-loop-init.asm.frag | 22 + .../asm/frag/op-constant-null.asm.frag | 11 + .../frag/op-phi-swap-continue-block.asm.frag | 29 + ...t-of-bounds-access-opspecconstant.asm.frag | 8 + .../asm/frag/out-of-bounds-access.asm.frag | 8 + .../asm/frag/pack-and-unpack-uint2.asm.frag | 9 + .../shaders/asm/frag/pass-by-value.asm.frag | 16 + .../asm/frag/phi-loop-variable.asm.frag | 6 + .../asm/frag/sample-and-compare.asm.frag | 13 + ...pler-buffer-array-without-sampler.asm.frag | 18 + .../sampler-buffer-without-sampler.asm.frag | 13 + .../frag/single-function-private-lut.asm.frag | 23 + .../opt/shaders/asm/frag/srem.asm.frag | 13 + .../storage-class-output-initializer.asm.frag | 13 + .../struct-composite-extract-swizzle.asm.frag | 21 + .../frag/switch-label-shared-block.asm.frag | 32 + .../switch-preserve-sign-extension.asm.frag | 9 + .../asm/frag/temporary-name-alias.asm.frag | 6 + .../asm/frag/temporary-phi-hoisting.asm.frag | 27 + .../asm/frag/texel-fetch-no-lod.asm.frag | 11 + .../frag/texture-sampling-fp16.asm.vk.frag | 19 + .../frag/texture-sampling-fp16.asm.vk.frag.vk | 20 + .../asm/frag/undef-variable-store.asm.frag | 9 + .../asm/frag/unknown-depth-state.asm.vk.frag | 13 + .../frag/unknown-depth-state.asm.vk.frag.vk | 14 + .../opt/shaders/asm/frag/unreachable.asm.frag | 24 + .../asm/frag/vector-shuffle-oom.asm.frag | 297 + .../asm/geom/block-name-namespace.asm.geom | 32 + .../inout-split-access-chain-handle.asm.geom | 9 + .../geom/split-access-chain-input.asm.geom | 9 + .../asm/geom/unroll-glposition-load.asm.geom | 16 + .../asm/tese/unroll-input-array-load.asm.tese | 17 + .../opt/shaders/asm/vert/empty-io.asm.vert | 15 + ...act-transposed-matrix-from-struct.asm.vert | 30 + .../asm/vert/global-builtin.sso.asm.vert | 20 + .../shaders/asm/vert/invariant-block.asm.vert | 9 + .../asm/vert/invariant-block.sso.asm.vert | 17 + .../opt/shaders/asm/vert/invariant.asm.vert | 9 + .../shaders/asm/vert/invariant.sso.asm.vert | 14 + .../spec-constant-op-composite.asm.vk.vert | 30 + .../spec-constant-op-composite.asm.vk.vert.vk | 28 + .../vert/uint-vertex-id-instance-id.asm.vert | 16 + .../reference/opt/shaders/comp/atomic.comp | 49 + .../opt/shaders/comp/bake_gradient.comp | 38 + .../reference/opt/shaders/comp/barriers.comp | 22 + .../reference/opt/shaders/comp/basic.comp | 28 + .../reference/opt/shaders/comp/casts.comp | 18 + .../shaders/comp/cfg-preserve-parameter.comp | 7 + .../reference/opt/shaders/comp/cfg.comp | 44 + .../opt/shaders/comp/coherent-block.comp | 13 + .../opt/shaders/comp/coherent-image.comp | 15 + .../comp/composite-array-initialization.comp | 27 + .../opt/shaders/comp/composite-construct.comp | 18 + .../reference/opt/shaders/comp/culling.comp | 28 + .../opt/shaders/comp/defer-parens.comp | 20 + .../reference/opt/shaders/comp/dowhile.comp | 38 + .../opt/shaders/comp/generate_height.comp | 56 + .../reference/opt/shaders/comp/image.comp | 12 + .../reference/opt/shaders/comp/insert.comp | 14 + .../reference/opt/shaders/comp/mat3.comp | 13 + .../reference/opt/shaders/comp/mod.comp | 20 + .../reference/opt/shaders/comp/modf.comp | 20 + .../opt/shaders/comp/outer-product.comp | 36 + .../opt/shaders/comp/read-write-only.comp | 27 + .../opt/shaders/comp/rmw-matrix.comp | 20 + .../reference/opt/shaders/comp/rmw-opt.comp | 23 + ...alar-std450-distance-length-normalize.comp | 19 + .../reference/opt/shaders/comp/shared.comp | 22 + .../opt/shaders/comp/ssbo-array-length.comp | 14 + .../opt/shaders/comp/ssbo-array.comp | 13 + .../opt/shaders/comp/struct-layout.comp | 23 + .../opt/shaders/comp/struct-packing.comp | 104 + .../opt/shaders/comp/torture-loop.comp | 40 + .../opt/shaders/comp/type-alias.comp | 33 + .../reference/opt/shaders/comp/udiv.comp | 18 + .../desktop-only/comp/enhanced-layouts.comp | 40 + .../comp/extended-arithmetic.desktop.comp | 159 + .../desktop-only/comp/fp64.desktop.comp | 63 + .../image-formats.desktop.noeliminate.comp | 7 + .../desktop-only/comp/int64.desktop.comp | 58 + .../frag/clip-cull-distance.desktop.frag | 12 + .../control-dependent-in-branch.desktop.frag | 37 + .../frag/depth-greater-than.desktop.frag | 9 + .../frag/depth-less-than.desktop.frag | 9 + .../frag/dual-source-blending.desktop.frag | 11 + .../frag/hlsl-uav-block-alias.asm.frag | 19 + .../desktop-only/frag/image-ms.desktop.frag | 12 + .../frag/image-query.desktop.frag | 6 + .../shaders/desktop-only/frag/image-size.frag | 12 + .../image-size.no-qualifier-deduction.frag | 12 + .../frag/in-block-qualifiers.frag | 21 + .../frag/layout-component.desktop.frag | 16 + .../frag/query-levels.desktop.frag | 11 + .../desktop-only/frag/query-lod.desktop.frag | 12 + .../frag/sampler-ms-query.desktop.frag | 14 + .../frag/stencil-export.desktop.frag | 13 + .../frag/texture-proj-shadow.desktop.frag | 27 + .../desktop-only/geom/basic.desktop.sso.geom | 36 + .../geom/viewport-index.desktop.geom | 9 + .../desktop-only/tesc/basic.desktop.sso.tesc | 27 + .../tese/triangle.desktop.sso.tese | 18 + .../desktop-only/vert/basic.desktop.sso.vert | 22 + .../vert/clip-cull-distance.desktop.sso.vert | 20 + .../vert/clip-cull-distance.desktop.vert | 15 + .../vert/out-block-qualifiers.vert | 27 + ...shader-draw-parameters-450.desktop.vk.vert | 24 + ...der-draw-parameters-450.desktop.vk.vert.vk | 8 + .../shader-draw-parameters.desktop.vk.vert | 24 + .../shader-draw-parameters.desktop.vk.vert.vk | 7 + .../opt/shaders/flatten/array.flatten.vert | 10 + .../opt/shaders/flatten/basic.flatten.vert | 13 + .../opt/shaders/flatten/copy.flatten.vert | 27 + .../opt/shaders/flatten/dynamic.flatten.vert | 27 + .../flatten/matrix-conversion.flatten.frag | 14 + .../shaders/flatten/matrixindex.flatten.vert | 19 + .../shaders/flatten/multiindex.flatten.vert | 10 + .../flatten/push-constant.flatten.vert | 13 + .../opt/shaders/flatten/rowmajor.flatten.vert | 10 + .../opt/shaders/flatten/struct.flatten.vert | 22 + .../flatten/struct.rowmajor.flatten.vert | 21 + .../opt/shaders/flatten/swizzle.flatten.vert | 21 + .../opt/shaders/flatten/types.flatten.frag | 14 + .../frag/array-lut-no-loop-variable.frag | 19 + .../avoid-expression-lowering-to-loop.frag | 29 + .../opt/shaders/frag/barycentric-khr.frag | 13 + .../opt/shaders/frag/barycentric-nv.frag | 13 + .../reference/opt/shaders/frag/basic.frag | 15 + .../complex-expression-in-access-chain.frag | 21 + .../composite-extract-forced-temporary.frag | 16 + .../opt/shaders/frag/constant-array.frag | 26 + .../opt/shaders/frag/constant-composites.frag | 23 + .../opt/shaders/frag/false-loop-init.frag | 18 + .../opt/shaders/frag/flush_params.frag | 11 + .../frag/for-loop-continue-control-flow.frag | 15 + .../opt/shaders/frag/for-loop-init.frag | 65 + .../opt/shaders/frag/frexp-modf.frag | 35 + .../opt/shaders/frag/front-facing.frag | 20 + .../opt/shaders/frag/gather-dref.frag | 14 + .../reference/opt/shaders/frag/ground.frag | 38 + .../opt/shaders/frag/helper-invocation.frag | 23 + ...temporary-use-continue-block-as-value.frag | 28 + .../frag/image-load-store-uint-coord.asm.frag | 17 + ...-loop-dominated-variable-preservation.frag | 11 + .../loop-dominator-and-switch-default.frag | 56 + .../opt/shaders/frag/lut-promotion.frag | 41 + .../reference/opt/shaders/frag/mix.frag | 18 + .../frag/modf-pointer-function-analysis.frag | 18 + .../shaders/frag/partial-write-preserve.frag | 8 + .../shaders/frag/pixel-interlock-ordered.frag | 35 + .../frag/pixel-interlock-unordered.frag | 35 + .../reference/opt/shaders/frag/pls.frag | 21 + .../shaders/frag/post-depth-coverage-es.frag | 14 + .../opt/shaders/frag/post-depth-coverage.frag | 15 + .../opt/shaders/frag/round-even.frag | 12 + .../reference/opt/shaders/frag/round.frag | 12 + .../frag/sample-interlock-ordered.frag | 35 + .../frag/sample-interlock-unordered.frag | 35 + .../opt/shaders/frag/sample-parameter.frag | 13 + .../opt/shaders/frag/sampler-ms.frag | 14 + .../opt/shaders/frag/sampler-proj.frag | 16 + .../reference/opt/shaders/frag/sampler.frag | 15 + .../shaders/frag/scalar-refract-reflect.frag | 13 + .../frag/selection-block-dominator.frag | 19 + .../opt/shaders/frag/shader-clock.frag | 19 + .../frag/struct-type-unrelated-alias.frag | 9 + .../frag/switch-unreachable-break.frag | 37 + .../shaders/frag/switch-unsigned-case.frag | 29 + .../reference/opt/shaders/frag/swizzle.frag | 22 + .../opt/shaders/frag/texel-fetch-offset.frag | 15 + .../frag/ubo-load-row-major-workaround.frag | 46 + .../opt/shaders/frag/ubo_layout.frag | 26 + .../opt/shaders/frag/unary-enclose.frag | 12 + .../reference/opt/shaders/geom/basic.geom | 27 + .../shaders/geom/geometry-passthrough.geom | 22 + .../opt/shaders/geom/lines-adjacency.geom | 26 + .../reference/opt/shaders/geom/lines.geom | 23 + .../opt/shaders/geom/multi-stream.geom | 14 + .../reference/opt/shaders/geom/points.geom | 26 + .../opt/shaders/geom/single-invocation.geom | 26 + .../geom/transform-feedback-streams.geom | 26 + .../opt/shaders/geom/triangles-adjacency.geom | 26 + .../reference/opt/shaders/geom/triangles.geom | 26 + .../legacy/fragment/explicit-lod.legacy.frag | 12 + .../legacy/fragment/explicit-lod.legacy.vert | 11 + .../shaders/legacy/fragment/fma.legacy.frag | 15 + .../legacy/fragment/hyperbolic.legacy.frag | 52 + .../legacy/fragment/io-blocks.legacy.frag | 12 + .../legacy/fragment/isnan-isinf.legacy.frag | 28 + .../shaders/legacy/fragment/modf.legacy.frag | 20 + .../multiple-struct-flattening.legacy.frag | 36 + .../shaders/legacy/fragment/round.legacy.frag | 13 + .../fragment/struct-varying.legacy.frag | 18 + .../legacy/fragment/switch.legacy.frag | 77 + .../legacy/vert/implicit-lod.legacy.vert | 9 + .../legacy/vert/int-attribute.legacy.vert | 13 + .../shaders/legacy/vert/inverse.legacy.vert | 85 + .../shaders/legacy/vert/io-block.legacy.vert | 13 + .../legacy/vert/outer-product.legacy.vert | 19 + .../struct-flatten-inner-array.legacy.vert | 17 + ...flatten-stores-multi-dimension.legacy.vert | 49 + .../legacy/vert/struct-varying.legacy.vert | 24 + .../legacy/vert/switch-nested.legacy.vert | 45 + .../shaders/legacy/vert/transpose.legacy.vert | 54 + ...ader-basic-lines.spv14.vk.nocompat.mesh.vk | 66 + ...der-basic-points.spv14.vk.nocompat.mesh.vk | 66 + ...r-basic-triangle.spv14.vk.nocompat.mesh.vk | 66 + .../reference/opt/shaders/tesc/basic.tesc | 17 + .../opt/shaders/tesc/water_tess.tesc | 79 + .../reference/opt/shaders/tese/ccw.tese | 9 + .../reference/opt/shaders/tese/cw.tese | 9 + .../reference/opt/shaders/tese/equal.tese | 9 + .../opt/shaders/tese/fractional_even.tese | 9 + .../opt/shaders/tese/fractional_odd.tese | 9 + .../opt/shaders/tese/input-array.tese | 11 + .../reference/opt/shaders/tese/line.tese | 9 + .../opt/shaders/tese/load-array-of-array.tese | 10 + .../opt/shaders/tese/patch-input-array.tese | 10 + .../reference/opt/shaders/tese/triangle.tese | 9 + .../opt/shaders/tese/water_tess.tese | 36 + .../reference/opt/shaders/vert/basic.vert | 17 + .../reference/opt/shaders/vert/ground.vert | 98 + .../reference/opt/shaders/vert/invariant.vert | 18 + .../opt/shaders/vert/no-contraction.vert | 18 + .../reference/opt/shaders/vert/ocean.vert | 119 + .../vert/read-from-row-major-array.vert | 31 + .../opt/shaders/vert/return-array.vert | 9 + .../shaders/vert/row-major-workaround.vert | 30 + .../opt/shaders/vert/texture_buffer.vert | 11 + .../vert/transform-feedback-decorations.vert | 22 + .../reference/opt/shaders/vert/ubo.vert | 17 + ...ay-of-buffer-reference.nocompat.vk.comp.vk | 25 + ...uffer-reference-atomic.nocompat.vk.comp.vk | 28 + ...base-alignment-promote.nocompat.vk.comp.vk | 29 + ...itcast-uvec2-2.nocompat.invalid.vk.comp.vk | 22 + ...eference-bitcast-uvec2.nocompat.vk.comp.vk | 21 + ...ffer-reference-bitcast.nocompat.vk.comp.vk | 26 + ...-reference-decorations.nocompat.vk.comp.vk | 35 + .../comp/buffer-reference.nocompat.vk.comp.vk | 53 + .../vulkan/comp/fp-atomic.nocompat.vk.comp.vk | 23 + ...ay-query.nocompat.spv14.invalid.vk.comp.vk | 72 + .../spec-constant-op-member-array.vk.comp | 47 + .../spec-constant-op-member-array.vk.comp.vk | 35 + .../spec-constant-work-group-size.vk.comp | 34 + .../spec-constant-work-group-size.vk.comp.vk | 24 + .../combined-texture-sampler-shadow.vk.frag | 14 + ...combined-texture-sampler-shadow.vk.frag.vk | 15 + .../frag/combined-texture-sampler.vk.frag | 17 + .../frag/combined-texture-sampler.vk.frag.vk | 17 + ...-helper-forwarding.asm.vk.nocompat.frag.vk | 15 + .../frag/demote-to-helper.vk.nocompat.frag.vk | 9 + .../vulkan/frag/desktop-mediump.vk.frag | 12 + .../vulkan/frag/desktop-mediump.vk.frag.vk | 12 + .../vulkan/frag/input-attachment-ms.vk.frag | 12 + .../frag/input-attachment-ms.vk.frag.vk | 12 + .../vulkan/frag/input-attachment.vk.frag | 14 + .../vulkan/frag/input-attachment.vk.frag.vk | 14 + .../nonuniform-qualifier.vk.nocompat.frag.vk | 64 + .../push-constant-as-ubo.push-ubo.vk.frag | 14 + .../push-constant-as-ubo.push-ubo.vk.frag.vk | 14 + .../shaders/vulkan/frag/push-constant.vk.frag | 20 + .../vulkan/frag/push-constant.vk.frag.vk | 18 + .../separate-combined-fake-overload.vk.frag | 12 + ...separate-combined-fake-overload.vk.frag.vk | 13 + .../separate-sampler-texture-array.vk.frag | 23 + .../separate-sampler-texture-array.vk.frag.vk | 24 + .../frag/separate-sampler-texture.vk.frag | 23 + .../frag/separate-sampler-texture.vk.frag.vk | 24 + ...shader-arithmetic-8bit.nocompat.vk.frag.vk | 43 + .../frag/spec-constant-block-size.vk.frag | 22 + .../frag/spec-constant-block-size.vk.frag.vk | 19 + .../vulkan/frag/spec-constant-ternary.vk.frag | 16 + .../frag/spec-constant-ternary.vk.frag.vk | 14 + ...terminators.khr.spv14.nocompat.vk.rahit.vk | 17 + .../rahit/terminators.nocompat.vk.rahit.vk | 17 + ...ng-callable.khr.spv14.nocompat.vk.rcall.vk | 10 + ...ibute_block.khr.spv14.nocompat.vk.rchit.vk | 24 + .../hit_attribute_block.nocompat.vk.rchit.vk | 24 + ...in_function.khr.spv14.nocompat.vk.rchit.vk | 24 + ...ute_block_in_function.nocompat.vk.rchit.vk | 24 + ...ibute_plain.khr.spv14.nocompat.vk.rchit.vk | 11 + .../hit_attribute_plain.nocompat.vk.rchit.vk | 11 + ...bute_struct.khr.spv14.nocompat.vk.rchit.vk | 17 + .../hit_attribute_struct.nocompat.vk.rchit.vk | 17 + .../hit_kind.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/hit_kind.nocompat.vk.rchit.vk | 10 + .../hit_t.khr.spv14.nocompat.vk.rchit.vk | 10 + .../vulkan/rchit/hit_t.nocompat.vk.rchit.vk | 10 + ...g_ray_flags.khr.spv14.nocompat.vk.rchit.vk | 10 + .../incoming_ray_flags.nocompat.vk.rchit.vk | 10 + ...e_custom_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../instance_custom_id.nocompat.vk.rchit.vk | 10 + ...instance_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/instance_id.nocompat.vk.rchit.vk | 10 + ...y_direction.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_ray_direction.nocompat.vk.rchit.vk | 10 + ..._ray_origin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_ray_origin.nocompat.vk.rchit.vk | 10 + ...ct_to_world.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_to_world.nocompat.vk.rchit.vk | 10 + .../payloads.khr.spv14.nocompat.vk.rchit.vk | 15 + .../rchit/payloads.nocompat.vk.rchit.vk | 15 + ...rimitive_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/primitive_id.nocompat.vk.rchit.vk | 10 + .../ray_tmax.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tmax.nocompat.vk.rchit.vk | 10 + .../ray_tmin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tmin.nocompat.vk.rchit.vk | 10 + ...ray_tracing.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tracing.nocompat.vk.rchit.vk | 10 + ...y_direction.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_ray_direction.nocompat.vk.rchit.vk | 10 + ..._ray_origin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_ray_origin.nocompat.vk.rchit.vk | 10 + ...d_to_object.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_to_object.nocompat.vk.rchit.vk | 10 + .../convert-u-to-as.spv14.vk.nocompat.rgen.vk | 15 + ...ute_callable.nocompat.khr.spv14.vk.rgen.vk | 15 + .../rgen/execute_callable.nocompat.vk.rgen.vk | 15 + .../launch_id.khr.spv14.nocompat.vk.rgen.vk | 10 + .../vulkan/rgen/launch_id.nocompat.vk.rgen.vk | 10 + .../launch_size.khr.spv14.nocompat.vk.rgen.vk | 10 + .../rgen/launch_size.nocompat.vk.rgen.vk | 10 + .../payloads.khr.spv14.nocompat.vk.rgen.vk | 31 + .../vulkan/rgen/payloads.nocompat.vk.rgen.vk | 31 + .../pure_call.khr.spv14.nocompat.vk.rgen.vk | 13 + .../vulkan/rgen/pure_call.nocompat.vk.rgen.vk | 12 + .../ray_tracing.khr.spv14.nocompat.vk.rgen.vk | 15 + .../rgen/ray_tracing.nocompat.vk.rgen.vk | 15 + ...ecord_buffer.khr.spv14.nocompat.vk.rgen.vk | 17 + .../shader_record_buffer.nocompat.vk.rgen.vk | 16 + ...intersection.khr.spv14.nocompat.vk.rint.vk | 8 + .../report-intersection.nocompat.vk.rint.vk | 8 + ...ray_tracing.khr.spv14.nocompat.vk.rmiss.vk | 10 + .../rmiss/ray_tracing.nocompat.vk.rmiss.vk | 10 + ...ce_incoming.khr.spv14.nocompat.vk.rmiss.vk | 11 + .../vert/device-group.nocompat.vk.vert.vk | 8 + .../vulkan/vert/multiview.nocompat.vk.vert.vk | 15 + .../shaders/vulkan/vert/small-storage.vk.vert | 69 + .../vulkan/vert/small-storage.vk.vert.vk | 55 + .../shaders/vulkan/vert/vulkan-vertex.vk.vert | 16 + .../vulkan/vert/vulkan-vertex.vk.vert.vk | 7 + ...access-chain-load-store-composite.asm.comp | 75 + ...ased-struct-divergent-member-name.asm.comp | 22 + .../asm/comp/atomic-load-store.asm.comp | 18 + .../asm/comp/atomic-result-temporary.asm.comp | 24 + .../comp/bitfield-signed-operations.asm.comp | 105 + .../asm/comp/bitscan.asm.comp | 25 + ...onuniform.asm.sm51.nonuniformresource.comp | 21 + .../comp/constant-composite-undef.asm.comp | 14 + .../comp/constant-lut-name-aliasing.asm.comp | 27 + ...-in-entry-point.noeliminate.spv14.asm.comp | 11 + .../asm/comp/glsl-signed-operations.asm.comp | 45 + ....std450.frexp-modf-struct.fxconly.asm.comp | 31 + ...onuniform.asm.sm51.nonuniformresource.comp | 21 + .../asm/comp/local-size-id-override.asm.comp | 37 + .../asm/comp/local-size-id.asm.comp | 38 + .../asm/comp/num-workgroups.spv14.asm.comp | 24 + .../comp/spec-constant-name-aliasing.asm.comp | 51 + ...lization-constant-workgroup.nofxc.asm.comp | 22 + .../comp/storage-buffer-basic.nofxc.asm.comp | 32 + .../anonymous-inner-struct-names.asm.frag | 89 + .../composite-insert-inheritance.asm.frag | 84 + .../asm/frag/empty-struct-in-struct.asm.frag | 37 + .../asm/frag/image-fetch-uint-coord.asm.frag | 28 + ...andling-2.nonuniformresource.sm51.asm.frag | 37 + ...opagation.nonuniformresource.sm51.asm.frag | 52 + ...form-ssbo.sm51.nonuniformresource.asm.frag | 39 + .../frag/only-initializer-frag-depth.asm.frag | 17 + .../asm/frag/phi.zero-initialize.asm.frag | 46 + ...-interlock-callstack.sm51.fxconly.asm.frag | 33 + ...terlock-control-flow.sm51.fxconly.asm.frag | 43 + ...lock-split-functions.sm51.fxconly.asm.frag | 43 + .../reserved-function-identifier.asm.frag | 31 + .../asm/frag/scalar-select.spv14.asm.frag | 62 + ...element-array-matrix-rule.invalid.asm.frag | 42 + ...rithmetic-cast.invalid.nofxc.sm60.asm.frag | 30 + ...ch-block-case-fallthrough.asm.invalid.frag | 82 + .../asm/frag/unordered-compare.asm.frag | 52 + .../frag/unordered-compare.relax-nan.asm.frag | 52 + .../frag/vec4-straddle-packing-holes.asm.frag | 26 + .../frag/vector-shuffle-undef-index.asm.frag | 28 + ...builtin-outputs.spv14.asm.vk.nocompat.mesh | 63 + .../asm/temporary.zero-initialize.asm.frag | 44 + .../vert/block-struct-initializer.asm.vert | 38 + .../vert/builtin-output-initializer.asm.vert | 28 + .../asm/vert/complex-link-by-name.asm.vert | 56 + .../asm/vert/empty-struct-composite.asm.vert | 15 + .../shaders-hlsl-no-opt/comp/bitfield.comp | 113 + .../comp/glsl.std450.fxconly.comp | 297 + .../comp/illegal-struct-name.asm.comp | 22 + .../comp/intmin-literal.comp | 19 + .../subgroups-boolean.invalid.nofxc.sm60.comp | 28 + .../comp/subgroups.invalid.nofxc.sm60.comp | 104 + .../comp/trivial-select-cast-vector.comp | 15 + .../comp/trivial-select-matrix.spv14.comp | 22 + .../frag/cbuffer-packing-straddle.frag | 56 + .../constant-buffer-array.invalid.sm51.frag | 44 + .../frag/fp16.invalid.desktop.frag | 179 + .../shaders-hlsl-no-opt/frag/frag-coord.frag | 27 + .../frag/helper-invocation.fxconly.nofxc.frag | 26 + ...types.fxconly.nofxc.sm62.native-16bit.frag | 79 + ...m-constructor.sm51.nonuniformresource.frag | 32 + ...terlock-simple-callstack.sm51.fxconly.frag | 33 + .../frag/spec-constant.frag | 142 + .../texture-gather-uint-component.asm.frag | 29 + .../frag/ubo-offset-out-of-order.frag | 33 + .../frag/variables.zero-initialize.frag | 45 + ...helper-invocation.fxconly.nofxc.spv16.frag | 29 + .../vert/base-instance.vert | 30 + .../shaders-hlsl-no-opt/vert/base-vertex.vert | 30 + .../block-io-auto-location-assignment.vert | 50 + .../vert/empty-shader.nofxc.sm30.vert | 8 + ...rix-input.flatten-matrix-vertex-input.vert | 56 + .../vert/pass-array-by-value.vert | 48 + .../asm/comp/access-chain-invalidate.asm.comp | 19 + .../asm/comp/atomic-decrement.asm.comp | 24 + .../asm/comp/atomic-increment.asm.comp | 24 + .../asm/comp/bitcast_icmp.asm.comp | 20 + .../asm/comp/block-name-alias-global.asm.comp | 39 + .../asm/comp/control-flow-hints.asm.comp | 41 + .../comp/global-parameter-name-alias.asm.comp | 33 + .../asm/comp/nmin-max-clamp.asm.comp | 84 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 27 + ...ctured-buffers.structured.fxconly.asm.frag | 26 + .../asm/frag/cbuffer-stripped.asm.frag | 32 + .../asm/frag/combined-sampler-reuse.asm.frag | 30 + .../asm/frag/empty-struct.asm.frag | 27 + .../shaders-hlsl/asm/frag/frem.asm.frag | 29 + .../asm/frag/function-overload-alias.asm.frag | 47 + .../asm/frag/image-extract-reuse.asm.frag | 31 + .../asm/frag/implicit-read-dep-phi.asm.frag | 56 + .../asm/frag/inf-nan-constant.asm.frag | 19 + .../asm/frag/line-directive.line.asm.frag | 86 + .../frag/lut-promotion-initializer.asm.frag | 55 + ...d-unpack-uint2.fxconly.nofxc.sm60.asm.frag | 34 + .../asm/frag/pass-by-value.asm.frag | 30 + .../asm/frag/sample-and-compare.asm.frag | 30 + .../frag/single-function-private-lut.asm.frag | 66 + .../shaders-hlsl/asm/frag/srem.asm.frag | 29 + .../storage-class-output-initializer.asm.frag | 23 + .../structured-buffer.structured.asm.frag | 26 + .../asm/frag/texel-fetch-no-lod.asm.frag | 30 + .../asm/frag/texture-sampling-fp16.asm.frag | 29 + .../asm/frag/unknown-depth-state.asm.frag | 41 + .../asm/frag/unreachable.asm.frag | 44 + ...act-transposed-matrix-from-struct.asm.vert | 67 + .../vert/spec-constant-op-composite.asm.vert | 47 + .../vert/uint-vertex-id-instance-id.asm.vert | 37 + .../asm/vert/vertex-id-instance-id.asm.vert | 28 + .../comp/access-chain-load-composite.comp | 164 + .../shaders-hlsl/comp/access-chains.comp | 23 + .../comp/access-chains.force-uav.comp | 23 + .../shaders-hlsl/comp/address-buffers.comp | 17 + .../reference/shaders-hlsl/comp/atomic.comp | 91 + .../reference/shaders-hlsl/comp/barriers.comp | 81 + .../reference/shaders-hlsl/comp/builtins.comp | 32 + .../comp/composite-array-initialization.comp | 63 + .../shaders-hlsl/comp/globallycoherent.comp | 20 + .../reference/shaders-hlsl/comp/image.comp | 73 + .../comp/image.nonwritable-uav-texture.comp | 73 + .../reference/shaders-hlsl/comp/inverse.comp | 124 + .../comp/num-workgroups-alone.comp | 19 + .../comp/num-workgroups-with-builtins.comp | 26 + .../shaders-hlsl/comp/outer-product.comp | 50 + .../comp/rayquery.nofxc.fxconly.comp | 224 + .../shaders-hlsl/comp/rmw-matrix.comp | 22 + .../shaders-hlsl/comp/rwbuffer-matrix.comp | 139 + ...alar-std450-distance-length-normalize.comp | 16 + .../reference/shaders-hlsl/comp/shared.comp | 31 + .../comp/spec-constant-op-member-array.comp | 51 + .../comp/spec-constant-work-group-size.comp | 43 + .../shaders-hlsl/comp/ssbo-array-length.comp | 17 + .../shaders-hlsl/comp/ssbo-array.comp | 13 + .../shaders-hlsl/flatten/array.flatten.vert | 30 + .../shaders-hlsl/flatten/basic.flatten.vert | 35 + .../shaders-hlsl/flatten/copy.flatten.vert | 53 + .../shaders-hlsl/flatten/dynamic.flatten.vert | 47 + .../flatten/matrix-conversion.flatten.frag | 29 + .../flatten/matrixindex.flatten.vert | 41 + .../flatten/multiindex.flatten.vert | 28 + .../flatten/push-constant.flatten.vert | 35 + .../flatten/rowmajor.flatten.vert | 29 + .../shaders-hlsl/flatten/struct.flatten.vert | 44 + .../flatten/struct.rowmajor.flatten.vert | 48 + .../shaders-hlsl/flatten/swizzle.flatten.vert | 45 + .../shaders-hlsl/flatten/types.flatten.frag | 23 + .../frag/array-lut-no-loop-variable.frag | 30 + .../frag/basic-color-3comp.sm30.frag | 26 + .../frag/basic-color-3comp.sm50.frag | 26 + .../reference/shaders-hlsl/frag/basic.frag | 32 + .../shaders-hlsl/frag/bit-conversions.frag | 27 + .../shaders-hlsl/frag/boolean-mix.frag | 27 + .../reference/shaders-hlsl/frag/builtins.frag | 34 + .../shaders-hlsl/frag/bvec-operations.frag | 29 + .../shaders-hlsl/frag/clip-cull-distance.frag | 30 + .../combined-texture-sampler-parameter.frag | 44 + .../frag/combined-texture-sampler-shadow.frag | 40 + .../complex-expression-in-access-chain.frag | 41 + .../frag/constant-composites.frag | 38 + .../control-dependent-in-branch.desktop.frag | 56 + .../shaders-hlsl/frag/demote-to-helper.frag | 9 + .../shaders-hlsl/frag/depth-greater-than.frag | 19 + .../shaders-hlsl/frag/depth-less-than.frag | 19 + .../frag/dual-source-blending.frag | 23 + .../frag/early-fragment-test.frag | 9 + .../frag/for-loop-continue-control-flow.frag | 44 + .../shaders-hlsl/frag/fp16-packing.frag | 44 + .../shaders-hlsl/frag/front-facing.frag | 39 + .../shaders-hlsl/frag/hyperbolic.frag | 65 + .../frag/image-query-selective.frag | 146 + .../shaders-hlsl/frag/image-query-uav.frag | 64 + ...age-query-uav.nonwritable-uav-texture.frag | 63 + .../shaders-hlsl/frag/image-query.frag | 132 + .../frag/input-attachment-ms.frag | 39 + .../shaders-hlsl/frag/input-attachment.frag | 35 + .../reference/shaders-hlsl/frag/io-block.frag | 34 + .../frag/legacy-tex-modifiers.sm30.frag | 32 + .../shaders-hlsl/frag/lut-promotion.frag | 55 + .../shaders-hlsl/frag/matrix-input.frag | 26 + .../reference/shaders-hlsl/frag/mod.frag | 71 + .../reference/shaders-hlsl/frag/mrt.frag | 31 + .../shaders-hlsl/frag/no-return.frag | 8 + .../shaders-hlsl/frag/no-return2.frag | 17 + ...orm-qualifier.nonuniformresource.sm51.frag | 121 + .../frag/partial-write-preserve.frag | 76 + .../pixel-interlock-ordered.sm51.fxconly.frag | 24 + .../shaders-hlsl/frag/point-coord-compat.frag | 19 + .../shaders-hlsl/frag/query-lod.desktop.frag | 31 + .../readonly-coherent-ssbo.force-uav.frag | 21 + .../frag/readonly-coherent-ssbo.frag | 21 + .../shaders-hlsl/frag/resources.frag | 44 + .../frag/row-major-layout-in-struct.frag | 47 + .../frag/sample-cmp-level-zero.frag | 53 + .../frag/sample-mask-in-and-out.frag | 30 + .../shaders-hlsl/frag/sample-mask-in.frag | 32 + .../shaders-hlsl/frag/sample-mask-out.frag | 23 + .../shaders-hlsl/frag/sampler-array.frag | 45 + .../frag/sampler-image-arrays.frag | 54 + .../frag/scalar-refract-reflect.frag | 49 + .../separate-combined-fake-overload.sm30.frag | 32 + .../frag/spec-constant-block-size.frag | 37 + .../frag/spec-constant-ternary.frag | 26 + .../frag/switch-unreachable-break.frag | 55 + .../frag/switch-unsigned-case.frag | 38 + .../shaders-hlsl/frag/swizzle-scalar.frag | 41 + .../shaders-hlsl/frag/tex-sampling-ms.frag | 33 + .../shaders-hlsl/frag/tex-sampling.frag | 106 + .../shaders-hlsl/frag/tex-sampling.sm30.frag | 83 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 31 + .../frag/texture-proj-shadow.frag | 53 + .../texture-size-combined-image-sampler.frag | 30 + .../shaders-hlsl/frag/unary-enclose.frag | 32 + .../frag/unorm-snorm-packing.frag | 111 + .../shaders-hlsl/frag/various-glsl-ops.frag | 28 + ...-shader-basic-lines.spv14.vk.nocompat.mesh | 97 + ...ader-basic-triangle.spv14.vk.nocompat.mesh | 87 + .../task/task-basic.spv14.vk.nocompat.task | 24 + .../reference/shaders-hlsl/vert/basic.vert | 39 + .../shaders-hlsl/vert/clip-cull-distance.vert | 28 + .../shaders-hlsl/vert/instancing.vert | 28 + .../shaders-hlsl/vert/invariant.vert | 40 + .../vert/legacy-int-attribute.sm30.vert | 36 + .../shaders-hlsl/vert/locations.vert | 77 + .../shaders-hlsl/vert/matrix-attribute.vert | 35 + .../shaders-hlsl/vert/matrix-output.vert | 23 + .../shaders-hlsl/vert/no-contraction.vert | 45 + .../reference/shaders-hlsl/vert/no-input.vert | 18 + .../shaders-hlsl/vert/point-size-compat.vert | 20 + .../shaders-hlsl/vert/point-size.sm30.vert | 26 + .../shaders-hlsl/vert/qualifiers.vert | 56 + .../vert/read-from-row-major-array.vert | 65 + .../shaders-hlsl/vert/return-array.vert | 48 + .../shaders-hlsl/vert/sampler-buffers.vert | 27 + .../vert/struct-composite-decl.vert | 50 + .../shaders-hlsl/vert/texture_buffer.vert | 21 + ...ased-struct-divergent-member-name.asm.comp | 38 + .../comp/arithmetic-conversion-signs.asm.comp | 42 + .../asm/comp/atomic-load-store.asm.comp | 23 + .../asm/comp/atomic-min-max-sign.asm.comp | 28 + .../asm/comp/atomic-result-temporary.asm.comp | 23 + ...da-to-array-in-buffer.asm.spv16.msl24.comp | 66 + .../asm/comp/bitcast-fp16-fp32.asm.comp | 21 + .../comp/bitfield-signed-operations.asm.comp | 29 + .../asm/comp/bitscan.asm.comp | 53 + ...block-like-array-type-construct-2.asm.comp | 77 + .../block-like-array-type-construct.asm.comp | 76 + ...-device-address-ptr-casting.msl24.asm.comp | 33 + ...composite-construct-buffer-struct.asm.comp | 22 + .../comp/constant-composite-undef.asm.comp | 17 + .../comp/constant-lut-name-aliasing.asm.comp | 61 + .../asm/comp/copy-logical-2.spv14.asm.comp | 60 + ...fset-and-array-stride-diffs.spv14.asm.comp | 54 + .../asm/comp/copy-logical.spv14.asm.comp | 47 + .../comp/device-array-load-temporary.asm.comp | 174 + ...load-temporary.force-native-array.asm.comp | 135 + .../device-constant-array-load-store.asm.comp | 179 + ...ray-load-store.force-native-array.asm.comp | 140 + ...-in-entry-point.noeliminate.spv14.asm.comp | 23 + .../asm/comp/glsl-signed-operations.asm.comp | 73 + .../glsl.std450.frexp-modf-struct.asm.comp | 35 + .../asm/comp/local-size-id-override.asm.comp | 25 + .../asm/comp/local-size-id.asm.comp | 26 + .../asm/comp/modf-storage-class.asm.comp | 44 + .../asm/comp/opptrdiff-basic.spv14.asm.comp | 51 + ...pptraccesschain-elem-offset.spv14.asm.comp | 45 + .../asm/comp/opptrequal-basic.spv14.asm.comp | 33 + ...ow-maj-mtx-bypass-transpose.spv14.asm.comp | 37 + .../comp/opptrnotequal-basic.spv14.asm.comp | 33 + .../comp/spec-constant-name-aliasing.asm.comp | 35 + .../storage-buffer-basic.invalid.asm.comp | 22 + .../storage-buffer-pointer-argument.asm.comp | 28 + .../asm/comp/variable-pointers.asm.comp | 74 + ...n-array-ubo-partial.argument.msl2.asm.frag | 27 + .../access-chain-array-ubo-partial.asm.frag | 28 + .../anonymous-inner-struct-names.asm.frag | 85 + ...omponent-insert-packed-expression.asm.frag | 34 + .../composite-insert-inheritance.asm.frag | 121 + ...composite-block-no-array-stride-2.asm.frag | 70 + ...py-memory-block-like-thread-local.asm.frag | 170 + .../asm/frag/empty-struct-in-struct.asm.frag | 35 + ...xup-entry-point-identifier.nomain.asm.frag | 17 + .../asm/frag/image-fetch-uint-coord.asm.frag | 22 + .../asm/frag/image-gather.asm.frag | 22 + ...mage-type-normal-comparison-usage.asm.frag | 31 + ...lock_with_aliased_struct_and_name.asm.frag | 105 + ...nput-attachment-unused-frag-coord.asm.frag | 25 + ...-frexp-scalar-access-chain-output.asm.frag | 17 + .../frag/only-initializer-frag-depth.asm.frag | 17 + .../asm/frag/phi.zero-initialize.asm.frag | 42 + .../pixel-interlock-callstack.msl2.asm.frag | 37 + ...pixel-interlock-control-flow.msl2.asm.frag | 52 + ...el-interlock-split-functions.msl2.asm.frag | 49 + .../private-initializer-direct-store.asm.frag | 19 + .../reserved-function-identifier.asm.frag | 33 + .../asm/frag/scalar-select.spv14.asm.frag | 71 + .../subgroup-arithmetic-cast.msl21.asm.frag | 30 + ...ch-block-case-fallthrough.asm.invalid.frag | 75 + .../asm/frag/texture-access.swizzle.asm.frag | 190 + .../usage-tracking-modf-io-pointer.asm.frag | 17 + .../frag/vector-shuffle-undef-index.asm.frag | 24 + ...lizers-block.mask-location-0.msl2.asm.tesc | 82 + ....mask-location-0.multi-patch.msl2.asm.tesc | 85 + ...lizers-block.mask-location-1.msl2.asm.tesc | 81 + ....mask-location-1.multi-patch.msl2.asm.tesc | 84 + ...lizers-block.mask-point-size.msl2.asm.tesc | 100 + ....mask-point-size.multi-patch.msl2.asm.tesc | 103 + ...ializers-block.mask-position.msl2.asm.tesc | 100 + ...ck.mask-position.multi-patch.msl2.asm.tesc | 103 + ...initializers.mask-location-0.msl2.asm.tesc | 90 + ....mask-location-0.msl2.multi-patch.asm.tesc | 93 + .../initializers.mask-location-1.asm.tesc | 89 + ...izers.mask-location-1.multi-patch.asm.tesc | 92 + ...initializers.mask-point-size.msl2.asm.tesc | 90 + ....mask-point-size.msl2.multi-patch.asm.tesc | 93 + .../initializers.mask-position.msl2.asm.tesc | 90 + ...rs.mask-position.msl2.multi-patch.asm.tesc | 93 + .../composite-extract-row-major.asm.comp | 16 + .../load-packed-no-forwarding-2.asm.comp | 19 + .../load-packed-no-forwarding-3.asm.comp | 20 + .../load-packed-no-forwarding-4.asm.comp | 20 + .../load-packed-no-forwarding-5.asm.comp | 20 + .../load-packed-no-forwarding.asm.comp | 23 + .../packed-vector-extract-insert.asm.comp | 22 + .../row-major-split-access-chain.asm.comp | 16 + .../asm/packing/scalar-array-float2.asm.frag | 24 + .../scalar-array-float3-one-element.asm.frag | 23 + .../asm/packing/scalar-array-float3.asm.frag | 24 + ...scalar-float2x2-col-major.invalid.asm.frag | 24 + .../scalar-float2x2-row-major.asm.frag | 24 + ...scalar-float2x3-col-major.invalid.asm.frag | 24 + .../scalar-float2x3-row-major.asm.frag | 24 + ...scalar-float3x2-col-major.invalid.asm.frag | 24 + .../scalar-float3x2-row-major.asm.frag | 24 + ...scalar-float3x3-col-major.invalid.asm.frag | 24 + .../scalar-float3x3-row-major.asm.frag | 24 + .../asm/temporary.zero-initialize.asm.frag | 38 + .../array-control-point-initializer.asm.tesc | 65 + .../block-control-point-initializer.asm.tesc | 70 + ...builtin-control-point-initializer.asm.tesc | 80 + ...mposite-control-point-initializer.asm.tesc | 69 + .../tesc/copy-memory-control-point.asm.tesc | 125 + .../asm/tesc/copy-tess-level-tri.asm.tesc | 66 + .../plain-control-point-initializer.asm.tesc | 62 + ...input-array-builtin-array.invalid.asm.tesc | 139 + ...builtin-array.invalid.multi-patch.asm.tesc | 138 + .../tesc/tess-level-initializer-quad.asm.tesc | 78 + .../tess-level-initializer-triangle.asm.tesc | 72 + ...-level-read-write-in-function-tri.asm.tesc | 35 + .../asm/tese/copy-tess-level.asm.msl2.tese | 73 + .../asm/tese/split-access-chain.asm.tese | 28 + .../vert/block-io-use-in-function.asm.vert | 128 + .../vert/block-struct-initializer.asm.vert | 39 + .../vert/builtin-output-initializer.asm.vert | 20 + ...omposite-extract-physical-type-id.asm.vert | 31 + ...t-composite-block-no-array-stride.asm.vert | 89 + .../asm/vert/duplicate-view-index.asm.vert | 19 + .../asm/vert/empty-struct-composite.asm.vert | 13 + .../op-load-forced-temporary-array.asm.frag | 76 + .../asm/vert/pointer-to-pointer.asm.vert | 20 + .../comp/array-copy-threadgroup-memory.comp | 172 + .../basic.dynamic-buffer.msl2.invalid.comp | 90 + .../bda-restrict-pointer-variable.msl2.comp | 23 + .../comp/bitcast-16bit-1.invalid.comp | 26 + .../comp/bitcast-16bit-2.invalid.comp | 35 + .../shaders-msl-no-opt/comp/bitfield.comp | 47 + ...ress-from-pointer-complex-chain.msl23.comp | 28 + .../shaders-msl-no-opt/comp/glsl.std450.comp | 289 + .../comp/illegal-struct-name.asm.comp | 29 + .../comp/implicit-integer-promotion.comp | 93 + .../comp/int16min-literal.comp | 24 + .../comp/int64.invalid.msl22.comp | 106 + .../comp/int64min-literal.msl22.comp | 24 + .../comp/intmin-literal.comp | 22 + .../shaders-msl-no-opt/comp/loop.comp | 91 + .../shaders-msl-no-opt/comp/return.comp | 39 + ...std140-array-load-composite-construct.comp | 18 + ...ct-packing-scalar.nocompat.invalid.vk.comp | 151 + ...pat.invalid.vk.msl12.emulate-subgroup.comp | 30 + .../subgroups.nocompat.invalid.vk.msl21.comp | 327 + ...ompat.invalid.vk.msl21.fixed-subgroup.comp | 322 + ...bgroups.nocompat.invalid.vk.msl21.ios.comp | 151 + ...bgroups.nocompat.invalid.vk.msl22.ios.comp | 282 + ...ps.nocompat.invalid.vk.msl23.ios.simd.comp | 316 + .../comp/trivial-select-cast-vector.comp | 19 + .../comp/trivial-select-matrix.spv14.comp | 20 + .../components/fragment-input-component.frag | 23 + .../components/fragment-output-component.frag | 25 + ...ragment-output-component.pad-fragment.frag | 22 + .../components/vertex-input-component.vert | 28 + .../components/vertex-output-component.vert | 26 + .../frag/16bit-constants.invalid.frag | 21 + .../combined-sampler-parameter-names.asm.frag | 30 + ...e-to-helper.vk.nocompat.msl21.invalid.frag | 11 + .../frag/depth-image-gather.asm.frag | 22 + ....msl2.argument..force-active.discrete.frag | 31 + .../frag/fp16.desktop.invalid.frag | 185 + .../shaders-msl-no-opt/frag/image-gather.frag | 24 + .../frag/in_block_assign.frag | 31 + .../frag/min-max-clamp.invalid.asm.frag | 69 + .../min-max-clamp.relax-nan.invalid.asm.frag | 69 + .../frag/nonuniform-constructor.msl2.frag | 23 + ...pixel-interlock-simple-callstack.msl2.frag | 37 + .../pull-interpolant-access-chain.msl23.frag | 75 + ...layout-ubo-std430.vk.nocompat.invalid.frag | 36 + .../shadow-compare-global-alias.invalid.frag | 57 + .../frag/struct-bool-edge-cases.frag | 98 + .../subgroups.nocompat.invalid.vk.msl22.frag | 314 + ...-fallback.msl20.ios.framebuffer-fetch.frag | 17 + ...ndex-fallback.msl23.framebuffer-fetch.frag | 17 + ...nction-argument.framebuffer-fetch.ios.frag | 37 + ...tion-argument.framebuffer-fetch.msl23.frag | 37 + ...ding.framebuffer-fetch.msl23.argument.frag | 23 + ...ation-binding.framebuffer-fetch.msl23.frag | 17 + ...g.ios.framebuffer-fetch.msl2.argument.frag | 23 + ...on-binding.ios.framebuffer-fetch.msl2.frag | 17 + .../frag/texture-access-int.swizzle.frag | 148 + .../frag/texture-access-leaf.swizzle.frag | 197 + .../frag/texture-access-uint.swizzle.frag | 148 + .../frag/texture-access.swizzle.frag | 190 + .../texture-gather-uint-component.asm.frag | 22 + ...le-structs-access-chain.argument.msl2.frag | 32 + ...o-array-multiple-structs-access-chain.frag | 33 + .../frag/ubo-offset-out-of-order.frag | 28 + .../frag/variables.zero-initialize.frag | 40 + ...olatile-helper-invocation.msl23.spv16.frag | 25 + .../packing/array-of-vec3.comp | 17 + .../packing/array-of-vec4.comp | 17 + .../packing/isolated-scalar-access.comp | 26 + .../packing/load-store-col-rows.comp | 76 + .../packing/matrix-2x2-scalar.comp | 86 + .../packing/matrix-2x2-std140.comp | 92 + .../packing/matrix-2x2-std430.comp | 86 + .../packing/matrix-2x3-scalar.comp | 92 + .../packing/matrix-2x3-std140.comp | 93 + .../packing/matrix-2x3-std430.comp | 87 + .../packing/matrix-2x4-scalar.comp | 88 + .../packing/matrix-2x4-std140.comp | 97 + .../packing/matrix-2x4-std430.comp | 88 + .../packing/matrix-3x2-scalar.comp | 91 + .../packing/matrix-3x2-std140.comp | 92 + .../packing/matrix-3x2-std430.comp | 86 + .../packing/matrix-3x3-scalar.comp | 102 + .../packing/matrix-3x3-std140.comp | 87 + .../packing/matrix-3x3-std430.comp | 87 + .../packing/matrix-3x4-scalar.comp | 99 + .../packing/matrix-3x4-std140.comp | 88 + .../packing/matrix-3x4-std430.comp | 88 + .../packing/matrix-4x2-scalar.comp | 86 + .../packing/matrix-4x2-std140.comp | 95 + .../packing/matrix-4x2-std430.comp | 86 + .../packing/matrix-4x3-scalar.comp | 98 + .../packing/matrix-4x3-std140.comp | 87 + .../packing/matrix-4x3-std430.comp | 87 + .../packing/matrix-4x4-scalar.comp | 88 + .../packing/matrix-4x4-std140.comp | 88 + .../packing/matrix-4x4-std430.comp | 88 + .../packing/matrix-multiply-row-major.comp | 21 + .../matrix-multiply-unpacked-col-major-2.comp | 25 + .../matrix-multiply-unpacked-col-major.comp | 23 + .../matrix-multiply-unpacked-row-major-2.comp | 25 + .../matrix-multiply-unpacked-row-major.comp | 23 + .../packing/member-padding.comp | 21 + .../packing/std140-array-of-vectors.comp | 42 + .../packing/struct-alignment.comp | 27 + .../struct-packing-array-of-scalar.comp | 22 + .../packing/struct-packing-recursive.comp | 33 + .../packing/struct-packing.comp | 29 + .../struct-size-padding-array-of-array.comp | 54 + .../packing/struct-size-padding.comp | 54 + .../tesc/copy-tess-level.tesc | 68 + .../passthrough-clip-cull.multi-patch.tesc | 71 + ...ess-level-read-write-in-function-quad.tesc | 37 + ...-input-automatic-attribute-assignment.tese | 80 + .../tese/load-clip-cull.msl2.tese | 37 + .../vert/cull-distance.for-tess.vert | 62 + .../vert/functions_nested.vert | 200 + .../vert/layer.msl11.invalid.vert | 24 + .../vert/modf-storage-class.capture.vert | 25 + ...ass-array-by-value.force-native-array.vert | 157 + .../vert/pass-array-by-value.vert | 85 + .../vert/uninitialized-vertex-output.vert | 18 + .../vert/unused-subgroup-builtin.msl22.vert | 9 + .../vert/viewport-index.msl2.invalid.vert | 24 + .../texture-access-function.swizzle.vk.frag | 204 + .../amd/shader_trinary_minmax.msl21.comp | 14 + .../asm/comp/atomic-decrement.asm.comp | 29 + .../asm/comp/atomic-increment.asm.comp | 29 + .../asm/comp/bitcast_iadd.asm.comp | 29 + .../asm/comp/bitcast_icmp.asm.comp | 29 + .../shaders-msl/asm/comp/bitcast_sar.asm.comp | 31 + .../asm/comp/bitcast_sdiv.asm.comp | 31 + .../shaders-msl/asm/comp/bitcast_slr.asm.comp | 31 + .../asm/comp/block-name-alias-global.asm.comp | 46 + .../comp/buffer-write-relative-addr.asm.comp | 32 + .../asm/comp/buffer-write.asm.comp | 24 + .../comp/copy-object-ssbo-to-ssbo.asm.comp | 23 + .../asm/comp/copy-object-ubo-to-ssbo.asm.comp | 24 + .../asm/comp/duplicate-spec-id.asm.comp | 20 + .../comp/global-parameter-name-alias.asm.comp | 33 + ...e-load-store-short-vector.invalid.asm.comp | 22 + .../asm/comp/multiple-entry.asm.comp | 29 + ...p-spec-constant-op-vector-related.asm.comp | 111 + .../shaders-msl/asm/comp/quantize.asm.comp | 34 + .../asm/comp/relaxed-block-layout.asm.comp | 22 + ...specialization-constant-workgroup.asm.comp | 21 + .../struct-resource-name-aliasing.asm.comp | 24 + .../asm/comp/uint_smulextended.asm.comp | 25 + .../undefined-constant-composite.asm.comp | 38 + ...undefined-spec-constant-composite.asm.comp | 42 + .../asm/comp/variable-pointers-2.asm.comp | 63 + ...ariable-pointers-store-forwarding.asm.comp | 32 + .../vector-builtin-type-cast-func.asm.comp | 34 + .../comp/vector-builtin-type-cast.asm.comp | 24 + .../asm/frag/combined-sampler-reuse.asm.frag | 23 + .../asm/frag/default-member-names.asm.frag | 40 + .../depth-image-color-format-fetch.asm.frag | 47 + .../depth-image-color-format-sampled.asm.frag | 46 + .../frag/descriptor-array-unnamed.asm.frag | 48 + ...isable-renamed-output.frag-output.asm.frag | 35 + .../asm/frag/empty-struct.asm.frag | 29 + .../extract-packed-from-composite.asm.frag | 49 + .../shaders-msl/asm/frag/frem.asm.frag | 23 + .../asm/frag/function-overload-alias.asm.frag | 51 + .../asm/frag/image-extract-reuse.asm.frag | 17 + .../asm/frag/implicit-read-dep-phi.asm.frag | 49 + .../asm/frag/inf-nan-constant.asm.frag | 17 + .../interpolation-qualifiers-struct.asm.frag | 47 + .../asm/frag/line-directive.line.asm.frag | 85 + .../asm/frag/locations-components.asm.frag | 37 + .../frag/lut-promotion-initializer.asm.frag | 92 + .../asm/frag/min-lod.msl22.asm.frag | 22 + .../asm/frag/op-constant-null.asm.frag | 70 + .../asm/frag/op-image-sampled-image.asm.frag | 25 + .../asm/frag/pass-by-value.asm.frag | 30 + .../asm/frag/phi-loop-variable.asm.frag | 12 + .../pull-model-interpolation.asm.msl23.frag | 187 + .../asm/frag/sample-and-compare.asm.frag | 22 + .../frag/single-function-private-lut.asm.frag | 82 + .../shaders-msl/asm/frag/srem.asm.frag | 23 + .../storage-class-output-initializer.asm.frag | 65 + .../asm/frag/switch-different-sizes.asm.frag | 78 + .../asm/frag/switch-long-case.asm.msl22.frag | 27 + .../switch-unsigned-long-case.asm.msl22.frag | 27 + .../asm/frag/texel-fetch-no-lod.asm.frag | 17 + .../asm/frag/texture-atomics.asm.frag | 121 + ...re-atomics.asm.graphics-robust-access.frag | 121 + .../asm/frag/texture-sampling-fp16.asm.frag | 22 + .../asm/frag/undef-variable-store.asm.frag | 37 + .../asm/frag/unknown-depth-state.asm.frag | 36 + .../asm/frag/unord-relational-op.asm.frag | 59 + .../unord-relational-op.relax-nan.asm.frag | 59 + .../shaders-msl/asm/frag/unreachable.asm.frag | 40 + .../asm/frag/vector-shuffle-oom.asm.frag | 336 + .../asm/tesc/tess-level-overrun.asm.tesc | 23 + .../tess-level-overrun.multi-patch.asm.tesc | 24 + .../asm/tese/unnamed-builtin-array.asm.tese | 73 + .../clip-distance-plain-variable.asm.vert | 49 + ...ce-plain-variable.no-user-varying.asm.vert | 45 + .../asm/vert/copy-memory-interface.asm.vert | 25 + ...act-transposed-matrix-from-struct.asm.vert | 66 + .../asm/vert/fake-builtin-input.asm.vert | 23 + .../asm/vert/invariant.msl21.asm.vert | 26 + .../asm/vert/packed-bool-to-uint.asm.vert | 38 + .../packed-bool2-to-packed_uint2.asm.vert | 38 + .../asm/vert/packing-test.asm.vert | 19 + .../vert/spec-constant-op-composite.asm.vert | 52 + .../vert/uint-vertex-id-instance-id.asm.vert | 29 + .../access-private-workgroup-in-function.comp | 38 + ...ffers-discrete.msl2.argument.discrete.comp | 42 + ...rs-image-load-store.ios.msl2.argument.comp | 11 + ...uffers-image-load-store.msl2.argument.comp | 17 + .../shaders-msl/comp/array-length.comp | 39 + .../array-length.msl2.argument.discrete.comp | 68 + .../shaders-msl/comp/atomic-float.msl3.comp | 20 + .../reference/shaders-msl/comp/atomic.comp | 72 + .../reference/shaders-msl/comp/barriers.comp | 90 + .../reference/shaders-msl/comp/basic.comp | 36 + .../shaders-msl/comp/basic.dispatchbase.comp | 41 + .../comp/basic.dispatchbase.msl11.comp | 39 + .../comp/basic.inline-block.msl2.comp | 54 + ...-vec-and-cast-to-and-from-uvec2.msl23.comp | 26 + ...dress-recursive-struct-pointers.msl23.comp | 67 + .../comp/buffer_device_address.msl2.comp | 43 + .../reference/shaders-msl/comp/builtins.comp | 17 + .../comp/cfg-preserve-parameter.comp | 82 + .../shaders-msl/comp/coherent-block.comp | 17 + .../shaders-msl/comp/coherent-image.comp | 17 + .../complex-composite-constant-array.comp | 65 + .../shaders-msl/comp/complex-type-alias.comp | 69 + .../comp/composite-array-initialization.comp | 88 + ...ray-initialization.force-native-array.comp | 158 + .../shaders-msl/comp/composite-construct.comp | 75 + .../comp/copy-array-of-arrays.comp | 76 + ...py-array-of-arrays.force-native-array.comp | 364 + .../reference/shaders-msl/comp/culling.comp | 36 + .../shaders-msl/comp/defer-parens.comp | 25 + .../reference/shaders-msl/comp/dowhile.comp | 31 + .../comp/force-recompile-hooks.swizzle.comp | 74 + .../reference/shaders-msl/comp/functions.comp | 19 + ...vocation-id-writable-ssbo-in-function.comp | 32 + .../comp/global-invocation-id.comp | 26 + ...omic-automatic-bindings.argument.msl2.comp | 38 + .../comp/image-atomic-automatic-bindings.comp | 29 + .../comp/image-cube-array-load-store.comp | 14 + .../reference/shaders-msl/comp/image.comp | 13 + .../reference/shaders-msl/comp/insert.comp | 23 + .../reference/shaders-msl/comp/inverse.comp | 130 + .../shaders-msl/comp/local-invocation-id.comp | 26 + .../comp/local-invocation-index.comp | 26 + .../comp/local-size-duplicate-spec-id.comp | 26 + .../comp/mat3-row-maj-read-write-const.comp | 22 + .../reference/shaders-msl/comp/mat3.comp | 18 + .../reference/shaders-msl/comp/mod.comp | 37 + .../reference/shaders-msl/comp/modf.comp | 26 + .../shaders-msl/comp/outer-product.comp | 40 + .../shaders-msl/comp/packing-test-1.comp | 38 + .../shaders-msl/comp/packing-test-2.comp | 29 + ....discrete.device-argument-buffer.msl2.comp | 142 + ...iptor-aliasing.argument.discrete.msl2.comp | 142 + ...ray-query.spv14.vk.ios.msl24..invalid.comp | 71 + .../shaders-msl/comp/read-write-only.comp | 31 + .../shaders-msl/comp/rmw-matrix.comp | 24 + .../reference/shaders-msl/comp/rmw-opt.comp | 31 + ...alar-std450-distance-length-normalize.comp | 25 + .../comp/shared-array-of-arrays.comp | 33 + .../comp/shared-matrix-array-of-array.comp | 1286 ++ .../shaders-msl/comp/shared-matrix-cast.comp | 1065 + .../shared-matrix-nested-struct-array.comp | 1316 ++ .../comp/shared-matrix-nested-struct.comp | 1473 ++ .../comp/shared-struct-bool-cast.comp | 110 + .../reference/shaders-msl/comp/shared.comp | 27 + .../comp/spec-constant-op-member-array.comp | 49 + .../comp/spec-constant-work-group-size.comp | 75 + .../storage-buffer-std140-vector-array.comp | 96 + .../shaders-msl/comp/struct-layout.comp | 28 + .../shaders-msl/comp/struct-nested.comp | 39 + .../shaders-msl/comp/struct-packing.comp | 152 + .../comp/threadgroup-boolean-workaround.comp | 28 + .../shaders-msl/comp/torture-loop.comp | 53 + .../shaders-msl/comp/type-alias.comp | 67 + .../comp/type_casting_i64.msl22.comp | 27 + .../reference/shaders-msl/comp/udiv.comp | 22 + .../shaders-msl/comp/writable-ssbo.comp | 26 + .../comp/extended-arithmetic.desktop.comp | 179 + .../desktop-only/frag/image-ms.desktop.frag | 13 + .../frag/query-levels.desktop.frag | 17 + .../frag/sampler-ms-query.desktop.frag | 17 + .../tesc/arrayed-output.desktop.sso.tesc | 85 + .../tesc/basic.desktop.sso.multi-patch.tesc | 47 + .../desktop-only/tesc/basic.desktop.sso.tesc | 47 + .../struct-copy.desktop.sso.multi-patch.tesc | 36 + .../tesc/struct-copy.desktop.sso.tesc | 40 + .../tese/triangle.desktop.sso.tese | 27 + .../desktop-only/vert/basic.desktop.sso.vert | 30 + ...ull-distance..no-user-varying.desktop.vert | 20 + .../vert/clip-cull-distance.desktop.vert | 24 + ...ader-draw-parameters.desktop.for-tess.vert | 20 + .../vert/shader-draw-parameters.desktop.vert | 17 + .../shaders-msl/flatten/basic.flatten.vert | 30 + .../flatten/multiindex.flatten.vert | 27 + .../flatten/push-constant.flatten.vert | 32 + .../shaders-msl/flatten/rowmajor.flatten.vert | 30 + .../shaders-msl/flatten/struct.flatten.vert | 40 + .../shaders-msl/flatten/swizzle.flatten.vert | 47 + .../shaders-msl/flatten/types.flatten.frag | 35 + .../frag/argument-buffers.msl2.argument.frag | 96 + .../shaders-msl/frag/array-component-io.frag | 99 + .../frag/array-lut-no-loop-variable.frag | 62 + .../shaders-msl/frag/array-of-array-lut.frag | 68 + ...niform.msl2.argument.discrete.swizzle.frag | 117 + ...zzle-nonconstant-uniform.msl2.swizzle.frag | 108 + ...wizzle.msl2.argument.discrete.swizzle.frag | 114 + ...array-of-texture-swizzle.msl2.swizzle.frag | 98 + .../frag/barycentric-nv-nopersp.msl22.frag | 31 + .../frag/barycentric-nv.msl22.frag | 31 + .../shaders-msl/frag/basic.force-sample.frag | 23 + .../reference/shaders-msl/frag/basic.frag | 23 + .../binary-func-unpack-pack-arguments.frag | 28 + .../frag/binary-unpack-pack-arguments.frag | 28 + .../shaders-msl/frag/bitcasting.1d-as-2d.frag | 30 + .../shaders-msl/frag/bitcasting.frag | 30 + .../shaders-msl/frag/buffer-read-write.frag | 27 + ...ead-write.texture-buffer-native.msl21.frag | 18 + .../reference/shaders-msl/frag/builtins.frag | 24 + .../frag/clip-distance-varying.frag | 67 + .../complex-expression-in-access-chain.frag | 32 + .../composite-extract-forced-temporary.frag | 23 + .../shaders-msl/frag/constant-array.frag | 83 + .../shaders-msl/frag/constant-composites.frag | 74 + .../control-dependent-in-branch.desktop.frag | 45 + .../frag/cull-distance-varying.frag | 67 + ...exture-lod.lod-as-grad.1d-as-2d.msl23.frag | 33 + .../shaders-msl/frag/depth-greater-than.frag | 17 + .../shaders-msl/frag/depth-less-than.frag | 17 + .../frag/depth-out-early-frag-tests.frag | 19 + .../frag/depth-out-no-early-frag-tests.frag | 19 + .../frag/disable-frag-output.frag-output.frag | 35 + .../frag/dual-source-blending.frag | 19 + .../frag/early-fragment-tests.frag | 17 + .../shaders-msl/frag/false-loop-init.frag | 35 + .../shaders-msl/frag/flush_params.frag | 40 + .../frag/for-loop-continue-control-flow.frag | 42 + .../shaders-msl/frag/for-loop-init.frag | 58 + .../shaders-msl/frag/fp16-packing.frag | 25 + ...ag-demote-checks.discard-checks.msl23.frag | 71 + ...s-continue-block.discard-checks.msl23.frag | 49 + ...g-discard-checks.discard-checks.msl23.frag | 70 + ...agment-component-padding.pad-fragment.frag | 82 + .../shaders-msl/frag/front-facing.frag | 30 + .../shaders-msl/frag/gather-dref.frag | 22 + .../shaders-msl/frag/gather-offset.frag | 17 + .../frag/helper-invocation.msl21.frag | 39 + ....device-argument-buffer.argument.msl2.frag | 58 + .../shaders-msl/frag/illegal-name-test-0.frag | 21 + .../frag/image-query-lod.msl22.frag | 78 + .../reference/shaders-msl/frag/in_block.frag | 32 + ...ck_with_multiple_structs_of_same_type.frag | 105 + .../reference/shaders-msl/frag/in_mat.frag | 37 + ...t-attachment-ms.arrayed-subpass.msl21.frag | 27 + .../shaders-msl/frag/input-attachment-ms.frag | 27 + .../input-attachment-ms.multiview.msl21.frag | 28 + .../input-attachment.arrayed-subpass.frag | 25 + .../shaders-msl/frag/input-attachment.frag | 25 + .../frag/input-attachment.multiview.frag | 26 + .../frag/interpolation-qualifiers-block.frag | 47 + .../frag/interpolation-qualifiers.frag | 28 + .../shaders-msl/frag/lut-promotion.frag | 92 + .../reference/shaders-msl/frag/mix.frag | 30 + .../frag/modf-access-tracking-function.frag | 33 + .../reference/shaders-msl/frag/mrt-array.frag | 94 + .../frag/nonuniform-qualifier.msl2.frag | 56 + .../packed-expression-vector-shuffle.frag | 27 + .../shaders-msl/frag/packing-test-3.frag | 55 + ...pixel-interlock-ordered.msl2.argument.frag | 53 + .../frag/pixel-interlock-ordered.msl2.frag | 41 + .../reference/shaders-msl/frag/pls.frag | 31 + .../frag/post-depth-coverage.ios.msl2.frag | 17 + .../frag/post-depth-coverage.msl23.frag | 17 + ...rivate-variable-prototype-declaration.frag | 41 + ...ery-object-in-function.spv14.vk.msl24.frag | 60 + .../read-cull-clip-distance-in-function.frag | 78 + .../shaders-msl/frag/readonly-ssbo.frag | 30 + ...return-value-after-discard-terminator.frag | 26 + ...e-depth-propagate-state-from-resource.frag | 43 + .../sample-depth-separate-image-sampler.frag | 31 + ...nd-out.fixed-sample-mask.force-sample.frag | 20 + ...ple-mask-in-and-out.fixed-sample-mask.frag | 20 + ...ample-mask-not-used.fixed-sample-mask.frag | 19 + .../frag/sample-mask.fixed-sample-mask.frag | 20 + .../shaders-msl/frag/sample-mask.frag | 19 + .../frag/sample-position-func.frag | 32 + .../shaders-msl/frag/sample-position.frag | 18 + .../sample-rate-frag-coord-sample-id.frag | 19 + .../sample-rate-frag-coord-sample-input.frag | 24 + .../sample-rate-frag-coord-sample-pos.frag | 19 + .../sample-rate-frag-coord.force-sample.frag | 18 + .../frag/sampler-1d-lod.1d-as-2d.frag | 22 + .../shaders-msl/frag/sampler-1d-lod.frag | 22 + .../sampler-compare-bias.msl23.1d-as-2d.frag | 22 + .../sampler-compare-cascade-gradient.frag | 22 + .../sampler-compare-cascade-gradient.ios.frag | 22 + ...ampler-compare-cascade-gradient.msl23.frag | 22 + .../frag/sampler-image-arrays.msl2.frag | 48 + .../shaders-msl/frag/sampler-ms.frag | 18 + .../reference/shaders-msl/frag/sampler.frag | 32 + .../frag/scalar-refract-reflect.frag | 49 + .../frag/separate-image-sampler-argument.frag | 25 + .../frag/shader-arithmetic-8bit.frag | 102 + .../frag/spec-constant-block-size.frag | 32 + .../frag/spec-constant-ternary.frag | 22 + .../frag/stencil-export.msl21.frag | 30 + .../frag/subgroup-builtins.msl22.frag | 18 + .../frag/subgroup-globals-extract.msl22.frag | 86 + .../frag/switch-unreachable-break.frag | 43 + .../frag/switch-unsigned-case.frag | 35 + .../reference/shaders-msl/frag/swizzle.frag | 28 + .../frag/texel-fetch-offset.1d-as-2d.frag | 18 + .../shaders-msl/frag/texel-fetch-offset.frag | 18 + .../shaders-msl/frag/texture-cube-array.frag | 25 + ...ure-cube-array.ios.emulate-cube-array.frag | 61 + .../frag/texture-multisample-array.msl21.frag | 23 + .../shaders-msl/frag/texture-proj-shadow.frag | 30 + .../shaders-msl/frag/ubo_layout.frag | 37 + .../shaders-msl/frag/unary-enclose.frag | 26 + .../frag/vecsize-mismatch.shader-inputs.frag | 75 + .../frag/write-depth-in-function.frag | 27 + .../intel/shader-integer-functions2.asm.comp | 31 + .../legacy/vert/transpose.legacy.vert | 33 + ...rays.mask-location-0.msl2.multi-patch.tesc | 188 + .../copy-arrays.mask-location-0.msl2.tesc | 191 + ...rays.mask-location-1.msl2.multi-patch.tesc | 79 + .../copy-arrays.mask-location-1.msl2.tesc | 83 + ...utputs-block.mask-location-0.for-tess.vert | 35 + ...te-outputs-block.mask-location-0.msl2.tesc | 49 + ...lock.mask-location-0.multi-patch.msl2.tesc | 52 + .../write-outputs-block.mask-location-0.vert | 34 + ...utputs-block.mask-location-1.for-tess.vert | 35 + ...te-outputs-block.mask-location-1.msl2.tesc | 49 + ...lock.mask-location-1.multi-patch.msl2.tesc | 52 + .../write-outputs-block.mask-location-1.vert | 34 + .../write-outputs.mask-clip-distance.vert | 73 + ...rite-outputs.mask-location-0.for-tess.vert | 74 + .../write-outputs.mask-location-0.msl2.tesc | 42 + ...e-outputs.mask-location-0.multi-patch.tesc | 87 + .../write-outputs.mask-location-0.tesc | 84 + .../write-outputs.mask-location-0.vert | 38 + ...rite-outputs.mask-location-1.for-tess.vert | 74 + .../write-outputs.mask-location-1.msl2.tesc | 41 + ...e-outputs.mask-location-1.multi-patch.tesc | 48 + .../write-outputs.mask-location-1.tesc | 45 + .../write-outputs.mask-location-1.vert | 38 + ...rite-outputs.mask-point-size.for-tess.vert | 74 + ...e-outputs.mask-point-size.multi-patch.tesc | 95 + .../write-outputs.mask-point-size.tesc | 92 + .../write-outputs.mask-point-size.vert | 38 + ...ite-outputs.mask-position.multi-patch.tesc | 95 + .../masking/write-outputs.mask-position.tesc | 92 + .../tesc/arrayed-block-io.multi-patch.tesc | 111 + .../shaders-msl/tesc/basic.multi-patch.tesc | 23 + .../reference/shaders-msl/tesc/basic.tesc | 22 + ...control-point-inout-types.multi-patch.tesc | 134 + .../complex-control-point-inout-types.tesc | 138 + .../tesc/complex-patch-out-types.tesc | 113 + ...rol-point-array-of-matrix.multi-patch.tesc | 67 + .../load-control-point-array-of-matrix.tesc | 72 + ...rol-point-array-of-struct.multi-patch.tesc | 75 + .../load-control-point-array-of-struct.tesc | 85 + .../load-control-point-array.multi-patch.tesc | 68 + .../tesc/load-control-point-array.tesc | 69 + .../tesc/matrix-output.multi-patch.tesc | 39 + .../tesc/reload-tess-level.multi-patch.tesc | 35 + .../shaders-msl/tesc/reload-tess-level.tesc | 35 + .../tesc/struct-output.multi-patch.tesc | 45 + .../tesc/water_tess.multi-patch.tesc | 135 + .../shaders-msl/tesc/water_tess.tesc | 137 + .../tese/in-array-of-struct.raw-tess-in.tese | 73 + ...-block-with-nested-struct.raw-tess-in.tese | 39 + .../tese/in-block-with-nested-struct.tese | 44 + .../shaders-msl/tese/input-array.tese | 37 + .../tese/input-types.raw-tess-in.tese | 81 + .../shaders-msl/tese/input-types.tese | 87 + .../load-control-point-array-of-matrix.tese | 83 + .../tese/load-control-point-array.tese | 80 + .../shaders-msl/tese/quad.domain.tese | 74 + .../reference/shaders-msl/tese/quad.tese | 79 + .../read-tess-level-in-func-quad.msl2.tese | 78 + ...s-level-in-func-quad.raw-tess-in.msl2.tese | 72 + .../tese/read-tess-level-in-func.msl2.tese | 75 + ...d-tess-level-in-func.raw-tess-in.msl2.tese | 70 + .../shaders-msl/tese/set-from-function.tese | 63 + .../shaders-msl/tese/triangle-tess-level.tese | 69 + .../reference/shaders-msl/tese/triangle.tese | 17 + .../tese/water_tess.raw-tess-in.tese | 77 + .../shaders-msl/tese/water_tess.tese | 76 + .../vert/array-component-io.for-tess.vert | 98 + .../shaders-msl/vert/array-component-io.vert | 100 + .../shaders-msl/vert/basic.capture.vert | 29 + .../shaders-msl/vert/basic.for-tess.vert | 31 + .../reference/shaders-msl/vert/basic.vert | 30 + .../vert/buffer_device_address.msl2.vert | 49 + .../clip-distance-block.no-user-varying.vert | 25 + .../shaders-msl/vert/clip-distance-block.vert | 29 + .../shaders-msl/vert/copy.flatten.vert | 54 + .../shaders-msl/vert/dynamic.flatten.vert | 43 + .../vert/float-math.invariant-float-math.vert | 136 + .../shaders-msl/vert/float-math.vert | 87 + .../reference/shaders-msl/vert/functions.vert | 122 + .../shaders-msl/vert/implicit-position-1.vert | 18 + .../shaders-msl/vert/implicit-position-2.vert | 9 + .../shaders-msl/vert/in_out_array_mat.vert | 119 + .../interface-block-block-composites.frag | 97 + .../interface-block-block-composites.vert | 105 + .../interface-block-single-element-array.vert | 79 + .../vert/interpolation-qualifiers-block.vert | 55 + .../vert/interpolation-qualifiers.vert | 36 + .../shaders-msl/vert/invariant.msl21.vert | 26 + .../vert/leaf-function.capture.vert | 37 + .../vert/leaf-function.for-tess.vert | 39 + .../shaders-msl/vert/no-contraction.vert | 92 + .../no-disable-vertex-out.frag-output.vert | 28 + .../vert/no_stage_out.for-tess.vert | 23 + .../shaders-msl/vert/no_stage_out.vert | 20 + .../vert/no_stage_out.write_buff.vert | 35 + .../vert/no_stage_out.write_buff_atomic.vert | 31 + .../vert/no_stage_out.write_tex.vert | 25 + .../out-block-with-nested-struct-array.vert | 88 + .../vert/out-block-with-struct-array.vert | 83 + .../reference/shaders-msl/vert/out_block.vert | 41 + .../shaders-msl/vert/packed-bool-to-uint.vert | 38 + .../vert/packed-bool2-to-packed_uint2.vert | 38 + .../shaders-msl/vert/packed_matrix.vert | 55 + .../reference/shaders-msl/vert/pointsize.vert | 33 + .../vert/read-from-row-major-array.vert | 63 + .../vert/resource-arrays-leaf.ios.vert | 50 + .../shaders-msl/vert/resource-arrays.ios.vert | 42 + .../vert/return-array.force-native-array.vert | 154 + .../shaders-msl/vert/return-array.vert | 81 + .../shaders-msl/vert/set_builtin_in_func.vert | 27 + .../shaders-msl/vert/sign-int-types.vert | 60 + .../signedness-mismatch.shader-inputs.vert | 74 + ...re_buffer.texture-buffer-native.msl21.vert | 17 + .../shaders-msl/vert/texture_buffer.vert | 26 + .../shaders-msl/vert/ubo.alignment.vert | 38 + .../reference/shaders-msl/vert/ubo.vert | 30 + .../uniform-struct-out-of-order-offests.vert | 35 + .../vert/uniform-struct-packing-nested.vert | 57 + .../shaders-msl/vert/unused-position.vert | 18 + ...asic.multiview.no-layered.nocompat.vk.frag | 73 + .../frag/basic.multiview.nocompat.vk.frag | 73 + ...lper-forwarding.asm.vk.nocompat.msl23.frag | 24 + .../demote-to-helper.vk.nocompat.msl23.frag | 28 + ...emote-to-helper.vk.nocompat.msl23.ios.frag | 14 + .../vulkan/frag/push-constant.vk.frag | 28 + .../vulkan/frag/spec-constant.msl11.vk.frag | 126 + .../vulkan/frag/spec-constant.vk.frag | 110 + ...oup.multiview.viewfromdev.nocompat.vk.vert | 19 + .../vulkan/vert/device-group.nocompat.vk.vert | 18 + ...view.multiview.no-layered.nocompat.vk.vert | 28 + .../vert/multiview.multiview.nocompat.vk.vert | 31 + .../vulkan/vert/multiview.nocompat.vk.vert | 29 + .../vulkan/vert/small-storage.vk.vert | 48 + .../vulkan/vert/vulkan-vertex.vk.vert | 17 + ...ss-chain-dominator-in-loop-body-2.asm.comp | 30 + ...cess-chain-dominator-in-loop-body.asm.comp | 27 + ...ess-tracking-function-call-result.asm.comp | 24 + ...ased-struct-divergent-member-name.asm.comp | 25 + ...c-conversion-signs.asm.nocompat.vk.comp.vk | 46 + .../asm/comp/atomic-load-store.asm.comp | 16 + .../asm/comp/atomic-result-temporary.asm.comp | 18 + .../asm/comp/basic.spv16.asm.comp | 13 + ...ay-in-buffer.asm.spv16.nocompat.vk.comp.vk | 45 + .../asm/comp/bitcast-fp16-fp32.asm.vk.comp | 24 + .../asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk | 25 + .../comp/bitfield-signed-operations.asm.comp | 27 + .../shaders-no-opt/asm/comp/bitscan.asm.comp | 27 + ...-atomic-nonuniform.vk.nocompat.asm.comp.vk | 15 + ...ddress-ptr-casting.vk.nocompat.asm.comp.vk | 37 + ...aliased-block-name.nocompat.vk.asm.comp.vk | 35 + ...r-to-pod-in-buffer.asm.nocompat.vk.comp.vk | 19 + ...used-pod-in-buffer.asm.nocompat.vk.comp.vk | 13 + ...thesized-pointer-2.asm.nocompat.vk.comp.vk | 25 + ...ynthesized-pointer.asm.nocompat.vk.comp.vk | 25 + .../comp/constant-composite-undef.asm.comp | 15 + .../comp/constant-lut-name-aliasing.asm.comp | 16 + .../asm/comp/copy-logical.spv14.asm.comp | 45 + ...-in-entry-point.noeliminate.spv14.asm.comp | 7 + .../comp/expression-nesting-limits.asm.comp | 34 + .../extended-debug-extinst.invalid.asm.comp | 18 + .../fuzz-collapse-degenerate-loop.asm.comp | 51 + ...r-with-unreachable-continue-block.asm.comp | 411 + .../asm/comp/glsl-signed-operations.asm.comp | 47 + .../glsl.std450.frexp-modf-struct.asm.comp | 33 + ...-atomic-nonuniform.vk.nocompat.asm.comp.vk | 12 + .../comp/local-size-id-override.vk.asm.comp | 29 + .../local-size-id-override.vk.asm.comp.vk | 16 + .../asm/comp/local-size-id.vk.asm.comp | 31 + .../asm/comp/local-size-id.vk.asm.comp.vk | 22 + ...iable-early-read-with-initializer.asm.comp | 107 + ...op-variable-early-read-with-undef.asm.comp | 108 + .../loop-variable-with-initializer.asm.comp | 12 + .../multi-break-switch-out-of-loop.asm.comp | 52 + ...m-bracket-handling.vk.nocompat.asm.comp.vk | 55 + ...porary-copy-loop-variable.asm.invalid.comp | 20 + ...mporary-rtas.spv14.asm.vk.nocompat.comp.vk | 28 + ...ction-object.spv14.asm.vk.nocompat.comp.vk | 15 + .../spec-constant-name-aliasing.vk.asm.comp | 44 + ...spec-constant-name-aliasing.vk.asm.comp.vk | 26 + .../spec-constant-op-convert-sign.asm.comp | 39 + .../asm/comp/storage-buffer-basic.asm.comp | 28 + ...-access-terminator.vk.nocompat.asm.comp.vk | 36 + .../degenerate-selection-constructs.asm.frag | 118 + .../anonymous-inner-struct-names.asm.frag | 63 + .../array-builtin-bitcast-load-store.asm.frag | 28 + .../frag/collapsed-switch-phi-flush.asm.frag | 11 + ...ge-sampler-dxc-min16float.asm.invalid.frag | 28 + ...mplex-opaque-handle-reuse-in-loop.asm.frag | 71 + ...site-insert-hoisted-temporaries-1.asm.frag | 27 + ...site-insert-hoisted-temporaries-2.asm.frag | 29 + .../composite-insert-inheritance.asm.frag | 73 + ...pure-function-call.vk.nocompat.asm.frag.vk | 22 + .../discard-impure-function-call.asm.frag | 21 + .../do-while-continue-phi.asm.invalid.frag | 37 + .../frag/do-while-loop-inverted-test.asm.frag | 13 + .../early-conditional-return-switch.asm.frag | 67 + .../asm/frag/empty-struct-in-struct.asm.frag | 31 + ...ated-merge-block-inverted.asm.invalid.frag | 11 + ...-merge-block-non-inverted.asm.invalid.frag | 11 + .../asm/frag/for-loop-inverted-test.asm.frag | 11 + .../asm/frag/image-fetch-uint-coord.asm.frag | 12 + .../inliner-dominator-inside-loop.asm.frag | 213 + .../late-expression-invalidation-2.asm.frag | 263 + .../late-expression-invalidation.asm.frag | 54 + .../asm/frag/ldexp-uint-exponent.asm.frag | 13 + .../loop-merge-to-continue.asm.invalid.frag | 17 + ...bracket-handling-2.vk.nocompat.asm.frag.vk | 20 + ...lifier-propagation.vk.nocompat.asm.frag.vk | 37 + .../nonuniform-ssbo.nocompat.vk.asm.frag.vk | 24 + .../frag/only-initializer-frag-depth.asm.frag | 8 + .../opaque-id-literal-alias.preserve.asm.frag | 20 + .../asm/frag/out-of-order-struct-id.asm.frag | 25 + ...rnative-precision.asm..vk.nocompat.frag.vk | 29 + .../asm/frag/phi.zero-initialize.asm.frag | 30 + .../frag/pixel-interlock-callstack.asm.frag | 51 + .../pixel-interlock-control-flow.asm.frag | 65 + .../pixel-interlock-split-functions.asm.frag | 61 + ...ritance-rules-hoisted-temporaries.asm.frag | 23 + ...heritance-rules-hoisted-temporary.asm.frag | 19 + ...laxed-precision-inheritance-rules.asm.frag | 55 + .../reserved-function-identifier.asm.frag | 21 + .../asm/frag/reserved-identifiers.asm.frag | 17 + .../asm/frag/scalar-select.spv14.asm.frag | 19 + ...lection-merge-to-continue.asm.invalid.frag | 21 + ...exture-feedback-uint-code.asm.desktop.frag | 23 + ...up-arithmetic-cast.nocompat.vk.asm.frag.vk | 24 + .../asm/frag/subgroup-ballot-only.vk.asm.frag | 32 + .../frag/subgroup-ballot-only.vk.asm.frag.vk | 15 + ...ch-block-case-fallthrough.asm.invalid.frag | 63 + .../switch-merge-to-continue.asm.invalid.frag | 30 + ...ch-non-default-fallthrough-no-phi.asm.frag | 88 + ...tch-single-case-multiple-exit-cfg.asm.frag | 26 + ...minate-impure-function-call.spv16.asm.frag | 21 + .../frag/texel-fetch-ms-uint-sample.asm.frag | 15 + .../asm/frag/unordered-compare.asm.frag | 34 + .../frag/unordered-compare.relax-nan.asm.frag | 34 + ...tor-extract-dynamic-spec-constant.asm.frag | 27 + .../frag/vector-shuffle-undef-index.asm.frag | 12 + .../frag/while-loop-inverted-test.asm.frag | 13 + .../geom/store-uint-layer.invalid.asm.geom | 41 + .../loop-header-self-continue-break.asm.comp | 89 + ...ltin-outputs.spv14.asm.vk.nocompat.mesh.vk | 44 + ...n-nonuniform.spv14.vk.nocompat.asm.rgen.vk | 19 + .../task-shader.vk.nocompat.spv14.asm.task.vk | 35 + .../asm/temporary.zero-initialize.asm.frag | 28 + ...array-of-block-output-initializer.asm.tesc | 82 + .../tesc/copy-memory-control-point.asm.tesc | 73 + ...input-array-builtin-array.invalid.asm.tesc | 79 + .../asm/tesc/tess-level-initializer.asm.tesc | 24 + .../vert/block-struct-initializer.asm.vert | 24 + .../vert/builtin-output-initializer.asm.vert | 14 + .../asm/vert/complex-link-by-name.asm.vert | 35 + ...by-name.force-flattened-io.legacy.asm.vert | 33 + .../vert/constant-composite-extract.asm.vert | 7 + .../vert/debug-printf.asm.vk.nocompat.vert.vk | 10 + .../asm/vert/empty-struct-composite.asm.vert | 13 + .../asm/vert/fma-legacy-fallback.asm.vert | 10 + .../asm/vert/semantic-decoration.asm.vert | 25 + .../comp/bitcast-16bit-1.invalid.comp | 38 + .../comp/bitcast-16bit-2.invalid.comp | 47 + .../shaders-no-opt/comp/bitfield.comp | 19 + .../shaders-no-opt/comp/glsl.std450.comp | 112 + .../comp/illegal-struct-name.asm.comp | 22 + .../comp/image-load-formatted.comp | 12 + .../comp/inout-struct.invalid.comp | 65 + .../shaders-no-opt/comp/int16min-literal.comp | 36 + .../shaders-no-opt/comp/int64min-literal.comp | 29 + .../shaders-no-opt/comp/intmin-literal.comp | 18 + ...loop-break-merge-after-inner-continue.comp | 22 + .../comp/loop-resolve-debug-semantics.g.comp | 16 + .../comp/loop-resolve-debug-semantics.gV.comp | 16 + .../reference/shaders-no-opt/comp/loop.comp | 82 + .../reference/shaders-no-opt/comp/return.comp | 35 + ...ballot_nonuniform_invocations.invalid.comp | 11 + .../specialization-constant-evaluation.comp | 321 + ...packing-scalar.nocompat.invalid.vk.comp.vk | 105 + .../subgroups.nocompat.invalid.vk.comp.vk | 116 + .../comp/subgroups_arithmetic_fadd.vk.comp | 892 + .../comp/subgroups_arithmetic_fadd.vk.comp.vk | 56 + .../comp/subgroups_arithmetic_fmul.vk.comp | 892 + .../comp/subgroups_arithmetic_fmul.vk.comp.vk | 56 + .../comp/subgroups_arithmetic_iadd.vk.comp | 892 + .../comp/subgroups_arithmetic_iadd.vk.comp.vk | 56 + .../comp/subgroups_arithmetic_imul.vk.comp | 892 + .../comp/subgroups_arithmetic_imul.vk.comp.vk | 56 + .../comp/subgroups_basicvoteballot.vk.comp | 401 + .../comp/subgroups_basicvoteballot.vk.comp.vk | 45 + .../comp/trivial-select-cast-vector.comp | 15 + .../comp/trivial-select-matrix.spv14.comp | 16 + .../frag/16bit-constants.invalid.frag | 29 + .../frag/fp16.invalid.desktop.frag | 159 + .../frag/frag-fully-covered.frag | 14 + ...h_subpassInput.vk.nocompat.invalid.frag.vk | 11 + .../shaders-no-opt/frag/fs.invalid.frag | 15 + .../shaders-no-opt/frag/image-gather.frag | 15 + .../modf-non-function-purity-analysis.frag | 18 + ...mensional.desktop.invalid.flatten_dim.frag | 24 + ...nonuniform-constructor.vk.nocompat.frag.vk | 15 + .../pixel-interlock-simple-callstack.frag | 46 + ...out-ubo-std430.vk.nocompat.invalid.frag.vk | 24 + .../frag/sparse-texture-clamp.desktop.frag | 46 + .../frag/sparse-texture-feedback.desktop.frag | 105 + ...pass-input.framebuffer-fetch.nocompat.frag | 18 + ...ocompat.framebuffer-fetch-noncoherent.frag | 18 + ...put.framebuffer-fetch.nocompat.legacy.frag | 16 + ....legacy.framebuffer-fetch-noncoherent.frag | 16 + .../frag/texture-gather-offsets.frag | 12 + .../texture-gather-uint-component.asm.frag | 12 + .../frag/texture1d-emulation.es.frag | 30 + .../frag/texture1d-emulation.legacy.frag | 21 + .../frag/variables.zero-initialize.frag | 28 + ...gle-case-multiple-exit-cfg.legacy.asm.frag | 24 + ...k-shader-basic-2.vk.spv14.nocompat.task.vk | 42 + ...ask-shader-basic.vk.spv14.nocompat.task.vk | 35 + .../vert/io-blocks.force-flattened-io.vert | 25 + .../vert/pass-array-by-value.vert | 27 + .../frag/shading-rate.vk.nocompat.frag.vk | 10 + .../vulkan/frag/spec-constant.vk.frag | 131 + .../vulkan/frag/spec-constant.vk.frag.vk | 107 + ...bo-offset-out-of-order.vk.nocompat.frag.vk | 16 + ...elper-invocation.vk.nocompat.spv16.frag.vk | 16 + ...primitive-shading-rate.vk.nocompat.vert.vk | 9 + .../aliased-entry-point-names.asm.multi.json | 55 + ...to-array-of-physical-pointer.asm.comp.json | 71 + .../asm/op-source-glsl-ssbo-1.asm.comp.json | 46 + .../asm/op-source-glsl-ssbo-2.asm.comp.json | 70 + .../asm/op-source-hlsl-uav-1.asm.comp.json | 46 + .../asm/op-source-hlsl-uav-2.asm.comp.json | 53 + .../asm/op-source-none-ssbo-1.asm.comp.json | 46 + .../asm/op-source-none-ssbo-2.asm.comp.json | 70 + .../asm/op-source-none-uav-1.asm.comp.json | 46 + .../asm/op-source-none-uav-2.asm.comp.json | 53 + .../comp/array-of-physical-pointer.comp.json | 66 + .../function-pointer.invalid.asm.comp.json | 18 + .../comp/out-of-order-block-offsets.comp.json | 44 + .../comp/physical-pointer.comp.json | 55 + .../comp/struct-layout.comp.json | 83 + .../comp/struct-packing.comp.json | 590 + .../workgroup-size-spec-constant.comp.json | 62 + ...mbined-texture-sampler-shadow.vk.frag.json | 37 + .../combined-texture-sampler.vk.frag.json | 50 + .../image-load-store-uint-coord.asm.frag.json | 47 + .../frag/input-attachment-ms.vk.frag.json | 31 + .../frag/input-attachment.vk.frag.json | 31 + .../frag/push-constant.vk.frag.json | 46 + ...eparate-sampler-texture-array.vk.frag.json | 85 + .../frag/spec-constant.vk.frag.json | 90 + .../rgen/acceleration_structure.vk.rgen.json | 16 + .../vert/array-size-reflection.vert.json | 78 + .../vert/read-from-row-major-array.vert.json | 67 + .../vert/stride-reflection.vert.json | 96 + .../vert/texture_buffer.vert.json | 41 + ...schain-invalid-expression.asm.invalid.frag | 361 + .../frag/array-copy-error.asm.invalid.frag | 353 + .../phi-variable-declaration.asm.invalid.frag | 353 + .../asm/tese/ds-texcoord-array.asm.tese | 314 + ...-accesschain-writethrough.asm.invalid.vert | 122 + .../asm/frag/depth-compare.asm.frag | 315 + .../asm/frag/global-constant-arrays.asm.frag | 1346 ++ .../padded-float-array-member-defef.asm.frag | 1392 ++ .../asm/frag/sample-mask-not-array.asm.frag | 503 + ...bpass-input.ios.framebuffer-fetch.asm.frag | 213 + ...ass-input.msl23.framebuffer-fetch.asm.frag | 213 + .../texture-atomics.asm.argument.msl2.frag | 130 + .../asm/frag/texture-atomics.asm.frag | 122 + ...re-atomics.asm.graphics-robust-access.frag | 122 + .../hs-incorrect-base-type.invalid.asm.tesc | 395 + .../hs-input-array-access.invalid.asm.tesc | 463 + .../tesc/hs-texcoord-array.invalid.asm.tesc | 407 + ...actor-must-be-threadgroup.invalid.asm.tesc | 174 + .../asm/tese/ds-double-gl-in-deref.asm.tese | 419 + .../asm/tese/ds-patch-input-fixes.asm.tese | 416 + .../asm/tese/ds-patch-inputs.asm.tese | 216 + .../asm/vert/array-missing-copies.asm.vert | 467 + .../asm/vert/texture-buffer.asm.vert | 387 + .../reference/shaders/amd/gcn_shader.comp | 18 + .../reference/shaders/amd/shader_ballot.comp | 38 + .../shaders/amd/shader_group_vote.comp | 18 + .../shaders/amd/shader_trinary_minmax.comp | 11 + .../asm/comp/atomic-decrement.asm.comp | 18 + .../asm/comp/atomic-increment.asm.comp | 18 + .../shaders/asm/comp/bitcast_iadd.asm.comp | 27 + .../shaders/asm/comp/bitcast_icmp.asm.comp | 27 + .../shaders/asm/comp/bitcast_iequal.asm.comp | 33 + .../shaders/asm/comp/bitcast_sar.asm.comp | 29 + .../shaders/asm/comp/bitcast_sdiv.asm.comp | 29 + .../shaders/asm/comp/bitcast_slr.asm.comp | 29 + .../asm/comp/block-name-alias-global.asm.comp | 37 + .../asm/comp/builtin-compute-bitcast.asm.comp | 13 + .../asm/comp/control-flow-hints.asm.comp | 58 + .../asm/comp/decoration-group.asm.comp | 38 + .../comp/global-parameter-name-alias.asm.comp | 27 + .../asm/comp/hlsl-functionality.asm.comp | 24 + .../shaders/asm/comp/logical.asm.comp | 56 + .../shaders/asm/comp/multiple-entry.asm.comp | 27 + .../shaders/asm/comp/nmin-max-clamp.asm.comp | 44 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 39 + .../shaders/asm/comp/op-phi-swap.asm.comp | 40 + .../shaders/asm/comp/quantize.asm.comp | 19 + .../asm/comp/recompile-block-naming.asm.comp | 36 + ...specialization-constant-workgroup.asm.comp | 21 + .../comp/switch-break-ladder.asm.invalid.comp | 64 + .../undefined-constant-composite.asm.comp | 33 + .../frag/combined-sampler-reuse.vk.asm.frag | 13 + .../combined-sampler-reuse.vk.asm.frag.vk | 14 + .../frag/complex-name-workarounds.asm.frag | 28 + ...osite-construct-struct-no-swizzle.asm.frag | 19 + .../asm/frag/default-member-names.asm.frag | 32 + .../frag/do-while-statement-fallback.asm.frag | 58 + .../shaders/asm/frag/empty-struct.asm.frag | 25 + .../frag/for-loop-phi-only-continue.asm.frag | 18 + .../reference/shaders/asm/frag/frem.asm.frag | 13 + .../asm/frag/function-overload-alias.asm.frag | 39 + .../hlsl-sample-cmp-level-zero-cube.asm.frag | 17 + .../frag/hlsl-sample-cmp-level-zero.asm.frag | 27 + .../asm/frag/image-extract-reuse.asm.frag | 11 + .../frag/image-fetch-no-sampler.asm.vk.frag | 38 + .../image-fetch-no-sampler.asm.vk.frag.vk | 37 + ...etch-no-sampler.no-samplerless.asm.vk.frag | 38 + ...h-no-sampler.no-samplerless.asm.vk.frag.vk | 37 + ...uery-no-sampler.no-samplerless.vk.asm.frag | 13 + ...y-no-sampler.no-samplerless.vk.asm.frag.vk | 14 + .../frag/image-query-no-sampler.vk.asm.frag | 13 + .../image-query-no-sampler.vk.asm.frag.vk | 14 + .../asm/frag/implicit-read-dep-phi.asm.frag | 39 + .../asm/frag/inf-nan-constant-double.asm.frag | 17 + .../asm/frag/inf-nan-constant.asm.frag | 11 + .../shaders/asm/frag/invalidation.asm.frag | 15 + .../asm/frag/line-directive.line.asm.frag | 71 + .../asm/frag/locations-components.asm.frag | 25 + ...op-body-dominator-continue-access.asm.frag | 63 + .../asm/frag/loop-header-to-continue.asm.frag | 45 + .../frag/lut-promotion-initializer.asm.frag | 40 + .../asm/frag/multi-for-loop-init.asm.frag | 19 + .../asm/frag/op-constant-null.asm.frag | 23 + .../frag/op-phi-swap-continue-block.asm.frag | 24 + ...t-of-bounds-access-opspecconstant.asm.frag | 15 + .../asm/frag/out-of-bounds-access.asm.frag | 14 + .../asm/frag/pack-and-unpack-uint2.asm.frag | 18 + .../shaders/asm/frag/pass-by-value.asm.frag | 21 + .../asm/frag/phi-loop-variable.asm.frag | 9 + .../asm/frag/sample-and-compare.asm.frag | 13 + ...pler-buffer-array-without-sampler.asm.frag | 28 + .../sampler-buffer-without-sampler.asm.frag | 20 + .../frag/single-function-private-lut.asm.frag | 26 + .../reference/shaders/asm/frag/srem.asm.frag | 13 + .../storage-class-output-initializer.asm.frag | 13 + .../struct-composite-extract-swizzle.asm.frag | 21 + .../frag/switch-label-shared-block.asm.frag | 32 + .../switch-preserve-sign-extension.asm.frag | 27 + .../asm/frag/temporary-name-alias.asm.frag | 10 + .../asm/frag/temporary-phi-hoisting.asm.frag | 26 + .../asm/frag/texel-fetch-no-lod.asm.frag | 11 + .../frag/texture-sampling-fp16.asm.vk.frag | 19 + .../frag/texture-sampling-fp16.asm.vk.frag.vk | 20 + .../asm/frag/undef-variable-store.asm.frag | 29 + .../asm/frag/unknown-depth-state.asm.vk.frag | 23 + .../frag/unknown-depth-state.asm.vk.frag.vk | 24 + .../shaders/asm/frag/unreachable.asm.frag | 28 + .../asm/frag/vector-shuffle-oom.asm.frag | 326 + .../asm/geom/block-name-namespace.asm.geom | 33 + .../inout-split-access-chain-handle.asm.geom | 23 + .../geom/split-access-chain-input.asm.geom | 9 + .../asm/geom/unroll-glposition-load.asm.geom | 35 + .../asm/tese/unroll-input-array-load.asm.tese | 48 + .../shaders/asm/vert/empty-io.asm.vert | 35 + ...act-transposed-matrix-from-struct.asm.vert | 52 + .../asm/vert/global-builtin.sso.asm.vert | 35 + .../shaders/asm/vert/invariant-block.asm.vert | 9 + .../asm/vert/invariant-block.sso.asm.vert | 17 + .../shaders/asm/vert/invariant.asm.vert | 15 + .../shaders/asm/vert/invariant.sso.asm.vert | 20 + .../spec-constant-op-composite.asm.vk.vert | 35 + .../spec-constant-op-composite.asm.vk.vert.vk | 30 + .../vert/uint-vertex-id-instance-id.asm.vert | 25 + .../reference/shaders/comp/atomic.comp | 49 + .../reference/shaders/comp/bake_gradient.comp | 39 + .../reference/shaders/comp/barriers.comp | 77 + .../reference/shaders/comp/basic.comp | 29 + .../reference/shaders/comp/casts.comp | 19 + .../shaders/comp/cfg-preserve-parameter.comp | 74 + .../reference/shaders/comp/cfg.comp | 81 + .../shaders/comp/coherent-block.comp | 13 + .../shaders/comp/coherent-image.comp | 15 + .../comp/composite-array-initialization.comp | 38 + .../shaders/comp/composite-construct.comp | 40 + .../reference/shaders/comp/culling.comp | 29 + .../reference/shaders/comp/defer-parens.comp | 21 + .../reference/shaders/comp/dowhile.comp | 29 + .../shaders/comp/generate_height.comp | 95 + .../reference/shaders/comp/image.comp | 12 + .../reference/shaders/comp/insert.comp | 19 + .../reference/shaders/comp/mat3.comp | 14 + .../reference/shaders/comp/mod.comp | 24 + .../reference/shaders/comp/modf.comp | 22 + .../reference/shaders/comp/outer-product.comp | 36 + .../shaders/comp/read-write-only.comp | 27 + .../reference/shaders/comp/rmw-matrix.comp | 20 + .../reference/shaders/comp/rmw-opt.comp | 27 + ...alar-std450-distance-length-normalize.comp | 19 + .../reference/shaders/comp/shared.comp | 24 + .../shaders/comp/ssbo-array-length.comp | 14 + .../reference/shaders/comp/ssbo-array.comp | 14 + .../reference/shaders/comp/struct-layout.comp | 24 + .../shaders/comp/struct-packing.comp | 104 + .../reference/shaders/comp/torture-loop.comp | 49 + .../reference/shaders/comp/type-alias.comp | 49 + .../reference/shaders/comp/udiv.comp | 18 + .../desktop-only/comp/enhanced-layouts.comp | 40 + .../comp/extended-arithmetic.desktop.comp | 159 + .../desktop-only/comp/fp64.desktop.comp | 83 + .../image-formats.desktop.noeliminate.comp | 47 + .../desktop-only/comp/int64.desktop.comp | 58 + .../frag/clip-cull-distance.desktop.frag | 12 + .../control-dependent-in-branch.desktop.frag | 37 + .../frag/depth-greater-than.desktop.frag | 9 + .../frag/depth-less-than.desktop.frag | 9 + .../frag/dual-source-blending.desktop.frag | 11 + .../frag/hlsl-uav-block-alias.asm.frag | 24 + .../desktop-only/frag/image-ms.desktop.frag | 13 + .../frag/image-query.desktop.frag | 53 + .../shaders/desktop-only/frag/image-size.frag | 12 + .../image-size.no-qualifier-deduction.frag | 12 + .../frag/in-block-qualifiers.frag | 21 + .../frag/layout-component.desktop.frag | 16 + .../frag/query-levels.desktop.frag | 11 + .../desktop-only/frag/query-lod.desktop.frag | 12 + .../frag/sampler-ms-query.desktop.frag | 14 + .../frag/stencil-export.desktop.frag | 13 + .../frag/texture-proj-shadow.desktop.frag | 28 + .../desktop-only/geom/basic.desktop.sso.geom | 35 + .../geom/viewport-index.desktop.geom | 9 + .../desktop-only/tesc/basic.desktop.sso.tesc | 27 + .../tese/triangle.desktop.sso.tese | 18 + .../desktop-only/vert/basic.desktop.sso.vert | 22 + .../vert/clip-cull-distance.desktop.sso.vert | 20 + .../vert/clip-cull-distance.desktop.vert | 15 + .../vert/out-block-qualifiers.vert | 27 + ...shader-draw-parameters-450.desktop.vk.vert | 24 + ...der-draw-parameters-450.desktop.vk.vert.vk | 8 + .../shader-draw-parameters.desktop.vk.vert | 24 + .../shader-draw-parameters.desktop.vk.vert.vk | 7 + .../shaders/flatten/array.flatten.vert | 12 + .../shaders/flatten/basic.flatten.vert | 13 + .../shaders/flatten/copy.flatten.vert | 30 + .../shaders/flatten/dynamic.flatten.vert | 25 + .../flatten/matrix-conversion.flatten.frag | 14 + .../shaders/flatten/matrixindex.flatten.vert | 19 + .../shaders/flatten/multiindex.flatten.vert | 10 + .../flatten/push-constant.flatten.vert | 13 + .../shaders/flatten/rowmajor.flatten.vert | 11 + .../shaders/flatten/struct.flatten.vert | 22 + .../flatten/struct.rowmajor.flatten.vert | 26 + .../shaders/flatten/swizzle.flatten.vert | 21 + .../shaders/flatten/types.flatten.frag | 14 + .../frag/array-lut-no-loop-variable.frag | 15 + .../avoid-expression-lowering-to-loop.frag | 26 + .../shaders/frag/barycentric-khr.frag | 13 + .../shaders/frag/barycentric-nv.frag | 13 + .../reference/shaders/frag/basic.frag | 15 + .../complex-expression-in-access-chain.frag | 24 + .../composite-extract-forced-temporary.frag | 15 + .../shaders/frag/constant-array.frag | 29 + .../shaders/frag/constant-composites.frag | 23 + .../shaders/frag/false-loop-init.frag | 25 + .../reference/shaders/frag/flush_params.frag | 30 + .../frag/for-loop-continue-control-flow.frag | 34 + .../reference/shaders/frag/for-loop-init.frag | 52 + .../reference/shaders/frag/frexp-modf.frag | 43 + .../reference/shaders/frag/front-facing.frag | 20 + .../reference/shaders/frag/gather-dref.frag | 14 + .../reference/shaders/frag/ground.frag | 62 + .../shaders/frag/helper-invocation.frag | 28 + ...temporary-use-continue-block-as-value.frag | 31 + .../frag/image-load-store-uint-coord.asm.frag | 26 + ...-loop-dominated-variable-preservation.frag | 30 + .../loop-dominator-and-switch-default.frag | 50 + .../reference/shaders/frag/lut-promotion.frag | 40 + .../reference/shaders/frag/mix.frag | 20 + .../frag/modf-pointer-function-analysis.frag | 32 + .../shaders/frag/partial-write-preserve.frag | 109 + .../shaders/frag/pixel-interlock-ordered.frag | 35 + .../frag/pixel-interlock-unordered.frag | 35 + .../reference/shaders/frag/pls.frag | 21 + .../shaders/frag/post-depth-coverage-es.frag | 14 + .../shaders/frag/post-depth-coverage.frag | 15 + .../reference/shaders/frag/round-even.frag | 12 + .../reference/shaders/frag/round.frag | 12 + .../frag/sample-interlock-ordered.frag | 35 + .../frag/sample-interlock-unordered.frag | 35 + .../shaders/frag/sample-parameter.frag | 13 + .../reference/shaders/frag/sampler-ms.frag | 14 + .../reference/shaders/frag/sampler-proj.frag | 16 + .../reference/shaders/frag/sampler.frag | 21 + .../shaders/frag/scalar-refract-reflect.frag | 13 + .../frag/selection-block-dominator.frag | 20 + .../reference/shaders/frag/shader-clock.frag | 23 + .../frag/struct-type-unrelated-alias.frag | 18 + .../frag/switch-unreachable-break.frag | 36 + .../shaders/frag/switch-unsigned-case.frag | 29 + .../reference/shaders/frag/swizzle.frag | 20 + .../shaders/frag/texel-fetch-offset.frag | 14 + .../frag/ubo-load-row-major-workaround.frag | 48 + .../reference/shaders/frag/ubo_layout.frag | 26 + .../reference/shaders/frag/unary-enclose.frag | 16 + .../reference/shaders/geom/basic.geom | 26 + .../shaders/geom/geometry-passthrough.geom | 27 + .../shaders/geom/lines-adjacency.geom | 26 + .../reference/shaders/geom/lines.geom | 23 + .../reference/shaders/geom/multi-stream.geom | 14 + .../reference/shaders/geom/points.geom | 26 + .../shaders/geom/single-invocation.geom | 26 + .../geom/transform-feedback-streams.geom | 26 + .../shaders/geom/triangles-adjacency.geom | 26 + .../reference/shaders/geom/triangles.geom | 26 + .../legacy/fragment/explicit-lod.legacy.frag | 12 + .../legacy/fragment/explicit-lod.legacy.vert | 11 + .../shaders/legacy/fragment/fma.legacy.frag | 14 + .../legacy/fragment/hyperbolic.legacy.frag | 52 + .../legacy/fragment/io-blocks.legacy.frag | 12 + .../legacy/fragment/isnan-isinf.legacy.frag | 28 + .../shaders/legacy/fragment/modf.legacy.frag | 22 + .../multiple-struct-flattening.legacy.frag | 39 + .../shaders/legacy/fragment/round.legacy.frag | 13 + .../fragment/struct-varying.legacy.frag | 22 + .../legacy/fragment/switch.legacy.frag | 78 + .../legacy/vert/implicit-lod.legacy.vert | 9 + .../legacy/vert/int-attribute.legacy.vert | 13 + .../shaders/legacy/vert/inverse.legacy.vert | 85 + .../shaders/legacy/vert/io-block.legacy.vert | 13 + .../legacy/vert/outer-product.legacy.vert | 19 + .../struct-flatten-inner-array.legacy.vert | 18 + ...flatten-stores-multi-dimension.legacy.vert | 49 + .../legacy/vert/struct-varying.legacy.vert | 26 + .../legacy/vert/switch-nested.legacy.vert | 41 + .../shaders/legacy/vert/transpose.legacy.vert | 60 + ...ader-basic-lines.spv14.vk.nocompat.mesh.vk | 63 + ...der-basic-points.spv14.vk.nocompat.mesh.vk | 63 + ...r-basic-triangle.spv14.vk.nocompat.mesh.vk | 63 + .../reference/shaders/tesc/basic.tesc | 17 + .../reference/shaders/tesc/water_tess.tesc | 116 + .../reference/shaders/tese/ccw.tese | 9 + .../reference/shaders/tese/cw.tese | 9 + .../reference/shaders/tese/equal.tese | 9 + .../shaders/tese/fractional_even.tese | 9 + .../shaders/tese/fractional_odd.tese | 9 + .../reference/shaders/tese/input-array.tese | 11 + .../reference/shaders/tese/line.tese | 9 + .../shaders/tese/load-array-of-array.tese | 16 + .../shaders/tese/patch-input-array.tese | 10 + .../reference/shaders/tese/triangle.tese | 9 + .../reference/shaders/tese/water_tess.tese | 61 + .../reference/shaders/vert/basic.vert | 17 + .../reference/shaders/vert/ground.vert | 116 + .../reference/shaders/vert/invariant.vert | 19 + .../shaders/vert/no-contraction.vert | 24 + .../reference/shaders/vert/ocean.vert | 140 + .../vert/read-from-row-major-array.vert | 48 + .../reference/shaders/vert/return-array.vert | 23 + .../shaders/vert/row-major-workaround.vert | 30 + .../shaders/vert/texture_buffer.vert | 11 + .../vert/transform-feedback-decorations.vert | 22 + .../reference/shaders/vert/ubo.vert | 17 + ...ay-of-buffer-reference.nocompat.vk.comp.vk | 25 + ...uffer-reference-atomic.nocompat.vk.comp.vk | 28 + ...base-alignment-promote.nocompat.vk.comp.vk | 29 + ...itcast-uvec2-2.nocompat.invalid.vk.comp.vk | 22 + ...eference-bitcast-uvec2.nocompat.vk.comp.vk | 21 + ...ffer-reference-bitcast.nocompat.vk.comp.vk | 26 + ...-reference-decorations.nocompat.vk.comp.vk | 35 + .../comp/buffer-reference.nocompat.vk.comp.vk | 60 + .../vulkan/comp/fp-atomic.nocompat.vk.comp.vk | 23 + ...ay-query.nocompat.spv14.invalid.vk.comp.vk | 72 + .../spec-constant-op-member-array.vk.comp | 47 + .../spec-constant-op-member-array.vk.comp.vk | 35 + .../spec-constant-work-group-size.vk.comp | 34 + .../spec-constant-work-group-size.vk.comp.vk | 24 + .../combined-texture-sampler-shadow.vk.frag | 31 + ...combined-texture-sampler-shadow.vk.frag.vk | 32 + .../frag/combined-texture-sampler.vk.frag | 48 + .../frag/combined-texture-sampler.vk.frag.vk | 48 + ...-helper-forwarding.asm.vk.nocompat.frag.vk | 15 + .../frag/demote-to-helper.vk.nocompat.frag.vk | 10 + .../vulkan/frag/desktop-mediump.vk.frag | 12 + .../vulkan/frag/desktop-mediump.vk.frag.vk | 12 + .../vulkan/frag/input-attachment-ms.vk.frag | 12 + .../frag/input-attachment-ms.vk.frag.vk | 12 + .../vulkan/frag/input-attachment.vk.frag | 14 + .../vulkan/frag/input-attachment.vk.frag.vk | 14 + .../nonuniform-qualifier.vk.nocompat.frag.vk | 74 + .../push-constant-as-ubo.push-ubo.vk.frag | 14 + .../push-constant-as-ubo.push-ubo.vk.frag.vk | 14 + .../shaders/vulkan/frag/push-constant.vk.frag | 20 + .../vulkan/frag/push-constant.vk.frag.vk | 18 + .../separate-combined-fake-overload.vk.frag | 22 + ...separate-combined-fake-overload.vk.frag.vk | 23 + .../separate-sampler-texture-array.vk.frag | 44 + .../separate-sampler-texture-array.vk.frag.vk | 45 + .../frag/separate-sampler-texture.vk.frag | 37 + .../frag/separate-sampler-texture.vk.frag.vk | 38 + ...shader-arithmetic-8bit.nocompat.vk.frag.vk | 88 + .../frag/spec-constant-block-size.vk.frag | 22 + .../frag/spec-constant-block-size.vk.frag.vk | 19 + .../vulkan/frag/spec-constant-ternary.vk.frag | 16 + .../frag/spec-constant-ternary.vk.frag.vk | 14 + ...terminators.khr.spv14.nocompat.vk.rahit.vk | 22 + .../rahit/terminators.nocompat.vk.rahit.vk | 22 + ...ng-callable.khr.spv14.nocompat.vk.rcall.vk | 10 + ...ibute_block.khr.spv14.nocompat.vk.rchit.vk | 24 + .../hit_attribute_block.nocompat.vk.rchit.vk | 24 + ...in_function.khr.spv14.nocompat.vk.rchit.vk | 29 + ...ute_block_in_function.nocompat.vk.rchit.vk | 29 + ...ibute_plain.khr.spv14.nocompat.vk.rchit.vk | 11 + .../hit_attribute_plain.nocompat.vk.rchit.vk | 11 + ...bute_struct.khr.spv14.nocompat.vk.rchit.vk | 17 + .../hit_attribute_struct.nocompat.vk.rchit.vk | 17 + .../hit_kind.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/hit_kind.nocompat.vk.rchit.vk | 10 + .../hit_t.khr.spv14.nocompat.vk.rchit.vk | 10 + .../vulkan/rchit/hit_t.nocompat.vk.rchit.vk | 10 + ...g_ray_flags.khr.spv14.nocompat.vk.rchit.vk | 10 + .../incoming_ray_flags.nocompat.vk.rchit.vk | 10 + ...e_custom_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../instance_custom_id.nocompat.vk.rchit.vk | 10 + ...instance_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/instance_id.nocompat.vk.rchit.vk | 10 + ...y_direction.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_ray_direction.nocompat.vk.rchit.vk | 10 + ..._ray_origin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_ray_origin.nocompat.vk.rchit.vk | 10 + ...ct_to_world.khr.spv14.nocompat.vk.rchit.vk | 10 + .../object_to_world.nocompat.vk.rchit.vk | 10 + .../payloads.khr.spv14.nocompat.vk.rchit.vk | 20 + .../rchit/payloads.nocompat.vk.rchit.vk | 20 + ...rimitive_id.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/primitive_id.nocompat.vk.rchit.vk | 10 + .../ray_tmax.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tmax.nocompat.vk.rchit.vk | 10 + .../ray_tmin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tmin.nocompat.vk.rchit.vk | 10 + ...ray_tracing.khr.spv14.nocompat.vk.rchit.vk | 10 + .../rchit/ray_tracing.nocompat.vk.rchit.vk | 10 + ...y_direction.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_ray_direction.nocompat.vk.rchit.vk | 10 + ..._ray_origin.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_ray_origin.nocompat.vk.rchit.vk | 10 + ...d_to_object.khr.spv14.nocompat.vk.rchit.vk | 10 + .../world_to_object.nocompat.vk.rchit.vk | 10 + .../convert-u-to-as.spv14.vk.nocompat.rgen.vk | 17 + ...ute_callable.nocompat.khr.spv14.vk.rgen.vk | 17 + .../rgen/execute_callable.nocompat.vk.rgen.vk | 17 + .../launch_id.khr.spv14.nocompat.vk.rgen.vk | 10 + .../vulkan/rgen/launch_id.nocompat.vk.rgen.vk | 10 + .../launch_size.khr.spv14.nocompat.vk.rgen.vk | 10 + .../rgen/launch_size.nocompat.vk.rgen.vk | 10 + .../payloads.khr.spv14.nocompat.vk.rgen.vk | 47 + .../vulkan/rgen/payloads.nocompat.vk.rgen.vk | 47 + .../pure_call.khr.spv14.nocompat.vk.rgen.vk | 21 + .../vulkan/rgen/pure_call.nocompat.vk.rgen.vk | 21 + .../ray_tracing.khr.spv14.nocompat.vk.rgen.vk | 17 + .../rgen/ray_tracing.nocompat.vk.rgen.vk | 17 + ...ecord_buffer.khr.spv14.nocompat.vk.rgen.vk | 17 + .../shader_record_buffer.nocompat.vk.rgen.vk | 17 + ...intersection.khr.spv14.nocompat.vk.rint.vk | 13 + .../report-intersection.nocompat.vk.rint.vk | 13 + ...ray_tracing.khr.spv14.nocompat.vk.rmiss.vk | 10 + .../rmiss/ray_tracing.nocompat.vk.rmiss.vk | 10 + ...ce_incoming.khr.spv14.nocompat.vk.rmiss.vk | 13 + .../vert/device-group.nocompat.vk.vert.vk | 8 + .../vulkan/vert/multiview.nocompat.vk.vert.vk | 15 + .../shaders/vulkan/vert/small-storage.vk.vert | 69 + .../vulkan/vert/small-storage.vk.vert.vk | 55 + .../shaders/vulkan/vert/vulkan-vertex.vk.vert | 16 + .../vulkan/vert/vulkan-vertex.vk.vert.vk | 7 + third_party/spirv-cross/samples/cpp/Makefile | 31 + .../spirv-cross/samples/cpp/atomics.comp | 32 + .../spirv-cross/samples/cpp/atomics.cpp | 91 + .../spirv-cross/samples/cpp/multiply.comp | 25 + .../spirv-cross/samples/cpp/multiply.cpp | 92 + .../spirv-cross/samples/cpp/shared.comp | 39 + .../spirv-cross/samples/cpp/shared.cpp | 90 + ...access-chain-load-store-composite.asm.comp | 118 + ...ased-struct-divergent-member-name.asm.comp | 77 + .../asm/comp/atomic-load-store.asm.comp | 48 + .../asm/comp/atomic-result-temporary.asm.comp | 59 + .../comp/bitfield-signed-operations.asm.comp | 97 + .../asm/comp/bitscan.asm.comp | 72 + ...onuniform.asm.sm51.nonuniformresource.comp | 53 + .../comp/constant-composite-undef.asm.comp | 40 + .../comp/constant-lut-name-aliasing.asm.comp | 81 + ...-in-entry-point.noeliminate.spv14.asm.comp | 59 + .../asm/comp/glsl-signed-operations.asm.comp | 123 + ....std450.frexp-modf-struct.fxconly.asm.comp | 55 + ...onuniform.asm.sm51.nonuniformresource.comp | 55 + .../asm/comp/local-size-id-override.asm.comp | 60 + .../asm/comp/local-size-id.asm.comp | 76 + .../asm/comp/num-workgroups.spv14.asm.comp | 57 + .../comp/spec-constant-name-aliasing.asm.comp | 78 + ...lization-constant-workgroup.nofxc.asm.comp | 47 + .../comp/storage-buffer-basic.nofxc.asm.comp | 57 + .../anonymous-inner-struct-names.asm.frag | 83 + .../composite-insert-inheritance.asm.frag | 127 + .../asm/frag/empty-struct-in-struct.asm.frag | 61 + .../asm/frag/image-fetch-uint-coord.asm.frag | 44 + ...andling-2.nonuniformresource.sm51.asm.frag | 96 + ...opagation.nonuniformresource.sm51.asm.frag | 159 + ...form-ssbo.sm51.nonuniformresource.asm.frag | 99 + .../frag/only-initializer-frag-depth.asm.frag | 25 + .../asm/frag/phi.zero-initialize.asm.frag | 69 + ...-interlock-callstack.sm51.fxconly.asm.frag | 89 + ...terlock-control-flow.sm51.fxconly.asm.frag | 121 + ...lock-split-functions.sm51.fxconly.asm.frag | 102 + .../reserved-function-identifier.asm.frag | 60 + .../asm/frag/scalar-select.spv14.asm.frag | 62 + ...element-array-matrix-rule.invalid.asm.frag | 77 + ...rithmetic-cast.invalid.nofxc.sm60.asm.frag | 65 + ...ch-block-case-fallthrough.asm.invalid.frag | 80 + .../asm/frag/unordered-compare.asm.frag | 179 + .../frag/unordered-compare.relax-nan.asm.frag | 179 + .../frag/vec4-straddle-packing-holes.asm.frag | 52 + .../frag/vector-shuffle-undef-index.asm.frag | 42 + ...builtin-outputs.spv14.asm.vk.nocompat.mesh | 150 + .../asm/temporary.zero-initialize.asm.frag | 93 + .../vert/block-struct-initializer.asm.vert | 37 + .../vert/builtin-output-initializer.asm.vert | 44 + .../asm/vert/complex-link-by-name.asm.vert | 119 + .../asm/vert/empty-struct-composite.asm.vert | 36 + .../shaders-hlsl-no-opt/comp/bitfield.comp | 44 + .../comp/glsl.std450.fxconly.comp | 130 + .../comp/illegal-struct-name.asm.comp | 62 + .../comp/intmin-literal.comp | 18 + .../subgroups-boolean.invalid.nofxc.sm60.comp | 30 + .../comp/subgroups.invalid.nofxc.sm60.comp | 138 + .../comp/trivial-select-cast-vector.comp | 14 + .../comp/trivial-select-matrix.spv14.comp | 16 + .../frag/cbuffer-packing-straddle.frag | 50 + .../constant-buffer-array.invalid.sm51.frag | 32 + .../frag/fp16.invalid.desktop.frag | 156 + .../shaders-hlsl-no-opt/frag/frag-coord.frag | 8 + .../frag/helper-invocation.fxconly.nofxc.frag | 11 + ...types.fxconly.nofxc.sm62.native-16bit.frag | 72 + ...m-constructor.sm51.nonuniformresource.frag | 14 + ...terlock-simple-callstack.sm51.fxconly.frag | 31 + .../frag/spec-constant.frag | 80 + .../texture-gather-uint-component.asm.frag | 42 + .../frag/ubo-offset-out-of-order.frag | 16 + .../frag/variables.zero-initialize.frag | 21 + ...helper-invocation.fxconly.nofxc.spv16.frag | 11 + .../vert/base-instance.vert | 7 + .../shaders-hlsl-no-opt/vert/base-vertex.vert | 7 + .../block-io-auto-location-assignment.vert | 31 + .../vert/empty-shader.nofxc.sm30.vert | 5 + ...rix-input.flatten-matrix-vertex-input.vert | 13 + .../vert/pass-array-by-value.vert | 26 + .../asm/comp/access-chain-invalidate.asm.comp | 61 + .../asm/comp/atomic-decrement.asm.comp | 71 + .../asm/comp/atomic-increment.asm.comp | 71 + .../asm/comp/bitcast_icmp.asm.comp | 101 + .../asm/comp/block-name-alias-global.asm.comp | 119 + .../asm/comp/control-flow-hints.asm.comp | 146 + .../comp/global-parameter-name-alias.asm.comp | 102 + .../asm/comp/nmin-max-clamp.asm.comp | 203 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 203 + ...ctured-buffers.structured.fxconly.asm.frag | 55 + .../asm/frag/cbuffer-stripped.asm.frag | 55 + .../asm/frag/combined-sampler-reuse.asm.frag | 57 + .../asm/frag/empty-struct.asm.frag | 55 + .../shaders-hlsl/asm/frag/frem.asm.frag | 41 + .../asm/frag/function-overload-alias.asm.frag | 153 + .../asm/frag/image-extract-reuse.asm.frag | 41 + .../asm/frag/implicit-read-dep-phi.asm.frag | 81 + .../asm/frag/inf-nan-constant.asm.frag | 29 + .../asm/frag/line-directive.line.asm.frag | 221 + .../frag/lut-promotion-initializer.asm.frag | 195 + ...d-unpack-uint2.fxconly.nofxc.sm60.asm.frag | 55 + .../asm/frag/pass-by-value.asm.frag | 51 + .../asm/frag/sample-and-compare.asm.frag | 61 + .../frag/single-function-private-lut.asm.frag | 86 + .../shaders-hlsl/asm/frag/srem.asm.frag | 43 + .../storage-class-output-initializer.asm.frag | 41 + .../structured-buffer.structured.asm.frag | 52 + .../asm/frag/texel-fetch-no-lod.asm.frag | 46 + .../asm/frag/texture-sampling-fp16.asm.frag | 47 + .../asm/frag/unknown-depth-state.asm.frag | 71 + .../asm/frag/unreachable.asm.frag | 61 + ...act-transposed-matrix-from-struct.asm.vert | 141 + .../vert/spec-constant-op-composite.asm.vert | 98 + .../vert/uint-vertex-id-instance-id.asm.vert | 65 + .../asm/vert/vertex-id-instance-id.asm.vert | 53 + .../comp/access-chain-load-composite.comp | 35 + .../shaders-hlsl/comp/access-chains.comp | 24 + .../comp/access-chains.force-uav.comp | 24 + .../shaders-hlsl/comp/address-buffers.comp | 23 + .../spirv-cross/shaders-hlsl/comp/atomic.comp | 66 + .../shaders-hlsl/comp/barriers.comp | 79 + .../shaders-hlsl/comp/builtins.comp | 11 + .../comp/composite-array-initialization.comp | 29 + .../shaders-hlsl/comp/globallycoherent.comp | 25 + .../spirv-cross/shaders-hlsl/comp/image.comp | 77 + .../comp/image.nonwritable-uav-texture.comp | 77 + .../shaders-hlsl/comp/inverse.comp | 23 + .../comp/num-workgroups-alone.comp | 13 + .../comp/num-workgroups-with-builtins.comp | 13 + .../shaders-hlsl/comp/outer-product.comp | 37 + .../comp/rayquery.nofxc.fxconly.comp | 213 + .../shaders-hlsl/comp/rmw-matrix.comp | 20 + .../shaders-hlsl/comp/rwbuffer-matrix.comp | 104 + ...alar-std450-distance-length-normalize.comp | 18 + .../spirv-cross/shaders-hlsl/comp/shared.comp | 27 + .../comp/spec-constant-op-member-array.comp | 33 + .../comp/spec-constant-work-group-size.comp | 19 + .../shaders-hlsl/comp/ssbo-array-length.comp | 12 + .../shaders-hlsl/comp/ssbo-array.comp | 29 + .../shaders-hlsl/flatten/array.flatten.vert | 19 + .../shaders-hlsl/flatten/basic.flatten.vert | 16 + .../shaders-hlsl/flatten/copy.flatten.vert | 34 + .../shaders-hlsl/flatten/dynamic.flatten.vert | 33 + .../flatten/matrix-conversion.flatten.frag | 14 + .../flatten/matrixindex.flatten.vert | 25 + .../flatten/multiindex.flatten.vert | 13 + .../flatten/push-constant.flatten.vert | 17 + .../flatten/rowmajor.flatten.vert | 16 + .../shaders-hlsl/flatten/struct.flatten.vert | 30 + .../flatten/struct.rowmajor.flatten.vert | 26 + .../shaders-hlsl/flatten/swizzle.flatten.vert | 47 + .../shaders-hlsl/flatten/types.flatten.frag | 27 + .../frag/array-lut-no-loop-variable.frag | 13 + .../frag/basic-color-3comp.sm30.frag | 11 + .../frag/basic-color-3comp.sm50.frag | 11 + .../spirv-cross/shaders-hlsl/frag/basic.frag | 13 + .../shaders-hlsl/frag/bit-conversions.frag | 12 + .../shaders-hlsl/frag/boolean-mix.frag | 10 + .../shaders-hlsl/frag/builtins.frag | 11 + .../shaders-hlsl/frag/bvec-operations.frag | 13 + .../shaders-hlsl/frag/clip-cull-distance.frag | 12 + .../combined-texture-sampler-parameter.frag | 31 + .../frag/combined-texture-sampler-shadow.frag | 29 + .../complex-expression-in-access-chain.frag | 29 + .../frag/constant-composites.frag | 20 + .../control-dependent-in-branch.desktop.frag | 36 + .../shaders-hlsl/frag/demote-to-helper.frag | 7 + .../shaders-hlsl/frag/depth-greater-than.frag | 8 + .../shaders-hlsl/frag/depth-less-than.frag | 8 + .../frag/dual-source-blending.frag | 10 + .../frag/early-fragment-test.frag | 7 + .../frag/for-loop-continue-control-flow.frag | 11 + .../shaders-hlsl/frag/fp16-packing.frag | 12 + .../shaders-hlsl/frag/front-facing.frag | 14 + .../shaders-hlsl/frag/hyperbolic.frag | 26 + .../frag/image-query-selective.frag | 35 + .../shaders-hlsl/frag/image-query-uav.frag | 18 + ...age-query-uav.nonwritable-uav-texture.frag | 18 + .../shaders-hlsl/frag/image-query.frag | 33 + .../frag/input-attachment-ms.frag | 15 + .../shaders-hlsl/frag/input-attachment.frag | 16 + .../shaders-hlsl/frag/io-block.frag | 16 + .../frag/legacy-tex-modifiers.sm30.frag | 13 + .../shaders-hlsl/frag/lut-promotion.frag | 44 + .../shaders-hlsl/frag/matrix-input.frag | 9 + .../spirv-cross/shaders-hlsl/frag/mod.frag | 22 + .../spirv-cross/shaders-hlsl/frag/mrt.frag | 15 + .../shaders-hlsl/frag/no-return.frag | 5 + .../shaders-hlsl/frag/no-return2.frag | 9 + ...orm-qualifier.nonuniformresource.sm51.frag | 52 + .../frag/partial-write-preserve.frag | 64 + .../pixel-interlock-ordered.sm51.fxconly.frag | 36 + .../shaders-hlsl/frag/point-coord-compat.frag | 10 + .../shaders-hlsl/frag/query-lod.desktop.frag | 10 + .../readonly-coherent-ssbo.force-uav.frag | 12 + .../frag/readonly-coherent-ssbo.frag | 12 + .../shaders-hlsl/frag/resources.frag | 27 + .../frag/row-major-layout-in-struct.frag | 29 + .../frag/sample-cmp-level-zero.frag | 27 + .../frag/sample-mask-in-and-out.frag | 9 + .../shaders-hlsl/frag/sample-mask-in.frag | 11 + .../shaders-hlsl/frag/sample-mask-out.frag | 9 + .../shaders-hlsl/frag/sampler-array.frag | 28 + .../frag/sampler-image-arrays.frag | 33 + .../frag/scalar-refract-reflect.frag | 11 + .../separate-combined-fake-overload.sm30.frag | 21 + .../frag/spec-constant-block-size.frag | 17 + .../frag/spec-constant-ternary.frag | 9 + .../frag/switch-unreachable-break.frag | 32 + .../frag/switch-unsigned-case.frag | 26 + .../shaders-hlsl/frag/swizzle-scalar.frag | 16 + .../shaders-hlsl/frag/tex-sampling-ms.frag | 16 + .../shaders-hlsl/frag/tex-sampling.frag | 81 + .../shaders-hlsl/frag/texel-fetch-offset.frag | 10 + .../frag/texture-proj-shadow.frag | 21 + .../texture-size-combined-image-sampler.frag | 9 + .../shaders-hlsl/frag/unary-enclose.frag | 15 + .../frag/unorm-snorm-packing.frag | 24 + .../shaders-hlsl/frag/various-glsl-ops.frag | 17 + ...-shader-basic-lines.spv14.vk.nocompat.mesh | 74 + ...ader-basic-triangle.spv14.vk.nocompat.mesh | 64 + .../task/task-basic.spv14.vk.nocompat.task | 22 + .../spirv-cross/shaders-hlsl/vert/basic.vert | 15 + .../shaders-hlsl/vert/clip-cull-distance.vert | 11 + .../shaders-hlsl/vert/instancing.vert | 6 + .../shaders-hlsl/vert/invariant.vert | 13 + .../vert/legacy-int-attribute.sm30.vert | 10 + .../shaders-hlsl/vert/locations.vert | 51 + .../shaders-hlsl/vert/matrix-attribute.vert | 9 + .../shaders-hlsl/vert/matrix-output.vert | 9 + .../shaders-hlsl/vert/no-contraction.vert | 15 + .../shaders-hlsl/vert/no-input.vert | 6 + .../shaders-hlsl/vert/point-size-compat.vert | 7 + .../shaders-hlsl/vert/point-size.sm30.vert | 7 + .../shaders-hlsl/vert/qualifiers.vert | 27 + .../vert/read-from-row-major-array.vert | 20 + .../shaders-hlsl/vert/return-array.vert | 22 + .../shaders-hlsl/vert/sampler-buffers.vert | 17 + .../vert/struct-composite-decl.vert | 26 + .../shaders-hlsl/vert/texture_buffer.vert | 9 + ...ased-struct-divergent-member-name.asm.comp | 77 + .../comp/arithmetic-conversion-signs.asm.comp | 131 + .../asm/comp/atomic-load-store.asm.comp | 48 + .../asm/comp/atomic-min-max-sign.asm.comp | 56 + .../asm/comp/atomic-result-temporary.asm.comp | 59 + ...da-to-array-in-buffer.asm.spv16.msl24.comp | 71 + .../asm/comp/bitcast-fp16-fp32.asm.comp | 63 + .../comp/bitfield-signed-operations.asm.comp | 97 + .../asm/comp/bitscan.asm.comp | 72 + ...block-like-array-type-construct-2.asm.comp | 85 + .../block-like-array-type-construct.asm.comp | 80 + ...-device-address-ptr-casting.msl24.asm.comp | 106 + ...composite-construct-buffer-struct.asm.comp | 54 + .../comp/constant-composite-undef.asm.comp | 40 + .../comp/constant-lut-name-aliasing.asm.comp | 81 + .../asm/comp/copy-logical-2.spv14.asm.comp | 81 + ...fset-and-array-stride-diffs.spv14.asm.comp | 60 + .../asm/comp/copy-logical.spv14.asm.comp | 69 + .../comp/device-array-load-temporary.asm.comp | 53 + ...load-temporary.force-native-array.asm.comp | 53 + .../device-constant-array-load-store.asm.comp | 81 + ...ray-load-store.force-native-array.asm.comp | 81 + ...-in-entry-point.noeliminate.spv14.asm.comp | 59 + .../asm/comp/glsl-signed-operations.asm.comp | 123 + .../glsl.std450.frexp-modf-struct.asm.comp | 55 + .../asm/comp/local-size-id-override.asm.comp | 60 + .../asm/comp/local-size-id.asm.comp | 76 + .../asm/comp/modf-storage-class.asm.comp | 116 + .../asm/comp/opptrdiff-basic.spv14.asm.comp | 98 + ...pptraccesschain-elem-offset.spv14.asm.comp | 79 + .../asm/comp/opptrequal-basic.spv14.asm.comp | 96 + ...ow-maj-mtx-bypass-transpose.spv14.asm.comp | 98 + .../comp/opptrnotequal-basic.spv14.asm.comp | 96 + .../comp/spec-constant-name-aliasing.asm.comp | 78 + .../storage-buffer-basic.invalid.asm.comp | 58 + .../storage-buffer-pointer-argument.asm.comp | 63 + .../asm/comp/variable-pointers.asm.comp | 152 + ...n-array-ubo-partial.argument.msl2.asm.frag | 50 + .../access-chain-array-ubo-partial.asm.frag | 50 + .../anonymous-inner-struct-names.asm.frag | 83 + ...omponent-insert-packed-expression.asm.frag | 70 + .../composite-insert-inheritance.asm.frag | 127 + ...composite-block-no-array-stride-2.asm.frag | 33 + ...py-memory-block-like-thread-local.asm.frag | 50 + .../asm/frag/empty-struct-in-struct.asm.frag | 61 + ...xup-entry-point-identifier.nomain.asm.frag | 27 + .../asm/frag/image-fetch-uint-coord.asm.frag | 44 + .../asm/frag/image-gather.asm.frag | 74 + ...mage-type-normal-comparison-usage.asm.frag | 76 + ...lock_with_aliased_struct_and_name.asm.frag | 65 + ...nput-attachment-unused-frag-coord.asm.frag | 74 + ...-frexp-scalar-access-chain-output.asm.frag | 36 + .../frag/only-initializer-frag-depth.asm.frag | 25 + .../asm/frag/phi.zero-initialize.asm.frag | 69 + .../pixel-interlock-callstack.msl2.asm.frag | 89 + ...pixel-interlock-control-flow.msl2.asm.frag | 121 + ...el-interlock-split-functions.msl2.asm.frag | 102 + .../private-initializer-direct-store.asm.frag | 32 + .../reserved-function-identifier.asm.frag | 60 + .../asm/frag/scalar-select.spv14.asm.frag | 62 + .../subgroup-arithmetic-cast.msl21.asm.frag | 65 + ...ch-block-case-fallthrough.asm.invalid.frag | 80 + .../asm/frag/texture-access.swizzle.asm.frag | 364 + .../usage-tracking-modf-io-pointer.asm.frag | 28 + .../frag/vector-shuffle-undef-index.asm.frag | 42 + ...lizers-block.mask-location-0.msl2.asm.tesc | 85 + ....mask-location-0.multi-patch.msl2.asm.tesc | 85 + ...lizers-block.mask-location-1.msl2.asm.tesc | 85 + ....mask-location-1.multi-patch.msl2.asm.tesc | 85 + ...lizers-block.mask-point-size.msl2.asm.tesc | 86 + ....mask-point-size.multi-patch.msl2.asm.tesc | 86 + ...ializers-block.mask-position.msl2.asm.tesc | 86 + ...ck.mask-position.multi-patch.msl2.asm.tesc | 86 + ...initializers.mask-location-0.msl2.asm.tesc | 76 + ....mask-location-0.msl2.multi-patch.asm.tesc | 76 + .../initializers.mask-location-1.asm.tesc | 76 + ...izers.mask-location-1.multi-patch.asm.tesc | 76 + ...initializers.mask-point-size.msl2.asm.tesc | 76 + ....mask-point-size.msl2.multi-patch.asm.tesc | 76 + .../initializers.mask-position.msl2.asm.tesc | 76 + ...rs.mask-position.msl2.multi-patch.asm.tesc | 76 + .../composite-extract-row-major.asm.comp | 48 + .../load-packed-no-forwarding-2.asm.comp | 56 + .../load-packed-no-forwarding-3.asm.comp | 48 + .../load-packed-no-forwarding-4.asm.comp | 61 + .../load-packed-no-forwarding-5.asm.comp | 54 + .../load-packed-no-forwarding.asm.comp | 56 + .../packed-vector-extract-insert.asm.comp | 57 + .../row-major-split-access-chain.asm.comp | 48 + .../asm/packing/scalar-array-float2.asm.frag | 54 + .../scalar-array-float3-one-element.asm.frag | 51 + .../asm/packing/scalar-array-float3.asm.frag | 54 + ...scalar-float2x2-col-major.invalid.asm.frag | 56 + .../scalar-float2x2-row-major.asm.frag | 56 + ...scalar-float2x3-col-major.invalid.asm.frag | 56 + .../scalar-float2x3-row-major.asm.frag | 56 + ...scalar-float3x2-col-major.invalid.asm.frag | 56 + .../scalar-float3x2-row-major.asm.frag | 56 + ...scalar-float3x3-col-major.invalid.asm.frag | 56 + .../scalar-float3x3-row-major.asm.frag | 56 + .../asm/temporary.zero-initialize.asm.frag | 93 + .../array-control-point-initializer.asm.tesc | 80 + .../block-control-point-initializer.asm.tesc | 70 + ...builtin-control-point-initializer.asm.tesc | 65 + ...mposite-control-point-initializer.asm.tesc | 69 + .../tesc/copy-memory-control-point.asm.tesc | 199 + .../asm/tesc/copy-tess-level-tri.asm.tesc | 82 + .../plain-control-point-initializer.asm.tesc | 63 + ...input-array-builtin-array.invalid.asm.tesc | 248 + ...builtin-array.invalid.multi-patch.asm.tesc | 248 + .../tesc/tess-level-initializer-quad.asm.tesc | 88 + .../tess-level-initializer-triangle.asm.tesc | 88 + ...-level-read-write-in-function-tri.asm.tesc | 109 + .../asm/tese/copy-tess-level.asm.msl2.tese | 58 + .../asm/tese/split-access-chain.asm.tese | 35 + .../vert/block-io-use-in-function.asm.vert | 314 + .../vert/block-struct-initializer.asm.vert | 43 + .../vert/builtin-output-initializer.asm.vert | 39 + ...omposite-extract-physical-type-id.asm.vert | 63 + ...t-composite-block-no-array-stride.asm.vert | 157 + .../asm/vert/duplicate-view-index.asm.vert | 66 + .../asm/vert/empty-struct-composite.asm.vert | 36 + .../op-load-forced-temporary-array.asm.frag | 60 + .../asm/vert/pointer-to-pointer.asm.vert | 34 + .../comp/array-copy-threadgroup-memory.comp | 18 + .../basic.dynamic-buffer.msl2.invalid.comp | 27 + .../bda-restrict-pointer-variable.msl2.comp | 18 + .../comp/bitcast-16bit-1.invalid.comp | 23 + .../comp/bitcast-16bit-2.invalid.comp | 26 + .../shaders-msl-no-opt/comp/bitfield.comp | 23 + ...ress-from-pointer-complex-chain.msl23.comp | 21 + .../shaders-msl-no-opt/comp/glsl.std450.comp | 129 + .../comp/illegal-struct-name.asm.comp | 62 + .../comp/implicit-integer-promotion.comp | 85 + .../comp/int16min-literal.comp | 22 + .../comp/int64.invalid.msl22.comp | 65 + .../comp/int64min-literal.msl22.comp | 21 + .../comp/intmin-literal.comp | 18 + .../shaders-msl-no-opt/comp/loop.comp | 98 + .../shaders-msl-no-opt/comp/return.comp | 33 + ...std140-array-load-composite-construct.comp | 13 + ...ct-packing-scalar.nocompat.invalid.vk.comp | 100 + ...pat.invalid.vk.msl12.emulate-subgroup.comp | 25 + .../subgroups.nocompat.invalid.vk.msl21.comp | 145 + ...ompat.invalid.vk.msl21.fixed-subgroup.comp | 138 + ...bgroups.nocompat.invalid.vk.msl21.ios.comp | 49 + ...bgroups.nocompat.invalid.vk.msl22.ios.comp | 79 + ...ps.nocompat.invalid.vk.msl23.ios.simd.comp | 138 + .../comp/trivial-select-cast-vector.comp | 14 + .../comp/trivial-select-matrix.spv14.comp | 16 + .../components/fragment-input-component.frag | 10 + .../components/fragment-output-component.frag | 12 + ...ragment-output-component.pad-fragment.frag | 10 + .../components/vertex-input-component.vert | 11 + .../components/vertex-output-component.vert | 12 + .../frag/16bit-constants.invalid.frag | 14 + .../combined-sampler-parameter-names.asm.frag | 42 + ...e-to-helper.vk.nocompat.msl21.invalid.frag | 8 + .../frag/depth-image-gather.asm.frag | 72 + ....msl2.argument..force-active.discrete.frag | 15 + .../frag/fp16.desktop.invalid.frag | 151 + .../shaders-msl-no-opt/frag/image-gather.frag | 14 + .../frag/in_block_assign.frag | 16 + .../frag/min-max-clamp.invalid.asm.frag | 293 + .../min-max-clamp.relax-nan.invalid.asm.frag | 293 + .../frag/nonuniform-constructor.msl2.frag | 14 + ...pixel-interlock-simple-callstack.msl2.frag | 31 + .../pull-interpolant-access-chain.msl23.frag | 12 + ...layout-ubo-std430.vk.nocompat.invalid.frag | 23 + .../shadow-compare-global-alias.invalid.frag | 38 + .../frag/struct-bool-edge-cases.frag | 58 + .../subgroups.nocompat.invalid.vk.msl22.frag | 131 + ...-fallback.msl20.ios.framebuffer-fetch.frag | 9 + ...ndex-fallback.msl23.framebuffer-fetch.frag | 9 + ...nction-argument.framebuffer-fetch.ios.frag | 24 + ...tion-argument.framebuffer-fetch.msl23.frag | 24 + ...ding.framebuffer-fetch.msl23.argument.frag | 12 + ...ation-binding.framebuffer-fetch.msl23.frag | 12 + ...g.ios.framebuffer-fetch.msl2.argument.frag | 12 + ...on-binding.ios.framebuffer-fetch.msl2.frag | 12 + .../frag/texture-access-int.swizzle.frag | 53 + .../frag/texture-access-leaf.swizzle.frag | 86 + .../frag/texture-access-uint.swizzle.frag | 53 + .../frag/texture-access.swizzle.frag | 79 + .../texture-gather-uint-component.asm.frag | 42 + ...le-structs-access-chain.argument.msl2.frag | 18 + ...o-array-multiple-structs-access-chain.frag | 18 + .../frag/ubo-offset-out-of-order.frag | 16 + .../frag/variables.zero-initialize.frag | 21 + ...olatile-helper-invocation.msl23.spv16.frag | 11 + .../packing/array-of-vec3.comp | 13 + .../packing/array-of-vec4.comp | 13 + .../packing/isolated-scalar-access.comp | 25 + .../packing/load-store-col-rows.comp | 59 + .../packing/matrix-2x2-scalar.comp | 86 + .../packing/matrix-2x2-std140.comp | 85 + .../packing/matrix-2x2-std430.comp | 85 + .../packing/matrix-2x3-scalar.comp | 86 + .../packing/matrix-2x3-std140.comp | 85 + .../packing/matrix-2x3-std430.comp | 85 + .../packing/matrix-2x4-scalar.comp | 86 + .../packing/matrix-2x4-std140.comp | 85 + .../packing/matrix-2x4-std430.comp | 85 + .../packing/matrix-3x2-scalar.comp | 86 + .../packing/matrix-3x2-std140.comp | 85 + .../packing/matrix-3x2-std430.comp | 85 + .../packing/matrix-3x3-scalar.comp | 86 + .../packing/matrix-3x3-std140.comp | 85 + .../packing/matrix-3x3-std430.comp | 85 + .../packing/matrix-3x4-scalar.comp | 86 + .../packing/matrix-3x4-std140.comp | 85 + .../packing/matrix-3x4-std430.comp | 85 + .../packing/matrix-4x2-scalar.comp | 86 + .../packing/matrix-4x2-std140.comp | 85 + .../packing/matrix-4x2-std430.comp | 85 + .../packing/matrix-4x3-scalar.comp | 86 + .../packing/matrix-4x3-std140.comp | 85 + .../packing/matrix-4x3-std430.comp | 85 + .../packing/matrix-4x4-scalar.comp | 86 + .../packing/matrix-4x4-std140.comp | 85 + .../packing/matrix-4x4-std430.comp | 85 + .../packing/matrix-multiply-row-major.comp | 16 + .../matrix-multiply-unpacked-col-major-2.comp | 19 + .../matrix-multiply-unpacked-col-major.comp | 18 + .../matrix-multiply-unpacked-row-major-2.comp | 19 + .../matrix-multiply-unpacked-row-major.comp | 18 + .../packing/member-padding.comp | 14 + .../packing/std140-array-of-vectors.comp | 47 + .../packing/struct-alignment.comp | 22 + .../struct-packing-array-of-scalar.comp | 18 + .../packing/struct-packing-recursive.comp | 29 + .../packing/struct-packing.comp | 27 + .../struct-size-padding-array-of-array.comp | 45 + .../packing/struct-size-padding.comp | 45 + .../tesc/copy-tess-level.tesc | 12 + .../passthrough-clip-cull.multi-patch.tesc | 22 + ...ess-level-read-write-in-function-quad.tesc | 24 + ...-input-automatic-attribute-assignment.tese | 10 + .../tese/load-clip-cull.msl2.tese | 19 + .../vert/cull-distance.for-tess.vert | 10 + .../vert/functions_nested.vert | 132 + .../vert/layer.msl11.invalid.vert | 10 + .../vert/modf-storage-class.capture.vert | 9 + ...ass-array-by-value.force-native-array.vert | 26 + .../vert/pass-array-by-value.vert | 26 + .../vert/uninitialized-vertex-output.vert | 8 + .../vert/unused-subgroup-builtin.msl22.vert | 7 + .../vert/viewport-index.msl2.invalid.vert | 10 + .../texture-access-function.swizzle.vk.frag | 90 + .../amd/shader_trinary_minmax.msl21.comp | 11 + .../asm/comp/atomic-decrement.asm.comp | 71 + .../asm/comp/atomic-increment.asm.comp | 71 + .../asm/comp/bitcast_iadd.asm.comp | 79 + .../asm/comp/bitcast_icmp.asm.comp | 101 + .../shaders-msl/asm/comp/bitcast_sar.asm.comp | 77 + .../asm/comp/bitcast_sdiv.asm.comp | 77 + .../shaders-msl/asm/comp/bitcast_slr.asm.comp | 77 + .../asm/comp/block-name-alias-global.asm.comp | 119 + .../comp/buffer-write-relative-addr.asm.comp | 93 + .../asm/comp/buffer-write.asm.comp | 59 + .../comp/copy-object-ssbo-to-ssbo.asm.comp | 43 + .../asm/comp/copy-object-ubo-to-ssbo.asm.comp | 43 + .../asm/comp/duplicate-spec-id.asm.comp | 54 + .../comp/global-parameter-name-alias.asm.comp | 102 + ...e-load-store-short-vector.invalid.asm.comp | 75 + .../asm/comp/multiple-entry.asm.comp | 98 + ...p-spec-constant-op-vector-related.asm.comp | 107 + .../shaders-msl/asm/comp/quantize.asm.comp | 67 + .../asm/comp/relaxed-block-layout.asm.comp | 108 + ...specialization-constant-workgroup.asm.comp | 47 + .../struct-resource-name-aliasing.asm.comp | 49 + .../asm/comp/uint_smulextended.asm.comp | 61 + .../undefined-constant-composite.asm.comp | 102 + ...undefined-spec-constant-composite.asm.comp | 122 + .../asm/comp/variable-pointers-2.asm.comp | 117 + ...ariable-pointers-store-forwarding.asm.comp | 75 + .../vector-builtin-type-cast-func.asm.comp | 147 + .../comp/vector-builtin-type-cast.asm.comp | 128 + .../asm/frag/combined-sampler-reuse.asm.frag | 57 + .../asm/frag/default-member-names.asm.frag | 57 + .../depth-image-color-format-fetch.asm.frag | 170 + .../depth-image-color-format-sampled.asm.frag | 173 + .../frag/descriptor-array-unnamed.asm.frag | 63 + ...isable-renamed-output.frag-output.asm.frag | 83 + .../asm/frag/empty-struct.asm.frag | 55 + .../extract-packed-from-composite.asm.frag | 108 + .../shaders-msl/asm/frag/frem.asm.frag | 41 + .../asm/frag/function-overload-alias.asm.frag | 153 + .../asm/frag/image-extract-reuse.asm.frag | 41 + .../asm/frag/implicit-read-dep-phi.asm.frag | 81 + .../asm/frag/inf-nan-constant.asm.frag | 29 + .../interpolation-qualifiers-struct.asm.frag | 85 + .../asm/frag/line-directive.line.asm.frag | 221 + .../asm/frag/locations-components.asm.frag | 103 + .../frag/lut-promotion-initializer.asm.frag | 195 + .../asm/frag/min-lod.msl22.asm.frag | 42 + .../asm/frag/op-constant-null.asm.frag | 85 + .../asm/frag/op-image-sampled-image.asm.frag | 82 + .../asm/frag/pass-by-value.asm.frag | 51 + .../asm/frag/phi-loop-variable.asm.frag | 71 + .../pull-model-interpolation.asm.msl23.frag | 425 + .../asm/frag/sample-and-compare.asm.frag | 61 + .../frag/single-function-private-lut.asm.frag | 86 + .../shaders-msl/asm/frag/srem.asm.frag | 43 + .../storage-class-output-initializer.asm.frag | 41 + .../asm/frag/switch-different-sizes.asm.frag | 106 + .../asm/frag/switch-long-case.asm.msl22.frag | 48 + .../switch-unsigned-long-case.asm.msl22.frag | 48 + .../asm/frag/texel-fetch-no-lod.asm.frag | 46 + .../asm/frag/texture-sampling-fp16.asm.frag | 47 + .../asm/frag/undef-variable-store.asm.frag | 85 + .../asm/frag/unknown-depth-state.asm.frag | 71 + .../asm/frag/unord-relational-op.asm.frag | 207 + .../unord-relational-op.relax-nan.asm.frag | 207 + .../shaders-msl/asm/frag/unreachable.asm.frag | 61 + .../asm/frag/vector-shuffle-oom.asm.frag | 886 + .../asm/tesc/tess-level-overrun.asm.tesc | 102 + .../tess-level-overrun.multi-patch.asm.tesc | 102 + .../asm/tese/unnamed-builtin-array.asm.tese | 96 + .../clip-distance-plain-variable.asm.vert | 91 + ...ce-plain-variable.no-user-varying.asm.vert | 91 + .../asm/vert/copy-memory-interface.asm.vert | 33 + ...act-transposed-matrix-from-struct.asm.vert | 141 + .../asm/vert/fake-builtin-input.asm.vert | 55 + .../asm/vert/invariant.msl21.asm.vert | 34 + .../asm/vert/packed-bool-to-uint.asm.vert | 111 + .../packed-bool2-to-packed_uint2.asm.vert | 113 + .../asm/vert/packing-test.asm.vert | 43 + .../vert/spec-constant-op-composite.asm.vert | 101 + .../vert/uint-vertex-id-instance-id.asm.vert | 65 + .../access-private-workgroup-in-function.comp | 31 + ...ffers-discrete.msl2.argument.discrete.comp | 27 + ...rs-image-load-store.ios.msl2.argument.comp | 10 + ...uffers-image-load-store.msl2.argument.comp | 10 + .../shaders-msl/comp/array-length.comp | 22 + .../array-length.msl2.argument.discrete.comp | 38 + .../shaders-msl/comp/atomic-float.msl3.comp | 15 + .../spirv-cross/shaders-msl/comp/atomic.comp | 56 + .../shaders-msl/comp/barriers.comp | 79 + .../spirv-cross/shaders-msl/comp/basic.comp | 28 + .../shaders-msl/comp/basic.dispatchbase.comp | 29 + .../comp/basic.dispatchbase.msl11.comp | 29 + .../comp/basic.inline-block.msl2.comp | 37 + ...-vec-and-cast-to-and-from-uvec2.msl23.comp | 22 + ...dress-recursive-struct-pointers.msl23.comp | 64 + .../comp/buffer_device_address.msl2.comp | 86 + .../shaders-msl/comp/builtins.comp | 12 + .../comp/cfg-preserve-parameter.comp | 54 + .../shaders-msl/comp/coherent-block.comp | 12 + .../shaders-msl/comp/coherent-image.comp | 14 + .../complex-composite-constant-array.comp | 19 + .../shaders-msl/comp/complex-type-alias.comp | 41 + .../comp/composite-array-initialization.comp | 28 + ...ray-initialization.force-native-array.comp | 28 + .../shaders-msl/comp/composite-construct.comp | 31 + .../comp/copy-array-of-arrays.comp | 21 + ...py-array-of-arrays.force-native-array.comp | 21 + .../spirv-cross/shaders-msl/comp/culling.comp | 26 + .../shaders-msl/comp/defer-parens.comp | 30 + .../spirv-cross/shaders-msl/comp/dowhile.comp | 31 + .../comp/force-recompile-hooks.swizzle.comp | 9 + .../shaders-msl/comp/functions.comp | 12 + ...vocation-id-writable-ssbo-in-function.comp | 12 + .../comp/global-invocation-id.comp | 9 + ...omic-automatic-bindings.argument.msl2.comp | 16 + .../comp/image-atomic-automatic-bindings.comp | 16 + .../comp/image-cube-array-load-store.comp | 13 + .../spirv-cross/shaders-msl/comp/image.comp | 12 + .../spirv-cross/shaders-msl/comp/insert.comp | 18 + .../spirv-cross/shaders-msl/comp/inverse.comp | 23 + .../shaders-msl/comp/local-invocation-id.comp | 9 + .../comp/local-invocation-index.comp | 9 + .../comp/local-size-duplicate-spec-id.comp | 15 + .../comp/mat3-row-maj-read-write-const.comp | 17 + .../spirv-cross/shaders-msl/comp/mat3.comp | 14 + .../spirv-cross/shaders-msl/comp/mod.comp | 26 + .../spirv-cross/shaders-msl/comp/modf.comp | 23 + .../shaders-msl/comp/outer-product.comp | 37 + .../shaders-msl/comp/packing-test-1.comp | 18 + .../shaders-msl/comp/packing-test-2.comp | 16 + ....discrete.device-argument-buffer.msl2.comp | 114 + ...iptor-aliasing.argument.discrete.msl2.comp | 114 + ...ray-query.spv14.vk.ios.msl24..invalid.comp | 58 + .../shaders-msl/comp/read-write-only.comp | 26 + .../shaders-msl/comp/rmw-matrix.comp | 20 + .../spirv-cross/shaders-msl/comp/rmw-opt.comp | 27 + ...alar-std450-distance-length-normalize.comp | 20 + .../comp/shared-array-of-arrays.comp | 29 + .../comp/shared-matrix-array-of-array.comp | 65 + .../shaders-msl/comp/shared-matrix-cast.comp | 33 + .../shared-matrix-nested-struct-array.comp | 87 + .../comp/shared-matrix-nested-struct.comp | 141 + .../comp/shared-struct-bool-cast.comp | 35 + .../spirv-cross/shaders-msl/comp/shared.comp | 27 + .../comp/spec-constant-op-member-array.comp | 33 + .../comp/spec-constant-work-group-size.comp | 17 + .../storage-buffer-std140-vector-array.comp | 30 + .../shaders-msl/comp/struct-layout.comp | 24 + .../shaders-msl/comp/struct-nested.comp | 20 + .../shaders-msl/comp/struct-packing.comp | 77 + .../comp/threadgroup-boolean-workaround.comp | 21 + .../shaders-msl/comp/torture-loop.comp | 40 + .../shaders-msl/comp/type-alias.comp | 45 + .../comp/type_casting_i64.msl22.comp | 23 + .../spirv-cross/shaders-msl/comp/udiv.comp | 17 + .../shaders-msl/comp/writable-ssbo.comp | 9 + .../comp/extended-arithmetic.desktop.comp | 41 + .../desktop-only/frag/image-ms.desktop.frag | 13 + .../frag/query-levels.desktop.frag | 11 + .../frag/sampler-ms-query.desktop.frag | 12 + .../tesc/arrayed-output.desktop.sso.tesc | 27 + .../tesc/basic.desktop.sso.multi-patch.tesc | 32 + .../desktop-only/tesc/basic.desktop.sso.tesc | 32 + .../struct-copy.desktop.sso.multi-patch.tesc | 22 + .../tesc/struct-copy.desktop.sso.tesc | 22 + .../tese/triangle.desktop.sso.tese | 22 + .../desktop-only/vert/basic.desktop.sso.vert | 20 + ...ull-distance..no-user-varying.desktop.vert | 10 + .../vert/clip-cull-distance.desktop.vert | 10 + ...ader-draw-parameters.desktop.for-tess.vert | 11 + .../vert/shader-draw-parameters.desktop.vert | 11 + .../shaders-msl/flatten/basic.flatten.vert | 16 + .../flatten/multiindex.flatten.vert | 13 + .../flatten/push-constant.flatten.vert | 17 + .../shaders-msl/flatten/rowmajor.flatten.vert | 16 + .../shaders-msl/flatten/struct.flatten.vert | 30 + .../shaders-msl/flatten/swizzle.flatten.vert | 47 + .../shaders-msl/flatten/types.flatten.frag | 27 + .../frag/argument-buffers.msl2.argument.frag | 61 + .../shaders-msl/frag/array-component-io.frag | 21 + .../frag/array-lut-no-loop-variable.frag | 13 + .../shaders-msl/frag/array-of-array-lut.frag | 12 + ...niform.msl2.argument.discrete.swizzle.frag | 34 + ...zzle-nonconstant-uniform.msl2.swizzle.frag | 34 + ...wizzle.msl2.argument.discrete.swizzle.frag | 31 + ...array-of-texture-swizzle.msl2.swizzle.frag | 23 + .../frag/barycentric-nv-nopersp.msl22.frag | 17 + .../frag/barycentric-nv.msl22.frag | 17 + .../shaders-msl/frag/basic.force-sample.frag | 13 + .../spirv-cross/shaders-msl/frag/basic.frag | 13 + .../binary-func-unpack-pack-arguments.frag | 15 + .../frag/binary-unpack-pack-arguments.frag | 15 + .../shaders-msl/frag/bitcasting.1d-as-2d.frag | 23 + .../shaders-msl/frag/bitcasting.frag | 24 + .../shaders-msl/frag/buffer-read-write.frag | 12 + ...ead-write.texture-buffer-native.msl21.frag | 12 + .../shaders-msl/frag/builtins.frag | 11 + .../frag/clip-distance-varying.frag | 10 + .../complex-expression-in-access-chain.frag | 29 + .../composite-extract-forced-temporary.frag | 11 + .../shaders-msl/frag/constant-array.frag | 21 + .../shaders-msl/frag/constant-composites.frag | 20 + .../control-dependent-in-branch.desktop.frag | 34 + .../frag/cull-distance-varying.frag | 10 + ...exture-lod.lod-as-grad.1d-as-2d.msl23.frag | 12 + .../shaders-msl/frag/depth-greater-than.frag | 7 + .../shaders-msl/frag/depth-less-than.frag | 7 + .../frag/depth-out-early-frag-tests.frag | 11 + .../frag/depth-out-no-early-frag-tests.frag | 10 + .../frag/disable-frag-output.frag-output.frag | 25 + .../frag/dual-source-blending.frag | 10 + .../frag/early-fragment-tests.frag | 9 + .../shaders-msl/frag/false-loop-init.frag | 19 + .../shaders-msl/frag/flush_params.frag | 27 + .../frag/for-loop-continue-control-flow.frag | 11 + .../shaders-msl/frag/for-loop-init.frag | 52 + .../shaders-msl/frag/fp16-packing.frag | 12 + ...ag-demote-checks.discard-checks.msl23.frag | 33 + ...s-continue-block.discard-checks.msl23.frag | 17 + ...g-discard-checks.discard-checks.msl23.frag | 32 + ...agment-component-padding.pad-fragment.frag | 18 + .../shaders-msl/frag/front-facing.frag | 14 + .../shaders-msl/frag/gather-dref.frag | 11 + .../shaders-msl/frag/gather-offset.frag | 9 + .../frag/helper-invocation.msl21.frag | 21 + ....device-argument-buffer.argument.msl2.frag | 26 + .../shaders-msl/frag/illegal-name-test-0.frag | 12 + .../frag/image-query-lod.msl22.frag | 33 + .../shaders-msl/frag/in_block.frag | 14 + ...ck_with_multiple_structs_of_same_type.frag | 19 + .../spirv-cross/shaders-msl/frag/in_mat.frag | 19 + ...t-attachment-ms.arrayed-subpass.msl21.frag | 15 + .../shaders-msl/frag/input-attachment-ms.frag | 15 + .../input-attachment-ms.multiview.msl21.frag | 15 + .../input-attachment.arrayed-subpass.frag | 16 + .../shaders-msl/frag/input-attachment.frag | 16 + .../frag/input-attachment.multiview.frag | 16 + .../frag/interpolation-qualifiers-block.frag | 19 + .../frag/interpolation-qualifiers.frag | 15 + .../shaders-msl/frag/lut-promotion.frag | 44 + .../spirv-cross/shaders-msl/frag/mix.frag | 20 + .../frag/modf-access-tracking-function.frag | 15 + .../shaders-msl/frag/mrt-array.frag | 24 + .../frag/nonuniform-qualifier.msl2.frag | 28 + .../packed-expression-vector-shuffle.frag | 15 + .../shaders-msl/frag/packing-test-3.frag | 36 + ...pixel-interlock-ordered.msl2.argument.frag | 36 + .../frag/pixel-interlock-ordered.msl2.frag | 36 + .../spirv-cross/shaders-msl/frag/pls.frag | 20 + .../frag/post-depth-coverage.ios.msl2.frag | 11 + .../frag/post-depth-coverage.msl23.frag | 11 + ...rivate-variable-prototype-declaration.frag | 20 + ...ery-object-in-function.spv14.vk.msl24.frag | 31 + .../read-cull-clip-distance-in-function.frag | 20 + .../shaders-msl/frag/readonly-ssbo.frag | 16 + ...return-value-after-discard-terminator.frag | 17 + ...e-depth-propagate-state-from-resource.frag | 29 + .../sample-depth-separate-image-sampler.frag | 22 + ...nd-out.fixed-sample-mask.force-sample.frag | 10 + ...ple-mask-in-and-out.fixed-sample-mask.frag | 10 + ...ample-mask-not-used.fixed-sample-mask.frag | 8 + .../frag/sample-mask.fixed-sample-mask.frag | 10 + .../shaders-msl/frag/sample-mask.frag | 10 + .../frag/sample-position-func.frag | 15 + .../shaders-msl/frag/sample-position.frag | 8 + .../sample-rate-frag-coord-sample-id.frag | 10 + .../sample-rate-frag-coord-sample-input.frag | 11 + .../sample-rate-frag-coord-sample-pos.frag | 10 + .../sample-rate-frag-coord.force-sample.frag | 10 + .../frag/sampler-1d-lod.1d-as-2d.frag | 12 + .../shaders-msl/frag/sampler-1d-lod.frag | 12 + .../sampler-compare-bias.msl23.1d-as-2d.frag | 11 + .../sampler-compare-cascade-gradient.frag | 11 + .../sampler-compare-cascade-gradient.ios.frag | 11 + ...ampler-compare-cascade-gradient.msl23.frag | 11 + .../frag/sampler-image-arrays.msl2.frag | 33 + .../shaders-msl/frag/sampler-ms.frag | 16 + .../spirv-cross/shaders-msl/frag/sampler.frag | 18 + .../frag/scalar-refract-reflect.frag | 11 + .../frag/separate-image-sampler-argument.frag | 16 + .../frag/shader-arithmetic-8bit.frag | 88 + .../frag/spec-constant-block-size.frag | 17 + .../frag/spec-constant-ternary.frag | 9 + .../frag/stencil-export.msl21.frag | 17 + .../frag/subgroup-builtins.msl22.frag | 10 + .../frag/subgroup-globals-extract.msl22.frag | 30 + .../frag/switch-unreachable-break.frag | 30 + .../frag/switch-unsigned-case.frag | 26 + .../spirv-cross/shaders-msl/frag/swizzle.frag | 17 + .../frag/texel-fetch-offset.1d-as-2d.frag | 10 + .../shaders-msl/frag/texel-fetch-offset.frag | 10 + .../shaders-msl/frag/texture-cube-array.frag | 16 + ...ure-cube-array.ios.emulate-cube-array.frag | 16 + .../frag/texture-multisample-array.msl21.frag | 10 + .../shaders-msl/frag/texture-proj-shadow.frag | 19 + .../shaders-msl/frag/ubo_layout.frag | 24 + .../shaders-msl/frag/unary-enclose.frag | 15 + .../frag/vecsize-mismatch.shader-inputs.frag | 17 + .../frag/write-depth-in-function.frag | 14 + .../intel/shader-integer-functions2.asm.comp | 137 + .../legacy/vert/transpose.legacy.vert | 20 + ...rays.mask-location-0.msl2.multi-patch.tesc | 17 + .../copy-arrays.mask-location-0.msl2.tesc | 17 + ...rays.mask-location-1.msl2.multi-patch.tesc | 17 + .../copy-arrays.mask-location-1.msl2.tesc | 17 + ...utputs-block.mask-location-0.for-tess.vert | 16 + ...te-outputs-block.mask-location-0.msl2.tesc | 28 + ...lock.mask-location-0.multi-patch.msl2.tesc | 28 + .../write-outputs-block.mask-location-0.vert | 16 + ...utputs-block.mask-location-1.for-tess.vert | 16 + ...te-outputs-block.mask-location-1.msl2.tesc | 28 + ...lock.mask-location-1.multi-patch.msl2.tesc | 28 + .../write-outputs-block.mask-location-1.vert | 16 + .../write-outputs.mask-clip-distance.vert | 21 + ...rite-outputs.mask-location-0.for-tess.vert | 21 + .../write-outputs.mask-location-0.msl2.tesc | 26 + ...e-outputs.mask-location-0.multi-patch.tesc | 29 + .../write-outputs.mask-location-0.tesc | 29 + .../write-outputs.mask-location-0.vert | 21 + ...rite-outputs.mask-location-1.for-tess.vert | 21 + .../write-outputs.mask-location-1.msl2.tesc | 26 + ...e-outputs.mask-location-1.multi-patch.tesc | 29 + .../write-outputs.mask-location-1.tesc | 29 + .../write-outputs.mask-location-1.vert | 21 + ...rite-outputs.mask-point-size.for-tess.vert | 21 + ...e-outputs.mask-point-size.multi-patch.tesc | 29 + .../write-outputs.mask-point-size.tesc | 29 + .../write-outputs.mask-point-size.vert | 21 + ...ite-outputs.mask-position.multi-patch.tesc | 29 + .../masking/write-outputs.mask-position.tesc | 29 + .../tesc/arrayed-block-io.multi-patch.tesc | 64 + .../shaders-msl/tesc/basic.multi-patch.tesc | 17 + .../spirv-cross/shaders-msl/tesc/basic.tesc | 17 + ...control-point-inout-types.multi-patch.tesc | 70 + .../complex-control-point-inout-types.tesc | 68 + .../tesc/complex-patch-out-types.tesc | 55 + ...rol-point-array-of-matrix.multi-patch.tesc | 12 + .../load-control-point-array-of-matrix.tesc | 12 + ...rol-point-array-of-struct.multi-patch.tesc | 21 + .../load-control-point-array-of-struct.tesc | 21 + .../load-control-point-array.multi-patch.tesc | 12 + .../tesc/load-control-point-array.tesc | 12 + .../tesc/matrix-output.multi-patch.tesc | 28 + .../tesc/reload-tess-level.multi-patch.tesc | 17 + .../shaders-msl/tesc/reload-tess-level.tesc | 17 + .../tesc/struct-output.multi-patch.tesc | 36 + .../tesc/water_tess.multi-patch.tesc | 115 + .../shaders-msl/tesc/water_tess.tesc | 115 + .../tese/in-array-of-struct.raw-tess-in.tese | 19 + ...-block-with-nested-struct.raw-tess-in.tese | 31 + .../tese/in-block-with-nested-struct.tese | 31 + .../shaders-msl/tese/input-array.tese | 15 + .../tese/input-types.raw-tess-in.tese | 75 + .../shaders-msl/tese/input-types.tese | 75 + .../load-control-point-array-of-matrix.tese | 13 + .../tese/load-control-point-array.tese | 13 + .../shaders-msl/tese/quad.domain.tese | 12 + .../spirv-cross/shaders-msl/tese/quad.tese | 17 + .../read-tess-level-in-func-quad.msl2.tese | 17 + ...s-level-in-func-quad.raw-tess-in.msl2.tese | 17 + .../tese/read-tess-level-in-func.msl2.tese | 17 + ...d-tess-level-in-func.raw-tess-in.msl2.tese | 17 + .../shaders-msl/tese/set-from-function.tese | 36 + .../shaders-msl/tese/triangle-tess-level.tese | 13 + .../shaders-msl/tese/triangle.tese | 10 + .../tese/water_tess.raw-tess-in.tese | 65 + .../shaders-msl/tese/water_tess.tese | 65 + .../vert/array-component-io.for-tess.vert | 21 + .../shaders-msl/vert/array-component-io.vert | 21 + .../shaders-msl/vert/basic.capture.vert | 17 + .../shaders-msl/vert/basic.for-tess.vert | 17 + .../spirv-cross/shaders-msl/vert/basic.vert | 17 + .../vert/buffer_device_address.msl2.vert | 83 + .../clip-distance-block.no-user-varying.vert | 15 + .../shaders-msl/vert/clip-distance-block.vert | 15 + .../shaders-msl/vert/copy.flatten.vert | 34 + .../shaders-msl/vert/dynamic.flatten.vert | 33 + .../vert/float-math.invariant-float-math.vert | 25 + .../shaders-msl/vert/float-math.vert | 25 + .../shaders-msl/vert/functions.vert | 28 + .../shaders-msl/vert/implicit-position-1.vert | 6 + .../shaders-msl/vert/implicit-position-2.vert | 4 + .../shaders-msl/vert/in_out_array_mat.vert | 41 + .../interface-block-block-composites.frag | 17 + .../interface-block-block-composites.vert | 22 + .../interface-block-single-element-array.vert | 17 + .../vert/interpolation-qualifiers-block.vert | 26 + .../vert/interpolation-qualifiers.vert | 22 + .../shaders-msl/vert/invariant.msl21.vert | 11 + .../vert/leaf-function.capture.vert | 22 + .../vert/leaf-function.for-tess.vert | 22 + .../shaders-msl/vert/no-contraction.vert | 15 + .../no-disable-vertex-out.frag-output.vert | 16 + .../vert/no_stage_out.for-tess.vert | 14 + .../shaders-msl/vert/no_stage_out.vert | 14 + .../vert/no_stage_out.write_buff.vert | 23 + .../vert/no_stage_out.write_buff_atomic.vert | 15 + .../vert/no_stage_out.write_tex.vert | 16 + .../out-block-with-nested-struct-array.vert | 28 + .../vert/out-block-with-struct-array.vert | 24 + .../shaders-msl/vert/out_block.vert | 22 + .../shaders-msl/vert/packed-bool-to-uint.vert | 22 + .../vert/packed-bool2-to-packed_uint2.vert | 22 + .../shaders-msl/vert/packed_matrix.vert | 41 + .../shaders-msl/vert/pointsize.vert | 15 + .../vert/read-from-row-major-array.vert | 20 + .../vert/resource-arrays-leaf.ios.vert | 27 + .../shaders-msl/vert/resource-arrays.ios.vert | 23 + .../vert/return-array.force-native-array.vert | 22 + .../shaders-msl/vert/return-array.vert | 22 + .../shaders-msl/vert/set_builtin_in_func.vert | 12 + .../shaders-msl/vert/sign-int-types.vert | 38 + .../signedness-mismatch.shader-inputs.vert | 14 + ...re_buffer.texture-buffer-native.msl21.vert | 10 + .../shaders-msl/vert/texture_buffer.vert | 10 + .../shaders-msl/vert/ubo.alignment.vert | 23 + .../spirv-cross/shaders-msl/vert/ubo.vert | 16 + .../uniform-struct-out-of-order-offests.vert | 31 + .../vert/uniform-struct-packing-nested.vert | 50 + .../shaders-msl/vert/unused-position.vert | 13 + ...asic.multiview.no-layered.nocompat.vk.frag | 14 + .../frag/basic.multiview.nocompat.vk.frag | 14 + ...lper-forwarding.asm.vk.nocompat.msl23.frag | 41 + .../demote-to-helper.vk.nocompat.msl23.frag | 18 + ...emote-to-helper.vk.nocompat.msl23.ios.frag | 8 + .../vulkan/frag/push-constant.vk.frag | 16 + .../vulkan/frag/spec-constant.msl11.vk.frag | 67 + .../vulkan/frag/spec-constant.vk.frag | 67 + ...oup.multiview.viewfromdev.nocompat.vk.vert | 8 + .../vulkan/vert/device-group.nocompat.vk.vert | 7 + ...view.multiview.no-layered.nocompat.vk.vert | 14 + .../vert/multiview.multiview.nocompat.vk.vert | 14 + .../vulkan/vert/multiview.nocompat.vk.vert | 14 + .../vulkan/vert/small-storage.vk.vert | 38 + .../vulkan/vert/vulkan-vertex.vk.vert | 6 + ...ss-chain-dominator-in-loop-body-2.asm.comp | 55 + ...cess-chain-dominator-in-loop-body.asm.comp | 54 + ...ess-tracking-function-call-result.asm.comp | 54 + ...ased-struct-divergent-member-name.asm.comp | 77 + ...etic-conversion-signs.asm.nocompat.vk.comp | 143 + .../asm/comp/atomic-load-store.asm.comp | 48 + .../asm/comp/atomic-result-temporary.asm.comp | 59 + .../asm/comp/basic.spv16.asm.comp | 48 + ...array-in-buffer.asm.spv16.nocompat.vk.comp | 71 + .../asm/comp/bitcast-fp16-fp32.asm.vk.comp | 63 + .../comp/bitfield-signed-operations.asm.comp | 97 + .../shaders-no-opt/asm/comp/bitscan.asm.comp | 72 + ...fer-atomic-nonuniform.vk.nocompat.asm.comp | 53 + ...e-address-ptr-casting.vk.nocompat.asm.comp | 106 + ...ce-aliased-block-name.nocompat.vk.asm.comp | 110 + ...nter-to-pod-in-buffer.asm.nocompat.vk.comp | 44 + ...-unused-pod-in-buffer.asm.nocompat.vk.comp | 44 + ...synthesized-pointer-2.asm.nocompat.vk.comp | 44 + ...e-synthesized-pointer.asm.nocompat.vk.comp | 51 + .../comp/constant-composite-undef.asm.comp | 40 + .../comp/constant-lut-name-aliasing.asm.comp | 81 + .../asm/comp/copy-logical.spv14.asm.comp | 69 + ...-in-entry-point.noeliminate.spv14.asm.comp | 59 + .../comp/expression-nesting-limits.asm.comp | 288 + .../extended-debug-extinst.invalid.asm.comp | 67 + .../fuzz-collapse-degenerate-loop.asm.comp | 118 + ...r-with-unreachable-continue-block.asm.comp | 376 + .../asm/comp/glsl-signed-operations.asm.comp | 123 + .../glsl.std450.frexp-modf-struct.asm.comp | 55 + ...age-atomic-nonuniform.vk.nocompat.asm.comp | 55 + .../comp/local-size-id-override.vk.asm.comp | 60 + .../asm/comp/local-size-id.vk.asm.comp | 76 + ...iable-early-read-with-initializer.asm.comp | 185 + ...op-variable-early-read-with-undef.asm.comp | 185 + .../loop-variable-with-initializer.asm.comp | 31 + .../multi-break-switch-out-of-loop.asm.comp | 94 + ...form-bracket-handling.vk.nocompat.asm.comp | 299 + ...porary-copy-loop-variable.asm.invalid.comp | 68 + ...-temporary-rtas.spv14.asm.vk.nocompat.comp | 81 + ...function-object.spv14.asm.vk.nocompat.comp | 39 + .../spec-constant-name-aliasing.vk.asm.comp | 78 + .../spec-constant-op-convert-sign.asm.comp | 63 + .../asm/comp/storage-buffer-basic.asm.comp | 57 + ...ary-access-terminator.vk.nocompat.asm.comp | 86 + .../degenerate-selection-constructs.asm.frag | 310 + .../anonymous-inner-struct-names.asm.frag | 83 + .../array-builtin-bitcast-load-store.asm.frag | 57 + .../frag/collapsed-switch-phi-flush.asm.frag | 38 + ...ge-sampler-dxc-min16float.asm.invalid.frag | 95 + ...mplex-opaque-handle-reuse-in-loop.asm.frag | 120 + ...site-insert-hoisted-temporaries-1.asm.frag | 80 + ...site-insert-hoisted-temporaries-2.asm.frag | 82 + .../composite-insert-inheritance.asm.frag | 127 + ...-impure-function-call.vk.nocompat.asm.frag | 63 + .../discard-impure-function-call.asm.frag | 59 + .../do-while-continue-phi.asm.invalid.frag | 64 + .../frag/do-while-loop-inverted-test.asm.frag | 51 + .../early-conditional-return-switch.asm.frag | 133 + .../asm/frag/empty-struct-in-struct.asm.frag | 61 + ...ated-merge-block-inverted.asm.invalid.frag | 37 + ...-merge-block-non-inverted.asm.invalid.frag | 37 + .../asm/frag/for-loop-inverted-test.asm.frag | 35 + .../asm/frag/image-fetch-uint-coord.asm.frag | 44 + .../inliner-dominator-inside-loop.asm.frag | 646 + .../late-expression-invalidation-2.asm.frag | 625 + .../late-expression-invalidation.asm.frag | 109 + .../asm/frag/ldexp-uint-exponent.asm.frag | 36 + .../loop-merge-to-continue.asm.invalid.frag | 85 + ...rm-bracket-handling-2.vk.nocompat.asm.frag | 96 + ...qualifier-propagation.vk.nocompat.asm.frag | 159 + .../frag/nonuniform-ssbo.nocompat.vk.asm.frag | 99 + .../frag/only-initializer-frag-depth.asm.frag | 25 + .../opaque-id-literal-alias.preserve.asm.frag | 78 + .../asm/frag/out-of-order-struct-id.asm.frag | 54 + ...lternative-precision.asm..vk.nocompat.frag | 51 + .../asm/frag/phi.zero-initialize.asm.frag | 69 + .../frag/pixel-interlock-callstack.asm.frag | 89 + .../pixel-interlock-control-flow.asm.frag | 121 + .../pixel-interlock-split-functions.asm.frag | 102 + ...ritance-rules-hoisted-temporaries.asm.frag | 97 + ...heritance-rules-hoisted-temporary.asm.frag | 47 + ...laxed-precision-inheritance-rules.asm.frag | 146 + .../reserved-function-identifier.asm.frag | 60 + .../asm/frag/reserved-identifiers.asm.frag | 51 + .../asm/frag/scalar-select.spv14.asm.frag | 62 + ...lection-merge-to-continue.asm.invalid.frag | 85 + ...exture-feedback-uint-code.asm.desktop.frag | 57 + ...group-arithmetic-cast.nocompat.vk.asm.frag | 65 + .../asm/frag/subgroup-ballot-only.vk.asm.frag | 52 + ...ch-block-case-fallthrough.asm.invalid.frag | 80 + .../switch-merge-to-continue.asm.invalid.frag | 85 + ...ch-non-default-fallthrough-no-phi.asm.frag | 105 + ...tch-single-case-multiple-exit-cfg.asm.frag | 57 + ...minate-impure-function-call.spv16.asm.frag | 59 + .../frag/texel-fetch-ms-uint-sample.asm.frag | 68 + .../asm/frag/unordered-compare.asm.frag | 179 + .../frag/unordered-compare.relax-nan.asm.frag | 179 + ...tor-extract-dynamic-spec-constant.asm.frag | 49 + .../frag/vector-shuffle-undef-index.asm.frag | 42 + .../frag/while-loop-inverted-test.asm.frag | 53 + .../geom/store-uint-layer.invalid.asm.geom | 130 + .../loop-header-self-continue-break.asm.comp | 109 + ...builtin-outputs.spv14.asm.vk.nocompat.mesh | 150 + ...tion-nonuniform.spv14.vk.nocompat.asm.rgen | 112 + .../task-shader.vk.nocompat.spv14.asm.task | 132 + .../asm/temporary.zero-initialize.asm.frag | 93 + ...array-of-block-output-initializer.asm.tesc | 101 + .../tesc/copy-memory-control-point.asm.tesc | 199 + ...input-array-builtin-array.invalid.asm.tesc | 248 + .../asm/tesc/tess-level-initializer.asm.tesc | 87 + .../vert/block-struct-initializer.asm.vert | 37 + .../vert/builtin-output-initializer.asm.vert | 44 + .../asm/vert/complex-link-by-name.asm.vert | 119 + ...by-name.force-flattened-io.legacy.asm.vert | 119 + .../vert/constant-composite-extract.asm.vert | 66 + .../vert/debug-printf.asm.vk.nocompat.vert | 29 + .../asm/vert/empty-struct-composite.asm.vert | 36 + .../asm/vert/fma-legacy-fallback.asm.vert | 24 + .../asm/vert/semantic-decoration.asm.vert | 68 + .../comp/bitcast-16bit-1.invalid.comp | 23 + .../comp/bitcast-16bit-2.invalid.comp | 26 + .../shaders-no-opt/comp/bitfield.comp | 21 + .../shaders-no-opt/comp/glsl.std450.comp | 129 + .../comp/illegal-struct-name.asm.comp | 62 + .../comp/image-load-formatted.comp | 11 + .../comp/inout-struct.invalid.comp | 55 + .../shaders-no-opt/comp/int16min-literal.comp | 22 + .../shaders-no-opt/comp/int64min-literal.comp | 23 + .../shaders-no-opt/comp/intmin-literal.comp | 18 + ...loop-break-merge-after-inner-continue.comp | 21 + .../comp/loop-resolve-debug-semantics.g.comp | 16 + .../comp/loop-resolve-debug-semantics.gV.comp | 16 + .../spirv-cross/shaders-no-opt/comp/loop.comp | 98 + .../shaders-no-opt/comp/return.comp | 33 + ...ballot_nonuniform_invocations.invalid.comp | 9 + .../specialization-constant-evaluation.comp | 123 + ...ct-packing-scalar.nocompat.invalid.vk.comp | 88 + .../comp/subgroups.nocompat.invalid.vk.comp | 132 + .../comp/subgroups_arithmetic_fadd.vk.comp | 61 + .../comp/subgroups_arithmetic_fmul.vk.comp | 61 + .../comp/subgroups_arithmetic_iadd.vk.comp | 61 + .../comp/subgroups_arithmetic_imul.vk.comp | 61 + .../comp/subgroups_basicvoteballot.vk.comp | 49 + .../comp/trivial-select-cast-vector.comp | 14 + .../comp/trivial-select-matrix.spv14.comp | 16 + .../frag/16bit-constants.invalid.frag | 14 + .../frag/fp16.invalid.desktop.frag | 151 + .../frag/frag-fully-covered.frag | 11 + ...etch_subpassInput.vk.nocompat.invalid.frag | 10 + .../shaders-no-opt/frag/fs.invalid.frag | 14 + .../shaders-no-opt/frag/image-gather.frag | 14 + .../modf-non-function-purity-analysis.frag | 15 + ...mensional.desktop.invalid.flatten_dim.frag | 18 + .../nonuniform-constructor.vk.nocompat.frag | 14 + .../pixel-interlock-simple-callstack.frag | 31 + ...layout-ubo-std430.vk.nocompat.invalid.frag | 23 + .../frag/sparse-texture-clamp.desktop.frag | 23 + .../frag/sparse-texture-feedback.desktop.frag | 31 + ...pass-input.framebuffer-fetch.nocompat.frag | 12 + ...ocompat.framebuffer-fetch-noncoherent.frag | 12 + ...put.framebuffer-fetch.nocompat.legacy.frag | 12 + ....legacy.framebuffer-fetch-noncoherent.frag | 12 + .../frag/texture-gather-offsets.frag | 14 + .../texture-gather-uint-component.asm.frag | 42 + .../frag/texture1d-emulation.es.frag | 32 + .../frag/texture1d-emulation.legacy.frag | 17 + .../frag/variables.zero-initialize.frag | 21 + ...gle-case-multiple-exit-cfg.legacy.asm.frag | 57 + ...task-shader-basic-2.vk.spv14.nocompat.task | 35 + .../task-shader-basic.vk.spv14.nocompat.task | 28 + .../vert/io-blocks.force-flattened-io.vert | 25 + .../vert/pass-array-by-value.vert | 26 + .../vulkan/frag/shading-rate.vk.nocompat.frag | 9 + .../vulkan/frag/spec-constant.vk.frag | 77 + .../ubo-offset-out-of-order.vk.nocompat.frag | 16 + ...e-helper-invocation.vk.nocompat.spv16.frag | 11 + .../primitive-shading-rate.vk.nocompat.vert | 8 + .../spirv-cross/shaders-other/README.md | 4 + .../aliased-entry-point-names.asm | 60 + .../asm/aliased-entry-point-names.asm.multi | 60 + ...nter-to-array-of-physical-pointer.asm.comp | 51 + .../asm/op-source-glsl-ssbo-1.asm.comp | 53 + .../asm/op-source-glsl-ssbo-2.asm.comp | 65 + .../asm/op-source-hlsl-uav-1.asm.comp | 48 + .../asm/op-source-hlsl-uav-2.asm.comp | 54 + .../asm/op-source-none-ssbo-1.asm.comp | 52 + .../asm/op-source-none-ssbo-2.asm.comp | 64 + .../asm/op-source-none-uav-1.asm.comp | 47 + .../asm/op-source-none-uav-2.asm.comp | 53 + .../comp/array-of-physical-pointer.comp | 15 + .../comp/function-pointer.invalid.asm.comp | 19 + .../comp/out-of-order-block-offsets.comp | 12 + .../comp/physical-pointer.comp | 15 + .../comp/struct-layout.comp | 24 + .../comp/struct-packing.comp | 87 + .../comp/workgroup-size-spec-constant.comp | 13 + .../combined-texture-sampler-shadow.vk.frag | 29 + .../frag/combined-texture-sampler.vk.frag | 47 + .../frag/image-load-store-uint-coord.asm.frag | 103 + .../frag/input-attachment-ms.vk.frag | 10 + .../frag/input-attachment.vk.frag | 11 + .../frag/push-constant.vk.frag | 16 + .../separate-sampler-texture-array.vk.frag | 42 + .../frag/spec-constant.vk.frag | 78 + .../rgen/acceleration_structure.vk.rgen | 9 + .../vert/array-size-reflection.vert | 13 + .../vert/read-from-row-major-array.vert | 20 + .../vert/stride-reflection.vert | 14 + .../vert/texture_buffer.vert | 10 + ...schain-invalid-expression.asm.invalid.frag | 1087 + .../frag/array-copy-error.asm.invalid.frag | 878 + .../phi-variable-declaration.asm.invalid.frag | 878 + .../asm/tese/ds-texcoord-array.asm.tese | 715 + ...-accesschain-writethrough.asm.invalid.vert | 259 + .../asm/frag/depth-compare.asm.frag | 961 + .../asm/frag/global-constant-arrays.asm.frag | 3556 +++ .../padded-float-array-member-defef.asm.frag | 3694 +++ .../asm/frag/sample-mask-not-array.asm.frag | 1230 + ...bpass-input.ios.framebuffer-fetch.asm.frag | 589 + ...ass-input.msl23.framebuffer-fetch.asm.frag | 589 + .../texture-atomics.asm.argument.msl2.frag | 242 + .../asm/frag/texture-atomics.asm.frag | 242 + ...re-atomics.asm.graphics-robust-access.frag | 242 + .../hs-incorrect-base-type.invalid.asm.tesc | 1158 + .../hs-input-array-access.invalid.asm.tesc | 1264 ++ .../tesc/hs-texcoord-array.invalid.asm.tesc | 1144 + ...actor-must-be-threadgroup.invalid.asm.tesc | 352 + .../asm/tese/ds-double-gl-in-deref.asm.tese | 1046 + .../asm/tese/ds-patch-input-fixes.asm.tese | 1175 + .../asm/tese/ds-patch-inputs.asm.tese | 547 + .../asm/vert/array-missing-copies.asm.vert | 1131 + .../asm/vert/texture-buffer.asm.vert | 1054 + .../spirv-cross/shaders/amd/gcn_shader.comp | 13 + .../shaders/amd/shader_ballot.comp | 33 + .../shaders/amd/shader_group_vote.comp | 18 + .../shaders/amd/shader_trinary_minmax.comp | 11 + .../asm/comp/atomic-decrement.asm.comp | 71 + .../asm/comp/atomic-increment.asm.comp | 71 + .../shaders/asm/comp/bitcast_iadd.asm.comp | 79 + .../shaders/asm/comp/bitcast_icmp.asm.comp | 101 + .../shaders/asm/comp/bitcast_iequal.asm.comp | 90 + .../shaders/asm/comp/bitcast_sar.asm.comp | 77 + .../shaders/asm/comp/bitcast_sdiv.asm.comp | 77 + .../shaders/asm/comp/bitcast_slr.asm.comp | 77 + .../asm/comp/block-name-alias-global.asm.comp | 119 + .../asm/comp/builtin-compute-bitcast.asm.comp | 50 + .../asm/comp/control-flow-hints.asm.comp | 146 + .../asm/comp/decoration-group.asm.comp | 99 + .../comp/global-parameter-name-alias.asm.comp | 102 + .../asm/comp/hlsl-functionality.asm.comp | 64 + .../shaders/asm/comp/logical.asm.comp | 191 + .../shaders/asm/comp/multiple-entry.asm.comp | 98 + .../shaders/asm/comp/nmin-max-clamp.asm.comp | 203 + .../comp/nmin-max-clamp.relax-nan.asm.comp | 203 + .../shaders/asm/comp/op-phi-swap.asm.comp | 63 + .../shaders/asm/comp/quantize.asm.comp | 67 + .../asm/comp/recompile-block-naming.asm.comp | 140 + ...specialization-constant-workgroup.asm.comp | 47 + .../comp/switch-break-ladder.asm.invalid.comp | 92 + .../undefined-constant-composite.asm.comp | 102 + .../frag/combined-sampler-reuse.vk.asm.frag | 57 + .../frag/complex-name-workarounds.asm.frag | 81 + ...osite-construct-struct-no-swizzle.asm.frag | 51 + .../asm/frag/default-member-names.asm.frag | 57 + .../frag/do-while-statement-fallback.asm.frag | 76 + .../shaders/asm/frag/empty-struct.asm.frag | 55 + .../frag/for-loop-phi-only-continue.asm.frag | 48 + .../shaders/asm/frag/frem.asm.frag | 41 + .../asm/frag/function-overload-alias.asm.frag | 153 + .../hlsl-sample-cmp-level-zero-cube.asm.frag | 60 + .../frag/hlsl-sample-cmp-level-zero.asm.frag | 115 + .../asm/frag/image-extract-reuse.asm.frag | 41 + .../frag/image-fetch-no-sampler.asm.vk.frag | 163 + ...etch-no-sampler.no-samplerless.asm.vk.frag | 163 + ...uery-no-sampler.no-samplerless.vk.asm.frag | 57 + .../frag/image-query-no-sampler.vk.asm.frag | 57 + .../asm/frag/implicit-read-dep-phi.asm.frag | 81 + .../asm/frag/inf-nan-constant-double.asm.frag | 41 + .../asm/frag/inf-nan-constant.asm.frag | 29 + .../shaders/asm/frag/invalidation.asm.frag | 46 + .../asm/frag/line-directive.line.asm.frag | 221 + .../asm/frag/locations-components.asm.frag | 103 + ...op-body-dominator-continue-access.asm.frag | 190 + .../asm/frag/loop-header-to-continue.asm.frag | 132 + .../frag/lut-promotion-initializer.asm.frag | 195 + .../asm/frag/multi-for-loop-init.asm.frag | 111 + .../asm/frag/op-constant-null.asm.frag | 85 + .../frag/op-phi-swap-continue-block.asm.frag | 69 + ...t-of-bounds-access-opspecconstant.asm.frag | 42 + .../asm/frag/out-of-bounds-access.asm.frag | 47 + .../asm/frag/pack-and-unpack-uint2.asm.frag | 55 + .../shaders/asm/frag/pass-by-value.asm.frag | 51 + .../asm/frag/phi-loop-variable.asm.frag | 71 + .../asm/frag/sample-and-compare.asm.frag | 61 + ...pler-buffer-array-without-sampler.asm.frag | 86 + .../sampler-buffer-without-sampler.asm.frag | 62 + .../frag/single-function-private-lut.asm.frag | 86 + .../shaders/asm/frag/srem.asm.frag | 43 + .../storage-class-output-initializer.asm.frag | 41 + .../struct-composite-extract-swizzle.asm.frag | 55 + .../frag/switch-label-shared-block.asm.frag | 45 + .../switch-preserve-sign-extension.asm.frag | 44 + .../asm/frag/temporary-name-alias.asm.frag | 47 + .../asm/frag/temporary-phi-hoisting.asm.frag | 76 + .../asm/frag/texel-fetch-no-lod.asm.frag | 46 + .../frag/texture-sampling-fp16.asm.vk.frag | 47 + .../asm/frag/undef-variable-store.asm.frag | 85 + .../asm/frag/unknown-depth-state.asm.vk.frag | 71 + .../shaders/asm/frag/unreachable.asm.frag | 61 + .../asm/frag/vector-shuffle-oom.asm.frag | 886 + .../asm/geom/block-name-namespace.asm.geom | 103 + .../inout-split-access-chain-handle.asm.geom | 90 + .../geom/split-access-chain-input.asm.geom | 52 + .../asm/geom/unroll-glposition-load.asm.geom | 102 + .../asm/tese/unroll-input-array-load.asm.tese | 131 + .../shaders/asm/vert/empty-io.asm.vert | 70 + ...act-transposed-matrix-from-struct.asm.vert | 141 + .../asm/vert/global-builtin.sso.asm.vert | 68 + .../shaders/asm/vert/invariant-block.asm.vert | 44 + .../asm/vert/invariant-block.sso.asm.vert | 44 + .../shaders/asm/vert/invariant.asm.vert | 34 + .../shaders/asm/vert/invariant.sso.asm.vert | 34 + .../spec-constant-op-composite.asm.vk.vert | 100 + .../vert/uint-vertex-id-instance-id.asm.vert | 65 + .../spirv-cross/shaders/comp/atomic.comp | 56 + .../shaders/comp/bake_gradient.comp | 55 + .../spirv-cross/shaders/comp/barriers.comp | 79 + .../spirv-cross/shaders/comp/basic.comp | 28 + .../spirv-cross/shaders/comp/casts.comp | 18 + .../shaders/comp/cfg-preserve-parameter.comp | 54 + third_party/spirv-cross/shaders/comp/cfg.comp | 91 + .../shaders/comp/coherent-block.comp | 12 + .../shaders/comp/coherent-image.comp | 14 + .../comp/composite-array-initialization.comp | 29 + .../shaders/comp/composite-construct.comp | 40 + .../spirv-cross/shaders/comp/culling.comp | 26 + .../shaders/comp/defer-parens.comp | 30 + .../spirv-cross/shaders/comp/dowhile.comp | 31 + .../shaders/comp/generate_height.comp | 97 + .../spirv-cross/shaders/comp/image.comp | 12 + .../spirv-cross/shaders/comp/insert.comp | 18 + .../spirv-cross/shaders/comp/mat3.comp | 14 + third_party/spirv-cross/shaders/comp/mod.comp | 26 + .../spirv-cross/shaders/comp/modf.comp | 23 + .../shaders/comp/outer-product.comp | 37 + .../shaders/comp/read-write-only.comp | 26 + .../spirv-cross/shaders/comp/rmw-matrix.comp | 20 + .../spirv-cross/shaders/comp/rmw-opt.comp | 27 + ...alar-std450-distance-length-normalize.comp | 18 + .../spirv-cross/shaders/comp/shared.comp | 27 + .../shaders/comp/ssbo-array-length.comp | 12 + .../spirv-cross/shaders/comp/ssbo-array.comp | 14 + .../shaders/comp/struct-layout.comp | 24 + .../shaders/comp/struct-packing.comp | 86 + .../shaders/comp/torture-loop.comp | 40 + .../spirv-cross/shaders/comp/type-alias.comp | 45 + .../spirv-cross/shaders/comp/udiv.comp | 17 + .../desktop-only/comp/enhanced-layouts.comp | 39 + .../comp/extended-arithmetic.desktop.comp | 41 + .../desktop-only/comp/fp64.desktop.comp | 91 + .../image-formats.desktop.noeliminate.comp | 48 + .../desktop-only/comp/int64.desktop.comp | 55 + .../frag/clip-cull-distance.desktop.frag | 12 + .../control-dependent-in-branch.desktop.frag | 36 + .../frag/depth-greater-than.desktop.frag | 8 + .../frag/depth-less-than.desktop.frag | 8 + .../frag/dual-source-blending.desktop.frag | 10 + .../frag/hlsl-uav-block-alias.asm.frag | 56 + .../desktop-only/frag/image-ms.desktop.frag | 12 + .../frag/image-query.desktop.frag | 56 + .../shaders/desktop-only/frag/image-size.frag | 10 + .../image-size.no-qualifier-deduction.frag | 10 + .../frag/in-block-qualifiers.frag | 20 + .../frag/layout-component.desktop.frag | 14 + .../frag/query-levels.desktop.frag | 9 + .../desktop-only/frag/query-lod.desktop.frag | 10 + .../frag/sampler-ms-query.desktop.frag | 17 + .../frag/stencil-export.desktop.frag | 11 + .../frag/texture-proj-shadow.desktop.frag | 21 + .../desktop-only/geom/basic.desktop.sso.geom | 37 + .../geom/viewport-index.desktop.geom | 11 + .../desktop-only/tesc/basic.desktop.sso.tesc | 28 + .../tese/triangle.desktop.sso.tese | 22 + .../desktop-only/vert/basic.desktop.sso.vert | 20 + .../vert/clip-cull-distance.desktop.sso.vert | 13 + .../vert/clip-cull-distance.desktop.vert | 13 + .../vert/out-block-qualifiers.vert | 26 + ...shader-draw-parameters-450.desktop.vk.vert | 12 + .../shader-draw-parameters.desktop.vk.vert | 11 + .../shaders/flatten/array.flatten.vert | 19 + .../shaders/flatten/basic.flatten.vert | 16 + .../shaders/flatten/copy.flatten.vert | 34 + .../shaders/flatten/dynamic.flatten.vert | 33 + .../flatten/matrix-conversion.flatten.frag | 14 + .../shaders/flatten/matrixindex.flatten.vert | 25 + .../shaders/flatten/multiindex.flatten.vert | 13 + .../flatten/push-constant.flatten.vert | 17 + .../shaders/flatten/rowmajor.flatten.vert | 16 + .../shaders/flatten/struct.flatten.vert | 30 + .../flatten/struct.rowmajor.flatten.vert | 26 + .../shaders/flatten/swizzle.flatten.vert | 47 + .../shaders/flatten/types.flatten.frag | 27 + .../frag/array-lut-no-loop-variable.frag | 13 + .../avoid-expression-lowering-to-loop.frag | 23 + .../shaders/frag/barycentric-khr.frag | 11 + .../shaders/frag/barycentric-nv.frag | 11 + .../spirv-cross/shaders/frag/basic.frag | 13 + .../complex-expression-in-access-chain.frag | 29 + .../composite-extract-forced-temporary.frag | 11 + .../shaders/frag/constant-array.frag | 21 + .../shaders/frag/constant-composites.frag | 20 + .../shaders/frag/false-loop-init.frag | 19 + .../shaders/frag/flush_params.frag | 27 + .../frag/for-loop-continue-control-flow.frag | 11 + .../shaders/frag/for-loop-init.frag | 52 + .../spirv-cross/shaders/frag/frexp-modf.frag | 24 + .../shaders/frag/front-facing.frag | 14 + .../spirv-cross/shaders/frag/gather-dref.frag | 11 + .../spirv-cross/shaders/frag/ground.frag | 162 + .../shaders/frag/helper-invocation.frag | 21 + ...temporary-use-continue-block-as-value.frag | 24 + .../frag/image-load-store-uint-coord.asm.frag | 103 + ...-loop-dominated-variable-preservation.frag | 24 + .../loop-dominator-and-switch-default.frag | 34 + .../shaders/frag/lut-promotion.frag | 44 + third_party/spirv-cross/shaders/frag/mix.frag | 20 + .../frag/modf-pointer-function-analysis.frag | 25 + .../shaders/frag/partial-write-preserve.frag | 95 + .../shaders/frag/pixel-interlock-ordered.frag | 22 + .../frag/pixel-interlock-unordered.frag | 22 + third_party/spirv-cross/shaders/frag/pls.frag | 20 + .../shaders/frag/post-depth-coverage-es.frag | 13 + .../shaders/frag/post-depth-coverage.frag | 11 + .../spirv-cross/shaders/frag/round-even.frag | 11 + .../spirv-cross/shaders/frag/round.frag | 11 + .../frag/sample-interlock-ordered.frag | 22 + .../frag/sample-interlock-unordered.frag | 22 + .../shaders/frag/sample-parameter.frag | 11 + .../spirv-cross/shaders/frag/sampler-ms.frag | 16 + .../shaders/frag/sampler-proj.frag | 12 + .../spirv-cross/shaders/frag/sampler.frag | 18 + .../shaders/frag/scalar-refract-reflect.frag | 11 + .../frag/selection-block-dominator.frag | 18 + .../shaders/frag/shader-clock.frag | 17 + .../frag/struct-type-unrelated-alias.frag | 19 + .../frag/switch-unreachable-break.frag | 32 + .../shaders/frag/switch-unsigned-case.frag | 26 + .../spirv-cross/shaders/frag/swizzle.frag | 17 + .../shaders/frag/texel-fetch-offset.frag | 10 + .../frag/ubo-load-row-major-workaround.frag | 44 + .../spirv-cross/shaders/frag/ubo_layout.frag | 24 + .../shaders/frag/unary-enclose.frag | 15 + .../spirv-cross/shaders/geom/basic.geom | 28 + .../shaders/geom/geometry-passthrough.geom | 28 + .../shaders/geom/lines-adjacency.geom | 28 + .../spirv-cross/shaders/geom/lines.geom | 24 + .../shaders/geom/multi-stream.geom | 15 + .../spirv-cross/shaders/geom/points.geom | 28 + .../shaders/geom/single-invocation.geom | 28 + .../geom/transform-feedback-streams.geom | 24 + .../shaders/geom/triangles-adjacency.geom | 28 + .../spirv-cross/shaders/geom/triangles.geom | 28 + .../legacy/fragment/explicit-lod.legacy.frag | 12 + .../legacy/fragment/explicit-lod.legacy.vert | 12 + .../shaders/legacy/fragment/fma.legacy.frag | 12 + .../legacy/fragment/hyperbolic.legacy.frag | 26 + .../legacy/fragment/io-blocks.legacy.frag | 16 + .../legacy/fragment/isnan-isinf.legacy.frag | 14 + .../shaders/legacy/fragment/modf.legacy.frag | 16 + .../multiple-struct-flattening.legacy.frag | 37 + .../shaders/legacy/fragment/round.legacy.frag | 11 + .../fragment/struct-varying.legacy.frag | 25 + .../legacy/fragment/switch.legacy.frag | 43 + .../legacy/vert/implicit-lod.legacy.vert | 8 + .../legacy/vert/int-attribute.legacy.vert | 10 + .../shaders/legacy/vert/inverse.legacy.vert | 39 + .../shaders/legacy/vert/io-block.legacy.vert | 17 + .../legacy/vert/outer-product.legacy.vert | 19 + .../struct-flatten-inner-array.legacy.vert | 15 + ...flatten-stores-multi-dimension.legacy.vert | 40 + .../legacy/vert/struct-varying.legacy.vert | 33 + .../legacy/vert/switch-nested.legacy.vert | 28 + .../shaders/legacy/vert/transpose.legacy.vert | 54 + ...-shader-basic-lines.spv14.vk.nocompat.mesh | 63 + ...shader-basic-points.spv14.vk.nocompat.mesh | 63 + ...ader-basic-triangle.spv14.vk.nocompat.mesh | 63 + .../spirv-cross/shaders/tesc/basic.tesc | 17 + .../spirv-cross/shaders/tesc/water_tess.tesc | 115 + third_party/spirv-cross/shaders/tese/ccw.tese | 10 + third_party/spirv-cross/shaders/tese/cw.tese | 10 + .../spirv-cross/shaders/tese/equal.tese | 10 + .../shaders/tese/fractional_even.tese | 10 + .../shaders/tese/fractional_odd.tese | 10 + .../spirv-cross/shaders/tese/input-array.tese | 10 + .../spirv-cross/shaders/tese/line.tese | 10 + .../shaders/tese/load-array-of-array.tese | 10 + .../shaders/tese/patch-input-array.tese | 9 + .../spirv-cross/shaders/tese/triangle.tese | 10 + .../spirv-cross/shaders/tese/water_tess.tese | 65 + .../spirv-cross/shaders/vert/basic.vert | 16 + .../spirv-cross/shaders/vert/ground.vert | 202 + .../spirv-cross/shaders/vert/invariant.vert | 13 + .../shaders/vert/no-contraction.vert | 15 + .../spirv-cross/shaders/vert/ocean.vert | 200 + .../vert/read-from-row-major-array.vert | 20 + .../shaders/vert/return-array.vert | 22 + .../shaders/vert/row-major-workaround.vert | 28 + .../shaders/vert/texture_buffer.vert | 10 + .../vert/transform-feedback-decorations.vert | 20 + third_party/spirv-cross/shaders/vert/ubo.vert | 16 + ...array-of-buffer-reference.nocompat.vk.comp | 23 + .../buffer-reference-atomic.nocompat.vk.comp | 24 + ...ce-base-alignment-promote.nocompat.vk.comp | 25 + ...e-bitcast-uvec2-2.nocompat.invalid.vk.comp | 19 + ...r-reference-bitcast-uvec2.nocompat.vk.comp | 18 + .../buffer-reference-bitcast.nocompat.vk.comp | 22 + ...fer-reference-decorations.nocompat.vk.comp | 31 + .../comp/buffer-reference.nocompat.vk.comp | 40 + .../vulkan/comp/fp-atomic.nocompat.vk.comp | 18 + .../ray-query.nocompat.spv14.invalid.vk.comp | 58 + .../spec-constant-op-member-array.vk.comp | 33 + .../spec-constant-work-group-size.vk.comp | 17 + .../combined-texture-sampler-shadow.vk.frag | 29 + .../frag/combined-texture-sampler.vk.frag | 47 + ...-to-helper-forwarding.asm.vk.nocompat.frag | 41 + .../frag/demote-to-helper.vk.nocompat.frag | 8 + .../vulkan/frag/desktop-mediump.vk.frag | 11 + .../vulkan/frag/input-attachment-ms.vk.frag | 10 + .../vulkan/frag/input-attachment.vk.frag | 11 + .../nonuniform-qualifier.vk.nocompat.frag | 52 + .../push-constant-as-ubo.push-ubo.vk.frag | 13 + .../shaders/vulkan/frag/push-constant.vk.frag | 16 + .../separate-combined-fake-overload.vk.frag | 21 + .../separate-sampler-texture-array.vk.frag | 42 + .../frag/separate-sampler-texture.vk.frag | 36 + .../shader-arithmetic-8bit.nocompat.vk.frag | 88 + .../frag/spec-constant-block-size.vk.frag | 17 + .../vulkan/frag/spec-constant-ternary.vk.frag | 9 + .../terminators.khr.spv14.nocompat.vk.rahit | 17 + .../rahit/terminators.nocompat.vk.rahit | 17 + ...oming-callable.khr.spv14.nocompat.vk.rcall | 9 + ...ttribute_block.khr.spv14.nocompat.vk.rchit | 11 + .../hit_attribute_block.nocompat.vk.rchit | 11 + ...ck_in_function.khr.spv14.nocompat.vk.rchit | 16 + ...ribute_block_in_function.nocompat.vk.rchit | 16 + ...ttribute_plain.khr.spv14.nocompat.vk.rchit | 10 + .../hit_attribute_plain.nocompat.vk.rchit | 10 + ...tribute_struct.khr.spv14.nocompat.vk.rchit | 12 + .../hit_attribute_struct.nocompat.vk.rchit | 12 + .../hit_kind.khr.spv14.nocompat.vk.rchit | 9 + .../vulkan/rchit/hit_kind.nocompat.vk.rchit | 9 + .../rchit/hit_t.khr.spv14.nocompat.vk.rchit | 9 + .../vulkan/rchit/hit_t.nocompat.vk.rchit | 9 + ...ming_ray_flags.khr.spv14.nocompat.vk.rchit | 9 + .../incoming_ray_flags.nocompat.vk.rchit | 9 + ...ance_custom_id.khr.spv14.nocompat.vk.rchit | 9 + .../instance_custom_id.nocompat.vk.rchit | 9 + .../instance_id.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/instance_id.nocompat.vk.rchit | 9 + ..._ray_direction.khr.spv14.nocompat.vk.rchit | 9 + .../object_ray_direction.nocompat.vk.rchit | 9 + ...ect_ray_origin.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/object_ray_origin.nocompat.vk.rchit | 9 + ...bject_to_world.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/object_to_world.nocompat.vk.rchit | 9 + .../payloads.khr.spv14.nocompat.vk.rchit | 19 + .../vulkan/rchit/payloads.nocompat.vk.rchit | 19 + .../primitive_id.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/primitive_id.nocompat.vk.rchit | 9 + .../ray_tmax.khr.spv14.nocompat.vk.rchit | 9 + .../vulkan/rchit/ray_tmax.nocompat.vk.rchit | 9 + .../ray_tmin.khr.spv14.nocompat.vk.rchit | 9 + .../vulkan/rchit/ray_tmin.nocompat.vk.rchit | 9 + .../ray_tracing.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/ray_tracing.nocompat.vk.rchit | 9 + ..._ray_direction.khr.spv14.nocompat.vk.rchit | 9 + .../world_ray_direction.nocompat.vk.rchit | 9 + ...rld_ray_origin.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/world_ray_origin.nocompat.vk.rchit | 9 + ...orld_to_object.khr.spv14.nocompat.vk.rchit | 9 + .../rchit/world_to_object.nocompat.vk.rchit | 9 + .../convert-u-to-as.spv14.vk.nocompat.rgen | 16 + ...xecute_callable.nocompat.khr.spv14.vk.rgen | 16 + .../rgen/execute_callable.nocompat.vk.rgen | 16 + .../rgen/launch_id.khr.spv14.nocompat.vk.rgen | 9 + .../vulkan/rgen/launch_id.nocompat.vk.rgen | 9 + .../launch_size.khr.spv14.nocompat.vk.rgen | 9 + .../vulkan/rgen/launch_size.nocompat.vk.rgen | 9 + .../rgen/payloads.khr.spv14.nocompat.vk.rgen | 49 + .../vulkan/rgen/payloads.nocompat.vk.rgen | 49 + .../rgen/pure_call.khr.spv14.nocompat.vk.rgen | 18 + .../vulkan/rgen/pure_call.nocompat.vk.rgen | 18 + .../ray_tracing.khr.spv14.nocompat.vk.rgen | 16 + .../vulkan/rgen/ray_tracing.nocompat.vk.rgen | 16 + ...r_record_buffer.khr.spv14.nocompat.vk.rgen | 16 + .../shader_record_buffer.nocompat.vk.rgen | 16 + ...rt-intersection.khr.spv14.nocompat.vk.rint | 12 + .../rint/report-intersection.nocompat.vk.rint | 12 + .../ray_tracing.khr.spv14.nocompat.vk.rmiss | 9 + .../rmiss/ray_tracing.nocompat.vk.rmiss | 9 + ...trace_incoming.khr.spv14.nocompat.vk.rmiss | 12 + .../vulkan/vert/device-group.nocompat.vk.vert | 7 + .../vulkan/vert/multiview.nocompat.vk.vert | 14 + .../shaders/vulkan/vert/small-storage.vk.vert | 46 + .../shaders/vulkan/vert/vulkan-vertex.vk.vert | 6 + third_party/spirv-cross/spirv_common.hpp | 1 + third_party/spirv-cross/spirv_common.hpp.orig | 1 + third_party/spirv-cross/spirv_cross.cpp | 45 +- third_party/spirv-cross/spirv_cross.hpp | 2 + third_party/spirv-cross/spirv_cross_c.cpp | 37 + third_party/spirv-cross/spirv_cross_c.h | 4 +- .../spirv-cross/spirv_cross_parsed_ir.cpp | 7 + third_party/spirv-cross/spirv_glsl.cpp | 589 +- third_party/spirv-cross/spirv_glsl.cpp.orig | 18524 ++++++++++++++++ third_party/spirv-cross/spirv_glsl.hpp | 34 +- third_party/spirv-cross/spirv_hlsl.cpp | 55 +- third_party/spirv-cross/spirv_hlsl.hpp | 8 + third_party/spirv-cross/spirv_msl.cpp | 118 +- third_party/spirv-cross/spirv_msl.hpp | 2 +- third_party/spirv-cross/spirv_reflect.cpp | 2 +- third_party/spirv-cross/test_shaders.py | 2 + .../spirv-cross/tests-other/c_api_test.c | 223 + .../spirv-cross/tests-other/c_api_test.spv | Bin 0 -> 1268 bytes .../tests-other/hlsl_resource_binding.spv | Bin 0 -> 796 bytes .../tests-other/hlsl_resource_bindings.cpp | 89 + .../tests-other/hlsl_wave_mask.cpp | 73 + .../tests-other/msl_constexpr_test.cpp | 133 + .../tests-other/msl_constexpr_test.spv | Bin 0 -> 1656 bytes .../tests-other/msl_resource_binding.spv | Bin 0 -> 1424 bytes .../tests-other/msl_resource_bindings.cpp | 86 + .../tests-other/msl_ycbcr_conversion_test.cpp | 103 + .../tests-other/msl_ycbcr_conversion_test.spv | Bin 0 -> 728 bytes .../msl_ycbcr_conversion_test_2.spv | Bin 0 -> 840 bytes .../spirv-cross/tests-other/small_vector.cpp | 226 + .../spirv-cross/tests-other/typed_id_test.cpp | 49 + 4143 files changed, 251264 insertions(+), 148 deletions(-) create mode 100644 third_party/spirv-cross/pkg-config/spirv-cross-c.pc.in create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chain-load-composite.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.force-uav.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/address-buffers.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/builtins.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/globallycoherent.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.nonwritable-uav-texture.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/inverse.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-alone.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-with-builtins.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm30.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm50.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/builtins.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/clip-cull-distance.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/demote-to-helper.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/hyperbolic.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/io-block.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/matrix-input.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mod.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mrt.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/point-coord-compat.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/resources.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/row-major-layout-in-struct.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in-and-out.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-out.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-image-arrays.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling-ms.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.sm30.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/clip-cull-distance.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/instancing.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/invariant.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/legacy-int-attribute.sm30.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/locations.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-output.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-input.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size.sm30.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/qualifiers.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/amd/shader_trinary_minmax.msl21.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/duplicate-spec-id.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/relaxed-block-layout.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/uint_smulextended.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/min-lod.msl22.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-image-sampled-image.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-different-sizes.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/copy-memory-interface.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/fake-builtin-input.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/invariant.msl21.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/access-private-workgroup-in-function.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic-float.msl3.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.inline-block.msl2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address.msl2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/builtins.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-type-alias.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.force-native-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/force-recompile-hooks.swizzle.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/functions.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/image-cube-array-load-store.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/image.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/insert.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/local-size-duplicate-spec-id.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3-row-maj-read-write-const.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-1.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.nocompat.spv14.vk.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-array-of-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-cast.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-struct-bool-cast.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-nested.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/type-alias.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/type_casting_i64.msl22.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/udiv.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-component-io.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.force-sample.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-func-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/builtins.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/clip-distance-varying.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/cull-distance-varying.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/disable-frag-output.frag-output.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/early-fragment-tests.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/flush_params.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-dref.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/helper-invocation.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/illegal-name-test-0.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/image-query-lod.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/in_mat.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.arrayed-subpass.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.multiview.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers-block.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/mix.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/nonuniform-qualifier.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/packed-expression-vector-shuffle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/packing-test-3.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/pls.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.ios.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/private-variable-prototype-declaration.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/read-cull-clip-distance-in-function.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/readonly-ssbo.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/return-value-after-discard-terminator.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-separate-image-sampler.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position-func.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-image-arrays.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/separate-image-sampler-argument.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-arithmetic-8bit.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/stencil-export.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-builtins.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-globals-extract.msl22.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-multisample-array.msl21.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/frag/write-depth-in-function.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/intel/shader-integer-functions2.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-clip-distance.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/matrix-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/struct-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/input-array.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.domain.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.msl2.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/set-from-function.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.capture.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.no-user-varying.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/functions.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-1.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-2.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-single-element-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers-block.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/invariant.msl21.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.capture.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no-disable-vertex-out.frag-output.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.for-tess.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-nested-struct-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-struct-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/out_block.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool-to-uint.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool2-to-packed_uint2.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/packed_matrix.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/pointsize.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays-leaf.ios.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays.ios.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.force-native-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/set_builtin_in_func.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/signedness-mismatch.shader-inputs.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.alignment.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vert/unused-position.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/amd/gcn_shader.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/amd/shader_ballot.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/amd/shader_group_vote.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/amd/shader_trinary_minmax.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iequal.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/builtin-compute-bitcast.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/decoration-group.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/logical.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/op-phi-swap.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/recompile-block-naming.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/switch-break-ladder.asm.invalid.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/complex-name-workarounds.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/do-while-statement-fallback.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant-double.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/invalidation.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/op-phi-swap-continue-block.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/pack-and-unpack-uint2.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-label-shared-block.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-preserve-sign-extension.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-name-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/geom/block-name-namespace.asm.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/geom/inout-split-access-chain-handle.asm.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/geom/split-access-chain-input.asm.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/geom/unroll-glposition-load.asm.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/tese/unroll-input-array-load.asm.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/empty-io.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/bake_gradient.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/basic.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/casts.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/cfg.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/culling.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/dowhile.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/generate_height.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/image.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/insert.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/mat3.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/mod.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/modf.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/type-alias.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/comp/udiv.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/fp64.desktop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/int64.desktop.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/clip-cull-distance.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-greater-than.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-less-than.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/dual-source-blending.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/in-block-qualifiers.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/layout-component.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/stencil-export.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/viewport-index.desktop.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/out-block-qualifiers.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/avoid-expression-lowering-to-loop.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/barycentric-khr.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/barycentric-nv.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/constant-array.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/flush_params.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/frexp-modf.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/gather-dref.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/ground.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/helper-invocation.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/image-load-store-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/inside-loop-dominated-variable-preservation.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/mix.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/modf-pointer-function-analysis.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-ordered.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-unordered.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/pls.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/round-even.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/round.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-ordered.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-unordered.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sample-parameter.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sampler-proj.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/sampler.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/selection-block-dominator.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/shader-clock.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/struct-type-unrelated-alias.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/swizzle.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/ubo-load-row-major-workaround.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/basic.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/geometry-passthrough.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/lines-adjacency.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/lines.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/multi-stream.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/points.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/single-invocation.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/transform-feedback-streams.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/triangles-adjacency.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/geom/triangles.geom create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/fma.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/hyperbolic.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/io-blocks.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/isnan-isinf.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/modf.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/round.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/struct-varying.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/fragment/switch.legacy.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/implicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/int-attribute.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/inverse.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/io-block.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/outer-product.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/switch-nested.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/tesc/basic.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/ccw.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/cw.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/equal.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/fractional_even.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/fractional_odd.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/input-array.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/line.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/load-array-of-array.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/patch-input-array.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/triangle.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/tese/water_tess.tese create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/ground.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/invariant.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/ocean.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/row-major-workaround.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/transform-feedback-decorations.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vert/ubo.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/frag-coord.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/spec-constant.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-instance.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-vertex.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/access-chain-load-composite.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.force-uav.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/address-buffers.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/builtins.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/globallycoherent.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/image.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/image.nonwritable-uav-texture.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/inverse.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-alone.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-with-builtins.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/rwbuffer-matrix.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm30.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm50.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/bit-conversions.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/boolean-mix.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/builtins.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/bvec-operations.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/clip-cull-distance.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-parameter.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-shadow.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/demote-to-helper.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/early-fragment-test.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/hyperbolic.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-selective.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/image-query.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/io-block.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/matrix-input.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/mod.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/mrt.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/no-return.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/no-return2.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/point-coord-compat.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/resources.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/row-major-layout-in-struct.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sample-cmp-level-zero.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in-and-out.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-out.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-array.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-image-arrays.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/swizzle-scalar.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling-ms.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.sm30.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/unorm-snorm-packing.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/frag/various-glsl-ops.frag create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/clip-cull-distance.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/instancing.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/invariant.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/legacy-int-attribute.sm30.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/locations.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-attribute.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-output.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/no-input.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/point-size-compat.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/point-size.sm30.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/qualifiers.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/sampler-buffers.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/struct-composite-decl.vert create mode 100644 third_party/spirv-cross/reference/shaders-hlsl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-gather.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/implicit-integer-promotion.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int16min-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64.invalid.msl22.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64min-literal.msl22.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/loop.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/return.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-input-component.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-input-component.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-output-component.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/16bit-constants.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/depth-image-gather.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/image-gather.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/in_block_assign.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/load-store-col-rows.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/member-padding.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-alignment.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/cull-distance.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/layer.msl11.invalid.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/modf-storage-class.capture.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/amd/shader_trinary_minmax.msl21.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/duplicate-spec-id.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/relaxed-block-layout.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/uint_smulextended.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/min-lod.msl22.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/op-image-sampled-image.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-different-sizes.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/copy-memory-interface.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/fake-builtin-input.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/packing-test.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/array-length.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/atomic-float.msl3.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/basic.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/basic.inline-block.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/builtins.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/complex-composite-constant-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.force-native-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/culling.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/force-recompile-hooks.swizzle.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/functions.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/image-cube-array-load-store.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/image.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/insert.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/local-size-duplicate-spec-id.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/mat3-row-maj-read-write-const.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/mat3.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/mod.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/modf.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/packing-test-1.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/packing-test-2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-array-of-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-cast.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared-struct-bool-cast.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/storage-buffer-std140-vector-array.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/struct-nested.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/threadgroup-boolean-workaround.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/type-alias.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/type_casting_i64.msl22.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/udiv.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-component-io.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-of-array-lut.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/basic.force-sample.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/binary-func-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/binary-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/builtins.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/clip-distance-varying.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/constant-array.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/cull-distance-varying.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/depth-out-early-frag-tests.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/depth-out-no-early-frag-tests.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/disable-frag-output.frag-output.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/early-fragment-tests.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/flush_params.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/gather-dref.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/gather-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/illegal-name-test-0.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/in_block.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/in_mat.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.multiview.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers-block.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/mix.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/modf-access-tracking-function.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/mrt-array.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/nonuniform-qualifier.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/packed-expression-vector-shuffle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/pls.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.ios.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/read-cull-clip-distance-in-function.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/return-value-after-discard-terminator.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-position.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/sampler.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/subgroup-builtins.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/subgroup-globals-extract.msl22.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texture-multisample-array.msl21.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/intel/shader-integer-functions2.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-msl/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-clip-distance.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/basic.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/basic.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/complex-patch-out-types.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/matrix-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/struct-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.multi-patch.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/input-array.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/input-types.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/input-types.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/quad.domain.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/quad.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/set-from-function.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/triangle-tess-level.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/triangle.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/water_tess.raw-tess-in.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/tese/water_tess.tese create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/basic.capture.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/basic.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.no-user-varying.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/float-math.invariant-float-math.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/float-math.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/functions.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-1.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-2.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/interface-block-single-element-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers-block.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/invariant.msl21.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no-disable-vertex-out.frag-output.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.for-tess.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-nested-struct-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-struct-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/out_block.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/packed-bool-to-uint.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/packed-bool2-to-packed_uint2.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/packed_matrix.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/pointsize.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays.ios.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/return-array.force-native-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/signedness-mismatch.shader-inputs.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/ubo.alignment.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/ubo.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-out-of-order-offests.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-packing-nested.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vert/unused-position.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/basic.spv16.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/asm/vert/semantic-decoration.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/glsl.std450.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/image-load-formatted.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/inout-struct.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/int16min-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/int64min-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/loop.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/return.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/specialization-constant-evaluation.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/16bit-constants.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/fp16.invalid.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/frag-fully-covered.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/fs.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/image-gather.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-offsets.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.es.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vert/io-blocks.force-flattened-io.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/aliased-entry-point-names.asm.multi.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-1.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-2.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/array-of-physical-pointer.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/function-pointer.invalid.asm.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/out-of-order-block-offsets.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/physical-pointer.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/struct-layout.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/struct-packing.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/image-load-store-uint-coord.asm.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment-ms.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/push-constant.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/separate-sampler-texture-array.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/frag/spec-constant.vk.frag.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/vert/array-size-reflection.vert.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/vert/read-from-row-major-array.vert.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/vert/stride-reflection.vert.json create mode 100644 third_party/spirv-cross/reference/shaders-reflection/vert/texture_buffer.vert.json create mode 100644 third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/depth-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/global-constant-arrays.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/vert/array-missing-copies.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders-ue4/asm/vert/texture-buffer.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/amd/gcn_shader.comp create mode 100644 third_party/spirv-cross/reference/shaders/amd/shader_ballot.comp create mode 100644 third_party/spirv-cross/reference/shaders/amd/shader_group_vote.comp create mode 100644 third_party/spirv-cross/reference/shaders/amd/shader_trinary_minmax.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iequal.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/builtin-compute-bitcast.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/decoration-group.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/logical.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/op-phi-swap.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/recompile-block-naming.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/switch-break-ladder.asm.invalid.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/complex-name-workarounds.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/do-while-statement-fallback.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant-double.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/invalidation.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/multi-for-loop-init.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/pack-and-unpack-uint2.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/switch-label-shared-block.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/switch-preserve-sign-extension.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/temporary-name-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/temporary-phi-hoisting.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/asm/geom/block-name-namespace.asm.geom create mode 100644 third_party/spirv-cross/reference/shaders/asm/geom/inout-split-access-chain-handle.asm.geom create mode 100644 third_party/spirv-cross/reference/shaders/asm/geom/split-access-chain-input.asm.geom create mode 100644 third_party/spirv-cross/reference/shaders/asm/geom/unroll-glposition-load.asm.geom create mode 100644 third_party/spirv-cross/reference/shaders/asm/tese/unroll-input-array-load.asm.tese create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/empty-io.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/global-builtin.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/invariant.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/invariant.sso.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/reference/shaders/comp/atomic.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/bake_gradient.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/barriers.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/basic.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/casts.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/cfg.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/culling.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/dowhile.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/generate_height.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/image.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/insert.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/mat3.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/mod.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/modf.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/outer-product.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/shared.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/type-alias.comp create mode 100644 third_party/spirv-cross/reference/shaders/comp/udiv.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/comp/enhanced-layouts.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/comp/fp64.desktop.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/comp/int64.desktop.comp create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/clip-cull-distance.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-greater-than.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-less-than.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/dual-source-blending.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/image-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/in-block-qualifiers.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/layout-component.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/stencil-export.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/geom/basic.desktop.sso.geom create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/geom/viewport-index.desktop.geom create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/out-block-qualifiers.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/reference/shaders/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/reference/shaders/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/avoid-expression-lowering-to-loop.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/barycentric-khr.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/barycentric-nv.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/basic.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/constant-array.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/flush_params.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/frexp-modf.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/front-facing.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/gather-dref.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/ground.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/helper-invocation.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/image-load-store-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/inside-loop-dominated-variable-preservation.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/loop-dominator-and-switch-default.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/mix.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/modf-pointer-function-analysis.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/pixel-interlock-ordered.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/pixel-interlock-unordered.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/pls.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/post-depth-coverage.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/round-even.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/round.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sample-interlock-ordered.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sample-interlock-unordered.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sample-parameter.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sampler-proj.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/sampler.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/selection-block-dominator.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/shader-clock.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/struct-type-unrelated-alias.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/swizzle.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/ubo-load-row-major-workaround.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/reference/shaders/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/reference/shaders/geom/basic.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/geometry-passthrough.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/lines-adjacency.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/lines.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/multi-stream.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/points.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/single-invocation.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/transform-feedback-streams.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/triangles-adjacency.geom create mode 100644 third_party/spirv-cross/reference/shaders/geom/triangles.geom create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/fma.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/hyperbolic.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/io-blocks.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/isnan-isinf.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/modf.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/round.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/struct-varying.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/fragment/switch.legacy.frag create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/implicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/int-attribute.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/inverse.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/io-block.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/outer-product.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/struct-varying.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/switch-nested.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk create mode 100644 third_party/spirv-cross/reference/shaders/tesc/basic.tesc create mode 100644 third_party/spirv-cross/reference/shaders/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/reference/shaders/tese/ccw.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/cw.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/equal.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/fractional_even.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/fractional_odd.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/input-array.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/line.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/load-array-of-array.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/patch-input-array.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/triangle.tese create mode 100644 third_party/spirv-cross/reference/shaders/tese/water_tess.tese create mode 100644 third_party/spirv-cross/reference/shaders/vert/basic.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/ground.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/invariant.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/ocean.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/return-array.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/row-major-workaround.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/transform-feedback-decorations.vert create mode 100644 third_party/spirv-cross/reference/shaders/vert/ubo.vert create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert.vk create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk create mode 100644 third_party/spirv-cross/samples/cpp/Makefile create mode 100644 third_party/spirv-cross/samples/cpp/atomics.comp create mode 100644 third_party/spirv-cross/samples/cpp/atomics.cpp create mode 100644 third_party/spirv-cross/samples/cpp/multiply.comp create mode 100644 third_party/spirv-cross/samples/cpp/multiply.cpp create mode 100644 third_party/spirv-cross/samples/cpp/shared.comp create mode 100644 third_party/spirv-cross/samples/cpp/shared.cpp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/frag-coord.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/spec-constant.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-instance.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-vertex.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert create mode 100644 third_party/spirv-cross/shaders-hlsl-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/access-chain-load-composite.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/access-chains.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/access-chains.force-uav.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/address-buffers.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/atomic.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/barriers.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/builtins.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/globallycoherent.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/image.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/image.nonwritable-uav-texture.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/inverse.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-alone.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-with-builtins.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/rwbuffer-matrix.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/shared.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm30.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm50.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/basic.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/bit-conversions.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/boolean-mix.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/builtins.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/bvec-operations.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/clip-cull-distance.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-parameter.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-shadow.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/demote-to-helper.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/early-fragment-test.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/hyperbolic.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/image-query-selective.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/image-query.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/io-block.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/matrix-input.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/mod.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/mrt.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/no-return.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/no-return2.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/point-coord-compat.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/resources.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/row-major-layout-in-struct.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sample-cmp-level-zero.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in-and-out.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sample-mask-out.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sampler-array.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/sampler-image-arrays.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/swizzle-scalar.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/tex-sampling-ms.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/tex-sampling.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/unorm-snorm-packing.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/frag/various-glsl-ops.frag create mode 100644 third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/basic.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/clip-cull-distance.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/instancing.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/invariant.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/legacy-int-attribute.sm30.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/locations.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/matrix-attribute.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/matrix-output.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/no-input.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/point-size-compat.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/point-size.sm30.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/qualifiers.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/return-array.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/sampler-buffers.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/struct-composite-decl.vert create mode 100644 third_party/spirv-cross/shaders-hlsl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-gather.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/glsl.std450.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/implicit-integer-promotion.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/int16min-literal.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/int64.invalid.msl22.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/int64min-literal.msl22.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/loop.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/return.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/components/fragment-input-component.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/components/vertex-input-component.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/components/vertex-output-component.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/16bit-constants.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/depth-image-gather.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/image-gather.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/in_block_assign.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec3.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec4.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/isolated-scalar-access.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/load-store-col-rows.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std140.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std430.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/member-padding.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/std140-array-of-vectors.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-alignment.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-recursive.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding.comp create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/tesc/copy-tess-level.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/cull-distance.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/functions_nested.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/layer.msl11.invalid.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/modf-storage-class.capture.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert create mode 100644 third_party/spirv-cross/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/amd/shader_trinary_minmax.msl21.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/buffer-write.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/duplicate-spec-id.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/relaxed-block-layout.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/uint_smulextended.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/min-lod.msl22.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/op-image-sampled-image.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/switch-different-sizes.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/unknown-depth-state.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc create mode 100644 third_party/spirv-cross/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/copy-memory-interface.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/fake-builtin-input.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/invariant.msl21.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/packing-test.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/shaders-msl/comp/access-private-workgroup-in-function.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/array-length.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/array-length.msl2.argument.discrete.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/atomic-float.msl3.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/atomic.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/barriers.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/basic.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.msl11.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/basic.inline-block.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/buffer_device_address.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/builtins.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/complex-composite-constant-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/complex-type-alias.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.force-native-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/culling.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/dowhile.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/force-recompile-hooks.swizzle.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/functions.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/global-invocation-id.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/image-cube-array-load-store.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/image.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/insert.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/inverse.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/local-invocation-id.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/local-invocation-index.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/local-size-duplicate-spec-id.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/mat3-row-maj-read-write-const.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/mat3.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/mod.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/modf.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/outer-product.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/packing-test-1.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/packing-test-2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-array-of-arrays.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-matrix-array-of-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-matrix-cast.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared-struct-bool-cast.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/shared.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/spec-constant-op-member-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/spec-constant-work-group-size.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/storage-buffer-std140-vector-array.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/struct-nested.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/threadgroup-boolean-workaround.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/type-alias.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/type_casting_i64.msl22.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/udiv.comp create mode 100644 third_party/spirv-cross/shaders-msl/comp/writable-ssbo.comp create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/argument-buffers.msl2.argument.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-component-io.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-of-array-lut.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/barycentric-nv.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/basic.force-sample.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/basic.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/binary-func-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/binary-unpack-pack-arguments.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/bitcasting.1d-as-2d.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/bitcasting.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/buffer-read-write.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/builtins.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/clip-distance-varying.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/constant-array.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/cull-distance-varying.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/depth-greater-than.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/depth-less-than.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/depth-out-early-frag-tests.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/depth-out-no-early-frag-tests.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/disable-frag-output.frag-output.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/dual-source-blending.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/early-fragment-tests.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/flush_params.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/fp16-packing.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/fragment-component-padding.pad-fragment.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/front-facing.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/gather-dref.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/gather-offset.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/helper-invocation.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/illegal-name-test-0.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/image-query-lod.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/in_block.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/in_mat.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment.arrayed-subpass.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/input-attachment.multiview.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers-block.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/mix.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/modf-access-tracking-function.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/mrt-array.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/nonuniform-qualifier.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/packed-expression-vector-shuffle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/packing-test-3.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/pls.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.ios.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/private-variable-prototype-declaration.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/read-cull-clip-distance-in-function.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/readonly-ssbo.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/return-value-after-discard-terminator.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-depth-separate-image-sampler.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-mask.fixed-sample-mask.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-mask.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-position-func.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-position.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-image-arrays.msl2.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/sampler.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/separate-image-sampler-argument.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/shader-arithmetic-8bit.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/spec-constant-block-size.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/spec-constant-ternary.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/stencil-export.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/subgroup-builtins.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/subgroup-globals-extract.msl22.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/swizzle.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texture-cube-array.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texture-multisample-array.msl21.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/texture-proj-shadow.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag create mode 100644 third_party/spirv-cross/shaders-msl/frag/write-depth-in-function.frag create mode 100644 third_party/spirv-cross/shaders-msl/intel/shader-integer-functions2.asm.comp create mode 100644 third_party/spirv-cross/shaders-msl/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-clip-distance.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.vert create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/basic.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/basic.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/complex-patch-out-types.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/matrix-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/struct-output.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/water_tess.multi-patch.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/input-array.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/input-types.raw-tess-in.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/input-types.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/load-control-point-array-of-matrix.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/load-control-point-array.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/quad.domain.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/quad.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/set-from-function.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/triangle-tess-level.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/triangle.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/water_tess.raw-tess-in.tese create mode 100644 third_party/spirv-cross/shaders-msl/tese/water_tess.tese create mode 100644 third_party/spirv-cross/shaders-msl/vert/array-component-io.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/array-component-io.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/basic.capture.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/basic.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/basic.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/buffer_device_address.msl2.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/clip-distance-block.no-user-varying.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/clip-distance-block.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/copy.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/float-math.invariant-float-math.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/float-math.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/functions.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/implicit-position-1.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/implicit-position-2.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/in_out_array_mat.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.frag create mode 100644 third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/interface-block-single-element-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers-block.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/invariant.msl21.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/leaf-function.capture.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/leaf-function.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no-disable-vertex-out.frag-output.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.for-tess.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/out-block-with-nested-struct-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/out-block-with-struct-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/out_block.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/packed-bool-to-uint.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/packed-bool2-to-packed_uint2.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/packed_matrix.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/pointsize.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/resource-arrays-leaf.ios.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/resource-arrays.ios.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/return-array.force-native-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/return-array.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/set_builtin_in_func.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/sign-int-types.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/signedness-mismatch.shader-inputs.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/ubo.alignment.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/ubo.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/uniform-struct-out-of-order-offests.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/uniform-struct-packing-nested.vert create mode 100644 third_party/spirv-cross/shaders-msl/vert/unused-position.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-load-store.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/basic.spv16.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/bitscan.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/temporary.zero-initialize.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/asm/vert/semantic-decoration.asm.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/bitfield.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/glsl.std450.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/illegal-struct-name.asm.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/image-load-formatted.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/inout-struct.invalid.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/int16min-literal.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/int64min-literal.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/intmin-literal.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/loop.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/return.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/specialization-constant-evaluation.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/trivial-select-cast-vector.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/comp/trivial-select-matrix.spv14.comp create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/16bit-constants.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/fp16.invalid.desktop.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/frag-fully-covered.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/fs.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/image-gather.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/modf-non-function-purity-analysis.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/texture-gather-offsets.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/texture-gather-uint-component.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.es.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.legacy.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/frag/variables.zero-initialize.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task create mode 100644 third_party/spirv-cross/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task create mode 100644 third_party/spirv-cross/shaders-no-opt/vert/io-blocks.force-flattened-io.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/vert/pass-array-by-value.vert create mode 100644 third_party/spirv-cross/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/vulkan/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag create mode 100644 third_party/spirv-cross/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert create mode 100644 third_party/spirv-cross/shaders-other/README.md create mode 100644 third_party/spirv-cross/shaders-other/aliased-entry-point-names.asm create mode 100644 third_party/spirv-cross/shaders-reflection/asm/aliased-entry-point-names.asm.multi create mode 100644 third_party/spirv-cross/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-1.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-2.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/array-of-physical-pointer.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/function-pointer.invalid.asm.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/out-of-order-block-offsets.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/physical-pointer.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/shaders-reflection/comp/workgroup-size-spec-constant.comp create mode 100644 third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/image-load-store-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/input-attachment-ms.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/input-attachment.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/separate-sampler-texture-array.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/frag/spec-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders-reflection/rgen/acceleration_structure.vk.rgen create mode 100644 third_party/spirv-cross/shaders-reflection/vert/array-size-reflection.vert create mode 100644 third_party/spirv-cross/shaders-reflection/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/shaders-reflection/vert/stride-reflection.vert create mode 100644 third_party/spirv-cross/shaders-reflection/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag create mode 100644 third_party/spirv-cross/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese create mode 100644 third_party/spirv-cross/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/depth-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/global-constant-arrays.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese create mode 100644 third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese create mode 100644 third_party/spirv-cross/shaders-ue4/asm/vert/array-missing-copies.asm.vert create mode 100644 third_party/spirv-cross/shaders-ue4/asm/vert/texture-buffer.asm.vert create mode 100644 third_party/spirv-cross/shaders/amd/gcn_shader.comp create mode 100644 third_party/spirv-cross/shaders/amd/shader_ballot.comp create mode 100644 third_party/spirv-cross/shaders/amd/shader_group_vote.comp create mode 100644 third_party/spirv-cross/shaders/amd/shader_trinary_minmax.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/atomic-decrement.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/atomic-increment.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_iadd.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_icmp.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_iequal.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_sar.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_sdiv.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/bitcast_slr.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/block-name-alias-global.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/builtin-compute-bitcast.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/control-flow-hints.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/decoration-group.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/global-parameter-name-alias.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/logical.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/multiple-entry.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/op-phi-swap.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/quantize.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/recompile-block-naming.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/specialization-constant-workgroup.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/switch-break-ladder.asm.invalid.comp create mode 100644 third_party/spirv-cross/shaders/asm/comp/undefined-constant-composite.asm.comp create mode 100644 third_party/spirv-cross/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/complex-name-workarounds.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/default-member-names.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/do-while-statement-fallback.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/empty-struct.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/frem.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/function-overload-alias.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/image-extract-reuse.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.vk.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/implicit-read-dep-phi.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/inf-nan-constant-double.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/inf-nan-constant.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/invalidation.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/line-directive.line.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/locations-components.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/loop-header-to-continue.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/lut-promotion-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/multi-for-loop-init.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/op-constant-null.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/op-phi-swap-continue-block.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/pack-and-unpack-uint2.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/phi-loop-variable.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/sample-and-compare.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/single-function-private-lut.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/srem.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/storage-class-output-initializer.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/switch-label-shared-block.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/switch-preserve-sign-extension.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/temporary-name-alias.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/temporary-phi-hoisting.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/texel-fetch-no-lod.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/undef-variable-store.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/unknown-depth-state.asm.vk.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/unreachable.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/frag/vector-shuffle-oom.asm.frag create mode 100644 third_party/spirv-cross/shaders/asm/geom/block-name-namespace.asm.geom create mode 100644 third_party/spirv-cross/shaders/asm/geom/inout-split-access-chain-handle.asm.geom create mode 100644 third_party/spirv-cross/shaders/asm/geom/split-access-chain-input.asm.geom create mode 100644 third_party/spirv-cross/shaders/asm/geom/unroll-glposition-load.asm.geom create mode 100644 third_party/spirv-cross/shaders/asm/tese/unroll-input-array-load.asm.tese create mode 100644 third_party/spirv-cross/shaders/asm/vert/empty-io.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/global-builtin.sso.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/invariant-block.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/invariant-block.sso.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/invariant.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/invariant.sso.asm.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert create mode 100644 third_party/spirv-cross/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert create mode 100644 third_party/spirv-cross/shaders/comp/atomic.comp create mode 100644 third_party/spirv-cross/shaders/comp/bake_gradient.comp create mode 100644 third_party/spirv-cross/shaders/comp/barriers.comp create mode 100644 third_party/spirv-cross/shaders/comp/basic.comp create mode 100644 third_party/spirv-cross/shaders/comp/casts.comp create mode 100644 third_party/spirv-cross/shaders/comp/cfg-preserve-parameter.comp create mode 100644 third_party/spirv-cross/shaders/comp/cfg.comp create mode 100644 third_party/spirv-cross/shaders/comp/coherent-block.comp create mode 100644 third_party/spirv-cross/shaders/comp/coherent-image.comp create mode 100644 third_party/spirv-cross/shaders/comp/composite-array-initialization.comp create mode 100644 third_party/spirv-cross/shaders/comp/composite-construct.comp create mode 100644 third_party/spirv-cross/shaders/comp/culling.comp create mode 100644 third_party/spirv-cross/shaders/comp/defer-parens.comp create mode 100644 third_party/spirv-cross/shaders/comp/dowhile.comp create mode 100644 third_party/spirv-cross/shaders/comp/generate_height.comp create mode 100644 third_party/spirv-cross/shaders/comp/image.comp create mode 100644 third_party/spirv-cross/shaders/comp/insert.comp create mode 100644 third_party/spirv-cross/shaders/comp/mat3.comp create mode 100644 third_party/spirv-cross/shaders/comp/mod.comp create mode 100644 third_party/spirv-cross/shaders/comp/modf.comp create mode 100644 third_party/spirv-cross/shaders/comp/outer-product.comp create mode 100644 third_party/spirv-cross/shaders/comp/read-write-only.comp create mode 100644 third_party/spirv-cross/shaders/comp/rmw-matrix.comp create mode 100644 third_party/spirv-cross/shaders/comp/rmw-opt.comp create mode 100644 third_party/spirv-cross/shaders/comp/scalar-std450-distance-length-normalize.comp create mode 100644 third_party/spirv-cross/shaders/comp/shared.comp create mode 100644 third_party/spirv-cross/shaders/comp/ssbo-array-length.comp create mode 100644 third_party/spirv-cross/shaders/comp/ssbo-array.comp create mode 100644 third_party/spirv-cross/shaders/comp/struct-layout.comp create mode 100644 third_party/spirv-cross/shaders/comp/struct-packing.comp create mode 100644 third_party/spirv-cross/shaders/comp/torture-loop.comp create mode 100644 third_party/spirv-cross/shaders/comp/type-alias.comp create mode 100644 third_party/spirv-cross/shaders/comp/udiv.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/comp/enhanced-layouts.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/comp/extended-arithmetic.desktop.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/comp/fp64.desktop.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/comp/int64.desktop.comp create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/clip-cull-distance.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/depth-greater-than.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/depth-less-than.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/dual-source-blending.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/image-ms.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/image-query.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/image-size.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/in-block-qualifiers.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/layout-component.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/query-levels.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/query-lod.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/sampler-ms-query.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/stencil-export.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag create mode 100644 third_party/spirv-cross/shaders/desktop-only/geom/basic.desktop.sso.geom create mode 100644 third_party/spirv-cross/shaders/desktop-only/geom/viewport-index.desktop.geom create mode 100644 third_party/spirv-cross/shaders/desktop-only/tesc/basic.desktop.sso.tesc create mode 100644 third_party/spirv-cross/shaders/desktop-only/tese/triangle.desktop.sso.tese create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/basic.desktop.sso.vert create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.vert create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/out-block-qualifiers.vert create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert create mode 100644 third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert create mode 100644 third_party/spirv-cross/shaders/flatten/array.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/basic.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/copy.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/dynamic.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/matrix-conversion.flatten.frag create mode 100644 third_party/spirv-cross/shaders/flatten/matrixindex.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/multiindex.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/push-constant.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/struct.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/struct.rowmajor.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/swizzle.flatten.vert create mode 100644 third_party/spirv-cross/shaders/flatten/types.flatten.frag create mode 100644 third_party/spirv-cross/shaders/frag/array-lut-no-loop-variable.frag create mode 100644 third_party/spirv-cross/shaders/frag/avoid-expression-lowering-to-loop.frag create mode 100644 third_party/spirv-cross/shaders/frag/barycentric-khr.frag create mode 100644 third_party/spirv-cross/shaders/frag/barycentric-nv.frag create mode 100644 third_party/spirv-cross/shaders/frag/basic.frag create mode 100644 third_party/spirv-cross/shaders/frag/complex-expression-in-access-chain.frag create mode 100644 third_party/spirv-cross/shaders/frag/composite-extract-forced-temporary.frag create mode 100644 third_party/spirv-cross/shaders/frag/constant-array.frag create mode 100644 third_party/spirv-cross/shaders/frag/constant-composites.frag create mode 100644 third_party/spirv-cross/shaders/frag/false-loop-init.frag create mode 100644 third_party/spirv-cross/shaders/frag/flush_params.frag create mode 100644 third_party/spirv-cross/shaders/frag/for-loop-continue-control-flow.frag create mode 100644 third_party/spirv-cross/shaders/frag/for-loop-init.frag create mode 100644 third_party/spirv-cross/shaders/frag/frexp-modf.frag create mode 100644 third_party/spirv-cross/shaders/frag/front-facing.frag create mode 100644 third_party/spirv-cross/shaders/frag/gather-dref.frag create mode 100755 third_party/spirv-cross/shaders/frag/ground.frag create mode 100644 third_party/spirv-cross/shaders/frag/helper-invocation.frag create mode 100644 third_party/spirv-cross/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag create mode 100644 third_party/spirv-cross/shaders/frag/image-load-store-uint-coord.asm.frag create mode 100644 third_party/spirv-cross/shaders/frag/inside-loop-dominated-variable-preservation.frag create mode 100644 third_party/spirv-cross/shaders/frag/loop-dominator-and-switch-default.frag create mode 100644 third_party/spirv-cross/shaders/frag/lut-promotion.frag create mode 100644 third_party/spirv-cross/shaders/frag/mix.frag create mode 100644 third_party/spirv-cross/shaders/frag/modf-pointer-function-analysis.frag create mode 100644 third_party/spirv-cross/shaders/frag/partial-write-preserve.frag create mode 100644 third_party/spirv-cross/shaders/frag/pixel-interlock-ordered.frag create mode 100644 third_party/spirv-cross/shaders/frag/pixel-interlock-unordered.frag create mode 100644 third_party/spirv-cross/shaders/frag/pls.frag create mode 100644 third_party/spirv-cross/shaders/frag/post-depth-coverage-es.frag create mode 100644 third_party/spirv-cross/shaders/frag/post-depth-coverage.frag create mode 100644 third_party/spirv-cross/shaders/frag/round-even.frag create mode 100644 third_party/spirv-cross/shaders/frag/round.frag create mode 100644 third_party/spirv-cross/shaders/frag/sample-interlock-ordered.frag create mode 100644 third_party/spirv-cross/shaders/frag/sample-interlock-unordered.frag create mode 100644 third_party/spirv-cross/shaders/frag/sample-parameter.frag create mode 100644 third_party/spirv-cross/shaders/frag/sampler-ms.frag create mode 100644 third_party/spirv-cross/shaders/frag/sampler-proj.frag create mode 100644 third_party/spirv-cross/shaders/frag/sampler.frag create mode 100644 third_party/spirv-cross/shaders/frag/scalar-refract-reflect.frag create mode 100644 third_party/spirv-cross/shaders/frag/selection-block-dominator.frag create mode 100644 third_party/spirv-cross/shaders/frag/shader-clock.frag create mode 100644 third_party/spirv-cross/shaders/frag/struct-type-unrelated-alias.frag create mode 100644 third_party/spirv-cross/shaders/frag/switch-unreachable-break.frag create mode 100644 third_party/spirv-cross/shaders/frag/switch-unsigned-case.frag create mode 100644 third_party/spirv-cross/shaders/frag/swizzle.frag create mode 100644 third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag create mode 100644 third_party/spirv-cross/shaders/frag/ubo-load-row-major-workaround.frag create mode 100644 third_party/spirv-cross/shaders/frag/ubo_layout.frag create mode 100644 third_party/spirv-cross/shaders/frag/unary-enclose.frag create mode 100644 third_party/spirv-cross/shaders/geom/basic.geom create mode 100644 third_party/spirv-cross/shaders/geom/geometry-passthrough.geom create mode 100644 third_party/spirv-cross/shaders/geom/lines-adjacency.geom create mode 100644 third_party/spirv-cross/shaders/geom/lines.geom create mode 100644 third_party/spirv-cross/shaders/geom/multi-stream.geom create mode 100644 third_party/spirv-cross/shaders/geom/points.geom create mode 100644 third_party/spirv-cross/shaders/geom/single-invocation.geom create mode 100644 third_party/spirv-cross/shaders/geom/transform-feedback-streams.geom create mode 100644 third_party/spirv-cross/shaders/geom/triangles-adjacency.geom create mode 100644 third_party/spirv-cross/shaders/geom/triangles.geom create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/fma.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/hyperbolic.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/io-blocks.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/isnan-isinf.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/modf.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/round.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/struct-varying.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/fragment/switch.legacy.frag create mode 100644 third_party/spirv-cross/shaders/legacy/vert/implicit-lod.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/int-attribute.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/inverse.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/io-block.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/outer-product.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/struct-varying.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/switch-nested.legacy.vert create mode 100644 third_party/spirv-cross/shaders/legacy/vert/transpose.legacy.vert create mode 100644 third_party/spirv-cross/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh create mode 100644 third_party/spirv-cross/shaders/tesc/basic.tesc create mode 100644 third_party/spirv-cross/shaders/tesc/water_tess.tesc create mode 100644 third_party/spirv-cross/shaders/tese/ccw.tese create mode 100644 third_party/spirv-cross/shaders/tese/cw.tese create mode 100644 third_party/spirv-cross/shaders/tese/equal.tese create mode 100644 third_party/spirv-cross/shaders/tese/fractional_even.tese create mode 100644 third_party/spirv-cross/shaders/tese/fractional_odd.tese create mode 100644 third_party/spirv-cross/shaders/tese/input-array.tese create mode 100644 third_party/spirv-cross/shaders/tese/line.tese create mode 100644 third_party/spirv-cross/shaders/tese/load-array-of-array.tese create mode 100644 third_party/spirv-cross/shaders/tese/patch-input-array.tese create mode 100644 third_party/spirv-cross/shaders/tese/triangle.tese create mode 100644 third_party/spirv-cross/shaders/tese/water_tess.tese create mode 100644 third_party/spirv-cross/shaders/vert/basic.vert create mode 100755 third_party/spirv-cross/shaders/vert/ground.vert create mode 100644 third_party/spirv-cross/shaders/vert/invariant.vert create mode 100644 third_party/spirv-cross/shaders/vert/no-contraction.vert create mode 100644 third_party/spirv-cross/shaders/vert/ocean.vert create mode 100644 third_party/spirv-cross/shaders/vert/read-from-row-major-array.vert create mode 100644 third_party/spirv-cross/shaders/vert/return-array.vert create mode 100644 third_party/spirv-cross/shaders/vert/row-major-workaround.vert create mode 100644 third_party/spirv-cross/shaders/vert/texture_buffer.vert create mode 100644 third_party/spirv-cross/shaders/vert/transform-feedback-decorations.vert create mode 100644 third_party/spirv-cross/shaders/vert/ubo.vert create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/desktop-mediump.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/input-attachment-ms.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/input-attachment.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/push-constant.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/spec-constant-block-size.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/frag/spec-constant-ternary.vk.frag create mode 100644 third_party/spirv-cross/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit create mode 100644 third_party/spirv-cross/shaders/vulkan/rahit/terminators.nocompat.vk.rahit create mode 100644 third_party/spirv-cross/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/payloads.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/payloads.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen create mode 100644 third_party/spirv-cross/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint create mode 100644 third_party/spirv-cross/shaders/vulkan/rint/report-intersection.nocompat.vk.rint create mode 100644 third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss create mode 100644 third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss create mode 100644 third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss create mode 100644 third_party/spirv-cross/shaders/vulkan/vert/device-group.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders/vulkan/vert/multiview.nocompat.vk.vert create mode 100644 third_party/spirv-cross/shaders/vulkan/vert/small-storage.vk.vert create mode 100644 third_party/spirv-cross/shaders/vulkan/vert/vulkan-vertex.vk.vert create mode 100644 third_party/spirv-cross/spirv_glsl.cpp.orig create mode 100644 third_party/spirv-cross/tests-other/c_api_test.c create mode 100644 third_party/spirv-cross/tests-other/c_api_test.spv create mode 100644 third_party/spirv-cross/tests-other/hlsl_resource_binding.spv create mode 100644 third_party/spirv-cross/tests-other/hlsl_resource_bindings.cpp create mode 100644 third_party/spirv-cross/tests-other/hlsl_wave_mask.cpp create mode 100644 third_party/spirv-cross/tests-other/msl_constexpr_test.cpp create mode 100644 third_party/spirv-cross/tests-other/msl_constexpr_test.spv create mode 100644 third_party/spirv-cross/tests-other/msl_resource_binding.spv create mode 100644 third_party/spirv-cross/tests-other/msl_resource_bindings.cpp create mode 100644 third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.cpp create mode 100644 third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.spv create mode 100644 third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test_2.spv create mode 100644 third_party/spirv-cross/tests-other/small_vector.cpp create mode 100644 third_party/spirv-cross/tests-other/typed_id_test.cpp diff --git a/third_party/spirv-cross/.github/workflows/main.yml b/third_party/spirv-cross/.github/workflows/main.yml index 31fd114934..d7efc683ff 100644 --- a/third_party/spirv-cross/.github/workflows/main.yml +++ b/third_party/spirv-cross/.github/workflows/main.yml @@ -14,15 +14,15 @@ jobs: name: "Build ${{ matrix.platform }}" strategy: matrix: - platform: [windows-latest, ubuntu-18.04, ubuntu-20.04, macos-latest] + platform: [windows-latest, ubuntu-20.04, ubuntu-22.04, macos-latest] env: PARALLEL: -j 2 runs-on: "${{ matrix.platform }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: '3.x' @@ -50,6 +50,10 @@ jobs: cmake --build . --config Release cmake --build . --config Release --target install + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.platform }}-binaries + path: build/output - name: Test SPIRV-Cross shell: bash working-directory: ${{github.workspace}}/build @@ -60,7 +64,7 @@ jobs: container: khronosgroup/docker-images:asciidoctor-spec steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # REUSE license checker - name: license-check diff --git a/third_party/spirv-cross/CMakeLists.txt b/third_party/spirv-cross/CMakeLists.txt index 974c190287..dbf85d5d9f 100644 --- a/third_party/spirv-cross/CMakeLists.txt +++ b/third_party/spirv-cross/CMakeLists.txt @@ -242,7 +242,19 @@ set(spirv-cross-util-sources ${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_util.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spirv_cross_util.hpp) +set(spirv-cross-abi-major 0) +set(spirv-cross-abi-minor 57) +set(spirv-cross-abi-patch 0) +set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch}) + if (SPIRV_CROSS_STATIC) + if (NOT SPIRV_CROSS_SKIP_INSTALL) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/pkg-config/spirv-cross-c.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spirv-cross-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + endif() + spirv_cross_add_library(spirv-cross-core spirv_cross_core STATIC ${spirv-cross-core-sources}) @@ -331,13 +343,7 @@ if (SPIRV_CROSS_STATIC) endif() endif() -set(spirv-cross-abi-major 0) -set(spirv-cross-abi-minor 56) -set(spirv-cross-abi-patch 0) - if (SPIRV_CROSS_SHARED) - set(SPIRV_CROSS_VERSION ${spirv-cross-abi-major}.${spirv-cross-abi-minor}.${spirv-cross-abi-patch}) - if (NOT SPIRV_CROSS_SKIP_INSTALL) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/pkg-config/spirv-cross-c-shared.pc.in diff --git a/third_party/spirv-cross/main.cpp b/third_party/spirv-cross/main.cpp index 1f21c4c08d..5e9b0168c9 100644 --- a/third_party/spirv-cross/main.cpp +++ b/third_party/spirv-cross/main.cpp @@ -732,6 +732,7 @@ struct CLIArguments bool hlsl_nonwritable_uav_texture_as_srv = false; bool hlsl_enable_16bit_types = false; bool hlsl_flatten_matrix_vertex_input_semantics = false; + bool hlsl_preserve_structured_buffers = false; HLSLBindingFlags hlsl_binding_flags = 0; bool vulkan_semantics = false; bool flatten_multidimensional_arrays = false; @@ -839,6 +840,7 @@ static void print_help_hlsl() "\t\tOpName reflection information must be intact.\n" "\t[--hlsl-enable-16bit-types]:\n\t\tEnables native use of half/int16_t/uint16_t and ByteAddressBuffer interaction with these types. Requires SM 6.2.\n" "\t[--hlsl-flatten-matrix-vertex-input-semantics]:\n\t\tEmits matrix vertex inputs with input semantics as if they were independent vectors, e.g. TEXCOORD{2,3,4} rather than matrix form TEXCOORD2_{0,1,2}.\n" + "\t[--hlsl-preserve-structured-buffers]:\n\t\tEmit SturucturedBuffer rather than ByteAddressBuffer. Requires UserTypeGOOGLE to be emitted. Intended for DXC roundtrips.\n" ); // clang-format on } @@ -1421,6 +1423,7 @@ static string compile_iteration(const CLIArguments &args, std::vector hlsl_opts.nonwritable_uav_texture_as_srv = args.hlsl_nonwritable_uav_texture_as_srv; hlsl_opts.enable_16bit_types = args.hlsl_enable_16bit_types; hlsl_opts.flatten_matrix_vertex_input_semantics = args.hlsl_flatten_matrix_vertex_input_semantics; + hlsl_opts.preserve_structured_buffers = args.hlsl_preserve_structured_buffers; hlsl->set_hlsl_options(hlsl_opts); hlsl->set_resource_binding_flags(args.hlsl_binding_flags); if (args.hlsl_base_vertex_index_explicit_binding) @@ -1622,6 +1625,7 @@ static int main_inner(int argc, char *argv[]) cbs.add("--hlsl-enable-16bit-types", [&args](CLIParser &) { args.hlsl_enable_16bit_types = true; }); cbs.add("--hlsl-flatten-matrix-vertex-input-semantics", [&args](CLIParser &) { args.hlsl_flatten_matrix_vertex_input_semantics = true; }); + cbs.add("--hlsl-preserve-structured-buffers", [&args](CLIParser &) { args.hlsl_preserve_structured_buffers = true; }); cbs.add("--vulkan-semantics", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("-V", [&args](CLIParser &) { args.vulkan_semantics = true; }); cbs.add("--flatten-multidimensional-arrays", [&args](CLIParser &) { args.flatten_multidimensional_arrays = true; }); diff --git a/third_party/spirv-cross/pkg-config/spirv-cross-c-shared.pc.in b/third_party/spirv-cross/pkg-config/spirv-cross-c-shared.pc.in index 4fb8a0aee9..94e63eaeb4 100644 --- a/third_party/spirv-cross/pkg-config/spirv-cross-c-shared.pc.in +++ b/third_party/spirv-cross/pkg-config/spirv-cross-c-shared.pc.in @@ -8,7 +8,7 @@ sharedlibdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/spirv_cross Name: spirv-cross-c-shared -Description: C API for SPIRV-Cross +Description: C API for SPIRV-Cross (shared) Version: @SPIRV_CROSS_VERSION@ Requires: diff --git a/third_party/spirv-cross/pkg-config/spirv-cross-c.pc.in b/third_party/spirv-cross/pkg-config/spirv-cross-c.pc.in new file mode 100644 index 0000000000..2b586b6ffa --- /dev/null +++ b/third_party/spirv-cross/pkg-config/spirv-cross-c.pc.in @@ -0,0 +1,15 @@ +# Copyright 2020-2021 Hans-Kristian Arntzen +# SPDX-License-Identifier: Apache-2.0 + +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/spirv_cross + +Name: spirv-cross-c +Description: C API for SPIRV-Cross (static) +Version: @SPIRV_CROSS_VERSION@ + +Requires: +Libs: -L${libdir} -lspirv-cross-c +Cflags: -I${includedir} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp new file mode 100644 index 0000000000..b8265fc99e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp @@ -0,0 +1,19 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + uint _21 = _4.Load(_4.Load(0) * 4 + 4); + for (uint _23 = 0u; _23 < 64u; ) + { + _4.Store(_23 * 4 + 4, 0u); + _23++; + continue; + } + _4.Store(_4.Load(0) * 4 + 4, _21); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..c534ceaba1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,22 @@ +RWByteAddressBuffer u0_counter : register(u1); +RWBuffer u0 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _29; + u0_counter.InterlockedAdd(0, -1, _29); + u0[asint(asfloat(_29))] = uint(int(gl_GlobalInvocationID.x)).x; +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..5e7d282d6e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,22 @@ +RWByteAddressBuffer u0_counter : register(u1); +RWBuffer u0 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _29; + u0_counter.InterlockedAdd(0, 1, _29); + u0[asint(asfloat(_29))] = uint(int(gl_GlobalInvocationID.x)).x; +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..da499c3b6d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,20 @@ +RWByteAddressBuffer _5 : register(u0); +RWByteAddressBuffer _6 : register(u1); + +void comp_main() +{ + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) < int4(_5.Load4(0)).x, int(_5.Load4(16).y) < int4(_5.Load4(0)).y, int(_5.Load4(16).z) < int4(_5.Load4(0)).z, int(_5.Load4(16).w) < int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) <= int4(_5.Load4(0)).x, int(_5.Load4(16).y) <= int4(_5.Load4(0)).y, int(_5.Load4(16).z) <= int4(_5.Load4(0)).z, int(_5.Load4(16).w) <= int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x < uint(int4(_5.Load4(0)).x), _5.Load4(16).y < uint(int4(_5.Load4(0)).y), _5.Load4(16).z < uint(int4(_5.Load4(0)).z), _5.Load4(16).w < uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x <= uint(int4(_5.Load4(0)).x), _5.Load4(16).y <= uint(int4(_5.Load4(0)).y), _5.Load4(16).z <= uint(int4(_5.Load4(0)).z), _5.Load4(16).w <= uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) > int4(_5.Load4(0)).x, int(_5.Load4(16).y) > int4(_5.Load4(0)).y, int(_5.Load4(16).z) > int4(_5.Load4(0)).z, int(_5.Load4(16).w) > int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) >= int4(_5.Load4(0)).x, int(_5.Load4(16).y) >= int4(_5.Load4(0)).y, int(_5.Load4(16).z) >= int4(_5.Load4(0)).z, int(_5.Load4(16).w) >= int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x > uint(int4(_5.Load4(0)).x), _5.Load4(16).y > uint(int4(_5.Load4(0)).y), _5.Load4(16).z > uint(int4(_5.Load4(0)).z), _5.Load4(16).w > uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x >= uint(int4(_5.Load4(0)).x), _5.Load4(16).y >= uint(int4(_5.Load4(0)).y), _5.Load4(16).z >= uint(int4(_5.Load4(0)).z), _5.Load4(16).w >= uint(int4(_5.Load4(0)).w)))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..e184e03c5c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,39 @@ +struct A +{ + int a; + int b; +}; + +RWByteAddressBuffer C1 : register(u1); +cbuffer C2 : register(b2) +{ + A C2_1_Data[1024] : packoffset(c0); +}; + +RWByteAddressBuffer C3 : register(u0); +cbuffer B : register(b3) +{ + A C4_Data[1024] : packoffset(c0); +}; + + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + C1.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C2_1_Data[gl_GlobalInvocationID.x].a)); + C1.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C2_1_Data[gl_GlobalInvocationID.x].b)); + C3.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C4_Data[gl_GlobalInvocationID.x].a)); + C3.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C4_Data[gl_GlobalInvocationID.x].b)); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..70df6baf0e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,41 @@ +RWByteAddressBuffer bar : register(u0); +RWByteAddressBuffer foo : register(u1); + +void comp_main() +{ + bar.Store4(0, asuint(asfloat(foo.Load4(0)))); + bar.Store4(16, asuint(asfloat(foo.Load4(16)))); + bar.Store4(32, asuint(asfloat(foo.Load4(32)))); + bar.Store4(48, asuint(asfloat(foo.Load4(48)))); + bar.Store4(64, asuint(asfloat(foo.Load4(64)))); + bar.Store4(80, asuint(asfloat(foo.Load4(80)))); + bar.Store4(96, asuint(asfloat(foo.Load4(96)))); + bar.Store4(112, asuint(asfloat(foo.Load4(112)))); + bar.Store4(128, asuint(asfloat(foo.Load4(128)))); + bar.Store4(144, asuint(asfloat(foo.Load4(144)))); + bar.Store4(160, asuint(asfloat(foo.Load4(160)))); + bar.Store4(176, asuint(asfloat(foo.Load4(176)))); + bar.Store4(192, asuint(asfloat(foo.Load4(192)))); + bar.Store4(208, asuint(asfloat(foo.Load4(208)))); + bar.Store4(224, asuint(asfloat(foo.Load4(224)))); + bar.Store4(240, asuint(asfloat(foo.Load4(240)))); + [loop] + for (int _137 = 0; _137 < 16; ) + { + bar.Store4((15 - _137) * 16 + 0, asuint(asfloat(foo.Load4(_137 * 16 + 0)))); + _137++; + continue; + } + [branch] + if (asfloat(bar.Load(160)) > 10.0f) + { + foo.Store4(320, asuint(5.0f.xxxx)); + } + foo.Store4(320, asuint(20.0f.xxxx)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..d8bce8d54b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,9 @@ +void comp_main() +{ +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..7acd67d0b7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,87 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : min(asfloat(_4.Load(48)), asfloat(_4.Load(96)))))); + bool2 _146 = isnan(asfloat(_4.Load2(56))); + bool2 _147 = isnan(asfloat(_4.Load2(104))); + float2 _148 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _149 = float2(_146.x ? asfloat(_4.Load2(104)).x : _148.x, _146.y ? asfloat(_4.Load2(104)).y : _148.y); + _4.Store2(8, asuint(float2(_147.x ? asfloat(_4.Load2(56)).x : _149.x, _147.y ? asfloat(_4.Load2(56)).y : _149.y))); + bool3 _151 = isnan(asfloat(_4.Load3(64))); + bool3 _152 = isnan(asfloat(_4.Load3(112))); + float3 _153 = min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))); + float3 _154 = float3(_151.x ? asfloat(_4.Load3(112)).x : _153.x, _151.y ? asfloat(_4.Load3(112)).y : _153.y, _151.z ? asfloat(_4.Load3(112)).z : _153.z); + _4.Store3(16, asuint(float3(_152.x ? asfloat(_4.Load3(64)).x : _154.x, _152.y ? asfloat(_4.Load3(64)).y : _154.y, _152.z ? asfloat(_4.Load3(64)).z : _154.z))); + bool4 _156 = isnan(asfloat(_4.Load4(80))); + bool4 _157 = isnan(asfloat(_4.Load4(128))); + float4 _158 = min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))); + float4 _159 = float4(_156.x ? asfloat(_4.Load4(128)).x : _158.x, _156.y ? asfloat(_4.Load4(128)).y : _158.y, _156.z ? asfloat(_4.Load4(128)).z : _158.z, _156.w ? asfloat(_4.Load4(128)).w : _158.w); + _4.Store4(32, asuint(float4(_157.x ? asfloat(_4.Load4(80)).x : _159.x, _157.y ? asfloat(_4.Load4(80)).y : _159.y, _157.z ? asfloat(_4.Load4(80)).z : _159.z, _157.w ? asfloat(_4.Load4(80)).w : _159.w))); + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : max(asfloat(_4.Load(48)), asfloat(_4.Load(96)))))); + bool2 _166 = isnan(asfloat(_4.Load2(56))); + bool2 _167 = isnan(asfloat(_4.Load2(104))); + float2 _168 = max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _169 = float2(_166.x ? asfloat(_4.Load2(104)).x : _168.x, _166.y ? asfloat(_4.Load2(104)).y : _168.y); + _4.Store2(8, asuint(float2(_167.x ? asfloat(_4.Load2(56)).x : _169.x, _167.y ? asfloat(_4.Load2(56)).y : _169.y))); + bool3 _171 = isnan(asfloat(_4.Load3(64))); + bool3 _172 = isnan(asfloat(_4.Load3(112))); + float3 _173 = max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))); + float3 _174 = float3(_171.x ? asfloat(_4.Load3(112)).x : _173.x, _171.y ? asfloat(_4.Load3(112)).y : _173.y, _171.z ? asfloat(_4.Load3(112)).z : _173.z); + _4.Store3(16, asuint(float3(_172.x ? asfloat(_4.Load3(64)).x : _174.x, _172.y ? asfloat(_4.Load3(64)).y : _174.y, _172.z ? asfloat(_4.Load3(64)).z : _174.z))); + bool4 _176 = isnan(asfloat(_4.Load4(80))); + bool4 _177 = isnan(asfloat(_4.Load4(128))); + float4 _178 = max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))); + float4 _179 = float4(_176.x ? asfloat(_4.Load4(128)).x : _178.x, _176.y ? asfloat(_4.Load4(128)).y : _178.y, _176.z ? asfloat(_4.Load4(128)).z : _178.z, _176.w ? asfloat(_4.Load4(128)).w : _178.w); + _4.Store4(32, asuint(float4(_177.x ? asfloat(_4.Load4(80)).x : _179.x, _177.y ? asfloat(_4.Load4(80)).y : _179.y, _177.z ? asfloat(_4.Load4(80)).z : _179.z, _177.w ? asfloat(_4.Load4(80)).w : _179.w))); + float _180 = isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(48)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(48)))); + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? _180 : (isnan(_180) ? asfloat(_4.Load(96)) : min(_180, asfloat(_4.Load(96)))))); + bool2 _193 = isnan(asfloat(_4.Load2(8))); + bool2 _194 = isnan(asfloat(_4.Load2(56))); + float2 _195 = max(asfloat(_4.Load2(8)), asfloat(_4.Load2(56))); + float2 _196 = float2(_193.x ? asfloat(_4.Load2(56)).x : _195.x, _193.y ? asfloat(_4.Load2(56)).y : _195.y); + float2 _191 = float2(_194.x ? asfloat(_4.Load2(8)).x : _196.x, _194.y ? asfloat(_4.Load2(8)).y : _196.y); + bool2 _198 = isnan(_191); + bool2 _199 = isnan(asfloat(_4.Load2(104))); + float2 _200 = min(_191, asfloat(_4.Load2(104))); + float2 _201 = float2(_198.x ? asfloat(_4.Load2(104)).x : _200.x, _198.y ? asfloat(_4.Load2(104)).y : _200.y); + _4.Store2(8, asuint(float2(_199.x ? _191.x : _201.x, _199.y ? _191.y : _201.y))); + bool3 _204 = isnan(asfloat(_4.Load3(16))); + bool3 _205 = isnan(asfloat(_4.Load3(64))); + float3 _206 = max(asfloat(_4.Load3(16)), asfloat(_4.Load3(64))); + float3 _207 = float3(_204.x ? asfloat(_4.Load3(64)).x : _206.x, _204.y ? asfloat(_4.Load3(64)).y : _206.y, _204.z ? asfloat(_4.Load3(64)).z : _206.z); + float3 _202 = float3(_205.x ? asfloat(_4.Load3(16)).x : _207.x, _205.y ? asfloat(_4.Load3(16)).y : _207.y, _205.z ? asfloat(_4.Load3(16)).z : _207.z); + bool3 _209 = isnan(_202); + bool3 _210 = isnan(asfloat(_4.Load3(112))); + float3 _211 = min(_202, asfloat(_4.Load3(112))); + float3 _212 = float3(_209.x ? asfloat(_4.Load3(112)).x : _211.x, _209.y ? asfloat(_4.Load3(112)).y : _211.y, _209.z ? asfloat(_4.Load3(112)).z : _211.z); + _4.Store3(16, asuint(float3(_210.x ? _202.x : _212.x, _210.y ? _202.y : _212.y, _210.z ? _202.z : _212.z))); + bool4 _215 = isnan(asfloat(_4.Load4(32))); + bool4 _216 = isnan(asfloat(_4.Load4(80))); + float4 _217 = max(asfloat(_4.Load4(32)), asfloat(_4.Load4(80))); + float4 _218 = float4(_215.x ? asfloat(_4.Load4(80)).x : _217.x, _215.y ? asfloat(_4.Load4(80)).y : _217.y, _215.z ? asfloat(_4.Load4(80)).z : _217.z, _215.w ? asfloat(_4.Load4(80)).w : _217.w); + float4 _213 = float4(_216.x ? asfloat(_4.Load4(32)).x : _218.x, _216.y ? asfloat(_4.Load4(32)).y : _218.y, _216.z ? asfloat(_4.Load4(32)).z : _218.z, _216.w ? asfloat(_4.Load4(32)).w : _218.w); + bool4 _220 = isnan(_213); + bool4 _221 = isnan(asfloat(_4.Load4(128))); + float4 _222 = min(_213, asfloat(_4.Load4(128))); + float4 _223 = float4(_220.x ? asfloat(_4.Load4(128)).x : _222.x, _220.y ? asfloat(_4.Load4(128)).y : _222.y, _220.z ? asfloat(_4.Load4(128)).z : _222.z, _220.w ? asfloat(_4.Load4(128)).w : _222.w); + _4.Store4(32, asuint(float4(_221.x ? _213.x : _223.x, _221.y ? _213.y : _223.y, _221.z ? _213.z : _223.z, _221.w ? _213.w : _223.w))); + for (int _139 = 0; _139 < 2; ) + { + bool2 _225 = isnan(asfloat(_4.Load2(56))); + bool2 _226 = isnan(asfloat(_4.Load2(104))); + float2 _227 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _228 = float2(_225.x ? asfloat(_4.Load2(104)).x : _227.x, _225.y ? asfloat(_4.Load2(104)).y : _227.y); + _4.Store2(8, asuint(float2(_226.x ? asfloat(_4.Load2(56)).x : _228.x, _226.y ? asfloat(_4.Load2(56)).y : _228.y))); + float _229 = isnan(asfloat(_4.Load(56))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(56)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(56)))); + _4.Store(0, asuint(isnan(asfloat(_4.Load(60))) ? _229 : (isnan(_229) ? asfloat(_4.Load(60)) : min(_229, asfloat(_4.Load(60)))))); + _139++; + continue; + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..9f51eff135 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,30 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _4.Store(0, asuint(min(asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + _4.Store(0, asuint(max(asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + _4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(clamp(asfloat(_4.Load2(8)), asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(clamp(asfloat(_4.Load3(16)), asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(clamp(asfloat(_4.Load4(32)), asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + for (int _139 = 0; _139 < 2; ) + { + _4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(56)), asfloat(_4.Load(60))))); + _139++; + continue; + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag new file mode 100644 index 0000000000..77bd3a67b4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors[2] : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[1][3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag new file mode 100644 index 0000000000..b410010d22 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag @@ -0,0 +1,26 @@ +cbuffer _4_5 : register(b0) +{ + column_major float2x4 _5_m0 : packoffset(c0); + float4 _5_m1 : packoffset(c4); +}; + + +static float2 _3; + +struct SPIRV_Cross_Output +{ + float2 _3 : SV_Target0; +}; + +void frag_main() +{ + _3 = mul(_5_m0, _5_m1); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output._3 = _3; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..3951fd511a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t1); +SamplerState uSampler : register(s0); + +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTex.Sample(uSampler, vUV); + FragColor += uTex.Sample(uSampler, vUV, int2(1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..67998c56a7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/frem.asm.frag @@ -0,0 +1,29 @@ +static float4 FragColor; +static float4 vA; +static float4 vB; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = fmod(vA, vB); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..93f8414e93 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,19 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 10.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..2527d10fdc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,31 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static int2 Size; + +struct SPIRV_Cross_Output +{ + int2 Size : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _19_dummy_parameter; + uint _20_dummy_parameter; + Size = int2(spvTextureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(spvTextureSize(uTexture, uint(1), _20_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.Size = Size; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..67f14fccae --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,57 @@ +Texture2D uImage : register(t0); +SamplerState _uImage_sampler : register(s0); + +static float4 v0; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 v0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float phi; + float4 _36; + int _51; + _51 = 0; + phi = 1.0f; + _36 = float4(1.0f, 2.0f, 1.0f, 2.0f); + for (;;) + { + FragColor = _36; + if (_51 < 4) + { + if (v0[_51] > 0.0f) + { + float2 _48 = phi.xx; + _51++; + phi += 2.0f; + _36 = uImage.SampleLevel(_uImage_sampler, _48, 0.0f); + continue; + } + else + { + break; + } + } + else + { + break; + } + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v0 = stage_input.v0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..25dc6939e5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,19 @@ +static float3 FragColor; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float3(asfloat(0x7f800000u /* inf */), asfloat(0xff800000u /* -inf */), asfloat(0x7fc00000u /* nan */)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..4a1cf2ee54 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,91 @@ +static float FragColor; +static float vColor; + +struct SPIRV_Cross_Input +{ + float vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +#line 8 "test.frag" +void frag_main() +{ +#line 8 "test.frag" + FragColor = 1.0f; +#line 9 "test.frag" + FragColor = 2.0f; +#line 10 "test.frag" + if (vColor < 0.0f) + { +#line 12 "test.frag" + FragColor = 3.0f; + } + else + { +#line 16 "test.frag" + FragColor = 4.0f; + } +#line 19 "test.frag" + for (int _127 = 0; float(_127) < (40.0f + vColor); ) + { +#line 21 "test.frag" + FragColor += 0.20000000298023223876953125f; +#line 22 "test.frag" + FragColor += 0.300000011920928955078125f; +#line 19 "test.frag" + _127 += (int(vColor) + 5); + continue; + } +#line 25 "test.frag" + switch (int(vColor)) + { + case 0: + { +#line 28 "test.frag" + FragColor += 0.20000000298023223876953125f; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + FragColor += 0.4000000059604644775390625f; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + FragColor += 0.800000011920928955078125f; +#line 37 "test.frag" + break; + } + } + for (;;) + { +#line 42 "test.frag" + FragColor += (10.0f + vColor); +#line 43 "test.frag" + if (FragColor < 100.0f) + { + } + else + { + break; + } + } +#line 48 "test.frag" +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..5deae3a569 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,57 @@ +static const float _46[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f }; +static const float4 _76[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx }; +static const float4 _90[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx }; + +static float FragColor; +static int index; + +struct SPIRV_Cross_Input +{ + nointerpolation int index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 foobar[4] = _76; + float4 baz[4] = _76; + FragColor = _46[index]; + if (index < 10) + { + FragColor += _46[index ^ 1]; + } + else + { + FragColor += _46[index & 1]; + } + bool _99 = index > 30; + if (_99) + { + FragColor += _76[index & 3].y; + } + else + { + FragColor += _76[index & 1].x; + } + if (_99) + { + foobar[1].z = 20.0f; + } + int _37 = index & 3; + FragColor += foobar[_37].z; + baz = _90; + FragColor += baz[_37].z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + index = stage_input.index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag new file mode 100644 index 0000000000..5926eef7b4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag @@ -0,0 +1,19 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(18.0f, 52.0f, 1.0f, 1.0f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..56ac1f22ac --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,25 @@ +cbuffer Registers +{ + float registers_foo : packoffset(c0); +}; + + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 10.0f + registers_foo; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..41dfc08061 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,30 @@ +Texture2D g_Texture : register(t0); +SamplerState g_Sampler : register(s0); +SamplerComparisonState g_CompareSampler : register(s1); + +static float2 in_var_TEXCOORD0; +static float out_var_SV_Target; + +struct SPIRV_Cross_Input +{ + float2 in_var_TEXCOORD0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = g_Texture.Sample(g_Sampler, in_var_TEXCOORD0).x + g_Texture.SampleCmpLevelZero(g_CompareSampler, in_var_TEXCOORD0, 0.5f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..269cecb302 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,63 @@ +struct myType +{ + float data; +}; + +static const myType _18 = { 0.0f }; +static const myType _20 = { 1.0f }; +static const myType _21[5] = { { 0.0f }, { 1.0f }, { 0.0f }, { 1.0f }, { 0.0f } }; + +static float4 gl_FragCoord; +static float4 o_color; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 o_color : SV_Target0; +}; + +float mod(float x, float y) +{ + return x - y * floor(x / y); +} + +float2 mod(float2 x, float2 y) +{ + return x - y * floor(x / y); +} + +float3 mod(float3 x, float3 y) +{ + return x - y * floor(x / y); +} + +float4 mod(float4 x, float4 y) +{ + return x - y * floor(x / y); +} + +void frag_main() +{ + if (_21[int(mod(gl_FragCoord.x, 4.0f))].data > 0.0f) + { + o_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + else + { + o_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.o_color = o_color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..db5e717457 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/srem.asm.frag @@ -0,0 +1,29 @@ +static float4 FragColor; +static int4 vA; +static int4 vB; + +struct SPIRV_Cross_Input +{ + nointerpolation int4 vA : TEXCOORD0; + nointerpolation int4 vB : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(vA - vB * (vA / vB)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..1905b5ea29 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,23 @@ +static const float4 _20[2] = { float4(1.0f, 2.0f, 3.0f, 4.0f), 10.0f.xxxx }; + +static float4 FragColors[2] = _20; +static float4 FragColor = 5.0f.xxxx; + +struct SPIRV_Cross_Output +{ + float4 FragColors[2] : SV_Target0; + float4 FragColor : SV_Target2; +}; + +void frag_main() +{ +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColors = FragColors; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..d374bb9f9a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..74c12945bf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,30 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..322c86bed3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,29 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static min16float4 FragColor; +static min16float2 UV; + +struct SPIRV_Cross_Input +{ + min16float2 UV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + min16float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = min16float4(uTexture.Sample(_uTexture_sampler, UV)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + UV = stage_input.UV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..5b894de831 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,31 @@ +Texture2D uShadow : register(t0); +SamplerComparisonState _uShadow_sampler : register(s0); +Texture2D uTexture : register(t1); +SamplerComparisonState uSampler : register(s2); + +static float3 vUV; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float3 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uShadow.SampleCmp(_uShadow_sampler, vUV.xy, vUV.z) + uTexture.SampleCmp(uSampler, vUV.xy, vUV.z); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..4a024c8ef1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/frag/unreachable.asm.frag @@ -0,0 +1,40 @@ +static int counter; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int counter : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _33; + for (;;) + { + if (counter == 10) + { + _33 = 10.0f.xxxx; + break; + } + else + { + _33 = 30.0f.xxxx; + break; + } + } + FragColor = _33; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + counter = stage_input.counter; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..54cfec96ce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,45 @@ +struct InstanceData +{ + column_major float4x4 MATRIX_MVP; + float4 Color; +}; + +cbuffer gInstanceData : register(b0) +{ + InstanceData gInstanceData_1_data[32] : packoffset(c0); +}; + + +static float4 gl_Position; +static int gl_InstanceIndex; +static float3 PosL; +static float4 _entryPointOutput_Color; + +struct SPIRV_Cross_Input +{ + float3 PosL : TEXCOORD0; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 _entryPointOutput_Color : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(float4(PosL, 1.0f), gInstanceData_1_data[uint(gl_InstanceIndex)].MATRIX_MVP); + _entryPointOutput_Color = gInstanceData_1_data[uint(gl_InstanceIndex)].Color; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + PosL = stage_input.PosL; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output._entryPointOutput_Color = _entryPointOutput_Color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..3bccae3e0a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,42 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_201 +#define SPIRV_CROSS_CONSTANT_ID_201 -10 +#endif +static const int _7 = SPIRV_CROSS_CONSTANT_ID_201; +static const int _20 = (_7 + 2); +#ifndef SPIRV_CROSS_CONSTANT_ID_202 +#define SPIRV_CROSS_CONSTANT_ID_202 100u +#endif +static const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; +static const uint _25 = (_8 % 5u); +static const int4 _30 = int4(20, 30, _20, _20); +static const int2 _32 = int2(_30.y, _30.x); +static const int _33 = _30.y; + +static float4 gl_Position; +static int _4; + +struct SPIRV_Cross_Output +{ + nointerpolation int _4 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4 _63 = 0.0f.xxxx; + _63.y = float(_20); + _63.z = float(_25); + float4 _52 = _63 + float4(_30); + float2 _56 = _52.xy + float2(_32); + gl_Position = float4(_56.x, _56.y, _52.z, _52.w); + _4 = _33; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output._4 = _4; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..0d1e8cc534 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(uint(gl_VertexIndex) + uint(gl_InstanceIndex)).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..48b2df20d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chain-load-composite.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chain-load-composite.comp new file mode 100644 index 0000000000..778f62e83c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chain-load-composite.comp @@ -0,0 +1,108 @@ +struct Baz +{ + float c; +}; + +struct Bar +{ + float d[2][4]; + Baz baz[2]; +}; + +struct Foo +{ + column_major float2x2 a; + float2 b; + Bar c[5]; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _31 : register(u0); + +void comp_main() +{ + Foo _36; + _36.a = asfloat(uint2x2(_31.Load(0), _31.Load(8), _31.Load(4), _31.Load(12))); + _36.b = asfloat(_31.Load2(16)); + [unroll] + for (int _4ident = 0; _4ident < 5; _4ident++) + { + [unroll] + for (int _5ident = 0; _5ident < 2; _5ident++) + { + [unroll] + for (int _6ident = 0; _6ident < 4; _6ident++) + { + _36.c[_4ident].d[_5ident][_6ident] = asfloat(_31.Load(_6ident * 4 + _5ident * 16 + _4ident * 40 + 24)); + } + } + [unroll] + for (int _7ident = 0; _7ident < 2; _7ident++) + { + _36.c[_4ident].baz[_7ident].c = asfloat(_31.Load(_7ident * 4 + _4ident * 40 + 56)); + } + } + float2x2 _234 = float2x2(_36.a[0] + 1.0f.xx, _36.a[1] + 1.0f.xx); + _31.Store(224, asuint(_234[0].x)); + _31.Store(228, asuint(_234[1].x)); + _31.Store(232, asuint(_234[0].y)); + _31.Store(236, asuint(_234[1].y)); + _31.Store2(240, asuint(_36.b + 2.0f.xx)); + _31.Store(248, asuint(_36.c[0].d[0][0])); + _31.Store(252, asuint(_36.c[0].d[0][1])); + _31.Store(256, asuint(_36.c[0].d[0][2])); + _31.Store(260, asuint(_36.c[0].d[0][3])); + _31.Store(264, asuint(_36.c[0].d[1][0])); + _31.Store(268, asuint(_36.c[0].d[1][1])); + _31.Store(272, asuint(_36.c[0].d[1][2])); + _31.Store(276, asuint(_36.c[0].d[1][3])); + _31.Store(280, asuint(_36.c[0].baz[0].c)); + _31.Store(284, asuint(_36.c[0].baz[1].c)); + _31.Store(288, asuint(_36.c[1].d[0][0])); + _31.Store(292, asuint(_36.c[1].d[0][1])); + _31.Store(296, asuint(_36.c[1].d[0][2])); + _31.Store(300, asuint(_36.c[1].d[0][3])); + _31.Store(304, asuint(_36.c[1].d[1][0])); + _31.Store(308, asuint(_36.c[1].d[1][1])); + _31.Store(312, asuint(_36.c[1].d[1][2])); + _31.Store(316, asuint(_36.c[1].d[1][3])); + _31.Store(320, asuint(_36.c[1].baz[0].c)); + _31.Store(324, asuint(_36.c[1].baz[1].c)); + _31.Store(328, asuint(_36.c[2].d[0][0])); + _31.Store(332, asuint(_36.c[2].d[0][1])); + _31.Store(336, asuint(_36.c[2].d[0][2])); + _31.Store(340, asuint(_36.c[2].d[0][3])); + _31.Store(344, asuint(_36.c[2].d[1][0])); + _31.Store(348, asuint(_36.c[2].d[1][1])); + _31.Store(352, asuint(_36.c[2].d[1][2])); + _31.Store(356, asuint(_36.c[2].d[1][3])); + _31.Store(360, asuint(_36.c[2].baz[0].c)); + _31.Store(364, asuint(_36.c[2].baz[1].c)); + _31.Store(368, asuint(_36.c[3].d[0][0])); + _31.Store(372, asuint(_36.c[3].d[0][1])); + _31.Store(376, asuint(_36.c[3].d[0][2])); + _31.Store(380, asuint(_36.c[3].d[0][3])); + _31.Store(384, asuint(_36.c[3].d[1][0])); + _31.Store(388, asuint(_36.c[3].d[1][1] + 5.0f)); + _31.Store(392, asuint(_36.c[3].d[1][2])); + _31.Store(396, asuint(_36.c[3].d[1][3])); + _31.Store(400, asuint(_36.c[3].baz[0].c)); + _31.Store(404, asuint(_36.c[3].baz[1].c)); + _31.Store(408, asuint(_36.c[4].d[0][0])); + _31.Store(412, asuint(_36.c[4].d[0][1])); + _31.Store(416, asuint(_36.c[4].d[0][2])); + _31.Store(420, asuint(_36.c[4].d[0][3])); + _31.Store(424, asuint(_36.c[4].d[1][0])); + _31.Store(428, asuint(_36.c[4].d[1][1])); + _31.Store(432, asuint(_36.c[4].d[1][2])); + _31.Store(436, asuint(_36.c[4].d[1][3])); + _31.Store(440, asuint(_36.c[4].baz[0].c)); + _31.Store(444, asuint(_36.c[4].baz[1].c)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.comp new file mode 100644 index 0000000000..c748200b96 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.comp @@ -0,0 +1,23 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer wo : register(u1); +ByteAddressBuffer ro : register(t0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160)))); + wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480)))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.force-uav.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.force-uav.comp new file mode 100644 index 0000000000..97d046d89a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/access-chains.force-uav.comp @@ -0,0 +1,23 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer wo : register(u1); +RWByteAddressBuffer ro : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160)))); + wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480)))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/address-buffers.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/address-buffers.comp new file mode 100644 index 0000000000..7f1c7975bc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/address-buffers.comp @@ -0,0 +1,17 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer WriteOnly : register(u2); +ByteAddressBuffer ReadOnly : register(t0); +RWByteAddressBuffer ReadWrite : register(u1); + +void comp_main() +{ + WriteOnly.Store4(0, asuint(asfloat(ReadOnly.Load4(0)))); + ReadWrite.Store4(0, asuint(asfloat(ReadWrite.Load4(0)) + 10.0f.xxxx)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/atomic.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/atomic.comp new file mode 100644 index 0000000000..e6ff891e8c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/atomic.comp @@ -0,0 +1,91 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer ssbo : register(u2); +RWTexture2D uImage : register(u0); +RWTexture2D iImage : register(u1); + +groupshared int int_atomic; +groupshared uint uint_atomic; +groupshared int int_atomic_array[1]; +groupshared uint uint_atomic_array[1]; + +void comp_main() +{ + uint _19; + InterlockedAdd(uImage[int2(1, 5)], 1u, _19); + uint _27; + InterlockedAdd(uImage[int2(1, 5)], 1u, _27); + iImage[int2(1, 6)] = int(_27).x; + uint _32; + InterlockedOr(uImage[int2(1, 5)], 1u, _32); + uint _34; + InterlockedXor(uImage[int2(1, 5)], 1u, _34); + uint _36; + InterlockedAnd(uImage[int2(1, 5)], 1u, _36); + uint _38; + InterlockedMin(uImage[int2(1, 5)], 1u, _38); + uint _40; + InterlockedMax(uImage[int2(1, 5)], 1u, _40); + uint _44; + InterlockedCompareExchange(uImage[int2(1, 5)], 10u, 2u, _44); + int _47; + InterlockedAdd(iImage[int2(1, 6)], 1, _47); + int _49; + InterlockedOr(iImage[int2(1, 6)], 1, _49); + int _51; + InterlockedXor(iImage[int2(1, 6)], 1, _51); + int _53; + InterlockedAnd(iImage[int2(1, 6)], 1, _53); + int _55; + InterlockedMin(iImage[int2(1, 6)], 1, _55); + int _57; + InterlockedMax(iImage[int2(1, 6)], 1, _57); + int _61; + InterlockedCompareExchange(iImage[int2(1, 5)], 10, 2, _61); + uint _68; + ssbo.InterlockedAdd(0, 1u, _68); + uint _70; + ssbo.InterlockedOr(0, 1u, _70); + uint _72; + ssbo.InterlockedXor(0, 1u, _72); + uint _74; + ssbo.InterlockedAnd(0, 1u, _74); + uint _76; + ssbo.InterlockedMin(0, 1u, _76); + uint _78; + ssbo.InterlockedMax(0, 1u, _78); + uint _80; + ssbo.InterlockedExchange(0, 1u, _80); + uint _82; + ssbo.InterlockedCompareExchange(0, 10u, 2u, _82); + int _85; + ssbo.InterlockedAdd(4, 1, _85); + int _87; + ssbo.InterlockedOr(4, 1, _87); + int _89; + ssbo.InterlockedXor(4, 1, _89); + int _91; + ssbo.InterlockedAnd(4, 1, _91); + int _93; + ssbo.InterlockedMin(4, 1, _93); + int _95; + ssbo.InterlockedMax(4, 1, _95); + int _97; + ssbo.InterlockedExchange(4, 1, _97); + int _99; + ssbo.InterlockedCompareExchange(4, 10, 2, _99); + int _102; + InterlockedAdd(int_atomic, 10, _102); + uint _105; + InterlockedAdd(uint_atomic, 10u, _105); + int _110; + InterlockedAdd(int_atomic_array[0], 10, _110); + uint _115; + InterlockedAdd(uint_atomic_array[0], 10u, _115); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/barriers.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/barriers.comp new file mode 100644 index 0000000000..7ac2a656f0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/barriers.comp @@ -0,0 +1,26 @@ +static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); + +void comp_main() +{ + GroupMemoryBarrier(); + AllMemoryBarrier(); + DeviceMemoryBarrier(); + DeviceMemoryBarrier(); + AllMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); + AllMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); + DeviceMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); + DeviceMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); + AllMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); + GroupMemoryBarrierWithGroupSync(); +} + +[numthreads(4, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/builtins.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/builtins.comp new file mode 100644 index 0000000000..7f88aa798f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/builtins.comp @@ -0,0 +1,11 @@ +static const uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u); + +void comp_main() +{ +} + +[numthreads(8, 4, 2)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..e39f4d0683 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/composite-array-initialization.comp @@ -0,0 +1,50 @@ +struct Data +{ + float a; + float b; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 4.0f +#endif +static const float X = SPIRV_CROSS_CONSTANT_ID_0; + +static const uint3 gl_WorkGroupSize = uint3(2u, 1u, 1u); + +static const Data _21 = { 1.0f, 2.0f }; +static const Data _24 = { 3.0f, 4.0f }; +static const Data _25[2] = { { 1.0f, 2.0f }, { 3.0f, 4.0f } }; +static const Data _30 = { 3.0f, 5.0f }; + +RWByteAddressBuffer _61 : register(u0); + +static uint3 gl_WorkGroupID; +static uint3 gl_LocalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_LocalInvocationID : SV_GroupThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +void comp_main() +{ + Data _28 = { X, 2.0f }; + Data _31[2] = { _28, _30 }; + Data data2[2] = _31; + if (gl_LocalInvocationIndex == 0u) + { + _61.Store(gl_WorkGroupID.x * 8 + 0, asuint(_25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a)); + _61.Store(gl_WorkGroupID.x * 8 + 4, asuint(_25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b)); + } +} + +[numthreads(2, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_LocalInvocationID = stage_input.gl_LocalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/globallycoherent.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/globallycoherent.comp new file mode 100644 index 0000000000..b5f1e377ca --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/globallycoherent.comp @@ -0,0 +1,18 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +globallycoherent RWByteAddressBuffer _29 : register(u3); +ByteAddressBuffer _33 : register(t2); +RWTexture2D uImageIn : register(u0); +globallycoherent RWTexture2D uImageOut : register(u1); + +void comp_main() +{ + uImageOut[int2(9, 7)] = uImageIn[int2(9, 7)].x; + _29.Store(0, asuint(asfloat(_33.Load(0)))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.comp new file mode 100644 index 0000000000..e2f6b0a340 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.comp @@ -0,0 +1,66 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWTexture2D uImageInF : register(u0); +RWTexture2D uImageOutF : register(u1); +RWTexture2D uImageInI : register(u2); +RWTexture2D uImageOutI : register(u3); +RWTexture2D uImageInU : register(u4); +RWTexture2D uImageOutU : register(u5); +RWBuffer uImageInBuffer : register(u6); +RWBuffer uImageOutBuffer : register(u7); +RWTexture2D uImageInF2 : register(u8); +RWTexture2D uImageOutF2 : register(u9); +RWTexture2D uImageInI2 : register(u10); +RWTexture2D uImageOutI2 : register(u11); +RWTexture2D uImageInU2 : register(u12); +RWTexture2D uImageOutU2 : register(u13); +RWBuffer uImageInBuffer2 : register(u14); +RWBuffer uImageOutBuffer2 : register(u15); +RWTexture2D uImageInF4 : register(u16); +RWTexture2D uImageOutF4 : register(u17); +RWTexture2D uImageInI4 : register(u18); +RWTexture2D uImageOutI4 : register(u19); +RWTexture2D uImageInU4 : register(u20); +RWTexture2D uImageOutU4 : register(u21); +RWBuffer uImageInBuffer4 : register(u22); +RWBuffer uImageOutBuffer4 : register(u23); +RWTexture2D uImageNoFmtF : register(u24); +RWTexture2D uImageNoFmtU : register(u25); +RWTexture2D uImageNoFmtI : register(u26); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + int2 _23 = int2(gl_GlobalInvocationID.xy); + uImageOutF[_23] = uImageInF[_23].x; + uImageOutI[_23] = uImageInI[_23].x; + uImageOutU[_23] = uImageInU[_23].x; + int _74 = int(gl_GlobalInvocationID.x); + uImageOutBuffer[_74] = uImageInBuffer[_74].x; + uImageOutF2[_23] = uImageInF2[_23].xy; + uImageOutI2[_23] = uImageInI2[_23].xy; + uImageOutU2[_23] = uImageInU2[_23].xy; + float4 _135 = uImageInBuffer2[_74].xyyy; + uImageOutBuffer2[_74] = _135.xy; + uImageOutF4[_23] = uImageInF4[_23]; + int4 _165 = uImageInI4[_23]; + uImageOutI4[_23] = _165; + uint4 _180 = uImageInU4[_23]; + uImageOutU4[_23] = _180; + uImageOutBuffer4[_74] = uImageInBuffer4[_74]; + uImageNoFmtF[_23] = _135; + uImageNoFmtU[_23] = _180; + uImageNoFmtI[_23] = _165; +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.nonwritable-uav-texture.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.nonwritable-uav-texture.comp new file mode 100644 index 0000000000..6c4a213995 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/image.nonwritable-uav-texture.comp @@ -0,0 +1,66 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +Texture2D uImageInF : register(t0); +RWTexture2D uImageOutF : register(u1); +Texture2D uImageInI : register(t2); +RWTexture2D uImageOutI : register(u3); +Texture2D uImageInU : register(t4); +RWTexture2D uImageOutU : register(u5); +Buffer uImageInBuffer : register(t6); +RWBuffer uImageOutBuffer : register(u7); +Texture2D uImageInF2 : register(t8); +RWTexture2D uImageOutF2 : register(u9); +Texture2D uImageInI2 : register(t10); +RWTexture2D uImageOutI2 : register(u11); +Texture2D uImageInU2 : register(t12); +RWTexture2D uImageOutU2 : register(u13); +Buffer uImageInBuffer2 : register(t14); +RWBuffer uImageOutBuffer2 : register(u15); +Texture2D uImageInF4 : register(t16); +RWTexture2D uImageOutF4 : register(u17); +Texture2D uImageInI4 : register(t18); +RWTexture2D uImageOutI4 : register(u19); +Texture2D uImageInU4 : register(t20); +RWTexture2D uImageOutU4 : register(u21); +Buffer uImageInBuffer4 : register(t22); +RWBuffer uImageOutBuffer4 : register(u23); +RWTexture2D uImageNoFmtF : register(u24); +RWTexture2D uImageNoFmtU : register(u25); +RWTexture2D uImageNoFmtI : register(u26); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + int2 _23 = int2(gl_GlobalInvocationID.xy); + uImageOutF[_23] = uImageInF[_23].x; + uImageOutI[_23] = uImageInI[_23].x; + uImageOutU[_23] = uImageInU[_23].x; + int _74 = int(gl_GlobalInvocationID.x); + uImageOutBuffer[_74] = uImageInBuffer[_74].x; + uImageOutF2[_23] = uImageInF2[_23].xy; + uImageOutI2[_23] = uImageInI2[_23].xy; + uImageOutU2[_23] = uImageInU2[_23].xy; + float4 _135 = uImageInBuffer2[_74]; + uImageOutBuffer2[_74] = _135.xy; + uImageOutF4[_23] = uImageInF4[_23]; + int4 _165 = uImageInI4[_23]; + uImageOutI4[_23] = _165; + uint4 _180 = uImageInU4[_23]; + uImageOutU4[_23] = _180; + uImageOutBuffer4[_74] = uImageInBuffer4[_74]; + uImageNoFmtF[_23] = _135; + uImageNoFmtU[_23] = _180; + uImageNoFmtI[_23] = _165; +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/inverse.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/inverse.comp new file mode 100644 index 0000000000..698f647cec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/inverse.comp @@ -0,0 +1,124 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _15 : register(u0); +ByteAddressBuffer _20 : register(t1); + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float2x2 spvInverse(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 2x2 matrix. +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float3x3 spvInverse(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 3x3 matrix. +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float4x4 spvInverse(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +void comp_main() +{ + float2x2 _23 = asfloat(uint2x2(_20.Load2(0), _20.Load2(8))); + float2x2 _24 = spvInverse(_23); + _15.Store2(0, asuint(_24[0])); + _15.Store2(8, asuint(_24[1])); + float3x3 _29 = asfloat(uint3x3(_20.Load3(16), _20.Load3(32), _20.Load3(48))); + float3x3 _30 = spvInverse(_29); + _15.Store3(16, asuint(_30[0])); + _15.Store3(32, asuint(_30[1])); + _15.Store3(48, asuint(_30[2])); + float4x4 _35 = asfloat(uint4x4(_20.Load4(64), _20.Load4(80), _20.Load4(96), _20.Load4(112))); + float4x4 _36 = spvInverse(_35); + _15.Store4(64, asuint(_36[0])); + _15.Store4(80, asuint(_36[1])); + _15.Store4(96, asuint(_36[2])); + _15.Store4(112, asuint(_36[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-alone.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-alone.comp new file mode 100644 index 0000000000..ff71a0e103 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-alone.comp @@ -0,0 +1,19 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _10 : register(u0); +cbuffer SPIRV_Cross_NumWorkgroups +{ + uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0); +}; + + +void comp_main() +{ + _10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-with-builtins.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-with-builtins.comp new file mode 100644 index 0000000000..cc326db332 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/num-workgroups-with-builtins.comp @@ -0,0 +1,26 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _10 : register(u0); +cbuffer SPIRV_Cross_NumWorkgroups +{ + uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0); +}; + + +static uint3 gl_WorkGroupID; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; +}; + +void comp_main() +{ + _10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count + gl_WorkGroupID); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/outer-product.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/outer-product.comp new file mode 100644 index 0000000000..e58c02fe0b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/outer-product.comp @@ -0,0 +1,50 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _21 : register(u0); +ByteAddressBuffer _26 : register(t1); + +void comp_main() +{ + float2x2 _32 = float2x2(asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).y); + _21.Store2(0, asuint(_32[0])); + _21.Store2(8, asuint(_32[1])); + float2x3 _41 = float2x3(asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).y); + _21.Store3(16, asuint(_41[0])); + _21.Store3(32, asuint(_41[1])); + float2x4 _50 = float2x4(asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).y); + _21.Store4(48, asuint(_50[0])); + _21.Store4(64, asuint(_50[1])); + float3x2 _58 = float3x2(asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).z); + _21.Store2(80, asuint(_58[0])); + _21.Store2(88, asuint(_58[1])); + _21.Store2(96, asuint(_58[2])); + float3x3 _66 = float3x3(asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).z); + _21.Store3(112, asuint(_66[0])); + _21.Store3(128, asuint(_66[1])); + _21.Store3(144, asuint(_66[2])); + float3x4 _74 = float3x4(asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).z); + _21.Store4(160, asuint(_74[0])); + _21.Store4(176, asuint(_74[1])); + _21.Store4(192, asuint(_74[2])); + float4x2 _82 = float4x2(asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).w); + _21.Store2(208, asuint(_82[0])); + _21.Store2(216, asuint(_82[1])); + _21.Store2(224, asuint(_82[2])); + _21.Store2(232, asuint(_82[3])); + float4x3 _90 = float4x3(asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).w); + _21.Store3(240, asuint(_90[0])); + _21.Store3(256, asuint(_90[1])); + _21.Store3(272, asuint(_90[2])); + _21.Store3(288, asuint(_90[3])); + float4x4 _98 = float4x4(asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).w); + _21.Store4(304, asuint(_98[0])); + _21.Store4(320, asuint(_98[1])); + _21.Store4(336, asuint(_98[2])); + _21.Store4(352, asuint(_98[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp new file mode 100644 index 0000000000..af8ed1dd7d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp @@ -0,0 +1,242 @@ +static float3x4 _362; +static float4x3 _364; + +RWByteAddressBuffer _17 : register(u0); +uniform RaytracingAccelerationStructure rtas : register(t1); + +static RayQuery rayQuery; + +void comp_main() +{ + RayDesc _1ident = {0.0f.xxx, 0.0f, float3(1.0f, 0.0f, 0.0f), 9999.0f}; + rayQuery.TraceRayInline(rtas, 0u, 255u, _1ident); + float3x4 _361; + float4x3 _363; + _363 = _364; + _361 = _362; + float3x4 _387; + float4x3 _398; + for (;;) + { + bool _67 = rayQuery.Proceed(); + if (_67) + { + uint _71 = rayQuery.CandidateType(); + switch (_71) + { + case 0u: + { + rayQuery.Abort(); + float4x3 _79 = rayQuery.CandidateObjectToWorld4x3(); + rayQuery.CommitNonOpaqueTriangleHit(); + bool _87 = rayQuery.CommittedTriangleFrontFace(); + if (_87) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float2 _92 = rayQuery.CommittedTriangleBarycentrics(); + if (_92.x == 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _98 = rayQuery.CommittedInstanceID(); + if (_98 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _103 = rayQuery.CommittedInstanceIndex(); + if (_103 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float3 _108 = rayQuery.CommittedObjectRayDirection(); + if (_108.x > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float3 _114 = rayQuery.CommittedObjectRayOrigin(); + if (_114.x > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _120 = rayQuery.CommittedPrimitiveIndex(); + if (_120 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float _125 = rayQuery.CommittedRayT(); + if (_125 > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + uint _130 = rayQuery.CommittedInstanceContributionToHitGroupIndex(); + if (_130 > 0u) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + _398 = _79; + _387 = transpose(_79); + break; + } + case 1u: + { + float4x3 _136 = rayQuery.CandidateObjectToWorld4x3(); + bool _139 = rayQuery.CandidateProceduralPrimitiveNonOpaque(); + if (_139) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + rayQuery.CommitProceduralPrimitiveHit(0.5f); + rayQuery.Abort(); + _398 = _136; + _387 = transpose(_136); + break; + } + default: + { + _398 = _363; + _387 = _361; + break; + } + } + _363 = _398; + _361 = _387; + continue; + } + else + { + break; + } + } + if (_361[0].x == _363[0].x) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + uint _157 = rayQuery.CommittedStatus(); + float3x4 _365; + float4x3 _376; + switch (_157) + { + case 0u: + { + float4x3 _163 = rayQuery.CandidateWorldToObject4x3(); + _376 = _163; + _365 = transpose(_163); + break; + } + case 1u: + { + float4x3 _167 = rayQuery.CommittedWorldToObject4x3(); + bool _170 = rayQuery.CommittedTriangleFrontFace(); + if (_170) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float2 _174 = rayQuery.CommittedTriangleBarycentrics(); + if (_174.y == 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + _376 = _167; + _365 = transpose(_167); + break; + } + case 2u: + { + int _182 = rayQuery.CommittedGeometryIndex(); + if (_182 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _187 = rayQuery.CommittedInstanceIndex(); + if (_187 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _192 = rayQuery.CommittedInstanceID(); + if (_192 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float3 _197 = rayQuery.CommittedObjectRayDirection(); + if (_197.z > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float3 _204 = rayQuery.CommittedObjectRayOrigin(); + if (_204.x > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + int _210 = rayQuery.CommittedPrimitiveIndex(); + if (_210 > 0) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float _215 = rayQuery.CommittedRayT(); + if (_215 > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + _376 = _363; + _365 = _361; + break; + } + default: + { + _376 = _363; + _365 = _361; + break; + } + } + if (_365[0].x == _376[0].x) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + uint _230 = rayQuery.RayFlags(); + if (_230 > 256u) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float _236 = rayQuery.RayTMin(); + if (_236 > 0.0f) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } + float3 _242 = rayQuery.WorldRayOrigin(); + float3 _244 = rayQuery.WorldRayDirection(); + if (_242.x == _244.z) + { + _17.Store(0, 0u); + _17.Store(4, 0u); + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..30ac03f84f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rmw-matrix.comp @@ -0,0 +1,22 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _11 : register(u0); + +void comp_main() +{ + _11.Store(0, asuint(asfloat(_11.Load(0)) * asfloat(_11.Load(96)))); + _11.Store4(16, asuint(asfloat(_11.Load4(16)) * asfloat(_11.Load4(112)))); + float4x4 _35 = asfloat(uint4x4(_11.Load4(128), _11.Load4(144), _11.Load4(160), _11.Load4(176))); + float4x4 _37 = asfloat(uint4x4(_11.Load4(32), _11.Load4(48), _11.Load4(64), _11.Load4(80))); + float4x4 _38 = mul(_35, _37); + _11.Store4(32, asuint(_38[0])); + _11.Store4(48, asuint(_38[1])); + _11.Store4(64, asuint(_38[2])); + _11.Store4(80, asuint(_38[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp new file mode 100644 index 0000000000..09cbd2f49b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp @@ -0,0 +1,93 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _28 : register(u0); +cbuffer UBO : register(b1) +{ + int _68_index0 : packoffset(c0); + int _68_index1 : packoffset(c0.y); +}; + + +void comp_main() +{ + float4x4 _258 = asfloat(uint4x4(_28.Load(64), _28.Load(80), _28.Load(96), _28.Load(112), _28.Load(68), _28.Load(84), _28.Load(100), _28.Load(116), _28.Load(72), _28.Load(88), _28.Load(104), _28.Load(120), _28.Load(76), _28.Load(92), _28.Load(108), _28.Load(124))); + _28.Store4(0, asuint(_258[0])); + _28.Store4(16, asuint(_258[1])); + _28.Store4(32, asuint(_258[2])); + _28.Store4(48, asuint(_258[3])); + float2x2 _261 = asfloat(uint2x2(_28.Load(144), _28.Load(152), _28.Load(148), _28.Load(156))); + _28.Store2(128, asuint(_261[0])); + _28.Store2(136, asuint(_261[1])); + float2x3 _264 = asfloat(uint2x3(_28.Load(192), _28.Load(200), _28.Load(208), _28.Load(196), _28.Load(204), _28.Load(212))); + _28.Store3(160, asuint(_264[0])); + _28.Store3(176, asuint(_264[1])); + float3x2 _267 = asfloat(uint3x2(_28.Load(240), _28.Load(256), _28.Load(244), _28.Load(260), _28.Load(248), _28.Load(264))); + _28.Store2(216, asuint(_267[0])); + _28.Store2(224, asuint(_267[1])); + _28.Store2(232, asuint(_267[2])); + float4x4 _271 = asfloat(uint4x4(_28.Load4(0), _28.Load4(16), _28.Load4(32), _28.Load4(48))); + _28.Store(64, asuint(_271[0].x)); + _28.Store(68, asuint(_271[1].x)); + _28.Store(72, asuint(_271[2].x)); + _28.Store(76, asuint(_271[3].x)); + _28.Store(80, asuint(_271[0].y)); + _28.Store(84, asuint(_271[1].y)); + _28.Store(88, asuint(_271[2].y)); + _28.Store(92, asuint(_271[3].y)); + _28.Store(96, asuint(_271[0].z)); + _28.Store(100, asuint(_271[1].z)); + _28.Store(104, asuint(_271[2].z)); + _28.Store(108, asuint(_271[3].z)); + _28.Store(112, asuint(_271[0].w)); + _28.Store(116, asuint(_271[1].w)); + _28.Store(120, asuint(_271[2].w)); + _28.Store(124, asuint(_271[3].w)); + float2x2 _274 = asfloat(uint2x2(_28.Load2(128), _28.Load2(136))); + _28.Store(144, asuint(_274[0].x)); + _28.Store(148, asuint(_274[1].x)); + _28.Store(152, asuint(_274[0].y)); + _28.Store(156, asuint(_274[1].y)); + float2x3 _277 = asfloat(uint2x3(_28.Load3(160), _28.Load3(176))); + _28.Store(192, asuint(_277[0].x)); + _28.Store(196, asuint(_277[1].x)); + _28.Store(200, asuint(_277[0].y)); + _28.Store(204, asuint(_277[1].y)); + _28.Store(208, asuint(_277[0].z)); + _28.Store(212, asuint(_277[1].z)); + float3x2 _280 = asfloat(uint3x2(_28.Load2(216), _28.Load2(224), _28.Load2(232))); + _28.Store(240, asuint(_280[0].x)); + _28.Store(244, asuint(_280[1].x)); + _28.Store(248, asuint(_280[2].x)); + _28.Store(256, asuint(_280[0].y)); + _28.Store(260, asuint(_280[1].y)); + _28.Store(264, asuint(_280[2].y)); + _28.Store(_68_index0 * 4 + _68_index1 * 16 + 64, asuint(1.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 8 + 144, asuint(2.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 8 + 192, asuint(3.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 16 + 240, asuint(4.0f)); + _28.Store(_68_index0 * 4 + 64, asuint(1.0f.x)); + _28.Store(_68_index0 * 4 + 80, asuint(1.0f.xxxx.y)); + _28.Store(_68_index0 * 4 + 96, asuint(1.0f.xxxx.z)); + _28.Store(_68_index0 * 4 + 112, asuint(1.0f.xxxx.w)); + _28.Store(_68_index0 * 4 + 144, asuint(2.0f.x)); + _28.Store(_68_index0 * 4 + 152, asuint(2.0f.xx.y)); + _28.Store(_68_index0 * 4 + 192, asuint(3.0f.x)); + _28.Store(_68_index0 * 4 + 200, asuint(3.0f.xxx.y)); + _28.Store(_68_index0 * 4 + 208, asuint(3.0f.xxx.z)); + _28.Store(_68_index0 * 4 + 240, asuint(4.0f.x)); + _28.Store(_68_index0 * 4 + 256, asuint(4.0f.xx.y)); + _28.Store(_68_index0 * 16 + _68_index1 * 4 + 0, asuint(1.0f)); + _28.Store(_68_index0 * 8 + _68_index1 * 4 + 128, asuint(2.0f)); + _28.Store(_68_index0 * 16 + _68_index1 * 4 + 160, asuint(3.0f)); + _28.Store(_68_index0 * 8 + _68_index1 * 4 + 216, asuint(4.0f)); + _28.Store4(_68_index0 * 16 + 0, asuint(1.0f.xxxx)); + _28.Store2(_68_index0 * 8 + 128, asuint(2.0f.xx)); + _28.Store3(_68_index0 * 16 + 160, asuint(3.0f.xxx)); + _28.Store2(_68_index0 * 8 + 216, asuint(4.0f.xx)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..db2bbe9698 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,16 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _9 : register(u0); + +void comp_main() +{ + _9.Store(8, asuint(distance(asfloat(_9.Load(0)), asfloat(_9.Load(4))))); + _9.Store(12, asuint(length(asfloat(_9.Load(0))))); + _9.Store(16, asuint(sign(asfloat(_9.Load(0))))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/shared.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/shared.comp new file mode 100644 index 0000000000..9831302afd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/shared.comp @@ -0,0 +1,29 @@ +static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); + +ByteAddressBuffer _22 : register(t0); +RWByteAddressBuffer _44 : register(u1); + +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +groupshared float sShared[4]; + +void comp_main() +{ + sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0)); + GroupMemoryBarrierWithGroupSync(); + _44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[3u - gl_LocalInvocationIndex])); +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..4e7c5e6167 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,51 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +static const int c = SPIRV_CROSS_CONSTANT_ID_2; +static const int d = (c + 50); +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 400 +#endif +static const int e = SPIRV_CROSS_CONSTANT_ID_3; +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _22 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _22.Store(gl_GlobalInvocationID.x * 4 + 2800, uint(int(_22.Load(gl_GlobalInvocationID.x * 4 + 2800)) + (int(_22.Load(gl_GlobalInvocationID.x * 4 + 2400)) + e))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..55ebf32bb6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,43 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +static const uint _26 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +static const uint _27 = SPIRV_CROSS_CONSTANT_ID_10; +static const uint3 gl_WorkGroupSize = uint3(_27, 20u, 1u); +static const uint _32 = gl_WorkGroupSize.x; +static const uint _33 = (_26 + _32); +static const uint _34 = gl_WorkGroupSize.y; +static const uint _35 = (_33 + _34); +static const int _42 = (1 - a); + +RWByteAddressBuffer _23 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + int spec_const_array_size[b]; + spec_const_array_size[0] = 10; + spec_const_array_size[1] = 40; + spec_const_array_size[a] = a; + _23.Store((_35 + gl_GlobalInvocationID.x) * 4 + 0, uint(b + spec_const_array_size[_42])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array-length.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..82657cacfc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array-length.comp @@ -0,0 +1,17 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _11 : register(u1); + +void comp_main() +{ + uint _14; + _11.GetDimensions(_14); + _14 = (_14 - 16) / 16; + _11.Store(0, uint(int(_14))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp new file mode 100644 index 0000000000..ee202a2225 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/comp/ssbo-array.comp @@ -0,0 +1,11 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +void comp_main() +{ +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/array.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/array.flatten.vert new file mode 100644 index 0000000000..c709893c1e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/array.flatten.vert @@ -0,0 +1,28 @@ +uniform float4 UBO[56]; + +static float4 gl_Position; +static float4 aVertex; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = (mul(aVertex, float4x4(UBO[40], UBO[41], UBO[42], UBO[43])) + UBO[55]) + ((UBO[50] + UBO[45]) + UBO[54].x.xxxx); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..778acd4803 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/basic.flatten.vert @@ -0,0 +1,35 @@ +uniform float4 UBO[4]; + +static float4 gl_Position; +static float4 aVertex; +static float3 vNormal; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 vNormal : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vNormal = aNormal; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vNormal = vNormal; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/copy.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/copy.flatten.vert new file mode 100644 index 0000000000..5d857ad674 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/copy.flatten.vert @@ -0,0 +1,50 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + for (int _96 = 0; _96 < 4; ) + { + Light _51 = {UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]}; + float3 _68 = aVertex.xyz - _51.Position; + vColor += ((UBO[_96 * 2 + 5] * clamp(1.0f - (length(_68) / _51.Radius), 0.0f, 1.0f)) * dot(aNormal, normalize(_68))); + _96++; + continue; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/dynamic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..98d5e1b303 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/dynamic.flatten.vert @@ -0,0 +1,49 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + for (int _82 = 0; _82 < 4; ) + { + float3 _54 = aVertex.xyz - UBO[_82 * 2 + 4].xyz; + vColor += ((UBO[_82 * 2 + 5] * clamp(1.0f - (length(_54) / UBO[_82 * 2 + 4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(_54))); + _82++; + continue; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..59ec525f41 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,29 @@ +uniform float4 UBO[4]; + +static float3 FragColor; +static float3 vNormal; + +struct SPIRV_Cross_Input +{ + nointerpolation float3 vNormal : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4x4 _19 = float4x4(UBO[0], UBO[1], UBO[2], UBO[3]); + FragColor = mul(vNormal, float3x3(_19[0].xyz, _19[1].xyz, _19[2].xyz)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vNormal = stage_input.vNormal; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..b69a72dc11 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/matrixindex.flatten.vert @@ -0,0 +1,41 @@ +uniform float4 UBO[14]; + +static float4 gl_Position; +static float4 oA; +static float4 oB; +static float4 oC; +static float4 oD; +static float4 oE; + +struct SPIRV_Cross_Output +{ + float4 oA : TEXCOORD0; + float4 oB : TEXCOORD1; + float4 oC : TEXCOORD2; + float4 oD : TEXCOORD3; + float4 oE : TEXCOORD4; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 0.0f.xxxx; + oA = UBO[1]; + oB = float4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y); + oC = UBO[9]; + oD = float4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x); + oE = float4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.oA = oA; + stage_output.oB = oB; + stage_output.oC = oC; + stage_output.oD = oD; + stage_output.oE = oE; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..f21f05ec44 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/multiindex.flatten.vert @@ -0,0 +1,28 @@ +uniform float4 UBO[15]; + +static float4 gl_Position; +static int2 aIndex; + +struct SPIRV_Cross_Input +{ + int2 aIndex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aIndex = stage_input.aIndex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..5bfb4dc065 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/push-constant.flatten.vert @@ -0,0 +1,35 @@ +uniform float4 PushMe[6]; + +static float4 gl_Position; +static float4 Pos; +static float2 vRot; +static float2 Rot; + +struct SPIRV_Cross_Input +{ + float2 Rot : TEXCOORD0; + float4 Pos : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float2 vRot : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(Pos, float4x4(PushMe[0], PushMe[1], PushMe[2], PushMe[3])); + vRot = mul(Rot, float2x2(PushMe[4].xy, PushMe[4].zw)) + PushMe[5].z.xx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Pos = stage_input.Pos; + Rot = stage_input.Rot; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vRot = vRot; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..2560484efb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/rowmajor.flatten.vert @@ -0,0 +1,28 @@ +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])) + mul(aVertex, transpose(float4x4(UBO[4], UBO[5], UBO[6], UBO[7]))); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..41ad8ce965 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.flatten.vert @@ -0,0 +1,44 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[6]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + float3 _39 = aVertex.xyz - UBO[4].xyz; + vColor += ((UBO[5] * clamp(1.0f - (length(_39) / UBO[4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(_39))); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..bb702907a7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,43 @@ +struct Foo +{ + column_major float3x4 MVP0; + column_major float3x4 MVP1; +}; + +uniform float4 UBO[8]; + +static float4 v0; +static float4 v1; +static float3 V0; +static float3 V1; + +struct SPIRV_Cross_Input +{ + float4 v0 : TEXCOORD0; + float4 v1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 V0 : TEXCOORD0; + float3 V1 : TEXCOORD1; +}; + +void vert_main() +{ + Foo _19 = {transpose(float4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(float4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))}; + Foo _20 = _19; + V0 = mul(_20.MVP0, v0); + V1 = mul(_20.MVP1, v1); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v0 = stage_input.v0; + v1 = stage_input.v1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.V0 = V0; + stage_output.V1 = V1; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..1091a17e99 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/swizzle.flatten.vert @@ -0,0 +1,45 @@ +uniform float4 UBO[8]; + +static float4 gl_Position; +static float4 oA; +static float4 oB; +static float4 oC; +static float4 oD; +static float4 oE; +static float4 oF; + +struct SPIRV_Cross_Output +{ + float4 oA : TEXCOORD0; + float4 oB : TEXCOORD1; + float4 oC : TEXCOORD2; + float4 oD : TEXCOORD3; + float4 oE : TEXCOORD4; + float4 oF : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 0.0f.xxxx; + oA = UBO[0]; + oB = float4(UBO[1].xy, UBO[1].zw); + oC = float4(UBO[2].x, UBO[3].xyz); + oD = float4(UBO[4].xyz, UBO[4].w); + oE = float4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w); + oF = float4(UBO[6].x, UBO[6].zw, UBO[7].x); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.oA = oA; + stage_output.oB = oB; + stage_output.oC = oC; + stage_output.oD = oD; + stage_output.oE = oE; + stage_output.oF = oF; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/types.flatten.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/types.flatten.frag new file mode 100644 index 0000000000..feb0b36096 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/flatten/types.flatten.frag @@ -0,0 +1,23 @@ +uniform int4 UBO1[2]; +uniform uint4 UBO2[2]; +uniform float4 UBO0[2]; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = ((((float4(UBO1[0]) + float4(UBO1[1])) + float4(UBO2[0])) + float4(UBO2[1])) + UBO0[0]) + UBO0[1]; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..38f416fbfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,27 @@ +static const float _17[5] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + for (int _46 = 0; _46 < 4; ) + { + int _33 = _46 + 1; + FragColor += _17[_33].xxxx; + _46 = _33; + continue; + } +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm30.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm30.frag new file mode 100644 index 0000000000..d3697d650f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm30.frag @@ -0,0 +1,26 @@ +static float3 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + FragColor = vColor.xyz; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor, 0.0); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm50.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm50.frag new file mode 100644 index 0000000000..52f6fed6c1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic-color-3comp.sm50.frag @@ -0,0 +1,26 @@ +static float3 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vColor.xyz; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic.frag new file mode 100644 index 0000000000..6d067041c2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/basic.frag @@ -0,0 +1,32 @@ +Texture2D uTex : register(t0); +SamplerState _uTex_sampler : register(s0); + +static float4 FragColor; +static float4 vColor; +static float2 vTex; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; + float2 vTex : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vColor * uTex.Sample(_uTex_sampler, vTex); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag new file mode 100644 index 0000000000..b60b2ebb4a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bit-conversions.frag @@ -0,0 +1,26 @@ +static float2 value; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 value : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(1.0f, 0.0f, asfloat(asint(value.x)), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + value = stage_input.value; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag new file mode 100644 index 0000000000..f3e84898d6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/boolean-mix.frag @@ -0,0 +1,27 @@ +static float2 FragColor; +static float2 x0; + +struct SPIRV_Cross_Input +{ + float2 x0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float2 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool2 _27 = (x0.x > x0.y).xx; + FragColor = float2(_27.x ? float2(1.0f, 0.0f).x : float2(0.0f, 1.0f).x, _27.y ? float2(1.0f, 0.0f).y : float2(0.0f, 1.0f).y); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + x0 = stage_input.x0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/builtins.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/builtins.frag new file mode 100644 index 0000000000..8432c42f80 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/builtins.frag @@ -0,0 +1,34 @@ +static float4 gl_FragCoord; +static float gl_FragDepth; +static float4 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + float gl_FragDepth : SV_Depth; +}; + +void frag_main() +{ + FragColor = gl_FragCoord + vColor; + gl_FragDepth = 0.5f; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag new file mode 100644 index 0000000000..4813cc55a2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/bvec-operations.frag @@ -0,0 +1,29 @@ +static bool _47; + +static float2 value; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 value : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool2 _25 = bool2(value.x == 0.0f, _47); + FragColor = float4(1.0f, 0.0f, float(bool2(!_25.x, !_25.y).x), float(bool2(value.x <= float2(1.5f, 0.5f).x, value.y <= float2(1.5f, 0.5f).y).x)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + value = stage_input.value; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/clip-cull-distance.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/clip-cull-distance.frag new file mode 100644 index 0000000000..52f1ac30b6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/clip-cull-distance.frag @@ -0,0 +1,30 @@ +static float gl_ClipDistance[2]; +static float gl_CullDistance[1]; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float2 gl_ClipDistance0 : SV_ClipDistance0; + float gl_CullDistance0 : SV_CullDistance0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (gl_ClipDistance[0] + gl_CullDistance[0]) + gl_ClipDistance[1]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_ClipDistance[0] = stage_input.gl_ClipDistance0.x; + gl_ClipDistance[1] = stage_input.gl_ClipDistance0.y; + gl_CullDistance[0] = stage_input.gl_CullDistance0.x; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag new file mode 100644 index 0000000000..18968cb193 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-parameter.frag @@ -0,0 +1,24 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); +Texture2D uSamplerShadow : register(t1); +SamplerComparisonState _uSamplerShadow_sampler : register(s1); + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (uSampler.Sample(_uSampler_sampler, 1.0f.xx) + uSampler.Load(int3(int2(10, 10), 0))).x + uSamplerShadow.SampleCmp(_uSamplerShadow_sampler, 1.0f.xxx.xy, 1.0f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag new file mode 100644 index 0000000000..6e8f833b34 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/combined-texture-sampler-shadow.frag @@ -0,0 +1,23 @@ +Texture2D uDepth : register(t2); +SamplerComparisonState uSampler : register(s0); +SamplerState uSampler1 : register(s1); + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uDepth.SampleCmp(uSampler, 1.0f.xxx.xy, 1.0f) + uDepth.Sample(uSampler1, 1.0f.xx).x; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..1de882445b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,38 @@ +RWByteAddressBuffer _34 : register(u0); +Texture2D Buf : register(t1); +SamplerState _Buf_sampler : register(s1); + +static float4 gl_FragCoord; +static int vIn; +static int vIn2; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIn : TEXCOORD0; + nointerpolation int vIn2 : TEXCOORD1; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int _40 = Buf.Load(int3(int2(gl_FragCoord.xy), 0)).x % 16; + FragColor = (asfloat(_34.Load4(_40 * 16 + 0)) + asfloat(_34.Load4(_40 * 16 + 0))) + asfloat(_34.Load4(((vIn * vIn) + (vIn2 * vIn2)) * 16 + 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vIn = stage_input.vIn; + vIn2 = stage_input.vIn2; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/constant-composites.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..306ca5cadb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,38 @@ +struct Foo +{ + float a; + float b; +}; + +static const float _16[4] = { 1.0f, 4.0f, 3.0f, 2.0f }; +static const Foo _24 = { 10.0f, 20.0f }; +static const Foo _27 = { 30.0f, 40.0f }; +static const Foo _28[2] = { { 10.0f, 20.0f }, { 30.0f, 40.0f } }; + +static float4 FragColor; +static int _line; + +struct SPIRV_Cross_Input +{ + nointerpolation int _line : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _16[_line].xxxx; + FragColor += (_28[_line].a * _28[1 - _line].a).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _line = stage_input._line; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..1b314e13b9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,55 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); + +static float4 FragColor; +static float4 vInput; + +struct SPIRV_Cross_Input +{ + float4 vInput : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vInput; + float4 _23 = uSampler.Sample(_uSampler_sampler, vInput.xy); + float4 _26 = ddx(vInput); + float4 _29 = ddy(vInput); + float4 _32 = fwidth(vInput); + float4 _35 = ddx_coarse(vInput); + float4 _38 = ddy_coarse(vInput); + float4 _41 = fwidth(vInput); + float4 _44 = ddx_fine(vInput); + float4 _47 = ddy_fine(vInput); + float4 _50 = fwidth(vInput); + float _56_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vInput.zw); + float2 _56 = _56_tmp.xx; + if (vInput.y > 10.0f) + { + FragColor += _23; + FragColor += _26; + FragColor += _29; + FragColor += _32; + FragColor += _35; + FragColor += _38; + FragColor += _41; + FragColor += _44; + FragColor += _47; + FragColor += _50; + FragColor += _56.xyxy; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput = stage_input.vInput; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/demote-to-helper.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/demote-to-helper.frag new file mode 100644 index 0000000000..743a4228ba --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/demote-to-helper.frag @@ -0,0 +1,9 @@ +void frag_main() +{ + discard; +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-greater-than.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..b9f50db00a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-greater-than.frag @@ -0,0 +1,19 @@ +static float gl_FragDepth; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_DepthGreaterEqual; +}; + +void frag_main() +{ + gl_FragDepth = 0.5f; +} + +[earlydepthstencil] +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-less-than.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-less-than.frag new file mode 100644 index 0000000000..a702fd9f8e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/depth-less-than.frag @@ -0,0 +1,19 @@ +static float gl_FragDepth; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_DepthLessEqual; +}; + +void frag_main() +{ + gl_FragDepth = 0.5f; +} + +[earlydepthstencil] +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/dual-source-blending.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..961e800010 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/dual-source-blending.frag @@ -0,0 +1,23 @@ +static float4 FragColor0; +static float4 FragColor1; + +struct SPIRV_Cross_Output +{ + float4 FragColor0 : SV_Target0; + float4 FragColor1 : SV_Target1; +}; + +void frag_main() +{ + FragColor0 = 1.0f.xxxx; + FragColor1 = 2.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor0 = FragColor0; + stage_output.FragColor1 = FragColor1; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag new file mode 100644 index 0000000000..ae2569d5cf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/early-fragment-test.frag @@ -0,0 +1,9 @@ +void frag_main() +{ +} + +[earlydepthstencil] +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..f37c1fcc4b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,25 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 0.0f.xxxx; + for (int _43 = 0; _43 < 3; ) + { + FragColor[_43] += float(_43); + _43++; + continue; + } +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag new file mode 100644 index 0000000000..54b91e2aa5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/fp16-packing.frag @@ -0,0 +1,44 @@ +static float2 FP32Out; +static uint FP16; +static uint FP16Out; +static float2 FP32; + +struct SPIRV_Cross_Input +{ + nointerpolation uint FP16 : TEXCOORD0; + nointerpolation float2 FP32 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float2 FP32Out : SV_Target0; + uint FP16Out : SV_Target1; +}; + +uint spvPackHalf2x16(float2 value) +{ + uint2 Packed = f32tof16(value); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackHalf2x16(uint value) +{ + return f16tof32(uint2(value & 0xffff, value >> 16)); +} + +void frag_main() +{ + FP32Out = spvUnpackHalf2x16(FP16); + FP16Out = spvPackHalf2x16(FP32); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + FP16 = stage_input.FP16; + FP32 = stage_input.FP32; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FP32Out = FP32Out; + stage_output.FP16Out = FP16Out; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/front-facing.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/front-facing.frag new file mode 100644 index 0000000000..4ed09a2bd1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/front-facing.frag @@ -0,0 +1,39 @@ +static bool gl_FrontFacing; +static float4 FragColor; +static float4 vA; +static float4 vB; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; + bool gl_FrontFacing : SV_IsFrontFace; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + if (gl_FrontFacing) + { + FragColor = vA; + } + else + { + FragColor = vB; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FrontFacing = stage_input.gl_FrontFacing; + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/hyperbolic.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/hyperbolic.frag new file mode 100644 index 0000000000..ac6febb45c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/hyperbolic.frag @@ -0,0 +1,65 @@ +static float4 result; +static float scalar; +static float3 _vector; + +struct SPIRV_Cross_Input +{ + float scalar : TEXCOORD0; + float3 _vector : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 result : SV_Target0; +}; + +void frag_main() +{ + result = 1.0f.xxxx; + result.w *= sinh(scalar); + result.w *= cosh(scalar); + result.w *= tanh(scalar); + result.w *= log(scalar + sqrt(scalar * scalar + 1.0f)); + result.w *= log(scalar + sqrt(scalar * scalar - 1.0f)); + result.w *= (log((1.0f + scalar) / (1.0f - scalar)) * 0.5f); + float4 _58 = result; + float3 _60 = _58.xyz * sinh(_vector); + result.x = _60.x; + result.y = _60.y; + result.z = _60.z; + float4 _72 = result; + float3 _74 = _72.xyz * cosh(_vector); + result.x = _74.x; + result.y = _74.y; + result.z = _74.z; + float4 _83 = result; + float3 _85 = _83.xyz * tanh(_vector); + result.x = _85.x; + result.y = _85.y; + result.z = _85.z; + float4 _94 = result; + float3 _96 = _94.xyz * log(_vector + sqrt(_vector * _vector + 1.0f)); + result.x = _96.x; + result.y = _96.y; + result.z = _96.z; + float4 _105 = result; + float3 _107 = _105.xyz * log(_vector + sqrt(_vector * _vector - 1.0f)); + result.x = _107.x; + result.y = _107.y; + result.z = _107.z; + float4 _116 = result; + float3 _118 = _116.xyz * (log((1.0f + _vector) / (1.0f - _vector)) * 0.5f); + result.x = _118.x; + result.y = _118.y; + result.z = _118.z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + scalar = stage_input.scalar; + _vector = stage_input._vector; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.result = result; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-selective.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/image-query.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment-ms.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..54cb1dd944 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment-ms.frag @@ -0,0 +1,33 @@ +Texture2DMS uSubpass0 : register(t0); +Texture2DMS uSubpass1 : register(t1); + +static float4 gl_FragCoord; +static int gl_SampleID; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; + uint gl_SampleID : SV_SampleIndex; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (uSubpass0.Load(int2(gl_FragCoord.xy), 1) + uSubpass1.Load(int2(gl_FragCoord.xy), 2)) + uSubpass0.Load(int2(gl_FragCoord.xy), gl_SampleID); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + gl_SampleID = stage_input.gl_SampleID; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment.frag new file mode 100644 index 0000000000..34aaafcf3d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/input-attachment.frag @@ -0,0 +1,30 @@ +Texture2D uSubpass0 : register(t0); +Texture2D uSubpass1 : register(t1); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uSubpass0.Load(int3(int2(gl_FragCoord.xy), 0)) + uSubpass1.Load(int3(int2(gl_FragCoord.xy), 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/io-block.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/io-block.frag new file mode 100644 index 0000000000..812a44d813 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/io-block.frag @@ -0,0 +1,34 @@ +struct VertexOut +{ + float4 a; + float4 b; +}; + +static float4 FragColor; +static VertexOut _12; + +struct SPIRV_Cross_Input +{ + float4 VertexOut_a : TEXCOORD1; + float4 VertexOut_b : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _12.a + _12.b; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _12.a = stage_input.VertexOut_a; + _12.b = stage_input.VertexOut_b; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag new file mode 100644 index 0000000000..2af0e513b4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag @@ -0,0 +1,32 @@ +uniform sampler2D uSampler; + +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + float3 _23 = float3(vUV, 5.0f); + FragColor = tex2Dproj(uSampler, float4(_23.xy, 0.0, _23.z)); + FragColor += tex2Dbias(uSampler, float4(vUV, 0.0, 3.0f)); + FragColor += tex2Dlod(uSampler, float4(vUV, 0.0, 2.0f)); + FragColor += tex2Dgrad(uSampler, vUV, 4.0f.xx, 5.0f.xx); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/lut-promotion.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/lut-promotion.frag new file mode 100644 index 0000000000..4d89d36eb5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/lut-promotion.frag @@ -0,0 +1,55 @@ +static const float _16[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f }; +static const float4 _60[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx }; +static const float4 _104[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx }; + +static float FragColor; +static int index; + +struct SPIRV_Cross_Input +{ + nointerpolation int index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _16[index]; + if (index < 10) + { + FragColor += _16[index ^ 1]; + } + else + { + FragColor += _16[index & 1]; + } + bool _63 = index > 30; + if (_63) + { + FragColor += _60[index & 3].y; + } + else + { + FragColor += _60[index & 1].x; + } + float4 foobar[4] = _60; + if (_63) + { + foobar[1].z = 20.0f; + } + int _91 = index & 3; + FragColor += foobar[_91].z; + FragColor += _104[_91].z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + index = stage_input.index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/matrix-input.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/matrix-input.frag new file mode 100644 index 0000000000..92d87d396e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/matrix-input.frag @@ -0,0 +1,26 @@ +static float4 FragColor; +static float4x4 m; + +struct SPIRV_Cross_Input +{ + float4x4 m : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = ((m[0] + m[1]) + m[2]) + m[3]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + m = stage_input.m; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mod.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mod.frag new file mode 100644 index 0000000000..41ac930496 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mod.frag @@ -0,0 +1,67 @@ +static float4 a4; +static float4 b4; +static float3 a3; +static float3 b3; +static float2 a2; +static float2 b2; +static float a1; +static float b1; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 a4 : TEXCOORD0; + float3 a3 : TEXCOORD1; + float2 a2 : TEXCOORD2; + float a1 : TEXCOORD3; + float4 b4 : TEXCOORD4; + float3 b3 : TEXCOORD5; + float2 b2 : TEXCOORD6; + float b1 : TEXCOORD7; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float mod(float x, float y) +{ + return x - y * floor(x / y); +} + +float2 mod(float2 x, float2 y) +{ + return x - y * floor(x / y); +} + +float3 mod(float3 x, float3 y) +{ + return x - y * floor(x / y); +} + +float4 mod(float4 x, float4 y) +{ + return x - y * floor(x / y); +} + +void frag_main() +{ + FragColor = ((mod(a4, b4) + mod(a3, b3).xyzx) + mod(a2, b2).xyxy) + mod(a1, b1).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a4 = stage_input.a4; + b4 = stage_input.b4; + a3 = stage_input.a3; + b3 = stage_input.b3; + a2 = stage_input.a2; + b2 = stage_input.b2; + a1 = stage_input.a1; + b1 = stage_input.b1; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mrt.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mrt.frag new file mode 100644 index 0000000000..e69e91196a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/mrt.frag @@ -0,0 +1,31 @@ +static float4 RT0; +static float4 RT1; +static float4 RT2; +static float4 RT3; + +struct SPIRV_Cross_Output +{ + float4 RT0 : SV_Target0; + float4 RT1 : SV_Target1; + float4 RT2 : SV_Target2; + float4 RT3 : SV_Target3; +}; + +void frag_main() +{ + RT0 = 1.0f.xxxx; + RT1 = 2.0f.xxxx; + RT2 = 3.0f.xxxx; + RT3 = 4.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.RT0 = RT0; + stage_output.RT1 = RT1; + stage_output.RT2 = RT2; + stage_output.RT3 = RT3; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return2.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return2.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/no-return2.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag new file mode 100644 index 0000000000..6685ef9c42 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag @@ -0,0 +1,111 @@ +struct UBO_1_1 +{ + float4 v[64]; +}; + +ConstantBuffer ubos[] : register(b2, space9); +RWByteAddressBuffer ssbos[] : register(u3, space10); +Texture2D uSamplers[] : register(t0, space0); +SamplerState uSamps[] : register(s1, space3); +Texture2D uCombinedSamplers[] : register(t4, space2); +SamplerState _uCombinedSamplers_sampler[] : register(s4, space2); +Texture2DMS uSamplersMS[] : register(t0, space1); +RWTexture2D uImages[] : register(u5, space7); +RWTexture2D uImagesU32[] : register(u5, space8); + +static int vIndex; +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIndex : TEXCOORD0; + float2 vUV : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint2 spvTextureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint2 spvImageSize(RWTexture2D Tex, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y); + Param = 0u; + return ret; +} + +void frag_main() +{ + int _22 = vIndex + 10; + int _32 = vIndex + 40; + FragColor = uSamplers[NonUniformResourceIndex(_22)].Sample(uSamps[NonUniformResourceIndex(_32)], vUV); + int _49 = _22; + FragColor = uCombinedSamplers[NonUniformResourceIndex(_49)].Sample(_uCombinedSamplers_sampler[NonUniformResourceIndex(_49)], vUV); + int _65 = vIndex + 20; + int _69 = _32; + FragColor += ubos[NonUniformResourceIndex(_65)].v[_69]; + int _83 = vIndex + 50; + int _88 = vIndex + 60; + FragColor += asfloat(ssbos[NonUniformResourceIndex(_83)].Load4(_88 * 16 + 16)); + int _100 = vIndex + 70; + ssbos[NonUniformResourceIndex(_88)].Store4(_100 * 16 + 16, asuint(20.0f.xxxx)); + int2 _111 = int2(vUV); + FragColor = uSamplers[NonUniformResourceIndex(_49)].Load(int3(_111, 0)); + int _116 = vIndex + 100; + uint _122; + ssbos[_116].InterlockedAdd(0, 100u, _122); + float _136_tmp = uSamplers[NonUniformResourceIndex(_22)].CalculateLevelOfDetail(uSamps[NonUniformResourceIndex(_32)], vUV); + float2 _136 = _136_tmp.xx; + float _143_tmp = uCombinedSamplers[NonUniformResourceIndex(_49)].CalculateLevelOfDetail(_uCombinedSamplers_sampler[NonUniformResourceIndex(_49)], vUV); + float2 _143 = _143_tmp.xx; + float4 _147 = FragColor; + float2 _149 = _147.xy + (_136 + _143); + FragColor.x = _149.x; + FragColor.y = _149.y; + int _160; + spvTextureSize(uSamplers[NonUniformResourceIndex(_65)], 0u, _160); + FragColor.x += float(int(_160)); + int _176; + spvTextureSize(uSamplersMS[NonUniformResourceIndex(_65)], 0u, _176); + FragColor.y += float(int(_176)); + uint _187_dummy_parameter; + float4 _189 = FragColor; + float2 _191 = _189.xy + float2(int2(spvTextureSize(uSamplers[NonUniformResourceIndex(_65)], uint(0), _187_dummy_parameter))); + FragColor.x = _191.x; + FragColor.y = _191.y; + FragColor += uImages[NonUniformResourceIndex(_83)][_111].xxxx; + uint _216_dummy_parameter; + float4 _218 = FragColor; + float2 _220 = _218.xy + float2(int2(spvImageSize(uImages[NonUniformResourceIndex(_65)], _216_dummy_parameter))); + FragColor.x = _220.x; + FragColor.y = _220.y; + uImages[NonUniformResourceIndex(_88)][_111] = 50.0f.x; + uint _248; + InterlockedAdd(uImagesU32[NonUniformResourceIndex(_100)][_111], 40u, _248); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/partial-write-preserve.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag new file mode 100644 index 0000000000..8923f96a75 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag @@ -0,0 +1,24 @@ +RWByteAddressBuffer _9 : register(u6, space0); +globallycoherent RasterizerOrderedByteAddressBuffer _42 : register(u3, space0); +RasterizerOrderedByteAddressBuffer _52 : register(u4, space0); +RWTexture2D img4 : register(u5, space0); +RasterizerOrderedTexture2D img : register(u0, space0); +RasterizerOrderedTexture2D img3 : register(u2, space0); +RasterizerOrderedTexture2D img2 : register(u1, space0); + +void frag_main() +{ + _9.Store(0, uint(0)); + img4[int2(1, 1)] = float4(1.0f, 0.0f, 0.0f, 1.0f); + img[int2(0, 0)] = img3[int2(0, 0)]; + uint _39; + InterlockedAdd(img2[int2(0, 0)], 1u, _39); + _42.Store(0, uint(int(_42.Load(0)) + 42)); + uint _55; + _42.InterlockedAnd(4, _52.Load(0), _55); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/point-coord-compat.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/point-coord-compat.frag new file mode 100644 index 0000000000..629153982d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/point-coord-compat.frag @@ -0,0 +1,19 @@ +static float2 FragColor; + +struct SPIRV_Cross_Output +{ + float2 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float2(0.5f, 0.5f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..a9d4bd83d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/query-lod.desktop.frag @@ -0,0 +1,31 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); + +static float4 FragColor; +static float2 vTexCoord; + +struct SPIRV_Cross_Input +{ + float2 vTexCoord : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float _19_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vTexCoord); + float2 _19 = _19_tmp.xx; + FragColor = _19.xyxy; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vTexCoord = stage_input.vTexCoord; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag new file mode 100644 index 0000000000..bbe3e4a7d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag @@ -0,0 +1,21 @@ +globallycoherent RWByteAddressBuffer _12 : register(u0); + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = asfloat(_12.Load4(0)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.frag new file mode 100644 index 0000000000..02252f9cbc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/readonly-coherent-ssbo.frag @@ -0,0 +1,21 @@ +ByteAddressBuffer _12 : register(t0); + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = asfloat(_12.Load4(0)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/resources.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/resources.frag new file mode 100644 index 0000000000..aac0d53a1d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/resources.frag @@ -0,0 +1,41 @@ +cbuffer CBuffer : register(b3) +{ + float4 cbuf_a : packoffset(c0); +}; + +cbuffer PushMe +{ + float4 registers_d : packoffset(c0); +}; + +Texture2D uSampledImage : register(t4); +SamplerState _uSampledImage_sampler : register(s4); +Texture2D uTexture : register(t5); +SamplerState uSampler : register(s6); + +static float2 vTex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 vTex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (cbuf_a + registers_d); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/row-major-layout-in-struct.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/row-major-layout-in-struct.frag new file mode 100644 index 0000000000..7df0fd91d6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/row-major-layout-in-struct.frag @@ -0,0 +1,38 @@ +struct Foo +{ + row_major float4x4 v; + row_major float4x4 w; +}; + +cbuffer UBO : register(b0) +{ + Foo _17_foo : packoffset(c0); +}; + + +static float4 FragColor; +static float4 vUV; + +struct SPIRV_Cross_Input +{ + float4 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = mul(mul(vUV, _17_foo.w), _17_foo.v); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag new file mode 100644 index 0000000000..82688ac5a4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-cmp-level-zero.frag @@ -0,0 +1,41 @@ +Texture2D uSampler2D : register(t0); +SamplerComparisonState _uSampler2D_sampler : register(s0); +Texture2DArray uSampler2DArray : register(t1); +SamplerComparisonState _uSampler2DArray_sampler : register(s1); +TextureCube uSamplerCube : register(t2); +SamplerComparisonState _uSamplerCube_sampler : register(s2); +TextureCubeArray uSamplerCubeArray : register(t3); +SamplerComparisonState _uSamplerCubeArray_sampler : register(s3); + +static float3 vUVRef; +static float4 vDirRef; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float3 vUVRef : TEXCOORD0; + float4 vDirRef : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _33 = vDirRef; + float4 _80 = _33; + _80.z = _33.w; + FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, _33.xyz, _33.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, _33.xyz, _33.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, _33, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, _33.xyz, _33.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, _33.xyz, _33.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, _80.xy / _80.z, _33.z / _80.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, _80.xy / _80.z, _33.z / _80.z, int2(1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUVRef = stage_input.vUVRef; + vDirRef = stage_input.vDirRef; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in-and-out.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in-and-out.frag new file mode 100644 index 0000000000..185a09821e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in-and-out.frag @@ -0,0 +1,30 @@ +static int gl_SampleMaskIn; +static int gl_SampleMask; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + uint gl_SampleMaskIn : SV_Coverage; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + uint gl_SampleMask : SV_Coverage; +}; + +void frag_main() +{ + FragColor = 1.0f.xxxx; + gl_SampleMask = gl_SampleMaskIn; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_SampleMaskIn = stage_input.gl_SampleMaskIn; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_SampleMask = gl_SampleMask; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in.frag new file mode 100644 index 0000000000..8f6cfaf9e5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-in.frag @@ -0,0 +1,32 @@ +static int gl_SampleID; +static int gl_SampleMaskIn; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + uint gl_SampleID : SV_SampleIndex; + uint gl_SampleMaskIn : SV_Coverage; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + if ((gl_SampleMaskIn & (1 << gl_SampleID)) != 0) + { + FragColor = 1.0f.xxxx; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_SampleID = stage_input.gl_SampleID; + gl_SampleMaskIn = stage_input.gl_SampleMaskIn; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-out.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-out.frag new file mode 100644 index 0000000000..a966c03218 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sample-mask-out.frag @@ -0,0 +1,23 @@ +static int gl_SampleMask; +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + uint gl_SampleMask : SV_Coverage; +}; + +void frag_main() +{ + FragColor = 1.0f.xxxx; + gl_SampleMask = 0; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_SampleMask = gl_SampleMask; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-array.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-array.frag new file mode 100644 index 0000000000..8ecdc6c3a8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-array.frag @@ -0,0 +1,31 @@ +Texture2D uCombined[4] : register(t0); +SamplerState _uCombined_sampler[4] : register(s0); +Texture2D uTex[4] : register(t4); +SamplerState uSampler[4] : register(s8); +RWTexture2D uImage[8] : register(u12); + +static float4 gl_FragCoord; +static float2 vTex; +static int vIndex; + +struct SPIRV_Cross_Input +{ + float2 vTex : TEXCOORD0; + nointerpolation int vIndex : TEXCOORD1; + float4 gl_FragCoord : SV_Position; +}; + +void frag_main() +{ + int _72 = vIndex + 1; + uImage[vIndex][int2(gl_FragCoord.xy)] = ((uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex) + uTex[vIndex].Sample(uSampler[vIndex], vTex)) + uCombined[_72].Sample(_uCombined_sampler[_72], vTex)) + uTex[_72].Sample(uSampler[_72], vTex); +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vTex = stage_input.vTex; + vIndex = stage_input.vIndex; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-image-arrays.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-image-arrays.frag new file mode 100644 index 0000000000..b6d0e9421c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/sampler-image-arrays.frag @@ -0,0 +1,39 @@ +Texture2D uSampler[4] : register(t0); +SamplerState _uSampler_sampler[4] : register(s0); +Texture2D uTextures[4] : register(t8); +SamplerState uSamplers[4] : register(s4); + +static int vIndex; +static float2 vTex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation float2 vTex : TEXCOORD0; + nointerpolation int vIndex : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 0.0f.xxxx; + FragColor += uTextures[2].Sample(uSamplers[1], vTex); + FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex); + FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex + 0.100000001490116119384765625f.xx); + FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex + 0.20000000298023223876953125f.xx); + FragColor += uSampler[3].Sample(_uSampler_sampler[3], vTex + 0.300000011920928955078125f.xx); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..6c2d0be4f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/scalar-refract-reflect.frag @@ -0,0 +1,49 @@ +static float FragColor; +static float3 vRefract; + +struct SPIRV_Cross_Input +{ + float3 vRefract : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float spvReflect(float i, float n) +{ + return i - 2.0 * dot(n, i) * n; +} + +float spvRefract(float i, float n, float eta) +{ + float NoI = n * i; + float NoI2 = NoI * NoI; + float k = 1.0 - eta * eta * (1.0 - NoI2); + if (k < 0.0) + { + return 0.0; + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +void frag_main() +{ + FragColor = spvRefract(vRefract.x, vRefract.y, vRefract.z); + FragColor += spvReflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vRefract = stage_input.vRefract; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag new file mode 100644 index 0000000000..faed40678a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag @@ -0,0 +1,22 @@ +uniform sampler2D uSamp; +uniform sampler2D SPIRV_Cross_CombineduTuS; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + FragColor = tex2D(uSamp, 0.5f.xx) + tex2D(SPIRV_Cross_CombineduTuS, 0.5f.xx); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..415886dd31 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-block-size.frag @@ -0,0 +1,37 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +static const int Value = SPIRV_CROSS_CONSTANT_ID_10; + +cbuffer SpecConstArray : register(b0) +{ + float4 _15_samples[Value] : packoffset(c0); +}; + + +static float4 FragColor; +static int Index; + +struct SPIRV_Cross_Input +{ + nointerpolation int Index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _15_samples[Index]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Index = stage_input.Index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..942da54f04 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/spec-constant-ternary.frag @@ -0,0 +1,26 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 10u +#endif +static const uint s = SPIRV_CROSS_CONSTANT_ID_0; +static const bool _13 = (s > 20u); +static const uint f = _13 ? 30u : 50u; + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float(f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..f25b768b9e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unreachable-break.frag @@ -0,0 +1,49 @@ +cbuffer UBO : register(b0) +{ + int _13_cond : packoffset(c0); + int _13_cond2 : packoffset(c0.y); +}; + + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool _49; + switch (_13_cond) + { + case 1: + { + if (_13_cond2 < 50) + { + _49 = false; + break; + } + else + { + discard; + } + break; // unreachable workaround + } + default: + { + _49 = true; + break; + } + } + bool4 _45 = _49.xxxx; + FragColor = float4(_45.x ? 10.0f.xxxx.x : 20.0f.xxxx.x, _45.y ? 10.0f.xxxx.y : 20.0f.xxxx.y, _45.z ? 10.0f.xxxx.z : 20.0f.xxxx.z, _45.w ? 10.0f.xxxx.w : 20.0f.xxxx.w); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..d7ec92f0aa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/switch-unsigned-case.frag @@ -0,0 +1,38 @@ +cbuffer Buff : register(b0) +{ + uint _15_TestVal : packoffset(c0); +}; + + +static float4 fsout_Color; + +struct SPIRV_Cross_Output +{ + float4 fsout_Color : SV_Target0; +}; + +void frag_main() +{ + fsout_Color = 1.0f.xxxx; + switch (_15_TestVal) + { + case 0u: + { + fsout_Color = 0.100000001490116119384765625f.xxxx; + break; + } + case 1u: + { + fsout_Color = 0.20000000298023223876953125f.xxxx; + break; + } + } +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.fsout_Color = fsout_Color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag new file mode 100644 index 0000000000..ab310b82f2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/swizzle-scalar.frag @@ -0,0 +1,41 @@ +static float4 Float; +static float vFloat; +static int4 Int; +static int vInt; +static float4 Float2; +static int4 Int2; + +struct SPIRV_Cross_Input +{ + nointerpolation float vFloat : TEXCOORD0; + nointerpolation int vInt : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 Float : SV_Target0; + int4 Int : SV_Target1; + float4 Float2 : SV_Target2; + int4 Int2 : SV_Target3; +}; + +void frag_main() +{ + Float = vFloat.xxxx * 2.0f; + Int = vInt.xxxx * int4(2, 2, 2, 2); + Float2 = 10.0f.xxxx; + Int2 = int4(10, 10, 10, 10); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vFloat = stage_input.vFloat; + vInt = stage_input.vInt; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.Float = Float; + stage_output.Int = Int; + stage_output.Float2 = Float2; + stage_output.Int2 = Int2; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling-ms.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling-ms.frag new file mode 100644 index 0000000000..d4dd78d890 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling-ms.frag @@ -0,0 +1,34 @@ +Texture2DMS uTex : register(t0); +SamplerState _uTex_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int2 _22 = int2(gl_FragCoord.xy); + FragColor = uTex.Load(_22, 0); + FragColor += uTex.Load(_22, 1); + FragColor += uTex.Load(_22, 2); + FragColor += uTex.Load(_22, 3); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag new file mode 100644 index 0000000000..caedd37e44 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.frag @@ -0,0 +1,69 @@ +Texture1D tex1d : register(t0); +SamplerState _tex1d_sampler : register(s0); +Texture2D tex2d : register(t1); +SamplerState _tex2d_sampler : register(s1); +Texture3D tex3d : register(t2); +SamplerState _tex3d_sampler : register(s2); +TextureCube texCube : register(t3); +SamplerState _texCube_sampler : register(s3); +Texture1D tex1dShadow : register(t4); +SamplerComparisonState _tex1dShadow_sampler : register(s4); +Texture2D tex2dShadow : register(t5); +SamplerComparisonState _tex2dShadow_sampler : register(s5); +TextureCube texCubeShadow : register(t6); +SamplerComparisonState _texCubeShadow_sampler : register(s6); +Texture1DArray tex1dArray : register(t7); +SamplerState _tex1dArray_sampler : register(s7); +Texture2DArray tex2dArray : register(t8); +SamplerState _tex2dArray_sampler : register(s8); +TextureCubeArray texCubeArray : register(t9); +SamplerState _texCubeArray_sampler : register(s9); +Texture2D separateTex2d : register(t12); +SamplerState samplerNonDepth : register(s11); +Texture2D separateTex2dDepth : register(t13); +SamplerComparisonState samplerDepth : register(s10); + +static float texCoord1d; +static float2 texCoord2d; +static float3 texCoord3d; +static float4 texCoord4d; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float texCoord1d : TEXCOORD0; + float2 texCoord2d : TEXCOORD1; + float3 texCoord3d : TEXCOORD2; + float4 texCoord4d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float2 _41 = float2(texCoord1d, 2.0f); + float3 _88 = float3(texCoord2d, 2.0f); + float4 _135 = float4(texCoord3d, 2.0f); + float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, _41.x / _41.y)) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, _88.xy / _88.z)) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, _135.xyz / _135.w)) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f); + _162.w = ((_162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f)) + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f)) + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f); + float4 _243 = tex2d.GatherRed(_tex2d_sampler, texCoord2d); + float4 _269 = tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1)); + float4 _308 = ((((((((((((((_162 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + _243) + _243) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + _269) + _269) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d); + _308.w = _308.w + separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z); + FragColor = _308; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + texCoord1d = stage_input.texCoord1d; + texCoord2d = stage_input.texCoord2d; + texCoord3d = stage_input.texCoord3d; + texCoord4d = stage_input.texCoord4d; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.sm30.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.sm30.frag new file mode 100644 index 0000000000..4a2d9b68f6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/tex-sampling.sm30.frag @@ -0,0 +1,54 @@ +uniform sampler1D tex1d; +uniform sampler2D tex2d; +uniform sampler3D tex3d; +uniform samplerCUBE texCube; +uniform sampler1D tex1dShadow; +uniform sampler2D tex2dShadow; + +static float texCoord1d; +static float2 texCoord2d; +static float3 texCoord3d; +static float4 FragColor; +static float4 texCoord4d; + +struct SPIRV_Cross_Input +{ + float texCoord1d : TEXCOORD0; + float2 texCoord2d : TEXCOORD1; + float3 texCoord3d : TEXCOORD2; + float4 texCoord4d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + float2 _34 = float2(texCoord1d, 2.0f); + float3 _73 = float3(texCoord2d, 2.0f); + float4 _112 = float4(texCoord3d, 2.0f); + float4 _139 = ((((((((((((((((tex1D(tex1d, texCoord1d) + tex1Dlod(tex1d, float4(texCoord1d, 0.0, 0.0, 2.0f))) + tex1Dgrad(tex1d, texCoord1d, 1.0f, 2.0f)) + tex1Dproj(tex1d, float4(_34.x, 0.0, 0.0, _34.y))) + tex1Dbias(tex1d, float4(texCoord1d, 0.0, 0.0, 1.0f))) + tex2D(tex2d, texCoord2d)) + tex2Dlod(tex2d, float4(texCoord2d, 0.0, 2.0f))) + tex2Dgrad(tex2d, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2Dproj(tex2d, float4(_73.xy, 0.0, _73.z))) + tex2Dbias(tex2d, float4(texCoord2d, 0.0, 1.0f))) + tex3D(tex3d, texCoord3d)) + tex3Dlod(tex3d, float4(texCoord3d, 2.0f))) + tex3Dgrad(tex3d, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3Dproj(tex3d, float4(_112.xyz, _112.w))) + tex3Dbias(tex3d, float4(texCoord3d, 1.0f))) + texCUBE(texCube, texCoord3d)) + texCUBElod(texCube, float4(texCoord3d, 2.0f))) + texCUBEbias(texCube, float4(texCoord3d, 1.0f)); + float3 _147 = float3(texCoord1d, 0.0f, 0.0f); + float4 _171 = float4(texCoord1d, 0.0f, 0.0f, 2.0f); + _171.y = 2.0f; + float3 _194 = float3(texCoord2d, 0.0f); + float4 _219 = float4(texCoord2d, 0.0f, 2.0f); + _219.z = 2.0f; + float4 _264 = _139; + _264.w = (((((((_139.w + tex1Dproj(tex1dShadow, float4(_147.x, 0.0, 0.0f, 1.0)).x) + tex1Dlod(tex1dShadow, float4(_147.x, 0.0, 0.0f, 2.0f)).x) + tex1Dproj(tex1dShadow, float4(_171.x, 0.0, 0.0f, _171.y)).x) + tex1Dbias(tex1dShadow, float4(_147.x, 0.0, 0.0f, 1.0f)).x) + tex2Dproj(tex2dShadow, float4(_194.xy, 0.0f, 1.0)).x) + tex2Dlod(tex2dShadow, float4(_194.xy, 0.0f, 2.0f)).x) + tex2Dproj(tex2dShadow, float4(_219.xy, 0.0f, _219.z)).x) + tex2Dbias(tex2dShadow, float4(_194.xy, 0.0f, 1.0f)).x; + FragColor = _264; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + texCoord1d = stage_input.texCoord1d; + texCoord2d = stage_input.texCoord2d; + texCoord3d = stage_input.texCoord3d; + texCoord4d = stage_input.texCoord4d; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..9bd27697c5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,32 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int2 _22 = int2(gl_FragCoord.xy); + FragColor = uTexture.Load(int3(_22, 0), int2(1, 1)); + FragColor += uTexture.Load(int3(_22, 0), int2(-1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..bc710227ec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag @@ -0,0 +1,52 @@ +Texture1D uShadow1D : register(t0); +SamplerComparisonState _uShadow1D_sampler : register(s0); +Texture2D uShadow2D : register(t1); +SamplerComparisonState _uShadow2D_sampler : register(s1); +Texture1D uSampler1D : register(t2); +SamplerState _uSampler1D_sampler : register(s2); +Texture2D uSampler2D : register(t3); +SamplerState _uSampler2D_sampler : register(s3); +Texture3D uSampler3D : register(t4); +SamplerState _uSampler3D_sampler : register(s4); + +static float FragColor; +static float4 vClip4; +static float2 vClip2; +static float3 vClip3; + +struct SPIRV_Cross_Input +{ + float3 vClip3 : TEXCOORD0; + float4 vClip4 : TEXCOORD1; + float2 vClip2 : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _17 = vClip4; + float4 _20 = _17; + _20.y = _17.w; + FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, _20.x / _20.y, _17.z / _20.y); + float4 _30 = _17; + _30.z = _17.w; + FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, _30.xy / _30.z, _17.z / _30.z); + FragColor = uSampler1D.Sample(_uSampler1D_sampler, vClip2.x / vClip2.y).x; + FragColor = uSampler2D.Sample(_uSampler2D_sampler, vClip3.xy / vClip3.z).x; + FragColor = uSampler3D.Sample(_uSampler3D_sampler, _17.xyz / _17.w).x; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vClip4 = stage_input.vClip4; + vClip2 = stage_input.vClip2; + vClip3 = stage_input.vClip3; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..dd2eb251fc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t0); +SamplerState uSampler : register(s1); + +static int2 FooOut; + +struct SPIRV_Cross_Output +{ + int2 FooOut : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _23_dummy_parameter; + FooOut = int2(spvTextureSize(uTex, uint(0), _23_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FooOut = FooOut; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag new file mode 100644 index 0000000000..85419ef14a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unary-enclose.frag @@ -0,0 +1,26 @@ +static float4 FragColor; +static float4 vIn; + +struct SPIRV_Cross_Input +{ + float4 vIn : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vIn; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIn = stage_input.vIn; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag new file mode 100644 index 0000000000..95786b93b6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/unorm-snorm-packing.frag @@ -0,0 +1,111 @@ +static float4 FP32Out; +static uint UNORM8; +static uint SNORM8; +static uint UNORM16; +static uint SNORM16; +static uint UNORM8Out; +static float4 FP32; +static uint SNORM8Out; +static uint UNORM16Out; +static uint SNORM16Out; + +struct SPIRV_Cross_Input +{ + nointerpolation uint SNORM8 : TEXCOORD0; + nointerpolation uint UNORM8 : TEXCOORD1; + nointerpolation uint SNORM16 : TEXCOORD2; + nointerpolation uint UNORM16 : TEXCOORD3; + nointerpolation float4 FP32 : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 FP32Out : SV_Target0; + uint UNORM8Out : SV_Target1; + uint SNORM8Out : SV_Target2; + uint UNORM16Out : SV_Target3; + uint SNORM16Out : SV_Target4; +}; + +uint spvPackUnorm4x8(float4 value) +{ + uint4 Packed = uint4(round(saturate(value) * 255.0)); + return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24); +} + +float4 spvUnpackUnorm4x8(uint value) +{ + uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24); + return float4(Packed) / 255.0; +} + +uint spvPackSnorm4x8(float4 value) +{ + int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff; + return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24)); +} + +float4 spvUnpackSnorm4x8(uint value) +{ + int SignedValue = int(value); + int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24; + return clamp(float4(Packed) / 127.0, -1.0, 1.0); +} + +uint spvPackUnorm2x16(float2 value) +{ + uint2 Packed = uint2(round(saturate(value) * 65535.0)); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackUnorm2x16(uint value) +{ + uint2 Packed = uint2(value & 0xffff, value >> 16); + return float2(Packed) / 65535.0; +} + +uint spvPackSnorm2x16(float2 value) +{ + int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff; + return uint(Packed.x | (Packed.y << 16)); +} + +float2 spvUnpackSnorm2x16(uint value) +{ + int SignedValue = int(value); + int2 Packed = int2(SignedValue << 16, SignedValue) >> 16; + return clamp(float2(Packed) / 32767.0, -1.0, 1.0); +} + +void frag_main() +{ + FP32Out = spvUnpackUnorm4x8(UNORM8); + FP32Out = spvUnpackSnorm4x8(SNORM8); + float2 _21 = spvUnpackUnorm2x16(UNORM16); + FP32Out.x = _21.x; + FP32Out.y = _21.y; + float2 _31 = spvUnpackSnorm2x16(SNORM16); + FP32Out.x = _31.x; + FP32Out.y = _31.y; + UNORM8Out = spvPackUnorm4x8(FP32); + SNORM8Out = spvPackSnorm4x8(FP32); + UNORM16Out = spvPackUnorm2x16(FP32.xy); + SNORM16Out = spvPackSnorm2x16(FP32.zw); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + UNORM8 = stage_input.UNORM8; + SNORM8 = stage_input.SNORM8; + UNORM16 = stage_input.UNORM16; + SNORM16 = stage_input.SNORM16; + FP32 = stage_input.FP32; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FP32Out = FP32Out; + stage_output.UNORM8Out = UNORM8Out; + stage_output.SNORM8Out = SNORM8Out; + stage_output.UNORM16Out = UNORM16Out; + stage_output.SNORM16Out = SNORM16Out; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag new file mode 100644 index 0000000000..0bc2fc1a96 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/frag/various-glsl-ops.frag @@ -0,0 +1,26 @@ +static float2 interpolant; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 interpolant : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(0.0f, 0.0f, 0.0f, EvaluateAttributeSnapped(interpolant, 0.100000001490116119384765625f.xx).x) + float4(0.0f, 0.0f, 0.0f, ddx_coarse(interpolant.x)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + interpolant = stage_input.interpolant; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh b/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..4819b14f68 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh @@ -0,0 +1,90 @@ +struct BlockOut +{ + float4 a; + float4 b; +}; + +struct BlockOutPrim +{ + float4 a; + float4 b; +}; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(2u, 3u, 4u); + +static uint3 gl_WorkGroupID; +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +struct gl_MeshPerVertexEXT +{ + float4 vOut : TEXCOORD0; + BlockOut outputs : TEXCOORD2; + float4 gl_Position : SV_Position; + float gl_ClipDistance[1] : SV_ClipDistance; + float2 gl_CullDistance : SV_CullDistance; +}; + +struct gl_MeshPerPrimitiveEXT +{ + float4 vPrim : TEXCOORD1; + BlockOutPrim prim_outputs : TEXCOORD4; + uint gl_PrimitiveID : SV_PrimitiveID; + uint gl_Layer : SV_RenderTargetArrayIndex; + uint gl_ViewportIndex : SV_ViewportArrayIndex; + uint gl_PrimitiveShadingRateEXT : SV_ShadingRate; + bool gl_CullPrimitiveEXT : SV_CullPrimitive; +}; + +groupshared float shared_float[16]; + +void mesh_main(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], TaskPayload _payload, inout uint2 gl_PrimitiveLineIndicesEXT[22]) +{ + SetMeshOutputCounts(24u, 22u); + float3 _173 = float3(gl_GlobalInvocationID); + float _174 = _173.x; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = float4(_174, _173.yz, 1.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 6.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].vOut = float4(_174, _173.yz, 2.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.a = 5.0f.xxxx; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.b = 6.0f.xxxx; + GroupMemoryBarrierWithGroupSync(); + if (gl_LocalInvocationIndex < 22u) + { + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].vPrim = float4(float3(gl_WorkGroupID), 3.0f); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.a = _payload.a.xxxx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.b = _payload.b.xxxx; + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uint2(0u, 1u) + gl_LocalInvocationIndex.xx; + int _229 = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = _229; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = _229 + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = _229 + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = _229 + 3; + } +} + +[outputtopology("line")] +[numthreads(2, 3, 4)] +void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], in payload TaskPayload _payload, out indices uint2 gl_PrimitiveLineIndicesEXT[22]) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + mesh_main(gl_MeshVerticesEXT, gl_MeshPrimitivesEXT, _payload, gl_PrimitiveLineIndicesEXT); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh b/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..7436c463ed --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh @@ -0,0 +1,90 @@ +struct BlockOut +{ + float4 a; + float4 b; +}; + +struct BlockOutPrim +{ + float4 a; + float4 b; +}; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(2u, 3u, 4u); + +static uint3 gl_WorkGroupID; +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +struct gl_MeshPerVertexEXT +{ + float4 vOut : TEXCOORD0; + BlockOut outputs : TEXCOORD2; + float4 gl_Position : SV_Position; + float gl_ClipDistance[1] : SV_ClipDistance; + float2 gl_CullDistance : SV_CullDistance; +}; + +struct gl_MeshPerPrimitiveEXT +{ + float4 vPrim : TEXCOORD1; + BlockOutPrim prim_outputs : TEXCOORD4; + uint gl_PrimitiveID : SV_PrimitiveID; + uint gl_Layer : SV_RenderTargetArrayIndex; + uint gl_ViewportIndex : SV_ViewportArrayIndex; + uint gl_PrimitiveShadingRateEXT : SV_ShadingRate; + bool gl_CullPrimitiveEXT : SV_CullPrimitive; +}; + +groupshared float shared_float[16]; + +void mesh_main(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], TaskPayload _payload, inout uint3 gl_PrimitiveTriangleIndicesEXT[22]) +{ + SetMeshOutputCounts(24u, 22u); + float3 _29 = float3(gl_GlobalInvocationID); + float _31 = _29.x; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = float4(_31, _29.yz, 1.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 3.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].vOut = float4(_31, _29.yz, 2.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.a = 5.0f.xxxx; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.b = 6.0f.xxxx; + GroupMemoryBarrierWithGroupSync(); + if (gl_LocalInvocationIndex < 22u) + { + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].vPrim = float4(float3(gl_WorkGroupID), 3.0f); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.a = _payload.a.xxxx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.b = _payload.b.xxxx; + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uint3(0u, 1u, 2u) + gl_LocalInvocationIndex.xxx; + int _127 = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = _127; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = _127 + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = _127 + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = _127 + 3; + } +} + +[outputtopology("triangle")] +[numthreads(2, 3, 4)] +void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], in payload TaskPayload _payload, out indices uint3 gl_PrimitiveTriangleIndicesEXT[22]) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + mesh_main(gl_MeshVerticesEXT, gl_MeshPrimitivesEXT, _payload, gl_PrimitiveTriangleIndicesEXT); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task b/third_party/spirv-cross/reference/opt/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task new file mode 100644 index 0000000000..2f5ae1b81d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task @@ -0,0 +1,24 @@ +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +groupshared TaskPayload _payload; + +void task_main() +{ + _payload.a = 1.2000000476837158203125f; + _payload.b = 2.2999999523162841796875f; + _payload.c = 3; + DispatchMesh(1u, 2u, 3u, _payload); +} + +[numthreads(1, 1, 1)] +void main() +{ + task_main(); +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/basic.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/basic.vert new file mode 100644 index 0000000000..e0bcebf725 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/basic.vert @@ -0,0 +1,39 @@ +cbuffer UBO : register(b0) +{ + row_major float4x4 _16_uMVP : packoffset(c0); +}; + + +static float4 gl_Position; +static float4 aVertex; +static float3 vNormal; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 vNormal : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, _16_uMVP); + vNormal = aNormal; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vNormal = vNormal; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/clip-cull-distance.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/clip-cull-distance.vert new file mode 100644 index 0000000000..7e0d104acd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/clip-cull-distance.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static float gl_ClipDistance[2]; +static float gl_CullDistance[1]; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; + float2 gl_ClipDistance0 : SV_ClipDistance0; + float gl_CullDistance0 : SV_CullDistance0; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_ClipDistance[0] = 0.0f; + gl_ClipDistance[1] = 0.0f; + gl_CullDistance[0] = 4.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.gl_ClipDistance0.x = gl_ClipDistance[0]; + stage_output.gl_ClipDistance0.y = gl_ClipDistance[1]; + stage_output.gl_CullDistance0.x = gl_CullDistance[0]; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/instancing.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/instancing.vert new file mode 100644 index 0000000000..48b2df20d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/instancing.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/invariant.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/invariant.vert new file mode 100644 index 0000000000..ae1ae4b7e6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/invariant.vert @@ -0,0 +1,39 @@ +static float4 gl_Position; +static float4 vInput0; +static float4 vInput1; +static float4 vInput2; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vInput0 : TEXCOORD0; + float4 vInput1 : TEXCOORD1; + float4 vInput2 : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + precise float4 vColor : TEXCOORD0; + precise float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4 _21 = mad(vInput1, vInput2, vInput0); + gl_Position = _21; + float4 _27 = vInput0 - vInput1; + float4 _29 = _27 * vInput2; + vColor = _29; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput0 = stage_input.vInput0; + vInput1 = stage_input.vInput1; + vInput2 = stage_input.vInput2; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/legacy-int-attribute.sm30.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/legacy-int-attribute.sm30.vert new file mode 100644 index 0000000000..84e283483b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/legacy-int-attribute.sm30.vert @@ -0,0 +1,36 @@ +uniform float4 gl_HalfPixel; + +static float4 gl_Position; +static int4 attr_int4; +static int attr_int1; + +struct SPIRV_Cross_Input +{ + float4 attr_int4 : TEXCOORD0; + float attr_int1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : POSITION; +}; + +void vert_main() +{ + gl_Position.x = float(attr_int4[attr_int1]); + gl_Position.y = 0.0f; + gl_Position.z = 0.0f; + gl_Position.w = 0.0f; + gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w; + gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + attr_int4 = stage_input.attr_int4; + attr_int1 = stage_input.attr_int1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/locations.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/locations.vert new file mode 100644 index 0000000000..0d14def342 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/locations.vert @@ -0,0 +1,75 @@ +struct Foo +{ + float3 a; + float3 b; + float3 c; +}; + +struct VertexOut +{ + float3 color; + float3 foo; +}; + +static const Foo _71 = { 1.0f.xxx, 1.0f.xxx, 1.0f.xxx }; + +static float4 gl_Position; +static float4 Input2; +static float4 Input4; +static float4 Input0; +static float vLocation0; +static float vLocation1; +static float vLocation2[2]; +static Foo vLocation4; +static float vLocation9; +static VertexOut vout; + +struct SPIRV_Cross_Input +{ + float4 Input0 : TEXCOORD0; + float4 Input2 : TEXCOORD2; + float4 Input4 : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float vLocation0 : TEXCOORD0; + float vLocation1 : TEXCOORD1; + float vLocation2[2] : TEXCOORD2; + Foo vLocation4 : TEXCOORD4; + float3 VertexOut_color : TEXCOORD7; + float3 VertexOut_foo : TEXCOORD8; + float vLocation9 : TEXCOORD9; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = ((1.0f.xxxx + Input2) + Input4) + Input0; + vLocation0 = 0.0f; + vLocation1 = 1.0f; + vLocation2[0] = 2.0f; + vLocation2[1] = 2.0f; + vLocation4 = _71; + vLocation9 = 9.0f; + vout.color = 2.0f.xxx; + vout.foo = 4.0f.xxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Input2 = stage_input.Input2; + Input4 = stage_input.Input4; + Input0 = stage_input.Input0; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vLocation0 = vLocation0; + stage_output.vLocation1 = vLocation1; + stage_output.vLocation2 = vLocation2; + stage_output.vLocation4 = vLocation4; + stage_output.vLocation9 = vLocation9; + stage_output.VertexOut_color = vout.color; + stage_output.VertexOut_foo = vout.foo; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert new file mode 100644 index 0000000000..a3d0eef56e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-attribute.vert @@ -0,0 +1,35 @@ +static float4 gl_Position; +static float4x4 m; +static float3 pos; + +struct SPIRV_Cross_Input +{ + float3 pos : TEXCOORD0; + float4 m_0 : TEXCOORD1_0; + float4 m_1 : TEXCOORD1_1; + float4 m_2 : TEXCOORD1_2; + float4 m_3 : TEXCOORD1_3; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(float4(pos, 1.0f), m); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + m[0] = stage_input.m_0; + m[1] = stage_input.m_1; + m[2] = stage_input.m_2; + m[3] = stage_input.m_3; + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-output.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-output.vert new file mode 100644 index 0000000000..dc776cb5ec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/matrix-output.vert @@ -0,0 +1,23 @@ +static float4 gl_Position; +static float4x4 m; + +struct SPIRV_Cross_Output +{ + float4x4 m : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + m = float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 1.0f)); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.m = m; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-contraction.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-contraction.vert new file mode 100644 index 0000000000..10763fbee5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-contraction.vert @@ -0,0 +1,39 @@ +static float4 gl_Position; +static float4 vA; +static float4 vB; +static float4 vC; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; + float4 vC : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + precise float4 _15 = vA * vB; + precise float4 _19 = vA + vB; + precise float4 _23 = vA - vB; + precise float4 _30 = _15 + vC; + precise float4 _34 = _15 + _19; + precise float4 _36 = _34 + _23; + precise float4 _38 = _36 + _30; + gl_Position = _38; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + vC = stage_input.vC; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-input.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-input.vert new file mode 100644 index 0000000000..c98544dbe8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/no-input.vert @@ -0,0 +1,18 @@ +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert new file mode 100644 index 0000000000..95f45d02f0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size-compat.vert @@ -0,0 +1,20 @@ +static float4 gl_Position; +static float gl_PointSize; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_PointSize = 1.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size.sm30.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size.sm30.vert new file mode 100644 index 0000000000..7f9eba4742 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/point-size.sm30.vert @@ -0,0 +1,26 @@ +uniform float4 gl_HalfPixel; + +static float4 gl_Position; +static float gl_PointSize; +struct SPIRV_Cross_Output +{ + float4 gl_Position : POSITION; + float gl_PointSize : PSIZE; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_PointSize = 4.0f; + gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w; + gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.gl_PointSize = gl_PointSize; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/qualifiers.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/qualifiers.vert new file mode 100644 index 0000000000..bbf7dc61e4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/qualifiers.vert @@ -0,0 +1,56 @@ +struct Block +{ + float vFlat; + float vCentroid; + float vSample; + float vNoperspective; +}; + +static float4 gl_Position; +static float vFlat; +static float vCentroid; +static float vSample; +static float vNoperspective; +static Block vout; + +struct SPIRV_Cross_Output +{ + nointerpolation float vFlat : TEXCOORD0; + centroid float vCentroid : TEXCOORD1; + sample float vSample : TEXCOORD2; + noperspective float vNoperspective : TEXCOORD3; + nointerpolation float Block_vFlat : TEXCOORD4; + centroid float Block_vCentroid : TEXCOORD5; + sample float Block_vSample : TEXCOORD6; + noperspective float Block_vNoperspective : TEXCOORD7; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + vFlat = 0.0f; + vCentroid = 1.0f; + vSample = 2.0f; + vNoperspective = 3.0f; + vout.vFlat = 0.0f; + vout.vCentroid = 1.0f; + vout.vSample = 2.0f; + vout.vNoperspective = 3.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vFlat = vFlat; + stage_output.vCentroid = vCentroid; + stage_output.vSample = vSample; + stage_output.vNoperspective = vNoperspective; + stage_output.Block_vFlat = vout.vFlat; + stage_output.Block_vCentroid = vout.vCentroid; + stage_output.Block_vSample = vout.vSample; + stage_output.Block_vNoperspective = vout.vNoperspective; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..03fa4f3351 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/read-from-row-major-array.vert @@ -0,0 +1,36 @@ +cbuffer Block : register(b0) +{ + column_major float2x3 _104_var[3][4] : packoffset(c0); +}; + + +static float4 gl_Position; +static float4 a_position; +static float v_vtxResult; + +struct SPIRV_Cross_Input +{ + float4 a_position : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float v_vtxResult : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = a_position; + v_vtxResult = ((float(abs(_104_var[0][0][0].x - 2.0f) < 0.0500000007450580596923828125f) * float(abs(_104_var[0][0][0].y - 6.0f) < 0.0500000007450580596923828125f)) * float(abs(_104_var[0][0][0].z - (-6.0f)) < 0.0500000007450580596923828125f)) * ((float(abs(_104_var[0][0][1].x) < 0.0500000007450580596923828125f) * float(abs(_104_var[0][0][1].y - 5.0f) < 0.0500000007450580596923828125f)) * float(abs(_104_var[0][0][1].z - 5.0f) < 0.0500000007450580596923828125f)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a_position = stage_input.a_position; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.v_vtxResult = v_vtxResult; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/return-array.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/return-array.vert new file mode 100644 index 0000000000..be11c3f1a5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/return-array.vert @@ -0,0 +1,26 @@ +static float4 gl_Position; +static float4 vInput1; + +struct SPIRV_Cross_Input +{ + float4 vInput1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 10.0f.xxxx + vInput1; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput1 = stage_input.vInput1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert new file mode 100644 index 0000000000..3652185443 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/sampler-buffers.vert @@ -0,0 +1,22 @@ +Buffer uFloatSampler : register(t1); +Buffer uIntSampler : register(t2); +Buffer uUintSampler : register(t3); + +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = (uFloatSampler.Load(20) + asfloat(uIntSampler.Load(40))) + asfloat(uUintSampler.Load(60)); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert new file mode 100644 index 0000000000..76bd349775 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/struct-composite-decl.vert @@ -0,0 +1,44 @@ +struct VOut +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +static VOut vout; +static float4 a; +static float4 b; +static float4 c; +static float4 d; + +struct SPIRV_Cross_Input +{ + float4 a : TEXCOORD0; + float4 b : TEXCOORD1; + float4 c : TEXCOORD2; + float4 d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + VOut vout : TEXCOORD0; +}; + +void vert_main() +{ + VOut _26 = { a, b, c, d }; + vout = _26; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a = stage_input.a; + b = stage_input.b; + c = stage_input.c; + d = stage_input.d; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.vout = vout; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert new file mode 100644 index 0000000000..1c92f6fe65 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-hlsl/vert/texture_buffer.vert @@ -0,0 +1,21 @@ +Buffer uSamp : register(t4); +RWBuffer uSampo : register(u5); + +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = uSamp.Load(10) + uSampo[100]; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/amd/shader_trinary_minmax.msl21.comp b/third_party/spirv-cross/reference/opt/shaders-msl/amd/shader_trinary_minmax.msl21.comp new file mode 100644 index 0000000000..9c33c22ca8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/amd/shader_trinary_minmax.msl21.comp @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..513f8763a3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct u0_counters +{ + uint c; +}; + +kernel void main0(device u0_counters& u0_counter [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _29 = atomic_fetch_sub_explicit((device atomic_uint*)&u0_counter.c, 1, memory_order_relaxed); + u0.write(uint4(uint(int(gl_GlobalInvocationID.x))), spvTexelBufferCoord(as_type(as_type(_29)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..55c41374c3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct u0_counters +{ + uint c; +}; + +kernel void main0(device u0_counters& u0_counter [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _29 = atomic_fetch_add_explicit((device atomic_uint*)&u0_counter.c, 1, memory_order_relaxed); + u0.write(uint4(uint(int(gl_GlobalInvocationID.x))), spvTexelBufferCoord(as_type(as_type(_29)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..cbbf27d65d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& __restrict _5 [[buffer(0)]], device _4& __restrict _6 [[buffer(1)]]) +{ + _6._m0 = _5._m1 + uint4(_5._m0); + _6._m0 = uint4(_5._m0) + _5._m1; + _6._m0 = _5._m1 + _5._m1; + _6._m0 = uint4(_5._m0 + _5._m0); + _6._m1 = int4(_5._m1 + _5._m1); + _6._m1 = _5._m0 + _5._m0; + _6._m1 = int4(_5._m1) + _5._m0; + _6._m1 = _5._m0 + int4(_5._m1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..a55d8916df --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& __restrict _5 [[buffer(0)]], device _4& __restrict _6 [[buffer(1)]]) +{ + _6._m0 = uint4(int4(_5._m1) < _5._m0); + _6._m0 = uint4(int4(_5._m1) <= _5._m0); + _6._m0 = uint4(_5._m1 < uint4(_5._m0)); + _6._m0 = uint4(_5._m1 <= uint4(_5._m0)); + _6._m0 = uint4(int4(_5._m1) > _5._m0); + _6._m0 = uint4(int4(_5._m1) >= _5._m0); + _6._m0 = uint4(_5._m1 > uint4(_5._m0)); + _6._m0 = uint4(_5._m1 >= uint4(_5._m0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..4176830588 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = uint4(int4(_23) >> _22); + _6._m0 = uint4(_22 >> int4(_23)); + _6._m0 = uint4(int4(_23) >> int4(_23)); + _6._m0 = uint4(_22 >> _22); + _6._m1 = int4(_23) >> int4(_23); + _6._m1 = _22 >> _22; + _6._m1 = int4(_23) >> _22; + _6._m1 = _22 >> int4(_23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..6b80dff310 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = uint4(int4(_23) / _22); + _6._m0 = uint4(_22 / int4(_23)); + _6._m0 = uint4(int4(_23) / int4(_23)); + _6._m0 = uint4(_22 / _22); + _6._m1 = int4(_23) / int4(_23); + _6._m1 = _22 / _22; + _6._m1 = int4(_23) / _22; + _6._m1 = _22 / int4(_23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..1dfca39181 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = _23 >> uint4(_22); + _6._m0 = uint4(_22) >> _23; + _6._m0 = _23 >> _23; + _6._m0 = uint4(_22) >> uint4(_22); + _6._m1 = int4(_23 >> _23); + _6._m1 = int4(uint4(_22) >> uint4(_22)); + _6._m1 = int4(_23 >> uint4(_22)); + _6._m1 = int4(uint4(_22) >> _23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..6dcc14ea8d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,46 @@ +#include +#include + +using namespace metal; + +struct A +{ + int a; + int b; +}; + +struct A_1 +{ + A Data[1]; +}; + +struct A_2 +{ + int a; + int b; + char _m0_final_padding[8]; +}; + +struct A_3 +{ + A_2 Data[1024]; +}; + +struct B +{ + A Data[1]; +}; + +struct B_1 +{ + A_2 Data[1024]; +}; + +kernel void main0(device A_1& C1 [[buffer(0)]], constant A_3& C2 [[buffer(1)]], device B& C3 [[buffer(2)]], constant B_1& C4 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + C1.Data[gl_GlobalInvocationID.x].a = C2.Data[gl_GlobalInvocationID.x].a; + C1.Data[gl_GlobalInvocationID.x].b = C2.Data[gl_GlobalInvocationID.x].b; + C3.Data[gl_GlobalInvocationID.x].a = C4.Data[gl_GlobalInvocationID.x].a; + C3.Data[gl_GlobalInvocationID.x].b = C4.Data[gl_GlobalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp new file mode 100644 index 0000000000..db0ade34b4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct cb5_struct +{ + float4 _m0[5]; +}; + +kernel void main0(constant cb5_struct& cb0_5 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + uint _44 = as_type(as_type(int(gl_LocalInvocationID.x) << 4)) >> 2u; + uint4 _51 = as_type(cb0_5._m0[uint(as_type(as_type(int(gl_LocalInvocationID.x)))) + 1u]); + u0.write(_51.xxxx, spvTexelBufferCoord(_44)); + u0.write(_51.yyyy, spvTexelBufferCoord((_44 + 1u))); + u0.write(_51.zzzz, spvTexelBufferCoord((_44 + 2u))); + u0.write(_51.wwww, spvTexelBufferCoord((_44 + 3u))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp new file mode 100644 index 0000000000..89e8d83ea7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp @@ -0,0 +1,24 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct cb +{ + float value; +}; + +kernel void main0(constant cb& _6 [[buffer(0)]], texture2d _buffer [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _buffer.write(float4(_6.value), spvTexelBufferCoord(((32u * gl_WorkGroupID.x) + gl_LocalInvocationIndex))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp new file mode 100644 index 0000000000..986e909663 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct _19 +{ +}; +struct _5 +{ + int _m0; + _19 _m1; + char _m2_pad[4]; + _19 _m2; + char _m3_pad[4]; + int _m3; +}; + +kernel void main0(device _5& _3 [[buffer(0)]], device _5& _4 [[buffer(1)]]) +{ + _4 = _3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp new file mode 100644 index 0000000000..4bcfeb21ab --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct _19 +{ +}; +struct _5 +{ + int _m0; + char _m1_pad[12]; + _19 _m1; + char _m2_pad[16]; + _19 _m2; + char _m3_pad[16]; + int _m3; +}; + +kernel void main0(constant _5& _3 [[buffer(0)]], device _5& _4 [[buffer(1)]]) +{ + _4 = _3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/duplicate-spec-id.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/duplicate-spec-id.asm.comp new file mode 100644 index 0000000000..90bebdd6fc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/duplicate-spec-id.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct StorageBuffer +{ + float values[1]; +}; + +constant int foo_tmp [[function_constant(0)]]; +constant int foo = is_function_constant_defined(foo_tmp) ? foo_tmp : 1; +constant float bar = is_function_constant_defined(foo_tmp) ? as_type(foo_tmp) : 2.0; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device StorageBuffer& ssbo [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + ssbo.values[gl_LocalInvocationIndex] = float(foo) + bar; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..59fc03a752 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp new file mode 100644 index 0000000000..536556391e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp @@ -0,0 +1,22 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +void _main(thread const uint3& id, texture2d TargetTexture) +{ + float2 loaded = TargetTexture.read(uint2(id.xy)).xy; + float2 storeTemp = loaded + float2(1.0); + TargetTexture.write(storeTemp.xyyy, uint2((id.xy + uint2(1u)))); +} + +kernel void main0(texture2d TargetTexture [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint3 id = gl_WorkGroupID; + uint3 param = id; + _main(param, TargetTexture); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..3584373379 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _6 +{ + int4 _m0; + uint4 _m1; +}; + +struct _7 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _6& __restrict _8 [[buffer(0)]], device _7& __restrict _9 [[buffer(1)]]) +{ + _9._m0 = _8._m1 + uint4(_8._m0); + _9._m0 = uint4(_8._m0) + _8._m1; + _9._m0 = _8._m1 + _8._m1; + _9._m0 = uint4(_8._m0 + _8._m0); + _9._m1 = int4(_8._m1 + _8._m1); + _9._m1 = _8._m0 + _8._m0; + _9._m1 = int4(_8._m1) + _8._m0; + _9._m1 = _8._m0 + int4(_8._m1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp new file mode 100644 index 0000000000..d643379aaf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _29 +{ + spvUnsafeArray, 3> _m0; +}; + +struct _7 +{ + int _m0[1]; +}; + +constant int3 _32 = {}; +constant int _3_tmp [[function_constant(0)]]; +constant int _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 0; +constant int _4_tmp [[function_constant(1)]]; +constant int _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 0; +constant int _5_tmp [[function_constant(2)]]; +constant int _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 0; +constant spvUnsafeArray _36 = spvUnsafeArray({ _3, 0, 0 }); +constant spvUnsafeArray _37 = spvUnsafeArray({ _3, _4, 0 }); +constant spvUnsafeArray _38 = spvUnsafeArray({ _3, _4, _5 }); +constant spvUnsafeArray _39 = spvUnsafeArray({ _4, 0, 0 }); +constant spvUnsafeArray _40 = spvUnsafeArray({ _4, _5, 0 }); +constant spvUnsafeArray _41 = spvUnsafeArray({ _4, _5, _3 }); +constant spvUnsafeArray _42 = spvUnsafeArray({ _5, 0, 0 }); +constant spvUnsafeArray _43 = spvUnsafeArray({ _5, _3, 0 }); +constant spvUnsafeArray _44 = spvUnsafeArray({ _5, _3, _4 }); +constant spvUnsafeArray, 3> _45 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }) }); +constant spvUnsafeArray, 3> _46 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ 0, 0, 0 }) }); +constant spvUnsafeArray, 3> _47 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ _5, _3, _4 }) }); +constant _29 _48 = _29{ spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ _5, _3, _4 }) }) }; +constant int _50 = _48._m0[0][0]; +constant int _51 = _48._m0[1][0]; +constant int _52 = _48._m0[0][1]; +constant int _53 = _48._m0[2][2]; +constant int _54 = _48._m0[2][0]; +constant int _55 = _48._m0[1][1]; +constant bool _56 = (_50 == _51); +constant bool _57 = (_52 == _53); +constant bool _58 = (_54 == _55); +constant int _59 = int(_56); +constant int _60 = int(_57); +constant int _61 = _58 ? 2 : 1; +constant int3 _62 = int3(_3, 0, 0); +constant int3 _63 = int3(0, _4, 0); +constant int3 _64 = int3(0, 0, _5); +constant int3 _65 = int3(_62.x, 0, _62.z); +constant int3 _66 = int3(0, _63.y, _63.x); +constant int3 _67 = int3(_64.z, 0, _64.z); +constant int3 _68 = int3(_65.y, _65.x, _66.y); +constant int3 _69 = int3(_67.z, _68.y, _68.z); +constant int _70 = _69.x; +constant int _71 = _69.y; +constant int _72 = _69.z; +constant int _73 = (_70 - _71); +constant int _74 = (_73 * _72); + +constant spvUnsafeArray _33 = spvUnsafeArray({ 0, 0, 0 }); +constant spvUnsafeArray, 3> _34 = spvUnsafeArray, 3>({ spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }) }); + +kernel void main0(device _7& _8 [[buffer(0)]], device _7& _9 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _9._m0[gl_GlobalInvocationID.x] = _8._m0[gl_GlobalInvocationID.x] + ((((1 - _59) * _60) * (_61 - 1)) * _74); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..672c2b2088 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/quantize.asm.comp @@ -0,0 +1,34 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct SpvHalfTypeSelector; +template <> struct SpvHalfTypeSelector { public: using H = half; }; +template struct SpvHalfTypeSelector> { using H = vec; }; +template::H> +[[clang::optnone]] F spvQuantizeToF16(F fval) +{ + H hval = H(fval); + hval = select(copysign(H(0), hval), hval, isnormal(hval) || isinf(hval) || isnan(hval)); + return F(hval); +} + +struct SSBO0 +{ + float scalar; + float2 vec2_val; + float3 vec3_val; + float4 vec4_val; +}; + +kernel void main0(device SSBO0& _4 [[buffer(0)]]) +{ + _4.scalar = spvQuantizeToF16(_4.scalar); + _4.vec2_val = spvQuantizeToF16(_4.vec2_val); + _4.vec3_val = spvQuantizeToF16(_4.vec3_val); + _4.vec4_val = spvQuantizeToF16(_4.vec4_val); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/relaxed-block-layout.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/relaxed-block-layout.asm.comp new file mode 100644 index 0000000000..6728a4e2d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/relaxed-block-layout.asm.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct foo +{ + uint bar; + packed_float3 baz; + uchar quux; + packed_uchar4 blah; + packed_half2 wibble; +}; + +kernel void main0(device foo& _8 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]]) +{ + _8.bar = gl_LocalInvocationID.x; + _8.baz = float3(gl_GlobalInvocationID); + _8.blah = uchar4(uint4(uint4(uchar4(_8.blah)).xyz + gl_WorkGroupID, 0u)); + _8.wibble = half2(float2(half2(_8.wibble)) * float2(gl_NumWorkGroups.xy)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..1e2880f4e8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; +}; + +constant uint _5_tmp [[function_constant(10)]]; +constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u; +constant uint _6_tmp [[function_constant(12)]]; +constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_5, 20u, _6); + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + _4.a += 1.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp new file mode 100644 index 0000000000..5b1f0a0361 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp @@ -0,0 +1,16 @@ +#include +#include + +using namespace metal; + +struct bufA +{ + uint _data[1]; +}; + +kernel void main0(device bufA& bufA_1 [[buffer(0)]], device bufA& bufB [[buffer(1)]]) +{ + bufA_1._data[0] = 0u; + bufB._data[0] = 0u; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/uint_smulextended.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/uint_smulextended.asm.comp new file mode 100644 index 0000000000..6996f7fd26 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/uint_smulextended.asm.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct _4 +{ + uint _m0[1]; +}; + +struct _20 +{ + uint _m0; + uint _m1; +}; + +kernel void main0(device _4& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]], device _4& _7 [[buffer(2)]], device _4& _8 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _20 _28; + _28._m0 = uint(int(_5._m0[gl_GlobalInvocationID.x]) * int(_6._m0[gl_GlobalInvocationID.x])); + _28._m1 = uint(mulhi(int(_5._m0[gl_GlobalInvocationID.x]), int(_6._m0[gl_GlobalInvocationID.x]))); + _7._m0[gl_GlobalInvocationID.x] = _28._m0; + _8._m0[gl_GlobalInvocationID.x] = _28._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..359e8913fc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct _20 +{ + int _m0; + int _m1; +}; + +struct _5 +{ + int _m0[10]; +}; + +struct _7 +{ + int _m0[10]; +}; + +constant int _28 = {}; + +kernel void main0(device _5& _6 [[buffer(0)]], device _7& _8 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _6._m0[gl_GlobalInvocationID.x] = _8._m0[gl_GlobalInvocationID.x] + (_20{ _28, 200 })._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp new file mode 100644 index 0000000000..0cb22e1761 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _21 +{ + int _m0; + int _m1; +}; + +struct _5 +{ + int _m0[10]; +}; + +struct _7 +{ + int _m0[10]; +}; + +constant int _29 = {}; +constant int _9_tmp [[function_constant(0)]]; +constant int _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 0; +constant _21 _30 = _21{ _9, _29 }; + +kernel void main0(device _5& _6 [[buffer(0)]], device _7& _8 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _6._m0[gl_GlobalInvocationID.x] = (_8._m0[gl_GlobalInvocationID.x] + _30._m0) + (_21{ _29, 200 })._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp new file mode 100644 index 0000000000..a276b400c0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-2.asm.comp @@ -0,0 +1,51 @@ +#include +#include + +using namespace metal; + +struct foo +{ + int a[128]; + uint b; + float2 c; +}; + +struct bar +{ + int d; +}; + +kernel void main0(device foo& buf [[buffer(0)]], constant bar& cb [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + bool _71 = cb.d != 0; + device foo* _72 = _71 ? &buf : nullptr; + device foo* _67 = _72; + device foo* _45 = _72; + thread uint3* _79 = _71 ? &gl_GlobalInvocationID : &gl_LocalInvocationID; + thread uint3* _74 = _79; + device int* _52; + device int* _55; + _52 = &_72->a[0u]; + _55 = &buf.a[0u]; + int _57; + int _58; + for (;;) + { + _57 = *_52; + _58 = *_55; + if (_57 != _58) + { + int _66 = (_57 + _58) + int((*_79).x); + *_52 = _66; + *_55 = _66; + _52 = &_52[1u]; + _55 = &_55[1u]; + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp new file mode 100644 index 0000000000..e1861730f5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct foo +{ + int a; +}; + +struct bar +{ + int b; +}; + +kernel void main0(device foo& x [[buffer(0)]], device bar& y [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + device int* _47 = (gl_GlobalInvocationID.x != 0u) ? &x.a : &y.b; + device int* _40 = _47; + device int* _33 = _47; + int _37 = x.a; + *_47 = 0; + y.b = _37 + _37; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp new file mode 100644 index 0000000000..afbcadd0b9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct cb1_struct +{ + float4 _RESERVED_IDENTIFIER_FIXUP_m0[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u); + +kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + int2 _46 = int2(u0.get_width(), u0.get_height()) >> int2(uint2(4u)); + int _98; + _98 = 0; + for (; _98 < _46.y; _98++) + { + for (int _99 = 0; _99 < _46.x; ) + { + u0.write(cb0_1._RESERVED_IDENTIFIER_FIXUP_m0[0].xxxx, uint2(((_46 * int3(gl_LocalInvocationID).xy) + int2(_98, _99)))); + _99++; + continue; + } + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp new file mode 100644 index 0000000000..e572525ebd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct cb1_struct +{ + float4 _RESERVED_IDENTIFIER_FIXUP_m0[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u); + +kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + int2 _40 = int2(u0.get_width(), u0.get_height()) >> int2(uint2(4u)); + int _80; + _80 = 0; + for (; _80 < _40.y; _80++) + { + for (int _81 = 0; _81 < _40.x; ) + { + u0.write(cb0_1._RESERVED_IDENTIFIER_FIXUP_m0[0].xxxx, uint2(((_40 * int3(gl_LocalInvocationID).xy) + int2(_80, _81)))); + _81++; + continue; + } + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..703dd0a951 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uSampler [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample(uSampler, in.vUV); + out.FragColor += uTex.sample(uSampler, in.vUV, int2(1)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..82b41d1a8a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/default-member-names.asm.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +constant float _49 = {}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.m_3 = float4(_49); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag new file mode 100644 index 0000000000..be9f1331e3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + float4 _m0[64]; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +struct main0_in +{ + float4 m_2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], device _7& _10 [[buffer(0)]], texture2d _8 [[texture(0)]]) +{ + main0_out out = {}; + for (int _154 = 0; _154 < 64; ) + { + _10._m0[_154] = _8.read(uint2(int2(_154 - 8 * (_154 / 8), _154 / 8)), 0); + _154++; + continue; + } + out.m_3 = in.m_2; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag new file mode 100644 index 0000000000..bbe0acd75b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + float4 _m0[64]; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +struct main0_in +{ + float4 m_2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], device _7& _10 [[buffer(0)]], texture2d _8 [[texture(0)]], sampler _9 [[sampler(0)]]) +{ + main0_out out = {}; + for (int _158 = 0; _158 < 64; ) + { + _10._m0[_158] = _8.sample(_9, (float2(int2(_158 - 8 * (_158 / 8), _158 / 8)) * float2(0.125)), level(0.0)); + _158++; + continue; + } + out.m_3 = in.m_2; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag new file mode 100644 index 0000000000..58f02ad072 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct _4 +{ + float4 _m0; +}; + +struct _6 +{ + int _m0; +}; + +struct _7 +{ + float4 _m0; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +fragment main0_out main0(const device _4* _5_0 [[buffer(0)]], const device _4* _5_1 [[buffer(1)]], const device _4* _5_2 [[buffer(2)]], const device _4* _5_3 [[buffer(3)]], constant _6& _20 [[buffer(4)]], constant _7* _8_0 [[buffer(5)]], constant _7* _8_1 [[buffer(6)]], constant _7* _8_2 [[buffer(7)]], constant _7* _8_3 [[buffer(8)]]) +{ + const device _4* _5[] = + { + _5_0, + _5_1, + _5_2, + _5_3, + }; + + constant _7* _8[] = + { + _8_0, + _8_1, + _8_2, + _8_3, + }; + + main0_out out = {}; + out.m_3 = fma(_8[_20._m0]->_m0, float4(0.20000000298023223876953125), _5[_20._m0]->_m0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag new file mode 100644 index 0000000000..b64ccabe6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o1 [[color(1)]]; + float4 o3 [[color(3)]]; + float4 o6 [[color(6)]]; + float4 o7 [[color(7)]]; +}; + +fragment main0_out main0() +{ + float4 o0; + float4 o2; + float4 o4; + float4 o5; + float gl_FragDepth; + int gl_FragStencilRefARB; + main0_out out = {}; + o0 = float4(0.0, 0.0, 0.0, 1.0); + out.o1 = float4(1.0, 0.0, 0.0, 1.0); + o2 = float4(0.0, 1.0, 0.0, 1.0); + out.o3 = float4(0.0, 0.0, 1.0, 1.0); + o4 = float4(1.0, 0.0, 1.0, 0.5); + o5 = float4(0.25); + out.o6 = float4(0.75); + out.o7 = float4(1.0); + gl_FragDepth = 0.89999997615814208984375; + gl_FragStencilRefARB = uint(127); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..92ac1d9f83 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag new file mode 100644 index 0000000000..09f8ed8c0d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + packed_float3 a; + float b; +}; + +struct buf +{ + Foo results[16]; + float4 bar; +}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +fragment main0_out main0(constant buf& _11 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int _68 = int(gl_FragCoord.x) % 16; + out._entryPointOutput = float4(dot(float3(_11.results[_68].a), _11.bar.xyz), _11.results[_68].b, 0.0, 0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..ebc73d52df --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/frem.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = fmod(in.vA, in.vB); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..64edee8722 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(10.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..0d691b306d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + int2 Size [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.Size = int2(uTexture.get_width(), uTexture.get_height()) + int2(uTexture.get_width(1), uTexture.get_height(1)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..dd977a99da --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,50 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 v0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uImage [[texture(0)]], sampler uImageSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float phi; + float4 _36; + int _51; + _51 = 0; + phi = 1.0; + _36 = float4(1.0, 2.0, 1.0, 2.0); + for (;;) + { + out.FragColor = _36; + if (_51 < 4) + { + if (in.v0[_51] > 0.0) + { + float2 _48 = float2(phi); + _51++; + phi += 2.0; + _36 = uImage.sample(uImageSmplr, _48, level(0.0)); + continue; + } + else + { + break; + } + } + else + { + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..067719896b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float3(as_type(0x7f800000u /* inf */), as_type(0xff800000u /* -inf */), as_type(0x7fc00000u /* nan */)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag new file mode 100644 index 0000000000..fe49e09aa4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct Input +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 inp_v0 [[user(locn0)]]; + float2 inp_v1 [[user(locn1), center_no_perspective]]; + float3 inp_v2 [[user(locn2), centroid_perspective]]; + float4 inp_v3 [[user(locn3), centroid_no_perspective]]; + float inp_v4 [[user(locn4), sample_perspective]]; + float inp_v5 [[user(locn5), sample_no_perspective]]; + float inp_v6 [[user(locn6), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Input inp = {}; + inp.v0 = in.inp_v0; + inp.v1 = in.inp_v1; + inp.v2 = in.inp_v2; + inp.v3 = in.inp_v3; + inp.v4 = in.inp_v4; + inp.v5 = in.inp_v5; + inp.v6 = in.inp_v6; + out.FragColor = float4(inp.v0.x + inp.v1.y, inp.v2.xy, fma(inp.v3.w, inp.v4, inp.v5) - inp.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..27b7d4771f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,87 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vColor [[user(locn0)]]; +}; + +#line 8 "test.frag" +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; +#line 8 "test.frag" + out.FragColor = 1.0; +#line 9 "test.frag" + out.FragColor = 2.0; +#line 10 "test.frag" + if (in.vColor < 0.0) + { +#line 12 "test.frag" + out.FragColor = 3.0; + } + else + { +#line 16 "test.frag" + out.FragColor = 4.0; + } +#line 19 "test.frag" + for (int _127 = 0; float(_127) < (40.0 + in.vColor); ) + { +#line 21 "test.frag" + out.FragColor += 0.20000000298023223876953125; +#line 22 "test.frag" + out.FragColor += 0.300000011920928955078125; +#line 19 "test.frag" + _127 += (int(in.vColor) + 5); + continue; + } +#line 25 "test.frag" + switch (int(in.vColor)) + { + case 0: + { +#line 28 "test.frag" + out.FragColor += 0.20000000298023223876953125; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + out.FragColor += 0.4000000059604644775390625; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + out.FragColor += 0.800000011920928955078125; +#line 37 "test.frag" + break; + } + } + for (;;) + { +#line 42 "test.frag" + out.FragColor += (10.0 + in.vColor); +#line 43 "test.frag" + if (out.FragColor < 100.0) + { + } + else + { + break; + } + } +#line 48 "test.frag" + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..07ab82ac1f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/locations-components.asm.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o0 [[color(0)]]; +}; + +struct main0_in +{ + float2 m_2 [[user(locn1)]]; + float m_3 [[user(locn1_2)]]; + float m_4 [[user(locn2), flat]]; + uint m_5 [[user(locn2_1)]]; + uint m_6 [[user(locn2_2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 v1; + v1 = float4(in.m_2.x, in.m_2.y, v1.z, v1.w); + v1.z = in.m_3; + float4 v2; + v2.x = in.m_4; + v2.y = as_type(in.m_5); + v2.z = as_type(in.m_6); + out.o0.y = float(as_type(as_type(as_type(v2.y) + as_type(v2.z)))); + out.o0.x = v1.y + v2.x; + out.o0 = float4(out.o0.x, out.o0.y, v1.z, v1.x); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..726976631a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,94 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _46 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 }); +constant spvUnsafeArray _76 = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); +constant spvUnsafeArray _90 = spvUnsafeArray({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) }); + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + spvUnsafeArray foobar = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + spvUnsafeArray baz = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + main0_out out = {}; + out.FragColor = _46[in.index]; + if (in.index < 10) + { + out.FragColor += _46[in.index ^ 1]; + } + else + { + out.FragColor += _46[in.index & 1]; + } + bool _99 = in.index > 30; + if (_99) + { + out.FragColor += _76[in.index & 3].y; + } + else + { + out.FragColor += _76[in.index & 1].x; + } + if (_99) + { + foobar[1].z = 20.0; + } + int _37 = in.index & 3; + out.FragColor += foobar[_37].z; + baz = _90; + out.FragColor += baz[_37].z; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/min-lod.msl22.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/min-lod.msl22.asm.frag new file mode 100644 index 0000000000..5193b2cda8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/min-lod.msl22.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uSampler.sample(uSamplerSmplr, in.vUV, min_lod_clamp(4.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..e1badb517a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = 0.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-image-sampled-image.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-image-sampled-image.asm.frag new file mode 100644 index 0000000000..807fde3f49 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/op-image-sampled-image.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct push_cb +{ + float4 cb0[1]; +}; + +struct main0_out +{ + float4 o0 [[color(0)]]; +}; + +fragment main0_out main0(constant push_cb& _19 [[buffer(0)]], texture2d t0 [[texture(0)]], sampler dummy_sampler [[sampler(0)]]) +{ + main0_out out = {}; + out.o0 = t0.read(uint2(as_type(_19.cb0[0u].zw)) + uint2(int2(-1, -2)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..3858f6dac7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct Registers +{ + float foo; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant Registers& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = 10.0 + registers.foo; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..92ac1d9f83 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag new file mode 100644 index 0000000000..6a6b1622d2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag @@ -0,0 +1,181 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _13 +{ + float4 x; + float4 y; + float4 z; + spvUnsafeArray u; + spvUnsafeArray v; + spvUnsafeArray w; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + interpolant foo [[user(locn0)]]; + interpolant bar [[user(locn1)]]; + interpolant baz [[user(locn2)]]; + int sid [[user(locn3)]]; + interpolant a_0 [[user(locn4)]]; + interpolant a_1 [[user(locn5)]]; + interpolant b_0 [[user(locn6)]]; + interpolant b_1 [[user(locn7)]]; + interpolant c_0 [[user(locn8)]]; + interpolant c_1 [[user(locn9)]]; + interpolant s_x [[user(locn10)]]; + interpolant s_y [[user(locn11)]]; + interpolant s_z [[user(locn12)]]; + interpolant s_u_0 [[user(locn13)]]; + interpolant s_u_1 [[user(locn14)]]; + interpolant s_v_0 [[user(locn15)]]; + interpolant s_v_1 [[user(locn16)]]; + interpolant s_w_0 [[user(locn17)]]; + interpolant s_w_1 [[user(locn18)]]; + interpolant s_w_2 [[user(locn19)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + spvUnsafeArray a = {}; + _13 s = {}; + spvUnsafeArray b = {}; + spvUnsafeArray c = {}; + a[0] = in.a_0.interpolate_at_center(); + a[1] = in.a_1.interpolate_at_center(); + s.x = in.s_x.interpolate_at_center(); + s.y = in.s_y.interpolate_at_centroid(); + s.z = in.s_z.interpolate_at_sample(gl_SampleID); + s.u[0] = in.s_u_0.interpolate_at_centroid(); + s.u[1] = in.s_u_1.interpolate_at_centroid(); + s.v[0] = in.s_v_0.interpolate_at_sample(gl_SampleID); + s.v[1] = in.s_v_1.interpolate_at_sample(gl_SampleID); + s.w[0] = in.s_w_0.interpolate_at_center(); + s.w[1] = in.s_w_1.interpolate_at_center(); + s.w[2] = in.s_w_2.interpolate_at_center(); + b[0] = in.b_0.interpolate_at_centroid(); + b[1] = in.b_1.interpolate_at_centroid(); + c[0] = in.c_0.interpolate_at_sample(gl_SampleID); + c[1] = in.c_1.interpolate_at_sample(gl_SampleID); + out.FragColor = in.foo.interpolate_at_center(); + out.FragColor += in.foo.interpolate_at_centroid(); + out.FragColor += in.foo.interpolate_at_sample(in.sid); + out.FragColor += in.foo.interpolate_at_offset(float2(0.100000001490116119384765625) + 0.4375); + float3 _65 = out.FragColor.xyz + in.bar.interpolate_at_centroid(); + out.FragColor = float4(_65.x, _65.y, _65.z, out.FragColor.w); + float3 _71 = out.FragColor.xyz + in.bar.interpolate_at_centroid(); + out.FragColor = float4(_71.x, _71.y, _71.z, out.FragColor.w); + float3 _78 = out.FragColor.xyz + in.bar.interpolate_at_sample(in.sid); + out.FragColor = float4(_78.x, _78.y, _78.z, out.FragColor.w); + float3 _84 = out.FragColor.xyz + in.bar.interpolate_at_offset(float2(-0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_84.x, _84.y, _84.z, out.FragColor.w); + float2 _91 = out.FragColor.xy + b[0]; + out.FragColor = float4(_91.x, _91.y, out.FragColor.z, out.FragColor.w); + float2 _98 = out.FragColor.xy + in.b_1.interpolate_at_centroid(); + out.FragColor = float4(_98.x, _98.y, out.FragColor.z, out.FragColor.w); + float2 _105 = out.FragColor.xy + in.b_0.interpolate_at_sample(2); + out.FragColor = float4(_105.x, _105.y, out.FragColor.z, out.FragColor.w); + float2 _112 = out.FragColor.xy + in.b_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_112.x, _112.y, out.FragColor.z, out.FragColor.w); + float2 _119 = out.FragColor.xy + c[0]; + out.FragColor = float4(_119.x, _119.y, out.FragColor.z, out.FragColor.w); + float2 _127 = out.FragColor.xy + in.c_1.interpolate_at_centroid().xy; + out.FragColor = float4(_127.x, _127.y, out.FragColor.z, out.FragColor.w); + float2 _135 = out.FragColor.xy + in.c_0.interpolate_at_sample(2).yx; + out.FragColor = float4(_135.x, _135.y, out.FragColor.z, out.FragColor.w); + float2 _143 = out.FragColor.xy + in.c_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).xx; + out.FragColor = float4(_143.x, _143.y, out.FragColor.z, out.FragColor.w); + out.FragColor += s.x; + out.FragColor += in.s_x.interpolate_at_centroid(); + out.FragColor += in.s_x.interpolate_at_sample(in.sid); + out.FragColor += in.s_x.interpolate_at_offset(float2(0.100000001490116119384765625) + 0.4375); + out.FragColor += s.y; + out.FragColor += in.s_y.interpolate_at_centroid(); + out.FragColor += in.s_y.interpolate_at_sample(in.sid); + out.FragColor += in.s_y.interpolate_at_offset(float2(-0.100000001490116119384765625) + 0.4375); + float2 _184 = out.FragColor.xy + s.v[0]; + out.FragColor = float4(_184.x, _184.y, out.FragColor.z, out.FragColor.w); + float2 _191 = out.FragColor.xy + in.s_v_1.interpolate_at_centroid(); + out.FragColor = float4(_191.x, _191.y, out.FragColor.z, out.FragColor.w); + float2 _198 = out.FragColor.xy + in.s_v_0.interpolate_at_sample(2); + out.FragColor = float4(_198.x, _198.y, out.FragColor.z, out.FragColor.w); + float2 _205 = out.FragColor.xy + in.s_v_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_205.x, _205.y, out.FragColor.z, out.FragColor.w); + out.FragColor.x += s.w[0]; + out.FragColor.x += in.s_w_1.interpolate_at_centroid(); + out.FragColor.x += in.s_w_0.interpolate_at_sample(2); + out.FragColor.x += in.s_w_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + float2 _328 = out.FragColor.xy + in.baz.interpolate_at_sample(gl_SampleID); + out.FragColor = float4(_328.x, _328.y, out.FragColor.z, out.FragColor.w); + out.FragColor.x += in.baz.interpolate_at_centroid().x; + out.FragColor.y += in.baz.interpolate_at_sample(3).y; + out.FragColor.z += in.baz.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).y; + float2 _353 = out.FragColor.xy + in.a_1.interpolate_at_centroid(); + out.FragColor = float4(_353.x, _353.y, out.FragColor.z, out.FragColor.w); + float2 _360 = out.FragColor.xy + in.a_0.interpolate_at_sample(2); + out.FragColor = float4(_360.x, _360.y, out.FragColor.z, out.FragColor.w); + float2 _367 = out.FragColor.xy + in.a_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_367.x, _367.y, out.FragColor.z, out.FragColor.w); + out.FragColor += s.z; + float2 _379 = out.FragColor.xy + in.s_z.interpolate_at_centroid().yy; + out.FragColor = float4(_379.x, _379.y, out.FragColor.z, out.FragColor.w); + float2 _387 = out.FragColor.yz + in.s_z.interpolate_at_sample(3).xy; + out.FragColor = float4(out.FragColor.x, _387.x, _387.y, out.FragColor.w); + float2 _395 = out.FragColor.zw + in.s_z.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).wx; + out.FragColor = float4(out.FragColor.x, out.FragColor.y, _395.x, _395.y); + out.FragColor += s.u[0]; + out.FragColor += in.s_u_1.interpolate_at_centroid(); + out.FragColor += in.s_u_0.interpolate_at_sample(2); + out.FragColor += in.s_u_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..aed8fd382a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float out_var_SV_Target [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d g_Texture [[texture(0)]], sampler g_Sampler [[sampler(0)]], sampler g_CompareSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = float4(g_Texture.sample(g_Sampler, in.in_var_TEXCOORD0)).x + g_Texture.sample_compare(g_CompareSampler, in.in_var_TEXCOORD0, 0.5, level(0.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..6ae5ec7844 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myType +{ + float data; +}; + +struct main0_out +{ + float4 o_color [[color(0)]]; +}; + +fragment main0_out main0(float4 gl_FragCoord [[position]]) +{ + spvUnsafeArray _21 = spvUnsafeArray({ myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } }); + + main0_out out = {}; + if (_21[int(mod(gl_FragCoord.x, 4.0))].data > 0.0) + { + out.o_color = float4(0.0, 1.0, 0.0, 1.0); + } + else + { + out.o_color = float4(1.0, 0.0, 0.0, 1.0); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..f0cdd574de --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/srem.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int4 vA [[user(locn0)]]; + int4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.vA - in.vB * (in.vA / in.vB)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..d59013daaf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,65 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _20 = spvUnsafeArray({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) }); + +struct main0_out +{ + float4 FragColors_0 [[color(0)]]; + float4 FragColors_1 [[color(1)]]; + float4 FragColor [[color(2)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + spvUnsafeArray FragColors = spvUnsafeArray({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) }); + out.FragColor = float4(5.0); + out.FragColors_0 = FragColors[0]; + out.FragColors_1 = FragColors[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-different-sizes.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-different-sizes.asm.frag new file mode 100644 index 0000000000..92ac1d9f83 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-different-sizes.asm.frag @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag new file mode 100644 index 0000000000..92ac1d9f83 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag new file mode 100644 index 0000000000..92ac1d9f83 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..dd308c32ad --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag new file mode 100644 index 0000000000..ab5be64984 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag @@ -0,0 +1,121 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + spvUnsafeArray _m0; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _102 = float3(_100.x, _100.y, _70.z); + _102.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102)) + { + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag new file mode 100644 index 0000000000..ca5e3eadb7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + spvUnsafeArray _m0; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0]; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _102 = float3(_100.x, _100.y, _70.z); + _102.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _186 = clamp(_103 + 1u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u); + if (all(CulledObjectBoxBounds._m0[_186].xy > _96.xy) && all(CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz < _102)) + { + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[int(clamp(uint(_160), uint(0), uint(7)))] - (float3(0.5) * (CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz + CulledObjectBoxBounds._m0[_186].xyz)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 2u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 3u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 4u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..97345820b6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + half4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + half2 UV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = half4(uTexture.sample(uTextureSmplr, float2(in.UV))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..a5380c51dc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out._entryPointOutput = float4(1.0, 1.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..dc87406538 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow [[texture(0)]], depth2d uTexture [[texture(1)]], sampler uShadowSmplr [[sampler(0)]], sampler uSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = uShadow.sample_compare(uShadowSmplr, in.vUV.xy, in.vUV.z) + uTexture.sample_compare(uSampler, in.vUV.xy, in.vUV.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.asm.frag new file mode 100644 index 0000000000..aee290f5a2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(a + b); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag new file mode 100644 index 0000000000..aee290f5a2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(a + b); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..918a0b9c13 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/unreachable.asm.frag @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int counter [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _33; + for (;;) + { + if (in.counter == 10) + { + _33 = float4(10.0); + break; + } + else + { + _33 = float4(30.0); + break; + } + } + out.FragColor = _33; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..2031b335d4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,277 @@ +#include +#include + +using namespace metal; + +struct _28 +{ + float4 _m0; +}; + +struct _6 +{ + float4 _m0; + float _m1; + float4 _m2; +}; + +struct _10 +{ + float3 _m0; + packed_float3 _m1; + float _m2; + packed_float3 _m3; + float _m4; + packed_float3 _m5; + float _m6; + packed_float3 _m7; + float _m8; + packed_float3 _m9; + float _m10; + packed_float3 _m11; + float _m12; + float2 _m13; + float2 _m14; + packed_float3 _m15; + float _m16; + float _m17; + float _m18; + float _m19; + float _m20; + float4 _m21; + float4 _m22; + float4x4 _m23; + float4 _m24; +}; + +struct _18 +{ + float4x4 _m0; + float4x4 _m1; + float4x4 _m2; + float4x4 _m3; + float4 _m4; + float4 _m5; + float _m6; + float _m7; + float _m8; + float _m9; + packed_float3 _m10; + float _m11; + packed_float3 _m12; + float _m13; + packed_float3 _m14; + float _m15; + packed_float3 _m16; + float _m17; + float _m18; + float _m19; + float2 _m20; + float2 _m21; + float2 _m22; + float4 _m23; + float2 _m24; + float2 _m25; + float2 _m26; + char _m27_pad[8]; + packed_float3 _m27; + float _m28; + float _m29; + float _m30; + float _m31; + float _m32; + float2 _m33; + float _m34; + float _m35; + float3 _m36; + float4x4 _m37[2]; + float4 _m38[2]; +}; + +struct main0_out +{ + float4 m_5 [[color(0)]]; +}; + +fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d _8 [[texture(0)]], texture2d _12 [[texture(1)]], texture2d _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _88 = _7._m2 * _7._m0.xyxy; + float2 _95 = _88.xy; + float2 _96 = _88.zw; + float2 _97 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(0.0, -2.0) * _7._m0.xy), _95, _96); + float3 _109 = float3(_11._m5) * fast::clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _113 = _12.sample(_13, _97, level(0.0)); + float _114 = _113.y; + float3 _129; + if (_114 > 0.0) + { + _129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * fast::clamp(_114 * _113.z, 0.0, 1.0)); + } + else + { + _129 = _109; + } + float2 _144 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(-1.0) * _7._m0.xy), _95, _96); + float3 _156 = float3(_11._m5) * fast::clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _160 = _12.sample(_13, _144, level(0.0)); + float _161 = _160.y; + float3 _176; + if (_161 > 0.0) + { + _176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * fast::clamp(_161 * _160.z, 0.0, 1.0)); + } + else + { + _176 = _156; + } + float2 _191 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(0.0, -1.0) * _7._m0.xy), _95, _96); + float3 _203 = float3(_11._m5) * fast::clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _207 = _12.sample(_13, _191, level(0.0)); + float _208 = _207.y; + float3 _223; + if (_208 > 0.0) + { + _223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * fast::clamp(_208 * _207.z, 0.0, 1.0)); + } + else + { + _223 = _203; + } + float2 _238 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(1.0, -1.0) * _7._m0.xy), _95, _96); + float3 _250 = float3(_11._m5) * fast::clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _254 = _12.sample(_13, _238, level(0.0)); + float _255 = _254.y; + float3 _270; + if (_255 > 0.0) + { + _270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * fast::clamp(_255 * _254.z, 0.0, 1.0)); + } + else + { + _270 = _250; + } + float2 _285 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(-2.0, 0.0) * _7._m0.xy), _95, _96); + float3 _297 = float3(_11._m5) * fast::clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _301 = _12.sample(_13, _285, level(0.0)); + float _302 = _301.y; + float3 _317; + if (_302 > 0.0) + { + _317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * fast::clamp(_302 * _301.z, 0.0, 1.0)); + } + else + { + _317 = _297; + } + float2 _332 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(-1.0, 0.0) * _7._m0.xy), _95, _96); + float3 _344 = float3(_11._m5) * fast::clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _348 = _12.sample(_13, _332, level(0.0)); + float _349 = _348.y; + float3 _364; + if (_349 > 0.0) + { + _364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * fast::clamp(_349 * _348.z, 0.0, 1.0)); + } + else + { + _364 = _344; + } + float2 _379 = fast::clamp(gl_FragCoord.xy * _19._m23.xy, _95, _96); + float3 _391 = float3(_11._m5) * fast::clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _395 = _12.sample(_13, _379, level(0.0)); + float _396 = _395.y; + float3 _411; + if (_396 > 0.0) + { + _411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * fast::clamp(_396 * _395.z, 0.0, 1.0)); + } + else + { + _411 = _391; + } + float2 _426 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(1.0, 0.0) * _7._m0.xy), _95, _96); + float3 _438 = float3(_11._m5) * fast::clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _442 = _12.sample(_13, _426, level(0.0)); + float _443 = _442.y; + float3 _458; + if (_443 > 0.0) + { + _458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * fast::clamp(_443 * _442.z, 0.0, 1.0)); + } + else + { + _458 = _438; + } + float2 _473 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(2.0, 0.0) * _7._m0.xy), _95, _96); + float3 _485 = float3(_11._m5) * fast::clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _489 = _12.sample(_13, _473, level(0.0)); + float _490 = _489.y; + float3 _505; + if (_490 > 0.0) + { + _505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * fast::clamp(_490 * _489.z, 0.0, 1.0)); + } + else + { + _505 = _485; + } + float2 _520 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(-1.0, 1.0) * _7._m0.xy), _95, _96); + float3 _532 = float3(_11._m5) * fast::clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _536 = _12.sample(_13, _520, level(0.0)); + float _537 = _536.y; + float3 _552; + if (_537 > 0.0) + { + _552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * fast::clamp(_537 * _536.z, 0.0, 1.0)); + } + else + { + _552 = _532; + } + float2 _567 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(0.0, 1.0) * _7._m0.xy), _95, _96); + float3 _579 = float3(_11._m5) * fast::clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _583 = _12.sample(_13, _567, level(0.0)); + float _584 = _583.y; + float3 _599; + if (_584 > 0.0) + { + _599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * fast::clamp(_584 * _583.z, 0.0, 1.0)); + } + else + { + _599 = _579; + } + float2 _614 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, _7._m0.xy), _95, _96); + float3 _626 = float3(_11._m5) * fast::clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _630 = _12.sample(_13, _614, level(0.0)); + float _631 = _630.y; + float3 _646; + if (_631 > 0.0) + { + _646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * fast::clamp(_631 * _630.z, 0.0, 1.0)); + } + else + { + _646 = _626; + } + float2 _661 = fast::clamp(fma(gl_FragCoord.xy, _19._m23.xy, float2(0.0, 2.0) * _7._m0.xy), _95, _96); + float3 _673 = float3(_11._m5) * fast::clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _677 = _12.sample(_13, _661, level(0.0)); + float _678 = _677.y; + float3 _693; + if (_678 > 0.0) + { + _693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * fast::clamp(_678 * _677.z, 0.0, 1.0)); + } + else + { + _693 = _673; + } + float3 _702 = (((((((((((((_129 * 0.5).xyz + (_176 * 0.5)).xyz + (_223 * 0.75)).xyz + (_270 * 0.5)).xyz + (_317 * 0.5)).xyz + (_364 * 0.75)).xyz + (_411 * 1.0)).xyz + (_458 * 0.75)).xyz + (_505 * 0.5)).xyz + (_552 * 0.5)).xyz + (_599 * 0.75)).xyz + (_646 * 0.5)).xyz + (_693 * 0.5)).xyz * float3(0.125); + _28 _750 = _28{ float4(_702.x, _702.y, _702.z, float4(0.0).w) }; + _750._m0.w = 1.0; + out.m_5 = _750._m0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc new file mode 100644 index 0000000000..6c9903e02b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct TessLevels +{ + float inner0; + float inner1; + float outer0; + float outer1; + float outer2; + float outer3; +}; + +kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(sb_levels.outer1); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(sb_levels.outer2); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc new file mode 100644 index 0000000000..79395a4bbb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct TessLevels +{ + float inner0; + float inner1; + float outer0; + float outer1; + float outer2; + float outer3; +}; + +kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(sb_levels.outer1); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(sb_levels.outer2); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese new file mode 100644 index 0000000000..bfa96f9cfb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + out.gl_Position = float4(fma(gl_TessCoord.x * gl_TessLevelInner[0], gl_TessLevelOuter[0], ((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), fma(gl_TessCoord.y * gl_TessLevelInner[1], gl_TessLevelOuter[1], ((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert new file mode 100644 index 0000000000..1528c8350d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.pos; + out.gl_ClipDistance[0] = in.pos.x; + out.gl_ClipDistance[1] = in.pos.y; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert new file mode 100644 index 0000000000..1d6885958c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.pos; + out.gl_ClipDistance[0] = in.pos.x; + out.gl_ClipDistance[1] = in.pos.y; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/copy-memory-interface.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/copy-memory-interface.asm.vert new file mode 100644 index 0000000000..63ab796e8e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/copy-memory-interface.asm.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o1 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v0 [[attribute(0)]]; + float4 v1 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.v0; + out.o1 = in.v1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..f1b7a87804 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct InstanceData +{ + float4x4 MATRIX_MVP; + float4 Color; +}; + +struct gInstanceData +{ + InstanceData _data[1]; +}; + +struct main0_out +{ + float4 _entryPointOutput_Color [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 PosL [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], const device gInstanceData& gInstanceData_1 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + out.gl_Position = float4(in.PosL, 1.0) * gInstanceData_1._data[gl_InstanceIndex].MATRIX_MVP; + out._entryPointOutput_Color = gInstanceData_1._data[gl_InstanceIndex].Color; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/fake-builtin-input.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/fake-builtin-input.asm.vert new file mode 100644 index 0000000000..3079ae9bcb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/fake-builtin-input.asm.vert @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + half4 out_var_SV_Target [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 in_var_POSITION [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = float4(in.in_var_POSITION, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/invariant.msl21.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/invariant.msl21.asm.vert new file mode 100644 index 0000000000..88ca455e15 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/invariant.msl21.asm.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position, invariant]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert new file mode 100644 index 0000000000..1926ff9e14 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _9 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _9.umatrix * float4(_9.uquad[int(gl_VertexIndex)].x, _9.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_9.flags.flags[0] != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert new file mode 100644 index 0000000000..ee20638574 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint2 flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _9 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _9.umatrix * float4(_9.uquad[int(gl_VertexIndex)].x, _9.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_9.flags.flags[0].x != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert new file mode 100644 index 0000000000..9e024c2095 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/packing-test.asm.vert @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +vertex void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..196057a79d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +constant int _7_tmp [[function_constant(201)]]; +constant int _7 = is_function_constant_defined(_7_tmp) ? _7_tmp : -10; +constant int _20 = (_7 + 2); +constant uint _8_tmp [[function_constant(202)]]; +constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u; +constant uint _25 = (_8 % 5u); +constant int _30 = _7 - (-3) * (_7 / (-3)); +constant int4 _32 = int4(20, 30, _20, _30); +constant int2 _34 = int2(_32.y, _32.x); +constant int _35 = _32.y; + +struct main0_out +{ + int m_4 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + float4 _66 = float4(0.0); + _66.y = float(_20); + _66.z = float(_25); + float4 _55 = _66 + float4(_32); + float2 _59 = _55.xy + float2(_34); + out.gl_Position = float4(_59.x, _59.y, _55.z, _55.w); + out.m_4 = _35; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..d453aadef0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + out.gl_Position = float4(float(gl_VertexIndex + gl_InstanceIndex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/access-private-workgroup-in-function.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/access-private-workgroup-in-function.comp new file mode 100644 index 0000000000..e57b2ea171 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/access-private-workgroup-in-function.comp @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp new file mode 100644 index 0000000000..18cfd68c19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct SSBO3 +{ + float4 v; +}; + +struct SSBO0 +{ + float4 v; +}; + +struct SSBO1 +{ + float4 v; +}; + +struct SSBO2 +{ + float4 v; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + const device SSBO0* ssbo0 [[id(0)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + const device SSBO1* ssbo1 [[id(0)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], const device SSBO2& ssbo2 [[buffer(3)]]) +{ + ssbo3.v = ((*spvDescriptorSet0.ssbo0).v + (*spvDescriptorSet1.ssbo1).v) + ssbo2.v; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp new file mode 100644 index 0000000000..25a0233aec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +kernel void main0(texture2d uImage [[texture(0)]], texture2d uImageRead [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int2 _17 = int2(gl_GlobalInvocationID.xy); + uImage.write(uImageRead.read(uint2(_17)), uint2(_17)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp new file mode 100644 index 0000000000..2f8067e55a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct spvDescriptorSetBuffer0 +{ + texture2d uImage [[id(0)]]; + texture2d uImageRead [[id(1)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int2 _17 = int2(gl_GlobalInvocationID.xy); + spvDescriptorSet0.uImage.write(spvDescriptorSet0.uImageRead.read(uint2(_17)), uint2(_17)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.comp new file mode 100644 index 0000000000..5a284b9666 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + uint size; + float4 v[1]; +}; + +struct SSBO1 +{ + float bz[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO& _14 [[buffer(0)]], device SSBO1* ssbos_0 [[buffer(1)]], device SSBO1* ssbos_1 [[buffer(2)]]) +{ + device SSBO1* ssbos[] = + { + ssbos_0, + ssbos_1, + }; + + constant uint& _14BufferSize = spvBufferSizeConstants[0]; + constant uint* ssbosBufferSize = &spvBufferSizeConstants[1]; + _14.size = uint(int((_14BufferSize - 16) / 16) + int((ssbosBufferSize[1] - 0) / 4)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.msl2.argument.discrete.comp new file mode 100644 index 0000000000..d804e18767 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/array-length.msl2.argument.discrete.comp @@ -0,0 +1,56 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + uint size; + float4 v[1]; +}; + +struct SSBO1 +{ + float bz[1]; +}; + +struct SSBO2 +{ + uint size2; + float4 w[1]; +}; + +struct SSBO3 +{ + float bz[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO* m_16 [[id(0)]]; + constant uint* spvBufferSizeConstants [[id(1)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + device SSBO1* ssbos [[id(0)]][2]; + constant uint* spvBufferSizeConstants [[id(2)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO2& _38 [[buffer(2)]], device SSBO3* ssbos2_0 [[buffer(3)]], device SSBO3* ssbos2_1 [[buffer(4)]]) +{ + device SSBO3* ssbos2[] = + { + ssbos2_0, + ssbos2_1, + }; + + constant uint& spvDescriptorSet0_m_16BufferSize = spvDescriptorSet0.spvBufferSizeConstants[0]; + constant uint* spvDescriptorSet1_ssbosBufferSize = &spvDescriptorSet1.spvBufferSizeConstants[0]; + constant uint& _38BufferSize = spvBufferSizeConstants[2]; + constant uint* ssbos2BufferSize = &spvBufferSizeConstants[3]; + (*spvDescriptorSet0.m_16).size = ((uint(int((spvDescriptorSet0_m_16BufferSize - 16) / 16)) + uint(int((spvDescriptorSet1_ssbosBufferSize[1] - 0) / 4))) + uint(int((_38BufferSize - 16) / 16))) + uint(int((ssbos2BufferSize[0] - 0) / 4)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic-float.msl3.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic-float.msl3.comp new file mode 100644 index 0000000000..051bfbc003 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic-float.msl3.comp @@ -0,0 +1,20 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float f32; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + float _18 = atomic_fetch_add_explicit((device atomic_float*)&ssbo.f32, 1.0, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic.comp new file mode 100644 index 0000000000..fca72bfcfe --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/atomic.comp @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + uint u32; + int i32; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + threadgroup uint shared_u32; + threadgroup int shared_i32; + uint _16 = atomic_fetch_add_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _18 = atomic_fetch_or_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _20 = atomic_fetch_xor_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _22 = atomic_fetch_and_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _24 = atomic_fetch_min_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _26 = atomic_fetch_max_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _28 = atomic_exchange_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _32; + do + { + _32 = 10u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&ssbo.u32, &_32, 2u, memory_order_relaxed, memory_order_relaxed) && _32 == 10u); + int _36 = atomic_fetch_add_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _38 = atomic_fetch_or_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _40 = atomic_fetch_xor_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _42 = atomic_fetch_and_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _44 = atomic_fetch_min_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _46 = atomic_fetch_max_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _48 = atomic_exchange_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _52; + do + { + _52 = 10; + } while (!atomic_compare_exchange_weak_explicit((device atomic_int*)&ssbo.i32, &_52, 2, memory_order_relaxed, memory_order_relaxed) && _52 == 10); + shared_u32 = 10u; + shared_i32 = 10; + uint _57 = atomic_fetch_add_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _58 = atomic_fetch_or_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _59 = atomic_fetch_xor_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _60 = atomic_fetch_and_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _61 = atomic_fetch_min_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _62 = atomic_fetch_max_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _63 = atomic_exchange_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _64; + do + { + _64 = 10u; + } while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_uint*)&shared_u32, &_64, 2u, memory_order_relaxed, memory_order_relaxed) && _64 == 10u); + int _65 = atomic_fetch_add_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _66 = atomic_fetch_or_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _67 = atomic_fetch_xor_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _68 = atomic_fetch_and_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _69 = atomic_fetch_min_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _70 = atomic_fetch_max_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _71 = atomic_exchange_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _72; + do + { + _72 = 10; + } while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_int*)&shared_i32, &_72, 2, memory_order_relaxed, memory_order_relaxed) && _72 == 10); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/barriers.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/barriers.comp new file mode 100644 index 0000000000..164cefd7bd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/barriers.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0() +{ + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_device); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_device); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_threadgroup); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp new file mode 100644 index 0000000000..dbb839f581 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.comp @@ -0,0 +1,35 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 _29 = _23.in_data[gl_GlobalInvocationID.x]; + if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _52 = atomic_fetch_add_explicit((device atomic_uint*)&_48.counter, 1u, memory_order_relaxed); + _45.out_data[_52] = _29; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp new file mode 100644 index 0000000000..ebbc144c7b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.comp @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint _59_tmp [[function_constant(10)]]; +constant uint _59 = is_function_constant_defined(_59_tmp) ? _59_tmp : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_59, 1u, 1u); + +kernel void main0(const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) +{ + gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; + float4 _33 = _27.in_data[gl_GlobalInvocationID.x]; + if (dot(_33, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _56 = atomic_fetch_add_explicit((device atomic_uint*)&_52.counter, 1u, memory_order_relaxed); + _49.out_data[_56] = _33; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp new file mode 100644 index 0000000000..2d991f5db5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.dispatchbase.msl11.comp @@ -0,0 +1,36 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; + float4 _33 = _27.in_data[gl_GlobalInvocationID.x]; + if (dot(_33, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _56 = atomic_fetch_add_explicit((device atomic_uint*)&_52.counter, 1u, memory_order_relaxed); + _49.out_data[_56] = _33; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.inline-block.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.inline-block.msl2.comp new file mode 100644 index 0000000000..902dfc92d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/basic.inline-block.msl2.comp @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +typedef packed_float4 packed_float4x4[4]; + +struct Baz +{ + int f; + int g; +}; + +struct X +{ + int x; + int y; + float z; +}; + +struct Foo +{ + int a; + int b; + packed_float4x4 c; + X x[2]; +}; + +struct Bar +{ + int d; + int e; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(3u, 3u, 2u); + +struct spvDescriptorSetBuffer0 +{ + constant Bar* m_38 [[id(0)]]; + Foo m_32 [[id(1)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + device Baz* baz [[id(0)]][3]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + spvDescriptorSet1.baz[gl_GlobalInvocationID.x]->f = spvDescriptorSet0.m_32.a + (*spvDescriptorSet0.m_38).d; + spvDescriptorSet1.baz[gl_GlobalInvocationID.x]->g = spvDescriptorSet0.m_32.b * (*spvDescriptorSet0.m_38).e; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp new file mode 100644 index 0000000000..fb561482ab --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct SSBO; + +struct UBO +{ + uint2 b; +}; + +struct SSBO +{ + packed_float3 a1; + float a2; +}; + +kernel void main0(constant UBO& _10 [[buffer(0)]]) +{ + (reinterpret_cast(as_type(_10.b)))->a1 = float3(1.0, 2.0, 3.0); + uint2 _35 = as_type(reinterpret_cast(reinterpret_cast(as_type(_10.b + uint2(32u))))); + uint2 v2 = _35; + device SSBO* _39 = reinterpret_cast(as_type(_35)); + float3 v3 = float3(_39->a1); + _39->a1 = float3(_39->a1) + float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp new file mode 100644 index 0000000000..d66154b549 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp @@ -0,0 +1,96 @@ +#include +#include + +using namespace metal; + +struct t21; + +struct t24 +{ + int4 m0[2]; + int m1; + ulong2 m2[2]; + device t21* m3; + float2x4 m4; +}; + +struct t21 +{ + int4 m0[2]; + int m1; + ulong2 m2[2]; + device t21* m3; + float2x4 m4; +}; + +struct t35 +{ + int m0[32]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant t24& u24 [[buffer(0)]], constant t35& u35 [[buffer(1)]], texture2d v295 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int v8 = 0; + int _30 = 0 | (u24.m0[0].x - 0); + v8 = _30; + int _44 = _30 | (u24.m0[u35.m0[1]].x - 1); + v8 = _44; + int _50 = _44 | (u24.m1 - 2); + v8 = _50; + int _60 = _50 | int(u24.m4[0u][0] - 3.0); + v8 = _60; + int _68 = _60 | int(u24.m4[1u][0] - 5.0); + v8 = _68; + int _75 = _68 | int(u24.m4[0u][1] - 4.0); + v8 = _75; + int _82 = _75 | int(u24.m4[1u][1] - 6.0); + v8 = _82; + int _92 = _82 | (((device t21*)u24.m2[0].x)->m0[0].x - 3); + v8 = _92; + int _101 = _92 | (((device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4); + v8 = _101; + int _109 = _101 | (((device t21*)u24.m2[0].x)->m1 - 5); + v8 = _109; + int _118 = _109 | int(((device t21*)u24.m2[0].x)->m4[0u][0] - 6.0); + v8 = _118; + int _127 = _118 | int(((device t21*)u24.m2[0].x)->m4[1u][0] - 8.0); + v8 = _127; + int _136 = _127 | int(((device t21*)u24.m2[0].x)->m4[0u][1] - 7.0); + v8 = _136; + int _145 = _136 | int(((device t21*)u24.m2[0].x)->m4[1u][1] - 9.0); + v8 = _145; + int _155 = _145 | (((device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); + v8 = _155; + int _167 = _155 | (((device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7); + v8 = _167; + int _177 = _167 | (((device t21*)u24.m2[u35.m0[1]].x)->m1 - 8); + v8 = _177; + int _187 = _177 | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0); + v8 = _187; + int _198 = _187 | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0); + v8 = _198; + int _209 = _198 | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0); + v8 = _209; + int _220 = _209 | int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0); + v8 = _220; + int _228 = _220 | (u24.m3->m0[0].x - 9); + v8 = _228; + int _238 = _228 | (u24.m3->m0[u35.m0[1]].x - 10); + v8 = _238; + int _246 = _238 | (u24.m3->m1 - 11); + v8 = _246; + int _254 = _246 | int(u24.m3->m4[0u][0] - 12.0); + v8 = _254; + int _263 = _254 | int(u24.m3->m4[1u][0] - 14.0); + v8 = _263; + int _272 = _263 | int(u24.m3->m4[0u][1] - 13.0); + v8 = _272; + int _281 = _272 | int(u24.m3->m4[1u][1] - 15.0); + v8 = _281; + uint4 _292 = select(uint4(1u, 0u, 0u, 1u), uint4(0u), bool4(_281 != 0)); + uint4 v284 = _292; + v295.write(_292, uint2(int2(gl_GlobalInvocationID.xy))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address.msl2.comp new file mode 100644 index 0000000000..d85fa356b8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/buffer_device_address.msl2.comp @@ -0,0 +1,56 @@ +#include +#include + +using namespace metal; + +struct Position; +struct PositionReferences; + +struct Position +{ + float2 positions[1]; +}; + +struct Registers +{ + device PositionReferences* references; + float fract_time; +}; + +struct PositionReferences +{ + device Position* buffers[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u); + +kernel void main0(constant Registers& registers [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint2 local_offset = gl_GlobalInvocationID.xy; + uint _19 = local_offset.y; + uint _29 = local_offset.x; + uint _30 = ((_19 * 8u) * gl_NumWorkGroups.x) + _29; + uint local_index = _30; + uint slice = gl_WorkGroupID.z; + device Position* __restrict positions = registers.references->buffers[gl_WorkGroupID.z]; + float _66 = float(gl_WorkGroupID.z); + float _70 = fract(fma(_66, 0.100000001490116119384765625, registers.fract_time)); + float _71 = 6.283125400543212890625 * _70; + float offset = _71; + float2 pos = float2(local_offset); + float _83 = sin(fma(2.2000000476837158203125, pos.x, _71)); + pos.x = fma(0.20000000298023223876953125, _83, pos.x); + float _97 = sin(fma(2.25, pos.y, _70 * 12.56625080108642578125)); + pos.y = fma(0.20000000298023223876953125, _97, pos.y); + float _111 = cos(fma(1.7999999523162841796875, pos.y, _70 * 18.849376678466796875)); + pos.x = fma(0.20000000298023223876953125, _111, pos.x); + float _125 = cos(fma(2.849999904632568359375, pos.x, _70 * 25.1325016021728515625)); + pos.y = fma(0.20000000298023223876953125, _125, pos.y); + float _133 = sin(_71); + pos.x = fma(0.5, _133, pos.x); + float _142 = sin(fma(6.283125400543212890625, _70, 0.300000011920928955078125)); + pos.y = fma(0.5, _142, pos.y); + float2 _155 = float2(gl_NumWorkGroups.xy); + registers.references->buffers[gl_WorkGroupID.z]->positions[_30] = (pos / fma(float2(8.0), _155, float2(-1.0))) - float2(0.5); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/builtins.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/builtins.comp new file mode 100644 index 0000000000..7576715df6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/builtins.comp @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 4u, 2u); + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..59fc03a752 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/cfg-preserve-parameter.comp @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-block.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-block.comp new file mode 100644 index 0000000000..58bbacb7f0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-block.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 value; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(volatile device SSBO& _10 [[buffer(0)]]) +{ + _10.value = float4(20.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-image.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-image.comp new file mode 100644 index 0000000000..5090484464 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/coherent-image.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int4 value; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(volatile device SSBO& _10 [[buffer(0)]], texture2d uImage [[texture(0)]]) +{ + _10.value = uImage.read(uint2(int2(10))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp new file mode 100644 index 0000000000..bd58c95a00 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp @@ -0,0 +1,59 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct SSBO +{ + float4x4 a; + uint index; +}; + +kernel void main0(device SSBO& _14 [[buffer(0)]]) +{ + spvUnsafeArray _32 = spvUnsafeArray({ float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)), float4x4(float4(2.0, 0.0, 0.0, 0.0), float4(0.0, 2.0, 0.0, 0.0), float4(0.0, 0.0, 2.0, 0.0), float4(0.0, 0.0, 0.0, 2.0)) }); + + _14.a = _32[_14.index]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-type-alias.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-type-alias.comp new file mode 100644 index 0000000000..43e1297585 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/complex-type-alias.comp @@ -0,0 +1,56 @@ +#include +#include + +using namespace metal; + +struct Foo0 +{ + float a; +}; + +struct Foo1 +{ + Foo0 a; +}; + +struct Foo2 +{ + Foo1 a; + float weight; +}; + +struct Foo0_1 +{ + float a; +}; + +struct Foo1_1 +{ + Foo0_1 a; +}; + +struct Foo2_1 +{ + Foo1_1 a; + float weight; +}; + +struct SSBO +{ + Foo2_1 outputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u); + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + threadgroup Foo2 coeffs[64]; + coeffs[gl_LocalInvocationIndex] = Foo2{ Foo1{ Foo0{ 0.0 } }, 0.0 }; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_LocalInvocationIndex == 0u) + { + _53.outputs[gl_WorkGroupID.x].a.a.a = coeffs[0].a.a.a; + _53.outputs[gl_WorkGroupID.x].weight = coeffs[0].weight; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..b5469b989b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Data +{ + float a; + float b; +}; + +constant float X_tmp [[function_constant(0)]]; +constant float X = is_function_constant_defined(X_tmp) ? X_tmp : 4.0; + +struct Data_1 +{ + float a; + float b; +}; + +struct SSBO +{ + Data_1 outdata[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + spvUnsafeArray _25 = spvUnsafeArray({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }); + + spvUnsafeArray _31 = spvUnsafeArray({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } }); + spvUnsafeArray data2 = _31; + _53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a; + _53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.force-native-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.force-native-array.comp new file mode 100644 index 0000000000..536a6e3074 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.force-native-array.comp @@ -0,0 +1,148 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Data +{ + float a; + float b; +}; + +constant float X_tmp [[function_constant(0)]]; +constant float X = is_function_constant_defined(X_tmp) ? X_tmp : 4.0; + +struct Data_1 +{ + float a; + float b; +}; + +struct SSBO +{ + Data_1 outdata[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; + + Data _31[2] = { Data{ X, 2.0 }, Data{ 3.0, 5.0 } }; + Data data2[2]; + spvArrayCopyFromStackToStack1(data2, _31); + _53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a; + _53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp new file mode 100644 index 0000000000..ea5aa49505 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct SSBO0 +{ + float4 as[1]; +}; + +struct SSBO1 +{ + float4 bs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + spvUnsafeArray _37 = spvUnsafeArray({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }); + spvUnsafeArray values = _37; + _16.as[0] = values[gl_LocalInvocationIndex]; + _32.bs[1] = float4(40.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.comp new file mode 100644 index 0000000000..cb396cff20 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct BUF +{ + int a; + float b; + float c; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device BUF& o [[buffer(0)]]) +{ + o.a = 4; + o.b = o.c; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp new file mode 100644 index 0000000000..cb396cff20 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct BUF +{ + int a; + float b; + float c; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device BUF& o [[buffer(0)]]) +{ + o.a = 4; + o.b = o.c; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp new file mode 100644 index 0000000000..55735475a7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/culling.comp @@ -0,0 +1,35 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float in_data[1]; +}; + +struct SSBO2 +{ + float out_data[1]; +}; + +struct SSBO3 +{ + uint count; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float _28 = _22.in_data[gl_GlobalInvocationID.x]; + if (_28 > 12.0) + { + uint _45 = atomic_fetch_add_explicit((device atomic_uint*)&_41.count, 1u, memory_order_relaxed); + _38.out_data[_45] = _28; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/defer-parens.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/defer-parens.comp new file mode 100644 index 0000000000..8c130e3a0c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/defer-parens.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 data; + int index; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _13 [[buffer(0)]]) +{ + float4 _17 = _13.data; + float2 _28 = _17.yz + float2(10.0); + _13.data = float4(_17.x, _28, _17.w); + _13.data = (_17 + _17) + _17; + _13.data = _28.xxyy; + _13.data = float4(_28.y); + _13.data = float4((_17.zw + float2(10.0))[_13.index]); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp new file mode 100644 index 0000000000..b503c948ad --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/dowhile.comp @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4x4 mvp; + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 _59; + int _60; + _60 = 0; + _59 = _28.in_data[gl_GlobalInvocationID.x]; + float4 _42; + for (;;) + { + _42 = _28.mvp * _59; + int _44 = _60 + 1; + if (_44 < 16) + { + _60 = _44; + _59 = _42; + } + else + { + break; + } + } + _52.out_data[gl_GlobalInvocationID.x] = _42; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/force-recompile-hooks.swizzle.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/force-recompile-hooks.swizzle.comp new file mode 100644 index 0000000000..fbf4c4f7fc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/force-recompile-hooks.swizzle.comp @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +kernel void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture2d foo [[texture(0)]], texture2d bar [[texture(1)]], sampler fooSmplr [[sampler(0)]]) +{ + constant uint& fooSwzl = spvSwizzleConstants[0]; + bar.write(spvTextureSwizzle(foo.sample(fooSmplr, float2(1.0), level(0.0)), fooSwzl), uint2(int2(0))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/functions.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/functions.comp new file mode 100644 index 0000000000..59fc03a752 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/functions.comp @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +kernel void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp new file mode 100644 index 0000000000..333485a256 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod(myStorage.b[gl_GlobalInvocationID.x] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp new file mode 100644 index 0000000000..333485a256 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod(myStorage.b[gl_GlobalInvocationID.x] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp new file mode 100644 index 0000000000..05dc38746a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct SSBO +{ + float4 outdata; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + texture2d uImage [[id(0)]]; + device atomic_uint* uImage_atomic [[id(1)]]; + device SSBO* m_31 [[id(2)]]; + texture2d uTexture [[id(3)]]; + sampler uTextureSmplr [[id(4)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _26 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.uImage_atomic[spvImage2DAtomicCoord(int2(gl_GlobalInvocationID.xy), spvDescriptorSet0.uImage)], 10u, memory_order_relaxed); + (*spvDescriptorSet0.m_31).outdata = spvDescriptorSet0.uTexture.sample(spvDescriptorSet0.uTextureSmplr, float2(gl_GlobalInvocationID.xy), level(0.0)) + float4(float(_26)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.comp new file mode 100644 index 0000000000..7b0a129a48 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-atomic-automatic-bindings.comp @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct SSBO +{ + float4 outdata; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _31 [[buffer(1)]], texture2d uImage [[texture(0)]], device atomic_uint* uImage_atomic [[buffer(0)]], texture2d uTexture [[texture(1)]], sampler uTextureSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _26 = atomic_fetch_add_explicit((device atomic_uint*)&uImage_atomic[spvImage2DAtomicCoord(int2(gl_GlobalInvocationID.xy), uImage)], 10u, memory_order_relaxed); + _31.outdata = uTexture.sample(uTextureSmplr, float2(gl_GlobalInvocationID.xy), level(0.0)) + float4(float(_26)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-cube-array-load-store.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-cube-array-load-store.comp new file mode 100644 index 0000000000..41c4dfc180 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image-cube-array-load-store.comp @@ -0,0 +1,12 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(texturecube_array uImageIn [[texture(0)]], texturecube_array uImageOut [[texture(1)]]) +{ + uImageOut.write(uImageIn.read(uint2(int3(9, 7, 11).xy), uint(int3(9, 7, 11).z) % 6u, uint(int3(9, 7, 11).z) / 6u), uint2(int3(9, 7, 11).xy), uint(int3(9, 7, 11).z) % 6u, uint(int3(9, 7, 11).z) / 6u); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/image.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image.comp new file mode 100644 index 0000000000..c875e78de0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/image.comp @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(texture2d uImageIn [[texture(0)]], texture2d uImageOut [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int2 _23 = int2(gl_GlobalInvocationID.xy); + uImageOut.write(uImageIn.read(uint2((_23 + int2(uImageIn.get_width(), uImageIn.get_height())))), uint2(_23)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/insert.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/insert.comp new file mode 100644 index 0000000000..437b7f3289 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/insert.comp @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _27.out_data[gl_GlobalInvocationID.x] = float4(10.0, 30.0, 70.0, 90.0); + ((device float*)&_27.out_data[gl_GlobalInvocationID.x])[1u] = 20.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp new file mode 100644 index 0000000000..0a1d298b0d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp @@ -0,0 +1,130 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns the determinant of a 2x2 matrix. +static inline __attribute__((always_inline)) +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the determinant of a 3x3 matrix. +static inline __attribute__((always_inline)) +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float4x4 spvInverse4x4(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float3x3 spvInverse3x3(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float2x2 spvInverse2x2(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +struct MatrixOut +{ + float2x2 m2out; + float3x3 m3out; + float4x4 m4out; +}; + +struct MatrixIn +{ + float2x2 m2in; + float3x3 m3in; + float4x4 m4in; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device MatrixOut& _15 [[buffer(0)]], const device MatrixIn& _20 [[buffer(1)]]) +{ + _15.m2out = spvInverse2x2(_20.m2in); + _15.m3out = spvInverse3x3(_20.m3in); + _15.m4out = spvInverse4x4(_20.m4in); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp new file mode 100644 index 0000000000..4505990588 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationID.x] = mod(myStorage.b[gl_LocalInvocationID.x] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp new file mode 100644 index 0000000000..67426dd3f6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationIndex] = mod(myStorage.b[gl_LocalInvocationIndex] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-size-duplicate-spec-id.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-size-duplicate-spec-id.comp new file mode 100644 index 0000000000..19a56fc9f8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/local-size-duplicate-spec-id.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct StorageBuffer +{ + uint values[1]; +}; + +constant uint _22_tmp [[function_constant(0)]]; +constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u; +constant uint _23_tmp [[function_constant(1)]]; +constant uint _23 = is_function_constant_defined(_23_tmp) ? _23_tmp : 1u; +constant uint _24_tmp [[function_constant(2)]]; +constant uint _24 = is_function_constant_defined(_24_tmp) ? _24_tmp : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, _23, _24); + +kernel void main0(device StorageBuffer& ssbo [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + ssbo.values[gl_LocalInvocationIndex] = 1u; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3-row-maj-read-write-const.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3-row-maj-read-write-const.comp new file mode 100644 index 0000000000..cf26178ee8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3-row-maj-read-write-const.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct model_t +{ + float3x3 mtx_rm; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device model_t& model [[buffer(0)]]) +{ + if ((transpose(model.mtx_rm) * float3x3(float3(4.0, -3.0, 1.0), float3(-7.0, 7.0, -7.0), float3(-5.0, 6.0, -8.0)))[0].x != 0.0) + { + model.mtx_rm = transpose(float3x3(float3(-5.0, -3.0, -5.0), float3(-2.0, 2.0, -5.0), float3(6.0, 3.0, -8.0))); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3.comp new file mode 100644 index 0000000000..31351ba57b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mat3.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float3x3 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _22.out_data[gl_GlobalInvocationID.x] = float3x3(float3(10.0), float3(20.0), float3(40.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp new file mode 100644 index 0000000000..94d739fe6c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/mod.comp @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _33.out_data[gl_GlobalInvocationID.x] = mod(_23.in_data[gl_GlobalInvocationID.x], _33.out_data[gl_GlobalInvocationID.x]); + _33.out_data[gl_GlobalInvocationID.x] = as_type(as_type(_23.in_data[gl_GlobalInvocationID.x]) % as_type(_33.out_data[gl_GlobalInvocationID.x])); + _33.out_data[gl_GlobalInvocationID.x] = as_type(as_type(_23.in_data[gl_GlobalInvocationID.x]) % as_type(_33.out_data[gl_GlobalInvocationID.x])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp new file mode 100644 index 0000000000..df19cae502 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/modf.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 i; + float4 _31 = modf(_23.in_data[gl_GlobalInvocationID.x], i); + _35.out_data[gl_GlobalInvocationID.x] = _31; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp new file mode 100644 index 0000000000..e589642dbd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/outer-product.comp @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float2x2 m22; + float2x3 m23; + float2x4 m24; + float3x2 m32; + float3x3 m33; + float3x4 m34; + float4x2 m42; + float4x3 m43; + float4x4 m44; +}; + +struct ReadSSBO +{ + float2 v2; + float3 v3; + float4 v4; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _21 [[buffer(0)]], const device ReadSSBO& _26 [[buffer(1)]]) +{ + _21.m22 = float2x2(_26.v2 * _26.v2.x, _26.v2 * _26.v2.y); + _21.m23 = float2x3(_26.v3 * _26.v2.x, _26.v3 * _26.v2.y); + _21.m24 = float2x4(_26.v4 * _26.v2.x, _26.v4 * _26.v2.y); + _21.m32 = float3x2(_26.v2 * _26.v3.x, _26.v2 * _26.v3.y, _26.v2 * _26.v3.z); + _21.m33 = float3x3(_26.v3 * _26.v3.x, _26.v3 * _26.v3.y, _26.v3 * _26.v3.z); + _21.m34 = float3x4(_26.v4 * _26.v3.x, _26.v4 * _26.v3.y, _26.v4 * _26.v3.z); + _21.m42 = float4x2(_26.v2 * _26.v4.x, _26.v2 * _26.v4.y, _26.v2 * _26.v4.z, _26.v2 * _26.v4.w); + _21.m43 = float4x3(_26.v3 * _26.v4.x, _26.v3 * _26.v4.y, _26.v3 * _26.v4.z, _26.v3 * _26.v4.w); + _21.m44 = float4x4(_26.v4 * _26.v4.x, _26.v4 * _26.v4.y, _26.v4 * _26.v4.z, _26.v4 * _26.v4.w); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-1.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-1.comp new file mode 100644 index 0000000000..0649f57685 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-1.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct T1 +{ + packed_float3 a; + float b; +}; + +struct Buffer0 +{ + T1 buf0[1]; +}; + +struct Buffer1 +{ + float buf1[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u); + +kernel void main0(device Buffer0& _15 [[buffer(0)]], device Buffer1& _34 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _34.buf1[gl_GlobalInvocationID.x] = _15.buf0[0].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-2.comp new file mode 100644 index 0000000000..abce48a37b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/packing-test-2.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct T1 +{ + packed_float3 a; + float b; +}; + +struct Buffer0 +{ + T1 buf0[1]; +}; + +struct Buffer1 +{ + float buf1[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u); + +kernel void main0(device Buffer0& _14 [[buffer(0)]], device Buffer1& _24 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _24.buf1[gl_GlobalInvocationID.x] = _14.buf0[0].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp new file mode 100644 index 0000000000..c119186663 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp @@ -0,0 +1,116 @@ +#include +#include + +using namespace metal; + +struct SSBO_A +{ + float data[1]; +}; + +struct UBO_C +{ + float4 data[1024]; +}; + +struct Registers +{ + float reg; +}; + +struct SSBO_B +{ + uint2 data[1]; +}; + +struct UBO_D +{ + uint4 data[1024]; +}; + +struct SSBO_BRO +{ + uint2 data[1]; +}; + +struct SSBO_As +{ + float data[1]; +}; + +struct UBO_Cs +{ + float4 data[1024]; +}; + +struct SSBO_Bs +{ + uint2 data[1024]; +}; + +struct UBO_Ds +{ + uint4 data[1024]; +}; + +struct SSBO_BsRO +{ + uint2 data[1024]; +}; + +struct SSBO_E +{ + float data[1]; +}; + +struct UBO_G +{ + float4 data[1024]; +}; + +struct SSBO_F +{ + uint2 data[1]; +}; + +struct UBO_H +{ + uint4 data[1024]; +}; + +struct SSBO_I +{ + uint2 data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO_A* ssbo_a [[id(0)]]; + constant UBO_C* ubo_c [[id(1)]]; + device SSBO_As* ssbo_as [[id(2)]][4]; + constant UBO_Cs* ubo_cs [[id(6)]][4]; +}; + +kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding0 [[buffer(2)]], constant void* spvBufferAliasSet2Binding1 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding0; + constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; + device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; + constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; + const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_b = (device SSBO_B&)(*spvDescriptorSet0.ssbo_a); + constant auto& ubo_d = (constant UBO_D&)(*spvDescriptorSet0.ubo_c); + const device auto& ssbo_b_readonly = (const device SSBO_BRO&)(*spvDescriptorSet0.ssbo_a); + const device auto& ssbo_bs = (device SSBO_Bs* const device (&)[4])spvDescriptorSet0.ssbo_as; + const device auto& ubo_ds = (constant UBO_Ds* const device (&)[4])spvDescriptorSet0.ubo_cs; + const device auto& ssbo_bs_readonly = (const device SSBO_BsRO* const device (&)[4])spvDescriptorSet0.ssbo_as; + (*spvDescriptorSet0.ssbo_a).data[gl_GlobalInvocationID.x] = (*spvDescriptorSet0.ubo_c).data[gl_WorkGroupID.x].x + _42.reg; + ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; + spvDescriptorSet0.ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = spvDescriptorSet0.ubo_cs[gl_WorkGroupID.x]->data[0].x; + ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp new file mode 100644 index 0000000000..9cef6b208f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp @@ -0,0 +1,116 @@ +#include +#include + +using namespace metal; + +struct SSBO_A +{ + float data[1]; +}; + +struct UBO_C +{ + float4 data[1024]; +}; + +struct Registers +{ + float reg; +}; + +struct SSBO_B +{ + uint2 data[1]; +}; + +struct UBO_D +{ + uint4 data[1024]; +}; + +struct SSBO_BRO +{ + uint2 data[1]; +}; + +struct SSBO_As +{ + float data[1]; +}; + +struct UBO_Cs +{ + float4 data[1024]; +}; + +struct SSBO_Bs +{ + uint2 data[1024]; +}; + +struct UBO_Ds +{ + uint4 data[1024]; +}; + +struct SSBO_BsRO +{ + uint2 data[1024]; +}; + +struct SSBO_E +{ + float data[1]; +}; + +struct UBO_G +{ + float4 data[1024]; +}; + +struct SSBO_F +{ + uint2 data[1]; +}; + +struct UBO_H +{ + uint4 data[1024]; +}; + +struct SSBO_I +{ + uint2 data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO_A* ssbo_a [[id(0)]]; + constant UBO_C* ubo_c [[id(1)]]; + device SSBO_As* ssbo_as [[id(2)]][4]; + constant UBO_Cs* ubo_cs [[id(6)]][4]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding0 [[buffer(2)]], constant void* spvBufferAliasSet2Binding1 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding0; + constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; + device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; + constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; + const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_b = (device SSBO_B&)(*spvDescriptorSet0.ssbo_a); + constant auto& ubo_d = (constant UBO_D&)(*spvDescriptorSet0.ubo_c); + const device auto& ssbo_b_readonly = (const device SSBO_BRO&)(*spvDescriptorSet0.ssbo_a); + constant auto& ssbo_bs = (device SSBO_Bs* constant (&)[4])spvDescriptorSet0.ssbo_as; + constant auto& ubo_ds = (constant UBO_Ds* constant (&)[4])spvDescriptorSet0.ubo_cs; + constant auto& ssbo_bs_readonly = (const device SSBO_BsRO* constant (&)[4])spvDescriptorSet0.ssbo_as; + (*spvDescriptorSet0.ssbo_a).data[gl_GlobalInvocationID.x] = (*spvDescriptorSet0.ubo_c).data[gl_WorkGroupID.x].x + _42.reg; + ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; + spvDescriptorSet0.ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = spvDescriptorSet0.ubo_cs[gl_WorkGroupID.x]->data[0].x; + ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.nocompat.spv14.vk.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.nocompat.spv14.vk.comp new file mode 100644 index 0000000000..b03d524c25 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.nocompat.spv14.vk.comp @@ -0,0 +1,91 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include +using namespace metal::raytracing; + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Params +{ + uint ray_flags; + uint cull_mask; + char _m2_pad[8]; + packed_float3 origin; + float tmin; + packed_float3 dir; + float tmax; + float thit; +}; + +kernel void main0(constant Params& _18 [[buffer(1)]], acceleration_structure AS0 [[buffer(0)]], acceleration_structure AS1 [[buffer(2)]]) +{ + intersection_query q; + intersection_params _intersection_params_; + q.reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS0, _intersection_params_); + spvUnsafeArray, 2> q2; + intersection_params _intersection_params_; + q2[1].reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS1, _intersection_params_); + bool _63 = q.next(); + q2[0].abort(); + q.commit_bounding_box_intersection(_18.thit); + _14.commit_triangle_intersection(); + float _71 = q.get_ray_min_distance(); + float3 _74 = q.get_world_space_ray_origin(); + float3 _75 = q.get_world_space_ray_direction(); + uint _80 = (uint)q2[1].get_committed_intersection_type(); + uint _83 = (uint)q2[0].get_committed_intersection_type(); + bool _85 = q2[1].is_candidate_non_opaque_bounding_box(); + float _87 = q2[1].get_committed_distance(); + float _89 = q2[1].get_committed_distance(); + int _92 = q.get_committed_user_instance_id(); + int _94 = q2[0].get_committed_instance_id(); + int _96 = q2[1].get_committed_geometry_id(); + int _97 = q.get_committed_primitive_id(); + float2 _100 = q2[0].get_committed_triangle_barycentric_coord(); + bool _103 = q.is_committed_triangle_front_facing(); + float3 _104 = q.get_committed_ray_direction(); + float3 _106 = q2[0].get_committed_ray_origin(); + float4x3 _110 = q.get_committed_object_to_world_transform(); + float4x3 _112 = q2[1].get_committed_world_to_object_transform(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp new file mode 100644 index 0000000000..dde7f47b08 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp @@ -0,0 +1,71 @@ +#include +#include +#if __METAL_VERSION__ >= 230 +#include +using namespace metal::raytracing; +#endif + +using namespace metal; + +struct Params +{ + uint ray_flags; + uint cull_mask; + char _m2_pad[8]; + packed_float3 origin; + float tmin; + packed_float3 dir; + float tmax; + float thit; +}; + +kernel void main0(constant Params& _18 [[buffer(1)]], raytracing::acceleration_structure AS0 [[buffer(0)]], raytracing::acceleration_structure AS1 [[buffer(2)]]) +{ + raytracing::intersection_query q; + q.reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS0, intersection_params()); + raytracing::intersection_query q2[2]; + q2[1].reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS1, intersection_params()); + bool _63 = q.next(); + bool res = _63; + q2[0].abort(); + q.commit_bounding_box_intersection(_18.thit); + q2[1].commit_triangle_intersection(); + float _71 = q.get_ray_min_distance(); + float fval = _71; + float3 _74 = q.get_world_space_ray_direction(); + float3 fvals = _74; + float3 _75 = q.get_world_space_ray_origin(); + fvals = _75; + uint _80 = uint(q2[1].get_committed_intersection_type()); + uint type = _80; + uint _83 = uint(q2[0].get_candidate_intersection_type()) - 1; + type = _83; + bool _85 = q2[1].is_candidate_non_opaque_bounding_box(); + res = _85; + float _87 = q2[1].get_committed_distance(); + fval = _87; + float _89 = q2[1].get_candidate_triangle_distance(); + fval = _89; + int _92 = q.get_committed_user_instance_id(); + int ival = _92; + int _94 = q2[0].get_candidate_instance_id(); + ival = _94; + int _96 = q2[1].get_candidate_geometry_id(); + ival = _96; + int _97 = q.get_committed_primitive_id(); + ival = _97; + float2 _100 = q2[0].get_candidate_triangle_barycentric_coord(); + fvals.x = _100.x; + fvals.y = _100.y; + bool _107 = q.is_committed_triangle_front_facing(); + res = _107; + float3 _108 = q.get_candidate_ray_direction(); + fvals = _108; + float3 _110 = q2[0].get_committed_ray_origin(); + fvals = _110; + float4x3 _114 = q.get_candidate_object_to_world_transform(); + float4x3 matrices = _114; + float4x3 _116 = q2[1].get_committed_world_to_object_transform(); + matrices = _116; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp new file mode 100644 index 0000000000..0cf8d8e321 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/read-write-only.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float4 data4; + float4 data5; +}; + +struct SSBO0 +{ + float4 data0; + float4 data1; +}; + +struct SSBO1 +{ + float4 data2; + float4 data3; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _10 [[buffer(0)]], const device SSBO0& _15 [[buffer(1)]], device SSBO1& _21 [[buffer(2)]]) +{ + _10.data4 = _15.data0 + _21.data2; + _10.data5 = _15.data1 + _21.data3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..b53a3a75c2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-matrix.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; + float4 b; + float4x4 c; + float a1; + float4 b1; + float4x4 c1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.a *= _11.a1; + _11.b *= _11.b1; + _11.c = _11.c * _11.c1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-opt.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-opt.comp new file mode 100644 index 0000000000..f93967da53 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/rmw-opt.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int a; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]]) +{ + _9.a += 10; + _9.a -= 10; + _9.a *= 10; + _9.a /= 10; + _9.a = _9.a << 2; + _9.a = _9.a >> 3; + _9.a &= 40; + _9.a ^= 10; + _9.a %= 40; + _9.a |= 1; + _9.a = 0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..9bf8781774 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; + float b; + float c; + float d; + float e; + float f; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]]) +{ + _9.c = abs(_9.a - _9.b); + _9.d = abs(_9.a); + _9.e = sign(_9.a); + _9.f = abs((_9.a - 1.0) - (_9.b - 2.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..ddb8c9629d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u); + +kernel void main0(device SSBO& _67 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup float foo[4][4]; + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + threadgroup_barrier(mem_flags::mem_threadgroup); + _67.out_data[gl_GlobalInvocationID.x] = ((foo[gl_LocalInvocationID.x][0] + foo[gl_LocalInvocationID.x][1]) + foo[gl_LocalInvocationID.x][2]) + foo[gl_LocalInvocationID.x][3]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-array-of-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-array-of-array.comp new file mode 100644 index 0000000000..0e17f95cb8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-array-of-array.comp @@ -0,0 +1,1353 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + spvStorage_float4x3 a[2]; + float b; + spvUnsafeArray c; +}; + +struct S2 +{ + int4 a; + spvUnsafeArray, 1>, 3> b; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device block& _383 [[buffer(0)]]) +{ + threadgroup S1 s1; + threadgroup S2 s2; + s1.a[0] = spvStorage_float4x3(float4x3(float3(0.0, 2.0, -8.0), float3(6.0, 7.0, 5.0), float3(-6.0, 1.0, 9.0), float3(-4.0, -3.0, 4.0))); + s1.a[1] = spvStorage_float4x3(float4x3(float3(4.0, 9.0, -9.0), float3(-8.0, -9.0, 8.0), float3(0.0, 4.0, -4.0), float3(7.0, 2.0, -1.0))); + s1.b = 7.0; + s1.c[0] = float2(-5.0, -4.0); + s1.c[1] = float2(3.0, -5.0); + s1.c[2] = float2(-3.0, -1.0); + s2.a = int4(1, 0, -3, 1); + s2.b[0][0][0] = short(true); + s2.b[0][0][1] = short(false); + s2.b[0][0][2] = short(false); + s2.b[1][0][0] = short(true); + s2.b[1][0][1] = short(false); + s2.b[1][0][2] = short(true); + s2.b[2][0][0] = short(false); + s2.b[2][0][1] = short(true); + s2.b[2][0][2] = short(true); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool _464 = abs(-float4x3(s1.a[0])[0].x) < 0.0500000007450580596923828125; + bool _449; + if (_464) + { + _449 = abs(2.0 - float4x3(s1.a[0])[0].y) < 0.0500000007450580596923828125; + } + else + { + _449 = _464; + } + bool _457; + if (_449) + { + _457 = abs((-8.0) - float4x3(s1.a[0])[0].z) < 0.0500000007450580596923828125; + } + else + { + _457 = _449; + } + bool _412; + if (_457) + { + bool _514 = abs(6.0 - float4x3(s1.a[0])[1].x) < 0.0500000007450580596923828125; + bool _499; + if (_514) + { + _499 = abs(7.0 - float4x3(s1.a[0])[1].y) < 0.0500000007450580596923828125; + } + else + { + _499 = _514; + } + bool _507; + if (_499) + { + _507 = abs(5.0 - float4x3(s1.a[0])[1].z) < 0.0500000007450580596923828125; + } + else + { + _507 = _499; + } + _412 = _507; + } + else + { + _412 = _457; + } + bool _420; + if (_412) + { + bool _564 = abs((-6.0) - float4x3(s1.a[0])[2].x) < 0.0500000007450580596923828125; + bool _549; + if (_564) + { + _549 = abs(1.0 - float4x3(s1.a[0])[2].y) < 0.0500000007450580596923828125; + } + else + { + _549 = _564; + } + bool _557; + if (_549) + { + _557 = abs(9.0 - float4x3(s1.a[0])[2].z) < 0.0500000007450580596923828125; + } + else + { + _557 = _549; + } + _420 = _557; + } + else + { + _420 = _412; + } + bool _428; + if (_420) + { + bool _614 = abs((-4.0) - float4x3(s1.a[0])[3].x) < 0.0500000007450580596923828125; + bool _599; + if (_614) + { + _599 = abs((-3.0) - float4x3(s1.a[0])[3].y) < 0.0500000007450580596923828125; + } + else + { + _599 = _614; + } + bool _607; + if (_599) + { + _607 = abs(4.0 - float4x3(s1.a[0])[3].z) < 0.0500000007450580596923828125; + } + else + { + _607 = _599; + } + _428 = _607; + } + else + { + _428 = _420; + } + bool _251; + if (_428) + { + bool _703 = abs(4.0 - float4x3(s1.a[1])[0].x) < 0.0500000007450580596923828125; + bool _688; + if (_703) + { + _688 = abs(9.0 - float4x3(s1.a[1])[0].y) < 0.0500000007450580596923828125; + } + else + { + _688 = _703; + } + bool _696; + if (_688) + { + _696 = abs((-9.0) - float4x3(s1.a[1])[0].z) < 0.0500000007450580596923828125; + } + else + { + _696 = _688; + } + bool _651; + if (_696) + { + bool _753 = abs((-8.0) - float4x3(s1.a[1])[1].x) < 0.0500000007450580596923828125; + bool _738; + if (_753) + { + _738 = abs((-9.0) - float4x3(s1.a[1])[1].y) < 0.0500000007450580596923828125; + } + else + { + _738 = _753; + } + bool _746; + if (_738) + { + _746 = abs(8.0 - float4x3(s1.a[1])[1].z) < 0.0500000007450580596923828125; + } + else + { + _746 = _738; + } + _651 = _746; + } + else + { + _651 = _696; + } + bool _659; + if (_651) + { + bool _803 = abs(-float4x3(s1.a[1])[2].x) < 0.0500000007450580596923828125; + bool _788; + if (_803) + { + _788 = abs(4.0 - float4x3(s1.a[1])[2].y) < 0.0500000007450580596923828125; + } + else + { + _788 = _803; + } + bool _796; + if (_788) + { + _796 = abs((-4.0) - float4x3(s1.a[1])[2].z) < 0.0500000007450580596923828125; + } + else + { + _796 = _788; + } + _659 = _796; + } + else + { + _659 = _651; + } + bool _667; + if (_659) + { + bool _853 = abs(7.0 - float4x3(s1.a[1])[3].x) < 0.0500000007450580596923828125; + bool _838; + if (_853) + { + _838 = abs(2.0 - float4x3(s1.a[1])[3].y) < 0.0500000007450580596923828125; + } + else + { + _838 = _853; + } + bool _846; + if (_838) + { + _846 = abs((-1.0) - float4x3(s1.a[1])[3].z) < 0.0500000007450580596923828125; + } + else + { + _846 = _838; + } + _667 = _846; + } + else + { + _667 = _659; + } + _251 = _667; + } + else + { + _251 = _428; + } + bool _260; + if (_251) + { + _260 = abs(7.0 - s1.b) < 0.0500000007450580596923828125; + } + else + { + _260 = _251; + } + bool _269; + if (_260) + { + bool _900 = abs((-5.0) - s1.c[0].x) < 0.0500000007450580596923828125; + bool _893; + if (_900) + { + _893 = abs((-4.0) - s1.c[0].y) < 0.0500000007450580596923828125; + } + else + { + _893 = _900; + } + _269 = _893; + } + else + { + _269 = _260; + } + bool _278; + if (_269) + { + bool _933 = abs(3.0 - s1.c[1].x) < 0.0500000007450580596923828125; + bool _926; + if (_933) + { + _926 = abs((-5.0) - s1.c[1].y) < 0.0500000007450580596923828125; + } + else + { + _926 = _933; + } + _278 = _926; + } + else + { + _278 = _269; + } + bool _287; + if (_278) + { + bool _966 = abs((-3.0) - s1.c[2].x) < 0.0500000007450580596923828125; + bool _959; + if (_966) + { + _959 = abs((-1.0) - s1.c[2].y) < 0.0500000007450580596923828125; + } + else + { + _959 = _966; + } + _287 = _959; + } + else + { + _287 = _278; + } + bool _296; + if (_287) + { + _296 = all(int4(1, 0, -3, 1) == s2.a); + } + else + { + _296 = _287; + } + bool _305; + if (_296) + { + _305 = true == bool(s2.b[0][0][0]); + } + else + { + _305 = _296; + } + bool _314; + if (_305) + { + _314 = false == bool(s2.b[0][0][1]); + } + else + { + _314 = _305; + } + bool _323; + if (_314) + { + _323 = false == bool(s2.b[0][0][2]); + } + else + { + _323 = _314; + } + bool _332; + if (_323) + { + _332 = true == bool(s2.b[1][0][0]); + } + else + { + _332 = _323; + } + bool _341; + if (_332) + { + _341 = false == bool(s2.b[1][0][1]); + } + else + { + _341 = _332; + } + bool _350; + if (_341) + { + _350 = true == bool(s2.b[1][0][2]); + } + else + { + _350 = _341; + } + bool _359; + if (_350) + { + _359 = false == bool(s2.b[2][0][0]); + } + else + { + _359 = _350; + } + bool _368; + if (_359) + { + _368 = true == bool(s2.b[2][0][1]); + } + else + { + _368 = _359; + } + bool _377; + if (_368) + { + _377 = true == bool(s2.b[2][0][2]); + } + else + { + _377 = _368; + } + if (_377) + { + _383.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-cast.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-cast.comp new file mode 100644 index 0000000000..32c8e823d4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-cast.comp @@ -0,0 +1,1017 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + float4 a; + spvStorage_float3x2 b; + short4 c; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device block& _212 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a = float4(1.0, -5.0, -9.0, -5.0); + s1.b = spvStorage_float3x2(float3x2(float2(1.0, -7.0), float2(1.0, 2.0), float2(8.0, 7.0))); + s1.c = short4(bool4(false, true, false, false)); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool _264 = abs(1.0 - s1.a.x) < 0.0500000007450580596923828125; + bool _241; + if (_264) + { + _241 = abs((-5.0) - s1.a.y) < 0.0500000007450580596923828125; + } + else + { + _241 = _264; + } + bool _249; + if (_241) + { + _249 = abs((-9.0) - s1.a.z) < 0.0500000007450580596923828125; + } + else + { + _249 = _241; + } + bool _257; + if (_249) + { + _257 = abs((-5.0) - s1.a.w) < 0.0500000007450580596923828125; + } + else + { + _257 = _249; + } + bool _197; + if (_257) + { + bool _340 = abs(1.0 - float3x2(s1.b)[0].x) < 0.0500000007450580596923828125; + bool _333; + if (_340) + { + _333 = abs((-7.0) - float3x2(s1.b)[0].y) < 0.0500000007450580596923828125; + } + else + { + _333 = _340; + } + bool _306; + if (_333) + { + bool _373 = abs(1.0 - float3x2(s1.b)[1].x) < 0.0500000007450580596923828125; + bool _366; + if (_373) + { + _366 = abs(2.0 - float3x2(s1.b)[1].y) < 0.0500000007450580596923828125; + } + else + { + _366 = _373; + } + _306 = _366; + } + else + { + _306 = _333; + } + bool _314; + if (_306) + { + bool _406 = abs(8.0 - float3x2(s1.b)[2].x) < 0.0500000007450580596923828125; + bool _399; + if (_406) + { + _399 = abs(7.0 - float3x2(s1.b)[2].y) < 0.0500000007450580596923828125; + } + else + { + _399 = _406; + } + _314 = _399; + } + else + { + _314 = _306; + } + _197 = _314; + } + else + { + _197 = _257; + } + bool _206; + if (_197) + { + _206 = all(bool4(false, true, false, false) == bool4(s1.c)); + } + else + { + _206 = _197; + } + if (_206) + { + _212.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct-array.comp new file mode 100644 index 0000000000..dfbd7a7666 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct-array.comp @@ -0,0 +1,1369 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct sA +{ + spvStorage_float2x3 mA; +}; + +struct sB +{ + spvStorage_float2x2 mA; + spvStorage_float3x2 mB; + uint3 mC; +}; + +struct sC +{ + sA mA; + sB mB; +}; + +struct sD +{ + sC mA; +}; + +struct sE +{ + spvStorage_float3x2 mA; + spvStorage_float4x3 mB; +}; + +struct sF +{ + sE mA; +}; + +struct sG +{ + sF mA; +}; + +struct sH +{ + spvUnsafeArray mA; +}; + +struct S1 +{ + sD a; + sG b; + spvUnsafeArray c; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device block& _424 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a.mA.mA.mA = spvStorage_float2x3(float2x3(float3(6.0, 8.0, 8.0), float3(0.0, -4.0, -5.0))); + s1.a.mA.mB.mA = spvStorage_float2x2(float2x2(float2(9.0, -4.0), float2(-6.0, -1.0))); + s1.a.mA.mB.mB = spvStorage_float3x2(float3x2(float2(-1.0, -2.0), float2(1.0, 6.0), float2(5.0, 7.0))); + s1.a.mA.mB.mC = uint3(3u, 1u, 5u); + s1.b.mA.mA.mA = spvStorage_float3x2(float3x2(float2(8.0, 3.0), float2(0.0, 2.0), float2(1.0, 8.0))); + s1.b.mA.mA.mB = spvStorage_float4x3(float4x3(float3(0.0, 9.0, -1.0), float3(-1.0, -7.0, 7.0), float3(-4.0, -3.0, 1.0), float3(-4.0, -9.0, 1.0))); + s1.c[0].mA[0] = short3(bool3(true, false, false)); + s1.c[0].mA[1] = short3(bool3(true, false, false)); + s1.c[1].mA[0] = short3(bool3(false)); + s1.c[1].mA[1] = short3(bool3(false)); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool _484 = abs(6.0 - float2x3(s1.a.mA.mA.mA)[0].x) < 0.0500000007450580596923828125; + bool _469; + if (_484) + { + _469 = abs(8.0 - float2x3(s1.a.mA.mA.mA)[0].y) < 0.0500000007450580596923828125; + } + else + { + _469 = _484; + } + bool _477; + if (_469) + { + _477 = abs(8.0 - float2x3(s1.a.mA.mA.mA)[0].z) < 0.0500000007450580596923828125; + } + else + { + _477 = _469; + } + bool _448; + if (_477) + { + bool _534 = abs(-float2x3(s1.a.mA.mA.mA)[1].x) < 0.0500000007450580596923828125; + bool _519; + if (_534) + { + _519 = abs((-4.0) - float2x3(s1.a.mA.mA.mA)[1].y) < 0.0500000007450580596923828125; + } + else + { + _519 = _534; + } + bool _527; + if (_519) + { + _527 = abs((-5.0) - float2x3(s1.a.mA.mA.mA)[1].z) < 0.0500000007450580596923828125; + } + else + { + _527 = _519; + } + _448 = _527; + } + else + { + _448 = _477; + } + bool _346; + if (_448) + { + bool _593 = abs(9.0 - float2x2(s1.a.mA.mB.mA)[0].x) < 0.0500000007450580596923828125; + bool _586; + if (_593) + { + _586 = abs((-4.0) - float2x2(s1.a.mA.mB.mA)[0].y) < 0.0500000007450580596923828125; + } + else + { + _586 = _593; + } + bool _567; + if (_586) + { + bool _626 = abs((-6.0) - float2x2(s1.a.mA.mB.mA)[1].x) < 0.0500000007450580596923828125; + bool _619; + if (_626) + { + _619 = abs((-1.0) - float2x2(s1.a.mA.mB.mA)[1].y) < 0.0500000007450580596923828125; + } + else + { + _619 = _626; + } + _567 = _619; + } + else + { + _567 = _586; + } + _346 = _567; + } + else + { + _346 = _448; + } + bool _355; + if (_346) + { + bool _688 = abs((-1.0) - float3x2(s1.a.mA.mB.mB)[0].x) < 0.0500000007450580596923828125; + bool _681; + if (_688) + { + _681 = abs((-2.0) - float3x2(s1.a.mA.mB.mB)[0].y) < 0.0500000007450580596923828125; + } + else + { + _681 = _688; + } + bool _654; + if (_681) + { + bool _721 = abs(1.0 - float3x2(s1.a.mA.mB.mB)[1].x) < 0.0500000007450580596923828125; + bool _714; + if (_721) + { + _714 = abs(6.0 - float3x2(s1.a.mA.mB.mB)[1].y) < 0.0500000007450580596923828125; + } + else + { + _714 = _721; + } + _654 = _714; + } + else + { + _654 = _681; + } + bool _662; + if (_654) + { + bool _754 = abs(5.0 - float3x2(s1.a.mA.mB.mB)[2].x) < 0.0500000007450580596923828125; + bool _747; + if (_754) + { + _747 = abs(7.0 - float3x2(s1.a.mA.mB.mB)[2].y) < 0.0500000007450580596923828125; + } + else + { + _747 = _754; + } + _662 = _747; + } + else + { + _662 = _654; + } + _355 = _662; + } + else + { + _355 = _346; + } + bool _364; + if (_355) + { + _364 = all(uint3(3u, 1u, 5u) == s1.a.mA.mB.mC); + } + else + { + _364 = _355; + } + bool _373; + if (_364) + { + bool _822 = abs(8.0 - float3x2(s1.b.mA.mA.mA)[0].x) < 0.0500000007450580596923828125; + bool _815; + if (_822) + { + _815 = abs(3.0 - float3x2(s1.b.mA.mA.mA)[0].y) < 0.0500000007450580596923828125; + } + else + { + _815 = _822; + } + bool _788; + if (_815) + { + bool _855 = abs(-float3x2(s1.b.mA.mA.mA)[1].x) < 0.0500000007450580596923828125; + bool _848; + if (_855) + { + _848 = abs(2.0 - float3x2(s1.b.mA.mA.mA)[1].y) < 0.0500000007450580596923828125; + } + else + { + _848 = _855; + } + _788 = _848; + } + else + { + _788 = _815; + } + bool _796; + if (_788) + { + bool _888 = abs(1.0 - float3x2(s1.b.mA.mA.mA)[2].x) < 0.0500000007450580596923828125; + bool _881; + if (_888) + { + _881 = abs(8.0 - float3x2(s1.b.mA.mA.mA)[2].y) < 0.0500000007450580596923828125; + } + else + { + _881 = _888; + } + _796 = _881; + } + else + { + _796 = _788; + } + _373 = _796; + } + else + { + _373 = _364; + } + bool _382; + if (_373) + { + bool _970 = abs(-float4x3(s1.b.mA.mA.mB)[0].x) < 0.0500000007450580596923828125; + bool _955; + if (_970) + { + _955 = abs(9.0 - float4x3(s1.b.mA.mA.mB)[0].y) < 0.0500000007450580596923828125; + } + else + { + _955 = _970; + } + bool _963; + if (_955) + { + _963 = abs((-1.0) - float4x3(s1.b.mA.mA.mB)[0].z) < 0.0500000007450580596923828125; + } + else + { + _963 = _955; + } + bool _918; + if (_963) + { + bool _1020 = abs((-1.0) - float4x3(s1.b.mA.mA.mB)[1].x) < 0.0500000007450580596923828125; + bool _1005; + if (_1020) + { + _1005 = abs((-7.0) - float4x3(s1.b.mA.mA.mB)[1].y) < 0.0500000007450580596923828125; + } + else + { + _1005 = _1020; + } + bool _1013; + if (_1005) + { + _1013 = abs(7.0 - float4x3(s1.b.mA.mA.mB)[1].z) < 0.0500000007450580596923828125; + } + else + { + _1013 = _1005; + } + _918 = _1013; + } + else + { + _918 = _963; + } + bool _926; + if (_918) + { + bool _1070 = abs((-4.0) - float4x3(s1.b.mA.mA.mB)[2].x) < 0.0500000007450580596923828125; + bool _1055; + if (_1070) + { + _1055 = abs((-3.0) - float4x3(s1.b.mA.mA.mB)[2].y) < 0.0500000007450580596923828125; + } + else + { + _1055 = _1070; + } + bool _1063; + if (_1055) + { + _1063 = abs(1.0 - float4x3(s1.b.mA.mA.mB)[2].z) < 0.0500000007450580596923828125; + } + else + { + _1063 = _1055; + } + _926 = _1063; + } + else + { + _926 = _918; + } + bool _934; + if (_926) + { + bool _1120 = abs((-4.0) - float4x3(s1.b.mA.mA.mB)[3].x) < 0.0500000007450580596923828125; + bool _1105; + if (_1120) + { + _1105 = abs((-9.0) - float4x3(s1.b.mA.mA.mB)[3].y) < 0.0500000007450580596923828125; + } + else + { + _1105 = _1120; + } + bool _1113; + if (_1105) + { + _1113 = abs(1.0 - float4x3(s1.b.mA.mA.mB)[3].z) < 0.0500000007450580596923828125; + } + else + { + _1113 = _1105; + } + _934 = _1113; + } + else + { + _934 = _926; + } + _382 = _934; + } + else + { + _382 = _373; + } + bool _391; + if (_382) + { + _391 = all(bool3(true, false, false) == bool3(s1.c[0].mA[0])); + } + else + { + _391 = _382; + } + bool _400; + if (_391) + { + _400 = all(bool3(true, false, false) == bool3(s1.c[0].mA[1])); + } + else + { + _400 = _391; + } + bool _409; + if (_400) + { + _409 = all(bool3(false) == bool3(s1.c[1].mA[0])); + } + else + { + _409 = _400; + } + bool _418; + if (_409) + { + _418 = all(bool3(false) == bool3(s1.c[1].mA[1])); + } + else + { + _418 = _409; + } + if (_418) + { + _424.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct.comp new file mode 100644 index 0000000000..6565536651 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-matrix-nested-struct.comp @@ -0,0 +1,1443 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + uint a; + float4 b; +}; + +struct sA +{ + spvStorage_float4x4 mA; + short3 mB; + short4 mC; +}; + +struct sB +{ + short2 mA; +}; + +struct sC +{ + float mA; + uint4 mB; + float mC; +}; + +struct sD +{ + sA mA; + sB mB; + sC mC; +}; + +struct sE +{ + sD mA; +}; + +struct sF +{ + uint3 mA; + short mB; +}; + +struct sG +{ + sF mA; + spvStorage_float3x2 mB; +}; + +struct sH +{ + sG mA; + float2 mB; +}; + +struct sI +{ + spvStorage_float2x2 mA; + short3 mB; + short4 mC; +}; + +struct sJ +{ + sI mA; + short3 mB; +}; + +struct sK +{ + short2 mA; + sJ mB; + int2 mC; +}; + +struct S2 +{ + sE a; + int3 b; + sH c; + sK d; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device block& _612 [[buffer(0)]]) +{ + threadgroup S1 s1; + threadgroup S2 s2; + s1.a = 0u; + s1.b = float4(8.0, 8.0, 0.0, -4.0); + s2.a.mA.mA.mA = spvStorage_float4x4(float4x4(float4(-5.0, 9.0, -4.0, -6.0), float4(-1.0, -1.0, -2.0, 1.0), float4(6.0, 5.0, 7.0, -2.0), float4(-4.0, -9.0, 8.0, 3.0))); + s2.a.mA.mA.mB = short3(bool3(true, false, false)); + s2.a.mA.mA.mC = short4(bool4(true, true, true, false)); + s2.a.mA.mB.mA = short2(bool2(true)); + s2.a.mA.mC.mA = 7.0; + s2.a.mA.mC.mB = uint4(8u, 6u, 2u, 0u); + s2.a.mA.mC.mC = -9.0; + s2.b = int3(1, -4, 0); + s2.c.mA.mA.mA = uint3(4u, 9u, 1u); + s2.c.mA.mA.mB = short(false); + s2.c.mA.mB = spvStorage_float3x2(float3x2(float2(3.0, -5.0), float2(-1.0, -5.0), float2(-1.0, -9.0))); + s2.c.mB = float2(-6.0, -9.0); + s2.d.mA = short2(bool2(true, false)); + s2.d.mB.mA.mA = spvStorage_float2x2(float2x2(float2(-2.0, 3.0), float2(7.0, 2.0))); + s2.d.mB.mA.mB = short3(bool3(false)); + s2.d.mB.mA.mC = short4(bool4(false, false, false, true)); + s2.d.mB.mB = short3(bool3(true, false, false)); + s2.d.mC = int2(-9, 0); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool _622 = 0u == s1.a; + bool _444; + if (_622) + { + bool _668 = abs(8.0 - s1.b.x) < 0.0500000007450580596923828125; + bool _645; + if (_668) + { + _645 = abs(8.0 - s1.b.y) < 0.0500000007450580596923828125; + } + else + { + _645 = _668; + } + bool _653; + if (_645) + { + _653 = abs(-s1.b.z) < 0.0500000007450580596923828125; + } + else + { + _653 = _645; + } + bool _661; + if (_653) + { + _661 = abs((-4.0) - s1.b.w) < 0.0500000007450580596923828125; + } + else + { + _661 = _653; + } + _444 = _661; + } + else + { + _444 = _622; + } + bool _453; + if (_444) + { + bool _774 = abs((-5.0) - float4x4(s2.a.mA.mA.mA)[0].x) < 0.0500000007450580596923828125; + bool _751; + if (_774) + { + _751 = abs(9.0 - float4x4(s2.a.mA.mA.mA)[0].y) < 0.0500000007450580596923828125; + } + else + { + _751 = _774; + } + bool _759; + if (_751) + { + _759 = abs((-4.0) - float4x4(s2.a.mA.mA.mA)[0].z) < 0.0500000007450580596923828125; + } + else + { + _759 = _751; + } + bool _767; + if (_759) + { + _767 = abs((-6.0) - float4x4(s2.a.mA.mA.mA)[0].w) < 0.0500000007450580596923828125; + } + else + { + _767 = _759; + } + bool _712; + if (_767) + { + bool _841 = abs((-1.0) - float4x4(s2.a.mA.mA.mA)[1].x) < 0.0500000007450580596923828125; + bool _818; + if (_841) + { + _818 = abs((-1.0) - float4x4(s2.a.mA.mA.mA)[1].y) < 0.0500000007450580596923828125; + } + else + { + _818 = _841; + } + bool _826; + if (_818) + { + _826 = abs((-2.0) - float4x4(s2.a.mA.mA.mA)[1].z) < 0.0500000007450580596923828125; + } + else + { + _826 = _818; + } + bool _834; + if (_826) + { + _834 = abs(1.0 - float4x4(s2.a.mA.mA.mA)[1].w) < 0.0500000007450580596923828125; + } + else + { + _834 = _826; + } + _712 = _834; + } + else + { + _712 = _767; + } + bool _720; + if (_712) + { + bool _908 = abs(6.0 - float4x4(s2.a.mA.mA.mA)[2].x) < 0.0500000007450580596923828125; + bool _885; + if (_908) + { + _885 = abs(5.0 - float4x4(s2.a.mA.mA.mA)[2].y) < 0.0500000007450580596923828125; + } + else + { + _885 = _908; + } + bool _893; + if (_885) + { + _893 = abs(7.0 - float4x4(s2.a.mA.mA.mA)[2].z) < 0.0500000007450580596923828125; + } + else + { + _893 = _885; + } + bool _901; + if (_893) + { + _901 = abs((-2.0) - float4x4(s2.a.mA.mA.mA)[2].w) < 0.0500000007450580596923828125; + } + else + { + _901 = _893; + } + _720 = _901; + } + else + { + _720 = _712; + } + bool _728; + if (_720) + { + bool _975 = abs((-4.0) - float4x4(s2.a.mA.mA.mA)[3].x) < 0.0500000007450580596923828125; + bool _952; + if (_975) + { + _952 = abs((-9.0) - float4x4(s2.a.mA.mA.mA)[3].y) < 0.0500000007450580596923828125; + } + else + { + _952 = _975; + } + bool _960; + if (_952) + { + _960 = abs(8.0 - float4x4(s2.a.mA.mA.mA)[3].z) < 0.0500000007450580596923828125; + } + else + { + _960 = _952; + } + bool _968; + if (_960) + { + _968 = abs(3.0 - float4x4(s2.a.mA.mA.mA)[3].w) < 0.0500000007450580596923828125; + } + else + { + _968 = _960; + } + _728 = _968; + } + else + { + _728 = _720; + } + _453 = _728; + } + else + { + _453 = _444; + } + bool _462; + if (_453) + { + _462 = all(bool3(true, false, false) == bool3(s2.a.mA.mA.mB)); + } + else + { + _462 = _453; + } + bool _471; + if (_462) + { + _471 = all(bool4(true, true, true, false) == bool4(s2.a.mA.mA.mC)); + } + else + { + _471 = _462; + } + bool _480; + if (_471) + { + _480 = all(bool2(true) == bool2(s2.a.mA.mB.mA)); + } + else + { + _480 = _471; + } + bool _489; + if (_480) + { + _489 = abs(7.0 - s2.a.mA.mC.mA) < 0.0500000007450580596923828125; + } + else + { + _489 = _480; + } + bool _498; + if (_489) + { + _498 = all(uint4(8u, 6u, 2u, 0u) == s2.a.mA.mC.mB); + } + else + { + _498 = _489; + } + bool _507; + if (_498) + { + _507 = abs((-9.0) - s2.a.mA.mC.mC) < 0.0500000007450580596923828125; + } + else + { + _507 = _498; + } + bool _516; + if (_507) + { + _516 = all(int3(1, -4, 0) == s2.b); + } + else + { + _516 = _507; + } + bool _525; + if (_516) + { + _525 = all(uint3(4u, 9u, 1u) == s2.c.mA.mA.mA); + } + else + { + _525 = _516; + } + bool _534; + if (_525) + { + _534 = false == bool(s2.c.mA.mA.mB); + } + else + { + _534 = _525; + } + bool _543; + if (_534) + { + bool _1106 = abs(3.0 - float3x2(s2.c.mA.mB)[0].x) < 0.0500000007450580596923828125; + bool _1099; + if (_1106) + { + _1099 = abs((-5.0) - float3x2(s2.c.mA.mB)[0].y) < 0.0500000007450580596923828125; + } + else + { + _1099 = _1106; + } + bool _1072; + if (_1099) + { + bool _1139 = abs((-1.0) - float3x2(s2.c.mA.mB)[1].x) < 0.0500000007450580596923828125; + bool _1132; + if (_1139) + { + _1132 = abs((-5.0) - float3x2(s2.c.mA.mB)[1].y) < 0.0500000007450580596923828125; + } + else + { + _1132 = _1139; + } + _1072 = _1132; + } + else + { + _1072 = _1099; + } + bool _1080; + if (_1072) + { + bool _1172 = abs((-1.0) - float3x2(s2.c.mA.mB)[2].x) < 0.0500000007450580596923828125; + bool _1165; + if (_1172) + { + _1165 = abs((-9.0) - float3x2(s2.c.mA.mB)[2].y) < 0.0500000007450580596923828125; + } + else + { + _1165 = _1172; + } + _1080 = _1165; + } + else + { + _1080 = _1072; + } + _543 = _1080; + } + else + { + _543 = _534; + } + bool _552; + if (_543) + { + bool _1205 = abs((-6.0) - s2.c.mB.x) < 0.0500000007450580596923828125; + bool _1198; + if (_1205) + { + _1198 = abs((-9.0) - s2.c.mB.y) < 0.0500000007450580596923828125; + } + else + { + _1198 = _1205; + } + _552 = _1198; + } + else + { + _552 = _543; + } + bool _561; + if (_552) + { + _561 = all(bool2(true, false) == bool2(s2.d.mA)); + } + else + { + _561 = _552; + } + bool _570; + if (_561) + { + bool _1263 = abs((-2.0) - float2x2(s2.d.mB.mA.mA)[0].x) < 0.0500000007450580596923828125; + bool _1256; + if (_1263) + { + _1256 = abs(3.0 - float2x2(s2.d.mB.mA.mA)[0].y) < 0.0500000007450580596923828125; + } + else + { + _1256 = _1263; + } + bool _1237; + if (_1256) + { + bool _1296 = abs(7.0 - float2x2(s2.d.mB.mA.mA)[1].x) < 0.0500000007450580596923828125; + bool _1289; + if (_1296) + { + _1289 = abs(2.0 - float2x2(s2.d.mB.mA.mA)[1].y) < 0.0500000007450580596923828125; + } + else + { + _1289 = _1296; + } + _1237 = _1289; + } + else + { + _1237 = _1256; + } + _570 = _1237; + } + else + { + _570 = _561; + } + bool _579; + if (_570) + { + _579 = all(bool3(false) == bool3(s2.d.mB.mA.mB)); + } + else + { + _579 = _570; + } + bool _588; + if (_579) + { + _588 = all(bool4(false, false, false, true) == bool4(s2.d.mB.mA.mC)); + } + else + { + _588 = _579; + } + bool _597; + if (_588) + { + _597 = all(bool3(true, false, false) == bool3(s2.d.mB.mB)); + } + else + { + _597 = _588; + } + bool _606; + if (_597) + { + _606 = all(int2(-9, 0) == s2.d.mC); + } + else + { + _606 = _597; + } + if (_606) + { + _612.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-struct-bool-cast.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-struct-bool-cast.comp new file mode 100644 index 0000000000..538ab0bd69 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared-struct-bool-cast.comp @@ -0,0 +1,63 @@ +#include +#include + +using namespace metal; + +struct S1 +{ + int3 a; + uint2 b; + short4 c; + uint d; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device block& _132 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a = int3(6, 8, 8); + s1.b = uint2(4u); + s1.c = short4(bool4(false, false, false, true)); + s1.d = 6u; + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool _144 = all(int3(6, 8, 8) == s1.a); + bool _108; + if (_144) + { + _108 = all(uint2(4u) == s1.b); + } + else + { + _108 = _144; + } + bool _117; + if (_108) + { + _117 = all(bool4(false, false, false, true) == bool4(s1.c)); + } + else + { + _117 = _108; + } + bool _126; + if (_117) + { + _126 = 6u == s1.d; + } + else + { + _126 = _117; + } + if (_126) + { + _132.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp new file mode 100644 index 0000000000..029ab539fd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/shared.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float in_data[1]; +}; + +struct SSBO2 +{ + float out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + threadgroup float sShared[4]; + sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; + threadgroup_barrier(mem_flags::mem_threadgroup); + _44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..8f54f0528d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,49 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +constant int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +constant int c = SPIRV_CROSS_CONSTANT_ID_2; +constant int d = (c + 50); + +struct SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +constant int e_tmp [[function_constant(3)]]; +constant int e = is_function_constant_defined(e_tmp) ? e_tmp : 400; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..de30edec15 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; +constant int a_tmp [[function_constant(0)]]; +constant int a = is_function_constant_defined(a_tmp) ? a_tmp : 1; + +struct SSBO +{ + int v[1]; +}; + +constant uint _21 = (uint(a) + 0u); +constant uint _22_tmp [[function_constant(10)]]; +constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, 20u, 1u); +constant uint _27 = gl_WorkGroupSize.x; +constant uint _28 = (_21 + _27); +constant uint _29 = gl_WorkGroupSize.y; +constant uint _30 = (_28 + _29); +constant int _32 = (1 - a); + +kernel void main0(device SSBO& _17 [[buffer(0)]]) +{ + spvUnsafeArray spec_const_array_size; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp new file mode 100644 index 0000000000..b584f307ef --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp @@ -0,0 +1,91 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Sub +{ + float4 f[2]; + float4 f2[2]; + float3 f3[2]; + float4 f4[2]; +}; + +struct SSBO +{ + Sub sub[2]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + spvUnsafeArray _155; + _155[0] = _27.sub[gl_WorkGroupID.x].f[0].x; + _155[1] = _27.sub[gl_WorkGroupID.x].f[1].x; + spvUnsafeArray _156; + _156[0] = _27.sub[gl_WorkGroupID.x].f2[0].xy; + _156[1] = _27.sub[gl_WorkGroupID.x].f2[1].xy; + spvUnsafeArray _157; + _157[0] = _27.sub[gl_WorkGroupID.x].f3[0]; + _157[1] = _27.sub[gl_WorkGroupID.x].f3[1]; + spvUnsafeArray _158; + _158[0] = _27.sub[gl_WorkGroupID.x].f4[0]; + _158[1] = _27.sub[gl_WorkGroupID.x].f4[1]; + _155[gl_GlobalInvocationID.x] += 1.0; + _156[gl_GlobalInvocationID.x] += float2(2.0); + _157[gl_GlobalInvocationID.x] += float3(3.0); + _158[gl_GlobalInvocationID.x] += float4(4.0); + (device float&)_27.sub[gl_WorkGroupID.x].f[0] = _155[0]; + (device float&)_27.sub[gl_WorkGroupID.x].f[1] = _155[1]; + (device float2&)_27.sub[gl_WorkGroupID.x].f2[0] = _156[0]; + (device float2&)_27.sub[gl_WorkGroupID.x].f2[1] = _156[1]; + _27.sub[gl_WorkGroupID.x].f3[0] = _157[0]; + _27.sub[gl_WorkGroupID.x].f3[1] = _157[1]; + _27.sub[gl_WorkGroupID.x].f4[0] = _158[0]; + _27.sub[gl_WorkGroupID.x].f4[1] = _158[1]; + (device float&)_27.sub[0].f[0] = _27.sub[0].f[0].x + 5.0; + (device float2&)_27.sub[0].f2[1] = _27.sub[0].f2[1].xy + float2(5.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp new file mode 100644 index 0000000000..0445f5aef9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-layout.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float4x4 m; +}; + +struct SSBO2 +{ + Foo out_data[1]; +}; + +struct SSBO +{ + Foo in_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _23 [[buffer(0)]], const device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _23.out_data[gl_GlobalInvocationID.x].m = _30.in_data[gl_GlobalInvocationID.x].m * _30.in_data[gl_GlobalInvocationID.x].m; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-nested.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-nested.comp new file mode 100644 index 0000000000..ad706c5909 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-nested.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct s1 +{ + int a; +}; + +struct s2 +{ + s1 b; +}; + +struct dstbuffer +{ + s2 test[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device dstbuffer& _19 [[buffer(0)]]) +{ + _19.test[0].b.a = 0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-packing.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-packing.comp new file mode 100644 index 0000000000..dc1654399d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/struct-packing.comp @@ -0,0 +1,152 @@ +#include +#include + +using namespace metal; + +struct S0 +{ + float2 a[1]; + float b; + char _m0_final_padding[4]; +}; + +struct S1 +{ + packed_float3 a; + float b; +}; + +struct S2 +{ + float3 a[1]; + float b; + char _m0_final_padding[12]; +}; + +struct S3 +{ + float2 a; + float b; +}; + +struct S4 +{ + float2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + S4 m3s[8]; + char _m0_final_padding[8]; +}; + +struct SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + float2x2 m0; + float2x2 m1; + float2x3 m2[4]; + float3x2 m3; + float2x2 m4; + float2x2 m5[9]; + float3x2 m6[4][2]; + float2x3 m7; + float array[1]; +}; + +struct S0_1 +{ + float2 a[1]; + char _m1_pad[8]; + float b; + char _m0_final_padding[12]; +}; + +struct S1_1 +{ + packed_float3 a; + float b; +}; + +struct S2_1 +{ + float3 a[1]; + float b; + char _m0_final_padding[12]; +}; + +struct S3_1 +{ + float2 a; + float b; +}; + +struct S4_1 +{ + float2 c; + char _m0_final_padding[8]; +}; + +struct Content_1 +{ + S0_1 m0s[1]; + S1_1 m1s[1]; + S2_1 m2s[1]; + S0_1 m0; + S1_1 m1; + S2_1 m2; + S3_1 m3; + float m4; + char _m8_pad[8]; + S4_1 m3s[8]; +}; + +struct SSBO0 +{ + Content_1 content; + Content_1 content1[2]; + Content_1 content2; + float4 array[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO1& ssbo_430 [[buffer(0)]], device SSBO0& ssbo_140 [[buffer(1)]]) +{ + Content_1 _60 = ssbo_140.content; + ssbo_430.content.m0s[0].a[0] = _60.m0s[0].a[0]; + ssbo_430.content.m0s[0].b = _60.m0s[0].b; + ssbo_430.content.m1s[0].a = float3(_60.m1s[0].a); + ssbo_430.content.m1s[0].b = _60.m1s[0].b; + ssbo_430.content.m2s[0].a[0] = _60.m2s[0].a[0]; + ssbo_430.content.m2s[0].b = _60.m2s[0].b; + ssbo_430.content.m0.a[0] = _60.m0.a[0]; + ssbo_430.content.m0.b = _60.m0.b; + ssbo_430.content.m1.a = float3(_60.m1.a); + ssbo_430.content.m1.b = _60.m1.b; + ssbo_430.content.m2.a[0] = _60.m2.a[0]; + ssbo_430.content.m2.b = _60.m2.b; + ssbo_430.content.m3.a = _60.m3.a; + ssbo_430.content.m3.b = _60.m3.b; + ssbo_430.content.m4 = _60.m4; + ssbo_430.content.m3s[0].c = _60.m3s[0].c; + ssbo_430.content.m3s[1].c = _60.m3s[1].c; + ssbo_430.content.m3s[2].c = _60.m3s[2].c; + ssbo_430.content.m3s[3].c = _60.m3s[3].c; + ssbo_430.content.m3s[4].c = _60.m3s[4].c; + ssbo_430.content.m3s[5].c = _60.m3s[5].c; + ssbo_430.content.m3s[6].c = _60.m3s[6].c; + ssbo_430.content.m3s[7].c = _60.m3s[7].c; + ssbo_430.content.m1.a = ssbo_430.content.m3.a * ssbo_430.m6[1][1]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp new file mode 100644 index 0000000000..c1eccf2780 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/threadgroup-boolean-workaround.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 values[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(device SSBO& _23 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup short4 foo[4]; + foo[gl_LocalInvocationIndex] = short4(_23.values[gl_GlobalInvocationID.x] != float4(10.0)); + threadgroup_barrier(mem_flags::mem_threadgroup); + _23.values[gl_GlobalInvocationID.x] = select(float4(40.0), float4(30.0), bool4(foo[gl_LocalInvocationIndex ^ 3u])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp new file mode 100644 index 0000000000..ff7e02e202 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/torture-loop.comp @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4x4 mvp; + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 _101; + _101 = _24.in_data[gl_GlobalInvocationID.x]; + for (int _95 = 0; (_95 + 1) < 10; ) + { + _101 *= 2.0; + _95 += 2; + continue; + } + float4 _100; + _100 = _101; + float4 _105; + for (uint _96 = 0u; _96 < 16u; _100 = _105, _96++) + { + _105 = _100; + for (uint _102 = 0u; _102 < 30u; ) + { + _105 = _24.mvp * _105; + _102++; + continue; + } + } + _89.out_data[gl_GlobalInvocationID.x] = _100; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/type-alias.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/type-alias.comp new file mode 100644 index 0000000000..2f6a0b7ba8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/type-alias.comp @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct S0 +{ + float4 a; +}; + +struct SSBO0 +{ + S0 s0s[1]; +}; + +struct S1 +{ + float4 a; +}; + +struct SSBO1 +{ + S1 s1s[1]; +}; + +struct SSBO2 +{ + float4 outputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/type_casting_i64.msl22.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/type_casting_i64.msl22.comp new file mode 100644 index 0000000000..6820b077a1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/type_casting_i64.msl22.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct dst_buff_t +{ + int m0[1]; +}; + +struct src_buff_t +{ + int m0[1]; +}; + +constant int base_val_tmp [[function_constant(0)]]; +constant int base_val = is_function_constant_defined(base_val_tmp) ? base_val_tmp : 0; +constant long shift_val_tmp [[function_constant(1)]]; +constant long shift_val = is_function_constant_defined(shift_val_tmp) ? shift_val_tmp : 0l; +constant int offset = (base_val >> int(shift_val)); +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device dst_buff_t& dst_buff [[buffer(0)]], device src_buff_t& src_buff [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + dst_buff.m0[gl_GlobalInvocationID.x] = src_buff.m0[gl_GlobalInvocationID.x] + offset; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/udiv.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/udiv.comp new file mode 100644 index 0000000000..7f7315b882 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/udiv.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + uint outputs[1]; +}; + +struct SSBO +{ + uint inputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp b/third_party/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp new file mode 100644 index 0000000000..310cda7fef --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b = mod(myStorage.b + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..cea12980c6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,179 @@ +#include +#include + +using namespace metal; + +struct SSBOUint +{ + uint a; + uint b; + uint c; + uint d; + uint2 a2; + uint2 b2; + uint2 c2; + uint2 d2; + uint3 a3; + uint3 b3; + uint3 c3; + uint3 d3; + uint4 a4; + uint4 b4; + uint4 c4; + uint4 d4; +}; + +struct ResType +{ + uint _m0; + uint _m1; +}; + +struct ResType_1 +{ + uint2 _m0; + uint2 _m1; +}; + +struct ResType_2 +{ + uint3 _m0; + uint3 _m1; +}; + +struct ResType_3 +{ + uint4 _m0; + uint4 _m1; +}; + +struct SSBOInt +{ + int a; + int b; + int c; + int d; + int2 a2; + int2 b2; + int2 c2; + int2 d2; + int3 a3; + int3 b3; + int3 c3; + int3 d3; + int4 a4; + int4 b4; + int4 c4; + int4 d4; +}; + +struct ResType_4 +{ + int _m0; + int _m1; +}; + +struct ResType_5 +{ + int2 _m0; + int2 _m1; +}; + +struct ResType_6 +{ + int3 _m0; + int3 _m1; +}; + +struct ResType_7 +{ + int4 _m0; + int4 _m1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBOUint& u [[buffer(0)]], device SSBOInt& i [[buffer(1)]]) +{ + ResType _25; + _25._m0 = u.a + u.b; + _25._m1 = select(uint(1), uint(0), _25._m0 >= max(u.a, u.b)); + u.d = _25._m1; + u.c = _25._m0; + ResType_1 _40; + _40._m0 = u.a2 + u.b2; + _40._m1 = select(uint2(1), uint2(0), _40._m0 >= max(u.a2, u.b2)); + u.d2 = _40._m1; + u.c2 = _40._m0; + ResType_2 _55; + _55._m0 = u.a3 + u.b3; + _55._m1 = select(uint3(1), uint3(0), _55._m0 >= max(u.a3, u.b3)); + u.d3 = _55._m1; + u.c3 = _55._m0; + ResType_3 _70; + _70._m0 = u.a4 + u.b4; + _70._m1 = select(uint4(1), uint4(0), _70._m0 >= max(u.a4, u.b4)); + u.d4 = _70._m1; + u.c4 = _70._m0; + ResType _79; + _79._m0 = u.a - u.b; + _79._m1 = select(uint(1), uint(0), u.a >= u.b); + u.d = _79._m1; + u.c = _79._m0; + ResType_1 _88; + _88._m0 = u.a2 - u.b2; + _88._m1 = select(uint2(1), uint2(0), u.a2 >= u.b2); + u.d2 = _88._m1; + u.c2 = _88._m0; + ResType_2 _97; + _97._m0 = u.a3 - u.b3; + _97._m1 = select(uint3(1), uint3(0), u.a3 >= u.b3); + u.d3 = _97._m1; + u.c3 = _97._m0; + ResType_3 _106; + _106._m0 = u.a4 - u.b4; + _106._m1 = select(uint4(1), uint4(0), u.a4 >= u.b4); + u.d4 = _106._m1; + u.c4 = _106._m0; + ResType _116; + _116._m0 = u.a * u.b; + _116._m1 = mulhi(u.a, u.b); + u.d = _116._m0; + u.c = _116._m1; + ResType_1 _125; + _125._m0 = u.a2 * u.b2; + _125._m1 = mulhi(u.a2, u.b2); + u.d2 = _125._m0; + u.c2 = _125._m1; + ResType_2 _134; + _134._m0 = u.a3 * u.b3; + _134._m1 = mulhi(u.a3, u.b3); + u.d3 = _134._m0; + u.c3 = _134._m1; + ResType_3 _143; + _143._m0 = u.a4 * u.b4; + _143._m1 = mulhi(u.a4, u.b4); + u.d4 = _143._m0; + u.c4 = _143._m1; + ResType_4 _160; + _160._m0 = i.a * i.b; + _160._m1 = mulhi(i.a, i.b); + i.d = _160._m0; + i.c = _160._m1; + ResType_5 _171; + _171._m0 = i.a2 * i.b2; + _171._m1 = mulhi(i.a2, i.b2); + i.d2 = _171._m0; + i.c2 = _171._m1; + ResType_6 _182; + _182._m0 = i.a3 * i.b3; + _182._m1 = mulhi(i.a3, i.b3); + i.d3 = _182._m0; + i.c3 = _182._m1; + ResType_7 _193; + _193._m0 = i.a4 * i.b4; + _193._m1 = mulhi(i.a4, i.b4); + i.d4 = _193._m0; + i.c4 = _193._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..4083e4ea16 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +fragment void main0(texture2d_ms uImageMS [[texture(0)]], texture2d_array uImageArray [[texture(1)]], texture2d uImage [[texture(2)]]) +{ + uImage.write(uImageMS.read(uint2(int2(1, 2)), 2), uint2(int2(2, 3))); + uImageArray.write(uImageArray.read(uint2(int3(1, 2, 4).xy), uint(int3(1, 2, 4).z)), uint2(int3(2, 3, 7).xy), uint(int3(2, 3, 7).z)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..922796b749 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(float(int(uSampler.get_num_mip_levels()))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..330bc64037 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], texture2d_ms uImage [[texture(1)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(float(int(uSampler.get_num_samples()) + int(uImage.get_num_samples()))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc new file mode 100644 index 0000000000..01fceeb6c7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float3 vVertex; +}; + +struct main0_patchOut +{ + spvUnsafeArray vPatch; +}; + +struct main0_in +{ + float3 vInput [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput + gl_in[gl_InvocationID ^ 1].vInput; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0) + { + patchOut.vPatch[0] = float3(10.0); + patchOut.vPatch[1] = float3(20.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..8ebde9d9d7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + float3 vFoo; +}; + +struct main0_in +{ + uint3 m_86; + ushort2 m_90; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 1]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 1; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..7276384320 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + float3 vFoo; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 1) + return; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..184a4a6f9b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct Boo +{ + float3 a; + uint3 b; +}; + +struct main0_out +{ + Boo vVertex; +}; + +struct main0_in +{ + Boo vInput; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc new file mode 100644 index 0000000000..f5fd60a9f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct Boo +{ + float3 a; + float3 b; +}; + +struct main0_out +{ + Boo vVertex; +}; + +struct main0_in +{ + float3 vInput_a [[attribute(0)]]; + float3 vInput_b [[attribute(1)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + Boo _25 = Boo{ gl_in[gl_InvocationID].vInput_a, gl_in[gl_InvocationID].vInput_b }; + gl_out[gl_InvocationID].vVertex = _25; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..dff8cb7bbd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + out.gl_Position = ((patchIn.gl_in[0].gl_Position * gl_TessCoord.x) + (patchIn.gl_in[1].gl_Position * gl_TessCoord.y)) + (patchIn.gl_in[2].gl_Position * gl_TessCoord.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert new file mode 100644 index 0000000000..a414c98542 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(10.0); + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 4.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..2d98929051 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(10.0); + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 4.0; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert new file mode 100644 index 0000000000..b3c8b6bb27 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], uint3 spvDispatchBase [[grid_origin]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + uint gl_BaseVertex = spvDispatchBase.x; + uint gl_BaseInstance = spvDispatchBase.y; + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert new file mode 100644 index 0000000000..a32c1948f8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(uint gl_BaseVertex [[base_vertex]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/basic.flatten.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..f4549abab2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/multiindex.flatten.vert @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 Data[3][5]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + int2 aIndex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _20 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _20.Data[in.aIndex.x][in.aIndex.y]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..8f2e8c173f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/push-constant.flatten.vert @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct PushMe +{ + float4x4 MVP; + float2x2 Rot; + float Arr[4]; +}; + +struct main0_out +{ + float2 vRot [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 Rot [[attribute(0)]]; + float4 Pos [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant PushMe& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = registers.MVP * in.Pos; + out.vRot = (registers.Rot * in.Rot) + float2(registers.Arr[2]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..b40528115f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/rowmajor.flatten.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVPR; + float4x4 uMVPC; + float4x4 uMVP; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (_18.uMVPR * in.aVertex) + (in.aVertex * _18.uMVPC); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..dc96ceae3e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/struct.flatten.vert @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light light; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _18.uMVP * in.aVertex; + out.vColor = float4(0.0); + float3 _39 = in.aVertex.xyz - float3(_18.light.Position); + out.vColor += ((_18.light.Color * fast::clamp(1.0 - (length(_39) / _18.light.Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(_39))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..52940411bc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/swizzle.flatten.vert @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 A; + float2 B0; + float2 B1; + float C0; + float3 C1; + packed_float3 D0; + float D1; + float E0; + float E1; + float E2; + float E3; + float F0; + float2 F1; + float F2; +}; + +struct main0_out +{ + float4 oA [[user(locn0)]]; + float4 oB [[user(locn1)]]; + float4 oC [[user(locn2)]]; + float4 oD [[user(locn3)]]; + float4 oE [[user(locn4)]]; + float4 oF [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant UBO& _22 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = float4(0.0); + out.oA = _22.A; + out.oB = float4(_22.B0, _22.B1); + out.oC = float4(_22.C0, _22.C1) + float4(_22.C1.xy, _22.C1.z, _22.C0); + out.oD = float4(_22.D0[0], _22.D0[1], _22.D0[2], _22.D1) + float4(_22.D0[0], _22.D0[1], _22.D0[2u], _22.D1); + out.oE = float4(_22.E0, _22.E1, _22.E2, _22.E3); + out.oF = float4(_22.F0, _22.F1, _22.F2); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/flatten/types.flatten.frag b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/types.flatten.frag new file mode 100644 index 0000000000..cee53d9e58 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/flatten/types.flatten.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct UBO1 +{ + int4 c; + int4 d; +}; + +struct UBO2 +{ + uint4 e; + uint4 f; +}; + +struct UBO0 +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO1& _14 [[buffer(0)]], constant UBO2& _29 [[buffer(1)]], constant UBO0& _41 [[buffer(2)]]) +{ + main0_out out = {}; + out.FragColor = ((((float4(_14.c) + float4(_14.d)) + float4(_29.e)) + float4(_29.f)) + _41.a) + _41.b; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag new file mode 100644 index 0000000000..bdf9080bd2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -0,0 +1,73 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 ssbo; +}; + +struct SSBOs +{ + float4 ssbo; +}; + +struct Push +{ + float4 push; +}; + +struct UBO +{ + float4 ubo; +}; + +struct UBOs +{ + float4 ubo; +}; + +struct spvDescriptorSetBuffer0 +{ + texture2d uTexture [[id(0)]]; + sampler uTextureSmplr [[id(1)]]; + array, 2> uTextures [[id(2)]]; + array uTexturesSmplr [[id(4)]]; + constant UBO* m_90 [[id(6)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + array, 4> uTexture2 [[id(0)]]; + array uSampler [[id(4)]]; + device SSBO* m_60 [[id(6)]]; + const device SSBOs* ssbos [[id(7)]][2]; +}; + +struct spvDescriptorSetBuffer2 +{ + constant UBOs* ubos [[id(0)]][4]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant Push& registers [[buffer(3)]]) +{ + main0_out out = {}; + out.FragColor = ((((((spvDescriptorSet0.uTexture.sample(spvDescriptorSet0.uTextureSmplr, in.vUV) + spvDescriptorSet1.uTexture2[2].sample(spvDescriptorSet1.uSampler[1], in.vUV)) + spvDescriptorSet0.uTextures[1].sample(spvDescriptorSet0.uTexturesSmplr[1], in.vUV)) + (*spvDescriptorSet1.m_60).ssbo) + spvDescriptorSet1.ssbos[0]->ssbo) + registers.push) + (*spvDescriptorSet0.m_90).ubo) + spvDescriptorSet2.ubos[0]->ubo; + out.FragColor += (*spvDescriptorSet0.m_90).ubo; + out.FragColor += (*spvDescriptorSet1.m_60).ssbo; + out.FragColor += spvDescriptorSet2.ubos[1]->ubo; + out.FragColor += registers.push; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-component-io.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-component-io.frag new file mode 100644 index 0000000000..9b4c5b5204 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-component-io.frag @@ -0,0 +1,99 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 m_location_0 [[color(0)]]; + float4 m_location_1 [[color(1)]]; + float4 m_location_2 [[color(2)]]; +}; + +struct main0_in +{ + float InC_0 [[user(locn0_1), flat]]; + float InA_0 [[user(locn1), flat]]; + float InC_1 [[user(locn1_1), flat]]; + float2 InB_0 [[user(locn1_2), flat]]; + float InA_1 [[user(locn2), flat]]; + float InC_2 [[user(locn2_1), flat]]; + float2 InB_1 [[user(locn2_2), flat]]; + float InD [[user(locn3_1), sample_perspective]]; + float InE [[user(locn4_2), center_no_perspective]]; + float InF [[user(locn5_3), centroid_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + float D = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + InA[0] = in.InA_0; + InA[1] = in.InA_1; + InB[0] = in.InB_0; + InB[1] = in.InB_1; + InC[0] = in.InC_0; + InC[1] = in.InC_1; + InC[2] = in.InC_2; + A = InA; + B = InB; + C = InC; + D = (in.InD + in.InE) + in.InF; + out.m_location_1.x = A[0]; + out.m_location_2.x = A[1]; + out.m_location_1.zw = B[0]; + out.m_location_2.zw = B[1]; + out.m_location_0.y = C[0]; + out.m_location_1.y = C[1]; + out.m_location_2.y = C[2]; + out.m_location_0.w = D; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..79f9025a78 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _17 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 5.0 }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + for (int _46 = 0; _46 < 4; ) + { + int _33 = _46 + 1; + out.FragColor += float4(_17[_33]); + _46 = _33; + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag new file mode 100644 index 0000000000..ba553824e7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _17 = spvUnsafeArray({ 1.0, 2.0, 3.0 }); +constant spvUnsafeArray _21 = spvUnsafeArray({ 4.0, 5.0, 6.0 }); +constant spvUnsafeArray, 2> _22 = spvUnsafeArray, 2>({ spvUnsafeArray({ 1.0, 2.0, 3.0 }), spvUnsafeArray({ 4.0, 5.0, 6.0 }) }); + +struct main0_out +{ + float vOutput [[color(0)]]; +}; + +struct main0_in +{ + int vIndex1 [[user(locn0)]]; + int vIndex2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.vOutput = _22[in.vIndex1][in.vIndex2]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..936b11dc85 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct UBO +{ + uint index; +}; + +struct UBO2 +{ + uint index2; +}; + +struct spvDescriptorSetBuffer0 +{ + array, 4> uSampler [[id(0)]]; + array uSamplerSmplr [[id(4)]]; + constant UBO* uUBO [[id(8)]]; + constant UBO2* m_50 [[id(9)]]; + constant uint* spvSwizzleConstants [[id(10)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant uint* spvSwizzleConstants [[buffer(30)]]) +{ + main0_out out = {}; + constant uint* spvDescriptorSet0_uSamplerSwzl = &spvDescriptorSet0.spvSwizzleConstants[0]; + out.FragColor = spvTextureSwizzle(spvDescriptorSet0.uSampler[(*spvDescriptorSet0.uUBO).index].sample(spvDescriptorSet0.uSamplerSmplr[(*spvDescriptorSet0.uUBO).index], in.vUV), spvDescriptorSet0_uSamplerSwzl[(*spvDescriptorSet0.uUBO).index]); + out.FragColor += spvTextureSwizzle(spvDescriptorSet0.uSampler[(*spvDescriptorSet0.m_50).index2].sample(spvDescriptorSet0.uSamplerSmplr[(*spvDescriptorSet0.m_50).index2], in.vUV), spvDescriptorSet0_uSamplerSwzl[(*spvDescriptorSet0.m_50).index2]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag new file mode 100644 index 0000000000..c680f04b57 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag @@ -0,0 +1,96 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct UBO +{ + uint index; +}; + +struct UBO2 +{ + uint index2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvSwizzleConstants [[buffer(30)]], constant UBO& uUBO [[buffer(0)]], constant UBO2& _50 [[buffer(1)]], array, 4> uSampler [[texture(0)]], array uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* uSamplerSwzl = &spvSwizzleConstants[0]; + out.FragColor = spvTextureSwizzle(uSampler[uUBO.index].sample(uSamplerSmplr[uUBO.index], in.vUV), uSamplerSwzl[uUBO.index]); + out.FragColor += spvTextureSwizzle(uSampler[_50.index2].sample(uSamplerSmplr[_50.index2], in.vUV), uSamplerSwzl[_50.index2]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..cc503e8695 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,97 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct spvDescriptorSetBuffer0 +{ + array, 4> uSampler0 [[id(0)]]; + array uSampler0Smplr [[id(4)]]; + constant uint* spvSwizzleConstants [[id(8)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant uint* spvSwizzleConstants [[buffer(30)]], texture2d uSampler1 [[texture(0)]], sampler uSampler1Smplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* spvDescriptorSet0_uSampler0Swzl = &spvDescriptorSet0.spvSwizzleConstants[0]; + constant uint& uSampler1Swzl = spvSwizzleConstants[0]; + out.FragColor = spvTextureSwizzle(spvDescriptorSet0.uSampler0[2].sample(spvDescriptorSet0.uSampler0Smplr[2], in.vUV), spvDescriptorSet0_uSampler0Swzl[2]); + float4 _73 = spvTextureSwizzle(uSampler1.sample(uSampler1Smplr, in.vUV), uSampler1Swzl); + out.FragColor += _73; + out.FragColor += spvTextureSwizzle(spvDescriptorSet0.uSampler0[1].sample(spvDescriptorSet0.uSampler0Smplr[1], in.vUV), spvDescriptorSet0_uSampler0Swzl[1]); + out.FragColor += _73; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag new file mode 100644 index 0000000000..5b1d17c56c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvSwizzleConstants [[buffer(30)]], array, 4> uSampler [[texture(0)]], array uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* uSamplerSwzl = &spvSwizzleConstants[0]; + out.FragColor = spvTextureSwizzle(uSampler[2].sample(uSamplerSmplr[2], in.vUV), uSamplerSwzl[2]); + out.FragColor += spvTextureSwizzle(uSampler[1].sample(uSamplerSmplr[1], in.vUV), uSamplerSwzl[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag new file mode 100644 index 0000000000..012d99b5b7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct Vertices +{ + float2 uvs[1]; +}; + +struct main0_out +{ + float2 value [[color(0)]]; +}; + +struct main0_in +{ + float3 gl_BaryCoordNoPerspEXT [[barycentric_coord, center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device Vertices& _19 [[buffer(0)]], uint gl_PrimitiveID [[primitive_id]]) +{ + main0_out out = {}; + int _23 = 3 * int(gl_PrimitiveID); + out.value = ((_19.uvs[_23] * in.gl_BaryCoordNoPerspEXT.x) + (_19.uvs[_23 + 1] * in.gl_BaryCoordNoPerspEXT.y)) + (_19.uvs[_23 + 2] * in.gl_BaryCoordNoPerspEXT.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv.msl22.frag new file mode 100644 index 0000000000..d6e9dcdbf9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/barycentric-nv.msl22.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct Vertices +{ + float2 uvs[1]; +}; + +struct main0_out +{ + float2 value [[color(0)]]; +}; + +struct main0_in +{ + float3 gl_BaryCoordEXT [[barycentric_coord, center_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device Vertices& _19 [[buffer(0)]], uint gl_PrimitiveID [[primitive_id]]) +{ + main0_out out = {}; + int _23 = 3 * int(gl_PrimitiveID); + out.value = ((_19.uvs[_23] * in.gl_BaryCoordEXT.x) + (_19.uvs[_23 + 1] * in.gl_BaryCoordEXT.y)) + (_19.uvs[_23 + 2] * in.gl_BaryCoordEXT.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.force-sample.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.force-sample.frag new file mode 100644 index 0000000000..b9706b73f5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.force-sample.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.frag new file mode 100644 index 0000000000..f33db61eba --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/basic.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-func-unpack-pack-arguments.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-func-unpack-pack-arguments.frag new file mode 100644 index 0000000000..134cfe1847 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-func-unpack-pack-arguments.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vIn [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = dot(in.vIn, float3(_15.color)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-unpack-pack-arguments.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-unpack-pack-arguments.frag new file mode 100644 index 0000000000..8bd538bec6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/binary-unpack-pack-arguments.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vIn [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = cross(in.vIn, float3(_15.color) - in.vIn); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.1d-as-2d.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.1d-as-2d.frag new file mode 100644 index 0000000000..d341397f4c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.1d-as-2d.frag @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0)]]; + float4 FragColor1 [[color(1)]]; +}; + +struct main0_in +{ + float4 VertGeom [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) +{ + main0_out out = {}; + float4 _22 = TextureBase.sample(TextureBaseSmplr, float2(in.VertGeom.x, 0.5)); + float4 _30 = TextureDetail.sample(TextureDetailSmplr, float2(in.VertGeom.x, 0.5), int2(3, 0)); + out.FragColor0 = as_type(as_type(_22)) * as_type(as_type(_30)); + out.FragColor1 = as_type(as_type(_22)) * as_type(as_type(_30)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.frag new file mode 100644 index 0000000000..ae6d45e013 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/bitcasting.frag @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0)]]; + float4 FragColor1 [[color(1)]]; +}; + +struct main0_in +{ + float4 VertGeom [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) +{ + main0_out out = {}; + float4 _20 = TextureBase.sample(TextureBaseSmplr, in.VertGeom.xy); + float4 _31 = TextureDetail.sample(TextureDetailSmplr, in.VertGeom.xy, int2(3, 2)); + out.FragColor0 = as_type(as_type(_20)) * as_type(as_type(_31)); + out.FragColor1 = as_type(as_type(_20)) * as_type(as_type(_31)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag new file mode 100644 index 0000000000..4f114ed724 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d buf [[texture(0)]], texture2d bufOut [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = buf.read(spvTexelBufferCoord(0)); + bufOut.write(out.FragColor, spvTexelBufferCoord(int(gl_FragCoord.x))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag new file mode 100644 index 0000000000..71496a4efe --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture_buffer buf [[texture(0)]], texture_buffer bufOut [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = buf.read(uint(0)); + bufOut.write(out.FragColor, uint(int(gl_FragCoord.x))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/builtins.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/builtins.frag new file mode 100644 index 0000000000..f9085252b3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/builtins.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + float gl_FragDepth [[depth(any)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = gl_FragCoord + in.vColor; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/clip-distance-varying.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/clip-distance-varying.frag new file mode 100644 index 0000000000..9a72d5ba39 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/clip-distance-varying.frag @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_ClipDistance = {}; + gl_ClipDistance[0] = in.gl_ClipDistance_0; + gl_ClipDistance[1] = in.gl_ClipDistance_1; + out.FragColor = float4((1.0 - gl_ClipDistance[0]) - gl_ClipDistance[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..0889469c35 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 results[1024]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIn [[user(locn0)]]; + int vIn2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int _40 = Buf.read(uint2(int2(gl_FragCoord.xy)), 0).x % 16; + out.FragColor = (_34.results[_40] + _34.results[_40]) + _34.results[(in.vIn * in.vIn) + (in.vIn2 * in.vIn2)]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..6948e4d098 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vTexCoord [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d Texture [[texture(0)]], sampler TextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float4 _19 = Texture.sample(TextureSmplr, in.vTexCoord); + float _22 = _19.x; + out.FragColor = float4(_22 * _22); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag new file mode 100644 index 0000000000..ca7efc5341 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foobar +{ + float a; + float b; +}; + +constant spvUnsafeArray _37 = spvUnsafeArray({ float4(1.0), float4(2.0), float4(3.0) }); +constant spvUnsafeArray _49 = spvUnsafeArray({ float4(1.0), float4(2.0) }); +constant spvUnsafeArray _54 = spvUnsafeArray({ float4(8.0), float4(10.0) }); +constant spvUnsafeArray, 2> _55 = spvUnsafeArray, 2>({ spvUnsafeArray({ float4(1.0), float4(2.0) }), spvUnsafeArray({ float4(8.0), float4(10.0) }) }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + spvUnsafeArray _75 = spvUnsafeArray({ Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } }); + + main0_out out = {}; + out.FragColor = ((_37[in.index] + _55[in.index][in.index + 1]) + float4(30.0)) + float4(_75[in.index].a + _75[in.index].b); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..e0fa980fb8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float b; +}; + +constant spvUnsafeArray _16 = spvUnsafeArray({ 1.0, 4.0, 3.0, 2.0 }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int line [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + spvUnsafeArray _28 = spvUnsafeArray({ Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } }); + + main0_out out = {}; + out.FragColor = float4(_16[in.line]); + out.FragColor += float4(_28[in.line].a * _28[1 - in.line].a); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..b75f86d23c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vInput [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = in.vInput; + float4 _23 = uSampler.sample(uSamplerSmplr, in.vInput.xy); + float4 _26 = dfdx(in.vInput); + float4 _29 = dfdy(in.vInput); + float4 _32 = fwidth(in.vInput); + float4 _35 = dfdx(in.vInput); + float4 _38 = dfdy(in.vInput); + float4 _41 = fwidth(in.vInput); + float4 _44 = dfdx(in.vInput); + float4 _47 = dfdy(in.vInput); + float4 _50 = fwidth(in.vInput); + if (in.vInput.y > 10.0) + { + out.FragColor += _23; + out.FragColor += _26; + out.FragColor += _29; + out.FragColor += _32; + out.FragColor += _35; + out.FragColor += _38; + out.FragColor += _41; + out.FragColor += _44; + out.FragColor += _47; + out.FragColor += _50; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/cull-distance-varying.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/cull-distance-varying.frag new file mode 100644 index 0000000000..708a295710 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/cull-distance-varying.frag @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_CullDistance_0 [[user(cull0)]]; + float gl_CullDistance_1 [[user(cull1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_CullDistance = {}; + gl_CullDistance[0] = in.gl_CullDistance_0; + gl_CullDistance[1] = in.gl_CullDistance_1; + out.FragColor = float4((1.0 - gl_CullDistance[0]) - gl_CullDistance[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag new file mode 100644 index 0000000000..f6751a42d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o_color [[color(0)]]; +}; + +struct main0_in +{ + float3 v_texCoord [[user(locn0)]]; + float v_lodBias [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array u_sampler [[texture(0)]], sampler u_samplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.o_color = float4(u_sampler.sample_compare(u_samplerSmplr, float2(in.v_texCoord.x, 0.5), uint(rint(in.v_texCoord.y)), in.v_texCoord.z, gradient2d(exp2(in.v_lodBias - 0.5) / float2(u_sampler.get_width(), 1.0), exp2(in.v_lodBias - 0.5) / float2(u_sampler.get_width(), 1.0))), 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-greater-than.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..5861509fc1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-greater-than.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(greater)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-less-than.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-less-than.frag new file mode 100644 index 0000000000..f1177fa640 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-less-than.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(less)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag new file mode 100644 index 0000000000..21884d81c5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-early-frag-tests.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 color_out [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0() +{ + float gl_FragDepth; + main0_out out = {}; + out.color_out = float4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988079071044921875; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag new file mode 100644 index 0000000000..57d810fafc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/depth-out-no-early-frag-tests.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 color_out [[color(0)]]; + float gl_FragDepth [[depth(less)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.color_out = float4(1.0, 0.0, 0.0, 1.0); + out.gl_FragDepth = 0.699999988079071044921875; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/disable-frag-output.frag-output.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/disable-frag-output.frag-output.frag new file mode 100644 index 0000000000..63bc45b8af --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/disable-frag-output.frag-output.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 buf1 [[color(1)]]; + float4 buf3 [[color(3)]]; + float4 buf6 [[color(6)]]; + float4 buf7 [[color(7)]]; +}; + +fragment main0_out main0() +{ + float4 buf0; + float4 buf2; + float4 buf4; + float4 buf5; + float gl_FragDepth; + int gl_FragStencilRefARB; + main0_out out = {}; + buf0 = float4(0.0, 0.0, 0.0, 1.0); + out.buf1 = float4(1.0, 0.0, 0.0, 1.0); + buf2 = float4(0.0, 1.0, 0.0, 1.0); + out.buf3 = float4(0.0, 0.0, 1.0, 1.0); + buf4 = float4(1.0, 0.0, 1.0, 0.5); + buf5 = float4(0.25); + out.buf6 = float4(0.75); + out.buf7 = float4(1.0); + gl_FragDepth = 0.89999997615814208984375; + gl_FragStencilRefARB = uint(127); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/dual-source-blending.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..37938bf8ca --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/dual-source-blending.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0), index(0)]]; + float4 FragColor1 [[color(0), index(1)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor0 = float4(1.0); + out.FragColor1 = float4(2.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/early-fragment-tests.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/early-fragment-tests.frag new file mode 100644 index 0000000000..850fdc9205 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/early-fragment-tests.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/false-loop-init.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/false-loop-init.frag new file mode 100644 index 0000000000..9233caa05d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/false-loop-init.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 result [[color(0)]]; +}; + +struct main0_in +{ + float4 accum [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.result = float4(0.0); + for (int _48 = 0; _48 < 4; ) + { + out.result += in.accum; + _48 += int((in.accum.y > 10.0) ? 40u : 30u); + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/flush_params.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/flush_params.frag new file mode 100644 index 0000000000..64edee8722 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/flush_params.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(10.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..b4cd2085e3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(0.0); + for (int _43 = 0; _43 < 3; ) + { + out.FragColor[_43] += float(_43); + _43++; + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-init.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-init.frag new file mode 100644 index 0000000000..1a42f6e7be --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/for-loop-init.frag @@ -0,0 +1,71 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + int FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + do + { + out.FragColor = 16; + for (int _143 = 0; _143 < 25; ) + { + out.FragColor += 10; + _143++; + continue; + } + for (int _144 = 1; _144 < 30; ) + { + out.FragColor += 11; + _144++; + continue; + } + int _145; + _145 = 0; + for (; _145 < 20; ) + { + out.FragColor += 12; + _145++; + continue; + } + int _62 = _145 + 3; + out.FragColor += _62; + if (_62 == 40) + { + for (int _149 = 0; _149 < 40; ) + { + out.FragColor += 13; + _149++; + continue; + } + break; + } + out.FragColor += _62; + int2 _146; + _146 = int2(0); + for (; _146.x < 10; ) + { + out.FragColor += _146.y; + int2 _142 = _146; + _142.x = _146.x + 4; + _146 = _142; + continue; + } + for (int _148 = _62; _148 < 40; ) + { + out.FragColor += _148; + _148++; + continue; + } + out.FragColor += _62; + break; + } while(false); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-packing.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-packing.frag new file mode 100644 index 0000000000..e21feb43ec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fp16-packing.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 FP32Out [[color(0)]]; + uint FP16Out [[color(1)]]; +}; + +struct main0_in +{ + uint FP16 [[user(locn0)]]; + float2 FP32 [[user(locn1), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FP32Out = float2(as_type(in.FP16)); + out.FP16Out = as_type(half2(in.FP32)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..25c6244894 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag @@ -0,0 +1,65 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct foo_t +{ + float x; + uint y; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +fragment main0_out main0(device foo_t& foo [[buffer(0)]], texture2d bar [[texture(0)]], device atomic_uint* bar_atomic [[buffer(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + if (!gl_HelperInvocation) + { + foo.x = 1.0; + } + uint _91 = (!gl_HelperInvocation ? atomic_exchange_explicit((device atomic_uint*)&foo.y, 0u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + if (int(gl_FragCoord.x) == 3) + { + gl_HelperInvocation = true, discard_fragment(); + } + int2 _101 = int2(gl_FragCoord.xy); + (gl_HelperInvocation ? ((void)0) : bar.write(uint4(1u), uint2(_101))); + uint _103 = (!gl_HelperInvocation ? atomic_fetch_add_explicit((device atomic_uint*)&foo.y, 42u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _108 = (!gl_HelperInvocation ? atomic_fetch_or_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], 62u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], memory_order_relaxed)); + uint _110 = (!gl_HelperInvocation ? atomic_fetch_and_explicit((device atomic_uint*)&foo.y, 65535u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _112 = (!gl_HelperInvocation ? atomic_fetch_xor_explicit((device atomic_uint*)&foo.y, 4294967040u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _114 = (!gl_HelperInvocation ? atomic_fetch_min_explicit((device atomic_uint*)&foo.y, 1u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _119 = (!gl_HelperInvocation ? atomic_fetch_max_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], 100u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], memory_order_relaxed)); + uint _124; + if (!gl_HelperInvocation) + { + do + { + _124 = 100u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], &_124, 42u, memory_order_relaxed, memory_order_relaxed) && _124 == 100u); + } + else + { + _124 = atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_101, bar)], memory_order_relaxed); + } + bool _125 = gl_HelperInvocation; + out.fragColor = float4(1.0, float(_125), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag new file mode 100644 index 0000000000..541096a1fa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct foo +{ + int x; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +fragment main0_out main0(device foo& _24 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + if (gl_FragCoord.y == 7.0) + { + gl_HelperInvocation = true, discard_fragment(); + } + if (!gl_HelperInvocation) + { + _24.x = 0; + } + for (; float(_24.x) < gl_FragCoord.x; ) + { + if (!gl_HelperInvocation) + { + _24.x++; + } + continue; + } + out.fragColor = float4(float(_24.x), 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..2b2e085389 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag @@ -0,0 +1,64 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct foo_t +{ + float x; + uint y; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +fragment main0_out main0(device foo_t& foo [[buffer(0)]], texture2d bar [[texture(0)]], device atomic_uint* bar_atomic [[buffer(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + if (!gl_HelperInvocation) + { + foo.x = 1.0; + } + uint _90 = (!gl_HelperInvocation ? atomic_exchange_explicit((device atomic_uint*)&foo.y, 0u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + if (int(gl_FragCoord.x) == 3) + { + gl_HelperInvocation = true, discard_fragment(); + } + int2 _100 = int2(gl_FragCoord.xy); + (gl_HelperInvocation ? ((void)0) : bar.write(uint4(1u), uint2(_100))); + uint _102 = (!gl_HelperInvocation ? atomic_fetch_add_explicit((device atomic_uint*)&foo.y, 42u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _107 = (!gl_HelperInvocation ? atomic_fetch_or_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], 62u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], memory_order_relaxed)); + uint _109 = (!gl_HelperInvocation ? atomic_fetch_and_explicit((device atomic_uint*)&foo.y, 65535u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _111 = (!gl_HelperInvocation ? atomic_fetch_xor_explicit((device atomic_uint*)&foo.y, 4294967040u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _113 = (!gl_HelperInvocation ? atomic_fetch_min_explicit((device atomic_uint*)&foo.y, 1u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _118 = (!gl_HelperInvocation ? atomic_fetch_max_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], 100u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], memory_order_relaxed)); + uint _123; + if (!gl_HelperInvocation) + { + do + { + _123 = 100u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], &_123, 42u, memory_order_relaxed, memory_order_relaxed) && _123 == 100u); + } + else + { + _123 = atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(_100, bar)], memory_order_relaxed); + } + out.fragColor = float4(1.0, 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag new file mode 100644 index 0000000000..19840fa434 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColors_0 [[color(0)]]; + float4 FragColors_1 [[color(1)]]; + float4 FragColor2 [[color(2)]]; + float4 FragColor3 [[color(3)]]; +}; + +struct main0_in +{ + float3 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray FragColors = {}; + float2 FragColor2 = {}; + float3 FragColor3 = {}; + FragColors[0] = in.vColor.x; + FragColors[1] = in.vColor.y; + FragColor2 = in.vColor.xz; + FragColor3 = in.vColor.zzz; + out.FragColors_0 = float4(FragColors[0]); + out.FragColors_1 = float4(FragColors[1]); + out.FragColor2.xy = FragColor2; + out.FragColor3.xyz = FragColor3; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/front-facing.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/front-facing.frag new file mode 100644 index 0000000000..2f83642492 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/front-facing.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], bool gl_FrontFacing [[front_facing]]) +{ + main0_out out = {}; + if (gl_FrontFacing) + { + out.FragColor = in.vA; + } + else + { + out.FragColor = in.vB; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-dref.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-dref.frag new file mode 100644 index 0000000000..c5c5ccf0bb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-dref.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uT [[texture(0)]], sampler uTSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uT.gather_compare(uTSmplr, in.vUV.xy, in.vUV.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-offset.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-offset.frag new file mode 100644 index 0000000000..02b80194b5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/gather-offset.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uT [[texture(0)]], sampler uTSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uT.gather(uTSmplr, float2(0.5), int2(0), component::w); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/helper-invocation.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/helper-invocation.msl21.frag new file mode 100644 index 0000000000..9d876df1a2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/helper-invocation.msl21.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float4 _52; + if (!simd_is_helper_thread()) + { + _52 = uSampler.sample(uSamplerSmplr, in.vUV, level(0.0)); + } + else + { + _52 = float4(1.0); + } + out.FragColor = _52; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag new file mode 100644 index 0000000000..0c6e6f4991 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 v; +}; + +struct spvDescriptorSetBuffer0 +{ + array, 10000> uSamplers [[id(0)]]; + array uSamplersSmplr [[id(10000)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + constant UBO* vs [[id(0)]][10000]; +}; + +struct spvDescriptorSetBuffer2 +{ + texture2d uSampler [[id(0)]]; + sampler uSamplerSmplr [[id(1)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]]) +{ + main0_out out = {}; + out.FragColor = (spvDescriptorSet0.uSamplers[9999].sample(spvDescriptorSet0.uSamplersSmplr[9999], in.vUV) + spvDescriptorSet1.vs[5000]->v) + spvDescriptorSet2.uSampler.sample(spvDescriptorSet2.uSamplerSmplr, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/illegal-name-test-0.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/illegal-name-test-0.frag new file mode 100644 index 0000000000..81cd3b5621 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/illegal-name-test-0.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(40.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/image-query-lod.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/image-query-lod.msl22.frag new file mode 100644 index 0000000000..de7a60cc5a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/image-query-lod.msl22.frag @@ -0,0 +1,70 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler2D [[texture(0)]], texture3d uSampler3D [[texture(1)]], texturecube uSamplerCube [[texture(2)]], texture2d uTexture2D [[texture(3)]], texture3d uTexture3D [[texture(4)]], texturecube uTextureCube [[texture(5)]], sampler uSampler2DSmplr [[sampler(0)]], sampler uSampler3DSmplr [[sampler(1)]], sampler uSamplerCubeSmplr [[sampler(2)]], sampler uSampler [[sampler(3)]]) +{ + main0_out out = {}; + out.FragColor = float2(0.0); + float2 _79; + _79.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, in.vUV.xy); + _79.y = uSampler2D.calculate_unclamped_lod(uSampler2DSmplr, in.vUV.xy); + out.FragColor += _79; + float2 _84; + _84.x = uSampler3D.calculate_clamped_lod(uSampler3DSmplr, in.vUV); + _84.y = uSampler3D.calculate_unclamped_lod(uSampler3DSmplr, in.vUV); + out.FragColor += _84; + float2 _89; + _89.x = uSamplerCube.calculate_clamped_lod(uSamplerCubeSmplr, in.vUV); + _89.y = uSamplerCube.calculate_unclamped_lod(uSamplerCubeSmplr, in.vUV); + out.FragColor += _89; + float2 _97; + _97.x = uTexture2D.calculate_clamped_lod(uSampler, in.vUV.xy); + _97.y = uTexture2D.calculate_unclamped_lod(uSampler, in.vUV.xy); + out.FragColor += _97; + float2 _104; + _104.x = uTexture3D.calculate_clamped_lod(uSampler, in.vUV); + _104.y = uTexture3D.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _104; + float2 _111; + _111.x = uTextureCube.calculate_clamped_lod(uSampler, in.vUV); + _111.y = uTextureCube.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _111; + float2 _119; + _119.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, in.vUV.xy); + _119.y = uSampler2D.calculate_unclamped_lod(uSampler2DSmplr, in.vUV.xy); + out.FragColor += _119; + float2 _124; + _124.x = uSampler3D.calculate_clamped_lod(uSampler3DSmplr, in.vUV); + _124.y = uSampler3D.calculate_unclamped_lod(uSampler3DSmplr, in.vUV); + out.FragColor += _124; + float2 _129; + _129.x = uSamplerCube.calculate_clamped_lod(uSamplerCubeSmplr, in.vUV); + _129.y = uSamplerCube.calculate_unclamped_lod(uSamplerCubeSmplr, in.vUV); + out.FragColor += _129; + float2 _137; + _137.x = uTexture2D.calculate_clamped_lod(uSampler, in.vUV.xy); + _137.y = uTexture2D.calculate_unclamped_lod(uSampler, in.vUV.xy); + out.FragColor += _137; + float2 _144; + _144.x = uTexture3D.calculate_clamped_lod(uSampler, in.vUV); + _144.y = uTexture3D.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _144; + float2 _151; + _151.x = uTextureCube.calculate_clamped_lod(uSampler, in.vUV); + _151.y = uTextureCube.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _151; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block.frag new file mode 100644 index 0000000000..efb0cbd429 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct VertexOut +{ + float4 color; + float4 color2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 inputs_color [[user(locn2)]]; + float4 inputs_color2 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + VertexOut inputs = {}; + inputs.color = in.inputs_color; + inputs.color2 = in.inputs_color2; + out.FragColor = inputs.color + inputs.color2; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag new file mode 100644 index 0000000000..7b011ffb58 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float b; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float foos_0_a [[user(locn1)]]; + float foos_0_b [[user(locn2)]]; + float foos_1_a [[user(locn3)]]; + float foos_1_b [[user(locn4)]]; + float foos_2_a [[user(locn5)]]; + float foos_2_b [[user(locn6)]]; + float foos_3_a [[user(locn7)]]; + float foos_3_b [[user(locn8)]]; + float bars_0_a [[user(locn10)]]; + float bars_0_b [[user(locn11)]]; + float bars_1_a [[user(locn12)]]; + float bars_1_b [[user(locn13)]]; + float bars_2_a [[user(locn14)]]; + float bars_2_b [[user(locn15)]]; + float bars_3_a [[user(locn16)]]; + float bars_3_b [[user(locn17)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray foos = {}; + spvUnsafeArray bars = {}; + foos[0].a = in.foos_0_a; + foos[0].b = in.foos_0_b; + foos[1].a = in.foos_1_a; + foos[1].b = in.foos_1_b; + foos[2].a = in.foos_2_a; + foos[2].b = in.foos_2_b; + foos[3].a = in.foos_3_a; + foos[3].b = in.foos_3_b; + bars[0].a = in.bars_0_a; + bars[0].b = in.bars_0_b; + bars[1].a = in.bars_1_a; + bars[1].b = in.bars_1_b; + bars[2].a = in.bars_2_a; + bars[2].b = in.bars_2_b; + bars[3].a = in.bars_3_a; + bars[3].b = in.bars_3_b; + out.FragColor.x = foos[0].a; + out.FragColor.y = foos[1].b; + out.FragColor.z = foos[2].a; + out.FragColor.w = bars[3].b; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_mat.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_mat.frag new file mode 100644 index 0000000000..5d0b44eb52 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/in_mat.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 outFragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 inPos [[user(locn0)]]; + float3 inNormal [[user(locn1)]]; + float4 inInvModelView_0 [[user(locn2)]]; + float4 inInvModelView_1 [[user(locn3)]]; + float4 inInvModelView_2 [[user(locn4)]]; + float4 inInvModelView_3 [[user(locn5)]]; + float inLodBias [[user(locn6)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube samplerColor [[texture(0)]], sampler samplerColorSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float4x4 inInvModelView = {}; + inInvModelView[0] = in.inInvModelView_0; + inInvModelView[1] = in.inInvModelView_1; + inInvModelView[2] = in.inInvModelView_2; + inInvModelView[3] = in.inInvModelView_3; + float4 _31 = inInvModelView * float4(reflect(fast::normalize(in.inPos), fast::normalize(in.inNormal)), 0.0); + float _33 = _31.x; + float3 _36 = float3(_33, _31.yz); + _36.x = _33 * (-1.0); + out.outFragColor = samplerColor.sample(samplerColorSmplr, _36, bias(in.inLodBias)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag new file mode 100644 index 0000000000..52a78cf93a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms_array uSubpass0 [[texture(0)]], texture2d_ms_array uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_Layer, 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer, gl_SampleID); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..0c47348d6e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms uSubpass0 [[texture(0)]], texture2d_ms uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), 1) + uSubpass1.read(uint2(gl_FragCoord.xy), 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_SampleID); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag new file mode 100644 index 0000000000..e27b24adf3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant uint* spvViewMask [[buffer(24)]], texture2d_ms_array uSubpass0 [[texture(0)]], texture2d_ms_array uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 2)) + uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex, gl_SampleID); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.arrayed-subpass.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.arrayed-subpass.frag new file mode 100644 index 0000000000..5d5ee43104 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.arrayed-subpass.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_array uSubpass0 [[texture(0)]], texture2d_array uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_Layer); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.frag new file mode 100644 index 0000000000..790dce3c1b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uSubpass0 [[texture(0)]], texture2d uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy)) + uSubpass1.read(uint2(gl_FragCoord.xy)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.multiview.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.multiview.frag new file mode 100644 index 0000000000..7cf06d2d6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/input-attachment.multiview.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant uint* spvViewMask [[buffer(24)]], texture2d_array uSubpass0 [[texture(0)]], texture2d_array uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_ViewIndex); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers-block.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers-block.frag new file mode 100644 index 0000000000..b3bab04319 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers-block.frag @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct Input +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 inp_v0 [[user(locn0), centroid_no_perspective]]; + float2 inp_v1 [[user(locn1), centroid_no_perspective]]; + float3 inp_v2 [[user(locn2), centroid_no_perspective]]; + float4 inp_v3 [[user(locn3), centroid_no_perspective]]; + float inp_v4 [[user(locn4), centroid_no_perspective]]; + float inp_v5 [[user(locn5), centroid_no_perspective]]; + float inp_v6 [[user(locn6), centroid_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Input inp = {}; + inp.v0 = in.inp_v0; + inp.v1 = in.inp_v1; + inp.v2 = in.inp_v2; + inp.v3 = in.inp_v3; + inp.v4 = in.inp_v4; + inp.v5 = in.inp_v5; + inp.v6 = in.inp_v6; + out.FragColor = float4(inp.v0.x + inp.v1.y, inp.v2.xy, fma(inp.v3.w, inp.v4, inp.v5) - inp.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers.frag new file mode 100644 index 0000000000..208e8806b2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/interpolation-qualifiers.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1), center_no_perspective]]; + float3 v2 [[user(locn2), centroid_perspective]]; + float4 v3 [[user(locn3), centroid_no_perspective]]; + float v4 [[user(locn4), sample_perspective]]; + float v5 [[user(locn5), sample_no_perspective]]; + float v6 [[user(locn6), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.v0.x + in.v1.y, in.v2.xy, fma(in.v3.w, in.v4, in.v5) - in.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag new file mode 100644 index 0000000000..e24bcd6d11 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _16 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 }); +constant spvUnsafeArray _60 = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); +constant spvUnsafeArray _104 = spvUnsafeArray({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) }); + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = _16[in.index]; + if (in.index < 10) + { + out.FragColor += _16[in.index ^ 1]; + } + else + { + out.FragColor += _16[in.index & 1]; + } + bool _63 = in.index > 30; + if (_63) + { + out.FragColor += _60[in.index & 3].y; + } + else + { + out.FragColor += _60[in.index & 1].x; + } + spvUnsafeArray foobar = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + if (_63) + { + foobar[1].z = 20.0; + } + int _91 = in.index & 3; + out.FragColor += foobar[_91].z; + out.FragColor += _104[_91].z; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/mix.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/mix.frag new file mode 100644 index 0000000000..5e385087bc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/mix.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vIn0 [[user(locn0)]]; + float4 vIn1 [[user(locn1)]]; + float vIn2 [[user(locn2)]]; + float vIn3 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.vIn0.x, in.vIn1.y, in.vIn0.z, in.vIn0.w); + out.FragColor = float4(in.vIn3); + out.FragColor = in.vIn0.xyzw; + out.FragColor = float4(in.vIn2); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag new file mode 100644 index 0000000000..612dd4e92d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/modf-access-tracking-function.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 vo0 [[color(0)]]; + float4 vo1 [[color(1)]]; +}; + +struct main0_in +{ + float4 v [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _25 = modf(in.v, out.vo1); + out.vo0 = _25; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag new file mode 100644 index 0000000000..d7fccdedc8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag @@ -0,0 +1,82 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct main0_out +{ + float4 FragColor_0 [[color(0)]]; + float4 FragColor_1 [[color(1)]]; + float4 FragColor_2 [[color(2)]]; + float4 FragColor_3 [[color(3)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray FragColor = {}; + FragColor[0] = mod(in.vA, in.vB); + FragColor[1] = in.vA + in.vB; + FragColor[2] = in.vA - in.vB; + FragColor[3] = in.vA * in.vB; + out.FragColor_0 = FragColor[0]; + out.FragColor_1 = FragColor[1]; + out.FragColor_2 = FragColor[2]; + out.FragColor_3 = FragColor[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/nonuniform-qualifier.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/nonuniform-qualifier.msl2.frag new file mode 100644 index 0000000000..bdd8d1419b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/nonuniform-qualifier.msl2.frag @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 v[64]; +}; + +struct SSBO +{ + float4 v[1]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIndex [[user(locn0)]]; + float2 vUV [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO* ubos_0 [[buffer(0)]], constant UBO* ubos_1 [[buffer(1)]], const device SSBO* ssbos_0 [[buffer(2)]], const device SSBO* ssbos_1 [[buffer(3)]], array, 8> uSamplers [[texture(0)]], array, 8> uCombinedSamplers [[texture(8)]], array uSamps [[sampler(0)]], array uCombinedSamplersSmplr [[sampler(7)]]) +{ + constant UBO* ubos[] = + { + ubos_0, + ubos_1, + }; + + const device SSBO* ssbos[] = + { + ssbos_0, + ssbos_1, + }; + + main0_out out = {}; + int _25 = in.vIndex + 10; + int _37 = in.vIndex + 40; + out.FragColor = uSamplers[_25].sample(uSamps[_37], in.vUV); + out.FragColor = uCombinedSamplers[_25].sample(uCombinedSamplersSmplr[_25], in.vUV); + int _69 = in.vIndex + 20; + out.FragColor += ubos[_69]->v[_37]; + int _87 = in.vIndex + 50; + int _91 = in.vIndex + 60; + out.FragColor += ssbos[_87]->v[_91]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/packed-expression-vector-shuffle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/packed-expression-vector-shuffle.frag new file mode 100644 index 0000000000..a12c44912f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/packed-expression-vector-shuffle.frag @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + float4 _36 = float4(1.0); + _36.x = _15.color[0]; + _36.y = _15.color[1]; + _36.z = _15.color[2]; + out.FragColor = _36; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/packing-test-3.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/packing-test-3.frag new file mode 100644 index 0000000000..1f696e94ef --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/packing-test-3.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct TestStruct +{ + packed_float3 position; + float radius; +}; + +struct CB0 +{ + TestStruct CB0[16]; +}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +fragment main0_out main0(constant CB0& _RESERVED_IDENTIFIER_FIXUP_24 [[buffer(0)]]) +{ + main0_out out = {}; + out._entryPointOutput = float4(_RESERVED_IDENTIFIER_FIXUP_24.CB0[1].position[0], _RESERVED_IDENTIFIER_FIXUP_24.CB0[1].position[1], _RESERVED_IDENTIFIER_FIXUP_24.CB0[1].position[2], _RESERVED_IDENTIFIER_FIXUP_24.CB0[1].radius); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag new file mode 100644 index 0000000000..1bfaff53bf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag @@ -0,0 +1,53 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct Buffer3 +{ + int baz; +}; + +struct Buffer +{ + int foo; + uint bar; +}; + +struct Buffer2 +{ + uint quux; +}; + +struct spvDescriptorSetBuffer0 +{ + device Buffer3* m_9 [[id(0)]]; + texture2d img4 [[id(1)]]; + texture2d img [[id(2), raster_order_group(0)]]; + texture2d img3 [[id(3), raster_order_group(0)]]; + texture2d img2 [[id(4), raster_order_group(0)]]; + device atomic_uint* img2_atomic [[id(5), raster_order_group(0)]]; + volatile device Buffer* m_42 [[id(6), raster_order_group(0)]]; + device Buffer2* m_52 [[id(7), raster_order_group(0)]]; +}; + +fragment void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]]) +{ + (*spvDescriptorSet0.m_9).baz = 0; + spvDescriptorSet0.img4.write(float4(1.0, 0.0, 0.0, 1.0), uint2(int2(1))); + spvDescriptorSet0.img.write(spvDescriptorSet0.img3.read(uint2(int2(0))), uint2(int2(0))); + uint _39 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.img2_atomic[spvImage2DAtomicCoord(int2(0), spvDescriptorSet0.img2)], 1u, memory_order_relaxed); + (*spvDescriptorSet0.m_42).foo += 42; + uint _55 = atomic_fetch_and_explicit((volatile device atomic_uint*)&(*spvDescriptorSet0.m_42).bar, (*spvDescriptorSet0.m_52).quux, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.frag new file mode 100644 index 0000000000..6a300e8c58 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pixel-interlock-ordered.msl2.frag @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct Buffer3 +{ + int baz; +}; + +struct Buffer +{ + int foo; + uint bar; +}; + +struct Buffer2 +{ + uint quux; +}; + +fragment void main0(device Buffer3& _9 [[buffer(0)]], volatile device Buffer& _42 [[buffer(2), raster_order_group(0)]], device Buffer2& _52 [[buffer(3), raster_order_group(0)]], texture2d img4 [[texture(0)]], texture2d img [[texture(1), raster_order_group(0)]], texture2d img3 [[texture(2), raster_order_group(0)]], texture2d img2 [[texture(3), raster_order_group(0)]], device atomic_uint* img2_atomic [[buffer(1), raster_order_group(0)]]) +{ + _9.baz = 0; + img4.write(float4(1.0, 0.0, 0.0, 1.0), uint2(int2(1))); + img.write(img3.read(uint2(int2(0))), uint2(int2(0))); + uint _39 = atomic_fetch_add_explicit((device atomic_uint*)&img2_atomic[spvImage2DAtomicCoord(int2(0), img2)], 1u, memory_order_relaxed); + _42.foo += 42; + uint _55 = atomic_fetch_and_explicit((volatile device atomic_uint*)&_42.bar, _52.quux, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/pls.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pls.frag new file mode 100644 index 0000000000..ee774a04af --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/pls.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 PLSOut0 [[color(0)]]; + float4 PLSOut1 [[color(1)]]; + float4 PLSOut2 [[color(2)]]; + float4 PLSOut3 [[color(3)]]; +}; + +struct main0_in +{ + float4 PLSIn0 [[user(locn0)]]; + float4 PLSIn1 [[user(locn1)]]; + float4 PLSIn2 [[user(locn2)]]; + float4 PLSIn3 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.PLSOut0 = in.PLSIn0 * 2.0; + out.PLSOut1 = in.PLSIn1 * 6.0; + out.PLSOut2 = in.PLSIn2 * 7.0; + out.PLSOut3 = in.PLSIn3 * 4.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.ios.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.ios.msl2.frag new file mode 100644 index 0000000000..3b2885e2e2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.ios.msl2.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask, post_depth_coverage]]) +{ + main0_out out = {}; + out.FragColor = float4(float(gl_SampleMaskIn)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.msl23.frag new file mode 100644 index 0000000000..3b2885e2e2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/post-depth-coverage.msl23.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask, post_depth_coverage]]) +{ + main0_out out = {}; + out.FragColor = float4(float(gl_SampleMaskIn)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/private-variable-prototype-declaration.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/private-variable-prototype-declaration.frag new file mode 100644 index 0000000000..1e9dc12d6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/private-variable-prototype-declaration.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float3(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag new file mode 100644 index 0000000000..859ace2cd4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag @@ -0,0 +1,45 @@ +#include +#include +#if __METAL_VERSION__ >= 230 +#include +using namespace metal::raytracing; +#endif + +using namespace metal; + +struct main0_out +{ + float4 outColor [[color(0)]]; +}; + +struct main0_in +{ + float4 inPos [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], raytracing::acceleration_structure topLevelAS [[buffer(0)]]) +{ + main0_out out = {}; + raytracing::intersection_query rayQuery; + rayQuery.reset(ray(float3((in.inPos.xy * 4.0) - float2(2.0), 1.0), float3(0.0, 0.0, -1.0), 0.001000000047497451305389404296875, 2.0), topLevelAS, intersection_params()); + for (;;) + { + bool _88 = rayQuery.next(); + if (_88) + { + continue; + } + else + { + break; + } + } + uint _92 = uint(rayQuery.get_committed_intersection_type()); + if (_92 == 0u) + { + discard_fragment(); + } + out.outColor = in.inPos; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/read-cull-clip-distance-in-function.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/read-cull-clip-distance-in-function.frag new file mode 100644 index 0000000000..3c9757ebd2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/read-cull-clip-distance-in-function.frag @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; + float gl_CullDistance_0 [[user(cull0)]]; + float gl_CullDistance_1 [[user(cull1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_CullDistance = {}; + spvUnsafeArray gl_ClipDistance = {}; + gl_CullDistance[0] = in.gl_CullDistance_0; + gl_CullDistance[1] = in.gl_CullDistance_1; + gl_ClipDistance[0] = in.gl_ClipDistance_0; + gl_ClipDistance[1] = in.gl_ClipDistance_1; + out.FragColor = float4(gl_CullDistance[0], gl_CullDistance[1], gl_ClipDistance[0], gl_ClipDistance[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/readonly-ssbo.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/readonly-ssbo.frag new file mode 100644 index 0000000000..777fd65c8a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/readonly-ssbo.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(const device SSBO& _13 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = _13.v + _13.v; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/return-value-after-discard-terminator.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/return-value-after-discard-terminator.frag new file mode 100644 index 0000000000..92097dfa4a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/return-value-after-discard-terminator.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct buff_t +{ + int m0[1024]; +}; + +struct main0_out +{ + float4 frag_clr [[color(0)]]; +}; + +fragment main0_out main0(device buff_t& buff [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int4 _16 = int4(gl_FragCoord); + out.frag_clr = float4(0.0, 0.0, 1.0, 1.0); + buff.m0[(_16.y * 32) + _16.x] = 1; + discard_fragment(); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag new file mode 100644 index 0000000000..4f7e9b53b2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uTexture [[texture(0)]], sampler uSampler [[sampler(0)]], sampler uSamplerShadow [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = float4(uTexture.sample(uSampler, in.vUV.xy)).x; + out.FragColor += uTexture.sample_compare(uSamplerShadow, in.vUV.xy, in.vUV.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-separate-image-sampler.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-separate-image-sampler.frag new file mode 100644 index 0000000000..6626946c45 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-separate-image-sampler.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0(depth2d uDepth [[texture(0)]], texture2d uColor [[texture(1)]], sampler uSamplerShadow [[sampler(0)]], sampler uSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = uDepth.sample_compare(uSamplerShadow, float3(0.5).xy, 0.5) + uColor.sample(uSampler, float2(0.5)).x; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag new file mode 100644 index 0000000000..626fe4c79c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = (gl_SampleMaskIn & 0x22 & (1 << gl_SampleID)); + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag new file mode 100644 index 0000000000..f478901b6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]]) +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = (gl_SampleMaskIn & 0x22); + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag new file mode 100644 index 0000000000..d04f2033bb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.fixed-sample-mask.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.fixed-sample-mask.frag new file mode 100644 index 0000000000..76306b5ade --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.fixed-sample-mask.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0; + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.frag new file mode 100644 index 0000000000..6a282395d6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-mask.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position-func.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position-func.frag new file mode 100644 index 0000000000..87875bbc39 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position-func.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + out.FragColor = float4(gl_SamplePosition, float(in.index), 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position.frag new file mode 100644 index 0000000000..8d26acb9f1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-position.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + out.FragColor = float4(gl_SamplePosition, float(gl_SampleID), 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag new file mode 100644 index 0000000000..77acb3f9b9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_array tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float3 _28 = float3(gl_FragCoord.xy, float(gl_SampleID)); + out.FragColor = tex.sample(texSmplr, _28.xy, uint(rint(_28.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag new file mode 100644 index 0000000000..0f78738eea --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float foo [[user(locn0), sample_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d_array tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float3 _26 = float3(gl_FragCoord.xy, in.foo); + out.FragColor = tex.sample(texSmplr, _26.xy, uint(rint(_26.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag new file mode 100644 index 0000000000..f8f357fe7c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + out.FragColor = tex.sample(texSmplr, (gl_FragCoord.xy - gl_SamplePosition)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag new file mode 100644 index 0000000000..1ed8148d4c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = tex.sample(texSmplr, gl_FragCoord.xy); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag new file mode 100644 index 0000000000..70278b1290 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vTex [[user(locn0), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor += ((uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), bias(2.0)) + uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), level(3.0))) + uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), gradient2d(5.0, 8.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.frag new file mode 100644 index 0000000000..96914f8056 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-1d-lod.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vTex [[user(locn0), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture1d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor += ((uSampler.sample(uSamplerSmplr, in.vTex) + uSampler.sample(uSamplerSmplr, in.vTex)) + uSampler.sample(uSamplerSmplr, in.vTex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag new file mode 100644 index 0000000000..924736ebb0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, float2(in.vUV.x, 0.5), uint(rint(in.vUV.y)), in.vUV.z, bias(1.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.frag new file mode 100644 index 0000000000..092b11d18a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, level(0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag new file mode 100644 index 0000000000..fdd4d16442 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, gradient2d(float2(0.0), float2(0.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag new file mode 100644 index 0000000000..f66f5d38c1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, level(0)) + uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, gradient2d(float2(1.0), float2(1.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-image-arrays.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-image-arrays.msl2.frag new file mode 100644 index 0000000000..f3e10fcade --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-image-arrays.msl2.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vTex [[user(locn0), flat]]; + int vIndex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], array, 4> uSampler [[texture(0)]], array, 4> uTextures [[texture(4)]], array uSamplerSmplr [[sampler(0)]], array uSamplers [[sampler(4)]]) +{ + main0_out out = {}; + out.FragColor = float4(0.0); + out.FragColor += uTextures[2].sample(uSamplers[1], in.vTex); + out.FragColor += uSampler[in.vIndex].sample(uSamplerSmplr[in.vIndex], in.vTex); + out.FragColor += uSampler[in.vIndex].sample(uSamplerSmplr[in.vIndex], (in.vTex + float2(0.100000001490116119384765625))); + out.FragColor += uSampler[in.vIndex].sample(uSamplerSmplr[in.vIndex], (in.vTex + float2(0.20000000298023223876953125))); + out.FragColor += uSampler[3].sample(uSamplerSmplr[3], (in.vTex + float2(0.300000011920928955078125))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-ms.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-ms.frag new file mode 100644 index 0000000000..8245ed8263 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler-ms.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int2 _17 = int2(gl_FragCoord.xy); + out.FragColor = ((uSampler.read(uint2(_17), 0) + uSampler.read(uint2(_17), 1)) + uSampler.read(uint2(_17), 2)) + uSampler.read(uint2(_17), 3); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler.frag new file mode 100644 index 0000000000..f33db61eba --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/sampler.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..fc908cb3e1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/scalar-refract-reflect.frag @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvReflect(T i, T n) +{ + return i - T(2) * i * n * n; +} + +template +inline T spvRefract(T i, T n, T eta) +{ + T NoI = n * i; + T NoI2 = NoI * NoI; + T k = T(1) - eta * eta * (T(1) - NoI2); + if (k < T(0)) + { + return T(0); + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vRefract [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = spvRefract(in.vRefract.x, in.vRefract.y, in.vRefract.z); + out.FragColor += spvReflect(in.vRefract.x, in.vRefract.y); + out.FragColor += refract(in.vRefract.xy, in.vRefract.yz, in.vRefract.z).y; + out.FragColor += reflect(in.vRefract.xy, in.vRefract.zy).y; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/separate-image-sampler-argument.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/separate-image-sampler-argument.frag new file mode 100644 index 0000000000..e576b49e7e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/separate-image-sampler-argument.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uDepth [[texture(0)]], sampler uSampler [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uDepth.sample(uSampler, float2(0.5)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-arithmetic-8bit.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-arithmetic-8bit.frag new file mode 100644 index 0000000000..fff932c037 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/shader-arithmetic-8bit.frag @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + char i8[16]; + uchar u8[16]; +}; + +struct Push +{ + char i8; + uchar u8; +}; + +struct UBO +{ + char i8; + uchar u8; +}; + +struct main0_out +{ + int4 FragColorInt [[color(0)]]; + uint4 FragColorUint [[color(1)]]; +}; + +struct main0_in +{ + int4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], device SSBO& ssbo [[buffer(0)]], constant Push& registers [[buffer(1)]], constant UBO& ubo [[buffer(2)]]) +{ + main0_out out = {}; + char4 _204 = as_type(20); + ssbo.i8[0] = _204.x; + ssbo.i8[1] = _204.y; + ssbo.i8[2] = _204.z; + ssbo.i8[3] = _204.w; + uchar4 _229 = as_type(20u); + ssbo.u8[0] = _229.x; + ssbo.u8[1] = _229.y; + ssbo.u8[2] = _229.z; + ssbo.u8[3] = _229.w; + char4 _249 = char4(in.vColor); + out.FragColorInt = int4((((((_249 + char4(registers.i8)) + char4(-40)) + char4(-50)) + char4(char(10), char(20), char(30), char(40))) + char4(ssbo.i8[4])) + char4(ubo.i8)); + out.FragColorUint = uint4((((((uchar4(_249) + uchar4(registers.u8)) + uchar4(216)) + uchar4(206)) + uchar4(uchar(10), uchar(20), uchar(30), uchar(40))) + uchar4(ssbo.u8[4])) + uchar4(ubo.u8)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..36456b814b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-block-size.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +constant int Value = SPIRV_CROSS_CONSTANT_ID_10; + +struct SpecConstArray +{ + float4 samples[Value]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int Index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant SpecConstArray& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = _15.samples[in.Index]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..059006509a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/spec-constant-ternary.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant uint s_tmp [[function_constant(0)]]; +constant uint s = is_function_constant_defined(s_tmp) ? s_tmp : 10u; +constant bool _13 = (s > 20u); +constant uint f = _13 ? 30u : 50u; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float(f); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/stencil-export.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/stencil-export.msl21.frag new file mode 100644 index 0000000000..5fc3cf92d5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/stencil-export.msl21.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 MRT0 [[color(0)]]; + float4 MRT1 [[color(1)]]; + uint gl_FragStencilRefARB [[stencil]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.MRT0 = float4(1.0); + out.MRT1 = float4(1.0, 0.0, 1.0, 1.0); + out.gl_FragStencilRefARB = uint(100); + out.gl_FragStencilRefARB = uint(int(out.gl_FragStencilRefARB) + 10); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-builtins.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-builtins.msl22.frag new file mode 100644 index 0000000000..03a536f0c6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-builtins.msl22.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + uint2 FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SubgroupSize [[threads_per_simdgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + main0_out out = {}; + out.FragColor.x = gl_SubgroupSize; + out.FragColor.y = gl_SubgroupInvocationID; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-globals-extract.msl22.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-globals-extract.msl22.frag new file mode 100644 index 0000000000..b2cfddf642 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/subgroup-globals-extract.msl22.frag @@ -0,0 +1,56 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +struct main0_out +{ + uint2 FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]], uint gl_SubgroupSize [[threads_per_simdgroup]]) +{ + main0_out out = {}; + out.FragColor.x = (((spvSubgroupBallotFindLSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize) + spvSubgroupBallotFindMSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize)) + spvSubgroupBallotBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize)) + spvSubgroupBallotInclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID)) + spvSubgroupBallotExclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..8d7903b79b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unreachable-break.frag @@ -0,0 +1,43 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + int cond; + int cond2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(10.0); + switch (_15.cond) + { + case 1: + { + if (_15.cond2 < 50) + { + break; + } + else + { + discard_fragment(); + } + break; // unreachable workaround + } + default: + { + out.FragColor = float4(20.0); + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..4cd2b6852a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/switch-unsigned-case.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct Buff +{ + uint TestVal; +}; + +struct main0_out +{ + float4 fsout_Color [[color(0)]]; +}; + +fragment main0_out main0(constant Buff& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.fsout_Color = float4(1.0); + switch (_15.TestVal) + { + case 0u: + { + out.fsout_Color = float4(0.100000001490116119384765625); + break; + } + case 1u: + { + out.fsout_Color = float4(0.20000000298023223876953125); + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/swizzle.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/swizzle.frag new file mode 100644 index 0000000000..cda23096c5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/swizzle.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vNormal [[user(locn1)]]; + float2 vUV [[user(locn2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d samp [[texture(0)]], sampler sampSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float4 _19 = samp.sample(sampSmplr, in.vUV); + float _23 = _19.x; + out.FragColor = float4(_23, _19.yz, 1.0); + out.FragColor = float4(_23, _19.z, 1.0, 4.0); + out.FragColor = float4(_23, _23, samp.sample(sampSmplr, (in.vUV + float2(0.100000001490116119384765625))).yy); + out.FragColor = float4(in.vNormal, 1.0); + out.FragColor = float4(in.vNormal + float3(1.7999999523162841796875), 1.0); + out.FragColor = float4(in.vUV, in.vUV + float2(1.7999999523162841796875)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag new file mode 100644 index 0000000000..98b9bb7ef8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], texture2d uTexture2 [[texture(1)]], sampler uTextureSmplr [[sampler(0)]], sampler uTexture2Smplr [[sampler(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(1)), 0); + out.FragColor += uTexture2.read(uint2(uint(int(gl_FragCoord.x)), 0) + uint2(uint(-1), 0), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..d4db1ae1c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int2 _22 = int2(gl_FragCoord.xy); + out.FragColor = uTexture.read(uint2(_22) + uint2(int2(1)), 0); + out.FragColor += uTexture.read(uint2(_22) + uint2(int2(-1, 1)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag new file mode 100644 index 0000000000..1bf6433b5b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube cubeSampler [[texture(0)]], texturecube_array cubeArraySampler [[texture(1)]], texture2d_array texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]]) +{ + main0_out out = {}; + out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, in.vUV.xyz, uint(rint(in.vUV.w)))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(rint(in.vUV.xyz.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag new file mode 100644 index 0000000000..f5af463e15 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag @@ -0,0 +1,58 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +float3 spvCubemapTo2DArrayFace(float3 P) +{ + float3 Coords = abs(P.xyz); + float CubeFace = 0; + float ProjectionAxis = 0; + float u = 0; + float v = 0; + if (Coords.x >= Coords.y && Coords.x >= Coords.z) + { + CubeFace = P.x >= 0 ? 0 : 1; + ProjectionAxis = Coords.x; + u = P.x >= 0 ? -P.z : P.z; + v = -P.y; + } + else if (Coords.y >= Coords.x && Coords.y >= Coords.z) + { + CubeFace = P.y >= 0 ? 2 : 3; + ProjectionAxis = Coords.y; + u = P.x; + v = P.y >= 0 ? P.z : -P.z; + } + else + { + CubeFace = P.z >= 0 ? 4 : 5; + ProjectionAxis = Coords.z; + u = P.z >= 0 ? P.x : -P.x; + v = -P.y; + } + u = 0.5 * (u/ProjectionAxis + 1); + v = 0.5 * (v/ProjectionAxis + 1); + return float3(u, v, CubeFace); +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube cubeSampler [[texture(0)]], texture2d_array cubeArraySampler [[texture(1)]], texture2d_array texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]]) +{ + main0_out out = {}; + out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, spvCubemapTo2DArrayFace(in.vUV.xyz).xy, uint(spvCubemapTo2DArrayFace(in.vUV.xyz).z) + (uint(rint(in.vUV.w)) * 6u))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(rint(in.vUV.xyz.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-multisample-array.msl21.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-multisample-array.msl21.frag new file mode 100644 index 0000000000..ed1e81f3e8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-multisample-array.msl21.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int3 vCoord [[user(locn0)]]; + int vSample [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d_ms_array uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(in.vCoord.xy), uint(in.vCoord.z), in.vSample); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..6d465ce9f9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/texture-proj-shadow.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vClip3 [[user(locn0)]]; + float4 vClip4 [[user(locn1)]]; + float2 vClip2 [[user(locn2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], texture1d uSampler1D [[texture(1)]], texture2d uSampler2D [[texture(2)]], texture3d uSampler3D [[texture(3)]], sampler uShadow2DSmplr [[sampler(0)]], sampler uSampler1DSmplr [[sampler(1)]], sampler uSampler2DSmplr [[sampler(2)]], sampler uSampler3DSmplr [[sampler(3)]]) +{ + main0_out out = {}; + float4 _17 = in.vClip4; + float4 _20 = _17; + _20.z = _17.w; + out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, _17.z / _20.z); + out.FragColor = uSampler1D.sample(uSampler1DSmplr, in.vClip2.x / in.vClip2.y).x; + out.FragColor = uSampler2D.sample(uSampler2DSmplr, in.vClip3.xy / in.vClip3.z).x; + out.FragColor = uSampler3D.sample(uSampler3DSmplr, _17.xyz / _17.w).x; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/ubo_layout.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/ubo_layout.frag new file mode 100644 index 0000000000..4ca603d643 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/ubo_layout.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct Str +{ + float4x4 foo; +}; + +struct UBO1 +{ + Str foo; +}; + +struct Str_1 +{ + float4x4 foo; +}; + +struct UBO2 +{ + Str_1 foo; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO1& ubo1 [[buffer(0)]], constant UBO2& ubo0 [[buffer(1)]]) +{ + main0_out out = {}; + out.FragColor = float4(ubo1.foo.foo[0][0], ubo1.foo.foo[1][0], ubo1.foo.foo[2][0], ubo1.foo.foo[3][0]) + ubo0.foo.foo[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/unary-enclose.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/unary-enclose.frag new file mode 100644 index 0000000000..c8648f1e01 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/unary-enclose.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vIn [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = in.vIn; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag new file mode 100644 index 0000000000..1cb7aa7032 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + ushort2 a [[user(locn0)]]; + uint3 b [[user(locn1)]]; + ushort c_0 [[user(locn2)]]; + ushort c_1 [[user(locn3)]]; + uint4 e_0 [[user(locn4)]]; + uint4 e_1 [[user(locn5)]]; + float4 d [[user(locn6)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray c = {}; + spvUnsafeArray e = {}; + c[0] = in.c_0; + c[1] = in.c_1; + e[0] = in.e_0; + e[1] = in.e_1; + out.FragColor = float4(float(int(short(in.a.x))), float(int(in.b.x)), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/frag/write-depth-in-function.frag b/third_party/spirv-cross/reference/opt/shaders-msl/frag/write-depth-in-function.frag new file mode 100644 index 0000000000..4ab74f19e0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/frag/write-depth-in-function.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; + float gl_FragDepth [[depth(any)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = 1.0; + out.gl_FragDepth = 0.20000000298023223876953125; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/intel/shader-integer-functions2.asm.comp b/third_party/spirv-cross/reference/opt/shaders-msl/intel/shader-integer-functions2.asm.comp new file mode 100644 index 0000000000..1e5d889d46 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/intel/shader-integer-functions2.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct foo +{ + uint a; + uint b; + int c; + int d; +}; + +kernel void main0(device foo& _4 [[buffer(0)]]) +{ + _4.a = clz(_4.a); + _4.a = ctz(_4.a); + _4.a = absdiff(_4.c, _4.d); + _4.a = absdiff(_4.a, _4.b); + _4.c = addsat(_4.c, _4.d); + _4.a = addsat(_4.a, _4.b); + _4.c = hadd(_4.c, _4.d); + _4.a = hadd(_4.a, _4.b); + _4.c = rhadd(_4.c, _4.d); + _4.a = rhadd(_4.a, _4.b); + _4.c = subsat(_4.c, _4.d); + _4.a = subsat(_4.a, _4.b); + _4.c = int(short(_4.c)) * int(short(_4.d)); + _4.a = uint(ushort(_4.a)) * uint(ushort(_4.b)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/reference/opt/shaders-msl/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..abd884ca8f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/legacy/vert/transpose.legacy.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct Buffer +{ + float4x4 MVPRowMajor; + float4x4 MVPColMajor; + float4x4 M; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Buffer& _13 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = (((_13.M * (in.Position * _13.MVPRowMajor)) + (_13.M * (_13.MVPColMajor * in.Position))) + (_13.M * (_13.MVPRowMajor * in.Position))) + (_13.M * (in.Position * _13.MVPColMajor)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc new file mode 100644 index 0000000000..24928da01d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc @@ -0,0 +1,188 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + spvUnsafeArray iFoo; + float4 ipFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup float4 spvStorageFoo[8][4][2]; + threadgroup float4 (&Foo)[4][2] = spvStorageFoo[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvArrayCopyFromDeviceToThreadGroup1(Foo[gl_InvocationID], gl_in[gl_InvocationID].iFoo.elements); + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..a08364e2b3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc @@ -0,0 +1,191 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + float4 iFoo_0 [[attribute(0)]]; + float4 iFoo_1 [[attribute(1)]]; + float4 ipFoo [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup float4 Foo[4][2]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvUnsafeArray _38 = spvUnsafeArray({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 }); + spvArrayCopyFromStackToThreadGroup1(Foo[gl_InvocationID], _38.elements); + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc new file mode 100644 index 0000000000..abc95ca899 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + spvUnsafeArray Foo; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + spvUnsafeArray iFoo; + float4 ipFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].Foo = gl_in[gl_InvocationID].iFoo; + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..3da1d18c61 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + spvUnsafeArray Foo; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + float4 iFoo_0 [[attribute(0)]]; + float4 iFoo_1 [[attribute(1)]]; + float4 ipFoo [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvUnsafeArray _38 = spvUnsafeArray({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 }); + gl_out[gl_InvocationID].Foo = _38; + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..2bf5c257d6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_b; + float4 m_22_c; + float4 m_22_d; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + V _22 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_b = _22.b; + out.m_22_c = _22.c; + out.m_22_d = _22.d; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..18596302eb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc @@ -0,0 +1,41 @@ +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_a; + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_b; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup P _11; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + _11.a = 1.0; + patchOut.m_11_b = 2.0; + gl_out[gl_InvocationID].c_a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc new file mode 100644 index 0000000000..f2f17bad37 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_a; + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_b; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup P spvStorage_11[8]; + threadgroup P (&_11) = spvStorage_11[(gl_GlobalInvocationID.x / 4) % 8]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + _11.a = 1.0; + patchOut.m_11_b = 2.0; + gl_out[gl_InvocationID].c_a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.vert new file mode 100644 index 0000000000..ad6079061e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-0.vert @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_b [[user(locn1)]]; + float4 m_22_c [[user(locn2)]]; + float4 m_22_d [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + V _22 = {}; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_b = _22.b; + out.m_22_c = _22.c; + out.m_22_d = _22.d; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..2b535c312e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_a; + float4 m_22_c; + float4 m_22_d; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + V _22 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_a = _22.a; + out.m_22_c = _22.c; + out.m_22_d = _22.d; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..7db78a9ba5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc @@ -0,0 +1,41 @@ +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_a; + float m_11_b; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup C c[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.m_11_a = 1.0; + patchOut.m_11_b = 2.0; + c[gl_InvocationID].a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc new file mode 100644 index 0000000000..ad793918e2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_a; + float m_11_b; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup C spvStoragec[8][4]; + threadgroup C (&c)[4] = spvStoragec[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + patchOut.m_11_a = 1.0; + patchOut.m_11_b = 2.0; + c[gl_InvocationID].a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.vert new file mode 100644 index 0000000000..3b830290f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs-block.mask-location-1.vert @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_a [[user(locn0)]]; + float4 m_22_c [[user(locn2)]]; + float4 m_22_d [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + V _22 = {}; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_a = _22.a; + out.m_22_c = _22.c; + out.m_22_d = _22.d; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-clip-distance.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-clip-distance.vert new file mode 100644 index 0000000000..1f56f34a76 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-clip-distance.vert @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + spvUnsafeArray gl_ClipDistance = {}; + out.v0 = float4(1.0); + out.v1 = float4(2.0); + out.gl_Position = float4(3.0); + out.gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..1c0aab5037 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v1; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float4 v0 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + v0 = float4(1.0); + out.v1 = float4(2.0); + out.gl_Position = float4(3.0); + out.gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..7c8e387824 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v1; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v0[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].x = 2.0; + if (gl_InvocationID == 0) + { + patchOut.v1 = float4(2.0); + ((device float*)&patchOut.v1)[3u] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position.z = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc new file mode 100644 index 0000000000..7a5e183a26 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc @@ -0,0 +1,81 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup float4 spvStoragev0[8][4]; + threadgroup float4 (&v0)[4] = spvStoragev0[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.tesc new file mode 100644 index 0000000000..ef3ff9c221 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.tesc @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v0[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.vert new file mode 100644 index 0000000000..88c6bb6fac --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-0.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + float4 v0 = {}; + v0 = float4(1.0); + out.v1 = float4(2.0); + out.gl_Position = float4(3.0); + out.gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..d558b7aed7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float4 v1 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.v0 = float4(1.0); + v1 = float4(2.0); + out.gl_Position = float4(3.0); + out.gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..bb87ced750 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ +}; +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v1; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.x = 2.0; + if (gl_InvocationID == 0) + { + v1 = float4(2.0); + ((threadgroup float*)&v1)[3u] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position.z = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc new file mode 100644 index 0000000000..28ec0be0c6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v3; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup float4 spvStoragev1[8][2]; + threadgroup float4 (&v1)[2] = spvStoragev1[(gl_GlobalInvocationID.x / 4) % 8]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((threadgroup float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((threadgroup float*)&v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.tesc new file mode 100644 index 0000000000..1673d52329 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.tesc @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v3; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v1[2]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((threadgroup float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((threadgroup float*)&v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.vert new file mode 100644 index 0000000000..cc7d41794d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-location-1.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + float4 v1 = {}; + out.v0 = float4(1.0); + v1 = float4(2.0); + out.gl_Position = float4(3.0); + out.gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert new file mode 100644 index 0000000000..463ecc87b5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0; + float4 v1; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float gl_PointSize = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.v0 = float4(1.0); + out.v1 = float4(2.0); + out.gl_Position = float4(3.0); + gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc new file mode 100644 index 0000000000..694cdbb7ff --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc @@ -0,0 +1,89 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out_masked[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.tesc new file mode 100644 index 0000000000..da976c9a8a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.tesc @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out_masked[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.vert b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.vert new file mode 100644 index 0000000000..ffdfdaaff4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-point-size.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + float gl_PointSize = {}; + out.v0 = float4(1.0); + out.v1 = float4(2.0); + out.gl_Position = float4(3.0); + gl_PointSize = 4.0; + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 0.5; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc new file mode 100644 index 0000000000..c55e337682 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc @@ -0,0 +1,89 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(10.0); + gl_out_masked[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.tesc new file mode 100644 index 0000000000..04584de49f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/masking/write-outputs.mask-position.tesc @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + patchOut.v1[0] = float4(2.0); + ((device float*)&patchOut.v1[0])[0u] = 3.0; + patchOut.v1[1] = float4(2.0); + ((device float*)&patchOut.v1[1])[0u] = 5.0; + } + patchOut.v3 = float4(5.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(10.0); + gl_out_masked[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc new file mode 100644 index 0000000000..1618eaa627 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc @@ -0,0 +1,123 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct S +{ + int x; + float4 y; + spvUnsafeArray z; +}; + +struct TheBlock +{ + spvUnsafeArray blockFa; + spvUnsafeArray blockSa; + float blockF; +}; + +struct main0_patchOut +{ + float2 in_te_positionScale; + float2 in_te_positionOffset; + spvUnsafeArray tcBlock; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_196; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 5]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 5, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 5, spvIndirectParams[1] - 1); + int _163; + _163 = 0; + float _111; + for (float _170 = 1.2999999523162841796875; _163 < 2; _170 = _111, _163++) + { + float _169; + _169 = _170; + for (int _164 = 0; _164 < 3; ) + { + patchOut.tcBlock[_163].blockFa[_164] = _169; + _169 += 0.4000000059604644775390625; + _164++; + continue; + } + int _165; + float _168; + _168 = _169; + _165 = 0; + float _174; + for (; _165 < 2; _168 = _174, _165++) + { + patchOut.tcBlock[_163].blockSa[_165].x = int(_168); + patchOut.tcBlock[_163].blockSa[_165].y = float4(_168 + 0.4000000059604644775390625, _168 + 1.2000000476837158203125, _168 + 2.0, _168 + 2.80000019073486328125); + _174 = _168 + 0.800000011920928955078125; + for (int _171 = 0; _171 < 2; ) + { + patchOut.tcBlock[_163].blockSa[_165].z[_171] = _174; + _174 += 0.4000000059604644775390625; + _171++; + continue; + } + } + patchOut.tcBlock[_163].blockF = _168; + _111 = _168 + 0.4000000059604644775390625; + } + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(gl_in[0].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(gl_in[1].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(gl_in[2].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(gl_in[3].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(gl_in[4].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(gl_in[5].in_tc_attr.x); + patchOut.in_te_positionScale = float2(gl_in[6].in_tc_attr.x, gl_in[7].in_tc_attr.x); + patchOut.in_te_positionOffset = float2(gl_in[8].in_tc_attr.x, gl_in[9].in_tc_attr.x); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.multi-patch.tesc new file mode 100644 index 0000000000..fe26831673 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.multi-patch.tesc @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_patchOut +{ + float3 vFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.tesc new file mode 100644 index 0000000000..a9ff5b37ea --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/basic.tesc @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_patchOut +{ + float3 vFoo; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc new file mode 100644 index 0000000000..1bed1c9058 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc @@ -0,0 +1,128 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct Block_1 +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct main0_out +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; + float4 gl_Position; +}; + +struct main0_in +{ + spvUnsafeArray in_a; + float in_b; + float2x2 in_m; + Meep in_meep; + spvUnsafeArray in_meeps; + spvUnsafeArray in_B_a; + float in_B_b; + float2x2 in_B_m; + Meep in_B_meep; + spvUnsafeArray in_B_meeps; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a[0]; + gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a[1]; + gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b; + gl_out[gl_InvocationID].m = gl_in[gl_InvocationID].in_m; + gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].in_meep.a; + gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].in_meep.b; + gl_out[gl_InvocationID].meeps[0].a = gl_in[gl_InvocationID].in_meeps[0].a; + gl_out[gl_InvocationID].meeps[0].b = gl_in[gl_InvocationID].in_meeps[0].b; + gl_out[gl_InvocationID].meeps[1].a = gl_in[gl_InvocationID].in_meeps[1].a; + gl_out[gl_InvocationID].meeps[1].b = gl_in[gl_InvocationID].in_meeps[1].b; + gl_out[gl_InvocationID].B_a[0] = gl_in[gl_InvocationID].in_B_a[0]; + gl_out[gl_InvocationID].B_a[1] = gl_in[gl_InvocationID].in_B_a[1]; + gl_out[gl_InvocationID].B_b = gl_in[gl_InvocationID].in_B_b; + gl_out[gl_InvocationID].B_m = gl_in[gl_InvocationID].in_B_m; + gl_out[gl_InvocationID].B_meep.a = gl_in[gl_InvocationID].in_B_meep.a; + gl_out[gl_InvocationID].B_meep.b = gl_in[gl_InvocationID].in_B_meep.b; + gl_out[gl_InvocationID].B_meeps[0].a = gl_in[gl_InvocationID].in_B_meeps[0].a; + gl_out[gl_InvocationID].B_meeps[0].b = gl_in[gl_InvocationID].in_B_meeps[0].b; + gl_out[gl_InvocationID].B_meeps[1].a = gl_in[gl_InvocationID].in_B_meeps[1].a; + gl_out[gl_InvocationID].B_meeps[1].b = gl_in[gl_InvocationID].in_B_meeps[1].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.tesc new file mode 100644 index 0000000000..e785fdfe22 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-control-point-inout-types.tesc @@ -0,0 +1,132 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct Block_1 +{ + spvUnsafeArray a; + float b; + float2x2 m; +}; + +struct main0_out +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; + float4 gl_Position; +}; + +struct main0_in +{ + float in_a_0 [[attribute(0)]]; + float in_a_1 [[attribute(1)]]; + float in_b [[attribute(2)]]; + float2 in_m_0 [[attribute(3)]]; + float2 in_m_1 [[attribute(4)]]; + float in_meep_a [[attribute(5)]]; + float in_meep_b [[attribute(6)]]; + float in_B_a_0 [[attribute(11)]]; + float in_B_a_1 [[attribute(12)]]; + float in_B_b [[attribute(13)]]; + float2 in_B_m_0 [[attribute(14)]]; + float2 in_B_m_1 [[attribute(15)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a_0; + gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a_1; + gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b; + float2x2 _178 = float2x2(gl_in[gl_InvocationID].in_m_0, gl_in[gl_InvocationID].in_m_1); + gl_out[gl_InvocationID].m = _178; + gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].in_meep_a; + gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].in_meep_b; + gl_out[gl_InvocationID].meeps[0].a = 1.0; + gl_out[gl_InvocationID].meeps[0].b = 2.0; + gl_out[gl_InvocationID].meeps[1].a = 3.0; + gl_out[gl_InvocationID].meeps[1].b = 4.0; + gl_out[gl_InvocationID].B_a[0] = gl_in[gl_InvocationID].in_B_a_0; + gl_out[gl_InvocationID].B_a[1] = gl_in[gl_InvocationID].in_B_a_1; + gl_out[gl_InvocationID].B_b = gl_in[gl_InvocationID].in_B_b; + float2x2 _216 = float2x2(gl_in[gl_InvocationID].in_B_m_0, gl_in[gl_InvocationID].in_B_m_1); + gl_out[gl_InvocationID].B_m = _216; + gl_out[gl_InvocationID].B_meep.a = 10.0; + gl_out[gl_InvocationID].B_meep.b = 20.0; + gl_out[gl_InvocationID].B_meeps[0].a = 5.0; + gl_out[gl_InvocationID].B_meeps[0].b = 6.0; + gl_out[gl_InvocationID].B_meeps[1].a = 7.0; + gl_out[gl_InvocationID].B_meeps[1].b = 8.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc new file mode 100644 index 0000000000..c3f7081552 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/complex-patch-out-types.tesc @@ -0,0 +1,107 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + patchOut.a[0] = 1.0; + patchOut.a[1] = 2.0; + patchOut.b = 3.0; + patchOut.m = float2x2(float2(2.0, 0.0), float2(0.0, 2.0)); + patchOut.meep.a = 4.0; + patchOut.meep.b = 5.0; + patchOut.meeps[0].a = 6.0; + patchOut.meeps[0].b = 7.0; + patchOut.meeps[1].a = 8.0; + patchOut.meeps[1].b = 9.0; + patchOut.B_a[0] = 1.0; + patchOut.B_a[1] = 2.0; + patchOut.B_b = 3.0; + patchOut.B_m = float2x2(float2(4.0, 0.0), float2(0.0, 4.0)); + patchOut.B_meep.a = 4.0; + patchOut.B_meep.b = 5.0; + patchOut.B_meeps[0].a = 6.0; + patchOut.B_meeps[0].b = 7.0; + patchOut.B_meeps[1].a = 8.0; + patchOut.B_meeps[1].b = 9.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc new file mode 100644 index 0000000000..5ea01cad9f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4x4 vOutputs; +}; + +struct main0_in +{ + float4x4 vInputs; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].vOutputs = gl_in[gl_InvocationID].vInputs; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc new file mode 100644 index 0000000000..1ed36213b6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4x4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs_0 [[attribute(0)]]; + float4 vInputs_1 [[attribute(1)]]; + float4 vInputs_2 [[attribute(2)]]; + float4 vInputs_3 [[attribute(3)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + float4x4 _28 = float4x4(gl_in[gl_InvocationID].vInputs_0, gl_in[gl_InvocationID].vInputs_1, gl_in[gl_InvocationID].vInputs_2, gl_in[gl_InvocationID].vInputs_3); + gl_out[gl_InvocationID].vOutputs = _28; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc new file mode 100644 index 0000000000..de6ba17807 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexData +{ + float4x4 a; + spvUnsafeArray b; + float4 c; +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + VertexData vInputs; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + int _27 = gl_InvocationID ^ 1; + gl_out[gl_InvocationID].vOutputs = ((gl_in[gl_InvocationID].vInputs.a[1] + gl_in[gl_InvocationID].vInputs.b[1]) + gl_in[gl_InvocationID].vInputs.c) + gl_in[_27].vInputs.c; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc new file mode 100644 index 0000000000..9eaaa2e6d5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc @@ -0,0 +1,81 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexData +{ + float4x4 a; + spvUnsafeArray b; + float4 c; +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs_a_0 [[attribute(0)]]; + float4 vInputs_a_1 [[attribute(1)]]; + float4 vInputs_a_2 [[attribute(2)]]; + float4 vInputs_a_3 [[attribute(3)]]; + float4 vInputs_b_0 [[attribute(4)]]; + float4 vInputs_b_1 [[attribute(5)]]; + float4 vInputs_c [[attribute(6)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + int _27 = gl_InvocationID ^ 1; + gl_out[gl_InvocationID].vOutputs = ((gl_in[gl_InvocationID].vInputs_a_1 + gl_in[gl_InvocationID].vInputs_b_1) + gl_in[gl_InvocationID].vInputs_c) + gl_in[_27].vInputs_c; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.multi-patch.tesc new file mode 100644 index 0000000000..ddf142ccba --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.multi-patch.tesc @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs; + ushort2 m_44; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].vOutputs = gl_in[gl_InvocationID].vInputs; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc new file mode 100644 index 0000000000..6f0da387e2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].vOutputs = gl_in[gl_InvocationID].vInputs; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/matrix-output.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/matrix-output.multi-patch.tesc new file mode 100644 index 0000000000..28fff01555 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/matrix-output.multi-patch.tesc @@ -0,0 +1,41 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float in_te_attr; + float4x3 in_te_data0; + float4x3 in_te_data1; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_104; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 3; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1); + float _15 = float(gl_InvocationID); + float3 _18 = float3(_15, 0.0, 0.0); + float3 _19 = float3(0.0, _15, 0.0); + float3 _20 = float3(0.0, 0.0, _15); + gl_out[gl_InvocationID].in_te_data0 = float4x3(_18, _19, _20, float3(0.0)); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + int _42 = (gl_InvocationID + 1) % 3; + gl_out[gl_InvocationID].in_te_data1 = float4x3(_18 + gl_out[_42].in_te_data0[0], _19 + gl_out[_42].in_te_data0[1], _20 + gl_out[_42].in_te_data0[2], gl_out[_42].in_te_data0[3]); + gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.multi-patch.tesc new file mode 100644 index 0000000000..ae33de517a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.multi-patch.tesc @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_in +{ + uint3 m_82; + ushort2 m_86; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + if (gl_InvocationID == 0) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(5.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5)); + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.tesc new file mode 100644 index 0000000000..eafc50607d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/reload-tess-level.tesc @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + if (gl_InvocationID == 0) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(5.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5)); + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/struct-output.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/struct-output.multi-patch.tesc new file mode 100644 index 0000000000..6c52654615 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/struct-output.multi-patch.tesc @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct te_data +{ + float a; + float b; + uint c; +}; + +struct main0_out +{ + float in_te_attr; + te_data in_te_data0; + te_data in_te_data1; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_119; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 3; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1); + float _15 = float(gl_InvocationID); + int _18 = gl_InvocationID + 1; + float _19 = float(_18); + uint _21 = uint(gl_InvocationID); + gl_out[gl_InvocationID].in_te_data0 = te_data{ _15, _19, _21 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + int _38 = _18 % 3; + gl_out[gl_InvocationID].in_te_data1 = te_data{ _15 + gl_out[_38].in_te_data0.a, _19 + gl_out[_38].in_te_data0.b, _21 + gl_out[_38].in_te_data0.c }; + gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.multi-patch.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.multi-patch.tesc new file mode 100644 index 0000000000..356a963d68 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.multi-patch.tesc @@ -0,0 +1,91 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 uScale; + float3 uCamPos; + float2 uPatchSize; + float2 uMaxTessLevel; + float uDistanceMod; + float4 uFrustum[6]; +}; + +struct main0_patchOut +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +struct main0_in +{ + float3 vPatchPosBase; + ushort2 m_996; +}; + +kernel void main0(constant UBO& _41 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + float2 _431 = (gl_in[0].vPatchPosBase.xy - float2(10.0)) * _41.uScale.xy; + float2 _441 = ((gl_in[0].vPatchPosBase.xy + _41.uPatchSize) + float2(10.0)) * _41.uScale.xy; + float3 _446 = float3(_431.x, -10.0, _431.y); + float3 _451 = float3(_441.x, 10.0, _441.y); + float4 _467 = float4((_446 + _451) * 0.5, 1.0); + float3 _514 = float3(length(_451 - _446) * (-0.5)); + bool _516 = any(float3(dot(_41.uFrustum[0], _467), dot(_41.uFrustum[1], _467), dot(_41.uFrustum[2], _467)) <= _514); + bool _526; + if (!_516) + { + _526 = any(float3(dot(_41.uFrustum[3], _467), dot(_41.uFrustum[4], _467), dot(_41.uFrustum[5], _467)) <= _514); + } + else + { + _526 = _516; + } + if (!(!_526)) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(-1.0); + } + else + { + patchOut.vOutPatchPosBase = gl_in[0].vPatchPosBase.xy; + float2 _681 = fma(float2(-0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float2 _710 = fma(float2(0.5, -0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _729 = fast::clamp(log2((length(_41.uCamPos - float3(_710.x, 0.0, _710.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _739 = fma(float2(1.5, -0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float2 _768 = fma(float2(-0.5, 0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _787 = fast::clamp(log2((length(_41.uCamPos - float3(_768.x, 0.0, _768.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _797 = fma(float2(0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _816 = fast::clamp(log2((length(_41.uCamPos - float3(_797.x, 0.0, _797.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _826 = fma(float2(1.5, 0.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _845 = fast::clamp(log2((length(_41.uCamPos - float3(_826.x, 0.0, _826.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _855 = fma(float2(-0.5, 1.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float2 _884 = fma(float2(0.5, 1.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _903 = fast::clamp(log2((length(_41.uCamPos - float3(_884.x, 0.0, _884.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _913 = fma(float2(1.5), _41.uPatchSize, gl_in[0].vPatchPosBase.xy) * _41.uScale.xy; + float _614 = dot(float4(_787, _816, fast::clamp(log2((length(_41.uCamPos - float3(_855.x, 0.0, _855.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _903), float4(0.25)); + float _620 = dot(float4(fast::clamp(log2((length(_41.uCamPos - float3(_681.x, 0.0, _681.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _729, _787, _816), float4(0.25)); + float _626 = dot(float4(_729, fast::clamp(log2((length(_41.uCamPos - float3(_739.x, 0.0, _739.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _816, _845), float4(0.25)); + float _632 = dot(float4(_816, _845, _903, fast::clamp(log2((length(_41.uCamPos - float3(_913.x, 0.0, _913.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x)), float4(0.25)); + float4 _633 = float4(_614, _620, _626, _632); + patchOut.vPatchLods = _633; + float4 _940 = exp2(-fast::min(_633, _633.yzwx)) * _41.uMaxTessLevel.y; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_940.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_940.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_940.z); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(_940.w); + float _948 = _41.uMaxTessLevel.y * exp2(-fast::min(fast::min(fast::min(_614, _620), fast::min(_626, _632)), _816)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(_948); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(_948); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.tesc b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.tesc new file mode 100644 index 0000000000..d9a6697cd9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.tesc @@ -0,0 +1,93 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 uScale; + float3 uCamPos; + float2 uPatchSize; + float2 uMaxTessLevel; + float uDistanceMod; + float4 uFrustum[6]; +}; + +struct main0_patchOut +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +struct main0_in +{ + float2 vPatchPosBase [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant UBO& _41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 1) + return; + float2 _431 = (gl_in[0].vPatchPosBase - float2(10.0)) * _41.uScale.xy; + float2 _441 = ((gl_in[0].vPatchPosBase + _41.uPatchSize) + float2(10.0)) * _41.uScale.xy; + float3 _446 = float3(_431.x, -10.0, _431.y); + float3 _451 = float3(_441.x, 10.0, _441.y); + float4 _467 = float4((_446 + _451) * 0.5, 1.0); + float3 _514 = float3(length(_451 - _446) * (-0.5)); + bool _516 = any(float3(dot(_41.uFrustum[0], _467), dot(_41.uFrustum[1], _467), dot(_41.uFrustum[2], _467)) <= _514); + bool _526; + if (!_516) + { + _526 = any(float3(dot(_41.uFrustum[3], _467), dot(_41.uFrustum[4], _467), dot(_41.uFrustum[5], _467)) <= _514); + } + else + { + _526 = _516; + } + if (!(!_526)) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(-1.0); + } + else + { + patchOut.vOutPatchPosBase = gl_in[0].vPatchPosBase; + float2 _681 = fma(float2(-0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float2 _710 = fma(float2(0.5, -0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _729 = fast::clamp(log2((length(_41.uCamPos - float3(_710.x, 0.0, _710.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _739 = fma(float2(1.5, -0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float2 _768 = fma(float2(-0.5, 0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _787 = fast::clamp(log2((length(_41.uCamPos - float3(_768.x, 0.0, _768.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _797 = fma(float2(0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _816 = fast::clamp(log2((length(_41.uCamPos - float3(_797.x, 0.0, _797.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _826 = fma(float2(1.5, 0.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _845 = fast::clamp(log2((length(_41.uCamPos - float3(_826.x, 0.0, _826.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _855 = fma(float2(-0.5, 1.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float2 _884 = fma(float2(0.5, 1.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _903 = fast::clamp(log2((length(_41.uCamPos - float3(_884.x, 0.0, _884.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + float2 _913 = fma(float2(1.5), _41.uPatchSize, gl_in[0].vPatchPosBase) * _41.uScale.xy; + float _614 = dot(float4(_787, _816, fast::clamp(log2((length(_41.uCamPos - float3(_855.x, 0.0, _855.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _903), float4(0.25)); + float _620 = dot(float4(fast::clamp(log2((length(_41.uCamPos - float3(_681.x, 0.0, _681.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _729, _787, _816), float4(0.25)); + float _626 = dot(float4(_729, fast::clamp(log2((length(_41.uCamPos - float3(_739.x, 0.0, _739.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _816, _845), float4(0.25)); + float _632 = dot(float4(_816, _845, _903, fast::clamp(log2((length(_41.uCamPos - float3(_913.x, 0.0, _913.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x)), float4(0.25)); + float4 _633 = float4(_614, _620, _626, _632); + patchOut.vPatchLods = _633; + float4 _940 = exp2(-fast::min(_633, _633.yzwx)) * _41.uMaxTessLevel.y; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_940.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_940.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_940.z); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(_940.w); + float _948 = _41.uMaxTessLevel.y * exp2(-fast::min(fast::min(fast::min(_614, _620), fast::min(_626, _632)), _816)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(_948); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(_948); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese new file mode 100644 index 0000000000..e1f1f3c9df --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _35 +{ + float dummy; + float4 variableInStruct; +}; + +struct main0_out +{ + float outResult [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + spvUnsafeArray<_35, 3> testStructArray; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(float3 gl_TessCoord [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + out.outResult = ((float(abs(gl_in[0].testStructArray[2].variableInStruct.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(gl_in[0].testStructArray[2].variableInStruct.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].testStructArray[2].variableInStruct.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].testStructArray[2].variableInStruct.w - 7.0) < 0.001000000047497451305389404296875); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese new file mode 100644 index 0000000000..d81d44b070 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct t35 +{ + float2 m0; + float4 m1; +}; + +struct t36 +{ + float2 m0; + t35 m1; +}; + +struct main0_out +{ + float v80 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 v40_m0; + t35 v40_m1; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(float3 gl_TessCoord [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + out.v80 = ((float(abs(gl_in[0].v40_m1.m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(gl_in[0].v40_m1.m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].v40_m1.m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].v40_m1.m1.w - 7.0) < 0.001000000047497451305389404296875); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.tese new file mode 100644 index 0000000000..8655395581 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/in-block-with-nested-struct.tese @@ -0,0 +1,43 @@ +#include +#include + +using namespace metal; + +struct t35 +{ + float2 m0; + float4 m1; +}; + +struct t36 +{ + float2 m0; + t35 m1; +}; + +struct main0_out +{ + float v80 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 v40_m0 [[attribute(0)]]; + float2 v40_m1_m0 [[attribute(1)]]; + float4 v40_m1_m1 [[attribute(2)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + out.v80 = ((float(abs(patchIn.gl_in[0].v40_m1_m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(patchIn.gl_in[0].v40_m1_m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(patchIn.gl_in[0].v40_m1_m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(patchIn.gl_in[0].v40_m1_m1.w - 7.0) < 0.001000000047497451305389404296875); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-array.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-array.tese new file mode 100644 index 0000000000..8f1002128d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-array.tese @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Floats [[attribute(0)]]; + float4 Floats2 [[attribute(2)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + out.gl_Position = (patchIn.gl_in[0].Floats * gl_TessCoord.x) + (patchIn.gl_in[1].Floats2 * gl_TessCoord.y); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.raw-tess-in.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.raw-tess-in.tese new file mode 100644 index 0000000000..e918f5b653 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.raw-tess-in.tese @@ -0,0 +1,70 @@ +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct PatchBlock +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor; + float4 blocks_a; + float4 blocks_b; + Foo vFoos; +}; + +struct main0_patchIn +{ + float4 vColors; + float4 patch_block_a; + float4 patch_block_b; + Foo vFoo; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device main0_patchIn* spvPatchIn [[buffer(20)]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + PatchBlock patch_block = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + const device main0_patchIn& patchIn = spvPatchIn[gl_PrimitiveID]; + patch_block.a = patchIn.patch_block_a; + patch_block.b = patchIn.patch_block_b; + out.gl_Position = gl_in[0].blocks_a; + out.gl_Position += gl_in[0].blocks_b; + out.gl_Position += gl_in[1].blocks_a; + out.gl_Position += gl_in[1].blocks_b; + out.gl_Position += patch_block.a; + out.gl_Position += patch_block.b; + out.gl_Position += gl_in[0].vColor; + out.gl_Position += gl_in[1].vColor; + out.gl_Position += patchIn.vColors; + out.gl_Position += patchIn.vFoo.a; + out.gl_Position += patchIn.vFoo.b; + out.gl_Position += gl_in[0].vFoos.a; + out.gl_Position += gl_in[0].vFoos.b; + out.gl_Position += gl_in[1].vFoos.a; + out.gl_Position += gl_in[1].vFoos.b; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese new file mode 100644 index 0000000000..25b25ff94e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese @@ -0,0 +1,76 @@ +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct PatchBlock +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor [[attribute(0)]]; + float4 blocks_a [[attribute(4)]]; + float4 blocks_b [[attribute(5)]]; + float4 vFoos_a [[attribute(14)]]; + float4 vFoos_b [[attribute(15)]]; +}; + +struct main0_patchIn +{ + float4 vColors [[attribute(1)]]; + float4 patch_block_a [[attribute(6)]]; + float4 patch_block_b [[attribute(7)]]; + float4 vFoo_a [[attribute(8)]]; + float4 vFoo_b [[attribute(9)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + PatchBlock patch_block = {}; + Foo vFoo = {}; + patch_block.a = patchIn.patch_block_a; + patch_block.b = patchIn.patch_block_b; + vFoo.a = patchIn.vFoo_a; + vFoo.b = patchIn.vFoo_b; + out.gl_Position = patchIn.gl_in[0].blocks_a; + out.gl_Position += patchIn.gl_in[0].blocks_b; + out.gl_Position += patchIn.gl_in[1].blocks_a; + out.gl_Position += patchIn.gl_in[1].blocks_b; + out.gl_Position += patch_block.a; + out.gl_Position += patch_block.b; + out.gl_Position += patchIn.gl_in[0].vColor; + out.gl_Position += patchIn.gl_in[1].vColor; + out.gl_Position += patchIn.vColors; + out.gl_Position += vFoo.a; + out.gl_Position += vFoo.b; + Foo _204 = Foo{ patchIn.gl_in[0].vFoos_a, patchIn.gl_in[0].vFoos_b }; + out.gl_Position += _204.a; + out.gl_Position += _204.b; + Foo _218 = Foo{ patchIn.gl_in[1].vFoos_a, patchIn.gl_in[1].vFoos_b }; + out.gl_Position += _218.a; + out.gl_Position += _218.b; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese new file mode 100644 index 0000000000..e4bbeb7ede --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInputs_0 [[attribute(0)]]; + float4 vInputs_1 [[attribute(1)]]; + float4 vInputs_2 [[attribute(2)]]; + float4 vInputs_3 [[attribute(3)]]; +}; + +struct main0_patchIn +{ + float4 vBoo_0 [[attribute(4)]]; + float4 vBoo_1 [[attribute(5)]]; + float4 vBoo_2 [[attribute(6)]]; + float4 vBoo_3 [[attribute(7)]]; + int vIndex [[attribute(8)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray vBoo = {}; + vBoo[0] = patchIn.vBoo_0; + vBoo[1] = patchIn.vBoo_1; + vBoo[2] = patchIn.vBoo_2; + vBoo[3] = patchIn.vBoo_3; + float4x4 _57 = float4x4(patchIn.gl_in[0u].vInputs_0, patchIn.gl_in[0u].vInputs_1, patchIn.gl_in[0u].vInputs_2, patchIn.gl_in[0u].vInputs_3); + float4x4 _59 = float4x4(patchIn.gl_in[1u].vInputs_0, patchIn.gl_in[1u].vInputs_1, patchIn.gl_in[1u].vInputs_2, patchIn.gl_in[1u].vInputs_3); + float4x4 _47 = _57; + float4x4 _48 = _59; + out.gl_Position = (_47[patchIn.vIndex] + _48[patchIn.vIndex]) + vBoo[patchIn.vIndex]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese new file mode 100644 index 0000000000..54d7419f5a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInputs [[attribute(0)]]; +}; + +struct main0_patchIn +{ + float4 vBoo_0 [[attribute(1)]]; + float4 vBoo_1 [[attribute(2)]]; + float4 vBoo_2 [[attribute(3)]]; + float4 vBoo_3 [[attribute(4)]]; + int vIndex [[attribute(5)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray vBoo = {}; + vBoo[0] = patchIn.vBoo_0; + vBoo[1] = patchIn.vBoo_1; + vBoo[2] = patchIn.vBoo_2; + vBoo[3] = patchIn.vBoo_3; + out.gl_Position = (patchIn.gl_in[0u].vInputs + patchIn.gl_in[1u].vInputs) + vBoo[patchIn.vIndex]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.domain.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.domain.tese new file mode 100644 index 0000000000..81c4aa49a4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.domain.tese @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + gl_TessCoord.y = 1.0 - gl_TessCoord.y; + out.gl_Position = float4(fma(gl_TessCoord.x * gl_TessLevelInner[0], gl_TessLevelOuter[0], ((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), fma(gl_TessCoord.y * gl_TessLevelInner[1], gl_TessLevelOuter[3], ((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.tese new file mode 100644 index 0000000000..bfa96f9cfb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/quad.tese @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + out.gl_Position = float4(fma(gl_TessCoord.x * gl_TessLevelInner[0], gl_TessLevelOuter[0], ((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), fma(gl_TessCoord.y * gl_TessLevelInner[1], gl_TessLevelOuter[1], ((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese new file mode 100644 index 0000000000..44bdd5ffe9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..65d2fd94f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]; + gl_TessLevelOuter[1] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]; + gl_TessLevelOuter[2] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]; + gl_TessLevelOuter[3] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]; + gl_TessLevelInner[0] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0]; + gl_TessLevelInner[1] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1]; + out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.msl2.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.msl2.tese new file mode 100644 index 0000000000..decaca3d5a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.msl2.tese @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevel [[attribute(0)]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = patchIn.gl_TessLevel[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevel[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevel[2]; + gl_TessLevelInner[0] = patchIn.gl_TessLevel[3]; + out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..0b555ed0fe --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese @@ -0,0 +1,64 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]; + gl_TessLevelOuter[1] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]; + gl_TessLevelOuter[2] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]; + gl_TessLevelInner[0] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor; + out.gl_Position = float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/set-from-function.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/set-from-function.tese new file mode 100644 index 0000000000..ad4f61b956 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/set-from-function.tese @@ -0,0 +1,55 @@ +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor [[attribute(0)]]; + float4 blocks_a [[attribute(2)]]; + float4 blocks_b [[attribute(3)]]; +}; + +struct main0_patchIn +{ + float4 vColors [[attribute(1)]]; + float4 vFoo_a [[attribute(4)]]; + float4 vFoo_b [[attribute(5)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + Foo vFoo = {}; + vFoo.a = patchIn.vFoo_a; + vFoo.b = patchIn.vFoo_b; + out.gl_Position = patchIn.gl_in[0].blocks_a; + out.gl_Position += patchIn.gl_in[0].blocks_b; + out.gl_Position += patchIn.gl_in[1].blocks_a; + out.gl_Position += patchIn.gl_in[1].blocks_b; + out.gl_Position += patchIn.gl_in[0].vColor; + out.gl_Position += patchIn.gl_in[1].vColor; + out.gl_Position += patchIn.vColors; + out.gl_Position += vFoo.a; + out.gl_Position += vFoo.b; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese new file mode 100644 index 0000000000..86ccc4f023 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevel [[attribute(0)]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevel[3]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevel[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevel[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevel[2]; + out.gl_Position = float4((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0], (gl_TessCoord.y * gl_TessLevelInner[0]) * gl_TessLevelOuter[1], (gl_TessCoord.z * gl_TessLevelInner[0]) * gl_TessLevelOuter[2], 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle.tese new file mode 100644 index 0000000000..12715be198 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/triangle.tese @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.raw-tess-in.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.raw-tess-in.tese new file mode 100644 index 0000000000..d4441c2eee --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.raw-tess-in.tese @@ -0,0 +1,46 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; + float4 uScale; + float2 uInvScale; + float3 uCamPos; + float2 uPatchSize; + float2 uInvHeightmapSize; +}; + +struct main0_out +{ + float3 vWorld [[user(locn0)]]; + float4 vGradNormalTex [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(constant UBO& _31 [[buffer(0)]], texture2d uHeightmapDisplacement [[texture(0)]], sampler uHeightmapDisplacementSmplr [[sampler(0)]], float2 gl_TessCoordIn [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_patchIn* spvPatchIn [[buffer(20)]]) +{ + main0_out out = {}; + const device main0_patchIn& patchIn = spvPatchIn[gl_PrimitiveID]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + float2 _202 = fma(gl_TessCoord.xy, _31.uPatchSize, patchIn.vOutPatchPosBase); + float2 _216 = mix(patchIn.vPatchLods.yx, patchIn.vPatchLods.zw, float2(gl_TessCoord.x)); + float _223 = mix(_216.x, _216.y, gl_TessCoord.y); + float _225 = floor(_223); + float2 _141 = _31.uInvHeightmapSize * exp2(_225); + out.vGradNormalTex = float4(fma(_202, _31.uInvHeightmapSize, _31.uInvHeightmapSize * 0.5), (_202 * _31.uInvHeightmapSize) * _31.uScale.zw); + float3 _256 = mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, fma(_202, _31.uInvHeightmapSize, _141 * 0.5), level(_225)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, fma(_202, _31.uInvHeightmapSize, _141 * 1.0), level(_225 + 1.0)).xyz, float3(_223 - _225)); + float2 _171 = fma(_202, _31.uScale.xy, _256.yz); + out.vWorld = float3(_171.x, _256.x, _171.y); + out.gl_Position = _31.uMVP * float4(out.vWorld, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.tese b/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.tese new file mode 100644 index 0000000000..e91063f2d4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/tese/water_tess.tese @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; + float4 uScale; + float2 uInvScale; + float3 uCamPos; + float2 uPatchSize; + float2 uInvHeightmapSize; +}; + +struct main0_out +{ + float3 vWorld [[user(locn0)]]; + float4 vGradNormalTex [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float2 vOutPatchPosBase [[attribute(0)]]; + float4 vPatchLods [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant UBO& _31 [[buffer(0)]], texture2d uHeightmapDisplacement [[texture(0)]], sampler uHeightmapDisplacementSmplr [[sampler(0)]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + float2 _202 = fma(gl_TessCoord.xy, _31.uPatchSize, patchIn.vOutPatchPosBase); + float2 _216 = mix(patchIn.vPatchLods.yx, patchIn.vPatchLods.zw, float2(gl_TessCoord.x)); + float _223 = mix(_216.x, _216.y, gl_TessCoord.y); + float _225 = floor(_223); + float2 _141 = _31.uInvHeightmapSize * exp2(_225); + out.vGradNormalTex = float4(fma(_202, _31.uInvHeightmapSize, _31.uInvHeightmapSize * 0.5), (_202 * _31.uInvHeightmapSize) * _31.uScale.zw); + float3 _256 = mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, fma(_202, _31.uInvHeightmapSize, _141 * 0.5), level(_225)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, fma(_202, _31.uInvHeightmapSize, _141 * 1.0), level(_225 + 1.0)).xyz, float3(_223 - _225)); + float2 _171 = fma(_202, _31.uScale.xy, _256.yz); + out.vWorld = float3(_171.x, _256.x, _171.y); + out.gl_Position = _31.uMVP * float4(out.vWorld, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.for-tess.vert new file mode 100644 index 0000000000..24958eb50d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.for-tess.vert @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 m_location_0; + float4 m_location_1; + float4 m_location_2; + float4 gl_Position; +}; + +struct main0_in +{ + float4 m_location_0 [[attribute(0)]]; + float4 m_location_1 [[attribute(1)]]; + float4 m_location_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + float D = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + float InD = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + InA[0] = in.m_location_1.x; + InA[1] = in.m_location_2.x; + InB[0] = in.m_location_1.zw; + InB[1] = in.m_location_2.zw; + InC[0] = in.m_location_0.y; + InC[1] = in.m_location_1.y; + InC[2] = in.m_location_2.y; + InD = in.m_location_0.w; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = in.Pos; + A = InA; + B = InB; + C = InC; + D = InD; + out.m_location_1.x = A[0]; + out.m_location_2.x = A[1]; + out.m_location_1.zw = B[0]; + out.m_location_2.zw = B[1]; + out.m_location_0.y = C[0]; + out.m_location_1.y = C[1]; + out.m_location_2.y = C[2]; + out.m_location_0.w = D; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.vert new file mode 100644 index 0000000000..352c9d2ef0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/array-component-io.vert @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float C_0 [[user(locn0_1)]]; + float D [[user(locn0_3)]]; + float A_0 [[user(locn1)]]; + float C_1 [[user(locn1_1)]]; + float2 B_0 [[user(locn1_2)]]; + float A_1 [[user(locn2)]]; + float C_2 [[user(locn2_1)]]; + float2 B_1 [[user(locn2_2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_location_0 [[attribute(0)]]; + float4 m_location_1 [[attribute(1)]]; + float4 m_location_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + float InD = {}; + InA[0] = in.m_location_1.x; + InA[1] = in.m_location_2.x; + InB[0] = in.m_location_1.zw; + InB[1] = in.m_location_2.zw; + InC[0] = in.m_location_0.y; + InC[1] = in.m_location_1.y; + InC[2] = in.m_location_2.y; + InD = in.m_location_0.w; + out.gl_Position = in.Pos; + A = InA; + B = InB; + C = InC; + out.D = InD; + out.A_0 = A[0]; + out.A_1 = A[1]; + out.B_0 = B[0]; + out.B_1 = B[1]; + out.C_0 = C[0]; + out.C_1 = C[1]; + out.C_2 = C[2]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.capture.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.capture.vert new file mode 100644 index 0000000000..a4177d3c30 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.capture.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex void main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]]) +{ + device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvIndirectParams[0] + gl_VertexIndex - gl_BaseVertex]; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.for-tess.vert new file mode 100644 index 0000000000..c99a95ac89 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.for-tess.vert @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal; + float4 gl_Position; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/basic.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert new file mode 100644 index 0000000000..3844298695 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/buffer_device_address.msl2.vert @@ -0,0 +1,62 @@ +#include +#include + +using namespace metal; + +struct Position; +struct PositionReferences; + +struct Position +{ + float2 positions[1]; +}; + +struct Registers +{ + float4x4 view_projection; + device PositionReferences* references; +}; + +struct PositionReferences +{ + device Position* buffers[1]; +}; + +struct main0_out +{ + float4 out_color [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant Registers& registers [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + int slice = int(gl_InstanceIndex); + const device Position* __restrict positions = registers.references->buffers[int(gl_InstanceIndex)]; + float2 _45 = registers.references->buffers[int(gl_InstanceIndex)]->positions[int(gl_VertexIndex)] * 2.5; + float2 pos = _45; + float2 _60 = _45 + ((float2(float(int(gl_InstanceIndex) % 8), float(int(gl_InstanceIndex) / 8)) - float2(3.5)) * 3.0); + pos = _60; + out.gl_Position = registers.view_projection * float4(_60, 0.0, 1.0); + int _82 = int(gl_VertexIndex) % 16; + int index_x = _82; + int _85 = int(gl_VertexIndex) / 16; + int index_y = _85; + float _92 = sin(float(_82)); + float _94 = fma(0.300000011920928955078125, _92, 0.5); + float r = _94; + float _98 = sin(float(_85)); + float _100 = fma(0.300000011920928955078125, _98, 0.5); + float g = _100; + int _105 = (_82 ^ _85) & 1; + int checkerboard = _105; + float _107 = float(_105); + float _111 = fma(_107, 0.800000011920928955078125, 0.20000000298023223876953125); + float _113 = _94 * _111; + r = _113; + float _119 = _100 * _111; + g = _119; + out.out_color = float4(_113, _119, 0.1500000059604644775390625, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.no-user-varying.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.no-user-varying.vert new file mode 100644 index 0000000000..c78105e0ce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.no-user-varying.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.Position; + out.gl_ClipDistance[0] = in.Position.x; + out.gl_ClipDistance[1] = in.Position.y; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.vert new file mode 100644 index 0000000000..af58f35ff5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/clip-distance-block.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.Position; + out.gl_ClipDistance[0] = in.Position.x; + out.gl_ClipDistance[1] = in.Position.y; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/copy.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/copy.flatten.vert new file mode 100644 index 0000000000..32fde3a48b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/copy.flatten.vert @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light lights[4]; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vColor = float4(0.0); + for (int _96 = 0; _96 < 4; ) + { + float3 _68 = in.aVertex.xyz - float3(_21.lights[_96].Position); + out.vColor += ((_21.lights[_96].Color * fast::clamp(1.0 - (length(_68) / _21.lights[_96].Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(_68))); + _96++; + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/dynamic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/dynamic.flatten.vert new file mode 100644 index 0000000000..26264ddf95 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/dynamic.flatten.vert @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light lights[4]; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vColor = float4(0.0); + for (int _82 = 0; _82 < 4; ) + { + float3 _54 = in.aVertex.xyz - float3(_21.lights[_82].Position); + out.vColor += ((_21.lights[_82].Color * fast::clamp(1.0 - (length(_54) / _21.lights[_82].Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(_54))); + _82++; + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert new file mode 100644 index 0000000000..0fddcdf4d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert @@ -0,0 +1,137 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +[[clang::optnone]] T spvFMul(T l, T r) +{ + return fma(l, r, T(0)); +} + +template +[[clang::optnone]] vec spvFMulVectorMatrix(vec v, matrix m) +{ + vec res = vec(0); + for (uint i = Rows; i > 0; --i) + { + vec tmp(0); + for (uint j = 0; j < Cols; ++j) + { + tmp[j] = m[j][i - 1]; + } + res = fma(tmp, vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] vec spvFMulMatrixVector(matrix m, vec v) +{ + vec res = vec(0); + for (uint i = Cols; i > 0; --i) + { + res = fma(m[i - 1], vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] matrix spvFMulMatrixMatrix(matrix l, matrix r) +{ + matrix res; + for (uint i = 0; i < RCols; i++) + { + vec tmp(0); + for (uint j = 0; j < LCols; j++) + { + tmp = fma(vec(r[i][j]), l[j], tmp); + } + res[i] = tmp; + } + return res; +} + +struct Matrices +{ + float4x4 vpMatrix; + float4x4 wMatrix; + float4x3 wMatrix4x3; + float3x4 wMatrix3x4; +}; + +struct main0_out +{ + float3 OutNormal [[user(locn0)]]; + float4 OutWorldPos_0 [[user(locn1)]]; + float4 OutWorldPos_1 [[user(locn2)]]; + float4 OutWorldPos_2 [[user(locn3)]]; + float4 OutWorldPos_3 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 InPos [[attribute(0)]]; + float3 InNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]]) +{ + main0_out out = {}; + spvUnsafeArray OutWorldPos = {}; + float4 _37 = float4(in.InPos, 1.0); + out.gl_Position = spvFMulMatrixVector(spvFMulMatrixMatrix(_22.vpMatrix, _22.wMatrix), _37); + OutWorldPos[0] = spvFMulMatrixVector(_22.wMatrix, _37); + OutWorldPos[1] = spvFMulVectorMatrix(_37, _22.wMatrix); + OutWorldPos[2] = spvFMulMatrixVector(_22.wMatrix3x4, in.InPos); + OutWorldPos[3] = spvFMulVectorMatrix(in.InPos, _22.wMatrix4x3); + out.OutNormal = spvFMulMatrixVector(_22.wMatrix, float4(in.InNormal, 0.0)).xyz; + out.OutWorldPos_0 = OutWorldPos[0]; + out.OutWorldPos_1 = OutWorldPos[1]; + out.OutWorldPos_2 = OutWorldPos[2]; + out.OutWorldPos_3 = OutWorldPos[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert new file mode 100644 index 0000000000..da468c24c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Matrices +{ + float4x4 vpMatrix; + float4x4 wMatrix; + float4x3 wMatrix4x3; + float3x4 wMatrix3x4; +}; + +struct main0_out +{ + float3 OutNormal [[user(locn0)]]; + float4 OutWorldPos_0 [[user(locn1)]]; + float4 OutWorldPos_1 [[user(locn2)]]; + float4 OutWorldPos_2 [[user(locn3)]]; + float4 OutWorldPos_3 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 InPos [[attribute(0)]]; + float3 InNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]]) +{ + main0_out out = {}; + spvUnsafeArray OutWorldPos = {}; + float4 _37 = float4(in.InPos, 1.0); + out.gl_Position = (_22.vpMatrix * _22.wMatrix) * _37; + OutWorldPos[0] = _22.wMatrix * _37; + OutWorldPos[1] = _37 * _22.wMatrix; + OutWorldPos[2] = _22.wMatrix3x4 * in.InPos; + OutWorldPos[3] = in.InPos * _22.wMatrix4x3; + out.OutNormal = (_22.wMatrix * float4(in.InNormal, 0.0)).xyz; + out.OutWorldPos_0 = OutWorldPos[0]; + out.OutWorldPos_1 = OutWorldPos[1]; + out.OutWorldPos_2 = OutWorldPos[2]; + out.OutWorldPos_3 = OutWorldPos[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/functions.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/functions.vert new file mode 100644 index 0000000000..4300aa1350 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/functions.vert @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL radians() function +template +inline T radians(T d) +{ + return d * T(0.01745329251); +} + +// Implementation of the GLSL degrees() function +template +inline T degrees(T r) +{ + return r * T(57.2957795131); +} + +// Implementation of the GLSL findLSB() function +template +inline T spvFindLSB(T x) +{ + return select(ctz(x), T(-1), x == T(0)); +} + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Returns the determinant of a 2x2 matrix. +static inline __attribute__((always_inline)) +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the determinant of a 3x3 matrix. +static inline __attribute__((always_inline)) +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float4x4 spvInverse4x4(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +struct UBO +{ + float4x4 uMVP; + float3 rotDeg; + float3 rotRad; + int2 bits; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float3 vRotDeg [[user(locn1)]]; + float3 vRotRad [[user(locn2)]]; + int2 vLSB [[user(locn3)]]; + int2 vMSB [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = spvInverse4x4(_18.uMVP) * in.aVertex; + out.vNormal = in.aNormal; + out.vRotDeg = degrees(_18.rotRad); + out.vRotRad = radians(_18.rotDeg); + out.vLSB = spvFindLSB(_18.bits); + out.vMSB = spvFindSMSB(_18.bits); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-1.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-1.vert new file mode 100644 index 0000000000..5cea4ee2c2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-1.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 V [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.V = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-2.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-2.vert new file mode 100644 index 0000000000..9e024c2095 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/implicit-position-2.vert @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +vertex void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert new file mode 100644 index 0000000000..7a74f49a49 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert @@ -0,0 +1,108 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct UBO +{ + float4x4 projection; + float4x4 model; + float lodBias; +}; + +struct main0_out +{ + float3 outPos [[user(locn0)]]; + float3 outNormal [[user(locn1)]]; + float4 outTransModel_0 [[user(locn2)]]; + float4 outTransModel_1 [[user(locn3)]]; + float4 outTransModel_2 [[user(locn4)]]; + float4 outTransModel_3 [[user(locn5)]]; + float outLodBias [[user(locn6)]]; + float4 color [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 inPos [[attribute(0)]]; + float4 colors_0 [[attribute(1)]]; + float4 colors_1 [[attribute(2)]]; + float4 colors_2 [[attribute(3)]]; + float3 inNormal [[attribute(4)]]; + float4 inViewMat_0 [[attribute(5)]]; + float4 inViewMat_1 [[attribute(6)]]; + float4 inViewMat_2 [[attribute(7)]]; + float4 inViewMat_3 [[attribute(8)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& ubo [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 outTransModel = {}; + spvUnsafeArray colors = {}; + float4x4 inViewMat = {}; + colors[0] = in.colors_0; + colors[1] = in.colors_1; + colors[2] = in.colors_2; + inViewMat[0] = in.inViewMat_0; + inViewMat[1] = in.inViewMat_1; + inViewMat[2] = in.inViewMat_2; + inViewMat[3] = in.inViewMat_3; + float4 _64 = float4(in.inPos, 1.0); + out.gl_Position = (ubo.projection * ubo.model) * _64; + out.outPos = float3((ubo.model * _64).xyz); + out.outNormal = float3x3(float3(ubo.model[0].x, ubo.model[0].y, ubo.model[0].z), float3(ubo.model[1].x, ubo.model[1].y, ubo.model[1].z), float3(ubo.model[2].x, ubo.model[2].y, ubo.model[2].z)) * in.inNormal; + out.outLodBias = ubo.lodBias; + outTransModel = transpose(ubo.model) * inViewMat; + outTransModel[2] = float4(in.inNormal, 1.0); + outTransModel[1].y = ubo.lodBias; + out.color = colors[2]; + out.outTransModel_0 = outTransModel[0]; + out.outTransModel_1 = outTransModel[1]; + out.outTransModel_2 = outTransModel[2]; + out.outTransModel_3 = outTransModel[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag new file mode 100644 index 0000000000..ac0d424d88 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag @@ -0,0 +1,99 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Vert +{ + float3x3 wMatrix; + float4 wTmp; + spvUnsafeArray arr; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vMatrix_0 [[user(locn0)]]; + float3 vMatrix_1 [[user(locn1)]]; + float3 vMatrix_2 [[user(locn2)]]; + float3 m_17_wMatrix_0 [[user(locn4)]]; + float3 m_17_wMatrix_1 [[user(locn5)]]; + float3 m_17_wMatrix_2 [[user(locn6)]]; + float4 m_17_wTmp [[user(locn7)]]; + float m_17_arr_0 [[user(locn8)]]; + float m_17_arr_1 [[user(locn9)]]; + float m_17_arr_2 [[user(locn10)]]; + float m_17_arr_3 [[user(locn11)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Vert _17 = {}; + float3x3 vMatrix = {}; + _17.wMatrix[0] = in.m_17_wMatrix_0; + _17.wMatrix[1] = in.m_17_wMatrix_1; + _17.wMatrix[2] = in.m_17_wMatrix_2; + _17.wTmp = in.m_17_wTmp; + _17.arr[0] = in.m_17_arr_0; + _17.arr[1] = in.m_17_arr_1; + _17.arr[2] = in.m_17_arr_2; + _17.arr[3] = in.m_17_arr_3; + vMatrix[0] = in.vMatrix_0; + vMatrix[1] = in.vMatrix_1; + vMatrix[2] = in.vMatrix_2; + out.FragColor = (_17.wMatrix[0].xxyy + _17.wTmp) + vMatrix[1].yyzz; + for (int _56 = 0; _56 < 4; ) + { + out.FragColor += float4(_17.arr[_56]); + _56++; + continue; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert new file mode 100644 index 0000000000..a05c933158 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Vert +{ + spvUnsafeArray arr; + float3x3 wMatrix; + float4 wTmp; +}; + +struct main0_out +{ + float3 vMatrix_0 [[user(locn0)]]; + float3 vMatrix_1 [[user(locn1)]]; + float3 vMatrix_2 [[user(locn2)]]; + float m_20_arr_0 [[user(locn4)]]; + float m_20_arr_1 [[user(locn5)]]; + float m_20_arr_2 [[user(locn6)]]; + float3 m_20_wMatrix_0 [[user(locn7)]]; + float3 m_20_wMatrix_1 [[user(locn8)]]; + float3 m_20_wMatrix_2 [[user(locn9)]]; + float4 m_20_wTmp [[user(locn10)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 Matrix_0 [[attribute(0)]]; + float3 Matrix_1 [[attribute(1)]]; + float3 Matrix_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float3x3 vMatrix = {}; + Vert _20 = {}; + float3x3 Matrix = {}; + Matrix[0] = in.Matrix_0; + Matrix[1] = in.Matrix_1; + Matrix[2] = in.Matrix_2; + vMatrix = Matrix; + _20.wMatrix = Matrix; + _20.arr[0] = 1.0; + _20.arr[1] = 2.0; + _20.arr[2] = 3.0; + _20.wTmp = in.Pos; + out.gl_Position = in.Pos; + out.vMatrix_0 = vMatrix[0]; + out.vMatrix_1 = vMatrix[1]; + out.vMatrix_2 = vMatrix[2]; + out.m_20_arr_0 = _20.arr[0]; + out.m_20_arr_1 = _20.arr[1]; + out.m_20_arr_2 = _20.arr[2]; + out.m_20_wMatrix_0 = _20.wMatrix[0]; + out.m_20_wMatrix_1 = _20.wMatrix[1]; + out.m_20_wMatrix_2 = _20.wMatrix[2]; + out.m_20_wTmp = _20.wTmp; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-single-element-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-single-element-array.vert new file mode 100644 index 0000000000..6858db730e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-single-element-array.vert @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct TDPickVertex +{ + float4 c; + spvUnsafeArray uv; +}; + +struct main0_out +{ + float4 oTDVert_c [[user(locn0)]]; + float3 oTDVert_uv_0 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 P [[attribute(0)]]; + float3 uv_0 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + TDPickVertex oTDVert = {}; + spvUnsafeArray uv = {}; + uv[0] = in.uv_0; + out.gl_Position = float4(in.P, 1.0); + oTDVert.uv[0] = uv[0]; + oTDVert.c = float4(1.0); + out.oTDVert_c = oTDVert.c; + out.oTDVert_uv_0 = oTDVert.uv[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers-block.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers-block.vert new file mode 100644 index 0000000000..1ae24c7e5b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers-block.vert @@ -0,0 +1,55 @@ +#include +#include + +using namespace metal; + +struct Output +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float2 outp_v0 [[user(locn0)]]; + float2 outp_v1 [[user(locn1)]]; + float3 outp_v2 [[user(locn2)]]; + float4 outp_v3 [[user(locn3)]]; + float outp_v4 [[user(locn4)]]; + float outp_v5 [[user(locn5)]]; + float outp_v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Output outp = {}; + outp.v0 = in.Position.xy; + outp.v1 = in.Position.zw; + outp.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + outp.v3 = in.Position.xxyy; + outp.v4 = in.Position.w; + outp.v5 = in.Position.y; + outp.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + out.outp_v0 = outp.v0; + out.outp_v1 = outp.v1; + out.outp_v2 = outp.v2; + out.outp_v3 = outp.v3; + out.outp_v4 = outp.v4; + out.outp_v5 = outp.v5; + out.outp_v6 = outp.v6; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 0000000000..ba2c4fbd23 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1)]]; + float3 v2 [[user(locn2)]]; + float4 v3 [[user(locn3)]]; + float v4 [[user(locn4)]]; + float v5 [[user(locn5)]]; + float v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.v0 = in.Position.xy; + out.v1 = in.Position.zw; + out.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + out.v3 = in.Position.xxyy; + out.v4 = in.Position.w; + out.v5 = in.Position.y; + out.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/invariant.msl21.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/invariant.msl21.vert new file mode 100644 index 0000000000..b7f703b2e6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/invariant.msl21.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position, invariant]]; +}; + +struct main0_in +{ + float4 vInput0 [[attribute(0)]]; + float4 vInput1 [[attribute(1)]]; + float4 vInput2 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _21 = fma(in.vInput1, in.vInput2, in.vInput0); + out.gl_Position = _21; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.capture.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.capture.vert new file mode 100644 index 0000000000..85276e128d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.capture.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex void main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]]) +{ + device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvIndirectParams[0] + gl_VertexIndex - gl_BaseVertex]; + out.gl_Position = _18.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.for-tess.vert new file mode 100644 index 0000000000..e3d2d1fac0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/leaf-function.for-tess.vert @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal; + float4 gl_Position; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = _18.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-contraction.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-contraction.vert new file mode 100644 index 0000000000..f4df5506ae --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-contraction.vert @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvFMul(T l, T r) +{ + return fma(l, r, T(0)); +} + +template +[[clang::optnone]] vec spvFMulVectorMatrix(vec v, matrix m) +{ + vec res = vec(0); + for (uint i = Rows; i > 0; --i) + { + vec tmp(0); + for (uint j = 0; j < Cols; ++j) + { + tmp[j] = m[j][i - 1]; + } + res = fma(tmp, vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] vec spvFMulMatrixVector(matrix m, vec v) +{ + vec res = vec(0); + for (uint i = Cols; i > 0; --i) + { + res = fma(m[i - 1], vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] matrix spvFMulMatrixMatrix(matrix l, matrix r) +{ + matrix res; + for (uint i = 0; i < RCols; i++) + { + vec tmp(0); + for (uint j = 0; j < LCols; j++) + { + tmp = fma(vec(r[i][j]), l[j], tmp); + } + res[i] = tmp; + } + return res; +} + +template +[[clang::optnone]] T spvFAdd(T l, T r) +{ + return fma(T(1), l, r); +} + +template +[[clang::optnone]] T spvFSub(T l, T r) +{ + return fma(T(-1), r, l); +} + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vA [[attribute(0)]]; + float4 vB [[attribute(1)]]; + float4 vC [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _15 = spvFMul(in.vA, in.vB); + out.gl_Position = spvFAdd(spvFAdd(spvFAdd(_15, spvFAdd(in.vA, in.vB)), spvFSub(in.vA, in.vB)), spvFAdd(_15, in.vC)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-disable-vertex-out.frag-output.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-disable-vertex-out.frag-output.vert new file mode 100644 index 0000000000..14cc94937c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no-disable-vertex-out.frag-output.vert @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct buf +{ + float4x4 MVP; + float4 position[36]; + float4 attr[36]; +}; + +struct main0_out +{ + float4 texcoord [[user(locn0)]]; + float3 frag_pos [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant buf& ubuf [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.texcoord = ubuf.attr[int(gl_VertexIndex)]; + out.gl_Position = ubuf.MVP * ubuf.position[int(gl_VertexIndex)]; + out.frag_pos = out.gl_Position.xyz; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.for-tess.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.for-tess.vert new file mode 100644 index 0000000000..984e83260a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.for-tess.vert @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_10_12 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_in +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_19 [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_10_12& _RESERVED_IDENTIFIER_FIXUP_12 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], uint3 spvDispatchBase [[grid_origin]]) +{ + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + uint gl_VertexIndex = gl_GlobalInvocationID.x + spvDispatchBase.x; + _RESERVED_IDENTIFIER_FIXUP_12._RESERVED_IDENTIFIER_FIXUP_m0[int(gl_VertexIndex)] = in._RESERVED_IDENTIFIER_FIXUP_19; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..e804da6753 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_10_12 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_in +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_19 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_10_12& _RESERVED_IDENTIFIER_FIXUP_12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + _RESERVED_IDENTIFIER_FIXUP_12._RESERVED_IDENTIFIER_FIXUP_m0[int(gl_VertexIndex)] = in._RESERVED_IDENTIFIER_FIXUP_19; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..296293aaea --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_33_35 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct _RESERVED_IDENTIFIER_FIXUP_38_40 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_33_35& _RESERVED_IDENTIFIER_FIXUP_35 [[buffer(0)]], constant _RESERVED_IDENTIFIER_FIXUP_38_40& _RESERVED_IDENTIFIER_FIXUP_40 [[buffer(1)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + for (int _52 = 0; _52 < 1024; ) + { + _RESERVED_IDENTIFIER_FIXUP_35._RESERVED_IDENTIFIER_FIXUP_m0[_52] = _RESERVED_IDENTIFIER_FIXUP_40._RESERVED_IDENTIFIER_FIXUP_m0[_52]; + _52++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..92fbf555d3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_19_21 +{ + uint _RESERVED_IDENTIFIER_FIXUP_m0; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], volatile device _RESERVED_IDENTIFIER_FIXUP_19_21& _RESERVED_IDENTIFIER_FIXUP_21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + uint _29 = atomic_fetch_add_explicit((volatile device atomic_uint*)&_RESERVED_IDENTIFIER_FIXUP_21._RESERVED_IDENTIFIER_FIXUP_m0, 1u, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..9d87efe142 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], texture1d _RESERVED_IDENTIFIER_FIXUP_32 [[texture(0)]], texture1d _RESERVED_IDENTIFIER_FIXUP_35 [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + for (int _45 = 0; _45 < 128; ) + { + _RESERVED_IDENTIFIER_FIXUP_32.write(_RESERVED_IDENTIFIER_FIXUP_35.read(uint(_45)), uint(_45)); + _45++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-nested-struct-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-nested-struct-array.vert new file mode 100644 index 0000000000..cabcfcb521 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-nested-struct-array.vert @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct t21 +{ + float4 m0; + float4 m1; +}; + +struct t24 +{ + spvUnsafeArray m0; +}; + +struct main0_out +{ + float4 v26_m0_0_m0 [[user(locn0)]]; + float4 v26_m0_0_m1 [[user(locn1)]]; + float4 v26_m0_1_m0 [[user(locn2)]]; + float4 v26_m0_1_m1 [[user(locn3)]]; + float4 v26_m0_2_m0 [[user(locn4)]]; + float4 v26_m0_2_m1 [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v17 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + t24 v26 = {}; + out.gl_Position = in.v17; + v26.m0[1].m1 = float4(-4.0, -9.0, 3.0, 7.0); + out.v26_m0_0_m0 = v26.m0[0].m0; + out.v26_m0_0_m1 = v26.m0[0].m1; + out.v26_m0_1_m0 = v26.m0[1].m0; + out.v26_m0_1_m1 = v26.m0[1].m1; + out.v26_m0_2_m0 = v26.m0[2].m0; + out.v26_m0_2_m1 = v26.m0[2].m1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-struct-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-struct-array.vert new file mode 100644 index 0000000000..61c7c18b54 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out-block-with-struct-array.vert @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct t21 +{ + float m0; + float4 m1; +}; + +struct main0_out +{ + float v25_0_m0 [[user(locn0)]]; + float4 v25_0_m1 [[user(locn1)]]; + float v25_1_m0 [[user(locn2)]]; + float4 v25_1_m1 [[user(locn3)]]; + float v25_2_m0 [[user(locn4)]]; + float4 v25_2_m1 [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v17 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray v25 = {}; + out.gl_Position = in.v17; + v25[2].m1 = float4(-4.0, -9.0, 3.0, 7.0); + out.v25_0_m0 = v25[0].m0; + out.v25_0_m1 = v25[0].m1; + out.v25_1_m0 = v25[1].m0; + out.v25_1_m1 = v25[1].m1; + out.v25_2_m0 = v25[2].m0; + out.v25_2_m1 = v25[2].m1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/out_block.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out_block.vert new file mode 100644 index 0000000000..909a059bd2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/out_block.vert @@ -0,0 +1,41 @@ +#include +#include + +using namespace metal; + +struct Transform +{ + float4x4 transform; +}; + +struct VertexOut +{ + float4 color; + float4 color2; +}; + +struct main0_out +{ + float4 outputs_color [[user(locn2)]]; + float4 outputs_color2 [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 position [[attribute(0)]]; + float4 color [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Transform& block [[buffer(0)]]) +{ + main0_out out = {}; + VertexOut outputs = {}; + out.gl_Position = block.transform * float4(in.position, 1.0); + outputs.color = in.color; + outputs.color2 = in.color + float4(1.0); + out.outputs_color = outputs.color; + out.outputs_color2 = outputs.color2; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool-to-uint.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool-to-uint.vert new file mode 100644 index 0000000000..6cc5520484 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool-to-uint.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _24 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _24.umatrix * float4(_24.uquad[int(gl_VertexIndex)].x, _24.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_24.flags.flags[0] != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool2-to-packed_uint2.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool2-to-packed_uint2.vert new file mode 100644 index 0000000000..4c46aaeb4e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed-bool2-to-packed_uint2.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint2 flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _25 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _25.umatrix * float4(_25.uquad[int(gl_VertexIndex)].x, _25.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_25.flags.flags[0].x != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed_matrix.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed_matrix.vert new file mode 100644 index 0000000000..2e6f9680db --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/packed_matrix.vert @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_1365_18812 +{ + float3x4 _RESERVED_IDENTIFIER_FIXUP_m0; + float3x4 _RESERVED_IDENTIFIER_FIXUP_m1; +}; + +struct _RESERVED_IDENTIFIER_FIXUP_1126_22044 +{ + float4x4 _RESERVED_IDENTIFIER_FIXUP_m0; + float4x4 _RESERVED_IDENTIFIER_FIXUP_m1; + float _RESERVED_IDENTIFIER_FIXUP_m9; + char _m3_pad[12]; + packed_float3 _RESERVED_IDENTIFIER_FIXUP_m10; + float _RESERVED_IDENTIFIER_FIXUP_m11; + packed_float3 _RESERVED_IDENTIFIER_FIXUP_m12; + float _RESERVED_IDENTIFIER_FIXUP_m17; + float _RESERVED_IDENTIFIER_FIXUP_m18; + float _RESERVED_IDENTIFIER_FIXUP_m19; + float2 _RESERVED_IDENTIFIER_FIXUP_m20; +}; + +struct main0_out +{ + float3 _RESERVED_IDENTIFIER_FIXUP_3976 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_5275 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant _RESERVED_IDENTIFIER_FIXUP_1365_18812& _RESERVED_IDENTIFIER_FIXUP_18812 [[buffer(0)]], constant _RESERVED_IDENTIFIER_FIXUP_1126_22044& _RESERVED_IDENTIFIER_FIXUP_22044 [[buffer(1)]]) +{ + main0_out out = {}; + float4 _70 = _RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m0 * float4(float3(_RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m10) + (in._RESERVED_IDENTIFIER_FIXUP_5275.xyz * (_RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m17 + _RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m18)), 1.0); + out._RESERVED_IDENTIFIER_FIXUP_3976 = fast::normalize(float4(in._RESERVED_IDENTIFIER_FIXUP_5275.xyz, 0.0) * _RESERVED_IDENTIFIER_FIXUP_18812._RESERVED_IDENTIFIER_FIXUP_m1); + _70.y = -_70.y; + out.gl_Position = _70; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/pointsize.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/pointsize.vert new file mode 100644 index 0000000000..8e5782bde4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/pointsize.vert @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct params +{ + float4x4 mvp; + float psize; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +struct main0_in +{ + float4 position [[attribute(0)]]; + float4 color0 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _19.mvp * in.position; + out.gl_PointSize = _19.psize; + out.color = in.color0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..ec3e7b7248 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct Block +{ + float3x4 var[3][4]; +}; + +struct main0_out +{ + float v_vtxResult [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Block& _104 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.a_position; + out.v_vtxResult = ((float(abs(_104.var[0][0][0][0] - 2.0) < 0.0500000007450580596923828125) * float(abs(_104.var[0][0][1][0] - 6.0) < 0.0500000007450580596923828125)) * float(abs(_104.var[0][0][2][0] - (-6.0)) < 0.0500000007450580596923828125)) * ((float(abs(_104.var[0][0][0][1]) < 0.0500000007450580596923828125) * float(abs(_104.var[0][0][1][1] - 5.0) < 0.0500000007450580596923828125)) * float(abs(_104.var[0][0][2][1] - 5.0) < 0.0500000007450580596923828125)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays-leaf.ios.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays-leaf.ios.vert new file mode 100644 index 0000000000..91be3a0477 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays-leaf.ios.vert @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct storage_block +{ + uint4 baz; + int2 quux; +}; + +struct constant_block +{ + float4 foo; + int bar; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 3 +#endif +constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; + +vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array, 3> images [[texture(0)]]) +{ + device storage_block* storage[] = + { + storage_0, + storage_1, + }; + + constant constant_block* constants[] = + { + constants_0, + constants_1, + constants_2, + constants_3, + }; + + storage[0]->baz = uint4(constants[3]->foo); + storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays.ios.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays.ios.vert new file mode 100644 index 0000000000..91be3a0477 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/resource-arrays.ios.vert @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct storage_block +{ + uint4 baz; + int2 quux; +}; + +struct constant_block +{ + float4 foo; + int bar; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 3 +#endif +constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; + +vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array, 3> images [[texture(0)]]) +{ + device storage_block* storage[] = + { + storage_0, + storage_1, + }; + + constant constant_block* constants[] = + { + constants_0, + constants_1, + constants_2, + constants_3, + }; + + storage[0]->baz = uint4(constants[3]->foo); + storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.force-native-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.force-native-array.vert new file mode 100644 index 0000000000..ce13349a0f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.force-native-array.vert @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInput1 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = float4(10.0) + in.vInput1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.vert new file mode 100644 index 0000000000..ce13349a0f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/return-array.vert @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInput1 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = float4(10.0) + in.vInput1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/set_builtin_in_func.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/set_builtin_in_func.vert new file mode 100644 index 0000000000..51a858af1e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/set_builtin_in_func.vert @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_PointSize = 1.0; + out.gl_Position = float4(out.gl_PointSize); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert new file mode 100644 index 0000000000..f5f647d458 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert @@ -0,0 +1,60 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL sign() function for integer types +template::value>::type> +inline T sign(T x) +{ + return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); +} + +struct UBO +{ + float4x4 uMVP; + float4 uFloatVec4; + float3 uFloatVec3; + float2 uFloatVec2; + float uFloat; + int4 uIntVec4; + int3 uIntVec3; + int2 uIntVec2; + int uInt; +}; + +struct main0_out +{ + float4 vFloatVec4 [[user(locn0)]]; + float3 vFloatVec3 [[user(locn1)]]; + float2 vFloatVec2 [[user(locn2)]]; + float vFloat [[user(locn3)]]; + int4 vIntVec4 [[user(locn4)]]; + int3 vIntVec3 [[user(locn5)]]; + int2 vIntVec2 [[user(locn6)]]; + int vInt [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vFloatVec4 = sign(_21.uFloatVec4); + out.vFloatVec3 = sign(_21.uFloatVec3); + out.vFloatVec2 = sign(_21.uFloatVec2); + out.vFloat = sign(_21.uFloat); + out.vIntVec4 = sign(_21.uIntVec4); + out.vIntVec3 = sign(_21.uIntVec3); + out.vIntVec2 = sign(_21.uIntVec2); + out.vInt = sign(_21.uInt); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/signedness-mismatch.shader-inputs.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/signedness-mismatch.shader-inputs.vert new file mode 100644 index 0000000000..56e00199cb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/signedness-mismatch.shader-inputs.vert @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + ushort2 a [[attribute(0)]]; + uint3 b [[attribute(1)]]; + ushort c_0 [[attribute(2)]]; + ushort c_1 [[attribute(3)]]; + uint4 d_0 [[attribute(4)]]; + uint4 d_1 [[attribute(5)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray c = {}; + spvUnsafeArray d = {}; + c[0] = in.c_0; + c[1] = in.c_1; + d[0] = in.d_0; + d[1] = in.d_1; + out.gl_Position = float4(float(int(short(in.a.x))), float(int(in.b.x)), float(uint(c[1])), float(d[0].w)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert new file mode 100644 index 0000000000..33c077c57a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(texture_buffer uSamp [[texture(0)]], texture_buffer uSampo [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = uSamp.read(uint(10)) + uSampo.read(uint(100)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert new file mode 100644 index 0000000000..9d8b5c49f0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(texture2d uSamp [[texture(0)]], texture2d uSampo [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = uSamp.read(spvTexelBufferCoord(10)) + uSampo.read(spvTexelBufferCoord(100)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.alignment.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.alignment.vert new file mode 100644 index 0000000000..c48111ed67 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.alignment.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 mvp; + float2 targSize; + char _m2_pad[8]; + packed_float3 color; + float opacity; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float3 vColor [[user(locn1)]]; + float2 vSize [[user(locn2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _18.mvp * in.aVertex; + out.vNormal = in.aNormal; + out.vColor = float3(_18.color) * _18.opacity; + out.vSize = _18.targSize * _18.opacity; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.vert new file mode 100644 index 0000000000..86ba1e9687 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/ubo.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 mvp; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.mvp * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert new file mode 100644 index 0000000000..c69775e326 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct data_u_t +{ + int4 m1[3]; + uint m3; + uint3 m2; + int4 m0[8]; +}; + +struct main0_out +{ + float foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vtx_posn [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant data_u_t& data_u [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.vtx_posn; + out.foo = float((uint3(data_u.m1[1].xyz) + data_u.m2).y * uint(data_u.m0[4].x)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert new file mode 100644 index 0000000000..c305623256 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert @@ -0,0 +1,52 @@ +#include +#include + +using namespace metal; + +typedef packed_float4 packed_rm_float4x4[4]; + +struct s0 +{ + float3x4 m0; + packed_int4 m1; + packed_rm_float4x4 m2; + packed_uint2 m3; +}; + +struct s1 +{ + float4x4 m0; + int m1; + char _m2_pad[12]; + packed_uint3 m2; + s0 m3; +}; + +struct data_u_t +{ + float4 m1[5]; + float2x4 m3; + int4 m4; + s1 m2; + float3x4 m0; +}; + +struct main0_out +{ + float foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vtx_posn [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant data_u_t& data_u [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.vtx_posn; + out.foo = (((data_u.m1[3].y + float(data_u.m4.z)) * data_u.m0[2][1]) * data_u.m2.m0[3][2]) * data_u.m2.m3.m2[3][3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vert/unused-position.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vert/unused-position.vert new file mode 100644 index 0000000000..7dc4672139 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vert/unused-position.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_PointSize = 1.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag new file mode 100644 index 0000000000..f0935f6dcf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex_0 [[user(locn1)]]; + float2 vTex_1 [[user(locn2)]]; + float2 vTex_2 [[user(locn3)]]; + float2 vTex_3 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + spvUnsafeArray vTex = {}; + vTex[0] = in.vTex_0; + vTex[1] = in.vTex_1; + vTex[2] = in.vTex_2; + vTex[3] = in.vTex_3; + const uint gl_ViewIndex = spvViewMask[0]; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, vTex[int(gl_ViewIndex)]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag new file mode 100644 index 0000000000..67895e3e92 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex_0 [[user(locn1)]]; + float2 vTex_1 [[user(locn2)]]; + float2 vTex_2 [[user(locn3)]]; + float2 vTex_3 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + spvUnsafeArray vTex = {}; + vTex[0] = in.vTex_0; + vTex[1] = in.vTex_1; + vTex[2] = in.vTex_2; + vTex[3] = in.vTex_3; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, vTex[int(gl_ViewIndex)]); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..274cea2de1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + bool _15 = gl_HelperInvocation; + gl_HelperInvocation = true, discard_fragment(); + if (!_15) + { + out.FragColor = float4(1.0, 0.0, 0.0, 1.0); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..e2b2a85712 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + gl_HelperInvocation = true, discard_fragment(); + bool _19 = gl_HelperInvocation; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag new file mode 100644 index 0000000000..82eb282f17 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + gl_HelperInvocation = true, discard_fragment(); + bool _9 = gl_HelperInvocation; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..7b8c502b32 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct PushConstants +{ + float4 value0; + float4 value1; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant PushConstants& push [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = (in.vColor + push.value0) + push.value1; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag new file mode 100644 index 0000000000..6baf93f107 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1.0 +#endif +constant float a = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2.0 +#endif +constant float b = SPIRV_CROSS_CONSTANT_ID_2; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(a + b); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.vk.frag b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..aee290f5a2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/frag/spec-constant.vk.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(a + b); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert new file mode 100644 index 0000000000..e36576b86f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + const int gl_DeviceIndex = 0; + const uint gl_ViewIndex = 0; + out.gl_Position = float4(float(gl_DeviceIndex), float(int(gl_ViewIndex)), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert new file mode 100644 index 0000000000..cc4bcc4202 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + const int gl_DeviceIndex = 0; + out.gl_Position = float4(float(gl_DeviceIndex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert new file mode 100644 index 0000000000..8959afe821 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], constant MVPs& _19 [[buffer(0)]]) +{ + main0_out out = {}; + const uint gl_ViewIndex = spvViewMask[0]; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert new file mode 100644 index 0000000000..20eff0a124 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], constant MVPs& _19 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + uint gl_ViewIndex = spvViewMask[0] + (gl_InstanceIndex - gl_BaseInstance) % spvViewMask[1]; + gl_InstanceIndex = (gl_InstanceIndex - gl_BaseInstance) / spvViewMask[1] + gl_BaseInstance; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + out.gl_Layer = gl_ViewIndex - spvViewMask[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert new file mode 100644 index 0000000000..5152b6222e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant MVPs& _19 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + const uint gl_ViewIndex = 0; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..c9ef91b247 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct block +{ + short2 a; + ushort2 b; + char2 c; + uchar2 d; + half2 e; +}; + +struct storage +{ + short3 f; + ushort3 g; + char3 h; + uchar3 i; + half3 j; +}; + +struct main0_out +{ + short4 p [[user(locn0)]]; + ushort4 q [[user(locn1)]]; + half4 r [[user(locn2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + short foo [[attribute(0)]]; + ushort bar [[attribute(1)]]; + half baz [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant block& _26 [[buffer(0)]], const device storage& _53 [[buffer(1)]]) +{ + main0_out out = {}; + out.p = short4((int4(int(in.foo)) + int4(int2(_26.a), int2(_26.c))) - int4(int3(_53.f) / int3(_53.h), 1)); + out.q = ushort4((uint4(uint(in.bar)) + uint4(uint2(_26.b), uint2(_26.d))) - uint4(uint3(_53.g) / uint3(_53.i), 1u)); + out.r = half4((float4(float(in.baz)) + float4(float2(_26.e), 0.0, 1.0)) - float4(float3(_53.j), 1.0)); + out.gl_Position = float4(0.0, 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..86a0cea5bb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(int(gl_VertexIndex) + int(gl_InstanceIndex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag new file mode 100644 index 0000000000..a7b390a8cf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag @@ -0,0 +1,321 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4x4 ShadowViewProjectionMatrices[6]; + float InvShadowmapResolution; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float2 ProjectionDepthBiasParameters; + float4 PointLightDepthBiasAndProjParameters; +}; + +constant float4 _471 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d SceneTexturesStruct_SceneDepthTexture [[texture(0)]], texture2d SceneTexturesStruct_GBufferATexture [[texture(1)]], texture2d SceneTexturesStruct_GBufferBTexture [[texture(2)]], texture2d SceneTexturesStruct_GBufferDTexture [[texture(3)]], depthcube ShadowDepthCubeTexture [[texture(4)]], texture2d SSProfilesTexture [[texture(5)]], sampler SceneTexturesStruct_SceneDepthTextureSampler [[sampler(0)]], sampler SceneTexturesStruct_GBufferATextureSampler [[sampler(1)]], sampler SceneTexturesStruct_GBufferBTextureSampler [[sampler(2)]], sampler SceneTexturesStruct_GBufferDTextureSampler [[sampler(3)]], sampler ShadowDepthTextureSampler [[sampler(4)]], sampler ShadowDepthCubeTextureSampler [[sampler(5)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float2 _114 = gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw; + float4 _118 = SceneTexturesStruct_SceneDepthTexture.sample(SceneTexturesStruct_SceneDepthTextureSampler, _114, level(0.0)); + float _119 = _118.x; + float _133 = fma(_119, View.View_InvDeviceZToWorldZTransform.x, View.View_InvDeviceZToWorldZTransform.y) + (1.0 / fma(_119, View.View_InvDeviceZToWorldZTransform.z, -View.View_InvDeviceZToWorldZTransform.w)); + float4 _147 = View.View_ScreenToWorld * float4((fma(gl_FragCoord.xy, View.View_BufferSizeAndInvSize.zw, -View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_133), _133, 1.0); + float3 _148 = _147.xyz; + float3 _152 = _Globals.LightPositionAndInvRadius.xyz - _148; + float _158 = length(_152); + bool _160 = (_158 * _Globals.LightPositionAndInvRadius.w) < 1.0; + float _207; + if (_160) + { + float3 _165 = abs(_152); + float _166 = _165.x; + float _167 = _165.y; + float _168 = _165.z; + float _170 = fast::max(_166, fast::max(_167, _168)); + int _189; + if (_170 == _166) + { + _189 = (_166 == _152.x) ? 0 : 1; + } + else + { + int _185; + if (_170 == _167) + { + _185 = (_167 == _152.y) ? 2 : 3; + } + else + { + _185 = (_168 == _152.z) ? 4 : 5; + } + _189 = _185; + } + float4 _196 = _Globals.ShadowViewProjectionMatrices[_189] * float4(_147.xyz, 1.0); + float _198 = _196.w; + _207 = ShadowDepthCubeTexture.sample_compare(ShadowDepthCubeTextureSampler, (_152 / float3(_158)), (_196.z / _198) + ((-_Globals.PointLightDepthBiasAndProjParameters.x) / _198), level(0.0)); + } + else + { + _207 = 1.0; + } + float _213 = fast::clamp(fma(_207 - 0.5, _Globals.ShadowSharpen, 0.5), 0.0, 1.0); + float _218 = sqrt(mix(1.0, _213 * _213, _Globals.ShadowFadeFraction)); + float4 _219; + _219.z = _218; + float4 _220 = float4(float3(1.0).x, float3(1.0).y, _219.z, float3(1.0).z); + float3 _236 = fast::normalize(fma(SceneTexturesStruct_GBufferATexture.sample(SceneTexturesStruct_GBufferATextureSampler, _114, level(0.0)).xyz, float3(2.0), float3(-1.0))); + uint _240 = uint(round(SceneTexturesStruct_GBufferBTexture.sample(SceneTexturesStruct_GBufferBTextureSampler, _114, level(0.0)).w * 255.0)); + bool _248 = (_240 & 15u) == 5u; + float _448; + if (_248) + { + float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint(fma(select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!(((_240 & 4294967280u) & 16u) != 0u))).x, 255.0, 0.5))), 0).xy), 0); + float _263 = _260.y * 0.5; + float3 _266 = fma(-_236, float3(_263), _148); + float _274 = pow(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0); + float _445; + if (_160) + { + float3 _278 = _152 / float3(_158); + float3 _280 = fast::normalize(cross(_278, float3(0.0, 0.0, 1.0))); + float3 _284 = float3(_Globals.InvShadowmapResolution); + float3 _285 = _280 * _284; + float3 _286 = cross(_280, _278) * _284; + float3 _287 = abs(_278); + float _288 = _287.x; + float _289 = _287.y; + float _290 = _287.z; + float _292 = fast::max(_288, fast::max(_289, _290)); + int _311; + if (_292 == _288) + { + _311 = (_288 == _278.x) ? 0 : 1; + } + else + { + int _307; + if (_292 == _289) + { + _307 = (_289 == _278.y) ? 2 : 3; + } + else + { + _307 = (_290 == _278.z) ? 4 : 5; + } + _311 = _307; + } + float4 _318 = _Globals.ShadowViewProjectionMatrices[_311] * float4(_266, 1.0); + float _323 = _260.x * (10.0 / _Globals.LightPositionAndInvRadius.w); + float _457 = -_Globals.PointLightDepthBiasAndProjParameters.w; + float _328 = 1.0 / fma(_318.z / _318.w, _Globals.PointLightDepthBiasAndProjParameters.z, _457); + float _341 = fma(_328, _Globals.LightPositionAndInvRadius.w, -((1.0 / fma(float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, fma(_286, float3(2.5), _278), level(0.0))).x, _Globals.PointLightDepthBiasAndProjParameters.z, _457)) * _Globals.LightPositionAndInvRadius.w)); + float _342 = _341 * _323; + float _363 = fma(_328, _Globals.LightPositionAndInvRadius.w, -((1.0 / fma(float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, fma(_286, float3(0.77254199981689453125), fma(_285, float3(2.3776409626007080078125), _278)), level(0.0))).x, _Globals.PointLightDepthBiasAndProjParameters.z, _457)) * _Globals.LightPositionAndInvRadius.w)); + float _364 = _363 * _323; + float _386 = fma(_328, _Globals.LightPositionAndInvRadius.w, -((1.0 / fma(float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, fma(_286, float3(-2.0225429534912109375), fma(_285, float3(1.46946299076080322265625), _278)), level(0.0))).x, _Globals.PointLightDepthBiasAndProjParameters.z, _457)) * _Globals.LightPositionAndInvRadius.w)); + float _387 = _386 * _323; + float _409 = fma(_328, _Globals.LightPositionAndInvRadius.w, -((1.0 / fma(float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, fma(_286, float3(-2.02254199981689453125), fma(_285, float3(-1.46946299076080322265625), _278)), level(0.0))).x, _Globals.PointLightDepthBiasAndProjParameters.z, _457)) * _Globals.LightPositionAndInvRadius.w)); + float _410 = _409 * _323; + float _432 = fma(_328, _Globals.LightPositionAndInvRadius.w, -((1.0 / fma(float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, fma(_286, float3(0.772543013095855712890625), fma(_285, float3(-2.3776409626007080078125), _278)), level(0.0))).x, _Globals.PointLightDepthBiasAndProjParameters.z, _457)) * _Globals.LightPositionAndInvRadius.w)); + float _433 = _432 * _323; + _445 = (((((fast::clamp(abs((_342 > 0.0) ? fma(_341, _323, _263) : fast::max(0.0, fma(_342, _274, _263))), 0.1500000059604644775390625, 5.0) + 0.25) + (fast::clamp(abs((_364 > 0.0) ? fma(_363, _323, _263) : fast::max(0.0, fma(_364, _274, _263))), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_387 > 0.0) ? fma(_386, _323, _263) : fast::max(0.0, fma(_387, _274, _263))), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_410 > 0.0) ? fma(_409, _323, _263) : fast::max(0.0, fma(_410, _274, _263))), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_433 > 0.0) ? fma(_432, _323, _263) : fast::max(0.0, fma(_433, _274, _263))), 0.1500000059604644775390625, 5.0) + 0.25)) * 0.20000000298023223876953125; + } + else + { + _445 = 1.0; + } + _448 = fma(-_445, 0.20000000298023223876953125, 1.0); + } + else + { + _448 = 1.0; + } + _220.w = _248 ? sqrt(_448) : _218; + out.out_var_SV_Target0 = _220; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag new file mode 100644 index 0000000000..192c0b411b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag @@ -0,0 +1,1073 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_Globals +{ + float4 MappingPolynomial; + float3 InverseGamma; + float4 ColorMatrixR_ColorCurveCd1; + float4 ColorMatrixG_ColorCurveCd3Cm3; + float4 ColorMatrixB_ColorCurveCm2; + float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3; + float4 ColorCurve_Ch1_Ch2; + float4 ColorShadow_Luma; + float4 ColorShadow_Tint1; + float4 ColorShadow_Tint2; + float FilmSlope; + float FilmToe; + float FilmShoulder; + float FilmBlackClip; + float FilmWhiteClip; + packed_float3 ColorScale; + float4 OverlayColor; + float WhiteTemp; + float WhiteTint; + float4 ColorSaturation; + float4 ColorContrast; + float4 ColorGamma; + float4 ColorGain; + float4 ColorOffset; + float4 ColorSaturationShadows; + float4 ColorContrastShadows; + float4 ColorGammaShadows; + float4 ColorGainShadows; + float4 ColorOffsetShadows; + float4 ColorSaturationMidtones; + float4 ColorContrastMidtones; + float4 ColorGammaMidtones; + float4 ColorGainMidtones; + float4 ColorOffsetMidtones; + float4 ColorSaturationHighlights; + float4 ColorContrastHighlights; + float4 ColorGammaHighlights; + float4 ColorGainHighlights; + float4 ColorOffsetHighlights; + float ColorCorrectionShadowsMax; + float ColorCorrectionHighlightsMin; + uint OutputDevice; + uint OutputGamut; + float BlueCorrection; + float ExpandGamut; +}; + +constant spvUnsafeArray _475 = spvUnsafeArray({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 }); +constant spvUnsafeArray _476 = spvUnsafeArray({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 }); +constant spvUnsafeArray _479 = spvUnsafeArray({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _480 = spvUnsafeArray({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 }); +constant spvUnsafeArray _482 = spvUnsafeArray({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _483 = spvUnsafeArray({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 }); + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + float3x3 _546 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875)); + float3x3 _547 = _546 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _548 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375)); + float3x3 _549 = _548 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)); + float3x3 _550 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _551 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)); + float3x3 _576; + for (;;) + { + if (_Globals.OutputGamut == 1u) + { + _576 = _548 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375)); + break; + } + else + { + if (_Globals.OutputGamut == 2u) + { + _576 = _548 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375)); + break; + } + else + { + if (_Globals.OutputGamut == 3u) + { + _576 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625)); + break; + } + else + { + if (_Globals.OutputGamut == 4u) + { + _576 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)); + break; + } + else + { + _576 = _549; + break; + } + } + } + } + } + float3 _577 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz; + float3 _599; + if (_Globals.OutputDevice >= 3u) + { + float3 _591 = pow(_577, float3(0.0126833133399486541748046875)); + _599 = pow(fast::max(float3(0.0), _591 - float3(0.8359375)) / fma(float3(-18.6875), _591, float3(18.8515625)), float3(6.277394771575927734375)) * float3(10000.0); + } + else + { + _599 = fma(exp2((_577 - float3(0.434017598628997802734375)) * float3(14.0)), float3(0.180000007152557373046875), float3(-0.00266771926544606685638427734375)); + } + float _602 = _Globals.WhiteTemp * 1.00055634975433349609375; + float _616 = (_602 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _602)) / _602)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _602)) / _602)); + float _633 = fma(1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(0.00015411825734190642833709716796875, _Globals.WhiteTemp, 0.860117733478546142578125)) / fma(7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(0.0008424202096648514270782470703125, _Globals.WhiteTemp, 1.0)); + float _644 = fma(4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(4.25, _Globals.WhiteTemp, 0.317398726940155029296875)) / fma(1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(-2.8974181986995972692966461181641e-05, _Globals.WhiteTemp, 1.0)); + float _649 = fma(2.0, _633, _644 * (-8.0)) + 4.0; + float2 _653 = float2((3.0 * _633) / _649, (2.0 * _644) / _649); + float2 _660 = fast::normalize(float2(_633, _644)); + float _665 = fma((-_660.y) * _Globals.WhiteTint, 0.0500000007450580596923828125, _633); + float _669 = fma(_660.x * _Globals.WhiteTint, 0.0500000007450580596923828125, _644); + float _674 = fma(2.0, _665, _669 * (-8.0)) + 4.0; + float2 _680 = select(float2(_616, fma(_616, fma(-3.0, _616, 2.86999988555908203125), -0.2750000059604644775390625)), _653, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _665) / _674, (2.0 * _669) / _674) - _653); + float _683 = fast::max(_680.y, 1.0000000133514319600180897396058e-10); + float3 _697 = float3(_680.x / _683, 1.0, ((1.0 - _680.x) - _680.y) / _683) * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _717 = (_599 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(0.941379249095916748046875 / _697.x, 0.0, 0.0), float3(0.0, 1.04043638706207275390625 / _697.y, 0.0), float3(0.0, 0.0, 1.08976650238037109375 / _697.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _547; + float3 _745; + if (_Globals.ColorShadow_Tint2.w != 0.0) + { + float _724 = dot(_717, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float3 _727 = (_717 / float3(_724)) - float3(1.0); + _745 = mix(_717, _717 * (_549 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_727, _727))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _724) * _724)))); + } + else + { + _745 = _717; + } + float _746 = dot(_745, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float4 _751 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation; + float4 _756 = _Globals.ColorContrastShadows * _Globals.ColorContrast; + float4 _761 = _Globals.ColorGammaShadows * _Globals.ColorGamma; + float4 _766 = _Globals.ColorGainShadows * _Globals.ColorGain; + float4 _771 = _Globals.ColorOffsetShadows + _Globals.ColorOffset; + float3 _772 = float3(_746); + float _804 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _746); + float4 _808 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation; + float4 _811 = _Globals.ColorContrastHighlights * _Globals.ColorContrast; + float4 _814 = _Globals.ColorGammaHighlights * _Globals.ColorGamma; + float4 _817 = _Globals.ColorGainHighlights * _Globals.ColorGain; + float4 _820 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset; + float _852 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _746); + float4 _855 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation; + float4 _858 = _Globals.ColorContrastMidtones * _Globals.ColorContrast; + float4 _861 = _Globals.ColorGammaMidtones * _Globals.ColorGamma; + float4 _864 = _Globals.ColorGainMidtones * _Globals.ColorGain; + float4 _867 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset; + float3 _905 = fma(fma(pow(pow(fast::max(float3(0.0), mix(_772, _745, _808.xyz * float3(_808.w))) * float3(5.5555553436279296875), _811.xyz * float3(_811.w)) * float3(0.180000007152557373046875), float3(1.0) / (_814.xyz * float3(_814.w))), _817.xyz * float3(_817.w), _820.xyz + float3(_820.w)), float3(_852), fma(fma(pow(pow(fast::max(float3(0.0), mix(_772, _745, _751.xyz * float3(_751.w))) * float3(5.5555553436279296875), _756.xyz * float3(_756.w)) * float3(0.180000007152557373046875), float3(1.0) / (_761.xyz * float3(_761.w))), _766.xyz * float3(_766.w), _771.xyz + float3(_771.w)), float3(1.0 - _804), fma(pow(pow(fast::max(float3(0.0), mix(_772, _745, _855.xyz * float3(_855.w))) * float3(5.5555553436279296875), _858.xyz * float3(_858.w)) * float3(0.180000007152557373046875), float3(1.0) / (_861.xyz * float3(_861.w))), _864.xyz * float3(_864.w), _867.xyz + float3(_867.w)) * float3(_804 - _852))); + float3 _906 = _905 * _549; + float3 _914 = float3(_Globals.BlueCorrection); + float3 _916 = mix(_905, _905 * ((_551 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _550), _914) * _551; + float _917 = _916.x; + float _918 = _916.y; + float _920 = _916.z; + float _923 = fast::max(fast::max(_917, _918), _920); + float _928 = (fast::max(_923, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_917, _918), _920), 1.0000000133514319600180897396058e-10)) / fast::max(_923, 0.00999999977648258209228515625); + float _941 = fma(1.75, sqrt(fma(_917, _917 - _920, fma(_920, _920 - _918, _918 * (_918 - _917)))), (_920 + _918) + _917); + float _942 = _941 * 0.3333333432674407958984375; + float _943 = _928 - 0.4000000059604644775390625; + float _948 = fast::max(1.0 - abs(_943 * 2.5), 0.0); + float _956 = fma(float(int(sign(_943 * 5.0))), fma(-_948, _948, 1.0), 1.0) * 0.02500000037252902984619140625; + float _969; + if (_942 <= 0.053333334624767303466796875) + { + _969 = _956; + } + else + { + float _968; + if (_942 >= 0.1599999964237213134765625) + { + _968 = 0.0; + } + else + { + _968 = _956 * ((0.23999999463558197021484375 / _941) - 0.5); + } + _969 = _968; + } + float3 _972 = _916 * float3(1.0 + _969); + float _973 = _972.x; + float _974 = _972.y; + float _976 = _972.z; + float _990; + if ((_973 == _974) && (_974 == _976)) + { + _990 = 0.0; + } + else + { + _990 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_974 - _976), fma(2.0, _973, -_974) - _976); + } + float _995; + if (_990 < 0.0) + { + _995 = _990 + 360.0; + } + else + { + _995 = _990; + } + float _996 = fast::clamp(_995, 0.0, 360.0); + float _1001; + if (_996 > 180.0) + { + _1001 = _996 - 360.0; + } + else + { + _1001 = _996; + } + float _1005 = smoothstep(0.0, 1.0, 1.0 - abs(_1001 * 0.01481481455266475677490234375)); + _972.x = fma(((_1005 * _1005) * _928) * (0.02999999932944774627685546875 - _973), 0.180000007152557373046875, _973); + float3 _1014 = fast::max(float3(0.0), _972 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375))); + float _1023 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe; + float _1026 = 1.0 + _Globals.FilmWhiteClip; + float _1029 = _1026 - _Globals.FilmShoulder; + float _1056; + if (_Globals.FilmToe > 0.800000011920928955078125) + { + _1056 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (-0.744727432727813720703125); + } + else + { + float _1035 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1023; + _1056 = fma(log(_1035 / (2.0 - _1035)) * (-0.5), _1023 / _Globals.FilmSlope, -0.744727432727813720703125); + } + float _1061 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1056; + float _1063 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1061; + float3 _1064 = log(mix(float3(dot(_1014, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1014, float3(0.959999978542327880859375))); + float3 _1067 = _1064 * float3(0.4342944622039794921875); + float3 _1071 = float3(_Globals.FilmSlope) * fma(_1064, float3(0.4342944622039794921875), float3(_1061)); + float3 _1079 = float3(_1056); + float3 _1080 = fma(_1064, float3(0.4342944622039794921875), -_1079); + float3 _1092 = float3(_1063); + float3 _1106 = fast::clamp(_1080 / float3(_1063 - _1056), float3(0.0), float3(1.0)); + float3 _1110 = select(_1106, float3(1.0) - _1106, bool3(_1063 < _1056)); + float3 _1115 = mix(select(_1071, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1023) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1023) * _1080))), _1067 < _1079), select(_1071, float3(_1026) - (float3(2.0 * _1029) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1029) * fma(_1064, float3(0.4342944622039794921875), -_1092)))), _1067 > _1092), (fma(float3(-2.0), _1110, float3(3.0)) * _1110) * _1110); + float3 _1119 = fast::max(float3(0.0), mix(float3(dot(_1115, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1115, float3(0.930000007152557373046875))); + float3 _1189; + if (_Globals.ColorShadow_Tint2.w == 0.0) + { + float3 _1157 = fast::max(float3(0.0), float3(dot(_906, _Globals.ColorMatrixR_ColorCurveCd1.xyz), dot(_906, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz), dot(_906, _Globals.ColorMatrixB_ColorCurveCm2.xyz)) * fma(_Globals.ColorShadow_Tint2.xyz, float3(1.0 / (dot(_906, _Globals.ColorShadow_Luma.xyz) + 1.0)), _Globals.ColorShadow_Tint1.xyz)); + float3 _1162 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1157); + float3 _1164 = fast::max(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz); + _1189 = fma(fma(_1164, _Globals.ColorCurve_Ch1_Ch2.xxx, _Globals.ColorCurve_Ch1_Ch2.yyy), float3(1.0) / (_1164 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www), fma(fast::clamp(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz), _Globals.ColorMatrixB_ColorCurveCm2.www, fma(_1162 * _Globals.ColorMatrixR_ColorCurveCd1.www, float3(1.0) / (_1162 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy), _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375); + } + else + { + _1189 = fast::max(float3(0.0), mix(_1119, _1119 * ((_551 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _550), _914) * _549); + } + float3 _1218 = pow(fast::max(float3(0.0), mix((fma(float3(_Globals.MappingPolynomial.x), _1189 * _1189, float3(_Globals.MappingPolynomial.y) * _1189) + float3(_Globals.MappingPolynomial.z)) * float3(_Globals.ColorScale), _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y)); + float3 _3001; + if (_Globals.OutputDevice == 0u) + { + float _2961 = _1218.x; + float _2973; + for (;;) + { + if (_2961 < 0.00313066993840038776397705078125) + { + _2973 = _2961 * 12.9200000762939453125; + break; + } + _2973 = fma(pow(_2961, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _2974 = _1218.y; + float _2986; + for (;;) + { + if (_2974 < 0.00313066993840038776397705078125) + { + _2986 = _2974 * 12.9200000762939453125; + break; + } + _2986 = fma(pow(_2974, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _2987 = _1218.z; + float _2999; + for (;;) + { + if (_2987 < 0.00313066993840038776397705078125) + { + _2999 = _2987 * 12.9200000762939453125; + break; + } + _2999 = fma(pow(_2987, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + _3001 = float3(_2973, _2986, _2999); + } + else + { + float3 _2960; + if (_Globals.OutputDevice == 1u) + { + float3 _2953 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1218 * _547) * _576); + _2960 = fast::min(_2953 * float3(4.5), fma(pow(fast::max(_2953, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)), float3(1.09899997711181640625), float3(-0.098999999463558197021484375))); + } + else + { + float3 _2950; + if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u)) + { + float3 _2100 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _2101 = _2100.x; + float _2102 = _2100.y; + float _2104 = _2100.z; + float _2107 = fast::max(fast::max(_2101, _2102), _2104); + float _2112 = (fast::max(_2107, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2101, _2102), _2104), 1.0000000133514319600180897396058e-10)) / fast::max(_2107, 0.00999999977648258209228515625); + float _2125 = fma(1.75, sqrt(fma(_2101, _2101 - _2104, fma(_2104, _2104 - _2102, _2102 * (_2102 - _2101)))), (_2104 + _2102) + _2101); + float _2126 = _2125 * 0.3333333432674407958984375; + float _2127 = _2112 - 0.4000000059604644775390625; + float _2132 = fast::max(1.0 - abs(_2127 * 2.5), 0.0); + float _2140 = fma(float(int(sign(_2127 * 5.0))), fma(-_2132, _2132, 1.0), 1.0) * 0.02500000037252902984619140625; + float _2153; + if (_2126 <= 0.053333334624767303466796875) + { + _2153 = _2140; + } + else + { + float _2152; + if (_2126 >= 0.1599999964237213134765625) + { + _2152 = 0.0; + } + else + { + _2152 = _2140 * ((0.23999999463558197021484375 / _2125) - 0.5); + } + _2153 = _2152; + } + float3 _2156 = _2100 * float3(1.0 + _2153); + float _2157 = _2156.x; + float _2158 = _2156.y; + float _2160 = _2156.z; + float _2174; + if ((_2157 == _2158) && (_2158 == _2160)) + { + _2174 = 0.0; + } + else + { + _2174 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_2158 - _2160), fma(2.0, _2157, -_2158) - _2160); + } + float _2179; + if (_2174 < 0.0) + { + _2179 = _2174 + 360.0; + } + else + { + _2179 = _2174; + } + float _2180 = fast::clamp(_2179, 0.0, 360.0); + float _2185; + if (_2180 > 180.0) + { + _2185 = _2180 - 360.0; + } + else + { + _2185 = _2180; + } + float _2235; + if ((_2185 > (-67.5)) && (_2185 < 67.5)) + { + float _2191 = _2185 - (-67.5); + int _2193 = int(_2191 * 0.0296296291053295135498046875); + float _2195 = fma(_2191, 0.0296296291053295135498046875, -float(_2193)); + float _2196 = _2195 * _2195; + float _2197 = _2196 * _2195; + float _2234; + if (_2193 == 3) + { + _2234 = fma(_2195, -0.5, fma(_2197, -0.16666667163372039794921875, _2196 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2227; + if (_2193 == 2) + { + _2227 = fma(_2197, 0.5, _2196 * (-1.0)) + 0.666666686534881591796875; + } + else + { + float _2222; + if (_2193 == 1) + { + _2222 = fma(_2195, 0.5, fma(_2197, -0.5, _2196 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2215; + if (_2193 == 0) + { + _2215 = _2197 * 0.16666667163372039794921875; + } + else + { + _2215 = 0.0; + } + _2222 = _2215; + } + _2227 = _2222; + } + _2234 = _2227; + } + _2235 = _2234; + } + else + { + _2235 = 0.0; + } + _2156.x = fma(((_2235 * 1.5) * _2112) * (0.02999999932944774627685546875 - _2157), 0.180000007152557373046875, _2157); + float3 _2245 = fast::clamp(fast::clamp(_2156, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _2248 = mix(float3(dot(_2245, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2245, float3(0.959999978542327880859375)); + float _2249 = _2248.x; + float _2257 = log((_2249 <= 0.0) ? 6.103515625e-05 : _2249); + float _2258 = _2257 * 0.4342944622039794921875; + float _2327; + if (_2258 <= (-5.2601776123046875)) + { + _2327 = -4.0; + } + else + { + float _2324; + if ((_2258 > (-5.2601776123046875)) && (_2258 < (-0.744727432727813720703125))) + { + float _2304 = fma(_2257, 0.4342944622039794921875, 5.2601776123046875); + int _2308 = int(_2304 * 0.6643855571746826171875); + float _2310 = fma(_2304, 0.6643855571746826171875, -float(_2308)); + _2324 = dot(float3(_2310 * _2310, _2310, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2308], _475[_2308 + 1], _475[_2308 + 2])); + } + else + { + float _2303; + if ((_2258 >= (-0.744727432727813720703125)) && (_2258 < 4.673812389373779296875)) + { + float _2283 = fma(_2257, 0.4342944622039794921875, 0.744727432727813720703125); + int _2287 = int(_2283 * 0.55365467071533203125); + float _2289 = fma(_2283, 0.55365467071533203125, -float(_2287)); + _2303 = dot(float3(_2289 * _2289, _2289, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2287], _476[_2287 + 1], _476[_2287 + 2])); + } + else + { + _2303 = 4.0; + } + _2324 = _2303; + } + _2327 = _2324; + } + float _2330 = _2248.y; + float _2333 = log((_2330 <= 0.0) ? 6.103515625e-05 : _2330); + float _2334 = _2333 * 0.4342944622039794921875; + float _2401; + if (_2334 <= (-5.2601776123046875)) + { + _2401 = -4.0; + } + else + { + float _2398; + if ((_2334 > (-5.2601776123046875)) && (_2334 < (-0.744727432727813720703125))) + { + float _2378 = fma(_2333, 0.4342944622039794921875, 5.2601776123046875); + int _2382 = int(_2378 * 0.6643855571746826171875); + float _2384 = fma(_2378, 0.6643855571746826171875, -float(_2382)); + _2398 = dot(float3(_2384 * _2384, _2384, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2382], _475[_2382 + 1], _475[_2382 + 2])); + } + else + { + float _2377; + if ((_2334 >= (-0.744727432727813720703125)) && (_2334 < 4.673812389373779296875)) + { + float _2357 = fma(_2333, 0.4342944622039794921875, 0.744727432727813720703125); + int _2361 = int(_2357 * 0.55365467071533203125); + float _2363 = fma(_2357, 0.55365467071533203125, -float(_2361)); + _2377 = dot(float3(_2363 * _2363, _2363, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2361], _476[_2361 + 1], _476[_2361 + 2])); + } + else + { + _2377 = 4.0; + } + _2398 = _2377; + } + _2401 = _2398; + } + float _2404 = _2248.z; + float _2407 = log((_2404 <= 0.0) ? 6.103515625e-05 : _2404); + float _2408 = _2407 * 0.4342944622039794921875; + float _2475; + if (_2408 <= (-5.2601776123046875)) + { + _2475 = -4.0; + } + else + { + float _2472; + if ((_2408 > (-5.2601776123046875)) && (_2408 < (-0.744727432727813720703125))) + { + float _2452 = fma(_2407, 0.4342944622039794921875, 5.2601776123046875); + int _2456 = int(_2452 * 0.6643855571746826171875); + float _2458 = fma(_2452, 0.6643855571746826171875, -float(_2456)); + _2472 = dot(float3(_2458 * _2458, _2458, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2456], _475[_2456 + 1], _475[_2456 + 2])); + } + else + { + float _2451; + if ((_2408 >= (-0.744727432727813720703125)) && (_2408 < 4.673812389373779296875)) + { + float _2431 = fma(_2407, 0.4342944622039794921875, 0.744727432727813720703125); + int _2435 = int(_2431 * 0.55365467071533203125); + float _2437 = fma(_2431, 0.55365467071533203125, -float(_2435)); + _2451 = dot(float3(_2437 * _2437, _2437, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2435], _476[_2435 + 1], _476[_2435 + 2])); + } + else + { + _2451 = 4.0; + } + _2472 = _2451; + } + _2475 = _2472; + } + float3 _2479 = (float3(pow(10.0, _2327), pow(10.0, _2401), pow(10.0, _2475)) * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _2685 = _2479.x; + float _2688 = log((_2685 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2685); + float _2689 = _2688 * 0.4342944622039794921875; + float _2768; + if (_2689 <= (-3.84832763671875)) + { + _2768 = fma(_2688, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _2760; + if ((_2689 > (-3.84832763671875)) && (_2689 < 0.68124115467071533203125)) + { + float _2743 = (7.0 * fma(_2688, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2744 = int(_2743); + float _2746 = _2743 - float(_2744); + _2760 = dot(float3(_2746 * _2746, _2746, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2744], _479[_2744 + 1], _479[_2744 + 2])); + } + else + { + float _2739; + if ((_2689 >= 0.68124115467071533203125) && (_2689 < 3.65370273590087890625)) + { + float _2722 = (7.0 * fma(_2688, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2723 = int(_2722); + float _2725 = _2722 - float(_2723); + _2739 = dot(float3(_2725 * _2725, _2725, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2723], _480[_2723 + 1], _480[_2723 + 2])); + } + else + { + _2739 = fma(_2688, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _2760 = _2739; + } + _2768 = _2760; + } + float _2771 = _2479.y; + float _2774 = log((_2771 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2771); + float _2775 = _2774 * 0.4342944622039794921875; + float _2852; + if (_2775 <= (-3.84832763671875)) + { + _2852 = fma(_2774, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _2844; + if ((_2775 > (-3.84832763671875)) && (_2775 < 0.68124115467071533203125)) + { + float _2827 = (7.0 * fma(_2774, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2828 = int(_2827); + float _2830 = _2827 - float(_2828); + _2844 = dot(float3(_2830 * _2830, _2830, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2828], _479[_2828 + 1], _479[_2828 + 2])); + } + else + { + float _2823; + if ((_2775 >= 0.68124115467071533203125) && (_2775 < 3.65370273590087890625)) + { + float _2806 = (7.0 * fma(_2774, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2807 = int(_2806); + float _2809 = _2806 - float(_2807); + _2823 = dot(float3(_2809 * _2809, _2809, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2807], _480[_2807 + 1], _480[_2807 + 2])); + } + else + { + _2823 = fma(_2774, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _2844 = _2823; + } + _2852 = _2844; + } + float _2855 = _2479.z; + float _2858 = log((_2855 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2855); + float _2859 = _2858 * 0.4342944622039794921875; + float _2936; + if (_2859 <= (-3.84832763671875)) + { + _2936 = fma(_2858, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _2928; + if ((_2859 > (-3.84832763671875)) && (_2859 < 0.68124115467071533203125)) + { + float _2911 = (7.0 * fma(_2858, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2912 = int(_2911); + float _2914 = _2911 - float(_2912); + _2928 = dot(float3(_2914 * _2914, _2914, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2912], _479[_2912 + 1], _479[_2912 + 2])); + } + else + { + float _2907; + if ((_2859 >= 0.68124115467071533203125) && (_2859 < 3.65370273590087890625)) + { + float _2890 = (7.0 * fma(_2858, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2891 = int(_2890); + float _2893 = _2890 - float(_2891); + _2907 = dot(float3(_2893 * _2893, _2893, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2891], _480[_2891 + 1], _480[_2891 + 2])); + } + else + { + _2907 = fma(_2858, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _2928 = _2907; + } + _2936 = _2928; + } + float3 _2942 = pow(((float3(pow(10.0, _2768), pow(10.0, _2852), pow(10.0, _2936)) - float3(3.5073844628641381859779357910156e-05)) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2950 = pow(fma(float3(18.8515625), _2942, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _2942, float3(1.0))), float3(78.84375)); + } + else + { + float3 _2097; + if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u)) + { + float3 _1263 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _1264 = _1263.x; + float _1265 = _1263.y; + float _1267 = _1263.z; + float _1270 = fast::max(fast::max(_1264, _1265), _1267); + float _1275 = (fast::max(_1270, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1264, _1265), _1267), 1.0000000133514319600180897396058e-10)) / fast::max(_1270, 0.00999999977648258209228515625); + float _1288 = fma(1.75, sqrt(fma(_1264, _1264 - _1267, fma(_1267, _1267 - _1265, _1265 * (_1265 - _1264)))), (_1267 + _1265) + _1264); + float _1289 = _1288 * 0.3333333432674407958984375; + float _1290 = _1275 - 0.4000000059604644775390625; + float _1295 = fast::max(1.0 - abs(_1290 * 2.5), 0.0); + float _1303 = fma(float(int(sign(_1290 * 5.0))), fma(-_1295, _1295, 1.0), 1.0) * 0.02500000037252902984619140625; + float _1316; + if (_1289 <= 0.053333334624767303466796875) + { + _1316 = _1303; + } + else + { + float _1315; + if (_1289 >= 0.1599999964237213134765625) + { + _1315 = 0.0; + } + else + { + _1315 = _1303 * ((0.23999999463558197021484375 / _1288) - 0.5); + } + _1316 = _1315; + } + float3 _1319 = _1263 * float3(1.0 + _1316); + float _1320 = _1319.x; + float _1321 = _1319.y; + float _1323 = _1319.z; + float _1337; + if ((_1320 == _1321) && (_1321 == _1323)) + { + _1337 = 0.0; + } + else + { + _1337 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_1321 - _1323), fma(2.0, _1320, -_1321) - _1323); + } + float _1342; + if (_1337 < 0.0) + { + _1342 = _1337 + 360.0; + } + else + { + _1342 = _1337; + } + float _1343 = fast::clamp(_1342, 0.0, 360.0); + float _1348; + if (_1343 > 180.0) + { + _1348 = _1343 - 360.0; + } + else + { + _1348 = _1343; + } + float _1398; + if ((_1348 > (-67.5)) && (_1348 < 67.5)) + { + float _1354 = _1348 - (-67.5); + int _1356 = int(_1354 * 0.0296296291053295135498046875); + float _1358 = fma(_1354, 0.0296296291053295135498046875, -float(_1356)); + float _1359 = _1358 * _1358; + float _1360 = _1359 * _1358; + float _1397; + if (_1356 == 3) + { + _1397 = fma(_1358, -0.5, fma(_1360, -0.16666667163372039794921875, _1359 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1390; + if (_1356 == 2) + { + _1390 = fma(_1360, 0.5, _1359 * (-1.0)) + 0.666666686534881591796875; + } + else + { + float _1385; + if (_1356 == 1) + { + _1385 = fma(_1358, 0.5, fma(_1360, -0.5, _1359 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1378; + if (_1356 == 0) + { + _1378 = _1360 * 0.16666667163372039794921875; + } + else + { + _1378 = 0.0; + } + _1385 = _1378; + } + _1390 = _1385; + } + _1397 = _1390; + } + _1398 = _1397; + } + else + { + _1398 = 0.0; + } + _1319.x = fma(((_1398 * 1.5) * _1275) * (0.02999999932944774627685546875 - _1320), 0.180000007152557373046875, _1320); + float3 _1408 = fast::clamp(fast::clamp(_1319, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _1411 = mix(float3(dot(_1408, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1408, float3(0.959999978542327880859375)); + float _1412 = _1411.x; + float _1420 = log((_1412 <= 0.0) ? 6.103515625e-05 : _1412); + float _1421 = _1420 * 0.4342944622039794921875; + float _1490; + if (_1421 <= (-5.2601776123046875)) + { + _1490 = -4.0; + } + else + { + float _1487; + if ((_1421 > (-5.2601776123046875)) && (_1421 < (-0.744727432727813720703125))) + { + float _1467 = fma(_1420, 0.4342944622039794921875, 5.2601776123046875); + int _1471 = int(_1467 * 0.6643855571746826171875); + float _1473 = fma(_1467, 0.6643855571746826171875, -float(_1471)); + _1487 = dot(float3(_1473 * _1473, _1473, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1471], _475[_1471 + 1], _475[_1471 + 2])); + } + else + { + float _1466; + if ((_1421 >= (-0.744727432727813720703125)) && (_1421 < 4.673812389373779296875)) + { + float _1446 = fma(_1420, 0.4342944622039794921875, 0.744727432727813720703125); + int _1450 = int(_1446 * 0.55365467071533203125); + float _1452 = fma(_1446, 0.55365467071533203125, -float(_1450)); + _1466 = dot(float3(_1452 * _1452, _1452, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1450], _476[_1450 + 1], _476[_1450 + 2])); + } + else + { + _1466 = 4.0; + } + _1487 = _1466; + } + _1490 = _1487; + } + float _1493 = _1411.y; + float _1496 = log((_1493 <= 0.0) ? 6.103515625e-05 : _1493); + float _1497 = _1496 * 0.4342944622039794921875; + float _1564; + if (_1497 <= (-5.2601776123046875)) + { + _1564 = -4.0; + } + else + { + float _1561; + if ((_1497 > (-5.2601776123046875)) && (_1497 < (-0.744727432727813720703125))) + { + float _1541 = fma(_1496, 0.4342944622039794921875, 5.2601776123046875); + int _1545 = int(_1541 * 0.6643855571746826171875); + float _1547 = fma(_1541, 0.6643855571746826171875, -float(_1545)); + _1561 = dot(float3(_1547 * _1547, _1547, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1545], _475[_1545 + 1], _475[_1545 + 2])); + } + else + { + float _1540; + if ((_1497 >= (-0.744727432727813720703125)) && (_1497 < 4.673812389373779296875)) + { + float _1520 = fma(_1496, 0.4342944622039794921875, 0.744727432727813720703125); + int _1524 = int(_1520 * 0.55365467071533203125); + float _1526 = fma(_1520, 0.55365467071533203125, -float(_1524)); + _1540 = dot(float3(_1526 * _1526, _1526, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1524], _476[_1524 + 1], _476[_1524 + 2])); + } + else + { + _1540 = 4.0; + } + _1561 = _1540; + } + _1564 = _1561; + } + float _1567 = _1411.z; + float _1570 = log((_1567 <= 0.0) ? 6.103515625e-05 : _1567); + float _1571 = _1570 * 0.4342944622039794921875; + float _1638; + if (_1571 <= (-5.2601776123046875)) + { + _1638 = -4.0; + } + else + { + float _1635; + if ((_1571 > (-5.2601776123046875)) && (_1571 < (-0.744727432727813720703125))) + { + float _1615 = fma(_1570, 0.4342944622039794921875, 5.2601776123046875); + int _1619 = int(_1615 * 0.6643855571746826171875); + float _1621 = fma(_1615, 0.6643855571746826171875, -float(_1619)); + _1635 = dot(float3(_1621 * _1621, _1621, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1619], _475[_1619 + 1], _475[_1619 + 2])); + } + else + { + float _1614; + if ((_1571 >= (-0.744727432727813720703125)) && (_1571 < 4.673812389373779296875)) + { + float _1594 = fma(_1570, 0.4342944622039794921875, 0.744727432727813720703125); + int _1598 = int(_1594 * 0.55365467071533203125); + float _1600 = fma(_1594, 0.55365467071533203125, -float(_1598)); + _1614 = dot(float3(_1600 * _1600, _1600, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1598], _476[_1598 + 1], _476[_1598 + 2])); + } + else + { + _1614 = 4.0; + } + _1635 = _1614; + } + _1638 = _1635; + } + float3 _1642 = (float3(pow(10.0, _1490), pow(10.0, _1564), pow(10.0, _1638)) * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _1848 = _1642.x; + float _1851 = log((_1848 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1848); + float _1852 = _1851 * 0.4342944622039794921875; + float _1926; + if (_1852 <= (-3.84832763671875)) + { + _1926 = -2.3010299205780029296875; + } + else + { + float _1923; + if ((_1852 > (-3.84832763671875)) && (_1852 < 0.68124115467071533203125)) + { + float _1906 = (7.0 * fma(_1851, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _1907 = int(_1906); + float _1909 = _1906 - float(_1907); + _1923 = dot(float3(_1909 * _1909, _1909, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1907], _482[_1907 + 1], _482[_1907 + 2])); + } + else + { + float _1902; + if ((_1852 >= 0.68124115467071533203125) && (_1852 < 3.761315822601318359375)) + { + float _1885 = (7.0 * fma(_1851, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _1886 = int(_1885); + float _1888 = _1885 - float(_1886); + _1902 = dot(float3(_1888 * _1888, _1888, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1886], _483[_1886 + 1], _483[_1886 + 2])); + } + else + { + _1902 = fma(_1851, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _1923 = _1902; + } + _1926 = _1923; + } + float _1929 = _1642.y; + float _1932 = log((_1929 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1929); + float _1933 = _1932 * 0.4342944622039794921875; + float _2005; + if (_1933 <= (-3.84832763671875)) + { + _2005 = -2.3010299205780029296875; + } + else + { + float _2002; + if ((_1933 > (-3.84832763671875)) && (_1933 < 0.68124115467071533203125)) + { + float _1985 = (7.0 * fma(_1932, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _1986 = int(_1985); + float _1988 = _1985 - float(_1986); + _2002 = dot(float3(_1988 * _1988, _1988, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1986], _482[_1986 + 1], _482[_1986 + 2])); + } + else + { + float _1981; + if ((_1933 >= 0.68124115467071533203125) && (_1933 < 3.761315822601318359375)) + { + float _1964 = (7.0 * fma(_1932, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _1965 = int(_1964); + float _1967 = _1964 - float(_1965); + _1981 = dot(float3(_1967 * _1967, _1967, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1965], _483[_1965 + 1], _483[_1965 + 2])); + } + else + { + _1981 = fma(_1932, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _2002 = _1981; + } + _2005 = _2002; + } + float _2008 = _1642.z; + float _2011 = log((_2008 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2008); + float _2012 = _2011 * 0.4342944622039794921875; + float _2084; + if (_2012 <= (-3.84832763671875)) + { + _2084 = -2.3010299205780029296875; + } + else + { + float _2081; + if ((_2012 > (-3.84832763671875)) && (_2012 < 0.68124115467071533203125)) + { + float _2064 = (7.0 * fma(_2011, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2065 = int(_2064); + float _2067 = _2064 - float(_2065); + _2081 = dot(float3(_2067 * _2067, _2067, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_2065], _482[_2065 + 1], _482[_2065 + 2])); + } + else + { + float _2060; + if ((_2012 >= 0.68124115467071533203125) && (_2012 < 3.761315822601318359375)) + { + float _2043 = (7.0 * fma(_2011, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _2044 = int(_2043); + float _2046 = _2043 - float(_2044); + _2060 = dot(float3(_2046 * _2046, _2046, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_2044], _483[_2044 + 1], _483[_2044 + 2])); + } + else + { + _2060 = fma(_2011, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _2081 = _2060; + } + _2084 = _2081; + } + float3 _2089 = pow((float3(pow(10.0, _1926), pow(10.0, _2005), pow(10.0, _2084)) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2097 = pow(fma(float3(18.8515625), _2089, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _2089, float3(1.0))), float3(78.84375)); + } + else + { + float3 _1260; + if (_Globals.OutputDevice == 7u) + { + float3 _1252 = pow(((_906 * _547) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _1260 = pow(fma(float3(18.8515625), _1252, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _1252, float3(1.0))), float3(78.84375)); + } + else + { + _1260 = pow((_1218 * _547) * _576, float3(_Globals.InverseGamma.z)); + } + _2097 = _1260; + } + _2950 = _2097; + } + _2960 = _2950; + } + _3001 = _2960; + } + float3 _3002 = _3001 * float3(0.95238101482391357421875); + float4 _3003 = float4(_3002.x, _3002.y, _3002.z, float4(0.0).w); + _3003.w = 0.0; + out.out_var_SV_Target0 = _3003; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag new file mode 100644 index 0000000000..8b53cca3ad --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag @@ -0,0 +1,1121 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_Globals +{ + float4 MappingPolynomial; + float3 InverseGamma; + float4 ColorMatrixR_ColorCurveCd1; + float4 ColorMatrixG_ColorCurveCd3Cm3; + float4 ColorMatrixB_ColorCurveCm2; + float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3; + float4 ColorCurve_Ch1_Ch2; + float4 ColorShadow_Luma; + float4 ColorShadow_Tint1; + float4 ColorShadow_Tint2; + float FilmSlope; + float FilmToe; + float FilmShoulder; + float FilmBlackClip; + float FilmWhiteClip; + float4 LUTWeights[5]; + float3 ColorScale; + float4 OverlayColor; + float WhiteTemp; + float WhiteTint; + float4 ColorSaturation; + float4 ColorContrast; + float4 ColorGamma; + float4 ColorGain; + float4 ColorOffset; + float4 ColorSaturationShadows; + float4 ColorContrastShadows; + float4 ColorGammaShadows; + float4 ColorGainShadows; + float4 ColorOffsetShadows; + float4 ColorSaturationMidtones; + float4 ColorContrastMidtones; + float4 ColorGammaMidtones; + float4 ColorGainMidtones; + float4 ColorOffsetMidtones; + float4 ColorSaturationHighlights; + float4 ColorContrastHighlights; + float4 ColorGammaHighlights; + float4 ColorGainHighlights; + float4 ColorOffsetHighlights; + float ColorCorrectionShadowsMax; + float ColorCorrectionHighlightsMin; + uint OutputDevice; + uint OutputGamut; + float BlueCorrection; + float ExpandGamut; +}; + +constant spvUnsafeArray _499 = spvUnsafeArray({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 }); +constant spvUnsafeArray _500 = spvUnsafeArray({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 }); +constant spvUnsafeArray _503 = spvUnsafeArray({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _504 = spvUnsafeArray({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 }); +constant spvUnsafeArray _506 = spvUnsafeArray({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _507 = spvUnsafeArray({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 }); + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], texture2d Texture1 [[texture(0)]], sampler Texture1Sampler [[sampler(0)]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + float3x3 _572 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875)); + float3x3 _573 = _572 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _574 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375)); + float3x3 _575 = _574 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)); + float3x3 _576 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _577 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)); + float3x3 _602; + for (;;) + { + if (_Globals.OutputGamut == 1u) + { + _602 = _574 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375)); + break; + } + else + { + if (_Globals.OutputGamut == 2u) + { + _602 = _574 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375)); + break; + } + else + { + if (_Globals.OutputGamut == 3u) + { + _602 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625)); + break; + } + else + { + if (_Globals.OutputGamut == 4u) + { + _602 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)); + break; + } + else + { + _602 = _575; + break; + } + } + } + } + } + float3 _603 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz; + float3 _625; + if (_Globals.OutputDevice >= 3u) + { + float3 _617 = pow(_603, float3(0.0126833133399486541748046875)); + _625 = pow(fast::max(float3(0.0), _617 - float3(0.8359375)) / fma(float3(-18.6875), _617, float3(18.8515625)), float3(6.277394771575927734375)) * float3(10000.0); + } + else + { + _625 = fma(exp2((_603 - float3(0.434017598628997802734375)) * float3(14.0)), float3(0.180000007152557373046875), float3(-0.00266771926544606685638427734375)); + } + float _628 = _Globals.WhiteTemp * 1.00055634975433349609375; + float _642 = (_628 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _628)) / _628)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _628)) / _628)); + float _659 = fma(1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(0.00015411825734190642833709716796875, _Globals.WhiteTemp, 0.860117733478546142578125)) / fma(7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(0.0008424202096648514270782470703125, _Globals.WhiteTemp, 1.0)); + float _670 = fma(4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(4.25, _Globals.WhiteTemp, 0.317398726940155029296875)) / fma(1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp, _Globals.WhiteTemp, fma(-2.8974181986995972692966461181641e-05, _Globals.WhiteTemp, 1.0)); + float _675 = fma(2.0, _659, _670 * (-8.0)) + 4.0; + float2 _679 = float2((3.0 * _659) / _675, (2.0 * _670) / _675); + float2 _686 = fast::normalize(float2(_659, _670)); + float _691 = fma((-_686.y) * _Globals.WhiteTint, 0.0500000007450580596923828125, _659); + float _695 = fma(_686.x * _Globals.WhiteTint, 0.0500000007450580596923828125, _670); + float _700 = fma(2.0, _691, _695 * (-8.0)) + 4.0; + float2 _706 = select(float2(_642, fma(_642, fma(-3.0, _642, 2.86999988555908203125), -0.2750000059604644775390625)), _679, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _691) / _700, (2.0 * _695) / _700) - _679); + float _709 = fast::max(_706.y, 1.0000000133514319600180897396058e-10); + float3 _723 = float3(_706.x / _709, 1.0, ((1.0 - _706.x) - _706.y) / _709) * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _743 = (_625 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(0.941379249095916748046875 / _723.x, 0.0, 0.0), float3(0.0, 1.04043638706207275390625 / _723.y, 0.0), float3(0.0, 0.0, 1.08976650238037109375 / _723.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _573; + float3 _771; + if (_Globals.ColorShadow_Tint2.w != 0.0) + { + float _750 = dot(_743, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float3 _753 = (_743 / float3(_750)) - float3(1.0); + _771 = mix(_743, _743 * (_575 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_753, _753))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _750) * _750)))); + } + else + { + _771 = _743; + } + float _772 = dot(_771, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float4 _777 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation; + float4 _782 = _Globals.ColorContrastShadows * _Globals.ColorContrast; + float4 _787 = _Globals.ColorGammaShadows * _Globals.ColorGamma; + float4 _792 = _Globals.ColorGainShadows * _Globals.ColorGain; + float4 _797 = _Globals.ColorOffsetShadows + _Globals.ColorOffset; + float3 _798 = float3(_772); + float _830 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _772); + float4 _834 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation; + float4 _837 = _Globals.ColorContrastHighlights * _Globals.ColorContrast; + float4 _840 = _Globals.ColorGammaHighlights * _Globals.ColorGamma; + float4 _843 = _Globals.ColorGainHighlights * _Globals.ColorGain; + float4 _846 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset; + float _878 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _772); + float4 _881 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation; + float4 _884 = _Globals.ColorContrastMidtones * _Globals.ColorContrast; + float4 _887 = _Globals.ColorGammaMidtones * _Globals.ColorGamma; + float4 _890 = _Globals.ColorGainMidtones * _Globals.ColorGain; + float4 _893 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset; + float3 _931 = fma(fma(pow(pow(fast::max(float3(0.0), mix(_798, _771, _834.xyz * float3(_834.w))) * float3(5.5555553436279296875), _837.xyz * float3(_837.w)) * float3(0.180000007152557373046875), float3(1.0) / (_840.xyz * float3(_840.w))), _843.xyz * float3(_843.w), _846.xyz + float3(_846.w)), float3(_878), fma(fma(pow(pow(fast::max(float3(0.0), mix(_798, _771, _777.xyz * float3(_777.w))) * float3(5.5555553436279296875), _782.xyz * float3(_782.w)) * float3(0.180000007152557373046875), float3(1.0) / (_787.xyz * float3(_787.w))), _792.xyz * float3(_792.w), _797.xyz + float3(_797.w)), float3(1.0 - _830), fma(pow(pow(fast::max(float3(0.0), mix(_798, _771, _881.xyz * float3(_881.w))) * float3(5.5555553436279296875), _884.xyz * float3(_884.w)) * float3(0.180000007152557373046875), float3(1.0) / (_887.xyz * float3(_887.w))), _890.xyz * float3(_890.w), _893.xyz + float3(_893.w)) * float3(_830 - _878))); + float3 _932 = _931 * _575; + float3 _940 = float3(_Globals.BlueCorrection); + float3 _942 = mix(_931, _931 * ((_577 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _576), _940) * _577; + float _943 = _942.x; + float _944 = _942.y; + float _946 = _942.z; + float _949 = fast::max(fast::max(_943, _944), _946); + float _954 = (fast::max(_949, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_943, _944), _946), 1.0000000133514319600180897396058e-10)) / fast::max(_949, 0.00999999977648258209228515625); + float _967 = fma(1.75, sqrt(fma(_943, _943 - _946, fma(_946, _946 - _944, _944 * (_944 - _943)))), (_946 + _944) + _943); + float _968 = _967 * 0.3333333432674407958984375; + float _969 = _954 - 0.4000000059604644775390625; + float _974 = fast::max(1.0 - abs(_969 * 2.5), 0.0); + float _982 = fma(float(int(sign(_969 * 5.0))), fma(-_974, _974, 1.0), 1.0) * 0.02500000037252902984619140625; + float _995; + if (_968 <= 0.053333334624767303466796875) + { + _995 = _982; + } + else + { + float _994; + if (_968 >= 0.1599999964237213134765625) + { + _994 = 0.0; + } + else + { + _994 = _982 * ((0.23999999463558197021484375 / _967) - 0.5); + } + _995 = _994; + } + float3 _998 = _942 * float3(1.0 + _995); + float _999 = _998.x; + float _1000 = _998.y; + float _1002 = _998.z; + float _1016; + if ((_999 == _1000) && (_1000 == _1002)) + { + _1016 = 0.0; + } + else + { + _1016 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_1000 - _1002), fma(2.0, _999, -_1000) - _1002); + } + float _1021; + if (_1016 < 0.0) + { + _1021 = _1016 + 360.0; + } + else + { + _1021 = _1016; + } + float _1022 = fast::clamp(_1021, 0.0, 360.0); + float _1027; + if (_1022 > 180.0) + { + _1027 = _1022 - 360.0; + } + else + { + _1027 = _1022; + } + float _1031 = smoothstep(0.0, 1.0, 1.0 - abs(_1027 * 0.01481481455266475677490234375)); + _998.x = fma(((_1031 * _1031) * _954) * (0.02999999932944774627685546875 - _999), 0.180000007152557373046875, _999); + float3 _1040 = fast::max(float3(0.0), _998 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375))); + float _1049 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe; + float _1052 = 1.0 + _Globals.FilmWhiteClip; + float _1055 = _1052 - _Globals.FilmShoulder; + float _1082; + if (_Globals.FilmToe > 0.800000011920928955078125) + { + _1082 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (-0.744727432727813720703125); + } + else + { + float _1061 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1049; + _1082 = fma(log(_1061 / (2.0 - _1061)) * (-0.5), _1049 / _Globals.FilmSlope, -0.744727432727813720703125); + } + float _1087 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1082; + float _1089 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1087; + float3 _1090 = log(mix(float3(dot(_1040, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1040, float3(0.959999978542327880859375))); + float3 _1093 = _1090 * float3(0.4342944622039794921875); + float3 _1097 = float3(_Globals.FilmSlope) * fma(_1090, float3(0.4342944622039794921875), float3(_1087)); + float3 _1105 = float3(_1082); + float3 _1106 = fma(_1090, float3(0.4342944622039794921875), -_1105); + float3 _1118 = float3(_1089); + float3 _1132 = fast::clamp(_1106 / float3(_1089 - _1082), float3(0.0), float3(1.0)); + float3 _1136 = select(_1132, float3(1.0) - _1132, bool3(_1089 < _1082)); + float3 _1141 = mix(select(_1097, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1049) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1049) * _1106))), _1093 < _1105), select(_1097, float3(_1052) - (float3(2.0 * _1055) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1055) * fma(_1090, float3(0.4342944622039794921875), -_1118)))), _1093 > _1118), (fma(float3(-2.0), _1136, float3(3.0)) * _1136) * _1136); + float3 _1145 = fast::max(float3(0.0), mix(float3(dot(_1141, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1141, float3(0.930000007152557373046875))); + float3 _1215; + if (_Globals.ColorShadow_Tint2.w == 0.0) + { + float3 _1183 = fast::max(float3(0.0), float3(dot(_932, _Globals.ColorMatrixR_ColorCurveCd1.xyz), dot(_932, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz), dot(_932, _Globals.ColorMatrixB_ColorCurveCm2.xyz)) * fma(_Globals.ColorShadow_Tint2.xyz, float3(1.0 / (dot(_932, _Globals.ColorShadow_Luma.xyz) + 1.0)), _Globals.ColorShadow_Tint1.xyz)); + float3 _1188 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1183); + float3 _1190 = fast::max(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz); + _1215 = fma(fma(_1190, _Globals.ColorCurve_Ch1_Ch2.xxx, _Globals.ColorCurve_Ch1_Ch2.yyy), float3(1.0) / (_1190 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www), fma(fast::clamp(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz), _Globals.ColorMatrixB_ColorCurveCm2.www, fma(_1188 * _Globals.ColorMatrixR_ColorCurveCd1.www, float3(1.0) / (_1188 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy), _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375); + } + else + { + _1215 = fast::max(float3(0.0), mix(_1145, _1145 * ((_577 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _576), _940) * _575); + } + float3 _1216 = fast::clamp(_1215, float3(0.0), float3(1.0)); + float _1217 = _1216.x; + float _1229; + for (;;) + { + if (_1217 < 0.00313066993840038776397705078125) + { + _1229 = _1217 * 12.9200000762939453125; + break; + } + _1229 = fma(pow(_1217, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _1230 = _1216.y; + float _1242; + for (;;) + { + if (_1230 < 0.00313066993840038776397705078125) + { + _1242 = _1230 * 12.9200000762939453125; + break; + } + _1242 = fma(pow(_1230, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _1243 = _1216.z; + float _1255; + for (;;) + { + if (_1243 < 0.00313066993840038776397705078125) + { + _1255 = _1243 * 12.9200000762939453125; + break; + } + _1255 = fma(pow(_1243, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float3 _1256 = float3(_1229, _1242, _1255); + float3 _1258 = fma(_1256, float3(0.9375), float3(0.03125)); + float _1270 = fma(_1258.z, 16.0, -0.5); + float _1271 = floor(_1270); + float _1274 = _1258.x + _1271; + float _1276 = _1258.y; + float4 _1279 = Texture1.sample(Texture1Sampler, float2(_1274 * 0.0625, _1276)); + float4 _1283 = Texture1.sample(Texture1Sampler, float2(fma(_1274, 0.0625, 0.0625), _1276)); + float3 _1289 = fast::max(float3(6.1035199905745685100555419921875e-05), fma(float3(_Globals.LUTWeights[0].x), _1256, float3(_Globals.LUTWeights[1].x) * mix(_1279, _1283, float4(_1270 - _1271)).xyz)); + float3 _1295 = select(_1289 * float3(0.077399380505084991455078125), pow(fma(_1289, float3(0.94786727428436279296875), float3(0.0521326996386051177978515625)), float3(2.400000095367431640625)), _1289 > float3(0.040449999272823333740234375)); + float3 _1324 = pow(fast::max(float3(0.0), mix((fma(float3(_Globals.MappingPolynomial.x), _1295 * _1295, float3(_Globals.MappingPolynomial.y) * _1295) + float3(_Globals.MappingPolynomial.z)) * _Globals.ColorScale, _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y)); + float3 _3103; + if (_Globals.OutputDevice == 0u) + { + float _3063 = _1324.x; + float _3075; + for (;;) + { + if (_3063 < 0.00313066993840038776397705078125) + { + _3075 = _3063 * 12.9200000762939453125; + break; + } + _3075 = fma(pow(_3063, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _3076 = _1324.y; + float _3088; + for (;;) + { + if (_3076 < 0.00313066993840038776397705078125) + { + _3088 = _3076 * 12.9200000762939453125; + break; + } + _3088 = fma(pow(_3076, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + float _3089 = _1324.z; + float _3101; + for (;;) + { + if (_3089 < 0.00313066993840038776397705078125) + { + _3101 = _3089 * 12.9200000762939453125; + break; + } + _3101 = fma(pow(_3089, 0.4166666567325592041015625), 1.05499994754791259765625, -0.054999999701976776123046875); + break; + } + _3103 = float3(_3075, _3088, _3101); + } + else + { + float3 _3062; + if (_Globals.OutputDevice == 1u) + { + float3 _3055 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1324 * _573) * _602); + _3062 = fast::min(_3055 * float3(4.5), fma(pow(fast::max(_3055, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)), float3(1.09899997711181640625), float3(-0.098999999463558197021484375))); + } + else + { + float3 _3052; + if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u)) + { + float3 _2204 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _2205 = _2204.x; + float _2206 = _2204.y; + float _2208 = _2204.z; + float _2211 = fast::max(fast::max(_2205, _2206), _2208); + float _2216 = (fast::max(_2211, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2205, _2206), _2208), 1.0000000133514319600180897396058e-10)) / fast::max(_2211, 0.00999999977648258209228515625); + float _2229 = fma(1.75, sqrt(fma(_2205, _2205 - _2208, fma(_2208, _2208 - _2206, _2206 * (_2206 - _2205)))), (_2208 + _2206) + _2205); + float _2230 = _2229 * 0.3333333432674407958984375; + float _2231 = _2216 - 0.4000000059604644775390625; + float _2236 = fast::max(1.0 - abs(_2231 * 2.5), 0.0); + float _2244 = fma(float(int(sign(_2231 * 5.0))), fma(-_2236, _2236, 1.0), 1.0) * 0.02500000037252902984619140625; + float _2257; + if (_2230 <= 0.053333334624767303466796875) + { + _2257 = _2244; + } + else + { + float _2256; + if (_2230 >= 0.1599999964237213134765625) + { + _2256 = 0.0; + } + else + { + _2256 = _2244 * ((0.23999999463558197021484375 / _2229) - 0.5); + } + _2257 = _2256; + } + float3 _2260 = _2204 * float3(1.0 + _2257); + float _2261 = _2260.x; + float _2262 = _2260.y; + float _2264 = _2260.z; + float _2278; + if ((_2261 == _2262) && (_2262 == _2264)) + { + _2278 = 0.0; + } + else + { + _2278 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_2262 - _2264), fma(2.0, _2261, -_2262) - _2264); + } + float _2283; + if (_2278 < 0.0) + { + _2283 = _2278 + 360.0; + } + else + { + _2283 = _2278; + } + float _2284 = fast::clamp(_2283, 0.0, 360.0); + float _2289; + if (_2284 > 180.0) + { + _2289 = _2284 - 360.0; + } + else + { + _2289 = _2284; + } + float _2339; + if ((_2289 > (-67.5)) && (_2289 < 67.5)) + { + float _2295 = _2289 - (-67.5); + int _2297 = int(_2295 * 0.0296296291053295135498046875); + float _2299 = fma(_2295, 0.0296296291053295135498046875, -float(_2297)); + float _2300 = _2299 * _2299; + float _2301 = _2300 * _2299; + float _2338; + if (_2297 == 3) + { + _2338 = fma(_2299, -0.5, fma(_2301, -0.16666667163372039794921875, _2300 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2331; + if (_2297 == 2) + { + _2331 = fma(_2301, 0.5, _2300 * (-1.0)) + 0.666666686534881591796875; + } + else + { + float _2326; + if (_2297 == 1) + { + _2326 = fma(_2299, 0.5, fma(_2301, -0.5, _2300 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2319; + if (_2297 == 0) + { + _2319 = _2301 * 0.16666667163372039794921875; + } + else + { + _2319 = 0.0; + } + _2326 = _2319; + } + _2331 = _2326; + } + _2338 = _2331; + } + _2339 = _2338; + } + else + { + _2339 = 0.0; + } + _2260.x = fma(((_2339 * 1.5) * _2216) * (0.02999999932944774627685546875 - _2261), 0.180000007152557373046875, _2261); + float3 _2349 = fast::clamp(fast::clamp(_2260, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _2352 = mix(float3(dot(_2349, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2349, float3(0.959999978542327880859375)); + float _2353 = _2352.x; + float _2361 = log((_2353 <= 0.0) ? 6.103515625e-05 : _2353); + float _2362 = _2361 * 0.4342944622039794921875; + float _2431; + if (_2362 <= (-5.2601776123046875)) + { + _2431 = -4.0; + } + else + { + float _2428; + if ((_2362 > (-5.2601776123046875)) && (_2362 < (-0.744727432727813720703125))) + { + float _2408 = fma(_2361, 0.4342944622039794921875, 5.2601776123046875); + int _2412 = int(_2408 * 0.6643855571746826171875); + float _2414 = fma(_2408, 0.6643855571746826171875, -float(_2412)); + _2428 = dot(float3(_2414 * _2414, _2414, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2412], _499[_2412 + 1], _499[_2412 + 2])); + } + else + { + float _2407; + if ((_2362 >= (-0.744727432727813720703125)) && (_2362 < 4.673812389373779296875)) + { + float _2387 = fma(_2361, 0.4342944622039794921875, 0.744727432727813720703125); + int _2391 = int(_2387 * 0.55365467071533203125); + float _2393 = fma(_2387, 0.55365467071533203125, -float(_2391)); + _2407 = dot(float3(_2393 * _2393, _2393, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2391], _500[_2391 + 1], _500[_2391 + 2])); + } + else + { + _2407 = 4.0; + } + _2428 = _2407; + } + _2431 = _2428; + } + float _2434 = _2352.y; + float _2437 = log((_2434 <= 0.0) ? 6.103515625e-05 : _2434); + float _2438 = _2437 * 0.4342944622039794921875; + float _2505; + if (_2438 <= (-5.2601776123046875)) + { + _2505 = -4.0; + } + else + { + float _2502; + if ((_2438 > (-5.2601776123046875)) && (_2438 < (-0.744727432727813720703125))) + { + float _2482 = fma(_2437, 0.4342944622039794921875, 5.2601776123046875); + int _2486 = int(_2482 * 0.6643855571746826171875); + float _2488 = fma(_2482, 0.6643855571746826171875, -float(_2486)); + _2502 = dot(float3(_2488 * _2488, _2488, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2486], _499[_2486 + 1], _499[_2486 + 2])); + } + else + { + float _2481; + if ((_2438 >= (-0.744727432727813720703125)) && (_2438 < 4.673812389373779296875)) + { + float _2461 = fma(_2437, 0.4342944622039794921875, 0.744727432727813720703125); + int _2465 = int(_2461 * 0.55365467071533203125); + float _2467 = fma(_2461, 0.55365467071533203125, -float(_2465)); + _2481 = dot(float3(_2467 * _2467, _2467, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2465], _500[_2465 + 1], _500[_2465 + 2])); + } + else + { + _2481 = 4.0; + } + _2502 = _2481; + } + _2505 = _2502; + } + float _2508 = _2352.z; + float _2511 = log((_2508 <= 0.0) ? 6.103515625e-05 : _2508); + float _2512 = _2511 * 0.4342944622039794921875; + float _2579; + if (_2512 <= (-5.2601776123046875)) + { + _2579 = -4.0; + } + else + { + float _2576; + if ((_2512 > (-5.2601776123046875)) && (_2512 < (-0.744727432727813720703125))) + { + float _2556 = fma(_2511, 0.4342944622039794921875, 5.2601776123046875); + int _2560 = int(_2556 * 0.6643855571746826171875); + float _2562 = fma(_2556, 0.6643855571746826171875, -float(_2560)); + _2576 = dot(float3(_2562 * _2562, _2562, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2560], _499[_2560 + 1], _499[_2560 + 2])); + } + else + { + float _2555; + if ((_2512 >= (-0.744727432727813720703125)) && (_2512 < 4.673812389373779296875)) + { + float _2535 = fma(_2511, 0.4342944622039794921875, 0.744727432727813720703125); + int _2539 = int(_2535 * 0.55365467071533203125); + float _2541 = fma(_2535, 0.55365467071533203125, -float(_2539)); + _2555 = dot(float3(_2541 * _2541, _2541, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2539], _500[_2539 + 1], _500[_2539 + 2])); + } + else + { + _2555 = 4.0; + } + _2576 = _2555; + } + _2579 = _2576; + } + float3 _2583 = (float3(pow(10.0, _2431), pow(10.0, _2505), pow(10.0, _2579)) * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _2787 = _2583.x; + float _2790 = log((_2787 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2787); + float _2791 = _2790 * 0.4342944622039794921875; + float _2870; + if (_2791 <= (-3.84832763671875)) + { + _2870 = fma(_2790, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _2862; + if ((_2791 > (-3.84832763671875)) && (_2791 < 0.68124115467071533203125)) + { + float _2845 = (7.0 * fma(_2790, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2846 = int(_2845); + float _2848 = _2845 - float(_2846); + _2862 = dot(float3(_2848 * _2848, _2848, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2846], _503[_2846 + 1], _503[_2846 + 2])); + } + else + { + float _2841; + if ((_2791 >= 0.68124115467071533203125) && (_2791 < 3.65370273590087890625)) + { + float _2824 = (7.0 * fma(_2790, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2825 = int(_2824); + float _2827 = _2824 - float(_2825); + _2841 = dot(float3(_2827 * _2827, _2827, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2825], _504[_2825 + 1], _504[_2825 + 2])); + } + else + { + _2841 = fma(_2790, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _2862 = _2841; + } + _2870 = _2862; + } + float _2873 = _2583.y; + float _2876 = log((_2873 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2873); + float _2877 = _2876 * 0.4342944622039794921875; + float _2954; + if (_2877 <= (-3.84832763671875)) + { + _2954 = fma(_2876, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _2946; + if ((_2877 > (-3.84832763671875)) && (_2877 < 0.68124115467071533203125)) + { + float _2929 = (7.0 * fma(_2876, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2930 = int(_2929); + float _2932 = _2929 - float(_2930); + _2946 = dot(float3(_2932 * _2932, _2932, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2930], _503[_2930 + 1], _503[_2930 + 2])); + } + else + { + float _2925; + if ((_2877 >= 0.68124115467071533203125) && (_2877 < 3.65370273590087890625)) + { + float _2908 = (7.0 * fma(_2876, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2909 = int(_2908); + float _2911 = _2908 - float(_2909); + _2925 = dot(float3(_2911 * _2911, _2911, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2909], _504[_2909 + 1], _504[_2909 + 2])); + } + else + { + _2925 = fma(_2876, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _2946 = _2925; + } + _2954 = _2946; + } + float _2957 = _2583.z; + float _2960 = log((_2957 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2957); + float _2961 = _2960 * 0.4342944622039794921875; + float _3038; + if (_2961 <= (-3.84832763671875)) + { + _3038 = fma(_2960, 1.3028833866119384765625, fma(8.86110210418701171875, 1.3028833866119384765625, -4.0)); + } + else + { + float _3030; + if ((_2961 > (-3.84832763671875)) && (_2961 < 0.68124115467071533203125)) + { + float _3013 = (7.0 * fma(_2960, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _3014 = int(_3013); + float _3016 = _3013 - float(_3014); + _3030 = dot(float3(_3016 * _3016, _3016, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_3014], _503[_3014 + 1], _503[_3014 + 2])); + } + else + { + float _3009; + if ((_2961 >= 0.68124115467071533203125) && (_2961 < 3.65370273590087890625)) + { + float _2992 = (7.0 * fma(_2960, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.4129619598388671875, 0.4342944622039794921875, -0.68124115467071533203125); + int _2993 = int(_2992); + float _2995 = _2992 - float(_2993); + _3009 = dot(float3(_2995 * _2995, _2995, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2993], _504[_2993 + 1], _504[_2993 + 2])); + } + else + { + _3009 = fma(_2960, 0.026057668030261993408203125, fma(-8.4129619598388671875, 0.026057668030261993408203125, 3.0)); + } + _3030 = _3009; + } + _3038 = _3030; + } + float3 _3044 = pow(((float3(pow(10.0, _2870), pow(10.0, _2954), pow(10.0, _3038)) - float3(3.5073844628641381859779357910156e-05)) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _3052 = pow(fma(float3(18.8515625), _3044, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _3044, float3(1.0))), float3(78.84375)); + } + else + { + float3 _2201; + if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u)) + { + float3 _1369 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _1370 = _1369.x; + float _1371 = _1369.y; + float _1373 = _1369.z; + float _1376 = fast::max(fast::max(_1370, _1371), _1373); + float _1381 = (fast::max(_1376, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1370, _1371), _1373), 1.0000000133514319600180897396058e-10)) / fast::max(_1376, 0.00999999977648258209228515625); + float _1394 = fma(1.75, sqrt(fma(_1370, _1370 - _1373, fma(_1373, _1373 - _1371, _1371 * (_1371 - _1370)))), (_1373 + _1371) + _1370); + float _1395 = _1394 * 0.3333333432674407958984375; + float _1396 = _1381 - 0.4000000059604644775390625; + float _1401 = fast::max(1.0 - abs(_1396 * 2.5), 0.0); + float _1409 = fma(float(int(sign(_1396 * 5.0))), fma(-_1401, _1401, 1.0), 1.0) * 0.02500000037252902984619140625; + float _1422; + if (_1395 <= 0.053333334624767303466796875) + { + _1422 = _1409; + } + else + { + float _1421; + if (_1395 >= 0.1599999964237213134765625) + { + _1421 = 0.0; + } + else + { + _1421 = _1409 * ((0.23999999463558197021484375 / _1394) - 0.5); + } + _1422 = _1421; + } + float3 _1425 = _1369 * float3(1.0 + _1422); + float _1426 = _1425.x; + float _1427 = _1425.y; + float _1429 = _1425.z; + float _1443; + if ((_1426 == _1427) && (_1427 == _1429)) + { + _1443 = 0.0; + } + else + { + _1443 = 57.2957763671875 * precise::atan2(1.73205077648162841796875 * (_1427 - _1429), fma(2.0, _1426, -_1427) - _1429); + } + float _1448; + if (_1443 < 0.0) + { + _1448 = _1443 + 360.0; + } + else + { + _1448 = _1443; + } + float _1449 = fast::clamp(_1448, 0.0, 360.0); + float _1454; + if (_1449 > 180.0) + { + _1454 = _1449 - 360.0; + } + else + { + _1454 = _1449; + } + float _1504; + if ((_1454 > (-67.5)) && (_1454 < 67.5)) + { + float _1460 = _1454 - (-67.5); + int _1462 = int(_1460 * 0.0296296291053295135498046875); + float _1464 = fma(_1460, 0.0296296291053295135498046875, -float(_1462)); + float _1465 = _1464 * _1464; + float _1466 = _1465 * _1464; + float _1503; + if (_1462 == 3) + { + _1503 = fma(_1464, -0.5, fma(_1466, -0.16666667163372039794921875, _1465 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1496; + if (_1462 == 2) + { + _1496 = fma(_1466, 0.5, _1465 * (-1.0)) + 0.666666686534881591796875; + } + else + { + float _1491; + if (_1462 == 1) + { + _1491 = fma(_1464, 0.5, fma(_1466, -0.5, _1465 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1484; + if (_1462 == 0) + { + _1484 = _1466 * 0.16666667163372039794921875; + } + else + { + _1484 = 0.0; + } + _1491 = _1484; + } + _1496 = _1491; + } + _1503 = _1496; + } + _1504 = _1503; + } + else + { + _1504 = 0.0; + } + _1425.x = fma(((_1504 * 1.5) * _1381) * (0.02999999932944774627685546875 - _1426), 0.180000007152557373046875, _1426); + float3 _1514 = fast::clamp(fast::clamp(_1425, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _1517 = mix(float3(dot(_1514, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1514, float3(0.959999978542327880859375)); + float _1518 = _1517.x; + float _1526 = log((_1518 <= 0.0) ? 6.103515625e-05 : _1518); + float _1527 = _1526 * 0.4342944622039794921875; + float _1596; + if (_1527 <= (-5.2601776123046875)) + { + _1596 = -4.0; + } + else + { + float _1593; + if ((_1527 > (-5.2601776123046875)) && (_1527 < (-0.744727432727813720703125))) + { + float _1573 = fma(_1526, 0.4342944622039794921875, 5.2601776123046875); + int _1577 = int(_1573 * 0.6643855571746826171875); + float _1579 = fma(_1573, 0.6643855571746826171875, -float(_1577)); + _1593 = dot(float3(_1579 * _1579, _1579, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1577], _499[_1577 + 1], _499[_1577 + 2])); + } + else + { + float _1572; + if ((_1527 >= (-0.744727432727813720703125)) && (_1527 < 4.673812389373779296875)) + { + float _1552 = fma(_1526, 0.4342944622039794921875, 0.744727432727813720703125); + int _1556 = int(_1552 * 0.55365467071533203125); + float _1558 = fma(_1552, 0.55365467071533203125, -float(_1556)); + _1572 = dot(float3(_1558 * _1558, _1558, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1556], _500[_1556 + 1], _500[_1556 + 2])); + } + else + { + _1572 = 4.0; + } + _1593 = _1572; + } + _1596 = _1593; + } + float _1599 = _1517.y; + float _1602 = log((_1599 <= 0.0) ? 6.103515625e-05 : _1599); + float _1603 = _1602 * 0.4342944622039794921875; + float _1670; + if (_1603 <= (-5.2601776123046875)) + { + _1670 = -4.0; + } + else + { + float _1667; + if ((_1603 > (-5.2601776123046875)) && (_1603 < (-0.744727432727813720703125))) + { + float _1647 = fma(_1602, 0.4342944622039794921875, 5.2601776123046875); + int _1651 = int(_1647 * 0.6643855571746826171875); + float _1653 = fma(_1647, 0.6643855571746826171875, -float(_1651)); + _1667 = dot(float3(_1653 * _1653, _1653, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1651], _499[_1651 + 1], _499[_1651 + 2])); + } + else + { + float _1646; + if ((_1603 >= (-0.744727432727813720703125)) && (_1603 < 4.673812389373779296875)) + { + float _1626 = fma(_1602, 0.4342944622039794921875, 0.744727432727813720703125); + int _1630 = int(_1626 * 0.55365467071533203125); + float _1632 = fma(_1626, 0.55365467071533203125, -float(_1630)); + _1646 = dot(float3(_1632 * _1632, _1632, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1630], _500[_1630 + 1], _500[_1630 + 2])); + } + else + { + _1646 = 4.0; + } + _1667 = _1646; + } + _1670 = _1667; + } + float _1673 = _1517.z; + float _1676 = log((_1673 <= 0.0) ? 6.103515625e-05 : _1673); + float _1677 = _1676 * 0.4342944622039794921875; + float _1744; + if (_1677 <= (-5.2601776123046875)) + { + _1744 = -4.0; + } + else + { + float _1741; + if ((_1677 > (-5.2601776123046875)) && (_1677 < (-0.744727432727813720703125))) + { + float _1721 = fma(_1676, 0.4342944622039794921875, 5.2601776123046875); + int _1725 = int(_1721 * 0.6643855571746826171875); + float _1727 = fma(_1721, 0.6643855571746826171875, -float(_1725)); + _1741 = dot(float3(_1727 * _1727, _1727, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1725], _499[_1725 + 1], _499[_1725 + 2])); + } + else + { + float _1720; + if ((_1677 >= (-0.744727432727813720703125)) && (_1677 < 4.673812389373779296875)) + { + float _1700 = fma(_1676, 0.4342944622039794921875, 0.744727432727813720703125); + int _1704 = int(_1700 * 0.55365467071533203125); + float _1706 = fma(_1700, 0.55365467071533203125, -float(_1704)); + _1720 = dot(float3(_1706 * _1706, _1706, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1704], _500[_1704 + 1], _500[_1704 + 2])); + } + else + { + _1720 = 4.0; + } + _1741 = _1720; + } + _1744 = _1741; + } + float3 _1748 = (float3(pow(10.0, _1596), pow(10.0, _1670), pow(10.0, _1744)) * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _1952 = _1748.x; + float _1955 = log((_1952 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1952); + float _1956 = _1955 * 0.4342944622039794921875; + float _2030; + if (_1956 <= (-3.84832763671875)) + { + _2030 = -2.3010299205780029296875; + } + else + { + float _2027; + if ((_1956 > (-3.84832763671875)) && (_1956 < 0.68124115467071533203125)) + { + float _2010 = (7.0 * fma(_1955, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2011 = int(_2010); + float _2013 = _2010 - float(_2011); + _2027 = dot(float3(_2013 * _2013, _2013, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2011], _506[_2011 + 1], _506[_2011 + 2])); + } + else + { + float _2006; + if ((_1956 >= 0.68124115467071533203125) && (_1956 < 3.761315822601318359375)) + { + float _1989 = (7.0 * fma(_1955, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _1990 = int(_1989); + float _1992 = _1989 - float(_1990); + _2006 = dot(float3(_1992 * _1992, _1992, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_1990], _507[_1990 + 1], _507[_1990 + 2])); + } + else + { + _2006 = fma(_1955, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _2027 = _2006; + } + _2030 = _2027; + } + float _2033 = _1748.y; + float _2036 = log((_2033 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2033); + float _2037 = _2036 * 0.4342944622039794921875; + float _2109; + if (_2037 <= (-3.84832763671875)) + { + _2109 = -2.3010299205780029296875; + } + else + { + float _2106; + if ((_2037 > (-3.84832763671875)) && (_2037 < 0.68124115467071533203125)) + { + float _2089 = (7.0 * fma(_2036, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2090 = int(_2089); + float _2092 = _2089 - float(_2090); + _2106 = dot(float3(_2092 * _2092, _2092, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2090], _506[_2090 + 1], _506[_2090 + 2])); + } + else + { + float _2085; + if ((_2037 >= 0.68124115467071533203125) && (_2037 < 3.761315822601318359375)) + { + float _2068 = (7.0 * fma(_2036, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _2069 = int(_2068); + float _2071 = _2068 - float(_2069); + _2085 = dot(float3(_2071 * _2071, _2071, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2069], _507[_2069 + 1], _507[_2069 + 2])); + } + else + { + _2085 = fma(_2036, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _2106 = _2085; + } + _2109 = _2106; + } + float _2112 = _1748.z; + float _2115 = log((_2112 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2112); + float _2116 = _2115 * 0.4342944622039794921875; + float _2188; + if (_2116 <= (-3.84832763671875)) + { + _2188 = -2.3010299205780029296875; + } + else + { + float _2185; + if ((_2116 > (-3.84832763671875)) && (_2116 < 0.68124115467071533203125)) + { + float _2168 = (7.0 * fma(_2115, 0.4342944622039794921875, 3.84832763671875)) / fma(1.56861579418182373046875, 0.4342944622039794921875, 3.84832763671875); + int _2169 = int(_2168); + float _2171 = _2168 - float(_2169); + _2185 = dot(float3(_2171 * _2171, _2171, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2169], _506[_2169 + 1], _506[_2169 + 2])); + } + else + { + float _2164; + if ((_2116 >= 0.68124115467071533203125) && (_2116 < 3.761315822601318359375)) + { + float _2147 = (7.0 * fma(_2115, 0.4342944622039794921875, -0.68124115467071533203125)) / fma(8.66075038909912109375, 0.4342944622039794921875, -0.68124115467071533203125); + int _2148 = int(_2147); + float _2150 = _2147 - float(_2148); + _2164 = dot(float3(_2150 * _2150, _2150, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2148], _507[_2148 + 1], _507[_2148 + 2])); + } + else + { + _2164 = fma(_2115, 0.05211533606052398681640625, fma(-8.66075038909912109375, 0.05211533606052398681640625, 3.3010299205780029296875)); + } + _2185 = _2164; + } + _2188 = _2185; + } + float3 _2193 = pow((float3(pow(10.0, _2030), pow(10.0, _2109), pow(10.0, _2188)) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2201 = pow(fma(float3(18.8515625), _2193, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _2193, float3(1.0))), float3(78.84375)); + } + else + { + float3 _1366; + if (_Globals.OutputDevice == 7u) + { + float3 _1358 = pow(((_932 * _573) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _1366 = pow(fma(float3(18.8515625), _1358, float3(0.8359375)) * (float3(1.0) / fma(float3(18.6875), _1358, float3(1.0))), float3(78.84375)); + } + else + { + _1366 = pow((_1324 * _573) * _602, float3(_Globals.InverseGamma.z)); + } + _2201 = _1366; + } + _3052 = _2201; + } + _3062 = _3052; + } + _3103 = _3062; + } + float3 _3104 = _3103 * float3(0.95238101482391357421875); + float4 _3105 = float4(_3104.x, _3104.y, _3104.z, float4(0.0).w); + _3105.w = 0.0; + out.out_var_SV_Target0 = _3105; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag new file mode 100644 index 0000000000..790ad27a1d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag @@ -0,0 +1,503 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_TranslucentBasePass +{ + uint TranslucentBasePass_Shared_Forward_NumLocalLights; + uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures; + uint TranslucentBasePass_Shared_Forward_HasDirectionalLight; + uint TranslucentBasePass_Shared_Forward_NumGridCells; + packed_int3 TranslucentBasePass_Shared_Forward_CulledGridSize; + uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell; + uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift; + uint PrePadding_TranslucentBasePass_Shared_Forward_36; + uint PrePadding_TranslucentBasePass_Shared_Forward_40; + uint PrePadding_TranslucentBasePass_Shared_Forward_44; + packed_float3 TranslucentBasePass_Shared_Forward_LightGridZParams; + float PrePadding_TranslucentBasePass_Shared_Forward_60; + packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection; + float PrePadding_TranslucentBasePass_Shared_Forward_76; + packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor; + float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity; + uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask; + uint PrePadding_TranslucentBasePass_Shared_Forward_100; + float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD; + uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades; + uint PrePadding_TranslucentBasePass_Shared_Forward_116; + uint PrePadding_TranslucentBasePass_Shared_Forward_120; + uint PrePadding_TranslucentBasePass_Shared_Forward_124; + float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths; + float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4]; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4]; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize; + float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias; + uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing; + uint PrePadding_TranslucentBasePass_Shared_Forward_488; + uint PrePadding_TranslucentBasePass_Shared_Forward_492; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize; + float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_576; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_580; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_584; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_588; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_592; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_596; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_600; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_604; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_608; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_612; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_616; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_620; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_624; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_628; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_632; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_636; + uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights; + uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures; + uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight; + uint TranslucentBasePass_Shared_ForwardISR_NumGridCells; + packed_int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize; + uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell; + uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684; + packed_float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_700; + packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_716; + packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor; + float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity; + uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740; + float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD; + uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764; + float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths; + float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4]; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4]; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize; + float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias; + uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1128; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1132; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize; + float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow; + float PrePadding_TranslucentBasePass_Shared_Reflection_1216; + float PrePadding_TranslucentBasePass_Shared_Reflection_1220; + float PrePadding_TranslucentBasePass_Shared_Reflection_1224; + float PrePadding_TranslucentBasePass_Shared_Reflection_1228; + float PrePadding_TranslucentBasePass_Shared_Reflection_1232; + float PrePadding_TranslucentBasePass_Shared_Reflection_1236; + float PrePadding_TranslucentBasePass_Shared_Reflection_1240; + float PrePadding_TranslucentBasePass_Shared_Reflection_1244; + float PrePadding_TranslucentBasePass_Shared_Reflection_1248; + float PrePadding_TranslucentBasePass_Shared_Reflection_1252; + float PrePadding_TranslucentBasePass_Shared_Reflection_1256; + float PrePadding_TranslucentBasePass_Shared_Reflection_1260; + float PrePadding_TranslucentBasePass_Shared_Reflection_1264; + float PrePadding_TranslucentBasePass_Shared_Reflection_1268; + float PrePadding_TranslucentBasePass_Shared_Reflection_1272; + float PrePadding_TranslucentBasePass_Shared_Reflection_1276; + float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters; + float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356; + float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis; + float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix; + packed_float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1484; + float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1496; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500; + float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2]; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2]; + float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound; + uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo; + float PrePadding_TranslucentBasePass_Shared_Fog_1676; + float PrePadding_TranslucentBasePass_Shared_Fog_1680; + float PrePadding_TranslucentBasePass_Shared_Fog_1684; + float PrePadding_TranslucentBasePass_Shared_Fog_1688; + float PrePadding_TranslucentBasePass_Shared_Fog_1692; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3; + float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection; + float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor; + float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation; + float PrePadding_TranslucentBasePass_Shared_Fog_1800; + float PrePadding_TranslucentBasePass_Shared_Fog_1804; + packed_float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters; + float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog; + float PrePadding_TranslucentBasePass_1824; + float PrePadding_TranslucentBasePass_1828; + float PrePadding_TranslucentBasePass_1832; + float PrePadding_TranslucentBasePass_1836; + float PrePadding_TranslucentBasePass_1840; + float PrePadding_TranslucentBasePass_1844; + float PrePadding_TranslucentBasePass_1848; + float PrePadding_TranslucentBasePass_1852; + float PrePadding_TranslucentBasePass_1856; + float PrePadding_TranslucentBasePass_1860; + float PrePadding_TranslucentBasePass_1864; + float PrePadding_TranslucentBasePass_1868; + float PrePadding_TranslucentBasePass_1872; + float PrePadding_TranslucentBasePass_1876; + float PrePadding_TranslucentBasePass_1880; + float PrePadding_TranslucentBasePass_1884; + float PrePadding_TranslucentBasePass_1888; + float PrePadding_TranslucentBasePass_1892; + float PrePadding_TranslucentBasePass_1896; + float PrePadding_TranslucentBasePass_1900; + float PrePadding_TranslucentBasePass_1904; + float PrePadding_TranslucentBasePass_1908; + float PrePadding_TranslucentBasePass_1912; + float PrePadding_TranslucentBasePass_1916; + float PrePadding_TranslucentBasePass_1920; + float PrePadding_TranslucentBasePass_1924; + float PrePadding_TranslucentBasePass_1928; + float PrePadding_TranslucentBasePass_1932; + float PrePadding_TranslucentBasePass_1936; + float PrePadding_TranslucentBasePass_1940; + float PrePadding_TranslucentBasePass_1944; + float PrePadding_TranslucentBasePass_1948; + float PrePadding_TranslucentBasePass_1952; + float PrePadding_TranslucentBasePass_1956; + float PrePadding_TranslucentBasePass_1960; + float PrePadding_TranslucentBasePass_1964; + float PrePadding_TranslucentBasePass_1968; + float PrePadding_TranslucentBasePass_1972; + float PrePadding_TranslucentBasePass_1976; + float PrePadding_TranslucentBasePass_1980; + float PrePadding_TranslucentBasePass_1984; + float PrePadding_TranslucentBasePass_1988; + float PrePadding_TranslucentBasePass_1992; + float PrePadding_TranslucentBasePass_1996; + float PrePadding_TranslucentBasePass_2000; + float PrePadding_TranslucentBasePass_2004; + float PrePadding_TranslucentBasePass_2008; + float PrePadding_TranslucentBasePass_2012; + float PrePadding_TranslucentBasePass_2016; + float PrePadding_TranslucentBasePass_2020; + float PrePadding_TranslucentBasePass_2024; + float PrePadding_TranslucentBasePass_2028; + float PrePadding_TranslucentBasePass_2032; + float PrePadding_TranslucentBasePass_2036; + float PrePadding_TranslucentBasePass_2040; + float PrePadding_TranslucentBasePass_2044; + float PrePadding_TranslucentBasePass_2048; + float PrePadding_TranslucentBasePass_2052; + float PrePadding_TranslucentBasePass_2056; + float PrePadding_TranslucentBasePass_2060; + float PrePadding_TranslucentBasePass_2064; + float PrePadding_TranslucentBasePass_2068; + float PrePadding_TranslucentBasePass_2072; + float PrePadding_TranslucentBasePass_2076; + float PrePadding_TranslucentBasePass_2080; + float PrePadding_TranslucentBasePass_2084; + float PrePadding_TranslucentBasePass_2088; + float PrePadding_TranslucentBasePass_2092; + float PrePadding_TranslucentBasePass_2096; + float PrePadding_TranslucentBasePass_2100; + float PrePadding_TranslucentBasePass_2104; + float PrePadding_TranslucentBasePass_2108; + float PrePadding_TranslucentBasePass_2112; + float PrePadding_TranslucentBasePass_2116; + float PrePadding_TranslucentBasePass_2120; + float PrePadding_TranslucentBasePass_2124; + float PrePadding_TranslucentBasePass_2128; + float PrePadding_TranslucentBasePass_2132; + float PrePadding_TranslucentBasePass_2136; + float PrePadding_TranslucentBasePass_2140; + float4 TranslucentBasePass_HZBUvFactorAndInvFactor; + float4 TranslucentBasePass_PrevScreenPositionScaleBias; + float TranslucentBasePass_PrevSceneColorPreExposureInv; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[2]; + float4 Material_ScalarExpressions[1]; +}; + +constant float _108 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 in_var_TEXCOORD11_centroid [[user(locn1)]]; + uint in_var_PRIMITIVE_ID [[user(locn2)]]; + float4 in_var_TEXCOORD7 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], constant type_TranslucentBasePass& TranslucentBasePass [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture3d TranslucentBasePass_Shared_Fog_IntegratedLightScattering [[texture(0)]], sampler View_SharedBilinearClampedSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleMaskIn [[sample_mask]]) +{ + main0_out out = {}; + float4 _137 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0); + float3 _142 = (_137.xyz / float3(_137.w)) - float3(View.View_PreViewTranslation); + bool _165 = TranslucentBasePass.TranslucentBasePass_Shared_Fog_ApplyVolumetricFog > 0.0; + float4 _215; + if (_165) + { + float4 _172 = View.View_WorldToClip * float4(_142, 1.0); + float _173 = _172.w; + float4 _202; + if (_165) + { + _202 = TranslucentBasePass_Shared_Fog_IntegratedLightScattering.sample(View_SharedBilinearClampedSampler, float3(fma((_172.xy / float2(_173)).xy, float2(0.5, -0.5), float2(0.5)), (log2(fma(_173, View.View_VolumetricFogGridZParams[0], View.View_VolumetricFogGridZParams[1])) * View.View_VolumetricFogGridZParams[2]) * View.View_VolumetricFogInvGridSize[2]), level(0.0)); + } + else + { + _202 = float4(0.0, 0.0, 0.0, 1.0); + } + _215 = float4(fma(in.in_var_TEXCOORD7.xyz, float3(_202.w), _202.xyz), _202.w * in.in_var_TEXCOORD7.w); + } + else + { + _215 = in.in_var_TEXCOORD7; + } + float3 _216 = fast::max(Material.Material_VectorExpressions[1].xyz * float3(fma(1.0 + dot(float3(-0.2857142984867095947265625, -0.4285714328289031982421875, 0.857142865657806396484375), fast::normalize(float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz) * fast::normalize(fma(float3(0.0, 0.0, 1.0), float3(View.View_NormalOverrideParameter.w), View.View_NormalOverrideParameter.xyz)))), 0.5, 0.20000000298023223876953125)), float3(0.0)); + float3 _246; + if (View.View_OutOfBoundsMask > 0.0) + { + uint _222 = in.in_var_PRIMITIVE_ID * 26u; + float3 _245; + if (any(abs(_142 - View_PrimitiveSceneData._m0[_222 + 5u].xyz) > (View_PrimitiveSceneData._m0[_222 + 19u].xyz + float3(1.0)))) + { + _245 = mix(float3(1.0, 1.0, 0.0), float3(0.0, 1.0, 1.0), float3(float3(fract(dot(_142, float3(0.57700002193450927734375)) * 0.00200000009499490261077880859375)) > float3(0.5))); + } + else + { + _245 = _216; + } + _246 = _245; + } + else + { + _246 = _216; + } + float4 _255 = float4(fma(_246, float3(_215.w), _215.xyz), _108); + _255.w = 1.0; + float4 _268; + uint _269; + if (View.View_NumSceneColorMSAASamples > 1) + { + _268 = _255 * float4(float(View.View_NumSceneColorMSAASamples) * 0.25); + _269 = gl_SampleMaskIn & 15u; + } + else + { + _268 = _255; + _269 = gl_SampleMaskIn; + } + out.out_var_SV_Target0 = _268; + out.gl_SampleMask = _269; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..6a7f419a5f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((fma(gl_FragCoord.xy, View.View_BufferSizeAndInvSize.zw, -View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(fma(fast::clamp(fma(ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx, float3(_Globals.SoftTransitionScale.z), -float3(fma(fast::min(_82.z, 0.999989986419677734375), _Globals.SoftTransitionScale.z, -1.0))), float3(0.0), float3(1.0)).x - 0.5, _Globals.ShadowSharpen, 0.5), 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _128 = float4(_127.x, _127.y, _127.z, _58.w); + _128.w = 0.0; + out.out_var_SV_Target0 = _128; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..6a7f419a5f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((fma(gl_FragCoord.xy, View.View_BufferSizeAndInvSize.zw, -View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(fma(fast::clamp(fma(ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx, float3(_Globals.SoftTransitionScale.z), -float3(fma(fast::min(_82.z, 0.999989986419677734375), _Globals.SoftTransitionScale.z, -1.0))), float3(0.0), float3(1.0)).x - 0.5, _Globals.ShadowSharpen, 0.5), 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _128 = float4(_127.x, _127.y, _127.z, _58.w); + _128.w = 0.0; + out.out_var_SV_Target0 = _128; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag new file mode 100644 index 0000000000..3c9be2985a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag @@ -0,0 +1,84 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct spvDescriptorSetBuffer0 +{ + const device type_StructuredBuffer_v4float* CulledObjectBoxBounds [[id(0)]]; + constant type_Globals* _Globals [[id(1)]]; + texture2d RWShadowTileNumCulledObjects [[id(2)]]; + device atomic_uint* RWShadowTileNumCulledObjects_atomic [[id(3)]]; +}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float(((*spvDescriptorSet0._Globals).ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2((*spvDescriptorSet0._Globals).ShadowTileListGroupSize); + float2 _96 = fma(_91 / _93, float2(2.0), float2(-1.0)); + float2 _100 = fma((_91 + float2(1.0)) / _93, float2(2.0), float2(-1.0)); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xy > _96.xy) && all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz < _101)) + { + float3 _120 = (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz + (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xyz; + float _122 = _96.x; + float _123 = _96.y; + float _126 = _100.x; + float _129 = _100.y; + float3 _166 = fma(float3(-0.5), _120, float3(_122, _123, -1000.0)); + float3 _170 = float3(dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _189 = fma(float3(-0.5), _120, float3(_126, _123, -1000.0)); + float3 _193 = float3(dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_189, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _205 = fma(float3(-0.5), _120, float3(_122, _129, -1000.0)); + float3 _209 = float3(dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_205, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _221 = fma(float3(-0.5), _120, float3(_126, _129, -1000.0)); + float3 _225 = float3(dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_221, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _237 = fma(float3(-0.5), _120, float3(_122, _123, 1.0)); + float3 _241 = float3(dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_237, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _253 = fma(float3(-0.5), _120, float3(_126, _123, 1.0)); + float3 _257 = float3(dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_253, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _269 = fma(float3(-0.5), _120, float3(_122, _129, 1.0)); + float3 _273 = float3(dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_269, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + float3 _285 = fma(float3(-0.5), _120, float3(_126, _129, 1.0)); + float3 _289 = float3(dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_285, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + if (all(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(float3(500000.0), _170), _193), _209), _225), _241), _257), _273), _289) < float3(1.0)) && all(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(float3(-500000.0), _170), _193), _209), _225), _241), _257), _273), _289) > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.RWShadowTileNumCulledObjects_atomic[(_78 * (*spvDescriptorSet0._Globals).ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag new file mode 100644 index 0000000000..617bb4d0b8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(0)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = fma(_91 / _93, float2(2.0), float2(-1.0)); + float2 _100 = fma((_91 + float2(1.0)) / _93, float2(2.0), float2(-1.0)); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _101)) + { + float3 _120 = CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz; + float _122 = _96.x; + float _123 = _96.y; + float _126 = _100.x; + float _129 = _100.y; + float3 _166 = fma(float3(-0.5), _120, float3(_122, _123, -1000.0)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _189 = fma(float3(-0.5), _120, float3(_126, _123, -1000.0)); + float3 _193 = float3(dot(_189, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_189, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_189, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _205 = fma(float3(-0.5), _120, float3(_122, _129, -1000.0)); + float3 _209 = float3(dot(_205, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_205, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_205, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _221 = fma(float3(-0.5), _120, float3(_126, _129, -1000.0)); + float3 _225 = float3(dot(_221, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_221, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_221, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _237 = fma(float3(-0.5), _120, float3(_122, _123, 1.0)); + float3 _241 = float3(dot(_237, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_237, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_237, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _253 = fma(float3(-0.5), _120, float3(_126, _123, 1.0)); + float3 _257 = float3(dot(_253, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_253, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_253, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _269 = fma(float3(-0.5), _120, float3(_122, _129, 1.0)); + float3 _273 = float3(dot(_269, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_269, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_269, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + float3 _285 = fma(float3(-0.5), _120, float3(_126, _129, 1.0)); + float3 _289 = float3(dot(_285, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_285, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_285, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + if (all(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(float3(500000.0), _170), _193), _209), _225), _241), _257), _273), _289) < float3(1.0)) && all(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(float3(-500000.0), _170), _193), _209), _225), _241), _257), _273), _289) > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag new file mode 100644 index 0000000000..3f68a92f0a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag @@ -0,0 +1,77 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(0)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0]; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = fma(_91 / _93, float2(2.0), float2(-1.0)); + float2 _100 = fma((_91 + float2(1.0)) / _93, float2(2.0), float2(-1.0)); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _323 = uint(clamp(int(_103 + 1u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u)))); + if (all(CulledObjectBoxBounds._m0[_323].xy > _96.xy) && all(CulledObjectBoxBounds._m0[uint(clamp(int(_103), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz < _101)) + { + float3 _120 = CulledObjectBoxBounds._m0[uint(clamp(int(_103), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz + CulledObjectBoxBounds._m0[_323].xyz; + float _122 = _96.x; + float _123 = _96.y; + float _126 = _100.x; + float _129 = _100.y; + float3 _166 = fma(float3(-0.5), _120, float3(_122, _123, -1000.0)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_166, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_166, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _189 = fma(float3(-0.5), _120, float3(_126, _123, -1000.0)); + float3 _193 = float3(dot(_189, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_189, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_189, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _205 = fma(float3(-0.5), _120, float3(_122, _129, -1000.0)); + float3 _209 = float3(dot(_205, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_205, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_205, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _221 = fma(float3(-0.5), _120, float3(_126, _129, -1000.0)); + float3 _225 = float3(dot(_221, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_221, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_221, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _237 = fma(float3(-0.5), _120, float3(_122, _123, 1.0)); + float3 _241 = float3(dot(_237, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_237, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_237, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _253 = fma(float3(-0.5), _120, float3(_126, _123, 1.0)); + float3 _257 = float3(dot(_253, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_253, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_253, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _269 = fma(float3(-0.5), _120, float3(_122, _129, 1.0)); + float3 _273 = float3(dot(_269, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_269, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_269, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + float3 _285 = fma(float3(-0.5), _120, float3(_126, _129, 1.0)); + float3 _289 = float3(dot(_285, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 2u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_285, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 3u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz), dot(_285, CulledObjectBoxBounds._m0[uint(clamp(int(_103 + 4u), int(0u), int(min((((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u), 2147483647u))))].xyz)); + if (all(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(fast::min(float3(500000.0), _170), _193), _209), _225), _241), _257), _273), _289) < float3(1.0)) && all(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(fast::max(float3(-500000.0), _170), _193), _209), _225), _241), _257), _273), _289) > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc new file mode 100644 index 0000000000..84540d3592 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -0,0 +1,395 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; + float4 Color; + spvUnsafeArray TexCoords; + float4 LightMapCoordinate; + uint PrimitiveId; + uint LightmapDataIndex; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FSharedBasePassInterpolants +{ +}; +struct FBasePassInterpolantsVSToDS +{ + FSharedBasePassInterpolants _m0; +}; + +struct FBasePassVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + FBasePassInterpolantsVSToDS BasePassInterpolants; + float4 Position; +}; + +struct FPNTessellationHSToDS +{ + FBasePassVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +constant float4 _142 = {}; + +struct main0_out +{ + float4 out_var_COLOR0; + uint out_var_LIGHTMAP_ID; + float3 out_var_PN_DisplacementScales; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + uint out_var_PRIMITIVE_ID; + spvUnsafeArray out_var_TEXCOORD0; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_TEXCOORD4; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_COLOR0 [[attribute(2)]]; + float4 in_var_TEXCOORD0_0 [[attribute(3)]]; + float4 in_var_TEXCOORD4 [[attribute(4)]]; + uint in_var_PRIMITIVE_ID [[attribute(5)]]; + uint in_var_LIGHTMAP_ID [[attribute(6)]]; + float4 in_var_VS_To_DS_Position [[attribute(7)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _144 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _145 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _146 = spvUnsafeArray({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 }); + spvUnsafeArray, 12> _147 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0 }) }); + spvUnsafeArray _148 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD4, gl_in[1].in_var_TEXCOORD4, gl_in[2].in_var_TEXCOORD4, gl_in[3].in_var_TEXCOORD4, gl_in[4].in_var_TEXCOORD4, gl_in[5].in_var_TEXCOORD4, gl_in[6].in_var_TEXCOORD4, gl_in[7].in_var_TEXCOORD4, gl_in[8].in_var_TEXCOORD4, gl_in[9].in_var_TEXCOORD4, gl_in[10].in_var_TEXCOORD4, gl_in[11].in_var_TEXCOORD4 }); + spvUnsafeArray _149 = spvUnsafeArray({ gl_in[0].in_var_PRIMITIVE_ID, gl_in[1].in_var_PRIMITIVE_ID, gl_in[2].in_var_PRIMITIVE_ID, gl_in[3].in_var_PRIMITIVE_ID, gl_in[4].in_var_PRIMITIVE_ID, gl_in[5].in_var_PRIMITIVE_ID, gl_in[6].in_var_PRIMITIVE_ID, gl_in[7].in_var_PRIMITIVE_ID, gl_in[8].in_var_PRIMITIVE_ID, gl_in[9].in_var_PRIMITIVE_ID, gl_in[10].in_var_PRIMITIVE_ID, gl_in[11].in_var_PRIMITIVE_ID }); + spvUnsafeArray _150 = spvUnsafeArray({ gl_in[0].in_var_LIGHTMAP_ID, gl_in[1].in_var_LIGHTMAP_ID, gl_in[2].in_var_LIGHTMAP_ID, gl_in[3].in_var_LIGHTMAP_ID, gl_in[4].in_var_LIGHTMAP_ID, gl_in[5].in_var_LIGHTMAP_ID, gl_in[6].in_var_LIGHTMAP_ID, gl_in[7].in_var_LIGHTMAP_ID, gl_in[8].in_var_LIGHTMAP_ID, gl_in[9].in_var_LIGHTMAP_ID, gl_in[10].in_var_LIGHTMAP_ID, gl_in[11].in_var_LIGHTMAP_ID }); + spvUnsafeArray _259 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _284 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[0], _145[0], _146[0], _147[0], _148[0], _149[0], _150[0] } }, FBasePassInterpolantsVSToDS{ { } }, _259[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[1], _145[1], _146[1], _147[1], _148[1], _149[1], _150[1] } }, FBasePassInterpolantsVSToDS{ { } }, _259[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[2], _145[2], _146[2], _147[2], _148[2], _149[2], _150[2] } }, FBasePassInterpolantsVSToDS{ { } }, _259[2] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[3], _145[3], _146[3], _147[3], _148[3], _149[3], _150[3] } }, FBasePassInterpolantsVSToDS{ { } }, _259[3] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[4], _145[4], _146[4], _147[4], _148[4], _149[4], _150[4] } }, FBasePassInterpolantsVSToDS{ { } }, _259[4] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[5], _145[5], _146[5], _147[5], _148[5], _149[5], _150[5] } }, FBasePassInterpolantsVSToDS{ { } }, _259[5] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[6], _145[6], _146[6], _147[6], _148[6], _149[6], _150[6] } }, FBasePassInterpolantsVSToDS{ { } }, _259[6] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[7], _145[7], _146[7], _147[7], _148[7], _149[7], _150[7] } }, FBasePassInterpolantsVSToDS{ { } }, _259[7] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[8], _145[8], _146[8], _147[8], _148[8], _149[8], _150[8] } }, FBasePassInterpolantsVSToDS{ { } }, _259[8] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[9], _145[9], _146[9], _147[9], _148[9], _149[9], _150[9] } }, FBasePassInterpolantsVSToDS{ { } }, _259[9] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[10], _145[10], _146[10], _147[10], _148[10], _149[10], _150[10] } }, FBasePassInterpolantsVSToDS{ { } }, _259[10] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[11], _145[11], _146[11], _147[11], _148[11], _149[11], _150[11] } }, FBasePassInterpolantsVSToDS{ { } }, _259[11] } }); + spvUnsafeArray param_var_I = _284; + float4 _301 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _310 = View_PrimitiveSceneData._m0[(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId * 26u) + 22u].xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _313 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _314 = 2u * gl_InvocationID; + uint _315 = 3u + _314; + uint _316 = _314 + 4u; + float4 _328 = float4(param_var_I[_313].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _336 = float4(param_var_I[_315].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _344 = float4(param_var_I[_316].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _392 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_313].Position) - (float4(dot(param_var_I[_313].Position - param_var_I[gl_InvocationID].Position, _301)) * _301)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_315].Position) + param_var_I[_316].Position) - (float4(dot(param_var_I[_316].Position - param_var_I[_315].Position, _336)) * _336)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_313].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_313].Position, _328)) * _328)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_316].Position) + param_var_I[_315].Position) - (float4(dot(param_var_I[_315].Position - param_var_I[_316].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color; + gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords; + gl_out[gl_InvocationID].out_var_TEXCOORD4 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightMapCoordinate; + gl_out[gl_InvocationID].out_var_PRIMITIVE_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId; + gl_out[gl_InvocationID].out_var_LIGHTMAP_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightmapDataIndex; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_PN_POSITION = _392; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _310; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _392, _310, 1.0, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _450 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _463; + _463.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _463.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _463.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _463.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _589; + for (;;) + { + float4 _489 = View.View_ViewToClip * float4(0.0); + float4 _494 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _495 = _494.xyz; + float3 _496 = _489.xyz; + float _498 = _494.w; + float _499 = _489.w; + float4 _516 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _517 = _516.xyz; + float _519 = _516.w; + float4 _537 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _538 = _537.xyz; + float _540 = _537.w; + if (any((((int3((_495 - _496) < float3(_498 + _499)) + (int3(2) * int3((_495 + _496) > float3((-_498) - _499)))) | (int3((_517 - _496) < float3(_519 + _499)) + (int3(2) * int3((_517 + _496) > float3((-_519) - _499))))) | (int3((_538 - _496) < float3(_540 + _499)) + (int3(2) * int3((_538 + _496) > float3((-_540) - _499))))) != int3(3))) + { + _589 = float4(0.0); + break; + } + float3 _558 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _559 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _560 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _563 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _566 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _569 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _573 = sqrt(dot(_559, _559) / dot(_566, _566)); + float _577 = sqrt(dot(_560, _560) / dot(_569, _569)); + float _581 = sqrt(dot(_558, _558) / dot(_563, _563)); + float4 _582 = float4(_573, _577, _581, 1.0); + _582.w = 0.333000004291534423828125 * ((_573 + _577) + _581); + _589 = float4(View.View_AdaptiveTessellationFactor) * _582; + break; + } + float4 _591 = fast::clamp(_463 * _589, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_591.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_591.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_591.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_591.w); + patchOut.out_var_PN_POSITION9 = _450 + ((_450 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc new file mode 100644 index 0000000000..3bfbb69cde --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc @@ -0,0 +1,463 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FHitProxyVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + float4 Position; + uint VertexID; +}; + +struct FHullShaderConstantDominantVertexData +{ + float2 UV; + float4 Normal; + float3 Tangent; +}; + +struct FHullShaderConstantDominantEdgeData +{ + float2 UV0; + float2 UV1; + float4 Normal0; + float4 Normal1; + float3 Tangent0; + float3 Tangent1; +}; + +struct FPNTessellationHSToDS +{ + FHitProxyVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; + FHullShaderConstantDominantVertexData DominantVertex; + FHullShaderConstantDominantEdgeData DominantEdge; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +constant float4 _140 = {}; + +struct main0_out +{ + float3 out_var_PN_DisplacementScales; + float2 out_var_PN_DominantEdge; + float2 out_var_PN_DominantEdge1; + float4 out_var_PN_DominantEdge2; + float4 out_var_PN_DominantEdge3; + float3 out_var_PN_DominantEdge4; + float3 out_var_PN_DominantEdge5; + float2 out_var_PN_DominantVertex; + float4 out_var_PN_DominantVertex1; + float3 out_var_PN_DominantVertex2; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; + uint out_var_VS_To_DS_VertexID; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_VS_To_DS_Position [[attribute(2)]]; + uint in_var_VS_To_DS_VertexID [[attribute(3)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _142 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _143 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _192 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _193 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID }); + spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } }); + spvUnsafeArray param_var_I = _230; + float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _255 = 2u * gl_InvocationID; + uint _256 = 3u + _255; + uint _257 = _255 + 4u; + uint _264 = (_254 < 2u) ? (_254 + 1u) : 0u; + uint _265 = 2u * _254; + uint _266 = 3u + _265; + uint _267 = _265 + 4u; + float4 _279 = float4(param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _315; + float4 _316; + float4 _317; + float4 _318; + if ((param_var_I[_266].VertexID < param_var_I[_254].VertexID) || ((param_var_I[_266].VertexID == param_var_I[_254].VertexID) && (param_var_I[_267].VertexID < param_var_I[_264].VertexID))) + { + _315 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _316 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + _317 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _318 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + } + else + { + _315 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _316 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + _317 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _318 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + } + float4 _324 = float4(_318.xyz, 0.0); + float4 _328 = float4(_316.xyz, 0.0); + float4 _336 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _344 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _352 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _402 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _336)) * _336)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _352)) * _352)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_VS_To_DS_VertexID = param_var_I[gl_InvocationID].VertexID; + gl_out[gl_InvocationID].out_var_PN_POSITION = _402; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_DominantVertex = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantVertex1 = _279; + gl_out[gl_InvocationID].out_var_PN_DominantVertex2 = param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz; + gl_out[gl_InvocationID].out_var_PN_DominantEdge = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantEdge1 = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantEdge2 = _324; + gl_out[gl_InvocationID].out_var_PN_DominantEdge3 = _328; + gl_out[gl_InvocationID].out_var_PN_DominantEdge4 = _317.xyz; + gl_out[gl_InvocationID].out_var_PN_DominantEdge5 = _315.xyz; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _402, _251, 1.0, 1.0, FHullShaderConstantDominantVertexData{ float2(0.0), _279, param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz }, FHullShaderConstantDominantEdgeData{ float2(0.0), float2(0.0), _324, _328, _317.xyz, _315.xyz } }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _461 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _474; + _474.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _474.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _474.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _474.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _600; + for (;;) + { + float4 _500 = View.View_ViewToClip * float4(0.0); + float4 _505 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _506 = _505.xyz; + float3 _507 = _500.xyz; + float _509 = _505.w; + float _510 = _500.w; + float4 _527 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _528 = _527.xyz; + float _530 = _527.w; + float4 _548 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _549 = _548.xyz; + float _551 = _548.w; + if (any((((int3((_506 - _507) < float3(_509 + _510)) + (int3(2) * int3((_506 + _507) > float3((-_509) - _510)))) | (int3((_528 - _507) < float3(_530 + _510)) + (int3(2) * int3((_528 + _507) > float3((-_530) - _510))))) | (int3((_549 - _507) < float3(_551 + _510)) + (int3(2) * int3((_549 + _507) > float3((-_551) - _510))))) != int3(3))) + { + _600 = float4(0.0); + break; + } + float3 _569 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _570 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _571 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _574 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _577 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _580 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _584 = sqrt(dot(_570, _570) / dot(_577, _577)); + float _588 = sqrt(dot(_571, _571) / dot(_580, _580)); + float _592 = sqrt(dot(_569, _569) / dot(_574, _574)); + float4 _593 = float4(_584, _588, _592, 1.0); + _593.w = 0.333000004291534423828125 * ((_584 + _588) + _592); + _600 = float4(View.View_AdaptiveTessellationFactor) * _593; + break; + } + float4 _602 = fast::clamp(_474 * _600, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_602.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_602.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_602.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_602.w); + patchOut.out_var_PN_POSITION9 = _461 + ((_461 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc new file mode 100644 index 0000000000..23859bc5bb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc @@ -0,0 +1,407 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; + float4 Color; + spvUnsafeArray TexCoords; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FHitProxyVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + float4 Position; +}; + +struct FPNTessellationHSToDS +{ + FHitProxyVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +constant float4 _127 = {}; + +struct main0_out +{ + float4 out_var_COLOR0; + float3 out_var_PN_DisplacementScales; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + spvUnsafeArray out_var_TEXCOORD0; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_COLOR0 [[attribute(2)]]; + float2 in_var_TEXCOORD0_0 [[attribute(3)]]; + float2 in_var_TEXCOORD0_1 [[attribute(4)]]; + float4 in_var_VS_To_DS_Position [[attribute(5)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _129 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _130 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _131 = spvUnsafeArray({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 }); + spvUnsafeArray, 12> _132 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) }); + spvUnsafeArray _205 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } }); + spvUnsafeArray param_var_I = _230; + float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _255 = 2u * gl_InvocationID; + uint _256 = 3u + _255; + uint _257 = _255 + 4u; + float4 _269 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _277 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _285 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _333 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _277)) * _277)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _269)) * _269)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _285)) * _285)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color; + gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_PN_POSITION = _333; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _333, _251, 1.0, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _385 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _398; + _398.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _398.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _398.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _398.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _524; + for (;;) + { + float4 _424 = View.View_ViewToClip * float4(0.0); + float4 _429 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _430 = _429.xyz; + float3 _431 = _424.xyz; + float _433 = _429.w; + float _434 = _424.w; + float4 _451 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _452 = _451.xyz; + float _454 = _451.w; + float4 _472 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _473 = _472.xyz; + float _475 = _472.w; + if (any((((int3((_430 - _431) < float3(_433 + _434)) + (int3(2) * int3((_430 + _431) > float3((-_433) - _434)))) | (int3((_452 - _431) < float3(_454 + _434)) + (int3(2) * int3((_452 + _431) > float3((-_454) - _434))))) | (int3((_473 - _431) < float3(_475 + _434)) + (int3(2) * int3((_473 + _431) > float3((-_475) - _434))))) != int3(3))) + { + _524 = float4(0.0); + break; + } + float3 _493 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _494 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _495 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _498 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _501 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _504 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _508 = sqrt(dot(_494, _494) / dot(_501, _501)); + float _512 = sqrt(dot(_495, _495) / dot(_504, _504)); + float _516 = sqrt(dot(_493, _493) / dot(_498, _498)); + float4 _517 = float4(_508, _512, _516, 1.0); + _517.w = 0.333000004291534423828125 * ((_508 + _512) + _516); + _524 = float4(View.View_AdaptiveTessellationFactor) * _517; + break; + } + float4 _526 = fast::clamp(_398 * _524, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_526.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_526.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_526.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_526.w); + patchOut.out_var_PN_POSITION9 = _385 + ((_385 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc new file mode 100644 index 0000000000..cab75e39bd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc @@ -0,0 +1,174 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FSharedBasePassInterpolants +{ +}; +struct FBasePassInterpolantsVSToDS +{ + FSharedBasePassInterpolants _m0; +}; + +struct FBasePassVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + FBasePassInterpolantsVSToDS BasePassInterpolants; + float4 Position; +}; + +struct FFlatTessellationHSToDS +{ + FBasePassVSToDS PassSpecificData; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[3]; + float4 Material_ScalarExpressions[1]; +}; + +constant float4 _88 = {}; + +struct main0_out +{ + float3 out_var_Flat_DisplacementScales; + float out_var_Flat_TessellationMultiplier; + float out_var_Flat_WorldDisplacementMultiplier; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_VS_To_DS_Position [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [[buffer(0)]], constant type_Material& Material [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FFlatTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _90 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _91 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _104 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position }); + spvUnsafeArray _111 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } }); + spvUnsafeArray param_var_I = _111; + float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_Flat_DisplacementScales = _128; + gl_out[gl_InvocationID].out_var_Flat_TessellationMultiplier = Material.Material_ScalarExpressions[0].x; + gl_out[gl_InvocationID].out_var_Flat_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FFlatTessellationHSToDS{ param_var_I[gl_InvocationID], _128, Material.Material_ScalarExpressions[0].x, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _154; + _154.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _154.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _154.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _154.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _173 = fast::clamp(_154, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_173.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_173.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_173.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_173.w); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese new file mode 100644 index 0000000000..bc0d7e051f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese @@ -0,0 +1,418 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_ShadowDepthPass +{ + float PrePadding_ShadowDepthPass_LPV_0; + float PrePadding_ShadowDepthPass_LPV_4; + float PrePadding_ShadowDepthPass_LPV_8; + float PrePadding_ShadowDepthPass_LPV_12; + float PrePadding_ShadowDepthPass_LPV_16; + float PrePadding_ShadowDepthPass_LPV_20; + float PrePadding_ShadowDepthPass_LPV_24; + float PrePadding_ShadowDepthPass_LPV_28; + float PrePadding_ShadowDepthPass_LPV_32; + float PrePadding_ShadowDepthPass_LPV_36; + float PrePadding_ShadowDepthPass_LPV_40; + float PrePadding_ShadowDepthPass_LPV_44; + float PrePadding_ShadowDepthPass_LPV_48; + float PrePadding_ShadowDepthPass_LPV_52; + float PrePadding_ShadowDepthPass_LPV_56; + float PrePadding_ShadowDepthPass_LPV_60; + float PrePadding_ShadowDepthPass_LPV_64; + float PrePadding_ShadowDepthPass_LPV_68; + float PrePadding_ShadowDepthPass_LPV_72; + float PrePadding_ShadowDepthPass_LPV_76; + float PrePadding_ShadowDepthPass_LPV_80; + float PrePadding_ShadowDepthPass_LPV_84; + float PrePadding_ShadowDepthPass_LPV_88; + float PrePadding_ShadowDepthPass_LPV_92; + float PrePadding_ShadowDepthPass_LPV_96; + float PrePadding_ShadowDepthPass_LPV_100; + float PrePadding_ShadowDepthPass_LPV_104; + float PrePadding_ShadowDepthPass_LPV_108; + float PrePadding_ShadowDepthPass_LPV_112; + float PrePadding_ShadowDepthPass_LPV_116; + float PrePadding_ShadowDepthPass_LPV_120; + float PrePadding_ShadowDepthPass_LPV_124; + float PrePadding_ShadowDepthPass_LPV_128; + float PrePadding_ShadowDepthPass_LPV_132; + float PrePadding_ShadowDepthPass_LPV_136; + float PrePadding_ShadowDepthPass_LPV_140; + float PrePadding_ShadowDepthPass_LPV_144; + float PrePadding_ShadowDepthPass_LPV_148; + float PrePadding_ShadowDepthPass_LPV_152; + float PrePadding_ShadowDepthPass_LPV_156; + float PrePadding_ShadowDepthPass_LPV_160; + float PrePadding_ShadowDepthPass_LPV_164; + float PrePadding_ShadowDepthPass_LPV_168; + float PrePadding_ShadowDepthPass_LPV_172; + float PrePadding_ShadowDepthPass_LPV_176; + float PrePadding_ShadowDepthPass_LPV_180; + float PrePadding_ShadowDepthPass_LPV_184; + float PrePadding_ShadowDepthPass_LPV_188; + float PrePadding_ShadowDepthPass_LPV_192; + float PrePadding_ShadowDepthPass_LPV_196; + float PrePadding_ShadowDepthPass_LPV_200; + float PrePadding_ShadowDepthPass_LPV_204; + float PrePadding_ShadowDepthPass_LPV_208; + float PrePadding_ShadowDepthPass_LPV_212; + float PrePadding_ShadowDepthPass_LPV_216; + float PrePadding_ShadowDepthPass_LPV_220; + float PrePadding_ShadowDepthPass_LPV_224; + float PrePadding_ShadowDepthPass_LPV_228; + float PrePadding_ShadowDepthPass_LPV_232; + float PrePadding_ShadowDepthPass_LPV_236; + float PrePadding_ShadowDepthPass_LPV_240; + float PrePadding_ShadowDepthPass_LPV_244; + float PrePadding_ShadowDepthPass_LPV_248; + float PrePadding_ShadowDepthPass_LPV_252; + float PrePadding_ShadowDepthPass_LPV_256; + float PrePadding_ShadowDepthPass_LPV_260; + float PrePadding_ShadowDepthPass_LPV_264; + float PrePadding_ShadowDepthPass_LPV_268; + float4x4 ShadowDepthPass_LPV_mRsmToWorld; + float4 ShadowDepthPass_LPV_mLightColour; + float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection; + float4 ShadowDepthPass_LPV_mEyePos; + packed_int3 ShadowDepthPass_LPV_mOldGridOffset; + int PrePadding_ShadowDepthPass_LPV_396; + packed_int3 ShadowDepthPass_LPV_mLpvGridOffset; + float ShadowDepthPass_LPV_ClearMultiplier; + float ShadowDepthPass_LPV_LpvScale; + float ShadowDepthPass_LPV_OneOverLpvScale; + float ShadowDepthPass_LPV_DirectionalOcclusionIntensity; + float ShadowDepthPass_LPV_DirectionalOcclusionRadius; + float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier; + float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier; + float ShadowDepthPass_LPV_SecondaryOcclusionStrength; + float ShadowDepthPass_LPV_SecondaryBounceStrength; + float ShadowDepthPass_LPV_VplInjectionBias; + float ShadowDepthPass_LPV_GeometryVolumeInjectionBias; + float ShadowDepthPass_LPV_EmissiveInjectionMultiplier; + int ShadowDepthPass_LPV_PropagationIndex; + float4x4 ShadowDepthPass_ProjectionMatrix; + float4x4 ShadowDepthPass_ViewMatrix; + float4 ShadowDepthPass_ShadowParams; + float ShadowDepthPass_bClampToNearPlane; + float PrePadding_ShadowDepthPass_612; + float PrePadding_ShadowDepthPass_616; + float PrePadding_ShadowDepthPass_620; + float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6]; + float4x4 ShadowDepthPass_ShadowViewMatrices[6]; +}; + +constant float4 _113 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; + float4 out_var_COLOR0 [[user(locn2)]]; + float4 out_var_TEXCOORD0_0 [[user(locn3)]]; + uint out_var_PRIMITIVE_ID [[user(locn4)]]; + float out_var_TEXCOORD6 [[user(locn5)]]; + float out_var_TEXCOORD8 [[user(locn6)]]; + float3 out_var_TEXCOORD7 [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_COLOR0 [[attribute(0)]]; + float4 in_var_PN_POSITION_0 [[attribute(2)]]; + float4 in_var_PN_POSITION_1 [[attribute(3)]]; + float4 in_var_PN_POSITION_2 [[attribute(4)]]; + float in_var_PN_WorldDisplacementMultiplier [[attribute(7)]]; + uint in_var_PRIMITIVE_ID [[attribute(8)]]; + float4 in_var_TEXCOORD0_0 [[attribute(9)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(10)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(11)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(5)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(1)]], texture2d Material_Texture2D_3 [[texture(0)]], sampler Material_Texture2D_3Sampler [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray out_var_TEXCOORD0 = {}; + spvUnsafeArray _117 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _118 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _119 = spvUnsafeArray({ patchIn.gl_in[0].in_var_COLOR0, patchIn.gl_in[1].in_var_COLOR0, patchIn.gl_in[2].in_var_COLOR0 }); + spvUnsafeArray, 3> _120 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) }); + spvUnsafeArray, 3> _135 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + spvUnsafeArray _136 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier }); + float _157 = gl_TessCoord.x * gl_TessCoord.x; + float _158 = gl_TessCoord.y * gl_TessCoord.y; + float _159 = gl_TessCoord.z * gl_TessCoord.z; + float4 _165 = float4(gl_TessCoord.x); + float4 _169 = float4(gl_TessCoord.y); + float4 _174 = float4(gl_TessCoord.z); + float4 _177 = float4(_157 * 3.0); + float4 _181 = float4(_158 * 3.0); + float4 _188 = float4(_159 * 3.0); + float4 _202 = fma(((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _174) * _165, _169, fma(_135[2][2] * _177, _174, fma(_135[2][1] * _188, _165, fma(_135[1][2] * _188, _169, fma(_135[1][1] * _181, _174, fma(_135[0][2] * _181, _165, fma(_135[0][1] * _177, _169, fma(_135[2][0] * float4(_159), _174, fma(_135[0][0] * float4(_157), _165, (_135[1][0] * float4(_158)) * _169))))))))); + float3 _226 = fma(_117[2].xyz, float3(gl_TessCoord.z), fma(_117[0].xyz, float3(gl_TessCoord.x), _117[1].xyz * float3(gl_TessCoord.y)).xyz); + float4 _229 = fma(_118[2], _174, fma(_118[0], _165, _118[1] * _169)); + float4 _231 = fma(_119[2], _174, fma(_119[0], _165, _119[1] * _169)); + float4 _233 = fma(_120[2][0], _174, fma(_120[0][0], _165, _120[1][0] * _169)); + spvUnsafeArray _234 = spvUnsafeArray({ _233 }); + float3 _236 = _229.xyz; + float3 _264 = fma((float3((Material_Texture2D_3.sample(Material_Texture2D_3Sampler, fma(_233.zw, float2(1.0, 2.0), float2(View.View_GameTime * 0.20000000298023223876953125, View.View_GameTime * (-0.699999988079071044921875))), level(-1.0)).x * 10.0) * (1.0 - _231.x)) * _236) * float3(0.5), float3(fma(_136[2], gl_TessCoord.z, fma(_136[0], gl_TessCoord.x, _136[1] * gl_TessCoord.y))), _202.xyz); + float4 _270 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_264.x, _264.y, _264.z, _202.w); + float4 _281; + if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_270.z < 0.0)) + { + float4 _279 = _270; + _279.z = 9.9999999747524270787835121154785e-07; + _279.w = 1.0; + _281 = _279; + } + else + { + _281 = _270; + } + float _290 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _236)); + out.out_var_TEXCOORD10_centroid = float4(_226.x, _226.y, _226.z, _113.w); + out.out_var_TEXCOORD11_centroid = _229; + out.out_var_COLOR0 = _231; + out_var_TEXCOORD0 = _234; + out.out_var_PRIMITIVE_ID = patchIn.gl_in[0u].in_var_PRIMITIVE_ID; + out.out_var_TEXCOORD6 = _281.z; + out.out_var_TEXCOORD8 = fma(ShadowDepthPass.ShadowDepthPass_ShadowParams.y, fast::clamp((abs(_290) > 0.0) ? (sqrt(fast::clamp(fma(-_290, _290, 1.0), 0.0, 1.0)) / _290) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z), ShadowDepthPass.ShadowDepthPass_ShadowParams.x); + out.out_var_TEXCOORD7 = _264.xyz; + out.gl_Position = _281; + out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese new file mode 100644 index 0000000000..987ba54ead --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese @@ -0,0 +1,416 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; + float PrePadding_View_3048; + float PrePadding_View_3052; + float4x4 View_WorldToVirtualTexture; + float4 View_VirtualTextureParams; + float4 View_XRPassthroughCameraUVs[2]; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[5]; + float4 Material_ScalarExpressions[2]; +}; + +constant float4 _118 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD6 [[user(locn0)]]; + float4 out_var_TEXCOORD7 [[user(locn1)]]; + float4 out_var_TEXCOORD10_centroid [[user(locn2)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn3)]]; + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [1]; + float gl_ClipDistance_0 [[user(clip0)]]; +}; + +struct main0_in +{ + float4 in_var_PN_DominantEdge2 [[attribute(3)]]; + float4 in_var_PN_DominantEdge3 [[attribute(4)]]; + float3 in_var_PN_DominantEdge4 [[attribute(5)]]; + float3 in_var_PN_DominantEdge5 [[attribute(6)]]; + float4 in_var_PN_DominantVertex1 [[attribute(8)]]; + float3 in_var_PN_DominantVertex2 [[attribute(9)]]; + float4 in_var_PN_POSITION_0 [[attribute(10)]]; + float4 in_var_PN_POSITION_1 [[attribute(11)]]; + float4 in_var_PN_POSITION_2 [[attribute(12)]]; + float in_var_PN_WorldDisplacementMultiplier [[attribute(15)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(16)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(17)]]; + float4 in_var_TEXCOORD6 [[attribute(18)]]; + float4 in_var_TEXCOORD8 [[attribute(19)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(13)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Material& Material [[buffer(1)]], texture3d View_GlobalDistanceFieldTexture0 [[texture(0)]], texture3d View_GlobalDistanceFieldTexture1 [[texture(1)]], texture3d View_GlobalDistanceFieldTexture2 [[texture(2)]], texture3d View_GlobalDistanceFieldTexture3 [[texture(3)]], sampler View_GlobalDistanceFieldSampler0 [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray _120 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD6, patchIn.gl_in[1].in_var_TEXCOORD6, patchIn.gl_in[2].in_var_TEXCOORD6 }); + spvUnsafeArray _121 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD8, patchIn.gl_in[1].in_var_TEXCOORD8, patchIn.gl_in[2].in_var_TEXCOORD8 }); + spvUnsafeArray _128 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _129 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray, 3> _136 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + spvUnsafeArray _137 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier }); + spvUnsafeArray _138 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantVertex1, patchIn.gl_in[1].in_var_PN_DominantVertex1, patchIn.gl_in[2].in_var_PN_DominantVertex1 }); + spvUnsafeArray _139 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantVertex2, patchIn.gl_in[1].in_var_PN_DominantVertex2, patchIn.gl_in[2].in_var_PN_DominantVertex2 }); + spvUnsafeArray _146 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge2, patchIn.gl_in[1].in_var_PN_DominantEdge2, patchIn.gl_in[2].in_var_PN_DominantEdge2 }); + spvUnsafeArray _147 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge3, patchIn.gl_in[1].in_var_PN_DominantEdge3, patchIn.gl_in[2].in_var_PN_DominantEdge3 }); + spvUnsafeArray _148 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge4, patchIn.gl_in[1].in_var_PN_DominantEdge4, patchIn.gl_in[2].in_var_PN_DominantEdge4 }); + spvUnsafeArray _149 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge5, patchIn.gl_in[1].in_var_PN_DominantEdge5, patchIn.gl_in[2].in_var_PN_DominantEdge5 }); + float _190 = gl_TessCoord.x * gl_TessCoord.x; + float _191 = gl_TessCoord.y * gl_TessCoord.y; + float _192 = gl_TessCoord.z * gl_TessCoord.z; + float4 _198 = float4(gl_TessCoord.x); + float4 _202 = float4(gl_TessCoord.y); + float4 _207 = float4(gl_TessCoord.z); + float4 _210 = float4(_190 * 3.0); + float4 _214 = float4(_191 * 3.0); + float4 _221 = float4(_192 * 3.0); + float4 _235 = fma(((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _207) * _198, _202, fma(_136[2][2] * _210, _207, fma(_136[2][1] * _221, _198, fma(_136[1][2] * _221, _202, fma(_136[1][1] * _214, _207, fma(_136[0][2] * _214, _198, fma(_136[0][1] * _210, _202, fma(_136[2][0] * float4(_192), _207, fma(_136[0][0] * float4(_190), _198, (_136[1][0] * float4(_191)) * _202))))))))); + float3 _237 = float3(gl_TessCoord.x); + float3 _240 = float3(gl_TessCoord.y); + float3 _254 = float3(gl_TessCoord.z); + float3 _256 = fma(_128[2].xyz, _254, fma(_128[0].xyz, _237, _128[1].xyz * _240).xyz); + float4 _259 = fma(_129[2], _207, fma(_129[0], _198, _129[1] * _202)); + float3 _264 = _235.xyz; + float3 _265 = _256.xyz; + float3 _266 = _259.xyz; + float3 _272 = _264 + float3(View.View_WorldCameraOrigin); + float _279 = float(int(gl_TessCoord.x == 0.0)); + float _282 = float(int(gl_TessCoord.y == 0.0)); + float _285 = float(int(gl_TessCoord.z == 0.0)); + float _286 = _279 + _282; + float _287 = _286 + _285; + float4 _387; + float3 _388; + if (float(int(_287 == 2.0)) == 1.0) + { + float _363 = float(int((_282 + _285) == 2.0)); + float _367 = float(int((_285 + _279) == 2.0)); + float _370 = float(int(_286 == 2.0)); + _387 = fma(float4(_370), _138[2], fma(float4(_363), _138[0], float4(_367) * _138[1])); + _388 = fma(float3(_370), _139[2], fma(float3(_363), _139[0], float3(_367) * _139[1])); + } + else + { + float4 _358; + float3 _359; + if (float(int(_287 == 1.0)) != 0.0) + { + float4 _304 = float4(_279); + float4 _306 = float4(_282); + float4 _309 = float4(_285); + float4 _311 = fma(_309, _146[2], fma(_304, _146[0], _306 * _146[1])); + float4 _316 = fma(_309, _147[2], fma(_304, _147[0], _306 * _147[1])); + float3 _331 = float3(_279); + float3 _333 = float3(_282); + float3 _336 = float3(_285); + float3 _338 = fma(_336, _148[2], fma(_331, _148[0], _333 * _148[1])); + float3 _343 = fma(_336, _149[2], fma(_331, _149[0], _333 * _149[1])); + _358 = fma(_309, fma(_198, _311, _202 * _316), fma(_304, fma(_202, _311, _207 * _316), _306 * fma(_207, _311, _198 * _316))); + _359 = fma(_336, fma(_237, _338, _240 * _343), fma(_331, fma(_240, _338, _254 * _343), _333 * fma(_254, _338, _237 * _343))); + } + else + { + _358 = float4(_259.xyz, 0.0); + _359 = _265; + } + _387 = _358; + _388 = _359; + } + float3x3 _398; + if (float(int(_287 == 0.0)) == 0.0) + { + _398 = float3x3(_388, cross(_387.xyz, _388) * float3(_387.w), _387.xyz); + } + else + { + _398 = float3x3(_265, cross(_266, _265) * float3(_259.w), _266); + } + float3 _411 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[0].xyz) + View.View_GlobalVolumeCenterAndExtent[0].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[0].xyz + View.View_GlobalVolumeCenterAndExtent[0].www) - _272, float3(0.0))); + float _547; + if (fast::min(_411.x, fast::min(_411.y, _411.z)) > (View.View_GlobalVolumeCenterAndExtent[0].w * View.View_GlobalVolumeTexelSize)) + { + _547 = View_GlobalDistanceFieldTexture0.sample(View_GlobalDistanceFieldSampler0, fma(_272, View.View_GlobalVolumeWorldToUVAddAndMul[0u].www, View.View_GlobalVolumeWorldToUVAddAndMul[0u].xyz), level(0.0)).x; + } + else + { + float3 _436 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[1].xyz) + View.View_GlobalVolumeCenterAndExtent[1].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[1].xyz + View.View_GlobalVolumeCenterAndExtent[1].www) - _272, float3(0.0))); + float _535; + if (fast::min(_436.x, fast::min(_436.y, _436.z)) > (View.View_GlobalVolumeCenterAndExtent[1].w * View.View_GlobalVolumeTexelSize)) + { + _535 = View_GlobalDistanceFieldTexture1.sample(View_GlobalDistanceFieldSampler0, fma(_272, View.View_GlobalVolumeWorldToUVAddAndMul[1u].www, View.View_GlobalVolumeWorldToUVAddAndMul[1u].xyz), level(0.0)).x; + } + else + { + float3 _459 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[2].xyz) + View.View_GlobalVolumeCenterAndExtent[2].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[2].xyz + View.View_GlobalVolumeCenterAndExtent[2].www) - _272, float3(0.0))); + float3 _475 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[3].xyz) + View.View_GlobalVolumeCenterAndExtent[3].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[3].xyz + View.View_GlobalVolumeCenterAndExtent[3].www) - _272, float3(0.0))); + float _480 = fast::min(_475.x, fast::min(_475.y, _475.z)); + float _523; + if (fast::min(_459.x, fast::min(_459.y, _459.z)) > (View.View_GlobalVolumeCenterAndExtent[2].w * View.View_GlobalVolumeTexelSize)) + { + _523 = View_GlobalDistanceFieldTexture2.sample(View_GlobalDistanceFieldSampler0, fma(_272, View.View_GlobalVolumeWorldToUVAddAndMul[2u].www, View.View_GlobalVolumeWorldToUVAddAndMul[2u].xyz), level(0.0)).x; + } + else + { + float _511; + if (_480 > (View.View_GlobalVolumeCenterAndExtent[3].w * View.View_GlobalVolumeTexelSize)) + { + _511 = mix(View.View_MaxGlobalDistance, View_GlobalDistanceFieldTexture3.sample(View_GlobalDistanceFieldSampler0, fma(_272, View.View_GlobalVolumeWorldToUVAddAndMul[3u].www, View.View_GlobalVolumeWorldToUVAddAndMul[3u].xyz), level(0.0)).x, fast::clamp((_480 * 10.0) * View.View_GlobalVolumeWorldToUVAddAndMul[3].w, 0.0, 1.0)); + } + else + { + _511 = View.View_MaxGlobalDistance; + } + _523 = _511; + } + _535 = _523; + } + _547 = _535; + } + float3 _565 = fma(_398[2] * float3(fast::min(_547 + Material.Material_ScalarExpressions[0].z, 0.0) * Material.Material_ScalarExpressions[0].w), float3(fma(_137[2], gl_TessCoord.z, fma(_137[0], gl_TessCoord.x, _137[1] * gl_TessCoord.y))), _264); + float4 _574 = View.View_TranslatedWorldToClip * float4(_565.x, _565.y, _565.z, _235.w); + _574.z = fma(0.001000000047497451305389404296875, _574.w, _574.z); + out.gl_Position = _574; + out.out_var_TEXCOORD6 = fma(_120[2], _207, fma(_120[0], _198, _120[1] * _202)); + out.out_var_TEXCOORD7 = fma(_121[2], _207, fma(_121[0], _198, _121[1] * _202)); + out.out_var_TEXCOORD10_centroid = float4(_256.x, _256.y, _256.z, _118.w); + out.out_var_TEXCOORD11_centroid = _259; + out.gl_ClipDistance[0u] = dot(View.View_GlobalClippingPlane, float4(_565.xyz - float3(View.View_PreViewTranslation), 1.0)); + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese new file mode 100644 index 0000000000..e0efbbfec2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese @@ -0,0 +1,215 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_ShadowDepthPass +{ + float PrePadding_ShadowDepthPass_LPV_0; + float PrePadding_ShadowDepthPass_LPV_4; + float PrePadding_ShadowDepthPass_LPV_8; + float PrePadding_ShadowDepthPass_LPV_12; + float PrePadding_ShadowDepthPass_LPV_16; + float PrePadding_ShadowDepthPass_LPV_20; + float PrePadding_ShadowDepthPass_LPV_24; + float PrePadding_ShadowDepthPass_LPV_28; + float PrePadding_ShadowDepthPass_LPV_32; + float PrePadding_ShadowDepthPass_LPV_36; + float PrePadding_ShadowDepthPass_LPV_40; + float PrePadding_ShadowDepthPass_LPV_44; + float PrePadding_ShadowDepthPass_LPV_48; + float PrePadding_ShadowDepthPass_LPV_52; + float PrePadding_ShadowDepthPass_LPV_56; + float PrePadding_ShadowDepthPass_LPV_60; + float PrePadding_ShadowDepthPass_LPV_64; + float PrePadding_ShadowDepthPass_LPV_68; + float PrePadding_ShadowDepthPass_LPV_72; + float PrePadding_ShadowDepthPass_LPV_76; + float PrePadding_ShadowDepthPass_LPV_80; + float PrePadding_ShadowDepthPass_LPV_84; + float PrePadding_ShadowDepthPass_LPV_88; + float PrePadding_ShadowDepthPass_LPV_92; + float PrePadding_ShadowDepthPass_LPV_96; + float PrePadding_ShadowDepthPass_LPV_100; + float PrePadding_ShadowDepthPass_LPV_104; + float PrePadding_ShadowDepthPass_LPV_108; + float PrePadding_ShadowDepthPass_LPV_112; + float PrePadding_ShadowDepthPass_LPV_116; + float PrePadding_ShadowDepthPass_LPV_120; + float PrePadding_ShadowDepthPass_LPV_124; + float PrePadding_ShadowDepthPass_LPV_128; + float PrePadding_ShadowDepthPass_LPV_132; + float PrePadding_ShadowDepthPass_LPV_136; + float PrePadding_ShadowDepthPass_LPV_140; + float PrePadding_ShadowDepthPass_LPV_144; + float PrePadding_ShadowDepthPass_LPV_148; + float PrePadding_ShadowDepthPass_LPV_152; + float PrePadding_ShadowDepthPass_LPV_156; + float PrePadding_ShadowDepthPass_LPV_160; + float PrePadding_ShadowDepthPass_LPV_164; + float PrePadding_ShadowDepthPass_LPV_168; + float PrePadding_ShadowDepthPass_LPV_172; + float PrePadding_ShadowDepthPass_LPV_176; + float PrePadding_ShadowDepthPass_LPV_180; + float PrePadding_ShadowDepthPass_LPV_184; + float PrePadding_ShadowDepthPass_LPV_188; + float PrePadding_ShadowDepthPass_LPV_192; + float PrePadding_ShadowDepthPass_LPV_196; + float PrePadding_ShadowDepthPass_LPV_200; + float PrePadding_ShadowDepthPass_LPV_204; + float PrePadding_ShadowDepthPass_LPV_208; + float PrePadding_ShadowDepthPass_LPV_212; + float PrePadding_ShadowDepthPass_LPV_216; + float PrePadding_ShadowDepthPass_LPV_220; + float PrePadding_ShadowDepthPass_LPV_224; + float PrePadding_ShadowDepthPass_LPV_228; + float PrePadding_ShadowDepthPass_LPV_232; + float PrePadding_ShadowDepthPass_LPV_236; + float PrePadding_ShadowDepthPass_LPV_240; + float PrePadding_ShadowDepthPass_LPV_244; + float PrePadding_ShadowDepthPass_LPV_248; + float PrePadding_ShadowDepthPass_LPV_252; + float PrePadding_ShadowDepthPass_LPV_256; + float PrePadding_ShadowDepthPass_LPV_260; + float PrePadding_ShadowDepthPass_LPV_264; + float PrePadding_ShadowDepthPass_LPV_268; + float4x4 ShadowDepthPass_LPV_mRsmToWorld; + float4 ShadowDepthPass_LPV_mLightColour; + float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection; + float4 ShadowDepthPass_LPV_mEyePos; + packed_int3 ShadowDepthPass_LPV_mOldGridOffset; + int PrePadding_ShadowDepthPass_LPV_396; + packed_int3 ShadowDepthPass_LPV_mLpvGridOffset; + float ShadowDepthPass_LPV_ClearMultiplier; + float ShadowDepthPass_LPV_LpvScale; + float ShadowDepthPass_LPV_OneOverLpvScale; + float ShadowDepthPass_LPV_DirectionalOcclusionIntensity; + float ShadowDepthPass_LPV_DirectionalOcclusionRadius; + float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier; + float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier; + float ShadowDepthPass_LPV_SecondaryOcclusionStrength; + float ShadowDepthPass_LPV_SecondaryBounceStrength; + float ShadowDepthPass_LPV_VplInjectionBias; + float ShadowDepthPass_LPV_GeometryVolumeInjectionBias; + float ShadowDepthPass_LPV_EmissiveInjectionMultiplier; + int ShadowDepthPass_LPV_PropagationIndex; + float4x4 ShadowDepthPass_ProjectionMatrix; + float4x4 ShadowDepthPass_ViewMatrix; + float4 ShadowDepthPass_ShadowParams; + float ShadowDepthPass_bClampToNearPlane; + float PrePadding_ShadowDepthPass_612; + float PrePadding_ShadowDepthPass_616; + float PrePadding_ShadowDepthPass_620; + float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6]; + float4x4 ShadowDepthPass_ShadowViewMatrices[6]; +}; + +constant float4 _90 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; + float out_var_TEXCOORD6 [[user(locn2)]]; + float3 out_var_TEXCOORD7 [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_PN_POSITION_0 [[attribute(10)]]; + float4 in_var_PN_POSITION_1 [[attribute(11)]]; + float4 in_var_PN_POSITION_2 [[attribute(12)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(16)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(17)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(13)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray _93 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _94 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray, 3> _101 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + float _119 = gl_TessCoord.x * gl_TessCoord.x; + float _120 = gl_TessCoord.y * gl_TessCoord.y; + float _121 = gl_TessCoord.z * gl_TessCoord.z; + float4 _127 = float4(gl_TessCoord.x); + float4 _131 = float4(gl_TessCoord.y); + float4 _136 = float4(gl_TessCoord.z); + float4 _139 = float4(_119 * 3.0); + float4 _143 = float4(_120 * 3.0); + float4 _150 = float4(_121 * 3.0); + float4 _164 = fma(((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _136) * _127, _131, fma(_101[2][2] * _139, _136, fma(_101[2][1] * _150, _127, fma(_101[1][2] * _150, _131, fma(_101[1][1] * _143, _136, fma(_101[0][2] * _143, _127, fma(_101[0][1] * _139, _131, fma(_101[2][0] * float4(_121), _136, fma(_101[0][0] * float4(_119), _127, (_101[1][0] * float4(_120)) * _131))))))))); + float3 _179 = fma(_93[2].xyz, float3(gl_TessCoord.z), fma(_93[0].xyz, float3(gl_TessCoord.x), _93[1].xyz * float3(gl_TessCoord.y)).xyz); + float4 _182 = fma(_94[2], _136, fma(_94[0], _127, _94[1] * _131)); + float4 _189 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_164.x, _164.y, _164.z, _164.w); + float4 _200; + if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_189.z < 0.0)) + { + float4 _198 = _189; + _198.z = 9.9999999747524270787835121154785e-07; + _198.w = 1.0; + _200 = _198; + } + else + { + _200 = _189; + } + float _209 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _182.xyz)); + float4 _234 = _200; + _234.z = fma(_200.z, ShadowDepthPass.ShadowDepthPass_ShadowParams.w, fma(ShadowDepthPass.ShadowDepthPass_ShadowParams.y, fast::clamp((abs(_209) > 0.0) ? (sqrt(fast::clamp(fma(-_209, _209, 1.0), 0.0, 1.0)) / _209) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z), ShadowDepthPass.ShadowDepthPass_ShadowParams.x)) * _200.w; + out.out_var_TEXCOORD10_centroid = float4(_179.x, _179.y, _179.z, _90.w); + out.out_var_TEXCOORD11_centroid = _182; + out.out_var_TEXCOORD6 = 0.0; + out.out_var_TEXCOORD7 = _164.xyz; + out.gl_Position = _234; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert new file mode 100644 index 0000000000..1f47ec47e3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert @@ -0,0 +1,457 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_MobileBasePass +{ + float4 MobileBasePass_Fog_ExponentialFogParameters; + float4 MobileBasePass_Fog_ExponentialFogParameters2; + float4 MobileBasePass_Fog_ExponentialFogColorParameter; + float4 MobileBasePass_Fog_ExponentialFogParameters3; + float4 MobileBasePass_Fog_InscatteringLightDirection; + float4 MobileBasePass_Fog_DirectionalInscatteringColor; + float2 MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation; + float PrePadding_MobileBasePass_Fog_104; + float PrePadding_MobileBasePass_Fog_108; + packed_float3 MobileBasePass_Fog_FogInscatteringTextureParameters; + float MobileBasePass_Fog_ApplyVolumetricFog; + float PrePadding_MobileBasePass_PlanarReflection_128; + float PrePadding_MobileBasePass_PlanarReflection_132; + float PrePadding_MobileBasePass_PlanarReflection_136; + float PrePadding_MobileBasePass_PlanarReflection_140; + float PrePadding_MobileBasePass_PlanarReflection_144; + float PrePadding_MobileBasePass_PlanarReflection_148; + float PrePadding_MobileBasePass_PlanarReflection_152; + float PrePadding_MobileBasePass_PlanarReflection_156; + float4 MobileBasePass_PlanarReflection_ReflectionPlane; + float4 MobileBasePass_PlanarReflection_PlanarReflectionOrigin; + float4 MobileBasePass_PlanarReflection_PlanarReflectionXAxis; + float4 MobileBasePass_PlanarReflection_PlanarReflectionYAxis; + float3x4 MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix; + packed_float3 MobileBasePass_PlanarReflection_PlanarReflectionParameters; + float PrePadding_MobileBasePass_PlanarReflection_284; + float2 MobileBasePass_PlanarReflection_PlanarReflectionParameters2; + float PrePadding_MobileBasePass_PlanarReflection_296; + float PrePadding_MobileBasePass_PlanarReflection_300; + float4x4 MobileBasePass_PlanarReflection_ProjectionWithExtraFOV[2]; + float4 MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2]; + float2 MobileBasePass_PlanarReflection_PlanarReflectionScreenBound; + uint MobileBasePass_PlanarReflection_bIsStereo; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_UseEditorDepthTest; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + float PrePadding_Primitive_380; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightingChannelMask; + uint Primitive_LightmapDataIndex; + int Primitive_SingleCaptureIndex; +}; + +struct type_LandscapeParameters +{ + float4 LandscapeParameters_HeightmapUVScaleBias; + float4 LandscapeParameters_WeightmapUVScaleBias; + float4 LandscapeParameters_LandscapeLightmapScaleBias; + float4 LandscapeParameters_SubsectionSizeVertsLayerUVPan; + float4 LandscapeParameters_SubsectionOffsetParams; + float4 LandscapeParameters_LightmapSubsectionOffsetParams; + float4x4 LandscapeParameters_LocalToWorldNoScaling; +}; + +struct type_Globals +{ + float4 LodBias; + float4 LodValues; + float4 SectionLods; + float4 NeighborSectionLod[4]; +}; + +struct main0_out +{ + float2 out_var_TEXCOORD0 [[user(locn0)]]; + float2 out_var_TEXCOORD1 [[user(locn1)]]; + float4 out_var_TEXCOORD2 [[user(locn2)]]; + float4 out_var_TEXCOORD3 [[user(locn3)]]; + float4 out_var_TEXCOORD8 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_ATTRIBUTE0 [[attribute(0)]]; + float4 in_var_ATTRIBUTE1_0 [[attribute(1)]]; + float4 in_var_ATTRIBUTE1_1 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileBasePass& MobileBasePass [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_LandscapeParameters& LandscapeParameters [[buffer(3)]], constant type_Globals& _Globals [[buffer(4)]]) +{ + main0_out out = {}; + spvUnsafeArray in_var_ATTRIBUTE1 = {}; + in_var_ATTRIBUTE1[0] = in.in_var_ATTRIBUTE1_0; + in_var_ATTRIBUTE1[1] = in.in_var_ATTRIBUTE1_1; + float4 _115 = in.in_var_ATTRIBUTE0 * float4(255.0); + float2 _116 = _115.zw; + float2 _118 = fract(_116 * float2(0.5)); + float2 _119 = _118 * float2(2.0); + float2 _121 = fma(-_118, float2(2.0), _116) * float2(0.0039215688593685626983642578125); + float2 _122 = _115.xy; + float2 _126 = _122 * float2(_Globals.LodValues.w); + float _127 = _126.y; + float _128 = _126.x; + float4 _131 = float4(_127, _128, 1.0 - _128, 1.0 - _127); + float4 _132 = _131 * float4(2.0); + float4 _186; + if (_119.y > 0.5) + { + float4 _161; + if (_119.x > 0.5) + { + _161 = fma(_132, float4(_Globals.SectionLods.w), fma(-_131, float4(2.0), float4(1.0)) * _Globals.NeighborSectionLod[3]); + } + else + { + _161 = fma(_132, float4(_Globals.SectionLods.z), fma(-_131, float4(2.0), float4(1.0)) * _Globals.NeighborSectionLod[2]); + } + _186 = _161; + } + else + { + float4 _185; + if (_119.x > 0.5) + { + _185 = fma(_132, float4(_Globals.SectionLods.y), fma(-_131, float4(2.0), float4(1.0)) * _Globals.NeighborSectionLod[1]); + } + else + { + _185 = fma(_132, float4(_Globals.SectionLods.x), fma(-_131, float4(2.0), float4(1.0)) * _Globals.NeighborSectionLod[0]); + } + _186 = _185; + } + float _206; + if ((_128 + _127) > 1.0) + { + float _198; + if (_128 < _127) + { + _198 = _186.w; + } + else + { + _198 = _186.z; + } + _206 = _198; + } + else + { + float _205; + if (_128 < _127) + { + _205 = _186.y; + } + else + { + _205 = _186.x; + } + _206 = _205; + } + float _207 = floor(_206); + float _220 = _121.x; + float3 _235 = select(select(select(select(select(float3(0.03125, _121.yy), float3(0.0625, _220, _121.y), bool3(_207 < 5.0)), float3(0.125, in_var_ATTRIBUTE1[1].w, _220), bool3(_207 < 4.0)), float3(0.25, in_var_ATTRIBUTE1[1].zw), bool3(_207 < 3.0)), float3(0.5, in_var_ATTRIBUTE1[1].yz), bool3(_207 < 2.0)), float3(1.0, in_var_ATTRIBUTE1[1].xy), bool3(_207 < 1.0)); + float _236 = _235.x; + float _245 = (fma(in_var_ATTRIBUTE1[0].x, 65280.0, in_var_ATTRIBUTE1[0].y * 255.0) - 32768.0) * 0.0078125; + float _252 = (fma(in_var_ATTRIBUTE1[0].z, 65280.0, in_var_ATTRIBUTE1[0].w * 255.0) - 32768.0) * 0.0078125; + float2 _257 = floor(_122 * float2(_236)); + float2 _271 = float2(fma(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x, _236, -1.0), fast::max((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * 0.5) * _236, 2.0) - 1.0) * float2(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.y); + float3 _287 = mix(float3(_257 / float2(_271.x), mix(_245, _252, _235.y)), float3(floor(_257 * float2(0.5)) / float2(_271.y), mix(_245, _252, _235.z)), float3(_206 - _207)); + float2 _288 = _119.xy; + float3 _296 = _287 + float3(_288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww, 0.0); + float4 _322 = float4(fma(Primitive.Primitive_LocalToWorld[2u].xyz, _296.zzz, fma(Primitive.Primitive_LocalToWorld[0u].xyz, _296.xxx, Primitive.Primitive_LocalToWorld[1u].xyz * _296.yyy)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0); + float2 _323 = _287.xy; + float4 _338 = float4(_322.x, _322.y, _322.z, _322.w); + float4 _339 = View.View_TranslatedWorldToClip * _338; + float3 _341 = _322.xyz - float3(View.View_TranslatedWorldCameraOrigin); + float _345 = dot(_341, _341); + float _346 = rsqrt(_345); + float _347 = _345 * _346; + float _354 = _341.z; + float _357 = fast::max(0.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.w); + float _393; + float _394; + float _395; + float _396; + if (_357 > 0.0) + { + float _361 = _357 * _346; + float _365 = fma(_361, _354, View.View_WorldCameraOrigin[2]); + _393 = fma(-_357, _346, 1.0) * _347; + _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.z * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.w))); + _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.x * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.y))); + _396 = fma(-_361, _354, _354); + } + else + { + _393 = _347; + _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.x; + _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.x; + _396 = _354; + } + float _400 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * _396); + float _417 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * _396); + float _428 = fma(_395, (abs(_400) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_400)) / _400) : fma(-0.2402265071868896484375, _400, 0.693147182464599609375), _394 * ((abs(_417) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_417)) / _417) : fma(-0.2402265071868896484375, _417, 0.693147182464599609375))); + float3 _459; + if (MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w >= 0.0) + { + _459 = (MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.xyz * float3(pow(fast::clamp(dot(_341 * float3(_346), MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.xyz), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.w))) * float3(1.0 - fast::clamp(exp2(-(_428 * fast::max(_393 - MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w, 0.0))), 0.0, 1.0)); + } + else + { + _459 = float3(0.0); + } + bool _468 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w > 0.0) && (_347 > MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w); + float _471 = _468 ? 1.0 : fast::max(fast::clamp(exp2(-(_428 * _393)), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.w); + float4 _479 = float4(fma(MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.xyz, float3(1.0 - _471), select(_459, float3(0.0), bool3(_468))), _471); + float4 _482 = _338; + _482.w = _339.w; + out.out_var_TEXCOORD0 = fma(_288, LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww, _323 + LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.zw).xy; + out.out_var_TEXCOORD1 = fma(_288, LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.zz, fma(_323, LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.xy, LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.zw)); + out.out_var_TEXCOORD2 = float4(float4(0.0).x, float4(0.0).y, _479.x, _479.y); + out.out_var_TEXCOORD3 = float4(float4(0.0).x, float4(0.0).y, _479.z, _479.w); + out.out_var_TEXCOORD8 = _482; + out.gl_Position = _339; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert new file mode 100644 index 0000000000..2f9afa1678 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert @@ -0,0 +1,387 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_UseEditorDepthTest; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + float PrePadding_Primitive_380; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightingChannelMask; + uint Primitive_LightmapDataIndex; + int Primitive_SingleCaptureIndex; +}; + +struct type_MobileShadowDepthPass +{ + float PrePadding_MobileShadowDepthPass_0; + float PrePadding_MobileShadowDepthPass_4; + float PrePadding_MobileShadowDepthPass_8; + float PrePadding_MobileShadowDepthPass_12; + float PrePadding_MobileShadowDepthPass_16; + float PrePadding_MobileShadowDepthPass_20; + float PrePadding_MobileShadowDepthPass_24; + float PrePadding_MobileShadowDepthPass_28; + float PrePadding_MobileShadowDepthPass_32; + float PrePadding_MobileShadowDepthPass_36; + float PrePadding_MobileShadowDepthPass_40; + float PrePadding_MobileShadowDepthPass_44; + float PrePadding_MobileShadowDepthPass_48; + float PrePadding_MobileShadowDepthPass_52; + float PrePadding_MobileShadowDepthPass_56; + float PrePadding_MobileShadowDepthPass_60; + float PrePadding_MobileShadowDepthPass_64; + float PrePadding_MobileShadowDepthPass_68; + float PrePadding_MobileShadowDepthPass_72; + float PrePadding_MobileShadowDepthPass_76; + float4x4 MobileShadowDepthPass_ProjectionMatrix; + float2 MobileShadowDepthPass_ShadowParams; + float MobileShadowDepthPass_bClampToNearPlane; + float PrePadding_MobileShadowDepthPass_156; + float4x4 MobileShadowDepthPass_ShadowViewProjectionMatrices[6]; +}; + +struct type_EmitterDynamicUniforms +{ + float2 EmitterDynamicUniforms_LocalToWorldScale; + float EmitterDynamicUniforms_EmitterInstRandom; + float PrePadding_EmitterDynamicUniforms_12; + float4 EmitterDynamicUniforms_AxisLockRight; + float4 EmitterDynamicUniforms_AxisLockUp; + float4 EmitterDynamicUniforms_DynamicColor; + float4 EmitterDynamicUniforms_MacroUVParameters; +}; + +struct type_EmitterUniforms +{ + float4 EmitterUniforms_ColorCurve; + float4 EmitterUniforms_ColorScale; + float4 EmitterUniforms_ColorBias; + float4 EmitterUniforms_MiscCurve; + float4 EmitterUniforms_MiscScale; + float4 EmitterUniforms_MiscBias; + float4 EmitterUniforms_SizeBySpeed; + float4 EmitterUniforms_SubImageSize; + float4 EmitterUniforms_TangentSelector; + packed_float3 EmitterUniforms_CameraFacingBlend; + float EmitterUniforms_RemoveHMDRoll; + float EmitterUniforms_RotationRateScale; + float EmitterUniforms_RotationBias; + float EmitterUniforms_CameraMotionBlurAmount; + float PrePadding_EmitterUniforms_172; + float2 EmitterUniforms_PivotOffset; +}; + +struct type_Globals +{ + uint ParticleIndicesOffset; +}; + +struct main0_out +{ + float out_var_TEXCOORD6 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 in_var_ATTRIBUTE0 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], constant type_MobileShadowDepthPass& MobileShadowDepthPass [[buffer(2)]], constant type_EmitterDynamicUniforms& EmitterDynamicUniforms [[buffer(3)]], constant type_EmitterUniforms& EmitterUniforms [[buffer(4)]], constant type_Globals& _Globals [[buffer(5)]], texture2d ParticleIndices [[texture(0)]], texture2d PositionTexture [[texture(1)]], texture2d VelocityTexture [[texture(2)]], texture2d AttributesTexture [[texture(3)]], texture2d CurveTexture [[texture(4)]], sampler PositionTextureSampler [[sampler(0)]], sampler VelocityTextureSampler [[sampler(1)]], sampler AttributesTextureSampler [[sampler(2)]], sampler CurveTextureSampler [[sampler(3)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + float2 _133 = ParticleIndices.read(spvTexelBufferCoord((_Globals.ParticleIndicesOffset + ((gl_InstanceIndex * 16u) + (gl_VertexIndex / 4u))))).xy; + float4 _137 = PositionTexture.sample(PositionTextureSampler, _133, level(0.0)); + float4 _145 = AttributesTexture.sample(AttributesTextureSampler, _133, level(0.0)); + float _146 = _137.w; + float3 _158 = float3x3(Primitive.Primitive_LocalToWorld[0].xyz, Primitive.Primitive_LocalToWorld[1].xyz, Primitive.Primitive_LocalToWorld[2].xyz) * VelocityTexture.sample(VelocityTextureSampler, _133, level(0.0)).xyz; + float3 _160 = fast::normalize(_158 + float3(0.0, 0.0, 9.9999997473787516355514526367188e-05)); + float2 _204 = ((((_145.xy + float2((_145.x < 0.5) ? 0.0 : (-0.5), (_145.y < 0.5) ? 0.0 : (-0.5))) * float2(2.0)) * (fma(CurveTexture.sample(CurveTextureSampler, fma(EmitterUniforms.EmitterUniforms_MiscCurve.zw, float2(_146), EmitterUniforms.EmitterUniforms_MiscCurve.xy), level(0.0)), EmitterUniforms.EmitterUniforms_MiscScale, EmitterUniforms.EmitterUniforms_MiscBias).xy * EmitterDynamicUniforms.EmitterDynamicUniforms_LocalToWorldScale)) * fast::min(fast::max(EmitterUniforms.EmitterUniforms_SizeBySpeed.xy * float2(length(_158)), float2(1.0)), EmitterUniforms.EmitterUniforms_SizeBySpeed.zw)) * float2(step(_146, 1.0)); + float3 _239 = float4(fma(Primitive.Primitive_LocalToWorld[2u].xyz, _137.zzz, fma(Primitive.Primitive_LocalToWorld[0u].xyz, _137.xxx, Primitive.Primitive_LocalToWorld[1u].xyz * _137.yyy)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0).xyz; + float3 _242 = float3(EmitterUniforms.EmitterUniforms_RemoveHMDRoll); + float3 _251 = mix(mix(float3(View.View_ViewRight), float3(View.View_HMDViewNoRollRight), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.w)); + float3 _259 = mix(-mix(float3(View.View_ViewUp), float3(View.View_HMDViewNoRollUp), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.w)); + float3 _260 = float3(View.View_TranslatedWorldCameraOrigin) - _239; + float _261 = dot(_260, _260); + float3 _265 = _260 / float3(sqrt(fast::max(_261, 0.00999999977648258209228515625))); + float3 _335; + float3 _336; + if (EmitterUniforms.EmitterUniforms_CameraFacingBlend[0] > 0.0) + { + float3 _279 = cross(_265, float3(0.0, 0.0, 1.0)); + float3 _284 = _279 / float3(sqrt(fast::max(dot(_279, _279), 0.00999999977648258209228515625))); + float3 _286 = float3(fast::clamp(fma(_261, EmitterUniforms.EmitterUniforms_CameraFacingBlend[1], -EmitterUniforms.EmitterUniforms_CameraFacingBlend[2]), 0.0, 1.0)); + _335 = fast::normalize(mix(_251, _284, _286)); + _336 = fast::normalize(mix(_259, cross(_265, _284), _286)); + } + else + { + float3 _333; + float3 _334; + if (EmitterUniforms.EmitterUniforms_TangentSelector.y > 0.0) + { + float3 _297 = cross(_265, _160); + _333 = _297 / float3(sqrt(fast::max(dot(_297, _297), 0.00999999977648258209228515625))); + _334 = -_160; + } + else + { + float3 _331; + float3 _332; + if (EmitterUniforms.EmitterUniforms_TangentSelector.z > 0.0) + { + float3 _310 = cross(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, _265); + _331 = EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz; + _332 = -(_310 / float3(sqrt(fast::max(dot(_310, _310), 0.00999999977648258209228515625)))); + } + else + { + float3 _329; + float3 _330; + if (EmitterUniforms.EmitterUniforms_TangentSelector.w > 0.0) + { + float3 _322 = cross(_265, float3(0.0, 0.0, 1.0)); + float3 _327 = _322 / float3(sqrt(fast::max(dot(_322, _322), 0.00999999977648258209228515625))); + _329 = _327; + _330 = cross(_265, _327); + } + else + { + _329 = _251; + _330 = _259; + } + _331 = _329; + _332 = _330; + } + _333 = _331; + _334 = _332; + } + _335 = _333; + _336 = _334; + } + float _339 = fma(fma(_145.w * EmitterUniforms.EmitterUniforms_RotationRateScale, _146, _145.z), 6.283185482025146484375, EmitterUniforms.EmitterUniforms_RotationBias); + float3 _342 = float3(sin(_339)); + float3 _344 = float3(cos(_339)); + float3 _367 = _239 + fma(float3(_204.x * (in.in_var_ATTRIBUTE0.x + EmitterUniforms.EmitterUniforms_PivotOffset.x)), fma(_342, _336, _344 * _335), float3(_204.y * (in.in_var_ATTRIBUTE0.y + EmitterUniforms.EmitterUniforms_PivotOffset.y)) * fma(_344, _336, -(_342 * _335))); + float4 _371 = float4(_367, 1.0); + float4 _375 = MobileShadowDepthPass.MobileShadowDepthPass_ProjectionMatrix * float4(_371.x, _371.y, _371.z, _371.w); + float4 _386; + if ((MobileShadowDepthPass.MobileShadowDepthPass_bClampToNearPlane > 0.0) && (_375.z < 0.0)) + { + float4 _384 = _375; + _384.z = 9.9999999747524270787835121154785e-07; + _384.w = 1.0; + _386 = _384; + } + else + { + _386 = _375; + } + float4 _396 = _386; + _396.z = fma(_386.z, MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.y, MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.x) * _386.w; + out.out_var_TEXCOORD6 = 0.0; + out.gl_Position = _396; + return out; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/amd/gcn_shader.comp b/third_party/spirv-cross/reference/opt/shaders/amd/gcn_shader.comp new file mode 100644 index 0000000000..f196185486 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/amd/gcn_shader.comp @@ -0,0 +1,15 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_AMD_gcn_shader : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/amd/shader_ballot.comp b/third_party/spirv-cross/reference/opt/shaders/amd/shader_ballot.comp new file mode 100644 index 0000000000..fc497abba9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/amd/shader_ballot.comp @@ -0,0 +1,33 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_ARB_shader_ballot : require +#extension GL_AMD_shader_ballot : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer inputData +{ + float inputDataArray[]; +} _12; + +layout(binding = 1, std430) buffer outputData +{ + float outputDataArray[]; +} _74; + +void main() +{ + bool _31 = _12.inputDataArray[gl_LocalInvocationID.x] > 0.0; + uvec4 _37 = uvec4(unpackUint2x32(ballotARB(_31)), 0u, 0u); + uint _44 = mbcntAMD(packUint2x32(uvec2(_37.xy))); + if (_31) + { + _74.outputDataArray[_44] = _12.inputDataArray[gl_LocalInvocationID.x]; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/amd/shader_group_vote.comp b/third_party/spirv-cross/reference/opt/shaders/amd/shader_group_vote.comp new file mode 100644 index 0000000000..266998177c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/amd/shader_group_vote.comp @@ -0,0 +1,14 @@ +#version 450 +#extension GL_ARB_shader_group_vote : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer inputData +{ + float inputDataArray[]; +} _12; + +void main() +{ + bool _31 = _12.inputDataArray[gl_LocalInvocationID.x] > 0.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/amd/shader_trinary_minmax.comp b/third_party/spirv-cross/reference/opt/shaders/amd/shader_trinary_minmax.comp new file mode 100644 index 0000000000..2644551e4a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/amd/shader_trinary_minmax.comp @@ -0,0 +1,8 @@ +#version 450 +#extension GL_AMD_shader_trinary_minmax : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..673ca715b6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer u0_counters +{ + uint c; +} u0_counter; + +layout(binding = 0, r32ui) uniform writeonly uimageBuffer u0; + +void main() +{ + uint _29 = atomicAdd(u0_counter.c, uint(-1)); + imageStore(u0, floatBitsToInt(uintBitsToFloat(_29)), uvec4(uint(int(gl_GlobalInvocationID.x)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..e45ae59263 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer u0_counters +{ + uint c; +} u0_counter; + +layout(binding = 0, r32ui) uniform writeonly uimageBuffer u0; + +void main() +{ + uint _29 = atomicAdd(u0_counter.c, 1u); + imageStore(u0, floatBitsToInt(uintBitsToFloat(_29)), uvec4(uint(int(gl_GlobalInvocationID.x)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..bed2dffccb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) restrict buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + _6._m0 = _5._m1 + uvec4(_5._m0); + _6._m0 = uvec4(_5._m0) + _5._m1; + _6._m0 = _5._m1 + _5._m1; + _6._m0 = uvec4(_5._m0 + _5._m0); + _6._m1 = ivec4(_5._m1 + _5._m1); + _6._m1 = _5._m0 + _5._m0; + _6._m1 = ivec4(_5._m1) + _5._m0; + _6._m1 = _5._m0 + ivec4(_5._m1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..8d59fcc856 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) restrict buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + _6._m0 = uvec4(lessThan(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(lessThanEqual(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(lessThan(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(lessThanEqual(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(greaterThan(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(greaterThanEqual(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(greaterThan(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(greaterThanEqual(_5._m1, uvec4(_5._m0))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iequal.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iequal.asm.comp new file mode 100644 index 0000000000..8a552dba06 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_iequal.asm.comp @@ -0,0 +1,33 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _30 = _5._m0; + uvec4 _31 = _5._m1; + bvec4 _34 = equal(ivec4(_31), _30); + bvec4 _35 = equal(_30, ivec4(_31)); + bvec4 _36 = equal(_31, _31); + bvec4 _37 = equal(_30, _30); + _6._m0 = uvec4(_34); + _6._m0 = uvec4(_35); + _6._m0 = uvec4(_36); + _6._m0 = uvec4(_37); + _6._m1 = ivec4(_34); + _6._m1 = ivec4(_35); + _6._m1 = ivec4(_36); + _6._m1 = ivec4(_37); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..283b444cce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = uvec4(ivec4(_23) >> _22); + _6._m0 = uvec4(_22 >> ivec4(_23)); + _6._m0 = uvec4(ivec4(_23) >> ivec4(_23)); + _6._m0 = uvec4(_22 >> _22); + _6._m1 = ivec4(_23) >> ivec4(_23); + _6._m1 = _22 >> _22; + _6._m1 = ivec4(_23) >> _22; + _6._m1 = _22 >> ivec4(_23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..e28c481d21 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = uvec4(ivec4(_23) / _22); + _6._m0 = uvec4(_22 / ivec4(_23)); + _6._m0 = uvec4(ivec4(_23) / ivec4(_23)); + _6._m0 = uvec4(_22 / _22); + _6._m1 = ivec4(_23) / ivec4(_23); + _6._m1 = _22 / _22; + _6._m1 = ivec4(_23) / _22; + _6._m1 = _22 / ivec4(_23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..78efaf3852 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = _23 >> uvec4(_22); + _6._m0 = uvec4(_22) >> _23; + _6._m0 = _23 >> _23; + _6._m0 = uvec4(_22) >> uvec4(_22); + _6._m1 = ivec4(_23 >> _23); + _6._m1 = ivec4(uvec4(_22) >> uvec4(_22)); + _6._m1 = ivec4(_23 >> uvec4(_22)); + _6._m1 = ivec4(uvec4(_22) >> _23); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..86ba0a3b9f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,37 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct A +{ + int a; + int b; +}; + +layout(binding = 1, std430) buffer C1 +{ + A Data[]; +} C1_1; + +layout(binding = 2, std140) uniform C2 +{ + A Data[1024]; +} C2_1; + +layout(binding = 0, std430) buffer B +{ + A Data[]; +} C3; + +layout(binding = 3, std140) uniform B +{ + A Data[1024]; +} C4; + +void main() +{ + C1_1.Data[gl_GlobalInvocationID.x].a = C2_1.Data[gl_GlobalInvocationID.x].a; + C1_1.Data[gl_GlobalInvocationID.x].b = C2_1.Data[gl_GlobalInvocationID.x].b; + C3.Data[gl_GlobalInvocationID.x].a = C4.Data[gl_GlobalInvocationID.x].a; + C3.Data[gl_GlobalInvocationID.x].b = C4.Data[gl_GlobalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/builtin-compute-bitcast.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/builtin-compute-bitcast.asm.comp new file mode 100644 index 0000000000..abb8a7976c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/builtin-compute-bitcast.asm.comp @@ -0,0 +1,13 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer BUF +{ + int values[]; +} _6; + +void main() +{ + _6.values[int(gl_WorkGroupID.y)] = int(gl_GlobalInvocationID.z); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..617cde4bca --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,58 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer bar +{ + vec4 _data[]; +} bar_1; + +layout(binding = 1, std430) buffer foo +{ + vec4 _data[]; +} foo_1; + +void main() +{ + bar_1._data[0] = foo_1._data[0]; + bar_1._data[1] = foo_1._data[1]; + bar_1._data[2] = foo_1._data[2]; + bar_1._data[3] = foo_1._data[3]; + bar_1._data[4] = foo_1._data[4]; + bar_1._data[5] = foo_1._data[5]; + bar_1._data[6] = foo_1._data[6]; + bar_1._data[7] = foo_1._data[7]; + bar_1._data[8] = foo_1._data[8]; + bar_1._data[9] = foo_1._data[9]; + bar_1._data[10] = foo_1._data[10]; + bar_1._data[11] = foo_1._data[11]; + bar_1._data[12] = foo_1._data[12]; + bar_1._data[13] = foo_1._data[13]; + bar_1._data[14] = foo_1._data[14]; + bar_1._data[15] = foo_1._data[15]; + SPIRV_CROSS_LOOP + for (int _137 = 0; _137 < 16; ) + { + bar_1._data[15 - _137] = foo_1._data[_137]; + _137++; + continue; + } + SPIRV_CROSS_BRANCH + if (bar_1._data[10].x > 10.0) + { + foo_1._data[20] = vec4(5.0); + } + foo_1._data[20] = vec4(20.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/decoration-group.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/decoration-group.asm.comp new file mode 100644 index 0000000000..28ad4d41fd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/decoration-group.asm.comp @@ -0,0 +1,38 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 5, std430) buffer _6_15 +{ + float _m0[]; +} _15; + +layout(binding = 0, std430) buffer _7_16 +{ + float _m0[]; +} _16; + +layout(binding = 1, std430) buffer _8_17 +{ + float _m0[]; +} _17; + +layout(binding = 2, std430) restrict readonly buffer _9_18 +{ + float _m0[]; +} _18; + +layout(binding = 3, std430) restrict readonly buffer _10_19 +{ + float _m0[]; +} _19; + +layout(binding = 4, std430) restrict readonly buffer _11_20 +{ + float _m0[]; +} _20; + +void main() +{ + _15._m0[gl_GlobalInvocationID.x] = (((_16._m0[gl_GlobalInvocationID.x] + _17._m0[gl_GlobalInvocationID.x]) + _18._m0[gl_GlobalInvocationID.x]) + _19._m0[gl_GlobalInvocationID.x]) + _20._m0[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..37b2863558 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,7 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp new file mode 100644 index 0000000000..d30cddafec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/hlsl-functionality.asm.comp @@ -0,0 +1,19 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer Buf +{ + vec4 _data[]; +} Buf_1; + +layout(binding = 1, std430) buffer Buf_count +{ + int _count; +} Buf_count_1; + +void main() +{ + int _33 = atomicAdd(Buf_count_1._count, 1); + Buf_1._data[_33] = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/logical.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/logical.asm.comp new file mode 100644 index 0000000000..124652b322 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/logical.asm.comp @@ -0,0 +1,7 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..6418464f19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _6_8 +{ + ivec4 _m0; + uvec4 _m1; +} _8; + +layout(binding = 1, std430) restrict buffer _7_9 +{ + uvec4 _m0; + ivec4 _m1; +} _9; + +void main() +{ + _9._m0 = _8._m1 + uvec4(_8._m0); + _9._m0 = uvec4(_8._m0) + _8._m1; + _9._m0 = _8._m1 + _8._m1; + _9._m0 = uvec4(_8._m0 + _8._m0); + _9._m1 = ivec4(_8._m1 + _8._m1); + _9._m1 = _8._m0 + _8._m0; + _9._m1 = ivec4(_8._m1) + _8._m0; + _9._m1 = _8._m0 + ivec4(_8._m1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..5ef1bc91a7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a1; + vec2 a2; + vec3 a3; + vec4 a4; + float b1; + vec2 b2; + vec3 b3; + vec4 b4; + float c1; + vec2 c2; + vec3 c3; + vec4 c4; +} _4; + +void main() +{ + _4.a1 = isnan(_4.c1) ? _4.b1 : (isnan(_4.b1) ? _4.c1 : min(_4.b1, _4.c1)); + _4.a2 = mix(mix(min(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + _4.a3 = mix(mix(min(_4.b3, _4.c3), _4.c3, isnan(_4.b3)), _4.b3, isnan(_4.c3)); + _4.a4 = mix(mix(min(_4.b4, _4.c4), _4.c4, isnan(_4.b4)), _4.b4, isnan(_4.c4)); + _4.a1 = isnan(_4.c1) ? _4.b1 : (isnan(_4.b1) ? _4.c1 : max(_4.b1, _4.c1)); + _4.a2 = mix(mix(max(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + _4.a3 = mix(mix(max(_4.b3, _4.c3), _4.c3, isnan(_4.b3)), _4.b3, isnan(_4.c3)); + _4.a4 = mix(mix(max(_4.b4, _4.c4), _4.c4, isnan(_4.b4)), _4.b4, isnan(_4.c4)); + float _180 = isnan(_4.b1) ? _4.a1 : (isnan(_4.a1) ? _4.b1 : max(_4.a1, _4.b1)); + _4.a1 = isnan(_4.c1) ? _180 : (isnan(_180) ? _4.c1 : min(_180, _4.c1)); + vec2 _191 = mix(mix(max(_4.a2, _4.b2), _4.b2, isnan(_4.a2)), _4.a2, isnan(_4.b2)); + _4.a2 = mix(mix(min(_191, _4.c2), _4.c2, isnan(_191)), _191, isnan(_4.c2)); + vec3 _202 = mix(mix(max(_4.a3, _4.b3), _4.b3, isnan(_4.a3)), _4.a3, isnan(_4.b3)); + _4.a3 = mix(mix(min(_202, _4.c3), _4.c3, isnan(_202)), _202, isnan(_4.c3)); + vec4 _213 = mix(mix(max(_4.a4, _4.b4), _4.b4, isnan(_4.a4)), _4.a4, isnan(_4.b4)); + _4.a4 = mix(mix(min(_213, _4.c4), _4.c4, isnan(_213)), _213, isnan(_4.c4)); + for (int _139 = 0; _139 < 2; ) + { + _4.a2 = mix(mix(min(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + float _229 = isnan(_4.b2.x) ? _4.a1 : (isnan(_4.a1) ? _4.b2.x : max(_4.a1, _4.b2.x)); + _4.a1 = isnan(_4.b2.y) ? _229 : (isnan(_229) ? _4.b2.y : min(_229, _4.b2.y)); + _139++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..32d8e02501 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,42 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a1; + vec2 a2; + vec3 a3; + vec4 a4; + float b1; + vec2 b2; + vec3 b3; + vec4 b4; + float c1; + vec2 c2; + vec3 c3; + vec4 c4; +} _4; + +void main() +{ + _4.a1 = min(_4.b1, _4.c1); + _4.a2 = min(_4.b2, _4.c2); + _4.a3 = min(_4.b3, _4.c3); + _4.a4 = min(_4.b4, _4.c4); + _4.a1 = max(_4.b1, _4.c1); + _4.a2 = max(_4.b2, _4.c2); + _4.a3 = max(_4.b3, _4.c3); + _4.a4 = max(_4.b4, _4.c4); + _4.a1 = clamp(_4.a1, _4.b1, _4.c1); + _4.a2 = clamp(_4.a2, _4.b2, _4.c2); + _4.a3 = clamp(_4.a3, _4.b3, _4.c3); + _4.a4 = clamp(_4.a4, _4.b4, _4.c4); + for (int _139 = 0; _139 < 2; ) + { + _4.a2 = min(_4.b2, _4.c2); + _4.a1 = clamp(_4.a1, _4.b2.x, _4.b2.y); + _139++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/op-phi-swap.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/op-phi-swap.asm.comp new file mode 100644 index 0000000000..a1a57e16b8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/op-phi-swap.asm.comp @@ -0,0 +1,39 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_4 +{ + float _m0[]; +} _4; + +layout(binding = 1, std430) buffer _3_5 +{ + float _m0[]; +} _5; + +void main() +{ + bool _34; + float _35; + float _35_copy; + float _36; + _34 = true; + _35 = _4._m0[gl_GlobalInvocationID.x]; + _36 = 8.5; + for (;;) + { + if (_34) + { + _34 = false; + _35_copy = _35; + _35 = _36; + _36 = _35_copy; + } + else + { + break; + } + } + _5._m0[gl_GlobalInvocationID.x] = _35 - _36; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/quantize.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..c089213800 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/quantize.asm.comp @@ -0,0 +1,19 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + float scalar; + vec2 vec2_val; + vec3 vec3_val; + vec4 vec4_val; +} _4; + +void main() +{ + _4.scalar = unpackHalf2x16(packHalf2x16(vec2(_4.scalar))).x; + _4.vec2_val = unpackHalf2x16(packHalf2x16(_4.vec2_val)); + _4.vec3_val = vec3(unpackHalf2x16(packHalf2x16(_4.vec3_val.xy)), unpackHalf2x16(packHalf2x16(_4.vec3_val.zz)).x); + _4.vec4_val = vec4(unpackHalf2x16(packHalf2x16(_4.vec4_val.xy)), unpackHalf2x16(packHalf2x16(_4.vec4_val.zw))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/recompile-block-naming.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/recompile-block-naming.asm.comp new file mode 100644 index 0000000000..7d43b6f54d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/recompile-block-naming.asm.comp @@ -0,0 +1,35 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer MyFirstBuffer +{ + uint _data[]; +} MyFirstBuffer_1; + +layout(binding = 0, std430) buffer MySecondBuffer +{ + uint _data[]; +} MySecondBuffer_1; + +layout(binding = 0, std430) buffer MyThirdBuffer +{ + uint _data[]; +} MyThirdBuffer_1; + +void main() +{ + uint _106 = MyFirstBuffer_1._data[0]; + uint _110 = MyFirstBuffer_1._data[1]; + uint _114 = MyFirstBuffer_1._data[2]; + uint _118 = MyFirstBuffer_1._data[3]; + uint _123 = MySecondBuffer_1._data[1]; + uint _127 = MySecondBuffer_1._data[2]; + uint _131 = MySecondBuffer_1._data[3]; + uint _135 = MySecondBuffer_1._data[4]; + uvec4 _141 = uvec4(_106, _110, _114, _118) + uvec4(_123, _127, _131, _135); + MyThirdBuffer_1._data[0] = _141.x; + MyThirdBuffer_1._data[1] = _141.y; + MyThirdBuffer_1._data[2] = _141.z; + MyThirdBuffer_1._data[3] = _141.w; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..8016ebaf9f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,21 @@ +#version 310 es + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 9u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_12 +#define SPIRV_CROSS_CONSTANT_ID_12 4u +#endif + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = SPIRV_CROSS_CONSTANT_ID_12) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; +} _4; + +void main() +{ + _4.a += 1.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/switch-break-ladder.asm.invalid.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/switch-break-ladder.asm.invalid.comp new file mode 100644 index 0000000000..f326869cef --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/switch-break-ladder.asm.invalid.comp @@ -0,0 +1,64 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer BUF +{ + int a; + int b; + int d; +} o; + +void main() +{ + int c = o.a; + int a; + for (;;) + { + bool _22_ladder_break = false; + switch (c) + { + case 5: + { + for (;;) + { + bool _30_ladder_break = false; + switch (o.d) + { + case 10: + case 20: + { + c += c; + _30_ladder_break = true; + break; + } + default: + { + continue; + } + } + if (_30_ladder_break) + { + break; + } + } + break; + } + case 1: + case 2: + case 3: + { + a = c; + _22_ladder_break = true; + break; + } + } + if (_22_ladder_break) + { + break; + } + c++; + continue; + } + o.b = a; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/reference/opt/shaders/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..eb94756d73 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,26 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct _20 +{ + int _m0; + int _m1; +}; + +int _28; + +layout(binding = 1, std430) buffer _5_6 +{ + int _m0[10]; +} _6; + +layout(binding = 0, std430) buffer _7_8 +{ + int _m0[10]; +} _8; + +void main() +{ + _6._m0[gl_GlobalInvocationID.x] = _8._m0[gl_GlobalInvocationID.x] + _20(_28, 200)._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag new file mode 100644 index 0000000000..b5e59f88bb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombineduTexuSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = texture(SPIRV_Cross_CombineduTexuSampler, vUV); + FragColor += textureOffset(SPIRV_Cross_CombineduTexuSampler, vUV, ivec2(1)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk new file mode 100644 index 0000000000..bce9808950 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(set = 0, binding = 1) uniform texture2D uTex; +layout(set = 0, binding = 0) uniform sampler uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = texture(sampler2D(uTex, uSampler), vUV); + FragColor += textureOffset(sampler2D(uTex, uSampler), vUV, ivec2(1)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/complex-name-workarounds.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/complex-name-workarounds.asm.frag new file mode 100644 index 0000000000..d68f84b48e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/complex-name-workarounds.asm.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 _; +layout(location = 1) in vec4 a; +layout(location = 0) out vec4 b; + +void main() +{ + vec4 _28 = (_ + a) + _; + b = _28; + b = _; + b = _28; + b = _; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag new file mode 100644 index 0000000000..45e83dbc18 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) in vec2 foo; +layout(location = 0) out float FooOut; + +void main() +{ + FooOut = foo.x + foo.y; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..ad64761ede --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/default-member-names.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +float _49; + +layout(location = 0) out vec4 _3; + +void main() +{ + _3 = vec4(_49); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/do-while-statement-fallback.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/do-while-statement-fallback.asm.frag new file mode 100644 index 0000000000..35bec9882e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/do-while-statement-fallback.asm.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = 5.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/empty-struct.asm.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..7a78d00b1c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float _19; + _19 = 0.0; + for (int _22 = 0; _22 < 16; ) + { + _19 += 1.0; + _22++; + continue; + } + FragColor = vec4(_19); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..1095ab04f2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/frem.asm.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + FragColor = vA - vB * trunc(vA / vB); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..16b4994148 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag new file mode 100644 index 0000000000..924b6f656c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +uniform samplerCubeShadow SPIRV_Cross_CombinedpointLightShadowMapshadowSamplerPCF; + +layout(location = 0) out float _entryPointOutput; + +void main() +{ + _entryPointOutput = textureGrad(SPIRV_Cross_CombinedpointLightShadowMapshadowSamplerPCF, vec4(vec4(0.100000001490116119384765625, 0.100000001490116119384765625, 0.100000001490116119384765625, 0.5).xyz, 0.5), vec3(0.0), vec3(0.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag new file mode 100644 index 0000000000..c4e3704e52 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag @@ -0,0 +1,14 @@ +#version 450 + +uniform sampler2DArrayShadow SPIRV_Cross_CombinedShadowMapShadowSamplerPCF; + +layout(location = 0) in vec2 texCoords; +layout(location = 1) in float cascadeIndex; +layout(location = 2) in float fragDepth; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + _entryPointOutput = vec4(textureGrad(SPIRV_Cross_CombinedShadowMapShadowSamplerPCF, vec4(vec4(texCoords, cascadeIndex, fragDepth).xyz, fragDepth), vec2(0.0), vec2(0.0))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..ab2749b4df --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out ivec2 Size; + +void main() +{ + Size = textureSize(uTexture, 0) + textureSize(uTexture, 1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag new file mode 100644 index 0000000000..350142d4b7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSampler; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + ivec2 _154 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _154, 0) + texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _154, 0)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk new file mode 100644 index 0000000000..b898b01bc0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 0) uniform sampler Sampler; +layout(set = 0, binding = 0) uniform texture2D SampledImage; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + ivec2 _154 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(SampledImage, _154, 0) + texelFetch(SampledImage, _154, 0)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag new file mode 100644 index 0000000000..350142d4b7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSampler; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + ivec2 _154 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _154, 0) + texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, _154, 0)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy)) + texture(SPIRV_Cross_CombinedSampledImageSampler, gl_FragCoord.xy); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk new file mode 100644 index 0000000000..21797b4cf3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler Sampler; +layout(set = 0, binding = 0) uniform texture2D SampledImage; +layout(set = 0, binding = 0) uniform sampler SPIRV_Cross_DummySampler; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + ivec2 _154 = ivec3(int(gl_FragCoord.x * 1280.0), int(gl_FragCoord.y * 720.0), 0).xy; + _entryPointOutput = ((texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _154, 0) + texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), _154, 0)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy)) + texture(sampler2D(SampledImage, Sampler), gl_FragCoord.xy); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..8a7f64d7f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,40 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uImage; + +layout(location = 0) in vec4 v0; +layout(location = 0) out vec4 FragColor; + +void main() +{ + float phi; + vec4 _36; + int _51; + _51 = 0; + phi = 1.0; + _36 = vec4(1.0, 2.0, 1.0, 2.0); + for (;;) + { + FragColor = _36; + if (_51 < 4) + { + if (v0[_51] > 0.0) + { + vec2 _48 = vec2(phi); + _51++; + phi += 2.0; + _36 = textureLod(uImage, _48, 0.0); + continue; + } + else + { + break; + } + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant-double.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant-double.asm.frag new file mode 100644 index 0000000000..e53b282f87 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant-double.asm.frag @@ -0,0 +1,17 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif + +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in double vTmp; + +void main() +{ + FragColor = vec3(dvec3(uint64BitsToDouble(0x7ff0000000000000ul /* inf */), uint64BitsToDouble(0xfff0000000000000ul /* -inf */), uint64BitsToDouble(0x7ff8000000000000ul /* nan */)) + dvec3(vTmp)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..b5e0c6e968 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec3 FragColor; + +void main() +{ + FragColor = vec3(uintBitsToFloat(0x7f800000u /* inf */), uintBitsToFloat(0xff800000u /* -inf */), uintBitsToFloat(0x7fc00000u /* nan */)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/invalidation.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/invalidation.asm.frag new file mode 100644 index 0000000000..c0dc7b682b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/invalidation.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in float v0; +layout(location = 1) in float v1; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = (v0 + v1) * v1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..4682d79e80 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,76 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require + +layout(location = 0) out float FragColor; +layout(location = 0) in float vColor; + +#line 8 "test.frag" +void main() +{ +#line 8 "test.frag" + FragColor = 1.0; +#line 9 "test.frag" + FragColor = 2.0; +#line 10 "test.frag" + if (vColor < 0.0) + { +#line 12 "test.frag" + FragColor = 3.0; + } + else + { +#line 16 "test.frag" + FragColor = 4.0; + } +#line 19 "test.frag" + for (int _127 = 0; float(_127) < (40.0 + vColor); ) + { +#line 21 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 22 "test.frag" + FragColor += 0.300000011920928955078125; +#line 19 "test.frag" + _127 += (int(vColor) + 5); + continue; + } +#line 25 "test.frag" + switch (int(vColor)) + { + case 0: + { +#line 28 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + FragColor += 0.4000000059604644775390625; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + FragColor += 0.800000011920928955078125; +#line 37 "test.frag" + break; + } + } + for (;;) + { +#line 42 "test.frag" + FragColor += (10.0 + vColor); +#line 43 "test.frag" + if (FragColor < 100.0) + { + } + else + { + break; + } + } +#line 48 "test.frag" +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..b1e3784309 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/locations-components.asm.frag @@ -0,0 +1,23 @@ +#version 450 + +layout(location = 1) in vec2 _2; +layout(location = 1, component = 2) in float _3; +layout(location = 2) flat in float _4; +layout(location = 2, component = 1) flat in uint _5; +layout(location = 2, component = 2) flat in uint _6; +layout(location = 0) out vec4 o0; +vec4 v1; +vec4 v2; + +void main() +{ + v1 = vec4(_2.x, _2.y, v1.z, v1.w); + v1.z = _3; + v2.x = _4; + v2.y = uintBitsToFloat(_5); + v2.z = uintBitsToFloat(_6); + o0.y = float(floatBitsToUint(intBitsToFloat(floatBitsToInt(v2.y) + floatBitsToInt(v2.z)))); + o0.x = v1.y + v2.x; + o0 = vec4(o0.x, o0.y, v1.z, v1.x); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag new file mode 100644 index 0000000000..eb16828e67 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag @@ -0,0 +1,83 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif + +int _231; + +layout(binding = 0, std140) uniform Foo +{ + layout(row_major) mat4 lightVP[64]; + uint shadowCascadesNum; + int test; +} _11; + +layout(location = 0) in vec3 fragWorld; +layout(location = 0) out int _entryPointOutput; + +mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; } + +void main() +{ + int _228; + do + { + bool _225; + int _229; + uint _222 = 0u; + SPIRV_CROSS_UNROLL + for (;;) + { + if (_222 < _11.shadowCascadesNum) + { + mat4 _223; + do + { + if (_11.test == 0) + { + _223 = mat4(vec4(0.5, 0.0, 0.0, 0.0), vec4(0.0, 0.5, 0.0, 0.0), vec4(0.0, 0.0, 0.5, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + break; + } + _223 = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + break; + } while(false); + vec4 _170 = (_223 * spvWorkaroundRowMajor(_11.lightVP[_222])) * vec4(fragWorld, 1.0); + float _172 = _170.z; + float _179 = _170.x; + float _181 = _170.y; + if ((((_172 >= 0.0) && (_172 <= 1.0)) && (max(_179, _181) <= 1.0)) && (min(_179, _181) >= 0.0)) + { + _229 = int(_222); + _225 = true; + break; + } + _222++; + continue; + } + else + { + _229 = _231; + _225 = false; + break; + } + } + if (_225) + { + _228 = _229; + break; + } + _228 = -1; + break; + } while(false); + _entryPointOutput = _228; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..97d3b74f02 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,46 @@ +#version 450 + +struct Params +{ + vec4 TextureSize; + vec4 Params1; + vec4 Params2; + vec4 Params3; + vec4 Params4; + vec4 Bloom; +}; + +layout(binding = 1, std140) uniform CB1 +{ + Params CB1; +} _8; + +uniform sampler2D SPIRV_Cross_CombinedmapTexturemapSampler; + +layout(location = 0) in vec2 IN_uv; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec2 _45 = vec2(0.0, _8.CB1.TextureSize.w); + vec4 _49 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv); + float _50 = _49.y; + float _53 = clamp(_50 * 0.06399999558925628662109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375); + float _55; + float _58; + _55 = 0.0; + _58 = 0.0; + for (int _60 = -3; _60 <= 3; ) + { + float _64 = float(_60); + float _68 = exp(((-_64) * _64) * 0.2222220003604888916015625); + vec4 _72 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv + (_45 * _64)); + float _77 = float(abs(_72.y - _50) < _53); + _55 = fma(_72.x, _68 * _77, _55); + _58 = fma(_68, _77, _58); + _60++; + continue; + } + _entryPointOutput = vec4(_55 / _58, _50, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..d88c0e36d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,42 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _46[16] = float[](1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0); +const vec4 _76[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + +layout(location = 0) out float FragColor; +layout(location = 0) flat in mediump int index; + +void main() +{ + vec4 foobar[4] = _76; + vec4 baz[4] = _76; + FragColor = _46[index]; + if (index < 10) + { + FragColor += _46[index ^ 1]; + } + else + { + FragColor += _46[index & 1]; + } + bool _99 = index > 30; + if (_99) + { + FragColor += _76[index & 3].y; + } + else + { + FragColor += _76[index & 1].x; + } + if (_99) + { + foobar[1].z = 20.0; + } + mediump int _37 = index & 3; + FragColor += foobar[_37].z; + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[_37].z; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag new file mode 100644 index 0000000000..679d9d557d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/multi-for-loop-init.asm.frag @@ -0,0 +1,22 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int counter; + +void main() +{ + FragColor = vec4(0.0); + mediump int _53 = 0; + mediump uint _54 = 1u; + for (; (_53 < 10) && (int(_54) < int(20u)); ) + { + FragColor += vec4(float(_53)); + FragColor += vec4(float(_54)); + _54 += uint(counter); + _53 += counter; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..873a64cb41 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = 0.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-phi-swap-continue-block.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-phi-swap-continue-block.asm.frag new file mode 100644 index 0000000000..ee45619a86 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/op-phi-swap-continue-block.asm.frag @@ -0,0 +1,29 @@ +#version 450 + +layout(binding = 0, std140) uniform UBO +{ + int uCount; + int uJ; + int uK; +} _5; + +layout(location = 0) out float FragColor; + +void main() +{ + int _23; + int _23_copy; + int _24; + _23 = _5.uK; + _24 = _5.uJ; + for (int _26 = 0; _26 < _5.uCount; ) + { + _23_copy = _23; + _23 = _24; + _24 = _23_copy; + _26++; + continue; + } + FragColor = float(_24 - _23) * float(_5.uJ * _5.uK); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag new file mode 100644 index 0000000000..4734c89c9a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag @@ -0,0 +1,8 @@ +#version 320 es +precision mediump float; +precision highp int; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access.asm.frag new file mode 100644 index 0000000000..4734c89c9a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/out-of-bounds-access.asm.frag @@ -0,0 +1,8 @@ +#version 320 es +precision mediump float; +precision highp int; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/pack-and-unpack-uint2.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pack-and-unpack-uint2.asm.frag new file mode 100644 index 0000000000..9aa9a471e8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pack-and-unpack-uint2.asm.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(18.0, 52.0, 1.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..fbbfe18bfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,16 @@ +#version 450 + +struct Registers +{ + float foo; +}; + +uniform Registers registers; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = 10.0 + registers.foo; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..d6489ed027 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_Combinedg_Textureg_Sampler; +uniform sampler2DShadow SPIRV_Cross_Combinedg_Textureg_CompareSampler; + +layout(location = 0) in vec2 in_var_TEXCOORD0; +layout(location = 0) out float out_var_SV_Target; + +void main() +{ + out_var_SV_Target = texture(SPIRV_Cross_Combinedg_Textureg_Sampler, in_var_TEXCOORD0).x + textureLod(SPIRV_Cross_Combinedg_Textureg_CompareSampler, vec3(in_var_TEXCOORD0, 0.5), 0.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag new file mode 100644 index 0000000000..bdda0d6293 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag @@ -0,0 +1,18 @@ +#version 450 + +struct Registers +{ + int index; +}; + +uniform Registers registers; + +uniform sampler2D SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[4]; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = (texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[registers.index], ivec2(10), 0) + texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[registers.index], ivec2(4), 0)) + texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[registers.index], ivec2(4), 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag new file mode 100644 index 0000000000..89058f1434 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(binding = 0, rgba32f) uniform writeonly imageBuffer RWTex; +layout(binding = 1) uniform samplerBuffer Tex; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + imageStore(RWTex, 20, vec4(1.0, 2.0, 3.0, 4.0)); + _entryPointOutput = texelFetch(Tex, 10); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..45fc4b1c05 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,23 @@ +#version 460 + +struct myType +{ + float data; +}; + +const myType _21[5] = myType[](myType(0.0), myType(1.0), myType(0.0), myType(1.0), myType(0.0)); + +layout(location = 0) out vec4 o_color; + +void main() +{ + if (_21[int(mod(gl_FragCoord.x, 4.0))].data > 0.0) + { + o_color = vec4(0.0, 1.0, 0.0, 1.0); + } + else + { + o_color = vec4(1.0, 0.0, 0.0, 1.0); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..05a3d7554f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/srem.asm.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in ivec4 vA; +layout(location = 1) flat in ivec4 vB; + +void main() +{ + FragColor = vec4(vA - vB * (vA / vB)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..a5faaefb30 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) out vec4 FragColors[2]; +layout(location = 2) out vec4 FragColor; +const vec4 _3_init[2] = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0)); +const vec4 _4_init = vec4(5.0); + +void main() +{ + FragColors = _3_init; + FragColor = _4_init; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag new file mode 100644 index 0000000000..7930ca3b4a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foo +{ + float var1; + float var2; +}; + +Foo _22; + +layout(binding = 0) uniform mediump sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(uSampler, vec2(_22.var1, _22.var2)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-label-shared-block.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-label-shared-block.asm.frag new file mode 100644 index 0000000000..748f96c8b0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-label-shared-block.asm.frag @@ -0,0 +1,32 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) flat in mediump int vIndex; +layout(location = 0) out float FragColor; + +void main() +{ + highp float _19; + switch (vIndex) + { + case 0: + case 2: + { + _19 = 1.0; + break; + } + default: + { + _19 = 3.0; + break; + } + case 8: + { + _19 = 8.0; + break; + } + } + FragColor = _19; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-preserve-sign-extension.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-preserve-sign-extension.asm.frag new file mode 100644 index 0000000000..41b9808512 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/switch-preserve-sign-extension.asm.frag @@ -0,0 +1,9 @@ +#version 330 +#ifdef GL_ARB_shading_language_420pack +#extension GL_ARB_shading_language_420pack : require +#endif + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-name-alias.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-name-alias.asm.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-name-alias.asm.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag new file mode 100644 index 0000000000..ade51d4a86 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/temporary-phi-hoisting.asm.frag @@ -0,0 +1,27 @@ +#version 450 + +struct MyStruct +{ + vec4 color; +}; + +layout(binding = 0, std140) uniform MyStruct_CB +{ + MyStruct g_MyStruct[4]; +} _6; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec3 _28; + _28 = vec3(0.0); + for (int _31 = 0; _31 < 4; ) + { + _28 += _6.g_MyStruct[_31].color.xyz; + _31++; + continue; + } + _entryPointOutput = vec4(_28, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..6193de0da9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetch(uTexture, ivec2(gl_FragCoord.xy), 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag new file mode 100644 index 0000000000..e0feb49327 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag @@ -0,0 +1,19 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out f16vec4 FragColor; +layout(location = 0) in f16vec2 UV; + +void main() +{ + FragColor = f16vec4(texture(uTexture, UV)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk new file mode 100644 index 0000000000..e13e4254ea --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk @@ -0,0 +1,20 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#extension GL_EXT_shader_16bit_storage : require + +layout(set = 0, binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out f16vec4 FragColor; +layout(location = 0) in f16vec2 UV; + +void main() +{ + FragColor = f16vec4(texture(uTexture, UV)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..84eb23a242 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + _entryPointOutput = vec4(1.0, 1.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag new file mode 100644 index 0000000000..6953ec61d0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(binding = 0) uniform sampler2DShadow uShadow; +uniform sampler2DShadow SPIRV_Cross_CombineduTextureuSampler; + +layout(location = 0) in vec3 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = texture(uShadow, vec3(vUV.xy, vUV.z)) + texture(SPIRV_Cross_CombineduTextureuSampler, vec3(vUV.xy, vUV.z)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk new file mode 100644 index 0000000000..2f997036f5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2DShadow uShadow; +layout(set = 0, binding = 1) uniform texture2D uTexture; +layout(set = 0, binding = 2) uniform samplerShadow uSampler; + +layout(location = 0) in vec3 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = texture(uShadow, vec3(vUV.xy, vUV.z)) + texture(sampler2DShadow(uTexture, uSampler), vec3(vUV.xy, vUV.z)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..c8986c1210 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/unreachable.asm.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(location = 0) flat in int counter; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _33; + for (;;) + { + if (counter == 10) + { + _33 = vec4(10.0); + break; + } + else + { + _33 = vec4(30.0); + break; + } + } + FragColor = _33; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..fcad3fbf0d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,297 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif + +struct _28 +{ + vec4 _m0; +}; + +layout(binding = 0, std140) uniform _6_7 +{ + vec4 _m0; + float _m1; + vec4 _m2; +} _7; + +layout(binding = 2, std140) uniform _10_11 +{ + vec3 _m0; + vec3 _m1; + float _m2; + vec3 _m3; + float _m4; + vec3 _m5; + float _m6; + vec3 _m7; + float _m8; + vec3 _m9; + float _m10; + vec3 _m11; + float _m12; + vec2 _m13; + vec2 _m14; + vec3 _m15; + float _m16; + float _m17; + float _m18; + float _m19; + float _m20; + vec4 _m21; + vec4 _m22; + layout(row_major) mat4 _m23; + vec4 _m24; +} _11; + +layout(binding = 1, std140) uniform _18_19 +{ + layout(row_major) mat4 _m0; + layout(row_major) mat4 _m1; + layout(row_major) mat4 _m2; + layout(row_major) mat4 _m3; + vec4 _m4; + vec4 _m5; + float _m6; + float _m7; + float _m8; + float _m9; + vec3 _m10; + float _m11; + vec3 _m12; + float _m13; + vec3 _m14; + float _m15; + vec3 _m16; + float _m17; + float _m18; + float _m19; + vec2 _m20; + vec2 _m21; + vec2 _m22; + vec4 _m23; + vec2 _m24; + vec2 _m25; + vec2 _m26; + vec3 _m27; + float _m28; + float _m29; + float _m30; + float _m31; + float _m32; + vec2 _m33; + float _m34; + float _m35; + vec3 _m36; + layout(row_major) mat4 _m37[2]; + vec4 _m38[2]; +} _19; + +uniform sampler2D SPIRV_Cross_Combined; +uniform sampler2D SPIRV_Cross_Combined_1; +uniform sampler2D SPIRV_Cross_Combined_2; + +layout(location = 0) out vec4 _5; + +void main() +{ + vec4 _88 = _7._m2 * _7._m0.xyxy; + vec2 _95 = _88.xy; + vec2 _96 = _88.zw; + vec2 _97 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(0.0, -2.0) * _7._m0.xy), _95, _96); + vec3 _109 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _97, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _113 = textureLod(SPIRV_Cross_Combined_1, _97, 0.0); + float _114 = _113.y; + vec3 _129; + SPIRV_CROSS_BRANCH + if (_114 > 0.0) + { + _129 = _109 + (textureLod(SPIRV_Cross_Combined_2, _97, 0.0).xyz * clamp(_114 * _113.z, 0.0, 1.0)); + } + else + { + _129 = _109; + } + vec2 _144 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(-1.0) * _7._m0.xy), _95, _96); + vec3 _156 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _144, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _160 = textureLod(SPIRV_Cross_Combined_1, _144, 0.0); + float _161 = _160.y; + vec3 _176; + SPIRV_CROSS_BRANCH + if (_161 > 0.0) + { + _176 = _156 + (textureLod(SPIRV_Cross_Combined_2, _144, 0.0).xyz * clamp(_161 * _160.z, 0.0, 1.0)); + } + else + { + _176 = _156; + } + vec2 _191 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(0.0, -1.0) * _7._m0.xy), _95, _96); + vec3 _203 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _191, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _207 = textureLod(SPIRV_Cross_Combined_1, _191, 0.0); + float _208 = _207.y; + vec3 _223; + SPIRV_CROSS_BRANCH + if (_208 > 0.0) + { + _223 = _203 + (textureLod(SPIRV_Cross_Combined_2, _191, 0.0).xyz * clamp(_208 * _207.z, 0.0, 1.0)); + } + else + { + _223 = _203; + } + vec2 _238 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(1.0, -1.0) * _7._m0.xy), _95, _96); + vec3 _250 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _238, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _254 = textureLod(SPIRV_Cross_Combined_1, _238, 0.0); + float _255 = _254.y; + vec3 _270; + SPIRV_CROSS_BRANCH + if (_255 > 0.0) + { + _270 = _250 + (textureLod(SPIRV_Cross_Combined_2, _238, 0.0).xyz * clamp(_255 * _254.z, 0.0, 1.0)); + } + else + { + _270 = _250; + } + vec2 _285 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(-2.0, 0.0) * _7._m0.xy), _95, _96); + vec3 _297 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _285, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _301 = textureLod(SPIRV_Cross_Combined_1, _285, 0.0); + float _302 = _301.y; + vec3 _317; + SPIRV_CROSS_BRANCH + if (_302 > 0.0) + { + _317 = _297 + (textureLod(SPIRV_Cross_Combined_2, _285, 0.0).xyz * clamp(_302 * _301.z, 0.0, 1.0)); + } + else + { + _317 = _297; + } + vec2 _332 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(-1.0, 0.0) * _7._m0.xy), _95, _96); + vec3 _344 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _332, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _348 = textureLod(SPIRV_Cross_Combined_1, _332, 0.0); + float _349 = _348.y; + vec3 _364; + SPIRV_CROSS_BRANCH + if (_349 > 0.0) + { + _364 = _344 + (textureLod(SPIRV_Cross_Combined_2, _332, 0.0).xyz * clamp(_349 * _348.z, 0.0, 1.0)); + } + else + { + _364 = _344; + } + vec2 _379 = clamp(gl_FragCoord.xy * _19._m23.xy, _95, _96); + vec3 _391 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _379, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _395 = textureLod(SPIRV_Cross_Combined_1, _379, 0.0); + float _396 = _395.y; + vec3 _411; + SPIRV_CROSS_BRANCH + if (_396 > 0.0) + { + _411 = _391 + (textureLod(SPIRV_Cross_Combined_2, _379, 0.0).xyz * clamp(_396 * _395.z, 0.0, 1.0)); + } + else + { + _411 = _391; + } + vec2 _426 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(1.0, 0.0) * _7._m0.xy), _95, _96); + vec3 _438 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _426, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _442 = textureLod(SPIRV_Cross_Combined_1, _426, 0.0); + float _443 = _442.y; + vec3 _458; + SPIRV_CROSS_BRANCH + if (_443 > 0.0) + { + _458 = _438 + (textureLod(SPIRV_Cross_Combined_2, _426, 0.0).xyz * clamp(_443 * _442.z, 0.0, 1.0)); + } + else + { + _458 = _438; + } + vec2 _473 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(2.0, 0.0) * _7._m0.xy), _95, _96); + vec3 _485 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _473, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _489 = textureLod(SPIRV_Cross_Combined_1, _473, 0.0); + float _490 = _489.y; + vec3 _505; + SPIRV_CROSS_BRANCH + if (_490 > 0.0) + { + _505 = _485 + (textureLod(SPIRV_Cross_Combined_2, _473, 0.0).xyz * clamp(_490 * _489.z, 0.0, 1.0)); + } + else + { + _505 = _485; + } + vec2 _520 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(-1.0, 1.0) * _7._m0.xy), _95, _96); + vec3 _532 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _520, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _536 = textureLod(SPIRV_Cross_Combined_1, _520, 0.0); + float _537 = _536.y; + vec3 _552; + SPIRV_CROSS_BRANCH + if (_537 > 0.0) + { + _552 = _532 + (textureLod(SPIRV_Cross_Combined_2, _520, 0.0).xyz * clamp(_537 * _536.z, 0.0, 1.0)); + } + else + { + _552 = _532; + } + vec2 _567 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(0.0, 1.0) * _7._m0.xy), _95, _96); + vec3 _579 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _567, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _583 = textureLod(SPIRV_Cross_Combined_1, _567, 0.0); + float _584 = _583.y; + vec3 _599; + SPIRV_CROSS_BRANCH + if (_584 > 0.0) + { + _599 = _579 + (textureLod(SPIRV_Cross_Combined_2, _567, 0.0).xyz * clamp(_584 * _583.z, 0.0, 1.0)); + } + else + { + _599 = _579; + } + vec2 _614 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, _7._m0.xy), _95, _96); + vec3 _626 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _614, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _630 = textureLod(SPIRV_Cross_Combined_1, _614, 0.0); + float _631 = _630.y; + vec3 _646; + SPIRV_CROSS_BRANCH + if (_631 > 0.0) + { + _646 = _626 + (textureLod(SPIRV_Cross_Combined_2, _614, 0.0).xyz * clamp(_631 * _630.z, 0.0, 1.0)); + } + else + { + _646 = _626; + } + vec2 _661 = clamp(fma(gl_FragCoord.xy, _19._m23.xy, vec2(0.0, 2.0) * _7._m0.xy), _95, _96); + vec3 _673 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _661, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _677 = textureLod(SPIRV_Cross_Combined_1, _661, 0.0); + float _678 = _677.y; + vec3 _693; + SPIRV_CROSS_BRANCH + if (_678 > 0.0) + { + _693 = _673 + (textureLod(SPIRV_Cross_Combined_2, _661, 0.0).xyz * clamp(_678 * _677.z, 0.0, 1.0)); + } + else + { + _693 = _673; + } + vec3 _702 = (((((((((((((_129 * 0.5).xyz + (_176 * 0.5)).xyz + (_223 * 0.75)).xyz + (_270 * 0.5)).xyz + (_317 * 0.5)).xyz + (_364 * 0.75)).xyz + (_411 * 1.0)).xyz + (_458 * 0.75)).xyz + (_505 * 0.5)).xyz + (_552 * 0.5)).xyz + (_599 * 0.75)).xyz + (_646 * 0.5)).xyz + (_693 * 0.5)).xyz * vec3(0.125); + _28 _750 = _28(vec4(_702.x, _702.y, _702.z, vec4(0.0).w)); + _750._m0.w = 1.0; + _5 = _750._m0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/geom/block-name-namespace.asm.geom b/third_party/spirv-cross/reference/opt/shaders/asm/geom/block-name-namespace.asm.geom new file mode 100644 index 0000000000..bb3e7d6b0a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/geom/block-name-namespace.asm.geom @@ -0,0 +1,32 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 4, triangle_strip) out; + +layout(binding = 0, std140) uniform VertexInput +{ + vec4 a; +} VertexInput_1; + +layout(binding = 0, std430) buffer VertexInput +{ + vec4 b; +} VertexInput_2; + +layout(location = 0) out VertexInput +{ + vec4 vColor; +} VertexInput_3; + +layout(location = 0) in VertexInput +{ + vec4 vColor; +} vin[3]; + + +void main() +{ + gl_Position = (vec4(1.0) + VertexInput_1.a) + VertexInput_2.b; + VertexInput_3.vColor = vin[0].vColor; + EmitVertex(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/geom/inout-split-access-chain-handle.asm.geom b/third_party/spirv-cross/reference/opt/shaders/asm/geom/inout-split-access-chain-handle.asm.geom new file mode 100644 index 0000000000..ca1381cff6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/geom/inout-split-access-chain-handle.asm.geom @@ -0,0 +1,9 @@ +#version 440 +layout(triangles) in; +layout(max_vertices = 5, triangle_strip) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/geom/split-access-chain-input.asm.geom b/third_party/spirv-cross/reference/opt/shaders/asm/geom/split-access-chain-input.asm.geom new file mode 100644 index 0000000000..511d87fcbe --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/geom/split-access-chain-input.asm.geom @@ -0,0 +1,9 @@ +#version 440 +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/geom/unroll-glposition-load.asm.geom b/third_party/spirv-cross/reference/opt/shaders/asm/geom/unroll-glposition-load.asm.geom new file mode 100644 index 0000000000..678379ddde --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/geom/unroll-glposition-load.asm.geom @@ -0,0 +1,16 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +void main() +{ + for (int _74 = 0; _74 < 3; ) + { + gl_Position = gl_in[_74].gl_Position; + EmitVertex(); + _74++; + continue; + } + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/tese/unroll-input-array-load.asm.tese b/third_party/spirv-cross/reference/opt/shaders/asm/tese/unroll-input-array-load.asm.tese new file mode 100644 index 0000000000..731ed3fab7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/tese/unroll-input-array-load.asm.tese @@ -0,0 +1,17 @@ +#version 450 +layout(quads) in; + +struct ControlPoint +{ + vec4 baz; +}; + +layout(location = 0) patch in vec4 input_foo; +layout(location = 1) patch in vec4 input_bar; +layout(location = 2) in ControlPoint CPData[]; + +void main() +{ + gl_Position = (((input_foo + input_bar) + vec2(gl_TessCoord.xy).xyxy) + CPData[0u].baz) + CPData[3u].baz; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/empty-io.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/empty-io.asm.vert new file mode 100644 index 0000000000..52fd706565 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/empty-io.asm.vert @@ -0,0 +1,15 @@ +#version 450 + +struct VSOutput +{ + int empty_struct_member; +}; + +layout(location = 0) in vec4 position; +layout(location = 0) out VSOutput _entryPointOutput; + +void main() +{ + gl_Position = position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..3ac9732b9b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,30 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct InstanceData +{ + mat4 MATRIX_MVP; + vec4 Color; +}; + +layout(binding = 0, std430) readonly buffer gInstanceData +{ + layout(row_major) InstanceData _data[]; +} gInstanceData_1; + +layout(location = 0) in vec3 PosL; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) out vec4 _entryPointOutput_Color; + +void main() +{ + gl_Position = gInstanceData_1._data[uint((gl_InstanceID + SPIRV_Cross_BaseInstance))].MATRIX_MVP * vec4(PosL, 1.0); + _entryPointOutput_Color = gInstanceData_1._data[uint((gl_InstanceID + SPIRV_Cross_BaseInstance))].Color; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert new file mode 100644 index 0000000000..20cb3b1704 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/global-builtin.sso.asm.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +struct VSOut +{ + float a; +}; + +layout(location = 0) out VSOut _entryPointOutput; + +void main() +{ + _entryPointOutput.a = 40.0; + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.asm.vert new file mode 100644 index 0000000000..9b2f05a8bd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.asm.vert @@ -0,0 +1,9 @@ +#version 450 + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.sso.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.sso.asm.vert new file mode 100644 index 0000000000..eb88694196 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant-block.sso.asm.vert @@ -0,0 +1,17 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.asm.vert new file mode 100644 index 0000000000..9b2f05a8bd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.asm.vert @@ -0,0 +1,9 @@ +#version 450 + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.sso.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.sso.asm.vert new file mode 100644 index 0000000000..4f7e2f5f67 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/invariant.sso.asm.vert @@ -0,0 +1,14 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert new file mode 100644 index 0000000000..3d9ad3b486 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -0,0 +1,30 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_201 +#define SPIRV_CROSS_CONSTANT_ID_201 -10 +#endif +const int _7 = SPIRV_CROSS_CONSTANT_ID_201; +const int _20 = (_7 + 2); +#ifndef SPIRV_CROSS_CONSTANT_ID_202 +#define SPIRV_CROSS_CONSTANT_ID_202 100u +#endif +const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; +const uint _25 = (_8 % 5u); +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; + +layout(location = 0) flat out int _4; + +void main() +{ + vec4 _65 = vec4(0.0); + _65.y = float(_20); + _65.z = float(_25); + vec4 _54 = _65 + vec4(_32); + vec2 _58 = _54.xy + vec2(_34); + gl_Position = vec4(_58.x, _58.y, _54.z, _54.w); + _4 = _35; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk new file mode 100644 index 0000000000..ed9d98e9de --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk @@ -0,0 +1,28 @@ +#version 450 + +layout(constant_id = 201) const int _7 = -10; +const int _20 = (_7 + 2); +layout(constant_id = 202) const uint _8 = 100u; +const uint _25 = (_8 % 5u); +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; + +layout(location = 0) flat out int _4; + +void main() +{ + float _42 = float(_20); + vec4 _65 = vec4(0.0); + _65.y = _42; + float _47 = float(_25); + _65.z = _47; + vec4 _52 = vec4(_32); + vec4 _54 = _65 + _52; + vec2 _55 = vec2(_34); + vec2 _58 = _54.xy + _55; + gl_Position = vec4(_58.x, _58.y, _54.z, _54.w); + _4 = _35; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/opt/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..134e08d592 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,16 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif + +void main() +{ + gl_Position = vec4(float(uint(gl_VertexID) + uint((gl_InstanceID + SPIRV_Cross_BaseInstance)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/atomic.comp b/third_party/spirv-cross/reference/opt/shaders/comp/atomic.comp new file mode 100644 index 0000000000..89b1351c0c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/atomic.comp @@ -0,0 +1,49 @@ +#version 310 es +#extension GL_OES_shader_image_atomic : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 2, std430) buffer SSBO +{ + uint u32; + int i32; +} ssbo; + +layout(binding = 0, r32ui) uniform highp uimage2D uImage; +layout(binding = 1, r32i) uniform highp iimage2D iImage; + +void main() +{ + uint _19 = imageAtomicAdd(uImage, ivec2(1, 5), 1u); + uint _27 = imageAtomicAdd(uImage, ivec2(1, 5), 1u); + imageStore(iImage, ivec2(1, 6), ivec4(int(_27))); + uint _32 = imageAtomicOr(uImage, ivec2(1, 5), 1u); + uint _34 = imageAtomicXor(uImage, ivec2(1, 5), 1u); + uint _36 = imageAtomicAnd(uImage, ivec2(1, 5), 1u); + uint _38 = imageAtomicMin(uImage, ivec2(1, 5), 1u); + uint _40 = imageAtomicMax(uImage, ivec2(1, 5), 1u); + uint _44 = imageAtomicCompSwap(uImage, ivec2(1, 5), 10u, 2u); + int _47 = imageAtomicAdd(iImage, ivec2(1, 6), 1); + int _49 = imageAtomicOr(iImage, ivec2(1, 6), 1); + int _51 = imageAtomicXor(iImage, ivec2(1, 6), 1); + int _53 = imageAtomicAnd(iImage, ivec2(1, 6), 1); + int _55 = imageAtomicMin(iImage, ivec2(1, 6), 1); + int _57 = imageAtomicMax(iImage, ivec2(1, 6), 1); + int _61 = imageAtomicCompSwap(iImage, ivec2(1, 5), 10, 2); + uint _68 = atomicAdd(ssbo.u32, 1u); + uint _70 = atomicOr(ssbo.u32, 1u); + uint _72 = atomicXor(ssbo.u32, 1u); + uint _74 = atomicAnd(ssbo.u32, 1u); + uint _76 = atomicMin(ssbo.u32, 1u); + uint _78 = atomicMax(ssbo.u32, 1u); + uint _80 = atomicExchange(ssbo.u32, 1u); + uint _82 = atomicCompSwap(ssbo.u32, 10u, 2u); + int _85 = atomicAdd(ssbo.i32, 1); + int _87 = atomicOr(ssbo.i32, 1); + int _89 = atomicXor(ssbo.i32, 1); + int _91 = atomicAnd(ssbo.i32, 1); + int _93 = atomicMin(ssbo.i32, 1); + int _95 = atomicMax(ssbo.i32, 1); + int _97 = atomicExchange(ssbo.i32, 1); + int _99 = atomicCompSwap(ssbo.i32, 10, 2); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/bake_gradient.comp b/third_party/spirv-cross/reference/opt/shaders/comp/bake_gradient.comp new file mode 100644 index 0000000000..7ef245e62e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/bake_gradient.comp @@ -0,0 +1,38 @@ +#version 310 es +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 4, std140) uniform UBO +{ + vec4 uInvSize; + vec4 uScale; +} _46; + +layout(binding = 0) uniform mediump sampler2D uHeight; +layout(binding = 1) uniform mediump sampler2D uDisplacement; +layout(binding = 2, rgba16f) uniform writeonly mediump image2D iHeightDisplacement; +layout(binding = 3, rgba16f) uniform writeonly mediump image2D iGradJacobian; + +void main() +{ + vec4 _59 = (vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5); + vec2 _67 = _59.xy; + mediump float _79 = textureLodOffset(uHeight, _67, 0.0, ivec2(-1, 0)).x; + float hp_copy_79 = _79; + mediump float _87 = textureLodOffset(uHeight, _67, 0.0, ivec2(1, 0)).x; + float hp_copy_87 = _87; + mediump float _94 = textureLodOffset(uHeight, _67, 0.0, ivec2(0, -1)).x; + float hp_copy_94 = _94; + mediump float _101 = textureLodOffset(uHeight, _67, 0.0, ivec2(0, 1)).x; + float hp_copy_101 = _101; + vec2 _128 = _59.zw; + vec2 _157 = ((textureLodOffset(uDisplacement, _128, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, _128, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z; + vec2 _161 = ((textureLodOffset(uDisplacement, _128, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, _128, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z; + mediump float _203 = _157.y * _161.x; + float hp_copy_203 = _203; + float _209 = -hp_copy_203; + mediump float mp_copy_209 = _209; + ivec2 _172 = ivec2(gl_GlobalInvocationID.xy); + imageStore(iHeightDisplacement, _172, vec4(textureLod(uHeight, _67, 0.0).x, 0.0, 0.0, 0.0)); + imageStore(iGradJacobian, _172, vec4((_46.uScale.xy * 0.5) * vec2(hp_copy_87 - hp_copy_79, hp_copy_101 - hp_copy_94), (1.0 + _157.x) * (1.0 + _161.y) + mp_copy_209, 0.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/barriers.comp b/third_party/spirv-cross/reference/opt/shaders/comp/barriers.comp new file mode 100644 index 0000000000..7dfde372ad --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/barriers.comp @@ -0,0 +1,22 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + memoryBarrierShared(); + memoryBarrier(); + memoryBarrierImage(); + memoryBarrierBuffer(); + groupMemoryBarrier(); + barrier(); + memoryBarrier(); + barrier(); + memoryBarrierImage(); + barrier(); + memoryBarrierBuffer(); + barrier(); + groupMemoryBarrier(); + barrier(); + barrier(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/basic.comp b/third_party/spirv-cross/reference/opt/shaders/comp/basic.comp new file mode 100644 index 0000000000..f025d53c6f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/basic.comp @@ -0,0 +1,28 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _45; + +layout(binding = 2, std430) buffer SSBO3 +{ + uint counter; +} _48; + +void main() +{ + vec4 _29 = _23.in_data[gl_GlobalInvocationID.x]; + if (dot(_29, vec4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _52 = atomicAdd(_48.counter, 1u); + _45.out_data[_52] = _29; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/casts.comp b/third_party/spirv-cross/reference/opt/shaders/comp/casts.comp new file mode 100644 index 0000000000..12cf17885b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/casts.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +} _21; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +} _27; + +void main() +{ + _21.outputs[gl_GlobalInvocationID.x] = ivec4(notEqual((_27.inputs[gl_GlobalInvocationID.x] & ivec4(3)), ivec4(uvec4(0u)))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/reference/opt/shaders/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..124652b322 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/cfg-preserve-parameter.comp @@ -0,0 +1,7 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/cfg.comp b/third_party/spirv-cross/reference/opt/shaders/comp/cfg.comp new file mode 100644 index 0000000000..f6e02a8551 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/cfg.comp @@ -0,0 +1,44 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +float _188; + +layout(binding = 0, std430) buffer SSBO +{ + float data; +} _11; + +void main() +{ + if (_11.data != 0.0) + { + _11.data = 10.0; + } + else + { + _11.data = 15.0; + } + switch (int(_11.data)) + { + case 0: + { + _11.data = 20.0; + break; + } + case 1: + { + _11.data = 30.0; + break; + } + } + float _185; + _185 = _188; + for (int _184 = 0; _184 < 20; ) + { + _185 += 10.0; + _184++; + continue; + } + _11.data = _185; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/coherent-block.comp b/third_party/spirv-cross/reference/opt/shaders/comp/coherent-block.comp new file mode 100644 index 0000000000..bfab6bbea8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/coherent-block.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) coherent restrict writeonly buffer SSBO +{ + vec4 value; +} _10; + +void main() +{ + _10.value = vec4(20.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/coherent-image.comp b/third_party/spirv-cross/reference/opt/shaders/comp/coherent-image.comp new file mode 100644 index 0000000000..b3992f242e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/coherent-image.comp @@ -0,0 +1,15 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) coherent restrict writeonly buffer SSBO +{ + ivec4 value; +} _10; + +layout(binding = 3, r32i) uniform coherent restrict readonly mediump iimage2D uImage; + +void main() +{ + _10.value = imageLoad(uImage, ivec2(10)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/opt/shaders/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..2e6dbebf8e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/composite-array-initialization.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 2, local_size_y = 1, local_size_z = 1) in; + +struct Data +{ + float a; + float b; +}; + +const Data _25[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 4.0 +#endif +const float X = SPIRV_CROSS_CONSTANT_ID_0; + +layout(binding = 0, std430) buffer SSBO +{ + Data outdata[]; +} _53; + +void main() +{ + Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); + _53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a; + _53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/composite-construct.comp b/third_party/spirv-cross/reference/opt/shaders/comp/composite-construct.comp new file mode 100644 index 0000000000..0e857976cd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/composite-construct.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + vec4 as[]; +} _41; + +layout(binding = 1, std430) buffer SSBO1 +{ + vec4 bs[]; +} _55; + +void main() +{ + _41.as[gl_GlobalInvocationID.x] = ((_41.as[gl_GlobalInvocationID.x] + _55.bs[gl_GlobalInvocationID.x]) + _55.bs[gl_GlobalInvocationID.x]) + vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/culling.comp b/third_party/spirv-cross/reference/opt/shaders/comp/culling.comp new file mode 100644 index 0000000000..f4dea4b359 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/culling.comp @@ -0,0 +1,28 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + float in_data[]; +} _22; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + float out_data[]; +} _38; + +layout(binding = 2, std430) buffer SSBO3 +{ + uint count; +} _41; + +void main() +{ + float _28 = _22.in_data[gl_GlobalInvocationID.x]; + if (_28 > 12.0) + { + uint _45 = atomicAdd(_41.count, 1u); + _38.out_data[_45] = _28; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/defer-parens.comp b/third_party/spirv-cross/reference/opt/shaders/comp/defer-parens.comp new file mode 100644 index 0000000000..c48fb9e080 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/defer-parens.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data; + int index; +} _13; + +void main() +{ + vec4 _17 = _13.data; + vec2 _28 = _17.yz + vec2(10.0); + _13.data = vec4(_17.x, _28, _17.w); + _13.data = (_17 + _17) + _17; + _13.data = _28.xxyy; + _13.data = vec4(_28.y); + _13.data = vec4((_17.zw + vec2(10.0))[_13.index]); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/dowhile.comp b/third_party/spirv-cross/reference/opt/shaders/comp/dowhile.comp new file mode 100644 index 0000000000..d9a9f77cbf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/dowhile.comp @@ -0,0 +1,38 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +} _28; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _52; + +void main() +{ + vec4 _59; + int _60; + _60 = 0; + _59 = _28.in_data[gl_GlobalInvocationID.x]; + vec4 _42; + for (;;) + { + _42 = _28.mvp * _59; + int _44 = _60 + 1; + if (_44 < 16) + { + _60 = _44; + _59 = _42; + } + else + { + break; + } + } + _52.out_data[gl_GlobalInvocationID.x] = _42; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/generate_height.comp b/third_party/spirv-cross/reference/opt/shaders/comp/generate_height.comp new file mode 100644 index 0000000000..75ad1f9125 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/generate_height.comp @@ -0,0 +1,56 @@ +#version 310 es +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer Distribution +{ + vec2 distribution[]; +} _137; + +layout(binding = 2, std140) uniform UBO +{ + vec4 uModTime; +} _166; + +layout(binding = 1, std430) writeonly buffer HeightmapFFT +{ + uint heights[]; +} _225; + +void main() +{ + uvec2 _265 = uvec2(64u, 1u) * gl_NumWorkGroups.xy; + uvec2 _270 = _265 - gl_GlobalInvocationID.xy; + bvec2 _272 = equal(gl_GlobalInvocationID.xy, uvec2(0u)); + uint _460; + if (_272.x) + { + _460 = 0u; + } + else + { + _460 = _270.x; + } + uint _461; + if (_272.y) + { + _461 = 0u; + } + else + { + _461 = _270.y; + } + uint _277 = _265.x; + uint _281 = (gl_GlobalInvocationID.y * _277) + gl_GlobalInvocationID.x; + uint _291 = (_461 * _277) + _460; + vec2 _298 = vec2(gl_GlobalInvocationID.xy); + vec2 _300 = vec2(_265); + float _310 = sqrt(9.81000041961669921875 * length(_166.uModTime.xy * mix(_298, _298 - _300, greaterThan(_298, _300 * 0.5)))) * _166.uModTime.z; + vec2 _317 = vec2(cos(_310), sin(_310)); + vec2 _391 = _317.xx; + vec2 _396 = _317.yy; + vec2 _399 = _396 * _137.distribution[_281].yx; + vec2 _426 = _396 * _137.distribution[_291].yx; + vec2 _434 = _137.distribution[_291] * _391 + vec2(-_426.x, _426.y); + _225.heights[_281] = packHalf2x16((_137.distribution[_281] * _391 + vec2(-_399.x, _399.y)) + vec2(_434.x, -_434.y)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/image.comp b/third_party/spirv-cross/reference/opt/shaders/comp/image.comp new file mode 100644 index 0000000000..cdb57142c3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/image.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, rgba8) uniform readonly mediump image2D uImageIn; +layout(binding = 1, rgba8) uniform writeonly mediump image2D uImageOut; + +void main() +{ + ivec2 _23 = ivec2(gl_GlobalInvocationID.xy); + imageStore(uImageOut, _23, imageLoad(uImageIn, _23 + imageSize(uImageIn))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/insert.comp b/third_party/spirv-cross/reference/opt/shaders/comp/insert.comp new file mode 100644 index 0000000000..97c55dd5aa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/insert.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + vec4 out_data[]; +} _27; + +void main() +{ + _27.out_data[gl_GlobalInvocationID.x] = vec4(10.0, 30.0, 70.0, 90.0); + _27.out_data[gl_GlobalInvocationID.x].y = 20.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/mat3.comp b/third_party/spirv-cross/reference/opt/shaders/comp/mat3.comp new file mode 100644 index 0000000000..b1c585b849 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/mat3.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + mat3 out_data[]; +} _22; + +void main() +{ + _22.out_data[gl_GlobalInvocationID.x] = mat3(vec3(10.0), vec3(20.0), vec3(40.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/mod.comp b/third_party/spirv-cross/reference/opt/shaders/comp/mod.comp new file mode 100644 index 0000000000..d8ee0ff83a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/mod.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _33; + +void main() +{ + _33.out_data[gl_GlobalInvocationID.x] = mod(_23.in_data[gl_GlobalInvocationID.x], _33.out_data[gl_GlobalInvocationID.x]); + _33.out_data[gl_GlobalInvocationID.x] = uintBitsToFloat(floatBitsToUint(_23.in_data[gl_GlobalInvocationID.x]) % floatBitsToUint(_33.out_data[gl_GlobalInvocationID.x])); + _33.out_data[gl_GlobalInvocationID.x] = intBitsToFloat(floatBitsToInt(_23.in_data[gl_GlobalInvocationID.x]) % floatBitsToInt(_33.out_data[gl_GlobalInvocationID.x])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/modf.comp b/third_party/spirv-cross/reference/opt/shaders/comp/modf.comp new file mode 100644 index 0000000000..3c8ab6ecd7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/modf.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _35; + +void main() +{ + vec4 i; + vec4 _31 = modf(_23.in_data[gl_GlobalInvocationID.x], i); + _35.out_data[gl_GlobalInvocationID.x] = _31; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/outer-product.comp b/third_party/spirv-cross/reference/opt/shaders/comp/outer-product.comp new file mode 100644 index 0000000000..d31dad3b2c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/outer-product.comp @@ -0,0 +1,36 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + mat2 m22; + mat2x3 m23; + mat2x4 m24; + mat3x2 m32; + mat3 m33; + mat3x4 m34; + mat4x2 m42; + mat4x3 m43; + mat4 m44; +} _21; + +layout(binding = 1, std430) readonly buffer ReadSSBO +{ + vec2 v2; + vec3 v3; + vec4 v4; +} _26; + +void main() +{ + _21.m22 = outerProduct(_26.v2, _26.v2); + _21.m23 = outerProduct(_26.v3, _26.v2); + _21.m24 = outerProduct(_26.v4, _26.v2); + _21.m32 = outerProduct(_26.v2, _26.v3); + _21.m33 = outerProduct(_26.v3, _26.v3); + _21.m34 = outerProduct(_26.v4, _26.v3); + _21.m42 = outerProduct(_26.v2, _26.v4); + _21.m43 = outerProduct(_26.v3, _26.v4); + _21.m44 = outerProduct(_26.v4, _26.v4); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/read-write-only.comp b/third_party/spirv-cross/reference/opt/shaders/comp/read-write-only.comp new file mode 100644 index 0000000000..06227ee2c6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/read-write-only.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 2, std430) restrict writeonly buffer SSBO2 +{ + vec4 data4; + vec4 data5; +} _10; + +layout(binding = 0, std430) readonly buffer SSBO0 +{ + vec4 data0; + vec4 data1; +} _15; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + vec4 data2; + vec4 data3; +} _21; + +void main() +{ + _10.data4 = _15.data0 + _21.data2; + _10.data5 = _15.data1 + _21.data3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/opt/shaders/comp/rmw-matrix.comp new file mode 100644 index 0000000000..5c4ac94bc7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/rmw-matrix.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; + vec4 b; + mat4 c; + float a1; + vec4 b1; + mat4 c1; +} _11; + +void main() +{ + _11.a *= _11.a1; + _11.b *= _11.b1; + _11.c = _11.c * _11.c1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/rmw-opt.comp b/third_party/spirv-cross/reference/opt/shaders/comp/rmw-opt.comp new file mode 100644 index 0000000000..342e6632db --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/rmw-opt.comp @@ -0,0 +1,23 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int a; +} _9; + +void main() +{ + _9.a += 10; + _9.a -= 10; + _9.a *= 10; + _9.a /= 10; + _9.a = _9.a << 2; + _9.a = _9.a >> 3; + _9.a &= 40; + _9.a ^= 10; + _9.a %= 40; + _9.a |= 1; + _9.a = 0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/opt/shaders/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..c28face28a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,19 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; + float b; + float c; + float d; + float e; +} _9; + +void main() +{ + _9.c = distance(_9.a, _9.b); + _9.d = length(_9.a); + _9.e = normalize(_9.a); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/shared.comp b/third_party/spirv-cross/reference/opt/shaders/comp/shared.comp new file mode 100644 index 0000000000..62cf4a4b20 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/shared.comp @@ -0,0 +1,22 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + float in_data[]; +} _22; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + float out_data[]; +} _44; + +shared float sShared[4]; + +void main() +{ + sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x]; + barrier(); + _44.out_data[gl_GlobalInvocationID.x] = sShared[3u - gl_LocalInvocationIndex]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array-length.comp b/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..ddc666e9b9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array-length.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +} _11; + +void main() +{ + _11.size = uint(int(uint(_11.v.length()))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array.comp b/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array.comp new file mode 100644 index 0000000000..6caf8f49f5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/ssbo-array.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data[]; +} ssbos[2]; + +void main() +{ + ssbos[1].data[gl_GlobalInvocationID.x] = ssbos[0].data[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/struct-layout.comp b/third_party/spirv-cross/reference/opt/shaders/comp/struct-layout.comp new file mode 100644 index 0000000000..0f73fa7fa9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/struct-layout.comp @@ -0,0 +1,23 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + mat4 m; +}; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + Foo out_data[]; +} _23; + +layout(binding = 0, std430) readonly buffer SSBO +{ + Foo in_data[]; +} _30; + +void main() +{ + _23.out_data[gl_GlobalInvocationID.x].m = _30.in_data[gl_GlobalInvocationID.x].m * _30.in_data[gl_GlobalInvocationID.x].m; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/struct-packing.comp b/third_party/spirv-cross/reference/opt/shaders/comp/struct-packing.comp new file mode 100644 index 0000000000..f4b58342d4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/struct-packing.comp @@ -0,0 +1,104 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + S4 m3s[8]; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0]; + ssbo_430.content.m0s[0].b = ssbo_140.content.m0s[0].b; + ssbo_430.content.m1s[0].a = ssbo_140.content.m1s[0].a; + ssbo_430.content.m1s[0].b = ssbo_140.content.m1s[0].b; + ssbo_430.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0]; + ssbo_430.content.m2s[0].b = ssbo_140.content.m2s[0].b; + ssbo_430.content.m0.a[0] = ssbo_140.content.m0.a[0]; + ssbo_430.content.m0.b = ssbo_140.content.m0.b; + ssbo_430.content.m1.a = ssbo_140.content.m1.a; + ssbo_430.content.m1.b = ssbo_140.content.m1.b; + ssbo_430.content.m2.a[0] = ssbo_140.content.m2.a[0]; + ssbo_430.content.m2.b = ssbo_140.content.m2.b; + ssbo_430.content.m3.a = ssbo_140.content.m3.a; + ssbo_430.content.m3.b = ssbo_140.content.m3.b; + ssbo_430.content.m4 = ssbo_140.content.m4; + ssbo_430.content.m3s[0].c = ssbo_140.content.m3s[0].c; + ssbo_430.content.m3s[1].c = ssbo_140.content.m3s[1].c; + ssbo_430.content.m3s[2].c = ssbo_140.content.m3s[2].c; + ssbo_430.content.m3s[3].c = ssbo_140.content.m3s[3].c; + ssbo_430.content.m3s[4].c = ssbo_140.content.m3s[4].c; + ssbo_430.content.m3s[5].c = ssbo_140.content.m3s[5].c; + ssbo_430.content.m3s[6].c = ssbo_140.content.m3s[6].c; + ssbo_430.content.m3s[7].c = ssbo_140.content.m3s[7].c; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/torture-loop.comp b/third_party/spirv-cross/reference/opt/shaders/comp/torture-loop.comp new file mode 100644 index 0000000000..9ca2b9591f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/torture-loop.comp @@ -0,0 +1,40 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +} _24; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _89; + +void main() +{ + vec4 _101; + _101 = _24.in_data[gl_GlobalInvocationID.x]; + for (int _95 = 0; (_95 + 1) < 10; ) + { + _101 *= 2.0; + _95 += 2; + continue; + } + vec4 _100; + _100 = _101; + vec4 _105; + for (uint _96 = 0u; _96 < 16u; _100 = _105, _96++) + { + _105 = _100; + for (uint _102 = 0u; _102 < 30u; ) + { + _105 = _24.mvp * _105; + _102++; + continue; + } + } + _89.out_data[gl_GlobalInvocationID.x] = _100; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/type-alias.comp b/third_party/spirv-cross/reference/opt/shaders/comp/type-alias.comp new file mode 100644 index 0000000000..c0f57f4bda --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/type-alias.comp @@ -0,0 +1,33 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct S0 +{ + vec4 a; +}; + +struct S1 +{ + vec4 a; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + S0 s0s[]; +} _36; + +layout(binding = 1, std430) buffer SSBO1 +{ + S1 s1s[]; +} _55; + +layout(binding = 2, std430) buffer SSBO2 +{ + vec4 outputs[]; +} _66; + +void main() +{ + _66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/comp/udiv.comp b/third_party/spirv-cross/reference/opt/shaders/comp/udiv.comp new file mode 100644 index 0000000000..0c1f926ad0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/comp/udiv.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO2 +{ + uint outputs[]; +} _10; + +layout(binding = 0, std430) buffer SSBO +{ + uint inputs[]; +} _23; + +void main() +{ + _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp new file mode 100644 index 0000000000..ba37ca237b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/enhanced-layouts.comp @@ -0,0 +1,40 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + int a; + int b; + int c; +}; + +layout(binding = 1, std140) buffer SSBO1 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo1; + +layout(binding = 2, std430) buffer SSBO2 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo2; + +layout(binding = 0, std140) uniform UBO +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ubo; + +void main() +{ + ssbo1.a = ssbo2.a; + ssbo1.b = ubo.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..9c55c74db4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,159 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct ResType +{ + uint _m0; + uint _m1; +}; + +struct ResType_1 +{ + uvec2 _m0; + uvec2 _m1; +}; + +struct ResType_2 +{ + uvec3 _m0; + uvec3 _m1; +}; + +struct ResType_3 +{ + uvec4 _m0; + uvec4 _m1; +}; + +struct ResType_4 +{ + int _m0; + int _m1; +}; + +struct ResType_5 +{ + ivec2 _m0; + ivec2 _m1; +}; + +struct ResType_6 +{ + ivec3 _m0; + ivec3 _m1; +}; + +struct ResType_7 +{ + ivec4 _m0; + ivec4 _m1; +}; + +layout(binding = 0, std430) buffer SSBOUint +{ + uint a; + uint b; + uint c; + uint d; + uvec2 a2; + uvec2 b2; + uvec2 c2; + uvec2 d2; + uvec3 a3; + uvec3 b3; + uvec3 c3; + uvec3 d3; + uvec4 a4; + uvec4 b4; + uvec4 c4; + uvec4 d4; +} u; + +layout(binding = 1, std430) buffer SSBOInt +{ + int a; + int b; + int c; + int d; + ivec2 a2; + ivec2 b2; + ivec2 c2; + ivec2 d2; + ivec3 a3; + ivec3 b3; + ivec3 c3; + ivec3 d3; + ivec4 a4; + ivec4 b4; + ivec4 c4; + ivec4 d4; +} i; + +void main() +{ + ResType _25; + _25._m0 = uaddCarry(u.a, u.b, _25._m1); + u.d = _25._m1; + u.c = _25._m0; + ResType_1 _40; + _40._m0 = uaddCarry(u.a2, u.b2, _40._m1); + u.d2 = _40._m1; + u.c2 = _40._m0; + ResType_2 _55; + _55._m0 = uaddCarry(u.a3, u.b3, _55._m1); + u.d3 = _55._m1; + u.c3 = _55._m0; + ResType_3 _70; + _70._m0 = uaddCarry(u.a4, u.b4, _70._m1); + u.d4 = _70._m1; + u.c4 = _70._m0; + ResType _79; + _79._m0 = usubBorrow(u.a, u.b, _79._m1); + u.d = _79._m1; + u.c = _79._m0; + ResType_1 _88; + _88._m0 = usubBorrow(u.a2, u.b2, _88._m1); + u.d2 = _88._m1; + u.c2 = _88._m0; + ResType_2 _97; + _97._m0 = usubBorrow(u.a3, u.b3, _97._m1); + u.d3 = _97._m1; + u.c3 = _97._m0; + ResType_3 _106; + _106._m0 = usubBorrow(u.a4, u.b4, _106._m1); + u.d4 = _106._m1; + u.c4 = _106._m0; + ResType _116; + umulExtended(u.a, u.b, _116._m1, _116._m0); + u.d = _116._m0; + u.c = _116._m1; + ResType_1 _125; + umulExtended(u.a2, u.b2, _125._m1, _125._m0); + u.d2 = _125._m0; + u.c2 = _125._m1; + ResType_2 _134; + umulExtended(u.a3, u.b3, _134._m1, _134._m0); + u.d3 = _134._m0; + u.c3 = _134._m1; + ResType_3 _143; + umulExtended(u.a4, u.b4, _143._m1, _143._m0); + u.d4 = _143._m0; + u.c4 = _143._m1; + ResType_4 _160; + imulExtended(i.a, i.b, _160._m1, _160._m0); + i.d = _160._m0; + i.c = _160._m1; + ResType_5 _171; + imulExtended(i.a2, i.b2, _171._m1, _171._m0); + i.d2 = _171._m0; + i.c2 = _171._m1; + ResType_6 _182; + imulExtended(i.a3, i.b3, _182._m1, _182._m0); + i.d3 = _182._m0; + i.c3 = _182._m1; + ResType_7 _193; + imulExtended(i.a4, i.b4, _193._m1, _193._m0); + i.d4 = _193._m0; + i.c4 = _193._m1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/fp64.desktop.comp b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/fp64.desktop.comp new file mode 100644 index 0000000000..3839a091f5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/fp64.desktop.comp @@ -0,0 +1,63 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct M0 +{ + double v; + dvec2 b[2]; + dmat2x3 c; + dmat3x2 d; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + dvec4 a; + M0 m0; + dmat4 b; +} ssbo_0; + +layout(binding = 1, std430) buffer SSBO1 +{ + dmat4 a; + dvec4 b; + M0 m0; +} ssbo_1; + +layout(binding = 2, std430) buffer SSBO2 +{ + double a[4]; + dvec2 b[4]; +} ssbo_2; + +layout(binding = 3, std140) buffer SSBO3 +{ + double a[4]; + dvec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += dvec4(10.0lf, 20.0lf, 30.0lf, 40.0lf); + ssbo_0.a += dvec4(20.0lf); + dvec4 _40 = ssbo_0.a; + ssbo_0.a = abs(_40); + ssbo_0.a = sign(_40); + ssbo_0.a = floor(_40); + ssbo_0.a = trunc(_40); + ssbo_0.a = round(_40); + ssbo_0.a = roundEven(_40); + ssbo_0.a = ceil(_40); + ssbo_0.a = fract(_40); + ssbo_0.a = mod(_40, dvec4(20.0lf)); + ssbo_0.a = mod(_40, _40); + ssbo_0.a = min(_40, _40); + ssbo_0.a = max(_40, _40); + ssbo_0.a = clamp(_40, _40, _40); + ssbo_0.a = mix(_40, _40, _40); + ssbo_0.a = step(_40, _40); + ssbo_0.a = smoothstep(_40, _40, _40); + ssbo_1.b.x += 1.0lf; + ssbo_2.b[0].x += 1.0lf; + ssbo_3.b[0].x += 1.0lf; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp new file mode 100644 index 0000000000..37b2863558 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp @@ -0,0 +1,7 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/int64.desktop.comp b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/int64.desktop.comp new file mode 100644 index 0000000000..28afc2fbd7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/comp/int64.desktop.comp @@ -0,0 +1,58 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct M0 +{ + int64_t v; + i64vec2 b[2]; + uint64_t c; + uint64_t d[5]; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + i64vec4 a; + M0 m0; +} ssbo_0; + +layout(binding = 1, std430) buffer SSBO1 +{ + u64vec4 b; + M0 m0; +} ssbo_1; + +layout(binding = 2, std430) buffer SSBO2 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_2; + +layout(binding = 3, std140) buffer SSBO3 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += i64vec4(10l, 20l, 30l, 40l); + ssbo_1.b += u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul); + ssbo_0.a += i64vec4(20l); + ssbo_0.a = abs(ssbo_0.a + i64vec4(ssbo_1.b)); + ssbo_0.a += i64vec4(1l); + ssbo_1.b += u64vec4(i64vec4(1l)); + ssbo_0.a -= i64vec4(1l); + ssbo_1.b -= u64vec4(i64vec4(1l)); + ssbo_1.b = doubleBitsToUint64(int64BitsToDouble(ssbo_0.a)); + ssbo_0.a = doubleBitsToInt64(uint64BitsToDouble(ssbo_1.b)); + ssbo_2.a[0] += 1l; + ssbo_3.a[0] += 2l; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/clip-cull-distance.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/clip-cull-distance.desktop.frag new file mode 100644 index 0000000000..3cc3205509 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/clip-cull-distance.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +in float gl_ClipDistance[4]; +in float gl_CullDistance[3]; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = gl_ClipDistance[0] + gl_CullDistance[0]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..29c59012cc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,37 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vInput; + +void main() +{ + FragColor = vInput; + vec4 _23 = texture(uSampler, vInput.xy); + vec4 _26 = dFdx(vInput); + vec4 _29 = dFdy(vInput); + vec4 _32 = fwidth(vInput); + vec4 _35 = dFdxCoarse(vInput); + vec4 _38 = dFdyCoarse(vInput); + vec4 _41 = fwidthCoarse(vInput); + vec4 _44 = dFdxFine(vInput); + vec4 _47 = dFdyFine(vInput); + vec4 _50 = fwidthFine(vInput); + vec2 _56 = textureQueryLod(uSampler, vInput.zw); + if (vInput.y > 10.0) + { + FragColor += _23; + FragColor += _26; + FragColor += _29; + FragColor += _32; + FragColor += _35; + FragColor += _38; + FragColor += _41; + FragColor += _44; + FragColor += _47; + FragColor += _50; + FragColor += _56.xyxy; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-greater-than.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-greater-than.desktop.frag new file mode 100644 index 0000000000..8b7c296447 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-greater-than.desktop.frag @@ -0,0 +1,9 @@ +#version 450 +layout(depth_greater) out float gl_FragDepth; +layout(early_fragment_tests) in; + +void main() +{ + gl_FragDepth = 0.5; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-less-than.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-less-than.desktop.frag new file mode 100644 index 0000000000..44752eb8fb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/depth-less-than.desktop.frag @@ -0,0 +1,9 @@ +#version 450 +layout(depth_less) out float gl_FragDepth; +layout(early_fragment_tests) in; + +void main() +{ + gl_FragDepth = 0.5; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/dual-source-blending.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/dual-source-blending.desktop.frag new file mode 100644 index 0000000000..3d946b04a5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/dual-source-blending.desktop.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0, index = 0) out vec4 FragColor0; +layout(location = 0, index = 1) out vec4 FragColor1; + +void main() +{ + FragColor0 = vec4(1.0); + FragColor1 = vec4(2.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag new file mode 100644 index 0000000000..2d0809fdbf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(binding = 0, std430) buffer Foobar +{ + vec4 _data[]; +} Foobar_1; + +layout(binding = 1, std430) buffer Foobaz +{ + vec4 _data[]; +} Foobaz_1; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + _entryPointOutput = Foobar_1._data[0] + Foobaz_1._data[0]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..1276981768 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0, rgba8) uniform image2DMS uImage; +layout(binding = 1, rgba8) uniform image2DMSArray uImageArray; + +void main() +{ + vec4 _29 = imageLoad(uImageArray, ivec3(1, 2, 4), 3); + imageStore(uImage, ivec2(2, 3), 1, imageLoad(uImage, ivec2(1, 2), 2)); + imageStore(uImageArray, ivec3(2, 3, 7), 1, _29); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag new file mode 100644 index 0000000000..05ce10adfa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-query.desktop.frag @@ -0,0 +1,6 @@ +#version 450 + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.frag new file mode 100644 index 0000000000..5bb060398e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0, r32f) uniform readonly writeonly image2D uImage1; +layout(binding = 1, r32f) uniform readonly writeonly image2D uImage2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag new file mode 100644 index 0000000000..1d9062064a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0, r32f) uniform image2D uImage1; +layout(binding = 1, r32f) uniform image2D uImage2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/in-block-qualifiers.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/in-block-qualifiers.frag new file mode 100644 index 0000000000..d4622801df --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/in-block-qualifiers.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in VertexData +{ + flat float f; + centroid vec4 g; + flat int h; + float i; +} vin; + +layout(location = 4) flat in float f; +layout(location = 5) centroid in vec4 g; +layout(location = 6) flat in int h; +layout(location = 7) sample in float i; + +void main() +{ + FragColor = ((((((vec4(vin.f) + vin.g) + vec4(float(vin.h))) + vec4(vin.i)) + vec4(f)) + g) + vec4(float(h))) + vec4(i); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/layout-component.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/layout-component.desktop.frag new file mode 100644 index 0000000000..13f17feeed --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/layout-component.desktop.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec2 FragColor; +layout(location = 0, component = 0) in vec2 v0; +layout(location = 0, component = 2) in float v1; +in Vertex +{ + layout(location = 1, component = 2) float v3; +} _20; + + +void main() +{ + FragColor = (v0 + vec2(v1)) + vec2(_20.v3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..4a80cbf81f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(textureQueryLevels(uSampler))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-lod.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..f43543b8c0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/query-lod.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTexCoord; + +void main() +{ + FragColor = textureQueryLod(uSampler, vTexCoord).xyxy; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..4c30ed1529 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSampler; +layout(binding = 1) uniform sampler2DMSArray uSamplerArray; +layout(binding = 2, rgba8) uniform readonly writeonly image2DMS uImage; +layout(binding = 3, rgba8) uniform readonly writeonly image2DMSArray uImageArray; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(((textureSamples(uSampler) + textureSamples(uSamplerArray)) + imageSamples(uImage)) + imageSamples(uImageArray))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/stencil-export.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/stencil-export.desktop.frag new file mode 100644 index 0000000000..65082a8b2d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/stencil-export.desktop.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_ARB_shader_stencil_export : require + +layout(location = 0) out vec4 MRT0; +layout(location = 1) out vec4 MRT1; + +void main() +{ + MRT0 = vec4(1.0); + MRT1 = vec4(1.0, 0.0, 1.0, 1.0); + gl_FragStencilRefARB = 100; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag new file mode 100644 index 0000000000..334a6b1944 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag @@ -0,0 +1,27 @@ +#version 450 + +layout(binding = 0) uniform sampler1DShadow uShadow1D; +layout(binding = 1) uniform sampler2DShadow uShadow2D; +layout(binding = 2) uniform sampler1D uSampler1D; +layout(binding = 3) uniform sampler2D uSampler2D; +layout(binding = 4) uniform sampler3D uSampler3D; + +layout(location = 0) out float FragColor; +layout(location = 1) in vec4 vClip4; +layout(location = 2) in vec2 vClip2; +layout(location = 0) in vec3 vClip3; + +void main() +{ + vec4 _17 = vClip4; + vec4 _20 = _17; + _20.y = _17.w; + FragColor = textureProj(uShadow1D, vec4(_20.x, 0.0, _17.z, _20.y)); + vec4 _30 = _17; + _30.z = _17.w; + FragColor = textureProj(uShadow2D, vec4(_30.xy, _17.z, _30.z)); + FragColor = textureProj(uSampler1D, vClip2).x; + FragColor = textureProj(uSampler2D, vClip3).x; + FragColor = textureProj(uSampler3D, _17).x; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom b/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom new file mode 100644 index 0000000000..8e51cfa36b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/basic.desktop.sso.geom @@ -0,0 +1,36 @@ +#version 450 +layout(invocations = 4, triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + float _37 = float(gl_InvocationID); + vNormal = vin[0].normal + vec3(_37); + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + vec3(4.0 * _37); + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + vec3(2.0 * _37); + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/viewport-index.desktop.geom b/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/viewport-index.desktop.geom new file mode 100644 index 0000000000..773aeb8bfd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/geom/viewport-index.desktop.geom @@ -0,0 +1,9 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 4, triangle_strip) out; + +void main() +{ + gl_ViewportIndex = 1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/reference/opt/shaders/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..c51699db6d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,27 @@ +#version 450 +layout(vertices = 1) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +} gl_out[1]; + +layout(location = 0) patch out vec3 vFoo; + +void main() +{ + gl_TessLevelInner[0] = 8.8999996185302734375; + gl_TessLevelInner[1] = 6.900000095367431640625; + gl_TessLevelOuter[0] = 8.8999996185302734375; + gl_TessLevelOuter[1] = 6.900000095367431640625; + gl_TessLevelOuter[2] = 3.900000095367431640625; + gl_TessLevelOuter[3] = 4.900000095367431640625; + vFoo = vec3(1.0); + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/reference/opt/shaders/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..c9bacd464e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,18 @@ +#version 450 +layout(triangles, cw, fractional_even_spacing) in; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = ((gl_in[0].gl_Position * gl_TessCoord.x) + (gl_in[1].gl_Position * gl_TessCoord.y)) + (gl_in[2].gl_Position * gl_TessCoord.z); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..2f880398e0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,22 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(binding = 0, std140) uniform UBO +{ + mat4 uMVP; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.uMVP * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert new file mode 100644 index 0000000000..a7c5d761c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[4]; + float gl_CullDistance[3]; +}; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..2f3d49f55d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,15 @@ +#version 450 + +out float gl_ClipDistance[4]; +out float gl_CullDistance[3]; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/out-block-qualifiers.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/out-block-qualifiers.vert new file mode 100644 index 0000000000..7c731684bc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/out-block-qualifiers.vert @@ -0,0 +1,27 @@ +#version 450 + +layout(location = 0) out VertexData +{ + flat float f; + centroid vec4 g; + flat int h; + float i; +} vout; + +layout(location = 4) flat out float f; +layout(location = 5) centroid out vec4 g; +layout(location = 6) flat out int h; +layout(location = 7) out float i; + +void main() +{ + vout.f = 10.0; + vout.g = vec4(20.0); + vout.h = 20; + vout.i = 30.0; + f = 10.0; + g = vec4(20.0); + h = 20; + i = 30.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert new file mode 100644 index 0000000000..2b3c5ce051 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert @@ -0,0 +1,24 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseVertex gl_BaseVertexARB +#else +uniform int SPIRV_Cross_BaseVertex; +#endif +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +#ifndef GL_ARB_shader_draw_parameters +#error GL_ARB_shader_draw_parameters is not supported. +#endif + +void main() +{ + gl_Position = vec4(float(SPIRV_Cross_BaseVertex), float(SPIRV_Cross_BaseInstance), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk new file mode 100644 index 0000000000..6121dd8f15 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk @@ -0,0 +1,8 @@ +#version 450 +#extension GL_ARB_shader_draw_parameters : require + +void main() +{ + gl_Position = vec4(float(gl_BaseVertexARB), float(gl_BaseInstanceARB), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert new file mode 100644 index 0000000000..bc16d0431a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert @@ -0,0 +1,24 @@ +#version 460 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseVertex gl_BaseVertexARB +#else +uniform int SPIRV_Cross_BaseVertex; +#endif +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +#ifndef GL_ARB_shader_draw_parameters +#error GL_ARB_shader_draw_parameters is not supported. +#endif + +void main() +{ + gl_Position = vec4(float(SPIRV_Cross_BaseVertex), float(SPIRV_Cross_BaseInstance), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk new file mode 100644 index 0000000000..b6948fbc4a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk @@ -0,0 +1,7 @@ +#version 460 + +void main() +{ + gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), float(gl_DrawID), 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/array.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/array.flatten.vert new file mode 100644 index 0000000000..de4eb3b78d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/array.flatten.vert @@ -0,0 +1,10 @@ +#version 310 es + +uniform vec4 UBO[56]; +layout(location = 0) in vec4 aVertex; + +void main() +{ + gl_Position = ((mat4(UBO[40], UBO[41], UBO[42], UBO[43]) * aVertex) + UBO[55]) + ((UBO[50] + UBO[45]) + vec4(UBO[54].x)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/basic.flatten.vert new file mode 100644 index 0000000000..f7eb758f2a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/basic.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +uniform vec4 UBO[4]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/copy.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/copy.flatten.vert new file mode 100644 index 0000000000..33caec4f78 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/copy.flatten.vert @@ -0,0 +1,27 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + for (int _96 = 0; _96 < 4; ) + { + vec3 _68 = aVertex.xyz - Light(UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]).Position; + vColor += ((UBO[_96 * 2 + 5] * clamp(1.0 - (length(_68) / Light(UBO[_96 * 2 + 4].xyz, UBO[_96 * 2 + 4].w, UBO[_96 * 2 + 5]).Radius), 0.0, 1.0)) * dot(aNormal, normalize(_68))); + _96++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/dynamic.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..7129af2869 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/dynamic.flatten.vert @@ -0,0 +1,27 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + for (int _82 = 0; _82 < 4; ) + { + vec3 _54 = aVertex.xyz - UBO[_82 * 2 + 4].xyz; + vColor += ((UBO[_82 * 2 + 5] * clamp(1.0 - (length(_54) / UBO[_82 * 2 + 4].w), 0.0, 1.0)) * dot(aNormal, normalize(_54))); + _82++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/reference/opt/shaders/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..ee79bf5b8a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform vec4 UBO[4]; +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in vec3 vNormal; + +void main() +{ + mat4 _19 = mat4(UBO[0], UBO[1], UBO[2], UBO[3]); + FragColor = mat3(_19[0].xyz, _19[1].xyz, _19[2].xyz) * vNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..f6d0fa486d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/matrixindex.flatten.vert @@ -0,0 +1,19 @@ +#version 310 es + +uniform vec4 UBO[14]; +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; + +void main() +{ + gl_Position = vec4(0.0); + oA = UBO[1]; + oB = vec4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y); + oC = UBO[9]; + oD = vec4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x); + oE = vec4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..3850bf6c70 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/multiindex.flatten.vert @@ -0,0 +1,10 @@ +#version 310 es + +uniform vec4 UBO[15]; +layout(location = 0) in ivec2 aIndex; + +void main() +{ + gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..216c1f9d1b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/push-constant.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +uniform vec4 PushMe[6]; +layout(location = 1) in vec4 Pos; +layout(location = 0) out vec2 vRot; +layout(location = 0) in vec2 Rot; + +void main() +{ + gl_Position = mat4(PushMe[0], PushMe[1], PushMe[2], PushMe[3]) * Pos; + vRot = (mat2(PushMe[4].xy, PushMe[4].zw) * Rot) + vec2(PushMe[5].z); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..b74aa004b4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/rowmajor.flatten.vert @@ -0,0 +1,10 @@ +#version 310 es + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; + +void main() +{ + gl_Position = (mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex) + (aVertex * mat4(UBO[4], UBO[5], UBO[6], UBO[7])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/struct.flatten.vert new file mode 100644 index 0000000000..35db010c76 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/struct.flatten.vert @@ -0,0 +1,22 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[6]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + vec3 _39 = aVertex.xyz - UBO[4].xyz; + vColor += ((UBO[5] * clamp(1.0 - (length(_39) / UBO[4].w), 0.0, 1.0)) * dot(aNormal, normalize(_39))); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..709d99291a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,21 @@ +#version 310 es + +struct Foo +{ + mat3x4 MVP0; + mat3x4 MVP1; +}; + +uniform vec4 UBO[8]; +layout(location = 0) in vec4 v0; +layout(location = 1) in vec4 v1; +layout(location = 0) out vec3 V0; +layout(location = 1) out vec3 V1; + +void main() +{ + Foo _20 = Foo(transpose(mat4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(mat4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))); + V0 = v0 * _20.MVP0; + V1 = v1 * _20.MVP1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/opt/shaders/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..92afb475e6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/swizzle.flatten.vert @@ -0,0 +1,21 @@ +#version 310 es + +uniform vec4 UBO[8]; +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; +layout(location = 5) out vec4 oF; + +void main() +{ + gl_Position = vec4(0.0); + oA = UBO[0]; + oB = vec4(UBO[1].xy, UBO[1].zw); + oC = vec4(UBO[2].x, UBO[3].xyz); + oD = vec4(UBO[4].xyz, UBO[4].w); + oE = vec4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w); + oF = vec4(UBO[6].x, UBO[6].zw, UBO[7].x); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/flatten/types.flatten.frag b/third_party/spirv-cross/reference/opt/shaders/flatten/types.flatten.frag new file mode 100644 index 0000000000..a74327d97b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/flatten/types.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump ivec4 UBO1[2]; +uniform mediump uvec4 UBO2[2]; +uniform vec4 UBO0[2]; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ((((vec4(UBO1[0]) + vec4(UBO1[1])) + vec4(UBO2[0])) + vec4(UBO2[1])) + UBO0[0]) + UBO0[1]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/opt/shaders/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..f50d0d4e43 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _17[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); + +layout(location = 0) out vec4 FragColor; + +void main() +{ + for (mediump int _46 = 0; _46 < 4; ) + { + mediump int _33 = _46 + 1; + FragColor += vec4(_17[_33]); + _46 = _33; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/avoid-expression-lowering-to-loop.frag b/third_party/spirv-cross/reference/opt/shaders/frag/avoid-expression-lowering-to-loop.frag new file mode 100644 index 0000000000..8eaea64e63 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/avoid-expression-lowering-to-loop.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 1, std140) uniform Count +{ + float count; +} _44; + +layout(binding = 0) uniform mediump sampler2D tex; + +layout(location = 0) in highp vec4 vertex; +layout(location = 0) out vec4 fragColor; + +void main() +{ + highp float _24 = 1.0 / float(textureSize(tex, 0).x); + highp float _34 = dFdx(vertex.x); + float _62; + _62 = 0.0; + for (float _61 = 0.0; _61 < _44.count; ) + { + _62 = _24 * _34 + _62; + _61 += 1.0; + continue; + } + fragColor = vec4(_62); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-khr.frag b/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-khr.frag new file mode 100644 index 0000000000..71a44c3857 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-khr.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_EXT_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexEXT in vec2 vUV[3]; +layout(location = 3) pervertexEXT in vec2 vUV2[3]; + +void main() +{ + value = ((vUV[0] * gl_BaryCoordEXT.x) + (vUV[1] * gl_BaryCoordEXT.y)) + (vUV[2] * gl_BaryCoordEXT.z); + value += (((vUV2[0] * gl_BaryCoordNoPerspEXT.x) + (vUV2[1] * gl_BaryCoordNoPerspEXT.y)) + (vUV2[2] * gl_BaryCoordNoPerspEXT.z)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-nv.frag b/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-nv.frag new file mode 100644 index 0000000000..b3b57e2f88 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/barycentric-nv.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexNV in vec2 vUV[3]; +layout(location = 1) pervertexNV in vec2 vUV2[3]; + +void main() +{ + value = ((vUV[0] * gl_BaryCoordNV.x) + (vUV[1] * gl_BaryCoordNV.y)) + (vUV[2] * gl_BaryCoordNV.z); + value += (((vUV2[0] * gl_BaryCoordNoPerspNV.x) + (vUV2[1] * gl_BaryCoordNoPerspNV.y)) + (vUV2[2] * gl_BaryCoordNoPerspNV.z)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/basic.frag b/third_party/spirv-cross/reference/opt/shaders/frag/basic.frag new file mode 100644 index 0000000000..2a4e440421 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/basic.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/opt/shaders/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..56b4c89a59 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0, std430) buffer UBO +{ + vec4 results[1024]; +} _34; + +layout(binding = 1) uniform highp isampler2D Buf; + +layout(location = 0) flat in mediump int vIn; +layout(location = 1) flat in mediump int vIn2; +layout(location = 0) out vec4 FragColor; + +void main() +{ + mediump int _40 = texelFetch(Buf, ivec2(gl_FragCoord.xy), 0).x % 16; + FragColor = (_34.results[_40] + _34.results[_40]) + _34.results[(vIn * vIn) + (vIn2 * vIn2)]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/reference/opt/shaders/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..eb59732fdc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D Texture; + +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _19 = texture(Texture, vTexCoord); + float _22 = _19.x; + FragColor = vec4(_22 * _22); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/constant-array.frag b/third_party/spirv-cross/reference/opt/shaders/frag/constant-array.frag new file mode 100644 index 0000000000..a7a064a163 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/constant-array.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foobar +{ + float a; + float b; +}; + +const vec4 _37[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0)); +const vec4 _55[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0))); +const Foobar _75[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int index; + +void main() +{ + highp float _106 = _75[index].a; + float mp_copy_106 = _106; + highp float _107 = _75[index].b; + float mp_copy_107 = _107; + FragColor = ((_37[index] + _55[index][index + 1]) + vec4(30.0)) + vec4(mp_copy_106 + mp_copy_107); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/constant-composites.frag b/third_party/spirv-cross/reference/opt/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..7813b98db2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/constant-composites.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _16[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; + +const Foo _28[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int line; + +void main() +{ + FragColor = vec4(_16[line]); + FragColor += vec4(_28[line].a * _28[1 - line].a); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/false-loop-init.frag b/third_party/spirv-cross/reference/opt/shaders/frag/false-loop-init.frag new file mode 100644 index 0000000000..7ded0eab41 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/false-loop-init.frag @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 result; +layout(location = 0) in vec4 accum; + +void main() +{ + result = vec4(0.0); + for (mediump int _48 = 0; _48 < 4; ) + { + result += accum; + _48 += int((accum.y > 10.0) ? 40u : 30u); + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/flush_params.frag b/third_party/spirv-cross/reference/opt/shaders/frag/flush_params.frag new file mode 100644 index 0000000000..16b4994148 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/flush_params.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..f49b906099 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(0.0); + for (int _43 = 0; _43 < 3; ) + { + FragColor[_43] += float(_43); + _43++; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-init.frag b/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-init.frag new file mode 100644 index 0000000000..6c2dfb5094 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/for-loop-init.frag @@ -0,0 +1,65 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out mediump int FragColor; + +void main() +{ + do + { + FragColor = 16; + for (mediump int _143 = 0; _143 < 25; ) + { + FragColor += 10; + _143++; + continue; + } + for (mediump int _144 = 1; _144 < 30; ) + { + FragColor += 11; + _144++; + continue; + } + mediump int _145; + _145 = 0; + for (; _145 < 20; ) + { + FragColor += 12; + _145++; + continue; + } + mediump int _62 = _145 + 3; + FragColor += _62; + if (_62 == 40) + { + for (mediump int _149 = 0; _149 < 40; ) + { + FragColor += 13; + _149++; + continue; + } + break; + } + FragColor += _62; + mediump ivec2 _146; + _146 = ivec2(0); + for (; _146.x < 10; ) + { + FragColor += _146.y; + mediump ivec2 _142 = _146; + _142.x = _146.x + 4; + _146 = _142; + continue; + } + for (mediump int _148 = _62; _148 < 40; ) + { + FragColor += _148; + _148++; + continue; + } + FragColor += _62; + break; + } while(false); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/frexp-modf.frag b/third_party/spirv-cross/reference/opt/shaders/frag/frexp-modf.frag new file mode 100644 index 0000000000..134878e034 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/frexp-modf.frag @@ -0,0 +1,35 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct ResType +{ + highp float _m0; + int _m1; +}; + +struct ResType_1 +{ + highp vec2 _m0; + ivec2 _m1; +}; + +layout(location = 0) in float v0; +layout(location = 1) in vec2 v1; +layout(location = 0) out float FragColor; + +void main() +{ + ResType _22; + _22._m0 = frexp(v0 + 1.0, _22._m1); + highp float _24 = _22._m0; + float mp_copy_24 = _24; + ResType_1 _35; + _35._m0 = frexp(v1, _35._m1); + float r0; + float _41 = modf(v0, r0); + vec2 r1; + vec2 _45 = modf(v1, r1); + FragColor = ((((mp_copy_24 + _35._m0.x) + _35._m0.y) + _41) + _45.x) + _45.y; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/front-facing.frag b/third_party/spirv-cross/reference/opt/shaders/frag/front-facing.frag new file mode 100644 index 0000000000..cc9aecc8ba --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/front-facing.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + if (gl_FrontFacing) + { + FragColor = vA; + } + else + { + FragColor = vB; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/gather-dref.frag b/third_party/spirv-cross/reference/opt/shaders/frag/gather-dref.frag new file mode 100644 index 0000000000..5416f79cb5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/gather-dref.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DShadow uT; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec3 vUV; + +void main() +{ + FragColor = textureGather(uT, vUV.xy, vUV.z); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/ground.frag b/third_party/spirv-cross/reference/opt/shaders/frag/ground.frag new file mode 100644 index 0000000000..d28f93efff --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/ground.frag @@ -0,0 +1,38 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 4, std140) uniform GlobalPSData +{ + vec4 g_CamPos; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_ResolutionParams; + vec4 g_TimeParams; + vec4 g_FogColor_Distance; +} _101; + +layout(binding = 2) uniform mediump sampler2D TexNormalmap; + +layout(location = 3) out vec4 LightingOut; +layout(location = 2) out vec4 NormalOut; +layout(location = 1) out vec4 SpecularOut; +layout(location = 0) out vec4 AlbedoOut; +layout(location = 0) in vec2 TexCoord; +layout(location = 1) in vec3 EyeVec; + +void main() +{ + vec3 _68 = normalize((texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0)); + float _113 = smoothstep(0.0, 0.1500000059604644775390625, (_101.g_CamPos.y + EyeVec.y) * 0.004999999888241291046142578125); + float _125 = smoothstep(0.699999988079071044921875, 0.75, _68.y); + highp float hp_copy_125 = _125; + vec3 _130 = mix(vec3(0.100000001490116119384765625), mix(vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625), vec3(0.800000011920928955078125), vec3(_113)), vec3(_125)); + highp float _172 = -hp_copy_125; + float mp_copy_172 = _172; + LightingOut = vec4(0.0); + NormalOut = vec4((_68 * 0.5) + vec3(0.5), 0.0); + SpecularOut = vec4(mp_copy_172 * _113 + 1.0, 0.0, 0.0, 0.0); + AlbedoOut = vec4(_130 * _130, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/helper-invocation.frag b/third_party/spirv-cross/reference/opt/shaders/frag/helper-invocation.frag new file mode 100644 index 0000000000..0c44f72ad6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/helper-invocation.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uSampler; + +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _52; + if (!gl_HelperInvocation) + { + _52 = textureLod(uSampler, vUV, 0.0); + } + else + { + _52 = vec4(1.0); + } + FragColor = _52; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag b/third_party/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag new file mode 100644 index 0000000000..050218b13b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag @@ -0,0 +1,28 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int vA; +layout(location = 1) flat in mediump int vB; + +void main() +{ + FragColor = vec4(0.0); + mediump int _49; + mediump int _58; + for (mediump int _57 = 0, _60 = 0; _57 < vA; _60 = _58, _57 += _49) + { + if ((vA + _57) == 20) + { + _58 = 50; + } + else + { + _58 = ((vB + _57) == 40) ? 60 : _60; + } + _49 = _58 + 10; + FragColor += vec4(1.0); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/image-load-store-uint-coord.asm.frag b/third_party/spirv-cross/reference/opt/shaders/frag/image-load-store-uint-coord.asm.frag new file mode 100644 index 0000000000..f25b4b738a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/image-load-store-uint-coord.asm.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(binding = 1, rgba32f) uniform image2D RWIm; +layout(binding = 0, rgba32f) uniform writeonly imageBuffer RWBuf; +layout(binding = 1) uniform sampler2D ROIm; +layout(binding = 0) uniform samplerBuffer ROBuf; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + imageStore(RWIm, ivec2(uvec2(10u)), vec4(10.0, 0.5, 8.0, 2.0)); + vec4 _70 = imageLoad(RWIm, ivec2(uvec2(30u))); + imageStore(RWBuf, int(80u), _70); + _entryPointOutput = (_70 + texelFetch(ROIm, ivec2(uvec2(50u, 60u)), 0)) + texelFetch(ROBuf, int(80u)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/inside-loop-dominated-variable-preservation.frag b/third_party/spirv-cross/reference/opt/shaders/frag/inside-loop-dominated-variable-preservation.frag new file mode 100644 index 0000000000..7724b14629 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/inside-loop-dominated-variable-preservation.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag b/third_party/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag new file mode 100644 index 0000000000..ee64d8335a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag @@ -0,0 +1,56 @@ +#version 310 es +precision mediump float; +precision highp int; + +vec4 _80; + +layout(location = 0) out vec4 fragColor; + +void main() +{ + mediump int _18 = int(_80.x); + vec4 _82; + _82 = _80; + vec4 _89; + for (mediump int _81 = 0; _81 < _18; _82 = _89, _81++) + { + vec4 _83; + switch (_18) + { + case 0: + { + vec4 _74 = _82; + _74.y = 0.0; + _83 = _74; + break; + } + case 1: + { + vec4 _76 = _82; + _76.y = 1.0; + _83 = _76; + break; + } + default: + { + vec4 _88; + _88 = _82; + for (mediump int _84 = 0; _84 < _18; ) + { + vec4 _72 = _88; + _72.y = _88.y + 0.5; + _88 = _72; + _84++; + continue; + } + _89 = _88; + continue; + } + } + vec4 _79 = _83; + _79.y = _83.y + 0.5; + _89 = _79; + } + fragColor = _82; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/lut-promotion.frag b/third_party/spirv-cross/reference/opt/shaders/frag/lut-promotion.frag new file mode 100644 index 0000000000..2f57d84fd2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/lut-promotion.frag @@ -0,0 +1,41 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _16[16] = float[](1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0); +const vec4 _60[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); +const vec4 _104[4] = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + +layout(location = 0) out float FragColor; +layout(location = 0) flat in mediump int index; + +void main() +{ + FragColor = _16[index]; + if (index < 10) + { + FragColor += _16[index ^ 1]; + } + else + { + FragColor += _16[index & 1]; + } + bool _63 = index > 30; + if (_63) + { + FragColor += _60[index & 3].y; + } + else + { + FragColor += _60[index & 1].x; + } + vec4 foobar[4] = _60; + if (_63) + { + foobar[1].z = 20.0; + } + mediump int _91 = index & 3; + FragColor += foobar[_91].z; + FragColor += _104[_91].z; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/mix.frag b/third_party/spirv-cross/reference/opt/shaders/frag/mix.frag new file mode 100644 index 0000000000..f791d45ce3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/mix.frag @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn0; +layout(location = 1) in vec4 vIn1; +layout(location = 2) in float vIn2; +layout(location = 3) in float vIn3; + +void main() +{ + FragColor = vec4(vIn0.x, vIn1.y, vIn0.z, vIn0.w); + FragColor = vec4(vIn3); + FragColor = vIn0.xyzw; + FragColor = vec4(vIn2); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/modf-pointer-function-analysis.frag b/third_party/spirv-cross/reference/opt/shaders/frag/modf-pointer-function-analysis.frag new file mode 100644 index 0000000000..07160bbdec --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/modf-pointer-function-analysis.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +void main() +{ + vec4 param; + vec4 _59 = modf(v, param); + vo0 = _59; + vo1 = param; + vec4 param_1 = param; + float _65 = modf(v.x, param_1.x); + vo0.x += _65; + vo1.x += param_1.x; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/partial-write-preserve.frag b/third_party/spirv-cross/reference/opt/shaders/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..d6c1fe8b44 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/partial-write-preserve.frag @@ -0,0 +1,8 @@ +#version 310 es +precision mediump float; +precision highp int; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-ordered.frag b/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-ordered.frag new file mode 100644 index 0000000000..915b56511f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-ordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-unordered.frag b/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-unordered.frag new file mode 100644 index 0000000000..13962daf19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/pixel-interlock-unordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_unordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/pls.frag b/third_party/spirv-cross/reference/opt/shaders/frag/pls.frag new file mode 100644 index 0000000000..1cafdbd365 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/pls.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 PLSOut0; +layout(location = 0) in vec4 PLSIn0; +layout(location = 1) out vec4 PLSOut1; +layout(location = 1) in vec4 PLSIn1; +layout(location = 2) out vec4 PLSOut2; +layout(location = 2) in vec4 PLSIn2; +layout(location = 3) out vec4 PLSOut3; +layout(location = 3) in vec4 PLSIn3; + +void main() +{ + PLSOut0 = PLSIn0 * 2.0; + PLSOut1 = PLSIn1 * 6.0; + PLSOut2 = PLSIn2 * 7.0; + PLSOut3 = PLSIn3 * 4.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag b/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 0000000000..d086560e5d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag b/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag new file mode 100644 index 0000000000..caca9c03cb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag @@ -0,0 +1,15 @@ +#version 450 +#if defined(GL_ARB_post_depth_coverge) +#extension GL_ARB_post_depth_coverage : require +#else +#extension GL_EXT_post_depth_coverage : require +#endif +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/round-even.frag b/third_party/spirv-cross/reference/opt/shaders/frag/round-even.frag new file mode 100644 index 0000000000..ab6f37adc1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/round-even.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; + +void main() +{ + FragColor = roundEven(vA); + FragColor *= roundEven(vB); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/round.frag b/third_party/spirv-cross/reference/opt/shaders/frag/round.frag new file mode 100644 index 0000000000..0f1fc0db0f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/round.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; + +void main() +{ + FragColor = round(vA); + FragColor *= round(vB); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-ordered.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-ordered.frag new file mode 100644 index 0000000000..9d5f90e4aa --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-ordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(sample_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _47 = atomicAnd(_30.bar, uint(gl_SampleMaskIn[0])); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-unordered.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-unordered.frag new file mode 100644 index 0000000000..441198814e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sample-interlock-unordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(sample_interlock_unordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sample-parameter.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sample-parameter.frag new file mode 100644 index 0000000000..3c130e68d4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sample-parameter.frag @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + FragColor = (gl_SamplePosition + vec2(float(gl_SampleMaskIn[0]))) + vec2(float(gl_SampleID)); + gl_SampleMask[0] = 1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sampler-ms.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sampler-ms.frag new file mode 100644 index 0000000000..d78b805d09 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sampler-ms.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DMS uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 _17 = ivec2(gl_FragCoord.xy); + FragColor = ((texelFetch(uSampler, _17, 0) + texelFetch(uSampler, _17, 1)) + texelFetch(uSampler, _17, 2)) + texelFetch(uSampler, _17, 3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sampler-proj.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sampler-proj.frag new file mode 100644 index 0000000000..865dec6c8b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sampler-proj.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vTex; + +void main() +{ + highp vec4 _19 = vTex; + _19.z = vTex.w; + FragColor = textureProj(uTex, _19.xyz); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/sampler.frag b/third_party/spirv-cross/reference/opt/shaders/frag/sampler.frag new file mode 100644 index 0000000000..2a4e440421 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/sampler.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/opt/shaders/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..94d671b5a9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/scalar-refract-reflect.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vRefract; + +void main() +{ + FragColor = refract(vRefract.x, vRefract.y, vRefract.z); + FragColor += reflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/selection-block-dominator.frag b/third_party/spirv-cross/reference/opt/shaders/frag/selection-block-dominator.frag new file mode 100644 index 0000000000..50a5a371c6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/selection-block-dominator.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + do + { + if (vIndex != 1) + { + FragColor = vec4(1.0); + break; + } + FragColor = vec4(10.0); + break; + } while(false); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/shader-clock.frag b/third_party/spirv-cross/reference/opt/shaders/frag/shader-clock.frag new file mode 100644 index 0000000000..4cefd1b70c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/shader-clock.frag @@ -0,0 +1,19 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_shader_realtime_clock : require +#extension GL_ARB_shader_clock : require + +void main() +{ + uvec2 _11 = clockRealtime2x32EXT(); + uint64_t _15 = clockRealtimeEXT(); + uvec2 _18 = clock2x32ARB(); + uint64_t _20 = clockARB(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/struct-type-unrelated-alias.frag b/third_party/spirv-cross/reference/opt/shaders/frag/struct-type-unrelated-alias.frag new file mode 100644 index 0000000000..d6fa667f3b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/struct-type-unrelated-alias.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = 30.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/opt/shaders/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..111a4d4be3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/switch-unreachable-break.frag @@ -0,0 +1,37 @@ +#version 450 + +layout(binding = 0, std140) uniform UBO +{ + int cond; + int cond2; +} _13; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bool _49; + switch (_13.cond) + { + case 1: + { + if (_13.cond2 < 50) + { + _49 = false; + break; + } + else + { + discard; + } + break; // unreachable workaround + } + default: + { + _49 = true; + break; + } + } + FragColor = mix(vec4(20.0), vec4(10.0), bvec4(_49)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/opt/shaders/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..4177f9e99a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/switch-unsigned-case.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0, std140) uniform Buff +{ + mediump uint TestVal; +} _15; + +layout(location = 0) out vec4 fsout_Color; + +void main() +{ + fsout_Color = vec4(1.0); + switch (_15.TestVal) + { + case 0u: + { + fsout_Color = vec4(0.100000001490116119384765625); + break; + } + case 1u: + { + fsout_Color = vec4(0.20000000298023223876953125); + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/swizzle.frag b/third_party/spirv-cross/reference/opt/shaders/frag/swizzle.frag new file mode 100644 index 0000000000..51f5b19895 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/swizzle.frag @@ -0,0 +1,22 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D samp; + +layout(location = 0) out vec4 FragColor; +layout(location = 2) in vec2 vUV; +layout(location = 1) in vec3 vNormal; + +void main() +{ + vec4 _19 = texture(samp, vUV); + float _23 = _19.x; + FragColor = vec4(_23, _19.yz, 1.0); + FragColor = vec4(_23, _19.z, 1.0, 4.0); + FragColor = vec4(_23, _23, texture(samp, vUV + vec2(0.100000001490116119384765625)).yy); + FragColor = vec4(vNormal, 1.0); + FragColor = vec4(vNormal + vec3(1.7999999523162841796875), 1.0); + FragColor = vec4(vUV, vUV + vec2(1.7999999523162841796875)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..520b4ee88b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 _22 = ivec2(gl_FragCoord.xy); + FragColor = texelFetchOffset(uTexture, _22, 0, ivec2(1)); + FragColor += texelFetchOffset(uTexture, _22, 0, ivec2(-1, 1)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/ubo-load-row-major-workaround.frag b/third_party/spirv-cross/reference/opt/shaders/frag/ubo-load-row-major-workaround.frag new file mode 100644 index 0000000000..90b000f94f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/ubo-load-row-major-workaround.frag @@ -0,0 +1,46 @@ +#version 450 + +struct RowMajor +{ + mat4 B; +}; + +struct NestedRowMajor +{ + RowMajor rm; +}; + +layout(binding = 2, std140) uniform UBO3 +{ + layout(row_major) NestedRowMajor rm2; +} _17; + +layout(binding = 1, std140) uniform UBO2 +{ + layout(row_major) RowMajor rm; +} _35; + +layout(binding = 0, std140) uniform UBO +{ + layout(row_major) mat4 A; + mat4 C; +} _42; + +layout(binding = 3, std140) uniform UBONoWorkaround +{ + mat4 D; +} _56; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 Clip; + +NestedRowMajor spvWorkaroundRowMajor(NestedRowMajor wrap) { return wrap; } +mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; } + +void main() +{ + FragColor = (((spvWorkaroundRowMajor(_17.rm2).rm.B * spvWorkaroundRowMajor(_35.rm.B)) * spvWorkaroundRowMajor(_42.A)) * spvWorkaroundRowMajor(_42.C)) * Clip; + FragColor += (_56.D * Clip); + FragColor = fma(_42.A[1], Clip, FragColor); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/ubo_layout.frag b/third_party/spirv-cross/reference/opt/shaders/frag/ubo_layout.frag new file mode 100644 index 0000000000..bc0b01c065 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/ubo_layout.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Str +{ + mat4 foo; +}; + +layout(binding = 0, std140) uniform UBO1 +{ + layout(row_major) Str foo; +} ubo1; + +layout(binding = 1, std140) uniform UBO2 +{ + Str foo; +} ubo0; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ubo1.foo.foo[0] + ubo0.foo.foo[0]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/frag/unary-enclose.frag b/third_party/spirv-cross/reference/opt/shaders/frag/unary-enclose.frag new file mode 100644 index 0000000000..e7b0bf534c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/frag/unary-enclose.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn; + +void main() +{ + FragColor = vIn; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/basic.geom b/third_party/spirv-cross/reference/opt/shaders/geom/basic.geom new file mode 100644 index 0000000000..f91136f609 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/basic.geom @@ -0,0 +1,27 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(invocations = 4, triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + float _37 = float(gl_InvocationID); + vNormal = vin[0].normal + vec3(_37); + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + vec3(4.0 * _37); + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + vec3(2.0 * _37); + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/geometry-passthrough.geom b/third_party/spirv-cross/reference/opt/shaders/geom/geometry-passthrough.geom new file mode 100644 index 0000000000..afbd662324 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/geometry-passthrough.geom @@ -0,0 +1,22 @@ +#version 450 +#extension GL_NV_geometry_shader_passthrough : require +layout(triangles) in; + +layout(passthrough, location = 0) in VertexBlock +{ + int a; + int b; +} v1[3]; + +layout(location = 2) in VertexBlock2 +{ + int a; + layout(passthrough) int b; +} v2[3]; + + +void main() +{ + gl_Layer = (gl_InvocationID + v1[0].a) + v2[1].b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/lines-adjacency.geom b/third_party/spirv-cross/reference/opt/shaders/geom/lines-adjacency.geom new file mode 100644 index 0000000000..46a21e9fb0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/lines-adjacency.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(lines_adjacency) in; +layout(max_vertices = 3, line_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[4]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/lines.geom b/third_party/spirv-cross/reference/opt/shaders/geom/lines.geom new file mode 100644 index 0000000000..c5aaa53d35 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/lines.geom @@ -0,0 +1,23 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(lines) in; +layout(max_vertices = 2, line_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[2]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/multi-stream.geom b/third_party/spirv-cross/reference/opt/shaders/geom/multi-stream.geom new file mode 100644 index 0000000000..548164d780 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/multi-stream.geom @@ -0,0 +1,14 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 2, points) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + EmitStreamVertex(0); + EndStreamPrimitive(0); + gl_Position = gl_in[0].gl_Position + vec4(2.0); + EmitStreamVertex(1); + EndStreamPrimitive(1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/points.geom b/third_party/spirv-cross/reference/opt/shaders/geom/points.geom new file mode 100644 index 0000000000..4d59137c3a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/points.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(points) in; +layout(max_vertices = 3, points) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[1]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/single-invocation.geom b/third_party/spirv-cross/reference/opt/shaders/geom/single-invocation.geom new file mode 100644 index 0000000000..fdccacc04f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/single-invocation.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/transform-feedback-streams.geom b/third_party/spirv-cross/reference/opt/shaders/geom/transform-feedback-streams.geom new file mode 100644 index 0000000000..4d238b4adf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/transform-feedback-streams.geom @@ -0,0 +1,26 @@ +#version 450 +layout(points) in; +layout(max_vertices = 2, points) out; + +layout(xfb_buffer = 1, xfb_stride = 20, stream = 1) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(location = 0, xfb_buffer = 2, xfb_stride = 32, xfb_offset = 16, stream = 1) out vec4 vFoo; +layout(xfb_buffer = 3, xfb_stride = 16, stream = 2) out VertOut +{ + layout(location = 1, xfb_offset = 0) vec4 vBar; +} _23; + + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + EmitStreamVertex(1); + _23.vBar = vec4(5.0); + EmitStreamVertex(2); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/triangles-adjacency.geom b/third_party/spirv-cross/reference/opt/shaders/geom/triangles-adjacency.geom new file mode 100644 index 0000000000..e9e6857a1f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/triangles-adjacency.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles_adjacency) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[6]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/geom/triangles.geom b/third_party/spirv-cross/reference/opt/shaders/geom/triangles.geom new file mode 100644 index 0000000000..fdccacc04f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/geom/triangles.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.frag new file mode 100644 index 0000000000..6e8dbf1a9c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.frag @@ -0,0 +1,12 @@ +#version 100 +#extension GL_EXT_shader_texture_lod : require +precision mediump float; +precision highp int; + +uniform mediump sampler2D tex; + +void main() +{ + gl_FragData[0] = texture2DLodEXT(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 0.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.vert new file mode 100644 index 0000000000..b73faa47ab --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/explicit-lod.legacy.vert @@ -0,0 +1,11 @@ +#version 100 + +uniform mediump sampler2D tex; + +varying mediump vec4 FragColor; + +void main() +{ + FragColor = texture2DLod(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 3.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/fma.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/fma.legacy.frag new file mode 100644 index 0000000000..2c206d886b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/fma.legacy.frag @@ -0,0 +1,15 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp vec4 vA; +varying highp vec4 vB; +varying highp vec4 vC; + +void main() +{ + highp vec4 _17 = vA * vB + vC; + gl_FragData[0] = _17; + gl_FragData[0] = _17 * (vB * vC + vA); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/hyperbolic.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/hyperbolic.legacy.frag new file mode 100644 index 0000000000..f4d99fe98d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/hyperbolic.legacy.frag @@ -0,0 +1,52 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec3 vector; + +void main() +{ + gl_FragData[0] = vec4(1.0); + gl_FragData[0].w *= ((exp(scalar) - exp(-scalar)) * 0.5); + gl_FragData[0].w *= ((exp(scalar) + exp(-scalar)) * 0.5); + highp float _125 = exp(scalar); + highp float _126 = exp(-scalar); + gl_FragData[0].w *= ((_125 - _126) / (_125 + _126)); + gl_FragData[0].w *= log(scalar + sqrt(scalar * scalar + 1.0)); + gl_FragData[0].w *= log(scalar + sqrt(scalar * scalar - 1.0)); + gl_FragData[0].w *= (log((1.0 + scalar) / (1.0 - scalar)) * 0.5); + highp vec4 _58 = gl_FragData[0]; + highp vec3 _60 = _58.xyz * ((exp(vector) - exp(-vector)) * 0.5); + gl_FragData[0].x = _60.x; + gl_FragData[0].y = _60.y; + gl_FragData[0].z = _60.z; + highp vec4 _72 = gl_FragData[0]; + highp vec3 _74 = _72.xyz * ((exp(vector) + exp(-vector)) * 0.5); + gl_FragData[0].x = _74.x; + gl_FragData[0].y = _74.y; + gl_FragData[0].z = _74.z; + highp vec3 _127 = exp(vector); + highp vec3 _128 = exp(-vector); + highp vec4 _83 = gl_FragData[0]; + highp vec3 _85 = _83.xyz * ((_127 - _128) / (_127 + _128)); + gl_FragData[0].x = _85.x; + gl_FragData[0].y = _85.y; + gl_FragData[0].z = _85.z; + highp vec4 _94 = gl_FragData[0]; + highp vec3 _96 = _94.xyz * log(vector + sqrt(vector * vector + 1.0)); + gl_FragData[0].x = _96.x; + gl_FragData[0].y = _96.y; + gl_FragData[0].z = _96.z; + highp vec4 _105 = gl_FragData[0]; + highp vec3 _107 = _105.xyz * log(vector + sqrt(vector * vector - 1.0)); + gl_FragData[0].x = _107.x; + gl_FragData[0].y = _107.y; + gl_FragData[0].z = _107.z; + highp vec4 _116 = gl_FragData[0]; + highp vec3 _118 = _116.xyz * (log((1.0 + vector) / (1.0 - vector)) * 0.5); + gl_FragData[0].x = _118.x; + gl_FragData[0].y = _118.y; + gl_FragData[0].z = _118.z; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/io-blocks.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/io-blocks.legacy.frag new file mode 100644 index 0000000000..d5a60d53e9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/io-blocks.legacy.frag @@ -0,0 +1,12 @@ +#version 100 +precision mediump float; +precision highp int; + +varying vec4 vin_color; +varying highp vec3 vin_normal; + +void main() +{ + gl_FragData[0] = vin_color + vin_normal.xyzz; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/isnan-isinf.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/isnan-isinf.legacy.frag new file mode 100644 index 0000000000..d19e4bec72 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/isnan-isinf.legacy.frag @@ -0,0 +1,28 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec4 vector; + +void main() +{ + gl_FragData[0] = vec4(0.0); + if (scalar != scalar) + { + gl_FragData[0].x = 1.0; + } + if (scalar != 0.0 && 2.0 * scalar == scalar) + { + gl_FragData[0].y = 1.0; + } + if (any(notEqual(vector, vector))) + { + gl_FragData[0].z = 1.0; + } + if (any(bvec4(vector.x != 0.0 && 2.0 * vector.x == vector.x, vector.y != 0.0 && 2.0 * vector.y == vector.y, vector.z != 0.0 && 2.0 * vector.z == vector.z, vector.w != 0.0 && 2.0 * vector.w == vector.w))) + { + gl_FragData[0].w = 1.0; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/modf.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/modf.legacy.frag new file mode 100644 index 0000000000..9ff3d03de0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/modf.legacy.frag @@ -0,0 +1,20 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec2 vector; + +void main() +{ + highp float sipart; + sipart = float(int(scalar)); + gl_FragData[0].x = sipart; + gl_FragData[0].y = scalar - sipart; + highp vec2 vipart; + vipart = vec2(ivec2(vector)); + highp vec2 _35 = vector - vipart; + gl_FragData[0].z = _35.x; + gl_FragData[0].w = _35.y; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag new file mode 100644 index 0000000000..10ce5a513f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag @@ -0,0 +1,36 @@ +#version 100 +precision mediump float; +precision highp int; + +struct Foo +{ + highp vec4 a; + highp vec4 b; +}; + +struct Bar +{ + highp vec4 a; + highp vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +varying highp vec4 baz_foo_a; +varying highp vec4 baz_foo_b; +varying highp vec4 baz_bar_a; +varying highp vec4 baz_bar_b; +varying highp vec4 _33_a_a; +varying highp vec4 _33_a_b; +varying highp vec4 _33_b_a; +varying highp vec4 _33_b_b; + +void main() +{ + gl_FragData[0] = (((_33_a_a + _33_b_b) + baz_foo_b) + baz_foo_a) + baz_bar_b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/round.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/round.legacy.frag new file mode 100644 index 0000000000..9033bc3c56 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/round.legacy.frag @@ -0,0 +1,13 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp vec4 vA; +varying highp float vB; + +void main() +{ + gl_FragData[0] = floor(vA + vec4(0.5)); + gl_FragData[0] *= floor(vB + float(0.5)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/struct-varying.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/struct-varying.legacy.frag new file mode 100644 index 0000000000..e131f2e21c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/struct-varying.legacy.frag @@ -0,0 +1,18 @@ +#version 100 +precision mediump float; +precision highp int; + +struct Inputs +{ + highp vec4 a; + highp vec2 b; +}; + +varying highp vec4 vin_a; +varying highp vec2 vin_b; + +void main() +{ + gl_FragData[0] = ((((Inputs(vin_a, vin_b).a + Inputs(vin_a, vin_b).b.xxyy) + Inputs(vin_a, vin_b).a) + Inputs(vin_a, vin_b).b.yyxx) + vin_a) + vin_b.xxyy; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/switch.legacy.frag b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/switch.legacy.frag new file mode 100644 index 0000000000..169f591a74 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/fragment/switch.legacy.frag @@ -0,0 +1,77 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float vIndexF; + +void main() +{ + int _13 = int(vIndexF); + highp vec4 _65; + highp vec4 _66; + highp vec4 _68; + for (int spvDummy25 = 0; spvDummy25 < 1; spvDummy25++) + { + if (_13 == 2) + { + _68 = vec4(0.0, 2.0, 3.0, 4.0); + break; + } + else if ((_13 == 4) || (_13 == 5)) + { + _68 = vec4(1.0, 2.0, 3.0, 4.0); + break; + } + else if ((_13 == 8) || (_13 == 9)) + { + _68 = vec4(40.0, 20.0, 30.0, 40.0); + break; + } + else if (_13 == 10) + { + _65 = vec4(10.0); + highp vec4 _45 = _65 + vec4(1.0); + _66 = _45; + highp vec4 _48 = _66 + vec4(2.0); + _68 = _48; + break; + } + else if (_13 == 11) + { + _65 = vec4(0.0); + highp vec4 _45 = _65 + vec4(1.0); + _66 = _45; + highp vec4 _48 = _66 + vec4(2.0); + _68 = _48; + break; + } + else if (_13 == 12) + { + _66 = vec4(0.0); + highp vec4 _48 = _66 + vec4(2.0); + _68 = _48; + break; + } + else + { + _68 = vec4(10.0, 20.0, 30.0, 40.0); + break; + } + } + highp vec4 _70; + for (int spvDummy146 = 0; spvDummy146 < 1; spvDummy146++) + { + if ((_13 == 10) || (_13 == 20)) + { + _70 = vec4(40.0); + break; + } + else + { + _70 = vec4(20.0); + break; + } + } + gl_FragData[0] = _68 + _70; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/implicit-lod.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/implicit-lod.legacy.vert new file mode 100644 index 0000000000..2d2050498e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/implicit-lod.legacy.vert @@ -0,0 +1,9 @@ +#version 100 + +uniform mediump sampler2D tex; + +void main() +{ + gl_Position = texture2DLod(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 0.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/int-attribute.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/int-attribute.legacy.vert new file mode 100644 index 0000000000..cc41c3fad2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/int-attribute.legacy.vert @@ -0,0 +1,13 @@ +#version 100 + +attribute vec4 attr_int4; +attribute float attr_int1; + +void main() +{ + gl_Position.x = float(int(attr_int4[int(attr_int1)])); + gl_Position.y = 0.0; + gl_Position.z = 0.0; + gl_Position.w = 0.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/inverse.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/inverse.legacy.vert new file mode 100644 index 0000000000..5c76e77fcf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/inverse.legacy.vert @@ -0,0 +1,85 @@ +#version 100 + +struct Buffer +{ + mat2 m2; + mat3 m3; + mat4 m4; + mediump mat2 m2r; + mediump mat3 m3r; + mediump mat4 m4r; +}; + +uniform Buffer _17; + +varying vec3 dets; +varying mat2 o2; +varying mat3 o3; +varying mat4 o4; +varying mat2 o2r; +varying mat3 o3r; +varying mat4 o4r; + +highp float spvDeterminant(highp mat2 m) +{ + return m[0][0] * m[1][1] - m[0][1] * m[1][0]; +} + +highp float spvDeterminant(highp mat3 m) +{ + return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0])); +} + +highp float spvDeterminant(highp mat4 m) +{ + return dot(m[0], vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2])); +} + +highp mat2 spvInverse(highp mat2 m) +{ + return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) * (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1])); +} + +highp mat3 spvInverse(highp mat3 m) +{ + highp vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]); + return mat3(t[0], m[0][2] * m[2][1] - m[0][1] * m[2][2], m[0][1] * m[1][2] - m[0][2] * m[1][1], t[1], m[0][0] * m[2][2] - m[0][2] * m[2][0], m[0][2] * m[1][0] - m[0][0] * m[1][2], t[2], m[0][1] * m[2][0] - m[0][0] * m[2][1], m[0][0] * m[1][1] - m[0][1] * m[1][0]) * (1.0 / dot(m[0], t)); +} + +highp mat4 spvInverse(highp mat4 m) +{ + highp vec4 t = vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]); + return mat4(t[0], m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], t[1], m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], t[2], m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], t[3], m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) * (1.0 / dot(m[0], t)); +} + +mediump mat2 spvInverseMP(mediump mat2 m) +{ + return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) * (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1])); +} + +mediump mat3 spvInverseMP(mediump mat3 m) +{ + mediump vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]); + return mat3(t[0], m[0][2] * m[2][1] - m[0][1] * m[2][2], m[0][1] * m[1][2] - m[0][2] * m[1][1], t[1], m[0][0] * m[2][2] - m[0][2] * m[2][0], m[0][2] * m[1][0] - m[0][0] * m[1][2], t[2], m[0][1] * m[2][0] - m[0][0] * m[2][1], m[0][0] * m[1][1] - m[0][1] * m[1][0]) * (1.0 / dot(m[0], t)); +} + +mediump mat4 spvInverseMP(mediump mat4 m) +{ + mediump vec4 t = vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]); + return mat4(t[0], m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], t[1], m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], t[2], m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], t[3], m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) * (1.0 / dot(m[0], t)); +} + +void main() +{ + dets.x = spvDeterminant(_17.m2); + dets.y = spvDeterminant(_17.m3); + dets.z = spvDeterminant(_17.m4); + o2 = spvInverse(_17.m2); + o3 = spvInverse(_17.m3); + o4 = spvInverse(_17.m4); + o2r = spvInverseMP(_17.m2r); + o3r = spvInverseMP(_17.m3r); + o4r = spvInverseMP(_17.m4r); + gl_Position = vec4(0.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/io-block.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/io-block.legacy.vert new file mode 100644 index 0000000000..3c518dc79e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/io-block.legacy.vert @@ -0,0 +1,13 @@ +#version 100 + +attribute vec4 Position; +varying vec4 vout_color; +varying vec3 vout_normal; + +void main() +{ + gl_Position = Position; + vout_color = vec4(1.0); + vout_normal = vec3(0.5); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/outer-product.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/outer-product.legacy.vert new file mode 100644 index 0000000000..39a642931a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/outer-product.legacy.vert @@ -0,0 +1,19 @@ +#version 100 + +varying mat2 m22; +attribute vec2 v2a; +attribute vec2 v2b; +varying mat3 m33; +attribute vec3 v3a; +attribute vec3 v3b; +varying mat4 m44; +attribute vec4 v4a; +attribute vec4 v4b; + +void main() +{ + m22 = mat2(v2a * v2b.x, v2a * v2b.y); + m33 = mat3(v3a * v3b.x, v3a * v3b.y, v3a * v3b.z); + m44 = mat4(v4a * v4b.x, v4a * v4b.y, v4a * v4b.z, v4a * v4b.w); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert new file mode 100644 index 0000000000..837a11a843 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert @@ -0,0 +1,17 @@ +#version 100 + +struct Foo +{ + float a[4]; +}; + +varying float foo_a[4]; + +void main() +{ + gl_Position = vec4(1.0); + for (int _46 = 0; _46 < 4; foo_a[_46] = float(_46 + 2), _46++) + { + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert new file mode 100644 index 0000000000..cf807c41f7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert @@ -0,0 +1,49 @@ +#version 100 + +struct Foo +{ + vec4 a; + vec4 b; +}; + +struct Bar +{ + vec4 a; + vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +varying vec4 _12_a_a; +varying vec4 _12_a_b; +varying vec4 _12_b_a; +varying vec4 _12_b_b; +varying vec4 baz_foo_a; +varying vec4 baz_foo_b; +varying vec4 baz_bar_a; +varying vec4 baz_bar_b; + +void main() +{ + _12_a_a = vec4(10.0); + _12_a_b = vec4(20.0); + _12_b_a = vec4(30.0); + _12_b_b = vec4(40.0); + _12_a_a = Foo(vec4(50.0), vec4(60.0)).a; + _12_a_b = Foo(vec4(50.0), vec4(60.0)).b; + _12_b_a = Bar(vec4(50.0), vec4(60.0)).a; + _12_b_b = Bar(vec4(50.0), vec4(60.0)).b; + baz_foo_a = Foo(vec4(100.0), vec4(200.0)).a; + baz_foo_b = Foo(vec4(100.0), vec4(200.0)).b; + baz_bar_a = Bar(vec4(300.0), vec4(400.0)).a; + baz_bar_b = Bar(vec4(300.0), vec4(400.0)).b; + baz_foo_a = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).foo.a; + baz_foo_b = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).foo.b; + baz_bar_a = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).bar.a; + baz_bar_b = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).bar.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert new file mode 100644 index 0000000000..66136d27ae --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/struct-varying.legacy.vert @@ -0,0 +1,24 @@ +#version 100 + +struct Output +{ + vec4 a; + vec2 b; +}; + +varying vec4 vout_a; +varying vec2 vout_b; + +void main() +{ + vout_a = Output(vec4(0.5), vec2(0.25)).a; + vout_b = Output(vec4(0.5), vec2(0.25)).b; + vout_a = Output(vec4(0.5), vec2(0.25)).a; + vout_b = Output(vec4(0.5), vec2(0.25)).b; + Output _22 = Output(vout_a, vout_b); + vout_a = _22.a; + vout_b = _22.b; + vout_a.x = 1.0; + vout_b.y = 1.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/switch-nested.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/switch-nested.legacy.vert new file mode 100644 index 0000000000..dd987e8f1b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/switch-nested.legacy.vert @@ -0,0 +1,45 @@ +#version 100 + +struct UBO +{ + int func_arg; + int inner_func_arg; +}; + +uniform UBO _34; + +void main() +{ + vec4 _102; + for (int spvDummy30 = 0; spvDummy30 < 1; spvDummy30++) + { + if (_34.func_arg != 0) + { + vec4 _101; + for (int spvDummy45 = 0; spvDummy45 < 1; spvDummy45++) + { + if (_34.inner_func_arg != 0) + { + _101 = vec4(1.0); + break; + } + else + { + _101 = vec4(0.0); + break; + } + break; // unreachable workaround + } + _102 = _101; + break; + } + else + { + _102 = vec4(0.0); + break; + } + break; // unreachable workaround + } + gl_Position = _102; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..6ef7dd2f78 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/legacy/vert/transpose.legacy.vert @@ -0,0 +1,54 @@ +#version 100 + +struct Buffer +{ + mat4 MVPRowMajor; + mat4 MVPColMajor; + mat4 M; + mediump mat4 MRelaxed; +}; + +uniform Buffer _13; + +attribute vec4 Position; +varying mat4 OutputMat1; +varying mat4 OutputMat2; +varying mat4 OutputMat3; +varying mat4 OutputMat4; +varying mat4 OutputMat5; +varying mat4 OutputMat6; +varying mediump mat4 OutputMat7; +varying mediump mat4 OutputMat8; + +highp mat4 spvWorkaroundRowMajor(highp mat4 wrap) { return wrap; } +mediump mat4 spvWorkaroundRowMajorMP(mediump mat4 wrap) { return wrap; } + +highp mat4 spvTranspose(highp mat4 m) +{ + return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]); +} + +mediump mat4 spvTransposeMP(mediump mat4 m) +{ + return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]); +} + +void main() +{ + mat4 _55 = _13.MVPRowMajor; + mat4 _61 = spvWorkaroundRowMajor(_13.MVPColMajor); + mat4 _80 = _13.MVPRowMajor * 2.0; + mat4 _87 = _61 * 2.0; + OutputMat1 = spvTranspose(_13.MVPRowMajor); + OutputMat2 = spvWorkaroundRowMajor(_13.MVPColMajor); + OutputMat3 = _55; + OutputMat4 = spvTranspose(_61); + mat4 _121 = spvWorkaroundRowMajor(_13.M); + OutputMat5 = spvTranspose(_121); + mediump mat4 _126 = spvWorkaroundRowMajor(_13.MRelaxed); + OutputMat6 = spvTransposeMP(_126); + OutputMat7 = spvTranspose(_121); + OutputMat8 = spvTransposeMP(_126); + gl_Position = (((((((((((spvWorkaroundRowMajor(_13.M) * (Position * _13.MVPRowMajor)) + (spvWorkaroundRowMajor(_13.M) * (spvWorkaroundRowMajor(_13.MVPColMajor) * Position))) + (spvWorkaroundRowMajor(_13.M) * (_13.MVPRowMajor * Position))) + (spvWorkaroundRowMajor(_13.M) * (Position * spvWorkaroundRowMajor(_13.MVPColMajor)))) + (_55 * Position)) + (Position * _61)) + (Position * _55)) + (_61 * Position)) + (Position * _80)) + (Position * _87)) + (_80 * Position)) + (_87 * Position); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..81f3c96ec1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,66 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, lines) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + vec3 _29 = vec3(gl_GlobalInvocationID); + float _31 = _29.x; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(_31, _29.yz, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(_31, _29.yz, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uvec2(0u, 1u) + uvec2(gl_LocalInvocationIndex); + int _128 = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = _128; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = _128 + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = _128 + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = _128 + 3; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..bacc7fdfdc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,66 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, points) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + vec3 _29 = vec3(gl_GlobalInvocationID); + float _31 = _29.x; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(_31, _29.yz, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(_31, _29.yz, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitivePointIndicesEXT[gl_LocalInvocationIndex] = gl_LocalInvocationIndex; + int _124 = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = _124; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = _124 + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = _124 + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = _124 + 3; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..87fd2c2b7b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,66 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, triangles) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + vec3 _29 = vec3(gl_GlobalInvocationID); + float _31 = _29.x; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(_31, _29.yz, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(_31, _29.yz, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0u, 1u, 2u) + uvec3(gl_LocalInvocationIndex); + int _127 = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = _127; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = _127 + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = _127 + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = _127 + 3; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tesc/basic.tesc b/third_party/spirv-cross/reference/opt/shaders/tesc/basic.tesc new file mode 100644 index 0000000000..6019151adb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tesc/basic.tesc @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(vertices = 1) out; + +layout(location = 0) patch out vec3 vFoo; + +void main() +{ + gl_TessLevelInner[0] = 8.8999996185302734375; + gl_TessLevelInner[1] = 6.900000095367431640625; + gl_TessLevelOuter[0] = 8.8999996185302734375; + gl_TessLevelOuter[1] = 6.900000095367431640625; + gl_TessLevelOuter[2] = 3.900000095367431640625; + gl_TessLevelOuter[3] = 4.900000095367431640625; + vFoo = vec3(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tesc/water_tess.tesc b/third_party/spirv-cross/reference/opt/shaders/tesc/water_tess.tesc new file mode 100644 index 0000000000..d3d9c8b3e0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tesc/water_tess.tesc @@ -0,0 +1,79 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(vertices = 1) out; + +layout(binding = 0, std140) uniform UBO +{ + vec4 uScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uMaxTessLevel; + float uDistanceMod; + vec4 uFrustum[6]; +} _41; + +layout(location = 1) patch out vec2 vOutPatchPosBase; +layout(location = 2) patch out vec4 vPatchLods; +layout(location = 0) in vec2 vPatchPosBase[]; + +void main() +{ + vec2 _431 = (vPatchPosBase[0] - vec2(10.0)) * _41.uScale.xy; + vec2 _441 = ((vPatchPosBase[0] + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy; + vec3 _446 = vec3(_431.x, -10.0, _431.y); + vec3 _451 = vec3(_441.x, 10.0, _441.y); + vec4 _467 = vec4((_446 + _451) * 0.5, 1.0); + vec3 _514 = vec3(length(_451 - _446) * (-0.5)); + bool _516 = any(lessThanEqual(vec3(dot(_41.uFrustum[0], _467), dot(_41.uFrustum[1], _467), dot(_41.uFrustum[2], _467)), _514)); + bool _526; + if (!_516) + { + _526 = any(lessThanEqual(vec3(dot(_41.uFrustum[3], _467), dot(_41.uFrustum[4], _467), dot(_41.uFrustum[5], _467)), _514)); + } + else + { + _526 = _516; + } + if (!(!_526)) + { + gl_TessLevelOuter[0] = -1.0; + gl_TessLevelOuter[1] = -1.0; + gl_TessLevelOuter[2] = -1.0; + gl_TessLevelOuter[3] = -1.0; + gl_TessLevelInner[0] = -1.0; + gl_TessLevelInner[1] = -1.0; + } + else + { + vOutPatchPosBase = vPatchPosBase[0]; + vec2 _681 = (vec2(-0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + vec2 _710 = (vec2(0.5, -0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _729 = clamp(log2((length(_41.uCamPos - vec3(_710.x, 0.0, _710.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + vec2 _739 = (vec2(1.5, -0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + vec2 _768 = (vec2(-0.5, 0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _787 = clamp(log2((length(_41.uCamPos - vec3(_768.x, 0.0, _768.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + vec2 _797 = (vec2(0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _816 = clamp(log2((length(_41.uCamPos - vec3(_797.x, 0.0, _797.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + vec2 _826 = (vec2(1.5, 0.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _845 = clamp(log2((length(_41.uCamPos - vec3(_826.x, 0.0, _826.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + vec2 _855 = (vec2(-0.5, 1.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + vec2 _884 = (vec2(0.5, 1.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _903 = clamp(log2((length(_41.uCamPos - vec3(_884.x, 0.0, _884.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x); + vec2 _913 = (vec2(1.5) * _41.uPatchSize + vPatchPosBase[0]) * _41.uScale.xy; + float _614 = dot(vec4(_787, _816, clamp(log2((length(_41.uCamPos - vec3(_855.x, 0.0, _855.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _903), vec4(0.25)); + float _620 = dot(vec4(clamp(log2((length(_41.uCamPos - vec3(_681.x, 0.0, _681.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _729, _787, _816), vec4(0.25)); + float _626 = dot(vec4(_729, clamp(log2((length(_41.uCamPos - vec3(_739.x, 0.0, _739.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x), _816, _845), vec4(0.25)); + float _632 = dot(vec4(_816, _845, _903, clamp(log2((length(_41.uCamPos - vec3(_913.x, 0.0, _913.y)) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod), 0.0, _41.uMaxTessLevel.x)), vec4(0.25)); + vec4 _633 = vec4(_614, _620, _626, _632); + vPatchLods = _633; + vec4 _940 = exp2(-min(_633, _633.yzwx)) * _41.uMaxTessLevel.y; + gl_TessLevelOuter[0] = _940.x; + gl_TessLevelOuter[1] = _940.y; + gl_TessLevelOuter[2] = _940.z; + gl_TessLevelOuter[3] = _940.w; + float _948 = _41.uMaxTessLevel.y * exp2(-min(min(min(_614, _620), min(_626, _632)), _816)); + gl_TessLevelInner[0] = _948; + gl_TessLevelInner[1] = _948; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/ccw.tese b/third_party/spirv-cross/reference/opt/shaders/tese/ccw.tese new file mode 100644 index 0000000000..a2a4508ac0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/ccw.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, ccw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/cw.tese b/third_party/spirv-cross/reference/opt/shaders/tese/cw.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/cw.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/equal.tese b/third_party/spirv-cross/reference/opt/shaders/tese/equal.tese new file mode 100644 index 0000000000..6d30518a30 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/equal.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, equal_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/fractional_even.tese b/third_party/spirv-cross/reference/opt/shaders/tese/fractional_even.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/fractional_even.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/fractional_odd.tese b/third_party/spirv-cross/reference/opt/shaders/tese/fractional_odd.tese new file mode 100644 index 0000000000..608c19aba7 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/fractional_odd.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_odd_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/input-array.tese b/third_party/spirv-cross/reference/opt/shaders/tese/input-array.tese new file mode 100644 index 0000000000..8a1aaf9fdb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/input-array.tese @@ -0,0 +1,11 @@ +#version 450 +layout(quads, ccw, fractional_odd_spacing) in; + +layout(location = 0) in vec4 Floats[]; +layout(location = 2) in vec4 Floats2[]; + +void main() +{ + gl_Position = (Floats[0] * gl_TessCoord.x) + (Floats2[1] * gl_TessCoord.y); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/line.tese b/third_party/spirv-cross/reference/opt/shaders/tese/line.tese new file mode 100644 index 0000000000..8b6ad8da20 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/line.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(isolines, point_mode, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/load-array-of-array.tese b/third_party/spirv-cross/reference/opt/shaders/tese/load-array-of-array.tese new file mode 100644 index 0000000000..e4b426d0ad --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/load-array-of-array.tese @@ -0,0 +1,10 @@ +#version 450 +layout(quads, ccw, equal_spacing) in; + +layout(location = 0) in vec4 vTexCoord[][1]; + +void main() +{ + gl_Position = (vTexCoord[0u][0] + vTexCoord[2u][0]) + vTexCoord[3u][0]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/patch-input-array.tese b/third_party/spirv-cross/reference/opt/shaders/tese/patch-input-array.tese new file mode 100644 index 0000000000..413d8b391f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/patch-input-array.tese @@ -0,0 +1,10 @@ +#version 450 +layout(quads, ccw, equal_spacing) in; + +layout(location = 0) patch in float P[4]; + +void main() +{ + gl_Position = vec4(P[0], P[1], P[2], P[3]); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/triangle.tese b/third_party/spirv-cross/reference/opt/shaders/tese/triangle.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/triangle.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/tese/water_tess.tese b/third_party/spirv-cross/reference/opt/shaders/tese/water_tess.tese new file mode 100644 index 0000000000..c862cfbdc0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/tese/water_tess.tese @@ -0,0 +1,36 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(quads, cw, fractional_even_spacing) in; + +layout(binding = 1, std140) uniform UBO +{ + mat4 uMVP; + vec4 uScale; + vec2 uInvScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uInvHeightmapSize; +} _31; + +layout(binding = 0) uniform mediump sampler2D uHeightmapDisplacement; + +layout(location = 0) patch in vec2 vOutPatchPosBase; +layout(location = 1) patch in vec4 vPatchLods; +layout(location = 1) out vec4 vGradNormalTex; +layout(location = 0) out vec3 vWorld; + +void main() +{ + vec2 _202 = gl_TessCoord.xy * _31.uPatchSize + vOutPatchPosBase; + vec2 _216 = mix(vPatchLods.yx, vPatchLods.zw, vec2(gl_TessCoord.x)); + float _223 = mix(_216.x, _216.y, gl_TessCoord.y); + mediump float mp_copy_223 = _223; + mediump float _225 = floor(mp_copy_223); + vec2 _141 = _31.uInvHeightmapSize * exp2(_225); + vGradNormalTex = vec4(_202 * _31.uInvHeightmapSize + (_31.uInvHeightmapSize * 0.5), (_202 * _31.uInvHeightmapSize) * _31.uScale.zw); + mediump vec3 _256 = mix(textureLod(uHeightmapDisplacement, _202 * _31.uInvHeightmapSize + (_141 * 0.5), _225).xyz, textureLod(uHeightmapDisplacement, _202 * _31.uInvHeightmapSize + (_141 * 1.0), _225 + 1.0).xyz, vec3(mp_copy_223 - _225)); + vec2 _171 = _202 * _31.uScale.xy + _256.yz; + vWorld = vec3(_171.x, _256.x, _171.y); + gl_Position = _31.uMVP * vec4(vWorld, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/basic.vert b/third_party/spirv-cross/reference/opt/shaders/vert/basic.vert new file mode 100644 index 0000000000..8f251cbedc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/basic.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 uMVP; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.uMVP * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/ground.vert b/third_party/spirv-cross/reference/opt/shaders/vert/ground.vert new file mode 100644 index 0000000000..5840c3d5a9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/ground.vert @@ -0,0 +1,98 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(binding = 0, std140) uniform PerPatch +{ + PatchData Patches[256]; +} _53; + +layout(binding = 2, std140) uniform GlobalGround +{ + vec4 GroundScale; + vec4 GroundPosition; + vec4 InvGroundSize_PatchScale; +} _156; + +layout(binding = 0, std140) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +} _236; + +layout(binding = 1) uniform mediump sampler2D TexLOD; +layout(binding = 0) uniform mediump sampler2D TexHeightmap; + +layout(location = 1) in vec4 LODWeights; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) in vec2 Position; +layout(location = 1) out vec3 EyeVec; +layout(location = 0) out vec2 TexCoord; + +void main() +{ + float _301 = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs); + float _303 = floor(_301); + uint _308 = uint(_303); + uvec2 _310 = uvec2(Position); + uvec2 _317 = (uvec2(1u) << uvec2(_308, _308 + 1u)) - uvec2(1u); + uint _384; + if (_310.x < 32u) + { + _384 = _317.x; + } + else + { + _384 = 0u; + } + uint _385; + if (_310.y < 32u) + { + _385 = _317.y; + } + else + { + _385 = 0u; + } + vec4 _345 = vec4((_310 + uvec2(_384, _385)).xyxy & (~_317).xxyy); + vec2 _167 = _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _156.InvGroundSize_PatchScale.zw + mix(_345.xy, _345.zw, vec2(_301 - _303)); + vec2 _173 = _167 * _156.InvGroundSize_PatchScale.xy; + mediump vec4 _360 = textureLod(TexLOD, _173, 0.0); + mediump float _361 = _360.x; + mediump float _362 = _361 * 7.96875; + float hp_copy_362 = _362; + float _364 = floor(hp_copy_362); + vec2 _185 = _156.InvGroundSize_PatchScale.xy * exp2(_364); + vec3 _230 = vec3(_173.x, mix(textureLod(TexHeightmap, _167 * _156.InvGroundSize_PatchScale.xy + (_185 * 0.5), _364).x, textureLod(TexHeightmap, _167 * _156.InvGroundSize_PatchScale.xy + (_185 * 1.0), _364 + 1.0).x, _361 * 7.96875 + (-_364)), _173.y) * _156.GroundScale.xyz + _156.GroundPosition.xyz; + EyeVec = _230 - _236.g_CamPos.xyz; + TexCoord = _167 * _156.InvGroundSize_PatchScale.xy + (_156.InvGroundSize_PatchScale.xy * 0.5); + gl_Position = (((_236.g_ViewProj_Row0 * _230.x) + (_236.g_ViewProj_Row1 * _230.y)) + (_236.g_ViewProj_Row2 * _230.z)) + _236.g_ViewProj_Row3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/invariant.vert b/third_party/spirv-cross/reference/opt/shaders/vert/invariant.vert new file mode 100644 index 0000000000..31e0c2d46f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/invariant.vert @@ -0,0 +1,18 @@ +#version 310 es + +invariant gl_Position; + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; +layout(location = 2) in vec4 vInput2; +layout(location = 0) invariant out vec4 vColor; + +void main() +{ + vec4 _21 = vInput1 * vInput2 + vInput0; + gl_Position = _21; + vec4 _27 = vInput0 - vInput1; + vec4 _29 = _27 * vInput2; + vColor = _29; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/no-contraction.vert b/third_party/spirv-cross/reference/opt/shaders/vert/no-contraction.vert new file mode 100644 index 0000000000..9f9969cd74 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/no-contraction.vert @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; + +void main() +{ + precise vec4 _15 = vA * vB; + precise vec4 _19 = vA + vB; + precise vec4 _23 = vA - vB; + precise vec4 _30 = _15 + vC; + precise vec4 _34 = _15 + _19; + precise vec4 _36 = _34 + _23; + precise vec4 _38 = _36 + _30; + gl_Position = _38; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/ocean.vert b/third_party/spirv-cross/reference/opt/shaders/vert/ocean.vert new file mode 100644 index 0000000000..489e82959e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/ocean.vert @@ -0,0 +1,119 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(binding = 0, std140) uniform Offsets +{ + PatchData Patches[256]; +} _53; + +layout(binding = 4, std140) uniform GlobalOcean +{ + vec4 OceanScale; + vec4 OceanPosition; + vec4 InvOceanSize_PatchScale; + vec4 NormalTexCoordScale; +} _180; + +layout(binding = 0, std140) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +} _273; + +layout(binding = 1) uniform mediump sampler2D TexLOD; +layout(binding = 0) uniform mediump sampler2D TexDisplacement; + +layout(location = 1) in vec4 LODWeights; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) in vec4 Position; +layout(location = 0) out vec3 EyeVec; +layout(location = 1) out vec4 TexCoord; + +void main() +{ + float _351 = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs); + float _353 = floor(_351); + uint _358 = uint(_353); + uvec4 _360 = uvec4(Position); + uvec2 _367 = (uvec2(1u) << uvec2(_358, _358 + 1u)) - uvec2(1u); + bool _370 = _360.x < 32u; + uint _467; + if (_370) + { + _467 = _367.x; + } + else + { + _467 = 0u; + } + bool _380 = _360.y < 32u; + uint _470; + if (_380) + { + _470 = _367.x; + } + else + { + _470 = 0u; + } + uint _472; + if (_370) + { + _472 = _367.y; + } + else + { + _472 = 0u; + } + uint _474; + if (_380) + { + _474 = _367.y; + } + else + { + _474 = 0u; + } + vec4 _416 = vec4((_360.xyxy + uvec4(_467, _470, _472, _474)) & (~_367).xxyy); + vec2 _197 = (_53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _180.InvOceanSize_PatchScale.zw + mix(_416.xy, _416.zw, vec2(_351 - _353))) * _180.InvOceanSize_PatchScale.xy; + vec2 _204 = _197 * _180.NormalTexCoordScale.zw; + mediump vec4 _431 = textureLod(TexLOD, _197, 0.0); + mediump float _432 = _431.x; + mediump float _433 = _432 * 7.96875; + float hp_copy_433 = _433; + float _435 = floor(hp_copy_433); + vec2 _220 = (_180.InvOceanSize_PatchScale.xy * exp2(_435)) * _180.NormalTexCoordScale.zw; + vec3 _267 = (vec3(_197.x, 0.0, _197.y) + mix(textureLod(TexDisplacement, _197 * _180.NormalTexCoordScale.zw + (_220 * 0.5), _435).yxz, textureLod(TexDisplacement, _197 * _180.NormalTexCoordScale.zw + (_220 * 1.0), _435 + 1.0).yxz, vec3(_432 * 7.96875 + (-_435)))) * _180.OceanScale.xyz + _180.OceanPosition.xyz; + EyeVec = _267 - _273.g_CamPos.xyz; + TexCoord = (_180.InvOceanSize_PatchScale.xyxy * 0.5) * _180.NormalTexCoordScale.zwzw + vec4(_204, _204 * _180.NormalTexCoordScale.xy); + gl_Position = (((_273.g_ViewProj_Row0 * _267.x) + (_273.g_ViewProj_Row1 * _267.y)) + (_273.g_ViewProj_Row2 * _267.z)) + _273.g_ViewProj_Row3; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/opt/shaders/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..d5d9681d0d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/read-from-row-major-array.vert @@ -0,0 +1,31 @@ +#version 310 es + +layout(binding = 0, std140) uniform Block +{ + layout(row_major) mat2x3 var[3][4]; +} _104; + +layout(location = 0) in vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +highp mat2x3 spvWorkaroundRowMajor(highp mat2x3 wrap) { return wrap; } +mediump mat2x3 spvWorkaroundRowMajorMP(mediump mat2x3 wrap) { return wrap; } + +void main() +{ + gl_Position = a_position; + float _172 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[0].x - 2.0) < 0.0500000007450580596923828125); + mediump float mp_copy_172 = _172; + float _180 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[0].y - 6.0) < 0.0500000007450580596923828125); + mediump float mp_copy_180 = _180; + float _188 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[0].z - (-6.0)) < 0.0500000007450580596923828125); + mediump float mp_copy_188 = _188; + float _221 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[1].x) < 0.0500000007450580596923828125); + mediump float mp_copy_221 = _221; + float _229 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[1].y - 5.0) < 0.0500000007450580596923828125); + mediump float mp_copy_229 = _229; + float _237 = float(abs(spvWorkaroundRowMajor(_104.var[0][0])[1].z - 5.0) < 0.0500000007450580596923828125); + mediump float mp_copy_237 = _237; + v_vtxResult = ((mp_copy_172 * mp_copy_180) * mp_copy_188) * ((mp_copy_221 * mp_copy_229) * mp_copy_237); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/return-array.vert b/third_party/spirv-cross/reference/opt/shaders/vert/return-array.vert new file mode 100644 index 0000000000..b78ca5f1b8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/return-array.vert @@ -0,0 +1,9 @@ +#version 310 es + +layout(location = 1) in vec4 vInput1; + +void main() +{ + gl_Position = vec4(10.0) + vInput1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/row-major-workaround.vert b/third_party/spirv-cross/reference/opt/shaders/vert/row-major-workaround.vert new file mode 100644 index 0000000000..4fe6885d10 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/row-major-workaround.vert @@ -0,0 +1,30 @@ +#version 310 es + +layout(binding = 0, std140) uniform Buffer +{ + layout(row_major) mat4 HP; + layout(row_major) mediump mat4 MP; +} _21; + +layout(binding = 1, std140) uniform Buffer2 +{ + layout(row_major) mediump mat4 MP2; +} _39; + +layout(location = 0) out vec4 H; +layout(location = 0) in vec4 Hin; +layout(location = 1) out mediump vec4 M; +layout(location = 1) in mediump vec4 Min; +layout(location = 2) out mediump vec4 M2; + +highp mat4 spvWorkaroundRowMajor(highp mat4 wrap) { return wrap; } +mediump mat4 spvWorkaroundRowMajorMP(mediump mat4 wrap) { return wrap; } + +void main() +{ + gl_Position = vec4(1.0); + H = spvWorkaroundRowMajor(_21.HP) * Hin; + M = spvWorkaroundRowMajor(_21.MP) * Min; + M2 = spvWorkaroundRowMajorMP(_39.MP2) * Min; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/texture_buffer.vert b/third_party/spirv-cross/reference/opt/shaders/vert/texture_buffer.vert new file mode 100644 index 0000000000..217804dfce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/texture_buffer.vert @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_EXT_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(binding = 5, rgba32f) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/transform-feedback-decorations.vert b/third_party/spirv-cross/reference/opt/shaders/vert/transform-feedback-decorations.vert new file mode 100644 index 0000000000..23e7cf3c19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/transform-feedback-decorations.vert @@ -0,0 +1,22 @@ +#version 450 + +layout(xfb_buffer = 1, xfb_stride = 20) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(location = 0, xfb_buffer = 2, xfb_stride = 32, xfb_offset = 16) out vec4 vFoo; +layout(xfb_buffer = 3, xfb_stride = 16) out VertOut +{ + layout(location = 1, xfb_offset = 0) vec4 vBar; +} _22; + + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + _22.vBar = vec4(5.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vert/ubo.vert b/third_party/spirv-cross/reference/opt/shaders/vert/ubo.vert new file mode 100644 index 0000000000..4e7236b290 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vert/ubo.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 mvp; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.mvp * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk new file mode 100644 index 0000000000..771d049644 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk @@ -0,0 +1,25 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Block; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer Block +{ + float v; +}; + +layout(set = 0, binding = 0, std140) uniform UBO +{ + Block blocks[4]; +} ubo; + +void main() +{ + Block blocks[4]; + blocks[0] = ubo.blocks[0]; + blocks[1] = ubo.blocks[1]; + blocks[2] = ubo.blocks[2]; + blocks[3] = ubo.blocks[3]; + blocks[gl_WorkGroupID.x].v = 20.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk new file mode 100644 index 0000000000..f5907d3e2c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk @@ -0,0 +1,28 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Bar; +layout(buffer_reference) buffer Foo; +layout(buffer_reference, buffer_reference_align = 8, std430) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(buffer_reference, std430) buffer Foo +{ + uint v; +}; + +layout(push_constant, std430) uniform Push +{ + Bar bar; +} _13; + +void main() +{ + uint _24 = atomicAdd(_13.bar.b, 1u); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk new file mode 100644 index 0000000000..1808beecbb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk @@ -0,0 +1,29 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Bar; +layout(buffer_reference) buffer Foo; +layout(buffer_reference, buffer_reference_align = 8, std430) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(buffer_reference, std430) buffer Foo +{ + uint v; +}; + +layout(push_constant, std430) uniform Push +{ + Bar bar; +} _15; + +void main() +{ + uint v = _15.bar.b; + uint _31 = atomicAdd(_15.bar.a, _15.bar.b); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk new file mode 100644 index 0000000000..20a4f1b423 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + uvec2 ptr; + PtrInt ptrint; +} _13; + +void main() +{ + _13.ptr = uvec2(_13.ptrint); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk new file mode 100644 index 0000000000..5cf6e2df36 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk @@ -0,0 +1,21 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 16, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + uvec2 ptr; +} _10; + +void main() +{ + PtrInt(_10.ptr).value = 10; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk new file mode 100644 index 0000000000..8923d21d78 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk @@ -0,0 +1,26 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrUint; +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer PtrUint +{ + uint value; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + PtrUint ptr; +} _11; + +void main() +{ + PtrInt(_11.ptr).value = 10; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk new file mode 100644 index 0000000000..b7e88062a0 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer RO; +layout(buffer_reference) buffer RW; +layout(buffer_reference) buffer WO; +layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer RO +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) restrict buffer RW +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) coherent writeonly buffer WO +{ + vec4 v[]; +}; + +layout(push_constant, std430) uniform Registers +{ + RO ro; + RW rw; + WO wo; +} registers; + +void main() +{ + registers.rw.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; + registers.wo.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk new file mode 100644 index 0000000000..c3855cf634 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk @@ -0,0 +1,53 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Node; +layout(buffer_reference, buffer_reference_align = 16, std430) buffer Node +{ + layout(offset = 0) int value; + layout(offset = 16) Node next; + layout(offset = 32) Node prev; +}; + +layout(set = 0, binding = 0, std430) restrict buffer LinkedList +{ + Node head1; + Node head2; +} _50; + +void main() +{ + Node _45; + Node _114; + if (gl_WorkGroupID.x < 4u) + { + _45 = _50.head1; + _114 = _50.head1; + } + else + { + _45 = _50.head2; + _114 = _50.head2; + } + restrict Node n = _114; + Node param = _114.next; + Node param_1 = _50.head1; + Node param_2 = _50.head2; + _114.next.value = _50.head1.value + _50.head2.value; + Node param_4 = _50.head1; + Node param_3 = _50.head1; + n = _50.head1; + int v = _50.head2.value; + _50.head1.value = 20; + _50.head1.value = _50.head2.value * 10; + uint64_t _98 = uint64_t(_50.head2.next); + uint64_t uptr = _98; + Node unode = Node(_98); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk new file mode 100644 index 0000000000..b700474622 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk @@ -0,0 +1,23 @@ +#version 450 +#extension GL_EXT_shader_atomic_float : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer SSBO +{ + float v; +} _18; + +layout(set = 0, binding = 0, r32f) uniform image2D uImage; + +shared float shared_v; + +void main() +{ + float _15 = atomicAdd(shared_v, 2.0); + float value = _15; + float _24 = atomicAdd(_18.v, _15); + float _39 = imageAtomicAdd(uImage, ivec2(gl_GlobalInvocationID.xy), _15); + float _45 = imageAtomicExchange(uImage, ivec2(gl_GlobalInvocationID.xy), _15); + value = _45; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk new file mode 100644 index 0000000000..fbe5e3d964 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk @@ -0,0 +1,72 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_flags_primitive_culling : require +#extension GL_EXT_ray_tracing : require +layout(primitive_culling); +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std140) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; + float thit; + uvec2 bda; +} _19; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +rayQueryEXT q; +rayQueryEXT q2[2]; + +void main() +{ + rayQueryInitializeEXT(q, AS, _19.ray_flags, _19.cull_mask, _19.origin, _19.tmin, _19.dir, _19.tmax); + rayQueryInitializeEXT(q2[1], accelerationStructureEXT(_19.bda), _19.ray_flags, _19.cull_mask, _19.origin, _19.tmin, _19.dir, _19.tmax); + bool _67 = rayQueryProceedEXT(q); + bool res = _67; + rayQueryTerminateEXT(q2[0]); + rayQueryGenerateIntersectionEXT(q, _19.thit); + rayQueryConfirmIntersectionEXT(q2[1]); + float _75 = rayQueryGetRayTMinEXT(q); + float fval = _75; + uint _79 = rayQueryGetRayFlagsEXT(q2[0]); + uint type = _79; + vec3 _82 = rayQueryGetWorldRayDirectionEXT(q); + vec3 fvals = _82; + vec3 _83 = rayQueryGetWorldRayOriginEXT(q); + fvals = _83; + uint _86 = rayQueryGetIntersectionTypeEXT(q2[1], bool(1)); + type = _86; + bool _88 = rayQueryGetIntersectionCandidateAABBOpaqueEXT(q2[1]); + res = _88; + float _91 = rayQueryGetIntersectionTEXT(q2[1], bool(0)); + fval = _91; + int _94 = rayQueryGetIntersectionInstanceCustomIndexEXT(q, bool(1)); + int ival = _94; + int _96 = rayQueryGetIntersectionInstanceIdEXT(q2[0], bool(0)); + ival = _96; + uint _97 = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(q, bool(1)); + type = _97; + int _99 = rayQueryGetIntersectionGeometryIndexEXT(q2[1], bool(0)); + ival = _99; + int _100 = rayQueryGetIntersectionPrimitiveIndexEXT(q, bool(1)); + ival = _100; + vec2 _103 = rayQueryGetIntersectionBarycentricsEXT(q2[0], bool(0)); + fvals.x = _103.x; + fvals.y = _103.y; + bool _110 = rayQueryGetIntersectionFrontFaceEXT(q, bool(1)); + res = _110; + vec3 _111 = rayQueryGetIntersectionObjectRayDirectionEXT(q, bool(0)); + fvals = _111; + vec3 _113 = rayQueryGetIntersectionObjectRayOriginEXT(q2[0], bool(1)); + fvals = _113; + mat4x3 _117 = rayQueryGetIntersectionObjectToWorldEXT(q, bool(0)); + mat4x3 matrices = _117; + mat4x3 _119 = rayQueryGetIntersectionWorldToObjectEXT(q2[1], bool(1)); + matrices = _119; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp new file mode 100644 index 0000000000..7c4c7ed6f4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +const int c = SPIRV_CROSS_CONSTANT_ID_2; +const int d = (c + 50); +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 400 +#endif +const int e = SPIRV_CROSS_CONSTANT_ID_3; + +layout(binding = 0, std430) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +} _22; + +void main() +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk new file mode 100644 index 0000000000..b7571b7abc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk @@ -0,0 +1,35 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(constant_id = 2) const int c = 300; +const int d = (c + 50); +layout(constant_id = 3) const int e = 400; + +layout(set = 1, binding = 0, std430) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +} _22; + +void main() +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 0000000000..888f4b1640 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,34 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk new file mode 100644 index 0000000000..bdf72dff4e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20, local_size_z = 1) in; + +layout(constant_id = 1) const int b = 2; +layout(constant_id = 0) const int a = 1; +const uint _21 = (uint(a) + 0u); +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(set = 1, binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag new file mode 100644 index 0000000000..f0729fdcdf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2DShadow SPIRV_Cross_CombineduDepthuSampler; +uniform mediump sampler2D SPIRV_Cross_CombineduDepthuSampler1; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = texture(SPIRV_Cross_CombineduDepthuSampler, vec3(vec3(1.0).xy, 1.0)) + texture(SPIRV_Cross_CombineduDepthuSampler1, vec2(1.0)).x; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk new file mode 100644 index 0000000000..b6ad1e39c4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 2) uniform mediump texture2D uDepth; +layout(set = 0, binding = 0) uniform mediump samplerShadow uSampler; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = texture(sampler2DShadow(uDepth, uSampler), vec3(vec3(1.0).xy, 1.0)) + texture(sampler2D(uDepth, uSampler1), vec2(1.0)).x; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag new file mode 100644 index 0000000000..29c247d6d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler0; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler1; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler0; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler1; + +layout(location = 0) in vec2 vTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ((((texture(SPIRV_Cross_CombineduTexture0uSampler0, vTex) + texture(SPIRV_Cross_CombineduTexture1uSampler1, vTex)) + (texture(SPIRV_Cross_CombineduTexture0uSampler0, vTex) + texture(SPIRV_Cross_CombineduTexture1uSampler0, vTex))) + (texture(SPIRV_Cross_CombineduTexture0uSampler1, vTex) + texture(SPIRV_Cross_CombineduTexture1uSampler1, vTex))) + (texture(SPIRV_Cross_CombineduTexture0uSampler0, vTex) + texture(SPIRV_Cross_CombineduTexture0uSampler1, vTex))) + (texture(SPIRV_Cross_CombineduTexture1uSampler0, vTex) + texture(SPIRV_Cross_CombineduTexture1uSampler1, vTex)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk new file mode 100644 index 0000000000..7a543c4168 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 2) uniform mediump texture2D uTexture0; +layout(set = 0, binding = 3) uniform mediump texture2D uTexture1; +layout(set = 0, binding = 0) uniform mediump sampler uSampler0; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; + +layout(location = 0) in vec2 vTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ((((texture(sampler2D(uTexture0, uSampler0), vTex) + texture(sampler2D(uTexture1, uSampler1), vTex)) + (texture(sampler2D(uTexture0, uSampler0), vTex) + texture(sampler2D(uTexture1, uSampler0), vTex))) + (texture(sampler2D(uTexture0, uSampler1), vTex) + texture(sampler2D(uTexture1, uSampler1), vTex))) + (texture(sampler2D(uTexture0, uSampler0), vTex) + texture(sampler2D(uTexture0, uSampler1), vTex))) + (texture(sampler2D(uTexture1, uSampler0), vTex) + texture(sampler2D(uTexture1, uSampler1), vTex)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk new file mode 100644 index 0000000000..153164920f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk @@ -0,0 +1,15 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bool _15 = helperInvocationEXT(); + demote; + if (!_15) + { + FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk new file mode 100644 index 0000000000..688a5800d1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk @@ -0,0 +1,9 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + demote; + bool _9 = helperInvocationEXT(); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag new file mode 100644 index 0000000000..8f7508ee8e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 F; +layout(location = 1) flat in ivec4 I; +layout(location = 2) flat in uvec4 U; + +void main() +{ + FragColor = (F + vec4(I)) + vec4(U); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag.vk new file mode 100644 index 0000000000..4c0506b110 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/desktop-mediump.vk.frag.vk @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out mediump vec4 FragColor; +layout(location = 0) in mediump vec4 F; +layout(location = 1) flat in mediump ivec4 I; +layout(location = 2) flat in mediump uvec4 U; + +void main() +{ + FragColor = (F + vec4(I)) + vec4(U); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag new file mode 100644 index 0000000000..ea460c1fae --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSubpass0; +layout(binding = 1) uniform sampler2DMS uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = (texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 1) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 2)) + texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), gl_SampleID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk new file mode 100644 index 0000000000..462df22a19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk @@ -0,0 +1,12 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = (subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2)) + subpassLoad(uSubpass0, gl_SampleID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag new file mode 100644 index 0000000000..8d216b2c49 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uSubpass0; +layout(binding = 1) uniform mediump sampler2D uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 0) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag.vk new file mode 100644 index 0000000000..c8b5d9a70d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/input-attachment.vk.frag.vk @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0) + subpassLoad(uSubpass1); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk new file mode 100644 index 0000000000..891ed232e8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk @@ -0,0 +1,64 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 2, std140) uniform UBO +{ + vec4 v[64]; +} ubos[]; + +layout(set = 0, binding = 3, std430) buffer SSBO +{ + uint counter; + vec4 v[]; +} ssbos[]; + +layout(set = 0, binding = 0) uniform texture2D uSamplers[]; +layout(set = 0, binding = 1) uniform sampler uSamps[]; +layout(set = 0, binding = 4) uniform sampler2D uCombinedSamplers[]; +layout(set = 0, binding = 0) uniform texture2DMS uSamplersMS[]; +layout(set = 0, binding = 5, r32f) uniform image2D uImages[]; +layout(set = 0, binding = 5, r32ui) uniform uimage2D uImagesU32[]; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; +layout(location = 1) in vec2 vUV; + +void main() +{ + int _22 = vIndex + 10; + int _32 = vIndex + 40; + FragColor = texture(nonuniformEXT(sampler2D(uSamplers[_22], uSamps[_32])), vUV); + int _49 = _22; + FragColor = texture(uCombinedSamplers[nonuniformEXT(_49)], vUV); + int _65 = vIndex + 20; + int _69 = _32; + FragColor += ubos[nonuniformEXT(_65)].v[_69]; + int _83 = vIndex + 50; + int _88 = vIndex + 60; + FragColor += ssbos[nonuniformEXT(_83)].v[_88]; + int _100 = vIndex + 70; + ssbos[nonuniformEXT(_88)].v[_100] = vec4(20.0); + ivec2 _111 = ivec2(vUV); + FragColor = texelFetch(uSamplers[nonuniformEXT(_49)], _111, 0); + int _116 = vIndex + 100; + uint _122 = atomicAdd(ssbos[_116].counter, 100u); + vec4 _147 = FragColor; + vec2 _149 = _147.xy + (textureQueryLod(nonuniformEXT(sampler2D(uSamplers[_22], uSamps[_32])), vUV) + textureQueryLod(uCombinedSamplers[nonuniformEXT(_49)], vUV)); + FragColor.x = _149.x; + FragColor.y = _149.y; + FragColor.x += float(textureQueryLevels(uSamplers[nonuniformEXT(_65)])); + FragColor.y += float(textureSamples(uSamplersMS[nonuniformEXT(_65)])); + vec4 _189 = FragColor; + vec2 _191 = _189.xy + vec2(textureSize(uSamplers[nonuniformEXT(_65)], 0)); + FragColor.x = _191.x; + FragColor.y = _191.y; + FragColor += imageLoad(uImages[nonuniformEXT(_83)], _111); + vec4 _218 = FragColor; + vec2 _220 = _218.xy + vec2(imageSize(uImages[nonuniformEXT(_65)])); + FragColor.x = _220.x; + FragColor.y = _220.y; + imageStore(uImages[nonuniformEXT(_88)], _111, vec4(50.0)); + uint _248 = imageAtomicAdd(uImagesU32[nonuniformEXT(_100)], _111, 40u); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag new file mode 100644 index 0000000000..21618f8885 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(std140) uniform UBO +{ + float ubo[4]; +} _14; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = _14.ubo[1]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk new file mode 100644 index 0000000000..8ca4f23ac4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(push_constant, std140) uniform UBO +{ + float ubo[4]; +} _14; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = _14.ubo[1]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..c04a7ca488 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct PushConstants +{ + vec4 value0; + vec4 value1; +}; + +uniform PushConstants push; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = (vColor + push.value0) + push.value1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag.vk new file mode 100644 index 0000000000..6cec90f19e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/push-constant.vk.frag.vk @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(push_constant, std430) uniform PushConstants +{ + vec4 value0; + vec4 value1; +} push; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = (vColor + push.value0) + push.value1; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag new file mode 100644 index 0000000000..c17c8e6d67 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSamp; +uniform sampler2D SPIRV_Cross_CombineduTuS; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(uSamp, vec2(0.5)) + texture(SPIRV_Cross_CombineduTuS, vec2(0.5)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk new file mode 100644 index 0000000000..5a5ec20298 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk @@ -0,0 +1,13 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(set = 0, binding = 1) uniform texture2D uT; +layout(set = 0, binding = 2) uniform sampler uS; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(uSamp, vec2(0.5)) + texture(sampler2D(uT, uS), vec2(0.5)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag new file mode 100644 index 0000000000..f77b448cdc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTextureuSampler[4]; +uniform mediump sampler2DArray SPIRV_Cross_CombineduTextureArrayuSampler[4]; +uniform mediump samplerCube SPIRV_Cross_CombineduTextureCubeuSampler[4]; +uniform mediump sampler3D SPIRV_Cross_CombineduTexture3DuSampler[4]; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + highp vec2 _76 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[1], 0)); + vec2 mp_copy_76 = _76; + highp vec2 _86 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[2], 1)); + vec2 mp_copy_86 = _86; + vec2 _95 = (vTex + mp_copy_76) + mp_copy_86; + FragColor = ((((texture(SPIRV_Cross_CombineduTextureuSampler[2], _95) + texture(SPIRV_Cross_CombineduTextureuSampler[1], _95)) + texture(SPIRV_Cross_CombineduTextureuSampler[1], _95)) + texture(SPIRV_Cross_CombineduTextureArrayuSampler[3], vTex3)) + texture(SPIRV_Cross_CombineduTextureCubeuSampler[1], vTex3)) + texture(SPIRV_Cross_CombineduTexture3DuSampler[2], vTex3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk new file mode 100644 index 0000000000..7a0c428d19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 1) uniform mediump texture2D uTexture[4]; +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray[4]; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube[4]; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D[4]; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + highp vec2 _76 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[1], uSampler), 0)); + vec2 mp_copy_76 = _76; + highp vec2 _86 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[2], uSampler), 1)); + vec2 mp_copy_86 = _86; + vec2 _95 = (vTex + mp_copy_76) + mp_copy_86; + FragColor = ((((texture(sampler2D(uTexture[2], uSampler), _95) + texture(sampler2D(uTexture[1], uSampler), _95)) + texture(sampler2D(uTexture[1], uSampler), _95)) + texture(sampler2DArray(uTextureArray[3], uSampler), vTex3)) + texture(samplerCube(uTextureCube[1], uSampler), vTex3)) + texture(sampler3D(uTexture3D[2], uSampler), vTex3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag new file mode 100644 index 0000000000..c664bd55b1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTextureuSampler; +uniform mediump sampler2DArray SPIRV_Cross_CombineduTextureArrayuSampler; +uniform mediump samplerCube SPIRV_Cross_CombineduTextureCubeuSampler; +uniform mediump sampler3D SPIRV_Cross_CombineduTexture3DuSampler; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + highp vec2 _54 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 0)); + vec2 mp_copy_54 = _54; + highp vec2 _64 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 1)); + vec2 mp_copy_64 = _64; + vec2 _73 = (vTex + mp_copy_54) + mp_copy_64; + FragColor = (((texture(SPIRV_Cross_CombineduTextureuSampler, _73) + texture(SPIRV_Cross_CombineduTextureuSampler, _73)) + texture(SPIRV_Cross_CombineduTextureArrayuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTextureCubeuSampler, vTex3)) + texture(SPIRV_Cross_CombineduTexture3DuSampler, vTex3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk new file mode 100644 index 0000000000..9fcd325275 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 1) uniform mediump texture2D uTexture; +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + highp vec2 _54 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 0)); + vec2 mp_copy_54 = _54; + highp vec2 _64 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 1)); + vec2 mp_copy_64 = _64; + vec2 _73 = (vTex + mp_copy_54) + mp_copy_64; + FragColor = (((texture(sampler2D(uTexture, uSampler), _73) + texture(sampler2D(uTexture, uSampler), _73)) + texture(sampler2DArray(uTextureArray, uSampler), vTex3)) + texture(samplerCube(uTextureCube, uSampler), vTex3)) + texture(sampler3D(uTexture3D, uSampler), vTex3); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk new file mode 100644 index 0000000000..512bc915e6 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk @@ -0,0 +1,43 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require + +layout(set = 0, binding = 1, std430) buffer SSBO +{ + int8_t i8[16]; + uint8_t u8[16]; +} ssbo; + +layout(set = 0, binding = 0, std140) uniform UBO +{ + int8_t i8; + uint8_t u8; +} ubo; + +layout(push_constant, std430) uniform Push +{ + int8_t i8; + uint8_t u8; +} registers; + +layout(location = 0) flat in ivec4 vColor; +layout(location = 0) out ivec4 FragColorInt; +layout(location = 1) out uvec4 FragColorUint; + +void main() +{ + i8vec4 _204 = unpack8(20); + ssbo.i8[0] = _204.x; + ssbo.i8[1] = _204.y; + ssbo.i8[2] = _204.z; + ssbo.i8[3] = _204.w; + u8vec4 _229 = unpack8(20u); + ssbo.u8[0] = _229.x; + ssbo.u8[1] = _229.y; + ssbo.u8[2] = _229.z; + ssbo.u8[3] = _229.w; + i8vec4 _249 = i8vec4(vColor); + FragColorInt = ivec4((((((_249 + i8vec4(registers.i8)) + i8vec4(-40)) + i8vec4(-50)) + i8vec4(int8_t(10), int8_t(20), int8_t(30), int8_t(40))) + i8vec4(ssbo.i8[4])) + i8vec4(ubo.i8)); + FragColorUint = uvec4((((((u8vec4(_249) + u8vec4(registers.u8)) + u8vec4(216)) + u8vec4(206)) + u8vec4(uint8_t(10), uint8_t(20), uint8_t(30), uint8_t(40))) + u8vec4(ssbo.u8[4])) + u8vec4(ubo.u8)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag new file mode 100644 index 0000000000..19ea6ae064 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag @@ -0,0 +1,22 @@ +#version 310 es +precision mediump float; +precision highp int; + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +const int Value = SPIRV_CROSS_CONSTANT_ID_10; + +layout(binding = 0, std140) uniform SpecConstArray +{ + vec4 samples[Value]; +} _15; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int Index; + +void main() +{ + FragColor = _15.samples[Index]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk new file mode 100644 index 0000000000..133761a83d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(constant_id = 10) const int Value = 2; + +layout(set = 0, binding = 0, std140) uniform SpecConstArray +{ + vec4 samples[Value]; +} _15; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int Index; + +void main() +{ + FragColor = _15.samples[Index]; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag new file mode 100644 index 0000000000..081206f1cb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag @@ -0,0 +1,16 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 10u +#endif +const uint s = SPIRV_CROSS_CONSTANT_ID_0; +const bool _13 = (s > 20u); +const uint f = _13 ? 30u : 50u; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(f); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk new file mode 100644 index 0000000000..04c4062a6c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(constant_id = 0) const uint s = 10u; +const bool _13 = (s > 20u); +const uint f = _13 ? 30u : 50u; + +layout(location = 0) out float FragColor; + +void main() +{ + float _17 = float(f); + FragColor = _17; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..2f7fbc1d95 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + if (payload > 0.0) + { + ignoreIntersectionEXT; + } + else + { + terminateRayEXT; + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..9b9e34b325 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void main() +{ + if (payload > 0.0) + { + ignoreIntersectionNV(); + } + else + { + terminateRayNV(); + } +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk new file mode 100644 index 0000000000..5adfac164f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) callableDataInEXT float c; + +void main() +{ + executeCallableEXT(10u, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..b6c1876d31 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..614a04d95e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..b6c1876d31 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..614a04d95e --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..eeccd3bb09 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..908d96344f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec2 payload; +hitAttributeNV vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a51e6b088f --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..133bdfc1d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e4e0103ddb --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..64f79a8dce --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_HitKindNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e94e3323c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..9004a00c40 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_HitTNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a013baa11d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..d17ab8ce76 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e28af5d252 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexEXT); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..531a1fc284 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexNV); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..0413e0d234 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..ff551db7c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..237d4790e5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..01afa0e067 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..5739ac09ff --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a49e17a173 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..7922e1efbf --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..fc2c5ed0c2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldNV * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..0bde78724c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void main() +{ + payload.a = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..6d865f7a19 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInNV Payload payload; + +void main() +{ + payload.a = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..667c015e8d --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..d3b0ef1942 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e94e3323c9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..769c96ad6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTmaxNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..04b8954950 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..2709899a13 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTminNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..05af948b37 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..103fd66b80 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..68ba2bafa5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..4acf03e064 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a5c6766e05 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..70241f2362 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginNV; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..309ca4c6f1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..0b93e38acd --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldToObjectNV * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk new file mode 100644 index 0000000000..335f476dc5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(push_constant, std430) uniform Registers +{ + uvec2 ptr; +} _19; + +layout(location = 0) rayPayloadEXT vec4 payload; + +void main() +{ + traceRayEXT(accelerationStructureEXT(_19.ptr), 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk new file mode 100644 index 0000000000..2cb00f26f1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT vec4 payload; +layout(location = 1) callableDataEXT float blend; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0); + executeCallableEXT(0u, 1); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..926546c04c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; +layout(location = 0) rayPayloadNV vec4 payload; +layout(location = 0) callableDataNV float blend; + +void main() +{ + traceNV(as, 1u, 255u, 0u, 0u, 0u, vec3(0.0), 0.0, vec3(0.0, 0.0, -1.0), 100.0, 0); + executeCallableNV(0u, 0); + imageStore(image, ivec2(gl_LaunchIDNV.xy), payload + vec4(blend)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..1614c49626 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..f907e6fd60 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDNV.xy), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..240e93daa4 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..08992c6319 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeNV.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..434eadf216 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,31 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT Payload payload2; +layout(location = 1) rayPayloadEXT float payload1; +layout(location = 2) rayPayloadEXT Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 1); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 2); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), (vec4(payload1) + (vec4(payload2.a) + vec4(payload2.b))) + vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..8212fa6484 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk @@ -0,0 +1,31 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 1) rayPayloadNV Payload payload2; +layout(location = 0) rayPayloadNV float payload1; +layout(location = 2) rayPayloadNV Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 1); + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(1.0, 0.0, 0.0), 0.0, vec3(0.0, 1.0, 0.0), 1000.0, 2); + imageStore(image, ivec2(gl_LaunchIDNV.xy), (vec4(payload1) + (vec4(payload2.a) + vec4(payload2.b))) + vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..25b8f2877a --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + vec2 _57 = vec2(gl_LaunchIDEXT.xy); + vec2 _61 = vec2(gl_LaunchSizeEXT.xy); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(_57.x / _61.x, _57.y / _61.y, 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..31603fe1c1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk @@ -0,0 +1,12 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; + +void main() +{ + vec2 _55 = vec2(gl_LaunchIDNV.xy); + vec2 _59 = vec2(gl_LaunchSizeNV.xy); + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(_55.x / _59.x, _55.y / _59.y, 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..d881446595 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); + vec4 _68 = vec4(0.0, 0.0, 0.0, 1.0); + _68.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), _68); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..b39ea891c3 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); + vec4 _68 = vec4(0.0, 0.0, 0.0, 1.0); + _68.y = payload; + imageStore(image, ivec2(gl_LaunchIDNV.xy), _68); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..3056e8ad28 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..daa9c3ee6b --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(shaderRecordNV, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk new file mode 100644 index 0000000000..f9eb7335d8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk @@ -0,0 +1,8 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void main() +{ + bool _16 = reportIntersectionEXT(0.5, 10u); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk new file mode 100644 index 0000000000..56873aff06 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk @@ -0,0 +1,8 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void main() +{ + bool _16 = reportIntersectionNV(0.5, 10u); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..c055a26814 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..ec3072a0e2 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..7e79126616 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadInEXT float p; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0), 0.0, vec3(0.0, 0.0, -1.0), 1000.0, 0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk new file mode 100644 index 0000000000..9cadcdb6dc --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_device_group : require + +void main() +{ + gl_Position = vec4(float(gl_DeviceIndex)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk new file mode 100644 index 0000000000..90055473d9 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk @@ -0,0 +1,15 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(set = 0, binding = 0, std140) uniform MVPs +{ + mat4 MVP[2]; +} _19; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = _19.MVP[gl_ViewIndex] * Position; +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..2c4beb71e5 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,69 @@ +#version 450 +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif +#if defined(GL_EXT_shader_explicit_arithmetic_types_int8) +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int8. +#endif +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif + +layout(binding = 0, std140) uniform block +{ + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +} _26; + +layout(binding = 1, std430) readonly buffer storage +{ + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +} _53; + +struct pushconst +{ + i16vec4 k; + u16vec4 l; + i8vec4 m; + u8vec4 n; + f16vec4 o; +}; + +uniform pushconst _76; + +layout(location = 0) out i16vec4 p; +layout(location = 0, component = 0) in int16_t foo; +layout(location = 1) out u16vec4 q; +layout(location = 0, component = 1) in uint16_t bar; +layout(location = 2) out f16vec4 r; +layout(location = 1) in float16_t baz; + +void main() +{ + p = i16vec4((((ivec4(int(foo)) + ivec4(ivec2(_26.a), ivec2(_26.c))) - ivec4(ivec3(_53.f) / ivec3(_53.h), 1)) + ivec4(_76.k)) + ivec4(_76.m)); + q = u16vec4((((uvec4(uint(bar)) + uvec4(uvec2(_26.b), uvec2(_26.d))) - uvec4(uvec3(_53.g) / uvec3(_53.i), 1u)) + uvec4(_76.l)) + uvec4(_76.n)); + r = f16vec4(((vec4(float(baz)) + vec4(vec2(_26.e), 0.0, 1.0)) - vec4(vec3(_53.j), 1.0)) + vec4(_76.o)); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert.vk new file mode 100644 index 0000000000..caec60a2c1 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/small-storage.vk.vert.vk @@ -0,0 +1,55 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif + +layout(set = 0, binding = 0, std140) uniform block +{ + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +} _26; + +layout(set = 0, binding = 1, std430) readonly buffer storage +{ + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +} _53; + +layout(push_constant, std430) uniform pushconst +{ + i16vec4 k; + u16vec4 l; + i8vec4 m; + u8vec4 n; + f16vec4 o; +} _76; + +layout(location = 0) out i16vec4 p; +layout(location = 0, component = 0) in int16_t foo; +layout(location = 1) out u16vec4 q; +layout(location = 0, component = 1) in uint16_t bar; +layout(location = 2) out f16vec4 r; +layout(location = 1) in float16_t baz; + +void main() +{ + p = i16vec4((((ivec4(int(foo)) + ivec4(ivec2(_26.a), ivec2(_26.c))) - ivec4(ivec3(_53.f) / ivec3(_53.h), 1)) + ivec4(_76.k)) + ivec4(_76.m)); + q = u16vec4((((uvec4(uint(bar)) + uvec4(uvec2(_26.b), uvec2(_26.d))) - uvec4(uvec3(_53.g) / uvec3(_53.i), 1u)) + uvec4(_76.l)) + uvec4(_76.n)); + r = f16vec4(((vec4(float(baz)) + vec4(vec2(_26.e), 0.0, 1.0)) - vec4(vec3(_53.j), 1.0)) + vec4(_76.o)); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..d939aa625c --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,16 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif + +void main() +{ + gl_Position = vec4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexID + (gl_InstanceID + SPIRV_Cross_BaseInstance)); +} + diff --git a/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk new file mode 100644 index 0000000000..8c4930d7a8 --- /dev/null +++ b/third_party/spirv-cross/reference/opt/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk @@ -0,0 +1,7 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexIndex + gl_InstanceIndex); +} + diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp new file mode 100644 index 0000000000..986cc6289f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp @@ -0,0 +1,75 @@ +struct Baz +{ + float c; +}; + +struct Bar +{ + float d[2][4]; + Baz baz[2]; +}; + +struct Foo +{ + column_major float2x2 a; + float2 b; + Bar c[5]; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _10 : register(u0); + +void comp_main() +{ + Foo _64; + _64.a = asfloat(uint2x2(_10.Load(0), _10.Load(8), _10.Load(4), _10.Load(12))); + _64.b = asfloat(_10.Load2(16)); + [unroll] + for (int _0ident = 0; _0ident < 5; _0ident++) + { + [unroll] + for (int _1ident = 0; _1ident < 2; _1ident++) + { + [unroll] + for (int _2ident = 0; _2ident < 4; _2ident++) + { + _64.c[_0ident].d[_1ident][_2ident] = asfloat(_10.Load(_2ident * 4 + _1ident * 16 + _0ident * 40 + 24)); + } + } + [unroll] + for (int _3ident = 0; _3ident < 2; _3ident++) + { + _64.c[_0ident].baz[_3ident].c = asfloat(_10.Load(_3ident * 4 + _0ident * 40 + 56)); + } + } + _10.Store(224, asuint(_64.a[0].x)); + _10.Store(228, asuint(_64.a[1].x)); + _10.Store(232, asuint(_64.a[0].y)); + _10.Store(236, asuint(_64.a[1].y)); + _10.Store2(240, asuint(_64.b)); + [unroll] + for (int _4ident = 0; _4ident < 5; _4ident++) + { + [unroll] + for (int _5ident = 0; _5ident < 2; _5ident++) + { + [unroll] + for (int _6ident = 0; _6ident < 4; _6ident++) + { + _10.Store(_6ident * 4 + _5ident * 16 + _4ident * 40 + 248, asuint(_64.c[_4ident].d[_5ident][_6ident])); + } + } + [unroll] + for (int _7ident = 0; _7ident < 2; _7ident++) + { + _10.Store(_7ident * 4 + _4ident * 40 + 280, asuint(_64.c[_4ident].baz[_7ident].c)); + } + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..b75157162d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,22 @@ +struct T +{ + float c; +}; + +static const T _18 = { 40.0f }; + +RWByteAddressBuffer _7 : register(u0); +RWByteAddressBuffer _10 : register(u1); + +void comp_main() +{ + T v = _18; + _7.Store(40, asuint(v.c)); + _10.Store(480, asuint(v.c)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..4f6a3e34c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,18 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _5 : register(u0); + +void comp_main() +{ + uint _20; + _5.InterlockedAdd(4, 0, _20); + uint c = _20; + uint _23; + _5.InterlockedExchange(0, c, _23); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..3a03fafe63 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,24 @@ +RWByteAddressBuffer _5 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _24; + _5.InterlockedAdd(0, 1u, _24); + if (_24 < 1024u) + { + _5.Store(_24 * 4 + 4, gl_GlobalInvocationID.x); + } +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..ebc431b3ed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,105 @@ +RWByteAddressBuffer _3 : register(u0); + +uint spvBitfieldInsert(uint Base, uint Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint2 spvBitfieldInsert(uint2 Base, uint2 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint3 spvBitfieldInsert(uint3 Base, uint3 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint4 spvBitfieldInsert(uint4 Base, uint4 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint spvBitfieldUExtract(uint Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint2 spvBitfieldUExtract(uint2 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint3 spvBitfieldUExtract(uint3 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint4 spvBitfieldUExtract(uint4 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +int spvBitfieldSExtract(int Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int2 spvBitfieldSExtract(int2 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int2 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int3 spvBitfieldSExtract(int3 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int3 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int4 spvBitfieldSExtract(int4 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int4 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +void comp_main() +{ + int4 _19 = int4(_3.Load4(0)); + uint4 _20 = _3.Load4(16); + _3.Store4(0, uint4(countbits(_19))); + _3.Store4(16, uint4(countbits(_19))); + _3.Store4(0, uint4(int4(countbits(_20)))); + _3.Store4(16, countbits(_20)); + _3.Store4(0, uint4(reversebits(_19))); + _3.Store4(16, reversebits(_20)); + _3.Store4(0, uint4(spvBitfieldSExtract(_19, 1, 11u))); + _3.Store4(16, spvBitfieldSExtract(_20, 11u, 1)); + _3.Store4(0, uint4(spvBitfieldUExtract(_19, 1, 11u))); + _3.Store4(16, spvBitfieldUExtract(_20, 11u, 1)); + _3.Store4(0, uint4(int4(spvBitfieldInsert(_19, _19.wzyx, 1, 11u)))); + _3.Store4(16, spvBitfieldInsert(_20, _20.wzyx, 11u, 1)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..f8a5fb6fa3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,25 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + uint4 _19 = _4.Load4(0); + int4 _20 = int4(_4.Load4(16)); + _4.Store4(0, firstbitlow(_19)); + _4.Store4(16, uint4(int4(firstbitlow(_19)))); + _4.Store4(0, uint4(firstbitlow(_20))); + _4.Store4(16, uint4(firstbitlow(_20))); + _4.Store4(0, firstbithigh(_19)); + _4.Store4(16, uint4(int4(firstbithigh(_19)))); + _4.Store4(0, firstbithigh(uint4(_20))); + _4.Store4(16, uint4(int4(firstbithigh(uint4(_20))))); + _4.Store4(0, uint4(firstbithigh(int4(_19)))); + _4.Store4(16, uint4(firstbithigh(int4(_19)))); + _4.Store4(0, uint4(firstbithigh(_20))); + _4.Store4(16, uint4(firstbithigh(_20))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp new file mode 100644 index 0000000000..0b6d93e48f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp @@ -0,0 +1,21 @@ +RWByteAddressBuffer ssbos[] : register(u0, space0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _24 = gl_GlobalInvocationID.z; + uint _25; + ssbos[NonUniformResourceIndex(_24)].InterlockedAdd(0, 1u, _25); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..a9eab1ccaf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,14 @@ +static float _15; + +RWByteAddressBuffer block : register(u0); + +void comp_main() +{ + block.Store4(0, asuint(float4(0.100000001490116119384765625f, 0.20000000298023223876953125f, 0.300000011920928955078125f, 0.0f))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..d3dc533753 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,27 @@ +static const uint3 gl_WorkGroupSize = uint3(4u, 4u, 1u); + +static const int indexable[4] = { 0, 1, 2, 3 }; +static const int indexable_1[4] = { 4, 5, 6, 7 }; + +RWByteAddressBuffer _6 : register(u0); + +static uint3 gl_LocalInvocationID; +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_LocalInvocationID : SV_GroupThreadID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _6.Store(gl_GlobalInvocationID.x * 4 + 0, uint(indexable[gl_LocalInvocationID.x] + indexable_1[gl_LocalInvocationID.y])); +} + +[numthreads(4, 4, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_LocalInvocationID = stage_input.gl_LocalInvocationID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..a53efc4f7f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,11 @@ +static const uint3 gl_WorkGroupSize = uint3(64u, 1u, 1u); + +void comp_main() +{ +} + +[numthreads(64, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..db16cf60ed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,45 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + int4 _19 = int4(_4.Load4(0)); + uint4 _20 = _4.Load4(16); + _4.Store4(0, uint4(abs(_19))); + _4.Store4(16, uint4(abs(_19))); + _4.Store4(0, uint4(abs(int4(_20)))); + _4.Store4(16, uint4(abs(int4(_20)))); + _4.Store4(0, uint4(sign(_19))); + _4.Store4(16, uint4(sign(_19))); + _4.Store4(0, uint4(sign(int4(_20)))); + _4.Store4(16, uint4(sign(int4(_20)))); + _4.Store4(0, uint4(firstbithigh(int4(_20)))); + _4.Store4(16, uint4(firstbithigh(int4(_20)))); + _4.Store4(0, uint4(int4(firstbithigh(uint4(_19))))); + _4.Store4(16, firstbithigh(uint4(_19))); + _4.Store4(0, uint4(min(_19, _19))); + _4.Store4(16, uint4(min(_19, int4(_20)))); + _4.Store4(0, uint4(min(int4(_20), int4(_20)))); + _4.Store4(16, uint4(min(int4(_20), _19))); + _4.Store4(0, uint4(int4(min(uint4(_19), _20)))); + _4.Store4(16, min(uint4(_19), _20)); + _4.Store4(0, uint4(int4(min(_20, uint4(_19))))); + _4.Store4(16, min(_20, uint4(_19))); + _4.Store4(0, uint4(max(_19, _19))); + _4.Store4(16, uint4(max(_19, _19))); + _4.Store4(0, uint4(max(int4(_20), _19))); + _4.Store4(16, uint4(max(int4(_20), _19))); + _4.Store4(0, uint4(int4(max(uint4(_19), _20)))); + _4.Store4(16, max(uint4(_19), uint4(_19))); + _4.Store4(0, uint4(int4(max(_20, uint4(_19))))); + _4.Store4(16, max(_20, uint4(_19))); + _4.Store4(0, uint4(clamp(int4(_20), int4(_20), int4(_20)))); + _4.Store4(16, uint4(clamp(int4(_20), int4(_20), int4(_20)))); + _4.Store4(0, uint4(int4(clamp(uint4(_19), uint4(_19), uint4(_19))))); + _4.Store4(16, clamp(uint4(_19), uint4(_19), uint4(_19))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp new file mode 100644 index 0000000000..b1232635ea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp @@ -0,0 +1,31 @@ +struct _8 +{ + float _m0; + float _m1; +}; + +struct _15 +{ + float _m0; + int _m1; +}; + +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _8 _23; + _23._m0 = modf(20.0f, _23._m1); + _15 _24; + _24._m0 = frexp(40.0f, _24._m1); + _4.Store(0, asuint(_23._m0)); + _4.Store(0, asuint(_23._m1)); + _4.Store(0, asuint(_24._m0)); + _4.Store(4, uint(_24._m1)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp new file mode 100644 index 0000000000..07f87ca9e6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp @@ -0,0 +1,21 @@ +RWTexture2D uImage[] : register(u0, space0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _26 = gl_GlobalInvocationID.z; + uint _31; + InterlockedAdd(uImage[NonUniformResourceIndex(_26)][int2(gl_GlobalInvocationID.xy)], 1u, _31); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp new file mode 100644 index 0000000000..dbc881f998 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp @@ -0,0 +1,37 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 11u +#endif +static const uint _10 = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 12u +#endif +static const uint _11 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 13u +#endif +static const uint _4 = SPIRV_CROSS_CONSTANT_ID_3; +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 14u +#endif +static const uint _5 = SPIRV_CROSS_CONSTANT_ID_4; +static const uint3 gl_WorkGroupSize = uint3(3u, _10, _11); + +RWByteAddressBuffer _8 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _8.Store4(gl_GlobalInvocationID.x * 16 + 0, asuint(asfloat(_8.Load4(gl_GlobalInvocationID.x * 16 + 0)) + 2.0f.xxxx)); +} + +[numthreads(3, SPIRV_CROSS_CONSTANT_ID_1, SPIRV_CROSS_CONSTANT_ID_2)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp new file mode 100644 index 0000000000..157f9e9921 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp @@ -0,0 +1,38 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 11 +#endif +static const int _10 = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 12 +#endif +static const int _11 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 13 +#endif +static const int _4 = SPIRV_CROSS_CONSTANT_ID_3; +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 14 +#endif +static const int _5 = SPIRV_CROSS_CONSTANT_ID_4; +static const uint _29 = (uint(_4) + 3u); +static const uint3 _30 = uint3(_29, _5, 2u); + +RWByteAddressBuffer _8 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _8.Store4(gl_GlobalInvocationID.x * 16 + 0, asuint(((((asfloat(_8.Load4(gl_GlobalInvocationID.x * 16 + 0)) + 2.0f.xxxx) + float3(_30).xyzz) * float(_4)) * float(_5)) * float(int(2u)))); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_3, SPIRV_CROSS_CONSTANT_ID_4, 2)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp new file mode 100644 index 0000000000..e771d77bb8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp @@ -0,0 +1,24 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _3 : register(u1); +cbuffer UBO : register(b0) +{ + uint3 _5_w : packoffset(c0); +}; + +cbuffer SPIRV_Cross_NumWorkgroups +{ + uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0); +}; + + +void comp_main() +{ + _3.Store3(0, SPIRV_Cross_NumWorkgroups_1_count + _5_w); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp new file mode 100644 index 0000000000..423beee63f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp @@ -0,0 +1,51 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 0 +#endif +static const int A = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1 +#endif +static const int A_1 = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2 +#endif +static const int A_2 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +static const int A_3 = SPIRV_CROSS_CONSTANT_ID_3; +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 4 +#endif +static const int A_4 = SPIRV_CROSS_CONSTANT_ID_4; +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 5 +#endif +static const int A_5 = SPIRV_CROSS_CONSTANT_ID_5; +static const int A_6 = (A - A_1); +static const int A_7 = (A_6 - A_2); +static const int A_8 = (A_7 - A_3); +static const int A_9 = (A_8 - A_4); +static const int A_10 = (A_9 - A_5); +static const int A_11 = (A_10 + A_5); +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _5 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _5.Store(gl_GlobalInvocationID.x * 4 + 0, uint(A_11)); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp new file mode 100644 index 0000000000..8c239b3198 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp @@ -0,0 +1,22 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 9u +#endif +static const uint _5 = SPIRV_CROSS_CONSTANT_ID_10; +#ifndef SPIRV_CROSS_CONSTANT_ID_12 +#define SPIRV_CROSS_CONSTANT_ID_12 4u +#endif +static const uint _6 = SPIRV_CROSS_CONSTANT_ID_12; +static const uint3 gl_WorkGroupSize = uint3(_5, 20u, _6); + +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _4.Store(0, asuint(asfloat(_4.Load(0)) + 1.0f)); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, SPIRV_CROSS_CONSTANT_ID_12)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp new file mode 100644 index 0000000000..c567fbaf14 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp @@ -0,0 +1,32 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +static const uint _3 = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 3u +#endif +static const uint _4 = SPIRV_CROSS_CONSTANT_ID_2; +static const uint3 gl_WorkGroupSize = uint3(_3, 2u, _4); + +RWByteAddressBuffer _8 : register(u0); +RWByteAddressBuffer _9 : register(u1); + +static uint3 gl_WorkGroupID; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; +}; + +static uint3 _22 = gl_WorkGroupSize; + +void comp_main() +{ + _8.Store(gl_WorkGroupID.x * 4 + 0, asuint(asfloat(_9.Load(gl_WorkGroupID.x * 4 + 0)) + asfloat(_8.Load(gl_WorkGroupID.x * 4 + 0)))); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_0, 2, SPIRV_CROSS_CONSTANT_ID_2)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..128a8c52f9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,89 @@ +struct anon_aa +{ + int foo; +}; + +struct anon_ab +{ + int foo; +}; + +struct anon_a +{ + anon_aa _aa; + anon_ab ab; +}; + +struct anon_ba +{ + int foo; +}; + +struct anon_bb +{ + int foo; +}; + +struct anon_b +{ + anon_ba _ba; + anon_bb bb; +}; + +struct VertexData +{ + anon_a _a; + anon_b b; +}; + +struct anon_ca +{ + int foo; +}; + +struct anon_c +{ + anon_ca _ca; +}; + +struct anon_da +{ + int foo; +}; + +struct anon_d +{ + anon_da da; +}; + +struct anon_e +{ + int a; +}; + +cbuffer UBO : register(b0) +{ + anon_c _16_c : packoffset(c0); + anon_d _16_d : packoffset(c1); +}; + +RWByteAddressBuffer _19 : register(u1); + +static VertexData _3; + +struct SPIRV_Cross_Input +{ + anon_a VertexData__a : TEXCOORD0; + anon_b VertexData_b : TEXCOORD2; +}; + +void frag_main() +{ +} + +void main(SPIRV_Cross_Input stage_input) +{ + _3._a = stage_input.VertexData__a; + _3.b = stage_input.VertexData_b; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..8c61e61b5f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,84 @@ +static float4 _32; + +static const float4 _34[2] = { 0.0f.xxxx, 0.0f.xxxx }; + +static float4 vInput; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 vInput : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _37 = vInput; + float4 _38 = _37; + _38.x = 1.0f; + _38.y = 2.0f; + _38.z = 3.0f; + _38.w = 4.0f; + FragColor = _38; + float4 _6 = _37; + _6.x = 1.0f; + _6.y = 2.0f; + _6.z = 3.0f; + _6.w = 4.0f; + FragColor = _6; + float4 _42 = _37; + _42.x = 1.0f; + _42.y = 2.0f; + _42.z = 3.0f; + _42.w = 4.0f; + FragColor = _42; + float4 _44 = _37; + _44.x = 1.0f; + float4 _45 = _44; + _45.y = 2.0f; + float4 _46 = _45; + _46.z = 3.0f; + float4 _47 = _46; + _47.w = 4.0f; + FragColor = _47 + _44; + FragColor = _47 + _45; + float4 _49; + _49.x = 1.0f; + _49.y = 2.0f; + _49.z = 3.0f; + _49.w = 4.0f; + FragColor = _49; + float4 _53 = 0.0f.xxxx; + _53.x = 1.0f; + FragColor = _53; + float4 _54[2] = _34; + _54[1].z = 1.0f; + _54[0].w = 2.0f; + FragColor = _54[0]; + FragColor = _54[1]; + float4x4 _58 = float4x4(0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx); + _58[1].z = 1.0f; + _58[2].w = 2.0f; + FragColor = _58[0]; + FragColor = _58[1]; + FragColor = _58[2]; + FragColor = _58[3]; + float4 PHI; + PHI = _46; + float4 _65 = PHI; + _65.w = 4.0f; + FragColor = _65; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput = stage_input.vInput; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..e7ffd8d606 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,37 @@ +struct EmptyStructTest +{ + int empty_struct_member; +}; + +struct EmptyStruct2Test +{ + EmptyStructTest _m0; +}; + +static const EmptyStructTest _30 = { 0 }; +static const EmptyStruct2Test _20 = { { 0 } }; + +float GetValue(EmptyStruct2Test self) +{ + return 0.0f; +} + +float GetValue_1(EmptyStruct2Test self) +{ + return 0.0f; +} + +void frag_main() +{ + EmptyStructTest _25 = { 0 }; + EmptyStruct2Test _26 = { _25 }; + EmptyStruct2Test emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(_26); + value = GetValue_1(_20); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..c5a761345f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,28 @@ +Texture2D Tex : register(t0); + +static uint3 in_var_TEXCOORD0; +static float4 out_var_SV_Target0; + +struct SPIRV_Cross_Input +{ + nointerpolation uint3 in_var_TEXCOORD0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target0 : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target0 = Tex.Load(int3(in_var_TEXCOORD0.xy, in_var_TEXCOORD0.z)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target0 = out_var_SV_Target0; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag new file mode 100644 index 0000000000..fd758b17d7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag @@ -0,0 +1,37 @@ +ByteAddressBuffer _8 : register(t0, space2); +Texture2D uSamplers[] : register(t0, space0); +SamplerState _uSamplers_sampler[] : register(s0, space0); +Texture2D uSampler : register(t1, space1); +SamplerState _uSampler_sampler : register(s1, space1); + +static float4 gl_FragCoord; +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uSamplers[NonUniformResourceIndex(_8.Load(40))].SampleLevel(_uSamplers_sampler[NonUniformResourceIndex(_8.Load(40))], vUV, 0.0f); + FragColor += uSampler.SampleLevel(_uSampler_sampler, vUV, float(_8.Load(int(gl_FragCoord.y) * 4 + 0))); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag new file mode 100644 index 0000000000..0356cf58d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag @@ -0,0 +1,52 @@ +struct UBO_1 +{ + float4 v[64]; +}; + +ConstantBuffer ubos[] : register(b0, space2); +ByteAddressBuffer ssbos[] : register(t0, space3); +Texture2D uSamplers[] : register(t0, space0); +SamplerState uSamps[] : register(s0, space1); +Texture2D uCombinedSamplers[] : register(t4, space0); +SamplerState _uCombinedSamplers_sampler[] : register(s4, space0); + +static int vIndex; +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIndex : TEXCOORD0; + float2 vUV : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int i = vIndex; + int _59 = i + 10; + int _64 = i + 40; + FragColor = uSamplers[NonUniformResourceIndex(_59)].Sample(uSamps[NonUniformResourceIndex(_64)], vUV); + int _71 = i + 10; + FragColor = uCombinedSamplers[NonUniformResourceIndex(_71)].Sample(_uCombinedSamplers_sampler[NonUniformResourceIndex(_71)], vUV); + int _77 = i + 20; + int _80 = i + 40; + FragColor += ubos[NonUniformResourceIndex(_77)].v[_80]; + int _87 = i + 50; + int _90 = i + 60; + FragColor += asfloat(ssbos[NonUniformResourceIndex(_87)].Load4(_90 * 16 + 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag new file mode 100644 index 0000000000..a692cdcf40 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag @@ -0,0 +1,39 @@ +RWByteAddressBuffer ssbos[] : register(u3, space0); + +static int vIndex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIndex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int i = vIndex; + int _42 = i + 60; + int _45 = i + 70; + ssbos[NonUniformResourceIndex(_42)].Store4(_45 * 16 + 16, asuint(20.0f.xxxx)); + int _48 = i + 100; + uint _49; + ssbos[NonUniformResourceIndex(_48)].InterlockedAdd(0, 100u, _49); + int _51 = i; + uint _52; + ssbos[NonUniformResourceIndex(_51)].GetDimensions(_52); + _52 = (_52 - 16) / 16; + FragColor.z += float(int(_52)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..dcbe5d134f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,17 @@ +static float gl_FragDepth = 0.5f; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_Depth; +}; + +void frag_main() +{ +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..2ce5fd41cf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,46 @@ +static int uninit_int = 0; +static int4 uninit_vector = int4(0, 0, 0, 0); +static float4x4 uninit_matrix = float4x4(0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx); + +struct Foo +{ + int a; +}; + +static Foo uninit_foo = { 0 }; + +static float4 vColor; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int _39 = 0; + if (vColor.x > 10.0f) + { + _39 = 10; + } + else + { + _39 = 20; + } + FragColor = vColor; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..8a47b91bf9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag @@ -0,0 +1,33 @@ +RasterizerOrderedByteAddressBuffer _7 : register(u1, space0); +RWByteAddressBuffer _9 : register(u0, space0); + +static float4 gl_FragCoord; +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +void callee2() +{ + int _31 = int(gl_FragCoord.x); + _7.Store(_31 * 4 + 0, _7.Load(_31 * 4 + 0) + 1u); +} + +void callee() +{ + int _39 = int(gl_FragCoord.x); + _9.Store(_39 * 4 + 0, _9.Load(_39 * 4 + 0) + 1u); + callee2(); +} + +void frag_main() +{ + callee(); +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..01bbe7ddc2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag @@ -0,0 +1,43 @@ +RasterizerOrderedByteAddressBuffer _7 : register(u1, space0); +RWByteAddressBuffer _13 : register(u2, space0); +RasterizerOrderedByteAddressBuffer _9 : register(u0, space0); + +static float4 gl_FragCoord; +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +void callee2() +{ + int _44 = int(gl_FragCoord.x); + _7.Store(_44 * 4 + 0, _7.Load(_44 * 4 + 0) + 1u); +} + +void callee() +{ + int _52 = int(gl_FragCoord.x); + _9.Store(_52 * 4 + 0, _9.Load(_52 * 4 + 0) + 1u); + callee2(); + if (true) + { + } +} + +void _35() +{ + _13.Store(int(gl_FragCoord.x) * 4 + 0, 4u); +} + +void frag_main() +{ + callee(); + _35(); +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..c1fb6ebbc2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag @@ -0,0 +1,43 @@ +RasterizerOrderedByteAddressBuffer _7 : register(u1, space0); +RasterizerOrderedByteAddressBuffer _9 : register(u0, space0); + +static float4 gl_FragCoord; +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +void callee2() +{ + int _37 = int(gl_FragCoord.x); + _7.Store(_37 * 4 + 0, _7.Load(_37 * 4 + 0) + 1u); +} + +void callee() +{ + int _45 = int(gl_FragCoord.x); + _9.Store(_45 * 4 + 0, _9.Load(_45 * 4 + 0) + 1u); + callee2(); +} + +void _29() +{ +} + +void _31() +{ +} + +void frag_main() +{ + callee(); + _29(); + _31(); +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..1f1f6fac10 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,31 @@ +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float _mat3(float a) +{ + return a + 1.0f; +} + +float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(int a) +{ + return float(a) + 1.0f; +} + +void frag_main() +{ + float param = 2.0f; + int param_1 = 4; + FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..b6d1a90242 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,62 @@ +struct _15 +{ + float _m0; +}; + +static const _15 _25 = { 0.0f }; +static const _15 _26 = { 1.0f }; +static const float _29[2] = { 0.0f, 1.0f }; +static const float _30[2] = { 1.0f, 0.0f }; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void spvSelectComposite(out _15 out_value, bool cond, _15 true_val, _15 false_val) +{ + if (cond) + { + out_value = true_val; + } + else + { + out_value = false_val; + } +} + +void spvSelectComposite(out float out_value[2], bool cond, float true_val[2], float false_val[2]) +{ + if (cond) + { + out_value = true_val; + } + else + { + out_value = false_val; + } +} + +void frag_main() +{ + FragColor = false ? float4(1.0f, 1.0f, 0.0f, 1.0f) : float4(0.0f, 0.0f, 0.0f, 1.0f); + FragColor = false ? 1.0f.xxxx : 0.0f.xxxx; + FragColor = float4(bool4(false, true, false, true).x ? float4(1.0f, 1.0f, 0.0f, 1.0f).x : float4(0.0f, 0.0f, 0.0f, 1.0f).x, bool4(false, true, false, true).y ? float4(1.0f, 1.0f, 0.0f, 1.0f).y : float4(0.0f, 0.0f, 0.0f, 1.0f).y, bool4(false, true, false, true).z ? float4(1.0f, 1.0f, 0.0f, 1.0f).z : float4(0.0f, 0.0f, 0.0f, 1.0f).z, bool4(false, true, false, true).w ? float4(1.0f, 1.0f, 0.0f, 1.0f).w : float4(0.0f, 0.0f, 0.0f, 1.0f).w); + FragColor = float4(bool4(false, true, false, true)); + _15 _38; + spvSelectComposite(_38, false, _25, _26); + _15 _32 = _38; + float _39[2]; + spvSelectComposite(_39, true, _29, _30); + float _33[2] = _39; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag new file mode 100644 index 0000000000..b88ac0dd72 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag @@ -0,0 +1,42 @@ +struct Foo +{ + row_major float3x3 m[2]; + float v; +}; + +struct Bar +{ + row_major float3x3 m; + float v; +}; + +cbuffer FooUBO : register(b0) +{ + Foo _6_foo : packoffset(c0); +}; + +cbuffer BarUBO : register(b1) +{ + Bar _9_bar : packoffset(c0); +}; + + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (_6_foo.v + _9_bar.v).xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag new file mode 100644 index 0000000000..b98e681f6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag @@ -0,0 +1,30 @@ +static int index; +static uint FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + uint FragColor : SV_Target0; +}; + +void frag_main() +{ + uint _17 = uint(index); + FragColor = uint(WaveActiveMin(index)); + FragColor = uint(WaveActiveMax(int(_17))); + FragColor = WaveActiveMin(uint(index)); + FragColor = WaveActiveMax(_17); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + index = stage_input.index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..19af59d3bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,82 @@ +static int vIndex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIndex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int i = 0; + int j; + int _30; + int _31; + switch (vIndex) + { + case 0: + { + _30 = 3; + j = _30; + _31 = 0; + j = _31; + break; + } + default: + { + _30 = 2; + j = _30; + _31 = 0; + j = _31; + break; + } + case 1: + case 11: + { + _31 = 1; + j = _31; + break; + } + case 2: + { + break; + } + case 3: + { + if (vIndex > 3) + { + i = 0; + break; + } + else + { + break; + } + } + case 4: + { + i = 0; + break; + } + case 5: + { + i = 0; + break; + } + } + FragColor = float(i).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag new file mode 100644 index 0000000000..021333cc74 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag @@ -0,0 +1,52 @@ +static float4 A; +static float4 B; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 A : TEXCOORD0; + float4 B : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 test_vector() +{ + bool4 le = bool4(!(A.x >= B.x), !(A.y >= B.y), !(A.z >= B.z), !(A.w >= B.w)); + bool4 leq = bool4(!(A.x > B.x), !(A.y > B.y), !(A.z > B.z), !(A.w > B.w)); + bool4 ge = bool4(!(A.x <= B.x), !(A.y <= B.y), !(A.z <= B.z), !(A.w <= B.w)); + bool4 geq = bool4(!(A.x < B.x), !(A.y < B.y), !(A.z < B.z), !(A.w < B.w)); + bool4 eq = bool4(A.x == B.x, A.y == B.y, A.z == B.z, A.w == B.w); + bool4 neq = bool4(A.x != B.x, A.y != B.y, A.z != B.z, A.w != B.w); + neq = bool4(A.x != B.x, A.y != B.y, A.z != B.z, A.w != B.w); + return ((((float4(le) + float4(leq)) + float4(ge)) + float4(geq)) + float4(eq)) + float4(neq); +} + +float test_scalar() +{ + bool le = !(A.x >= B.x); + bool leq = !(A.x > B.x); + bool ge = !(A.x <= B.x); + bool geq = !(A.x < B.x); + bool eq = A.x == B.x; + bool neq = A.x != B.x; + return ((((float(le) + float(leq)) + float(ge)) + float(geq)) + float(eq)) + float(neq); +} + +void frag_main() +{ + FragColor = test_vector() + test_scalar().xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + A = stage_input.A; + B = stage_input.B; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag new file mode 100644 index 0000000000..0172c20bb9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag @@ -0,0 +1,52 @@ +static float4 A; +static float4 B; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 A : TEXCOORD0; + float4 B : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 test_vector() +{ + bool4 le = bool4(A.x < B.x, A.y < B.y, A.z < B.z, A.w < B.w); + bool4 leq = bool4(A.x <= B.x, A.y <= B.y, A.z <= B.z, A.w <= B.w); + bool4 ge = bool4(A.x > B.x, A.y > B.y, A.z > B.z, A.w > B.w); + bool4 geq = bool4(A.x >= B.x, A.y >= B.y, A.z >= B.z, A.w >= B.w); + bool4 eq = bool4(A.x == B.x, A.y == B.y, A.z == B.z, A.w == B.w); + bool4 neq = bool4(A.x != B.x, A.y != B.y, A.z != B.z, A.w != B.w); + neq = bool4(A.x != B.x, A.y != B.y, A.z != B.z, A.w != B.w); + return ((((float4(le) + float4(leq)) + float4(ge)) + float4(geq)) + float4(eq)) + float4(neq); +} + +float test_scalar() +{ + bool le = A.x < B.x; + bool leq = A.x <= B.x; + bool ge = A.x > B.x; + bool geq = A.x >= B.x; + bool eq = A.x == B.x; + bool neq = A.x != B.x; + return ((((float(le) + float(leq)) + float(ge)) + float(geq)) + float(eq)) + float(neq); +} + +void frag_main() +{ + FragColor = test_vector() + test_scalar().xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + A = stage_input.A; + B = stage_input.B; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag new file mode 100644 index 0000000000..a73ce6418d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag @@ -0,0 +1,26 @@ +cbuffer type_Test : register(b0) +{ + float3 Test_V0_xyz_ : packoffset(c0); + float2 Test_V1_zw : packoffset(c1.z); +}; + + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = float4(Test_V0_xyz_, Test_V1_zw.x); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..95a48835d5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,28 @@ +static float4 undef; + +static float4 FragColor; +static float4 vFloat; + +struct SPIRV_Cross_Input +{ + float4 vFloat : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(undef.x, vFloat.y, 0.0f, vFloat.w) + float4(vFloat.z, vFloat.y, 0.0f, vFloat.w); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vFloat = stage_input.vFloat; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh new file mode 100644 index 0000000000..8fbd2915ae --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh @@ -0,0 +1,63 @@ +struct _12 +{ + float _m0; +}; + +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +struct gl_MeshPerVertexEXT +{ + float4 B : TEXCOORD1; + float4 gl_Position : SV_Position; +}; + +struct gl_MeshPerPrimitiveEXT +{ + float4 C : TEXCOORD3; + uint gl_PrimitiveID : SV_PrimitiveID; + uint gl_Layer : SV_RenderTargetArrayIndex; + bool gl_CullPrimitiveEXT : SV_CullPrimitive; +}; + +groupshared float _9[64]; + +void mesh_main(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], _12 _11, inout uint3 gl_PrimitiveTriangleIndicesEXT[8], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[8]) +{ + _9[gl_LocalInvocationIndex] = float(gl_LocalInvocationIndex); + GroupMemoryBarrierWithGroupSync(); + SetMeshOutputCounts(24u, 8u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.x = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.y = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.z = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.w = _9[gl_LocalInvocationIndex]; + float _63 = _11._m0 + _9[gl_LocalInvocationIndex ^ 1u]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].B.x = _63; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].B.y = _63; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].B.z = _63; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].B.w = _63; + if (gl_LocalInvocationIndex < 8u) + { + uint _71 = gl_LocalInvocationIndex * 3u; + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uint3(_71, _71 + 1u, _71 + 2u); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_LocalInvocationIndex & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_LocalInvocationIndex); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_LocalInvocationIndex); + uint _81 = gl_LocalInvocationIndex ^ 2u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].C.x = _9[_81]; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].C.y = _9[_81]; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].C.z = _9[_81]; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].C.w = _9[_81]; + } +} + +[outputtopology("triangle")] +[numthreads(2, 3, 4)] +void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], in payload _12 _11, out indices uint3 gl_PrimitiveTriangleIndicesEXT[8], out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[8]) +{ + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + mesh_main(gl_MeshVerticesEXT, _11, gl_PrimitiveTriangleIndicesEXT, gl_MeshPrimitivesEXT); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..dbdd784529 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,44 @@ +static float4 FragColor; +static int vA; +static int vB; + +struct SPIRV_Cross_Input +{ + nointerpolation int vA : TEXCOORD0; + nointerpolation int vB : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 0.0f.xxxx; + int _10 = 0; + int _15 = 0; + for (int _16 = 0, _17 = 0; _16 < vA; _17 = _15, _16 += _10) + { + if ((vA + _16) == 20) + { + _15 = 50; + } + else + { + _15 = ((vB + _16) == 40) ? 60 : _17; + } + _10 = _15 + 10; + FragColor += 1.0f.xxxx; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..72a86d2d44 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,38 @@ +struct Vert +{ + float a; + float b; +}; + +struct Foo +{ + float c; + float d; +}; + +static const Vert _11 = { 0.0f, 0.0f }; +static const Foo _13 = { 0.0f, 0.0f }; + +static Vert _3 = { 0.0f, 0.0f }; +static Foo foo = _13; + +struct SPIRV_Cross_Output +{ + float Vert_a : TEXCOORD0; + float Vert_b : TEXCOORD1; + Foo foo : TEXCOORD2; +}; + +void vert_main() +{ +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.Vert_a = _3.a; + stage_output.Vert_b = _3.b; + stage_output.foo = foo; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..ee30c1783e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,28 @@ +static const float _23[1] = { 0.0f }; +static const float _24[1] = { 0.0f }; + +static float4 gl_Position = 0.0f.xxxx; +static float gl_PointSize = 0.0f; +static float gl_ClipDistance[1] = _23; +static float gl_CullDistance[1] = _24; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; + float gl_ClipDistance0 : SV_ClipDistance0; + float gl_CullDistance0 : SV_CullDistance0; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.gl_ClipDistance0.x = gl_ClipDistance[0]; + stage_output.gl_CullDistance0.x = gl_CullDistance[0]; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert new file mode 100644 index 0000000000..4846e3f5c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert @@ -0,0 +1,56 @@ +struct Struct_vec4 +{ + float4 m0; +}; + +struct VertexOut +{ + Struct_vec4 m0; + Struct_vec4 m1; +}; + +cbuffer UBO : register(b0) +{ + Struct_vec4 ubo_binding_0_m0 : packoffset(c0); + Struct_vec4 ubo_binding_0_m1 : packoffset(c1); +}; + + +static float4 gl_Position; +static VertexOut output_location_0; +static Struct_vec4 output_location_2; +static Struct_vec4 output_location_3; + +struct SPIRV_Cross_Output +{ + Struct_vec4 VertexOut_m0 : TEXCOORD0; + Struct_vec4 VertexOut_m1 : TEXCOORD1; + Struct_vec4 output_location_2 : TEXCOORD2; + Struct_vec4 output_location_3 : TEXCOORD3; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + Struct_vec4 c; + c.m0 = ubo_binding_0_m0.m0; + Struct_vec4 b; + b.m0 = ubo_binding_0_m1.m0; + gl_Position = c.m0 + b.m0; + output_location_0.m0 = c; + output_location_0.m1 = b; + output_location_2 = c; + output_location_3 = b; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.VertexOut_m0 = output_location_0.m0; + stage_output.VertexOut_m1 = output_location_0.m1; + stage_output.output_location_2 = output_location_2; + stage_output.output_location_3 = output_location_3; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..ba1f576748 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,15 @@ +struct Test +{ + int empty_struct_member; +}; + +void vert_main() +{ + Test _14 = { 0 }; + Test t = _14; +} + +void main() +{ + vert_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..be287c4174 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp @@ -0,0 +1,113 @@ +uint spvBitfieldInsert(uint Base, uint Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint2 spvBitfieldInsert(uint2 Base, uint2 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint3 spvBitfieldInsert(uint3 Base, uint3 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint4 spvBitfieldInsert(uint4 Base, uint4 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint spvBitfieldUExtract(uint Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint2 spvBitfieldUExtract(uint2 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint3 spvBitfieldUExtract(uint3 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint4 spvBitfieldUExtract(uint4 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +int spvBitfieldSExtract(int Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int2 spvBitfieldSExtract(int2 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int2 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int3 spvBitfieldSExtract(int3 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int3 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int4 spvBitfieldSExtract(int4 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int4 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +void comp_main() +{ + int signed_value = 0; + uint unsigned_value = 0u; + int3 signed_values = int3(0, 0, 0); + uint3 unsigned_values = uint3(0u, 0u, 0u); + int s = spvBitfieldSExtract(signed_value, 5, 20); + uint u = spvBitfieldUExtract(unsigned_value, 6, 21); + s = int(spvBitfieldInsert(s, 40, 5, 4)); + u = spvBitfieldInsert(u, 60u, 5, 4); + u = reversebits(u); + s = reversebits(s); + int v0 = int(countbits(u)); + int v1 = countbits(s); + int v2 = int(firstbithigh(u)); + int v3 = firstbitlow(s); + int3 s_1 = spvBitfieldSExtract(signed_values, 5, 20); + uint3 u_1 = spvBitfieldUExtract(unsigned_values, 6, 21); + s_1 = int3(spvBitfieldInsert(s_1, int3(40, 40, 40), 5, 4)); + u_1 = spvBitfieldInsert(u_1, uint3(60u, 60u, 60u), 5, 4); + u_1 = reversebits(u_1); + s_1 = reversebits(s_1); + int3 v0_1 = int3(countbits(u_1)); + int3 v1_1 = countbits(s_1); + int3 v2_1 = int3(firstbithigh(u_1)); + int3 v3_1 = firstbitlow(s_1); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp new file mode 100644 index 0000000000..7936bf94d0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp @@ -0,0 +1,297 @@ +struct ResType +{ + float _m0; + int _m1; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _19 : register(u0); + +uint spvPackHalf2x16(float2 value) +{ + uint2 Packed = f32tof16(value); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackHalf2x16(uint value) +{ + return f16tof32(uint2(value & 0xffff, value >> 16)); +} + +uint spvPackUnorm4x8(float4 value) +{ + uint4 Packed = uint4(round(saturate(value) * 255.0)); + return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24); +} + +float4 spvUnpackUnorm4x8(uint value) +{ + uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24); + return float4(Packed) / 255.0; +} + +uint spvPackSnorm4x8(float4 value) +{ + int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff; + return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24)); +} + +float4 spvUnpackSnorm4x8(uint value) +{ + int SignedValue = int(value); + int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24; + return clamp(float4(Packed) / 127.0, -1.0, 1.0); +} + +uint spvPackUnorm2x16(float2 value) +{ + uint2 Packed = uint2(round(saturate(value) * 65535.0)); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackUnorm2x16(uint value) +{ + uint2 Packed = uint2(value & 0xffff, value >> 16); + return float2(Packed) / 65535.0; +} + +uint spvPackSnorm2x16(float2 value) +{ + int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff; + return uint(Packed.x | (Packed.y << 16)); +} + +float2 spvUnpackSnorm2x16(uint value) +{ + int SignedValue = int(value); + int2 Packed = int2(SignedValue << 16, SignedValue) >> 16; + return clamp(float2(Packed) / 32767.0, -1.0, 1.0); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float2x2 spvInverse(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 2x2 matrix. +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float3x3 spvInverse(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 3x3 matrix. +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float4x4 spvInverse(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +float spvReflect(float i, float n) +{ + return i - 2.0 * dot(n, i) * n; +} + +float spvRefract(float i, float n, float eta) +{ + float NoI = n * i; + float NoI2 = NoI * NoI; + float k = 1.0 - eta * eta * (1.0 - NoI2); + if (k < 0.0) + { + return 0.0; + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +float spvFaceForward(float n, float i, float nref) +{ + return i * nref < 0.0 ? n : -n; +} + +void comp_main() +{ + _19.Store(0, asuint(round(asfloat(_19.Load(16))))); + _19.Store(0, asuint(trunc(asfloat(_19.Load(16))))); + _19.Store(0, asuint(abs(asfloat(_19.Load(16))))); + _19.Store(4, uint(abs(int(_19.Load(32))))); + _19.Store(0, asuint(sign(asfloat(_19.Load(16))))); + _19.Store(4, uint(sign(int(_19.Load(32))))); + _19.Store(0, asuint(floor(asfloat(_19.Load(16))))); + _19.Store(0, asuint(ceil(asfloat(_19.Load(16))))); + _19.Store(0, asuint(frac(asfloat(_19.Load(16))))); + _19.Store(0, asuint(radians(asfloat(_19.Load(16))))); + _19.Store(0, asuint(degrees(asfloat(_19.Load(16))))); + _19.Store(0, asuint(sin(asfloat(_19.Load(16))))); + _19.Store(0, asuint(cos(asfloat(_19.Load(16))))); + _19.Store(0, asuint(tan(asfloat(_19.Load(16))))); + _19.Store(0, asuint(asin(asfloat(_19.Load(16))))); + _19.Store(0, asuint(acos(asfloat(_19.Load(16))))); + _19.Store(0, asuint(atan(asfloat(_19.Load(16))))); + _19.Store(0, asuint(sinh(asfloat(_19.Load(16))))); + _19.Store(0, asuint(cosh(asfloat(_19.Load(16))))); + _19.Store(0, asuint(tanh(asfloat(_19.Load(16))))); + _19.Store(0, asuint(atan2(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(0, asuint(pow(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(0, asuint(exp(asfloat(_19.Load(16))))); + _19.Store(0, asuint(log(asfloat(_19.Load(16))))); + _19.Store(0, asuint(exp2(asfloat(_19.Load(16))))); + _19.Store(0, asuint(log2(asfloat(_19.Load(16))))); + _19.Store(0, asuint(sqrt(asfloat(_19.Load(16))))); + _19.Store(0, asuint(rsqrt(asfloat(_19.Load(16))))); + _19.Store(0, asuint(length(asfloat(_19.Load(16))))); + _19.Store(0, asuint(distance(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(0, asuint(sign(asfloat(_19.Load(16))))); + _19.Store(0, asuint(spvFaceForward(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + _19.Store(0, asuint(spvReflect(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(0, asuint(spvRefract(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + _19.Store(0, asuint(length(asfloat(_19.Load4(16)).xy))); + _19.Store(0, asuint(distance(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).zw))); + float2 v2 = normalize(asfloat(_19.Load4(16)).xy); + v2 = faceforward(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).yz, asfloat(_19.Load4(16)).zw); + v2 = reflect(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).zw); + v2 = refract(asfloat(_19.Load4(16)).xy, asfloat(_19.Load4(16)).yz, asfloat(_19.Load(28))); + float3 v3 = cross(asfloat(_19.Load4(16)).xyz, asfloat(_19.Load4(16)).yzw); + float2x2 _240 = asfloat(uint2x2(_19.Load2(64), _19.Load2(72))); + _19.Store(0, asuint(determinant(_240))); + float3x3 _246 = asfloat(uint3x3(_19.Load3(80), _19.Load3(96), _19.Load3(112))); + _19.Store(0, asuint(determinant(_246))); + float4x4 _252 = asfloat(uint4x4(_19.Load4(128), _19.Load4(144), _19.Load4(160), _19.Load4(176))); + _19.Store(0, asuint(determinant(_252))); + float2x2 _256 = asfloat(uint2x2(_19.Load2(64), _19.Load2(72))); + float2x2 _257 = spvInverse(_256); + _19.Store2(64, asuint(_257[0])); + _19.Store2(72, asuint(_257[1])); + float3x3 _260 = asfloat(uint3x3(_19.Load3(80), _19.Load3(96), _19.Load3(112))); + float3x3 _261 = spvInverse(_260); + _19.Store3(80, asuint(_261[0])); + _19.Store3(96, asuint(_261[1])); + _19.Store3(112, asuint(_261[2])); + float4x4 _264 = asfloat(uint4x4(_19.Load4(128), _19.Load4(144), _19.Load4(160), _19.Load4(176))); + float4x4 _265 = spvInverse(_264); + _19.Store4(128, asuint(_265[0])); + _19.Store4(144, asuint(_265[1])); + _19.Store4(160, asuint(_265[2])); + _19.Store4(176, asuint(_265[3])); + float tmp; + float _271 = modf(asfloat(_19.Load(16)), tmp); + _19.Store(0, asuint(_271)); + _19.Store(0, asuint(min(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(8, min(_19.Load(48), _19.Load(52))); + _19.Store(4, uint(min(int(_19.Load(32)), int(_19.Load(36))))); + _19.Store(0, asuint(max(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(8, max(_19.Load(48), _19.Load(52))); + _19.Store(4, uint(max(int(_19.Load(32)), int(_19.Load(36))))); + _19.Store(0, asuint(clamp(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + _19.Store(8, clamp(_19.Load(48), _19.Load(52), _19.Load(56))); + _19.Store(4, uint(clamp(int(_19.Load(32)), int(_19.Load(36)), int(_19.Load(40))))); + _19.Store(0, asuint(lerp(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + _19.Store(0, asuint(step(asfloat(_19.Load(16)), asfloat(_19.Load(20))))); + _19.Store(0, asuint(smoothstep(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + _19.Store(0, asuint(mad(asfloat(_19.Load(16)), asfloat(_19.Load(20)), asfloat(_19.Load(24))))); + ResType _371; + _371._m0 = frexp(asfloat(_19.Load(16)), _371._m1); + int itmp = _371._m1; + _19.Store(0, asuint(_371._m0)); + _19.Store(0, asuint(ldexp(asfloat(_19.Load(16)), itmp))); + _19.Store(8, spvPackSnorm4x8(asfloat(_19.Load4(16)))); + _19.Store(8, spvPackUnorm4x8(asfloat(_19.Load4(16)))); + _19.Store(8, spvPackSnorm2x16(asfloat(_19.Load4(16)).xy)); + _19.Store(8, spvPackUnorm2x16(asfloat(_19.Load4(16)).xy)); + _19.Store(8, spvPackHalf2x16(asfloat(_19.Load4(16)).xy)); + v2 = spvUnpackSnorm2x16(_19.Load(48)); + v2 = spvUnpackUnorm2x16(_19.Load(48)); + v2 = spvUnpackHalf2x16(_19.Load(48)); + float4 v4 = spvUnpackSnorm4x8(_19.Load(48)); + v4 = spvUnpackUnorm4x8(_19.Load(48)); + _19.Store4(32, uint4(firstbitlow(int4(_19.Load4(32))))); + _19.Store4(32, uint4(int4(firstbitlow(_19.Load4(48))))); + _19.Store4(32, uint4(firstbithigh(int4(_19.Load4(32))))); + _19.Store4(32, uint4(int4(firstbithigh(_19.Load4(48))))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..dc972bdda8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,22 @@ +struct Foo +{ + float _abs; +}; + +RWByteAddressBuffer _7 : register(u0); + +void comp_main() +{ + Foo _24; + _24._abs = asfloat(_7.Load(0)); + Foo f; + f._abs = _24._abs; + int _abs = 10; + _7.Store(4, asuint(f._abs)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..9faa7fba7b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/intmin-literal.comp @@ -0,0 +1,19 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _9 : register(u1); +cbuffer UBO : register(b0) +{ + float _14_b : packoffset(c0); +}; + + +void comp_main() +{ + _9.Store(0, asuint(asfloat(asint(_14_b) ^ int(0x80000000)))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp new file mode 100644 index 0000000000..ae7ce70c5e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp @@ -0,0 +1,28 @@ +static const uint3 gl_WorkGroupSize = uint3(30u, 1u, 1u); + +RWByteAddressBuffer _46 : register(u0, space0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + bool v = gl_GlobalInvocationID.x != 3u; + bool4 v4; + v4.x = bool(WaveActiveBitOr(uint(v))); + v4.y = bool(WaveActiveBitAnd(uint(v))); + v4.z = bool(WaveActiveBitXor(uint(v))); + v4.w = WaveActiveAllEqual(v); + uint4 w = uint4(v4); + _46.Store(gl_GlobalInvocationID.x * 4 + 0, ((w.x + w.y) + w.z) + w.w); +} + +[numthreads(30, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp new file mode 100644 index 0000000000..4c11a4b136 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp @@ -0,0 +1,104 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _9 : register(u0, space0); + +static uint4 gl_SubgroupEqMask; +static uint4 gl_SubgroupGeMask; +static uint4 gl_SubgroupGtMask; +static uint4 gl_SubgroupLeMask; +static uint4 gl_SubgroupLtMask; +void comp_main() +{ + _9.Store(0, asuint(float(WaveGetLaneCount()))); + _9.Store(0, asuint(float(WaveGetLaneIndex()))); + bool elected = WaveIsFirstLane(); + _9.Store(0, asuint(float4(gl_SubgroupEqMask).x)); + _9.Store(0, asuint(float4(gl_SubgroupGeMask).x)); + _9.Store(0, asuint(float4(gl_SubgroupGtMask).x)); + _9.Store(0, asuint(float4(gl_SubgroupLeMask).x)); + _9.Store(0, asuint(float4(gl_SubgroupLtMask).x)); + float4 broadcasted = WaveReadLaneAt(10.0f.xxxx, 8u); + float3 first = WaveReadLaneFirst(20.0f.xxx); + uint4 ballot_value = WaveActiveBallot(true); + uint bit_count = countbits(ballot_value.x) + countbits(ballot_value.y) + countbits(ballot_value.z) + countbits(ballot_value.w); + uint inclusive_bit_count = countbits(ballot_value.x & gl_SubgroupLeMask.x) + countbits(ballot_value.y & gl_SubgroupLeMask.y) + countbits(ballot_value.z & gl_SubgroupLeMask.z) + countbits(ballot_value.w & gl_SubgroupLeMask.w); + uint exclusive_bit_count = countbits(ballot_value.x & gl_SubgroupLtMask.x) + countbits(ballot_value.y & gl_SubgroupLtMask.y) + countbits(ballot_value.z & gl_SubgroupLtMask.z) + countbits(ballot_value.w & gl_SubgroupLtMask.w); + uint shuffled = WaveReadLaneAt(10u, 8u); + uint shuffled_xor = WaveReadLaneAt(30u, WaveGetLaneIndex() ^ 8u); + uint shuffled_up = WaveReadLaneAt(20u, WaveGetLaneIndex() - 4u); + uint shuffled_down = WaveReadLaneAt(20u, WaveGetLaneIndex() + 4u); + bool has_all = WaveActiveAllTrue(true); + bool has_any = WaveActiveAnyTrue(true); + bool has_equal = WaveActiveAllEqual(true); + float4 added = WaveActiveSum(20.0f.xxxx); + int4 iadded = WaveActiveSum(int4(20, 20, 20, 20)); + float4 multiplied = WaveActiveProduct(20.0f.xxxx); + int4 imultiplied = WaveActiveProduct(int4(20, 20, 20, 20)); + float4 lo = WaveActiveMin(20.0f.xxxx); + float4 hi = WaveActiveMax(20.0f.xxxx); + int4 slo = WaveActiveMin(int4(20, 20, 20, 20)); + int4 shi = WaveActiveMax(int4(20, 20, 20, 20)); + uint4 ulo = WaveActiveMin(uint4(20u, 20u, 20u, 20u)); + uint4 uhi = WaveActiveMax(uint4(20u, 20u, 20u, 20u)); + uint4 anded = WaveActiveBitAnd(ballot_value); + uint4 ored = WaveActiveBitOr(ballot_value); + uint4 xored = WaveActiveBitXor(ballot_value); + bool4 anded_b = bool4(WaveActiveBitAnd(uint4(bool4(ballot_value.x == uint4(42u, 42u, 42u, 42u).x, ballot_value.y == uint4(42u, 42u, 42u, 42u).y, ballot_value.z == uint4(42u, 42u, 42u, 42u).z, ballot_value.w == uint4(42u, 42u, 42u, 42u).w)))); + bool4 ored_b = bool4(WaveActiveBitOr(uint4(bool4(ballot_value.x == uint4(42u, 42u, 42u, 42u).x, ballot_value.y == uint4(42u, 42u, 42u, 42u).y, ballot_value.z == uint4(42u, 42u, 42u, 42u).z, ballot_value.w == uint4(42u, 42u, 42u, 42u).w)))); + bool4 xored_b = bool4(WaveActiveBitXor(uint4(bool4(ballot_value.x == uint4(42u, 42u, 42u, 42u).x, ballot_value.y == uint4(42u, 42u, 42u, 42u).y, ballot_value.z == uint4(42u, 42u, 42u, 42u).z, ballot_value.w == uint4(42u, 42u, 42u, 42u).w)))); + added = WavePrefixSum(added) + added; + iadded = WavePrefixSum(iadded) + iadded; + multiplied = WavePrefixProduct(multiplied) * multiplied; + imultiplied = WavePrefixProduct(imultiplied) * imultiplied; + added = WavePrefixSum(multiplied); + multiplied = WavePrefixProduct(multiplied); + iadded = WavePrefixSum(imultiplied); + imultiplied = WavePrefixProduct(imultiplied); + float4 swap_horiz = QuadReadAcrossX(20.0f.xxxx); + float4 swap_vertical = QuadReadAcrossY(20.0f.xxxx); + float4 swap_diagonal = QuadReadAcrossDiagonal(20.0f.xxxx); + float4 quad_broadcast = QuadReadLaneAt(20.0f.xxxx, 3u); +} + +[numthreads(1, 1, 1)] +void main() +{ + gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96)); + if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0; + if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0; + if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0; + if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0; + gl_SubgroupGeMask = ~((1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u); + if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u; + if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u; + if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u; + if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u; + if (WaveGetLaneIndex() < 64) gl_SubgroupGeMask.z = ~0u; + if (WaveGetLaneIndex() < 96) gl_SubgroupGeMask.w = ~0u; + uint gt_lane_index = WaveGetLaneIndex() + 1; + gl_SubgroupGtMask = ~((1u << (gt_lane_index - uint4(0, 32, 64, 96))) - 1u); + if (gt_lane_index >= 32) gl_SubgroupGtMask.x = 0u; + if (gt_lane_index >= 64) gl_SubgroupGtMask.y = 0u; + if (gt_lane_index >= 96) gl_SubgroupGtMask.z = 0u; + if (gt_lane_index >= 128) gl_SubgroupGtMask.w = 0u; + if (gt_lane_index < 32) gl_SubgroupGtMask.y = ~0u; + if (gt_lane_index < 64) gl_SubgroupGtMask.z = ~0u; + if (gt_lane_index < 96) gl_SubgroupGtMask.w = ~0u; + uint le_lane_index = WaveGetLaneIndex() + 1; + gl_SubgroupLeMask = (1u << (le_lane_index - uint4(0, 32, 64, 96))) - 1u; + if (le_lane_index >= 32) gl_SubgroupLeMask.x = ~0u; + if (le_lane_index >= 64) gl_SubgroupLeMask.y = ~0u; + if (le_lane_index >= 96) gl_SubgroupLeMask.z = ~0u; + if (le_lane_index >= 128) gl_SubgroupLeMask.w = ~0u; + if (le_lane_index < 32) gl_SubgroupLeMask.y = 0u; + if (le_lane_index < 64) gl_SubgroupLeMask.z = 0u; + if (le_lane_index < 96) gl_SubgroupLeMask.w = 0u; + gl_SubgroupLtMask = (1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u; + if (WaveGetLaneIndex() >= 32) gl_SubgroupLtMask.x = ~0u; + if (WaveGetLaneIndex() >= 64) gl_SubgroupLtMask.y = ~0u; + if (WaveGetLaneIndex() >= 96) gl_SubgroupLtMask.z = ~0u; + if (WaveGetLaneIndex() < 32) gl_SubgroupLtMask.y = 0u; + if (WaveGetLaneIndex() < 64) gl_SubgroupLtMask.z = 0u; + if (WaveGetLaneIndex() < 96) gl_SubgroupLtMask.w = 0u; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..94aec45576 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,15 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _14 : register(u0); + +void comp_main() +{ + bool3 c = bool3(asfloat(_14.Load3(16)).x < 1.0f.xxx.x, asfloat(_14.Load3(16)).y < 1.0f.xxx.y, asfloat(_14.Load3(16)).z < 1.0f.xxx.z); + _14.Store3(0, asuint(float3(c.x ? float3(0.0f, 0.0f, 1.0f).x : float3(1.0f, 0.0f, 0.0f).x, c.y ? float3(0.0f, 0.0f, 1.0f).y : float3(1.0f, 0.0f, 0.0f).y, c.z ? float3(0.0f, 0.0f, 1.0f).z : float3(1.0f, 0.0f, 0.0f).z))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..7bd1c76169 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,22 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _14 : register(u0); + +void comp_main() +{ + bool c = asfloat(_14.Load(48)) < 1.0f; + float3x3 _29 = c ? float3x3(1.0f.xxx, 1.0f.xxx, 1.0f.xxx) : float3x3(0.0f.xxx, 0.0f.xxx, 0.0f.xxx); + _14.Store3(0, asuint(_29[0])); + _14.Store3(16, asuint(_29[1])); + _14.Store3(32, asuint(_29[2])); + float3x3 _37 = c ? float3x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f)) : float3x3(0.0f.xxx, 0.0f.xxx, 0.0f.xxx); + _14.Store3(0, asuint(_37[0])); + _14.Store3(16, asuint(_37[1])); + _14.Store3(32, asuint(_37[2])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag new file mode 100644 index 0000000000..2b8ec8119a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag @@ -0,0 +1,56 @@ +cbuffer UBO : register(b0) +{ + float4 _18_a[2] : packoffset(c0); + float4 _18_b : packoffset(c2); + float4 _18_c : packoffset(c3); + row_major float4x4 _18_d : packoffset(c4); + float _18_e : packoffset(c8); + float2 _18_f : packoffset(c8.z); + float _18_g : packoffset(c9); + float2 _18_h : packoffset(c9.z); + float _18_i : packoffset(c10); + float2 _18_j : packoffset(c10.z); + float _18_k : packoffset(c11); + float2 _18_l : packoffset(c11.z); + float _18_m : packoffset(c12); + float _18_n : packoffset(c12.y); + float _18_o : packoffset(c12.z); + float4 _18_p : packoffset(c13); + float4 _18_q : packoffset(c14); + float3 _18_r : packoffset(c15); + float4 _18_s : packoffset(c16); + float4 _18_t : packoffset(c17); + float4 _18_u : packoffset(c18); + float _18_v : packoffset(c19); + float _18_w : packoffset(c19.y); + float _18_x : packoffset(c19.z); + float _18_y : packoffset(c19.w); + float _18_z : packoffset(c20); + float _18_aa : packoffset(c20.y); + float _18_ab : packoffset(c20.z); + float _18_ac : packoffset(c20.w); + float _18_ad : packoffset(c21); + float _18_ae : packoffset(c21.y); + float4 _18_ef : packoffset(c22); +}; + + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _18_a[1]; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag new file mode 100644 index 0000000000..d330706c7b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag @@ -0,0 +1,44 @@ +struct CBO_1 +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +ConstantBuffer cbo[2][4] : register(b4, space0); +cbuffer PushMe +{ + float4 push_a : packoffset(c0); + float4 push_b : packoffset(c1); + float4 push_c : packoffset(c2); + float4 push_d : packoffset(c3); +}; + + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = cbo[1][2].a; + FragColor += cbo[1][2].b; + FragColor += cbo[1][2].c; + FragColor += cbo[1][2].d; + FragColor += push_a; + FragColor += push_b; + FragColor += push_c; + FragColor += push_d; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag new file mode 100644 index 0000000000..f0ed32f342 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag @@ -0,0 +1,179 @@ +static min16float4 v4; +static min16float3 v3; +static min16float v1; +static min16float2 v2; +static float o1; +static float2 o2; +static float3 o3; +static float4 o4; + +struct SPIRV_Cross_Input +{ + min16float v1 : TEXCOORD0; + min16float2 v2 : TEXCOORD1; + min16float3 v3 : TEXCOORD2; + min16float4 v4 : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float o1 : SV_Target0; + float2 o2 : SV_Target1; + float3 o3 : SV_Target2; + float4 o4 : SV_Target3; +}; + +float mod(float x, float y) +{ + return x - y * floor(x / y); +} + +float2 mod(float2 x, float2 y) +{ + return x - y * floor(x / y); +} + +float3 mod(float3 x, float3 y) +{ + return x - y * floor(x / y); +} + +float4 mod(float4 x, float4 y) +{ + return x - y * floor(x / y); +} + +uint spvPackFloat2x16(min16float2 value) +{ + uint2 Packed = f32tof16(value); + return Packed.x | (Packed.y << 16); +} + +min16float2 spvUnpackFloat2x16(uint value) +{ + return min16float2(f16tof32(uint2(value & 0xffff, value >> 16))); +} + +void test_constants() +{ + min16float a = min16float(1.0); + min16float b = min16float(1.5); + min16float c = min16float(-1.5); + min16float d = min16float(0.0 / 0.0); + min16float e = min16float(1.0 / 0.0); + min16float f = min16float(-1.0 / 0.0); + min16float g = min16float(1014.0); + min16float h = min16float(9.5367431640625e-07); +} + +min16float test_result() +{ + return min16float(1.0); +} + +void test_conversions() +{ + min16float one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = one != min16float(0.0); + float d = float(one); + double e = double(one); + min16float a2 = min16float(a); + min16float b2 = min16float(b); + min16float c2 = min16float(c); + min16float d2 = min16float(d); + min16float e2 = min16float(e); +} + +void test_builtins() +{ + min16float4 res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = atan2(v4, v3.xyzz); + res = atan(v4); + res = sinh(v4); + res = cosh(v4); + res = tanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = rsqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + res = ceil(v4); + res = frac(v4); + res = mod(v4, v4); + min16float4 tmp; + min16float4 _144 = modf(v4, tmp); + res = _144; + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = lerp(v4, v4, v4); + bool4 _164 = bool4(v4.x < v4.x, v4.y < v4.y, v4.z < v4.z, v4.w < v4.w); + res = min16float4(_164.x ? v4.x : v4.x, _164.y ? v4.y : v4.y, _164.z ? v4.z : v4.z, _164.w ? v4.w : v4.w); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + bool4 btmp = isnan(v4); + btmp = isinf(v4); + res = mad(v4, v4, v4); + uint pack0 = spvPackFloat2x16(v4.xy); + uint pack1 = spvPackFloat2x16(v4.zw); + res = min16float4(spvUnpackFloat2x16(pack0), spvUnpackFloat2x16(pack1)); + min16float t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + min16float3 res3 = cross(v3, v3); + res = normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + btmp = bool4(v4.x < v4.x, v4.y < v4.y, v4.z < v4.z, v4.w < v4.w); + btmp = bool4(v4.x <= v4.x, v4.y <= v4.y, v4.z <= v4.z, v4.w <= v4.w); + btmp = bool4(v4.x > v4.x, v4.y > v4.y, v4.z > v4.z, v4.w > v4.w); + btmp = bool4(v4.x >= v4.x, v4.y >= v4.y, v4.z >= v4.z, v4.w >= v4.w); + btmp = bool4(v4.x == v4.x, v4.y == v4.y, v4.z == v4.z, v4.w == v4.w); + btmp = bool4(v4.x != v4.x, v4.y != v4.y, v4.z != v4.z, v4.w != v4.w); + res = ddx(v4); + res = ddy(v4); + res = ddx_fine(v4); + res = ddy_fine(v4); + res = ddx_coarse(v4); + res = ddy_coarse(v4); + res = fwidth(v4); + res = fwidth(v4); + res = fwidth(v4); +} + +void frag_main() +{ + test_constants(); + test_conversions(); + test_builtins(); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v4 = stage_input.v4; + v3 = stage_input.v3; + v1 = stage_input.v1; + v2 = stage_input.v2; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.o1 = o1; + stage_output.o2 = o2; + stage_output.o3 = o3; + stage_output.o4 = o4; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/frag-coord.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/frag-coord.frag new file mode 100644 index 0000000000..17cb4c4b74 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/frag-coord.frag @@ -0,0 +1,27 @@ +static float4 gl_FragCoord; +static float3 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = gl_FragCoord.xyz / gl_FragCoord.w.xxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag new file mode 100644 index 0000000000..ad61b21ea3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag @@ -0,0 +1,26 @@ +static float FragColor; + +struct SPIRV_Cross_Input +{ +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float(IsHelperLane()); + discard; + bool _16 = IsHelperLane(); + FragColor = float(_16); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag new file mode 100644 index 0000000000..020831d0a0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag @@ -0,0 +1,79 @@ +RWByteAddressBuffer _62 : register(u0, space0); + +static float4 gl_FragCoord; +static half4 Output; +static half4 Input; +static int16_t4 OutputI; +static int16_t4 InputI; +static uint16_t4 OutputU; +static uint16_t4 InputU; + +struct SPIRV_Cross_Input +{ + half4 Input : TEXCOORD0; + nointerpolation int16_t4 InputI : TEXCOORD1; + nointerpolation uint16_t4 InputU : TEXCOORD2; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + half4 Output : SV_Target0; + int16_t4 OutputI : SV_Target1; + uint16_t4 OutputU : SV_Target2; +}; + +void frag_main() +{ + int index = int(gl_FragCoord.x); + Output = Input + half(20.0).xxxx; + OutputI = InputI + int16_t4(int16_t(-40), int16_t(-40), int16_t(-40), int16_t(-40)); + OutputU = InputU + uint16_t4(20u, 20u, 20u, 20u); + Output += _62.Load(index * 2 + 0).xxxx; + OutputI += _62.Load(index * 2 + 8).xxxx; + OutputU += _62.Load(index * 2 + 16).xxxx; + Output += _62.Load(index * 8 + 24); + OutputI += _62.Load(index * 8 + 56); + OutputU += _62.Load(index * 8 + 88); + Output += _62.Load(index * 16 + 128).xyzz; + Output += half3(_62.Load(index * 12 + 186), _62.Load(index * 12 + 190), _62.Load(index * 12 + 194)).xyzz; + half2x3 _128 = half2x3(_62.Load(index * 16 + 120), _62.Load(index * 16 + 128)); + half2x3 m0 = _128; + half2x3 _132 = half2x3(_62.Load(index * 12 + 184), _62.Load(index * 12 + 188), _62.Load(index * 12 + 192), _62.Load(index * 12 + 186), _62.Load(index * 12 + 190), _62.Load(index * 12 + 194)); + half2x3 m1 = _132; + _62.Store(index * 2 + 0, Output.x); + _62.Store(index * 2 + 8, OutputI.y); + _62.Store(index * 2 + 16, OutputU.z); + _62.Store(index * 8 + 24, Output); + _62.Store(index * 8 + 56, OutputI); + _62.Store(index * 8 + 88, OutputU); + _62.Store(index * 16 + 128, Output.xyz); + _62.Store(index * 12 + 186, Output.x); + _62.Store(index * 12 + 190, Output.xyz.y); + _62.Store(index * 12 + 194, Output.xyz.z); + half2x3 _182 = half2x3(half3(Output.xyz), half3(Output.wzy)); + _62.Store(index * 16 + 120, _182[0]); + _62.Store(index * 16 + 128, _182[1]); + half2x3 _197 = half2x3(half3(Output.xyz), half3(Output.wzy)); + _62.Store(index * 12 + 184, _197[0].x); + _62.Store(index * 12 + 186, _197[1].x); + _62.Store(index * 12 + 188, _197[0].y); + _62.Store(index * 12 + 190, _197[1].y); + _62.Store(index * 12 + 192, _197[0].z); + _62.Store(index * 12 + 194, _197[1].z); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + Input = stage_input.Input; + InputI = stage_input.InputI; + InputU = stage_input.InputU; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.Output = Output; + stage_output.OutputI = OutputI; + stage_output.OutputU = OutputU; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag new file mode 100644 index 0000000000..ca9a116fe8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag @@ -0,0 +1,32 @@ +Texture2D uTex[] : register(t0, space0); +SamplerState Immut : register(s0, space1); + +static float4 FragColor; +static int vIndex; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; + nointerpolation int vIndex : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTex[NonUniformResourceIndex(vIndex)].Sample(Immut, vUV); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag new file mode 100644 index 0000000000..aace6f58ba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag @@ -0,0 +1,33 @@ +RasterizerOrderedByteAddressBuffer _14 : register(u1, space0); +RasterizerOrderedByteAddressBuffer _35 : register(u0, space0); + +static float4 gl_FragCoord; +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +void callee2() +{ + int _25 = int(gl_FragCoord.x); + _14.Store(_25 * 4 + 0, _14.Load(_25 * 4 + 0) + 1u); +} + +void callee() +{ + int _38 = int(gl_FragCoord.x); + _35.Store(_38 * 4 + 0, _35.Load(_38 * 4 + 0) + 1u); + callee2(); +} + +void frag_main() +{ + callee(); +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/spec-constant.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/spec-constant.frag new file mode 100644 index 0000000000..89a5f5ca86 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/spec-constant.frag @@ -0,0 +1,142 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1.0f +#endif +static const float a = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2.0f +#endif +static const float b = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +static const int c = SPIRV_CROSS_CONSTANT_ID_3; +static const uint _18 = (uint(c) + 0u); +static const int _21 = (-c); +static const int _23 = (~c); +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 4 +#endif +static const int d = SPIRV_CROSS_CONSTANT_ID_4; +static const int _26 = (c + d); +static const int _28 = (c - d); +static const int _30 = (c * d); +static const int _32 = (c / d); +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 5u +#endif +static const uint e = SPIRV_CROSS_CONSTANT_ID_5; +#ifndef SPIRV_CROSS_CONSTANT_ID_6 +#define SPIRV_CROSS_CONSTANT_ID_6 6u +#endif +static const uint f = SPIRV_CROSS_CONSTANT_ID_6; +static const uint _36 = (e / f); +static const int _38 = (c % d); +static const uint _40 = (e % f); +static const int _42 = (c >> d); +static const uint _44 = (e >> f); +static const int _46 = (c << d); +static const int _48 = (c | d); +static const int _50 = (c ^ d); +static const int _52 = (c & d); +#ifndef SPIRV_CROSS_CONSTANT_ID_7 +#define SPIRV_CROSS_CONSTANT_ID_7 false +#endif +static const bool g = SPIRV_CROSS_CONSTANT_ID_7; +#ifndef SPIRV_CROSS_CONSTANT_ID_8 +#define SPIRV_CROSS_CONSTANT_ID_8 true +#endif +static const bool h = SPIRV_CROSS_CONSTANT_ID_8; +static const bool _58 = (g || h); +static const bool _60 = (g && h); +static const bool _62 = (!g); +static const bool _64 = (g == h); +static const bool _66 = (g != h); +static const bool _68 = (c == d); +static const bool _70 = (c != d); +static const bool _72 = (c < d); +static const bool _74 = (e < f); +static const bool _76 = (c > d); +static const bool _78 = (e > f); +static const bool _80 = (c <= d); +static const bool _82 = (e <= f); +static const bool _84 = (c >= d); +static const bool _86 = (e >= f); +static const int _92 = int(e + 0u); +static const bool _94 = (c != int(0u)); +static const bool _96 = (e != 0u); +static const int _100 = int(g); +static const uint _103 = uint(g); +static const int _111 = (c + 3); +static const int _118 = (c + 2); +static const int _124 = (d + 2); + +struct Foo +{ + float elems[_124]; +}; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float t0 = a; + float t1 = b; + uint c0 = _18; + int c1 = _21; + int c2 = _23; + int c3 = _26; + int c4 = _28; + int c5 = _30; + int c6 = _32; + uint c7 = _36; + int c8 = _38; + uint c9 = _40; + int c10 = _42; + uint c11 = _44; + int c12 = _46; + int c13 = _48; + int c14 = _50; + int c15 = _52; + bool c16 = _58; + bool c17 = _60; + bool c18 = _62; + bool c19 = _64; + bool c20 = _66; + bool c21 = _68; + bool c22 = _70; + bool c23 = _72; + bool c24 = _74; + bool c25 = _76; + bool c26 = _78; + bool c27 = _80; + bool c28 = _82; + bool c29 = _84; + bool c30 = _86; + int c31 = c8 + c3; + int c32 = _92; + bool c33 = _94; + bool c34 = _96; + int c35 = _100; + uint c36 = _103; + float c37 = float(g); + float vec0[_111][8]; + vec0[0][0] = 10.0f; + float vec1[_118]; + vec1[0] = 20.0f; + Foo foo; + foo.elems[c] = 10.0f; + FragColor = (((t0 + t1).xxxx + vec0[0][0].xxxx) + vec1[0].xxxx) + foo.elems[c].xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..a0f078a87c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,29 @@ +Texture2D uSamp : register(t0); +SamplerState _uSamp_sampler : register(s0); + +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uSamp.GatherGreen(_uSamp_sampler, vUV); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag new file mode 100644 index 0000000000..4ea3e0dfbe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag @@ -0,0 +1,33 @@ +cbuffer UBO : register(b0) +{ + row_major float4x4 _13_m : packoffset(c1); + float4 _13_v : packoffset(c0); +}; + + +static float4 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = mul(vColor, _13_m) + _13_v; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..7fe47df036 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,45 @@ +struct Foo +{ + int a; +}; + +static float4 vColor; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +static int uninit_int = 0; +static int4 uninit_vector = int4(0, 0, 0, 0); +static float4x4 uninit_matrix = float4x4(0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx, 0.0f.xxxx); +static Foo uninit_foo = { 0 }; + +void frag_main() +{ + int uninit_function_int = 0; + if (vColor.x > 10.0f) + { + uninit_function_int = 10; + } + else + { + uninit_function_int = 20; + } + FragColor = vColor; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag new file mode 100644 index 0000000000..1311c86345 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag @@ -0,0 +1,29 @@ +static float FragColor; + +struct SPIRV_Cross_Input +{ +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + bool _12 = IsHelperLane(); + float _15 = float(_12); + FragColor = _15; + discard; + bool _16 = IsHelperLane(); + float _17 = float(_16); + FragColor = _17; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-instance.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-instance.vert new file mode 100644 index 0000000000..de31f2c6c0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-instance.vert @@ -0,0 +1,30 @@ +static float4 gl_Position; +static int gl_BaseInstanceARB; +cbuffer SPIRV_Cross_VertexInfo +{ + int SPIRV_Cross_BaseVertex; + int SPIRV_Cross_BaseInstance; +}; + +struct SPIRV_Cross_Input +{ +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_BaseInstanceARB).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_BaseInstanceARB = SPIRV_Cross_BaseInstance; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-vertex.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-vertex.vert new file mode 100644 index 0000000000..6b9b62bbbb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/base-vertex.vert @@ -0,0 +1,30 @@ +static float4 gl_Position; +static int gl_BaseVertexARB; +cbuffer SPIRV_Cross_VertexInfo +{ + int SPIRV_Cross_BaseVertex; + int SPIRV_Cross_BaseInstance; +}; + +struct SPIRV_Cross_Input +{ +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_BaseVertexARB).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_BaseVertexARB = SPIRV_Cross_BaseVertex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert new file mode 100644 index 0000000000..ea3bdc1564 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert @@ -0,0 +1,50 @@ +struct Bar +{ + float v[2]; + float w; +}; + +struct V +{ + float a; + float b[2]; + Bar c[2]; + Bar d; +}; + +static V _14; + +struct SPIRV_Cross_Output +{ + float V_a : TEXCOORD0; + float V_b[2] : TEXCOORD1; + Bar V_c[2] : TEXCOORD3; + Bar V_d : TEXCOORD9; +}; + +void vert_main() +{ + _14.a = 1.0f; + _14.b[0] = 2.0f; + _14.b[1] = 3.0f; + _14.c[0].v[0] = 4.0f; + _14.c[0].v[1] = 5.0f; + _14.c[0].w = 6.0f; + _14.c[1].v[0] = 7.0f; + _14.c[1].v[1] = 8.0f; + _14.c[1].w = 9.0f; + _14.d.v[0] = 10.0f; + _14.d.v[1] = 11.0f; + _14.d.w = 12.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.V_a = _14.a; + stage_output.V_b = _14.b; + stage_output.V_c = _14.c; + stage_output.V_d = _14.d; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert new file mode 100644 index 0000000000..103ff46a3f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert @@ -0,0 +1,8 @@ +void vert_main() +{ +} + +void main() +{ + vert_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert new file mode 100644 index 0000000000..d76b24fca3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert @@ -0,0 +1,56 @@ +static float4 gl_Position; +static float4x4 m4; +static float4 v; +static float3x3 m3; +static float2x2 m2; + +struct SPIRV_Cross_Input +{ + float4 m4_0 : TEXCOORD0; + float4 m4_1 : TEXCOORD1; + float4 m4_2 : TEXCOORD2; + float4 m4_3 : TEXCOORD3; + float3 m3_0 : TEXCOORD4; + float3 m3_1 : TEXCOORD5; + float3 m3_2 : TEXCOORD6; + float2 m2_0 : TEXCOORD7; + float2 m2_1 : TEXCOORD8; + float4 v : TEXCOORD9; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(v, m4); + float4 _35 = gl_Position; + float3 _37 = _35.xyz + mul(v.xyz, m3); + gl_Position.x = _37.x; + gl_Position.y = _37.y; + gl_Position.z = _37.z; + float4 _56 = gl_Position; + float2 _58 = _56.xy + mul(v.xy, m2); + gl_Position.x = _58.x; + gl_Position.y = _58.y; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + m4[0] = stage_input.m4_0; + m4[1] = stage_input.m4_1; + m4[2] = stage_input.m4_2; + m4[3] = stage_input.m4_3; + v = stage_input.v; + m3[0] = stage_input.m3_0; + m3[1] = stage_input.m3_1; + m3[2] = stage_input.m3_2; + m2[0] = stage_input.m2_0; + m2[1] = stage_input.m2_1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..20afdb5135 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,48 @@ +static const float4 _68[4] = { 0.0f.xxxx, 1.0f.xxxx, 2.0f.xxxx, 3.0f.xxxx }; + +static float4 gl_Position; +static int Index1; +static int Index2; + +struct SPIRV_Cross_Input +{ + int Index1 : TEXCOORD0; + int Index2 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +float4 consume_constant_arrays2(float4 positions[4], float4 positions2[4]) +{ + float4 indexable[4] = positions; + float4 indexable_1[4] = positions2; + return indexable[Index1] + indexable_1[Index2]; +} + +float4 consume_constant_arrays(float4 positions[4], float4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +void vert_main() +{ + float4 LUT2[4]; + LUT2[0] = 10.0f.xxxx; + LUT2[1] = 11.0f.xxxx; + LUT2[2] = 12.0f.xxxx; + LUT2[3] = 13.0f.xxxx; + gl_Position = consume_constant_arrays(_68, LUT2); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Index1 = stage_input.Index1; + Index2 = stage_input.Index2; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp new file mode 100644 index 0000000000..b8265fc99e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp @@ -0,0 +1,19 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + uint _21 = _4.Load(_4.Load(0) * 4 + 4); + for (uint _23 = 0u; _23 < 64u; ) + { + _4.Store(_23 * 4 + 4, 0u); + _23++; + continue; + } + _4.Store(_4.Load(0) * 4 + 4, _21); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..919fe9bab5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,24 @@ +RWByteAddressBuffer u0_counter : register(u1); +RWBuffer u0 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _29; + u0_counter.InterlockedAdd(0, -1, _29); + float4 r0; + r0.x = asfloat(_29); + u0[(uint(asint(r0.x)) * 1u) + (uint(0) >> 2u)] = uint(int(gl_GlobalInvocationID.x)).x; +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..35960b0a69 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,24 @@ +RWByteAddressBuffer u0_counter : register(u1); +RWBuffer u0 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + uint _29; + u0_counter.InterlockedAdd(0, 1, _29); + float4 r0; + r0.x = asfloat(_29); + u0[(uint(asint(r0.x)) * 1u) + (uint(0) >> 2u)] = uint(int(gl_GlobalInvocationID.x)).x; +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..da499c3b6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,20 @@ +RWByteAddressBuffer _5 : register(u0); +RWByteAddressBuffer _6 : register(u1); + +void comp_main() +{ + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) < int4(_5.Load4(0)).x, int(_5.Load4(16).y) < int4(_5.Load4(0)).y, int(_5.Load4(16).z) < int4(_5.Load4(0)).z, int(_5.Load4(16).w) < int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) <= int4(_5.Load4(0)).x, int(_5.Load4(16).y) <= int4(_5.Load4(0)).y, int(_5.Load4(16).z) <= int4(_5.Load4(0)).z, int(_5.Load4(16).w) <= int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x < uint(int4(_5.Load4(0)).x), _5.Load4(16).y < uint(int4(_5.Load4(0)).y), _5.Load4(16).z < uint(int4(_5.Load4(0)).z), _5.Load4(16).w < uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x <= uint(int4(_5.Load4(0)).x), _5.Load4(16).y <= uint(int4(_5.Load4(0)).y), _5.Load4(16).z <= uint(int4(_5.Load4(0)).z), _5.Load4(16).w <= uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) > int4(_5.Load4(0)).x, int(_5.Load4(16).y) > int4(_5.Load4(0)).y, int(_5.Load4(16).z) > int4(_5.Load4(0)).z, int(_5.Load4(16).w) > int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(int(_5.Load4(16).x) >= int4(_5.Load4(0)).x, int(_5.Load4(16).y) >= int4(_5.Load4(0)).y, int(_5.Load4(16).z) >= int4(_5.Load4(0)).z, int(_5.Load4(16).w) >= int4(_5.Load4(0)).w))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x > uint(int4(_5.Load4(0)).x), _5.Load4(16).y > uint(int4(_5.Load4(0)).y), _5.Load4(16).z > uint(int4(_5.Load4(0)).z), _5.Load4(16).w > uint(int4(_5.Load4(0)).w)))); + _6.Store4(0, uint4(bool4(_5.Load4(16).x >= uint(int4(_5.Load4(0)).x), _5.Load4(16).y >= uint(int4(_5.Load4(0)).y), _5.Load4(16).z >= uint(int4(_5.Load4(0)).z), _5.Load4(16).w >= uint(int4(_5.Load4(0)).w)))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..e184e03c5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,39 @@ +struct A +{ + int a; + int b; +}; + +RWByteAddressBuffer C1 : register(u1); +cbuffer C2 : register(b2) +{ + A C2_1_Data[1024] : packoffset(c0); +}; + +RWByteAddressBuffer C3 : register(u0); +cbuffer B : register(b3) +{ + A C4_Data[1024] : packoffset(c0); +}; + + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + C1.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C2_1_Data[gl_GlobalInvocationID.x].a)); + C1.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C2_1_Data[gl_GlobalInvocationID.x].b)); + C3.Store(gl_GlobalInvocationID.x * 8 + 0, uint(C4_Data[gl_GlobalInvocationID.x].a)); + C3.Store(gl_GlobalInvocationID.x * 8 + 4, uint(C4_Data[gl_GlobalInvocationID.x].b)); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..9700100348 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,41 @@ +RWByteAddressBuffer bar : register(u0); +RWByteAddressBuffer foo : register(u1); + +void _main() +{ + [unroll] + for (int i = 0; i < 16; i++) + { + bar.Store4(i * 16 + 0, asuint(asfloat(foo.Load4(i * 16 + 0)))); + } + [loop] + for (int i_1 = 0; i_1 < 16; i_1++) + { + bar.Store4((15 - i_1) * 16 + 0, asuint(asfloat(foo.Load4(i_1 * 16 + 0)))); + } + float v = asfloat(bar.Load(160)); + float w = asfloat(foo.Load(160)); + [branch] + if (v > 10.0f) + { + foo.Store4(320, asuint(5.0f.xxxx)); + } + float value = 20.0f; + [flatten] + if (w > 40.0f) + { + value = 20.0f; + } + foo.Store4(320, asuint(value.xxxx)); +} + +void comp_main() +{ + _main(); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..44bde09f2a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,33 @@ +ByteAddressBuffer ssbo : register(t1); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void Load(uint size) +{ + int byteAddrTemp = int(size >> uint(2)); + uint4 data = uint4(ssbo.Load(byteAddrTemp * 4 + 0), ssbo.Load((byteAddrTemp + 1) * 4 + 0), ssbo.Load((byteAddrTemp + 2) * 4 + 0), ssbo.Load((byteAddrTemp + 3) * 4 + 0)); +} + +void _main(uint3 id) +{ + uint param = 4u; + Load(param); +} + +void comp_main() +{ + uint3 id = gl_GlobalInvocationID; + uint3 param = id; + _main(param); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..a6e88684fb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,84 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : min(asfloat(_4.Load(48)), asfloat(_4.Load(96)))))); + bool2 _145 = isnan(asfloat(_4.Load2(56))); + bool2 _146 = isnan(asfloat(_4.Load2(104))); + float2 _147 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _148 = float2(_145.x ? asfloat(_4.Load2(104)).x : _147.x, _145.y ? asfloat(_4.Load2(104)).y : _147.y); + _4.Store2(8, asuint(float2(_146.x ? asfloat(_4.Load2(56)).x : _148.x, _146.y ? asfloat(_4.Load2(56)).y : _148.y))); + bool3 _150 = isnan(asfloat(_4.Load3(64))); + bool3 _151 = isnan(asfloat(_4.Load3(112))); + float3 _152 = min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))); + float3 _153 = float3(_150.x ? asfloat(_4.Load3(112)).x : _152.x, _150.y ? asfloat(_4.Load3(112)).y : _152.y, _150.z ? asfloat(_4.Load3(112)).z : _152.z); + _4.Store3(16, asuint(float3(_151.x ? asfloat(_4.Load3(64)).x : _153.x, _151.y ? asfloat(_4.Load3(64)).y : _153.y, _151.z ? asfloat(_4.Load3(64)).z : _153.z))); + bool4 _155 = isnan(asfloat(_4.Load4(80))); + bool4 _156 = isnan(asfloat(_4.Load4(128))); + float4 _157 = min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))); + float4 _158 = float4(_155.x ? asfloat(_4.Load4(128)).x : _157.x, _155.y ? asfloat(_4.Load4(128)).y : _157.y, _155.z ? asfloat(_4.Load4(128)).z : _157.z, _155.w ? asfloat(_4.Load4(128)).w : _157.w); + _4.Store4(32, asuint(float4(_156.x ? asfloat(_4.Load4(80)).x : _158.x, _156.y ? asfloat(_4.Load4(80)).y : _158.y, _156.z ? asfloat(_4.Load4(80)).z : _158.z, _156.w ? asfloat(_4.Load4(80)).w : _158.w))); + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? asfloat(_4.Load(48)) : (isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(96)) : max(asfloat(_4.Load(48)), asfloat(_4.Load(96)))))); + bool2 _165 = isnan(asfloat(_4.Load2(56))); + bool2 _166 = isnan(asfloat(_4.Load2(104))); + float2 _167 = max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _168 = float2(_165.x ? asfloat(_4.Load2(104)).x : _167.x, _165.y ? asfloat(_4.Load2(104)).y : _167.y); + _4.Store2(8, asuint(float2(_166.x ? asfloat(_4.Load2(56)).x : _168.x, _166.y ? asfloat(_4.Load2(56)).y : _168.y))); + bool3 _170 = isnan(asfloat(_4.Load3(64))); + bool3 _171 = isnan(asfloat(_4.Load3(112))); + float3 _172 = max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))); + float3 _173 = float3(_170.x ? asfloat(_4.Load3(112)).x : _172.x, _170.y ? asfloat(_4.Load3(112)).y : _172.y, _170.z ? asfloat(_4.Load3(112)).z : _172.z); + _4.Store3(16, asuint(float3(_171.x ? asfloat(_4.Load3(64)).x : _173.x, _171.y ? asfloat(_4.Load3(64)).y : _173.y, _171.z ? asfloat(_4.Load3(64)).z : _173.z))); + bool4 _175 = isnan(asfloat(_4.Load4(80))); + bool4 _176 = isnan(asfloat(_4.Load4(128))); + float4 _177 = max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))); + float4 _178 = float4(_175.x ? asfloat(_4.Load4(128)).x : _177.x, _175.y ? asfloat(_4.Load4(128)).y : _177.y, _175.z ? asfloat(_4.Load4(128)).z : _177.z, _175.w ? asfloat(_4.Load4(128)).w : _177.w); + _4.Store4(32, asuint(float4(_176.x ? asfloat(_4.Load4(80)).x : _178.x, _176.y ? asfloat(_4.Load4(80)).y : _178.y, _176.z ? asfloat(_4.Load4(80)).z : _178.z, _176.w ? asfloat(_4.Load4(80)).w : _178.w))); + float _179 = isnan(asfloat(_4.Load(48))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(48)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(48)))); + _4.Store(0, asuint(isnan(asfloat(_4.Load(96))) ? _179 : (isnan(_179) ? asfloat(_4.Load(96)) : min(_179, asfloat(_4.Load(96)))))); + bool2 _192 = isnan(asfloat(_4.Load2(8))); + bool2 _193 = isnan(asfloat(_4.Load2(56))); + float2 _194 = max(asfloat(_4.Load2(8)), asfloat(_4.Load2(56))); + float2 _195 = float2(_192.x ? asfloat(_4.Load2(56)).x : _194.x, _192.y ? asfloat(_4.Load2(56)).y : _194.y); + float2 _190 = float2(_193.x ? asfloat(_4.Load2(8)).x : _195.x, _193.y ? asfloat(_4.Load2(8)).y : _195.y); + bool2 _197 = isnan(_190); + bool2 _198 = isnan(asfloat(_4.Load2(104))); + float2 _199 = min(_190, asfloat(_4.Load2(104))); + float2 _200 = float2(_197.x ? asfloat(_4.Load2(104)).x : _199.x, _197.y ? asfloat(_4.Load2(104)).y : _199.y); + _4.Store2(8, asuint(float2(_198.x ? _190.x : _200.x, _198.y ? _190.y : _200.y))); + bool3 _203 = isnan(asfloat(_4.Load3(16))); + bool3 _204 = isnan(asfloat(_4.Load3(64))); + float3 _205 = max(asfloat(_4.Load3(16)), asfloat(_4.Load3(64))); + float3 _206 = float3(_203.x ? asfloat(_4.Load3(64)).x : _205.x, _203.y ? asfloat(_4.Load3(64)).y : _205.y, _203.z ? asfloat(_4.Load3(64)).z : _205.z); + float3 _201 = float3(_204.x ? asfloat(_4.Load3(16)).x : _206.x, _204.y ? asfloat(_4.Load3(16)).y : _206.y, _204.z ? asfloat(_4.Load3(16)).z : _206.z); + bool3 _208 = isnan(_201); + bool3 _209 = isnan(asfloat(_4.Load3(112))); + float3 _210 = min(_201, asfloat(_4.Load3(112))); + float3 _211 = float3(_208.x ? asfloat(_4.Load3(112)).x : _210.x, _208.y ? asfloat(_4.Load3(112)).y : _210.y, _208.z ? asfloat(_4.Load3(112)).z : _210.z); + _4.Store3(16, asuint(float3(_209.x ? _201.x : _211.x, _209.y ? _201.y : _211.y, _209.z ? _201.z : _211.z))); + bool4 _214 = isnan(asfloat(_4.Load4(32))); + bool4 _215 = isnan(asfloat(_4.Load4(80))); + float4 _216 = max(asfloat(_4.Load4(32)), asfloat(_4.Load4(80))); + float4 _217 = float4(_214.x ? asfloat(_4.Load4(80)).x : _216.x, _214.y ? asfloat(_4.Load4(80)).y : _216.y, _214.z ? asfloat(_4.Load4(80)).z : _216.z, _214.w ? asfloat(_4.Load4(80)).w : _216.w); + float4 _212 = float4(_215.x ? asfloat(_4.Load4(32)).x : _217.x, _215.y ? asfloat(_4.Load4(32)).y : _217.y, _215.z ? asfloat(_4.Load4(32)).z : _217.z, _215.w ? asfloat(_4.Load4(32)).w : _217.w); + bool4 _219 = isnan(_212); + bool4 _220 = isnan(asfloat(_4.Load4(128))); + float4 _221 = min(_212, asfloat(_4.Load4(128))); + float4 _222 = float4(_219.x ? asfloat(_4.Load4(128)).x : _221.x, _219.y ? asfloat(_4.Load4(128)).y : _221.y, _219.z ? asfloat(_4.Load4(128)).z : _221.z, _219.w ? asfloat(_4.Load4(128)).w : _221.w); + _4.Store4(32, asuint(float4(_220.x ? _212.x : _222.x, _220.y ? _212.y : _222.y, _220.z ? _212.z : _222.z, _220.w ? _212.w : _222.w))); + float _223; + for (int i = 0; i < 2; i++, _223 = isnan(asfloat(_4.Load(56))) ? asfloat(_4.Load(0)) : (isnan(asfloat(_4.Load(0))) ? asfloat(_4.Load(56)) : max(asfloat(_4.Load(0)), asfloat(_4.Load(56)))), _4.Store(0, asuint(isnan(asfloat(_4.Load(60))) ? _223 : (isnan(_223) ? asfloat(_4.Load(60)) : min(_223, asfloat(_4.Load(60))))))) + { + bool2 _235 = isnan(asfloat(_4.Load2(56))); + bool2 _236 = isnan(asfloat(_4.Load2(104))); + float2 _237 = min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))); + float2 _238 = float2(_235.x ? asfloat(_4.Load2(104)).x : _237.x, _235.y ? asfloat(_4.Load2(104)).y : _237.y); + _4.Store2(8, asuint(float2(_236.x ? asfloat(_4.Load2(56)).x : _238.x, _236.y ? asfloat(_4.Load2(56)).y : _238.y))); + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..88f53a4c18 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,27 @@ +RWByteAddressBuffer _4 : register(u0); + +void comp_main() +{ + _4.Store(0, asuint(min(asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(min(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(min(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + _4.Store(0, asuint(max(asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(max(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(max(asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(max(asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + _4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(48)), asfloat(_4.Load(96))))); + _4.Store2(8, asuint(clamp(asfloat(_4.Load2(8)), asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + _4.Store3(16, asuint(clamp(asfloat(_4.Load3(16)), asfloat(_4.Load3(64)), asfloat(_4.Load3(112))))); + _4.Store4(32, asuint(clamp(asfloat(_4.Load4(32)), asfloat(_4.Load4(80)), asfloat(_4.Load4(128))))); + for (int i = 0; i < 2; i++, _4.Store(0, asuint(clamp(asfloat(_4.Load(0)), asfloat(_4.Load(56)), asfloat(_4.Load(60)))))) + { + _4.Store2(8, asuint(min(asfloat(_4.Load2(56)), asfloat(_4.Load2(104))))); + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag new file mode 100644 index 0000000000..77bd3a67b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors[2] : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[1][3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag new file mode 100644 index 0000000000..3d5d6288f8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag @@ -0,0 +1,32 @@ +cbuffer _4_5 : register(b0) +{ + column_major float2x4 _5_m0 : packoffset(c0); + float4 _5_m1 : packoffset(c4); +}; + + +static float2 _3; + +struct SPIRV_Cross_Output +{ + float2 _3 : SV_Target0; +}; + +float2 _23() +{ + float2 _25 = mul(_5_m0, _5_m1); + return _25; +} + +void frag_main() +{ + _3 = _23(); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output._3 = _3; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..3951fd511a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t1); +SamplerState uSampler : register(s0); + +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTex.Sample(uSampler, vUV); + FragColor += uTex.Sample(uSampler, vUV, int2(1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..38d12cd630 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,27 @@ +struct EmptyStructTest +{ + int empty_struct_member; +}; + +float GetValue(EmptyStructTest self) +{ + return 0.0f; +} + +float GetValue_1(EmptyStructTest self) +{ + return 0.0f; +} + +void frag_main() +{ + EmptyStructTest _23 = { 0 }; + EmptyStructTest emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(_23); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..67998c56a7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/frem.asm.frag @@ -0,0 +1,29 @@ +static float4 FragColor; +static float4 vA; +static float4 vB; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = fmod(vA, vB); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..e8978b6cd8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,47 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 foo(float4 foo_1) +{ + return foo_1 + 1.0f.xxxx; +} + +float4 foo(float3 foo_1) +{ + return foo_1.xyzz + 1.0f.xxxx; +} + +float4 foo_1(float4 foo_2) +{ + return foo_2 + 2.0f.xxxx; +} + +float4 foo(float2 foo_2) +{ + return foo_2.xyxy + 2.0f.xxxx; +} + +void frag_main() +{ + float4 foo_3 = 1.0f.xxxx; + float4 foo_2 = foo(foo_3); + float3 foo_5 = 1.0f.xxx; + float4 foo_4 = foo(foo_5); + float4 foo_7 = 1.0f.xxxx; + float4 foo_6 = foo_1(foo_7); + float2 foo_9 = 1.0f.xx; + float4 foo_8 = foo(foo_9); + FragColor = ((foo_2 + foo_4) + foo_6) + foo_8; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..2527d10fdc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,31 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static int2 Size; + +struct SPIRV_Cross_Output +{ + int2 Size : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _19_dummy_parameter; + uint _20_dummy_parameter; + Size = int2(spvTextureSize(uTexture, uint(0), _19_dummy_parameter)) + int2(spvTextureSize(uTexture, uint(1), _20_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.Size = Size; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..f668d63440 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,56 @@ +Texture2D uImage : register(t0); +SamplerState _uImage_sampler : register(s0); + +static float4 v0; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 v0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int i = 0; + float phi; + float4 _36; + phi = 1.0f; + _36 = float4(1.0f, 2.0f, 1.0f, 2.0f); + for (;;) + { + FragColor = _36; + if (i < 4) + { + if (v0[i] > 0.0f) + { + float2 _48 = phi.xx; + i++; + phi += 2.0f; + _36 = uImage.SampleLevel(_uImage_sampler, _48, 0.0f); + continue; + } + else + { + break; + } + } + else + { + break; + } + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v0 = stage_input.v0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..25dc6939e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,19 @@ +static float3 FragColor; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float3(asfloat(0x7f800000u /* inf */), asfloat(0xff800000u /* -inf */), asfloat(0x7fc00000u /* nan */)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..f0d99f7c72 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,86 @@ +static float FragColor; +static float vColor; + +struct SPIRV_Cross_Input +{ + float vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +#line 6 "test.frag" +void func() +{ +#line 8 "test.frag" + FragColor = 1.0f; +#line 9 "test.frag" + FragColor = 2.0f; +#line 10 "test.frag" + if (vColor < 0.0f) + { +#line 12 "test.frag" + FragColor = 3.0f; + } + else + { +#line 16 "test.frag" + FragColor = 4.0f; + } +#line 19 "test.frag" + for (int i = 0; float(i) < (40.0f + vColor); i += (int(vColor) + 5)) + { +#line 21 "test.frag" + FragColor += 0.20000000298023223876953125f; +#line 22 "test.frag" + FragColor += 0.300000011920928955078125f; + } +#line 25 "test.frag" + switch (int(vColor)) + { + case 0: + { +#line 28 "test.frag" + FragColor += 0.20000000298023223876953125f; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + FragColor += 0.4000000059604644775390625f; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + FragColor += 0.800000011920928955078125f; +#line 37 "test.frag" + break; + } + } + do + { +#line 42 "test.frag" + FragColor += (10.0f + vColor); + } while (FragColor < 100.0f); +} + +#line 46 "test.frag" +void frag_main() +{ +#line 48 "test.frag" + func(); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..a7aec01bad --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,55 @@ +static const float _46[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f }; +static const float4 _76[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx }; +static const float4 _90[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx }; + +static float FragColor; +static int index; + +struct SPIRV_Cross_Input +{ + nointerpolation int index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 foobar[4] = _76; + float4 baz[4] = _76; + FragColor = _46[index]; + if (index < 10) + { + FragColor += _46[index ^ 1]; + } + else + { + FragColor += _46[index & 1]; + } + if (index > 30) + { + FragColor += _76[index & 3].y; + } + else + { + FragColor += _76[index & 1].x; + } + if (index > 30) + { + foobar[1].z = 20.0f; + } + FragColor += foobar[index & 3].z; + baz = _90; + FragColor += baz[index & 3].z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + index = stage_input.index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag new file mode 100644 index 0000000000..88fad10ff1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag @@ -0,0 +1,34 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +uint64_t spvPackUint2x32(uint2 value) +{ + return (uint64_t(value.y) << 32) | uint64_t(value.x); +} + +uint2 spvUnpackUint2x32(uint64_t value) +{ + uint2 Unpacked; + Unpacked.x = uint(value & 0xffffffff); + Unpacked.y = uint(value >> 32); + return Unpacked; +} + +void frag_main() +{ + uint64_t _packed = spvPackUint2x32(uint2(18u, 52u)); + uint2 unpacked = spvUnpackUint2x32(_packed); + FragColor = float4(float(unpacked.x), float(unpacked.y), 1.0f, 1.0f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..ab0471a077 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,30 @@ +cbuffer Registers +{ + float registers_foo : packoffset(c0); +}; + + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float add_value(float v, float w) +{ + return v + w; +} + +void frag_main() +{ + FragColor = add_value(10.0f, registers_foo); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..41dfc08061 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,30 @@ +Texture2D g_Texture : register(t0); +SamplerState g_Sampler : register(s0); +SamplerComparisonState g_CompareSampler : register(s1); + +static float2 in_var_TEXCOORD0; +static float out_var_SV_Target; + +struct SPIRV_Cross_Input +{ + float2 in_var_TEXCOORD0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = g_Texture.Sample(g_Sampler, in_var_TEXCOORD0).x + g_Texture.SampleCmpLevelZero(g_CompareSampler, in_var_TEXCOORD0, 0.5f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + in_var_TEXCOORD0 = stage_input.in_var_TEXCOORD0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..9c71d08c4f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,66 @@ +struct myType +{ + float data; +}; + +static const myType _18 = { 0.0f }; +static const myType _20 = { 1.0f }; +static const myType _21[5] = { { 0.0f }, { 1.0f }, { 0.0f }, { 1.0f }, { 0.0f } }; + +static float4 gl_FragCoord; +static float4 o_color; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 o_color : SV_Target0; +}; + +float mod(float x, float y) +{ + return x - y * floor(x / y); +} + +float2 mod(float2 x, float2 y) +{ + return x - y * floor(x / y); +} + +float3 mod(float3 x, float3 y) +{ + return x - y * floor(x / y); +} + +float4 mod(float4 x, float4 y) +{ + return x - y * floor(x / y); +} + +void frag_main() +{ + float2 uv = gl_FragCoord.xy; + int index = int(mod(uv.x, 4.0f)); + myType elt = _21[index]; + if (elt.data > 0.0f) + { + o_color = float4(0.0f, 1.0f, 0.0f, 1.0f); + } + else + { + o_color = float4(1.0f, 0.0f, 0.0f, 1.0f); + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.o_color = o_color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..db5e717457 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/srem.asm.frag @@ -0,0 +1,29 @@ +static float4 FragColor; +static int4 vA; +static int4 vB; + +struct SPIRV_Cross_Input +{ + nointerpolation int4 vA : TEXCOORD0; + nointerpolation int4 vB : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float4(vA - vB * (vA / vB)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..1905b5ea29 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,23 @@ +static const float4 _20[2] = { float4(1.0f, 2.0f, 3.0f, 4.0f), 10.0f.xxxx }; + +static float4 FragColors[2] = _20; +static float4 FragColor = 5.0f.xxxx; + +struct SPIRV_Cross_Output +{ + float4 FragColors[2] : SV_Target0; + float4 FragColor : SV_Target2; +}; + +void frag_main() +{ +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColors = FragColors; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..d374bb9f9a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..74c12945bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,30 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..322c86bed3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,29 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static min16float4 FragColor; +static min16float2 UV; + +struct SPIRV_Cross_Input +{ + min16float2 UV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + min16float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = min16float4(uTexture.Sample(_uTexture_sampler, UV)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + UV = stage_input.UV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..027dd00c5a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,41 @@ +Texture2D uShadow : register(t0); +SamplerComparisonState _uShadow_sampler : register(s0); +Texture2D uTexture : register(t1); +SamplerComparisonState uSampler : register(s2); + +static float3 vUV; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float3 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float sample_combined() +{ + return uShadow.SampleCmp(_uShadow_sampler, vUV.xy, vUV.z); +} + +float sample_separate() +{ + return uTexture.SampleCmp(uSampler, vUV.xy, vUV.z); +} + +void frag_main() +{ + FragColor = sample_combined() + sample_separate(); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..5eb70adf81 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/frag/unreachable.asm.frag @@ -0,0 +1,44 @@ +static float4 _21; + +static int counter; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int counter : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _24; + _24 = _21; + float4 _33; + for (;;) + { + if (counter == 10) + { + _33 = 10.0f.xxxx; + break; + } + else + { + _33 = 30.0f.xxxx; + break; + } + } + FragColor = _33; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + counter = stage_input.counter; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..d5bf9e7a6a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,67 @@ +struct V2F +{ + float4 Position; + float4 Color; +}; + +struct InstanceData +{ + column_major float4x4 MATRIX_MVP; + float4 Color; +}; + +cbuffer gInstanceData : register(b0) +{ + InstanceData gInstanceData_1_data[32] : packoffset(c0); +}; + + +static float4 gl_Position; +static int gl_InstanceIndex; +static float3 PosL; +static float4 _entryPointOutput_Color; + +struct SPIRV_Cross_Input +{ + float3 PosL : TEXCOORD0; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 _entryPointOutput_Color : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +V2F _VS(float3 PosL_1, uint instanceID) +{ + InstanceData instData; + instData.MATRIX_MVP = gInstanceData_1_data[instanceID].MATRIX_MVP; + instData.Color = gInstanceData_1_data[instanceID].Color; + V2F v2f; + v2f.Position = mul(float4(PosL_1, 1.0f), instData.MATRIX_MVP); + v2f.Color = instData.Color; + return v2f; +} + +void vert_main() +{ + float3 PosL_1 = PosL; + uint instanceID = uint(gl_InstanceIndex); + float3 param = PosL_1; + uint param_1 = instanceID; + V2F flattenTemp = _VS(param, param_1); + gl_Position = flattenTemp.Position; + _entryPointOutput_Color = flattenTemp.Color; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + PosL = stage_input.PosL; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output._entryPointOutput_Color = _entryPointOutput_Color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..2a332551f3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,47 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_201 +#define SPIRV_CROSS_CONSTANT_ID_201 -10 +#endif +static const int _7 = SPIRV_CROSS_CONSTANT_ID_201; +static const int _20 = (_7 + 2); +#ifndef SPIRV_CROSS_CONSTANT_ID_202 +#define SPIRV_CROSS_CONSTANT_ID_202 100u +#endif +static const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; +static const uint _25 = (_8 % 5u); +static const int4 _30 = int4(20, 30, _20, _20); +static const int2 _32 = int2(_30.y, _30.x); +static const int _33 = _30.y; +#ifndef SPIRV_CROSS_CONSTANT_ID_200 +#define SPIRV_CROSS_CONSTANT_ID_200 3.141590118408203125f +#endif +static const float _9 = SPIRV_CROSS_CONSTANT_ID_200; + +static float4 gl_Position; +static int _4; + +struct SPIRV_Cross_Output +{ + nointerpolation int _4 : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4 pos = 0.0f.xxxx; + pos.y += float(_20); + pos.z += float(_25); + pos += float4(_30); + float2 _56 = pos.xy + float2(_32); + pos = float4(_56.x, _56.y, pos.z, pos.w); + gl_Position = pos; + _4 = _33; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output._4 = _4; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..a18c6e7056 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,37 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +float4 _main(uint vid, uint iid) +{ + return float(vid + iid).xxxx; +} + +void vert_main() +{ + uint vid = uint(gl_VertexIndex); + uint iid = uint(gl_InstanceIndex); + uint param = vid; + uint param_1 = iid; + gl_Position = _main(param, param_1); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..48b2df20d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chain-load-composite.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chain-load-composite.comp new file mode 100644 index 0000000000..1c4016008b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chain-load-composite.comp @@ -0,0 +1,164 @@ +struct Baz +{ + float c; +}; + +struct Bar +{ + float d[2][4]; + Baz baz[2]; +}; + +struct Foo +{ + column_major float2x2 a; + float2 b; + Bar c[5]; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _31 : register(u0); + +void comp_main() +{ + Foo _36; + _36.a = asfloat(uint2x2(_31.Load(0), _31.Load(8), _31.Load(4), _31.Load(12))); + _36.b = asfloat(_31.Load2(16)); + [unroll] + for (int _4ident = 0; _4ident < 5; _4ident++) + { + [unroll] + for (int _5ident = 0; _5ident < 2; _5ident++) + { + [unroll] + for (int _6ident = 0; _6ident < 4; _6ident++) + { + _36.c[_4ident].d[_5ident][_6ident] = asfloat(_31.Load(_6ident * 4 + _5ident * 16 + _4ident * 40 + 24)); + } + } + [unroll] + for (int _7ident = 0; _7ident < 2; _7ident++) + { + _36.c[_4ident].baz[_7ident].c = asfloat(_31.Load(_7ident * 4 + _4ident * 40 + 56)); + } + } + Foo f; + f.a = _36.a; + f.b = _36.b; + f.c[0].d[0][0] = _36.c[0].d[0][0]; + f.c[0].d[0][1] = _36.c[0].d[0][1]; + f.c[0].d[0][2] = _36.c[0].d[0][2]; + f.c[0].d[0][3] = _36.c[0].d[0][3]; + f.c[0].d[1][0] = _36.c[0].d[1][0]; + f.c[0].d[1][1] = _36.c[0].d[1][1]; + f.c[0].d[1][2] = _36.c[0].d[1][2]; + f.c[0].d[1][3] = _36.c[0].d[1][3]; + f.c[0].baz[0].c = _36.c[0].baz[0].c; + f.c[0].baz[1].c = _36.c[0].baz[1].c; + f.c[1].d[0][0] = _36.c[1].d[0][0]; + f.c[1].d[0][1] = _36.c[1].d[0][1]; + f.c[1].d[0][2] = _36.c[1].d[0][2]; + f.c[1].d[0][3] = _36.c[1].d[0][3]; + f.c[1].d[1][0] = _36.c[1].d[1][0]; + f.c[1].d[1][1] = _36.c[1].d[1][1]; + f.c[1].d[1][2] = _36.c[1].d[1][2]; + f.c[1].d[1][3] = _36.c[1].d[1][3]; + f.c[1].baz[0].c = _36.c[1].baz[0].c; + f.c[1].baz[1].c = _36.c[1].baz[1].c; + f.c[2].d[0][0] = _36.c[2].d[0][0]; + f.c[2].d[0][1] = _36.c[2].d[0][1]; + f.c[2].d[0][2] = _36.c[2].d[0][2]; + f.c[2].d[0][3] = _36.c[2].d[0][3]; + f.c[2].d[1][0] = _36.c[2].d[1][0]; + f.c[2].d[1][1] = _36.c[2].d[1][1]; + f.c[2].d[1][2] = _36.c[2].d[1][2]; + f.c[2].d[1][3] = _36.c[2].d[1][3]; + f.c[2].baz[0].c = _36.c[2].baz[0].c; + f.c[2].baz[1].c = _36.c[2].baz[1].c; + f.c[3].d[0][0] = _36.c[3].d[0][0]; + f.c[3].d[0][1] = _36.c[3].d[0][1]; + f.c[3].d[0][2] = _36.c[3].d[0][2]; + f.c[3].d[0][3] = _36.c[3].d[0][3]; + f.c[3].d[1][0] = _36.c[3].d[1][0]; + f.c[3].d[1][1] = _36.c[3].d[1][1]; + f.c[3].d[1][2] = _36.c[3].d[1][2]; + f.c[3].d[1][3] = _36.c[3].d[1][3]; + f.c[3].baz[0].c = _36.c[3].baz[0].c; + f.c[3].baz[1].c = _36.c[3].baz[1].c; + f.c[4].d[0][0] = _36.c[4].d[0][0]; + f.c[4].d[0][1] = _36.c[4].d[0][1]; + f.c[4].d[0][2] = _36.c[4].d[0][2]; + f.c[4].d[0][3] = _36.c[4].d[0][3]; + f.c[4].d[1][0] = _36.c[4].d[1][0]; + f.c[4].d[1][1] = _36.c[4].d[1][1]; + f.c[4].d[1][2] = _36.c[4].d[1][2]; + f.c[4].d[1][3] = _36.c[4].d[1][3]; + f.c[4].baz[0].c = _36.c[4].baz[0].c; + f.c[4].baz[1].c = _36.c[4].baz[1].c; + float2 _229 = 1.0f.xx; + f.a = float2x2(f.a[0] + _229, f.a[1] + _229); + f.b += 2.0f.xx; + f.c[3].d[1][1] += 5.0f; + _31.Store(224, asuint(f.a[0].x)); + _31.Store(228, asuint(f.a[1].x)); + _31.Store(232, asuint(f.a[0].y)); + _31.Store(236, asuint(f.a[1].y)); + _31.Store2(240, asuint(f.b)); + _31.Store(248, asuint(f.c[0].d[0][0])); + _31.Store(252, asuint(f.c[0].d[0][1])); + _31.Store(256, asuint(f.c[0].d[0][2])); + _31.Store(260, asuint(f.c[0].d[0][3])); + _31.Store(264, asuint(f.c[0].d[1][0])); + _31.Store(268, asuint(f.c[0].d[1][1])); + _31.Store(272, asuint(f.c[0].d[1][2])); + _31.Store(276, asuint(f.c[0].d[1][3])); + _31.Store(280, asuint(f.c[0].baz[0].c)); + _31.Store(284, asuint(f.c[0].baz[1].c)); + _31.Store(288, asuint(f.c[1].d[0][0])); + _31.Store(292, asuint(f.c[1].d[0][1])); + _31.Store(296, asuint(f.c[1].d[0][2])); + _31.Store(300, asuint(f.c[1].d[0][3])); + _31.Store(304, asuint(f.c[1].d[1][0])); + _31.Store(308, asuint(f.c[1].d[1][1])); + _31.Store(312, asuint(f.c[1].d[1][2])); + _31.Store(316, asuint(f.c[1].d[1][3])); + _31.Store(320, asuint(f.c[1].baz[0].c)); + _31.Store(324, asuint(f.c[1].baz[1].c)); + _31.Store(328, asuint(f.c[2].d[0][0])); + _31.Store(332, asuint(f.c[2].d[0][1])); + _31.Store(336, asuint(f.c[2].d[0][2])); + _31.Store(340, asuint(f.c[2].d[0][3])); + _31.Store(344, asuint(f.c[2].d[1][0])); + _31.Store(348, asuint(f.c[2].d[1][1])); + _31.Store(352, asuint(f.c[2].d[1][2])); + _31.Store(356, asuint(f.c[2].d[1][3])); + _31.Store(360, asuint(f.c[2].baz[0].c)); + _31.Store(364, asuint(f.c[2].baz[1].c)); + _31.Store(368, asuint(f.c[3].d[0][0])); + _31.Store(372, asuint(f.c[3].d[0][1])); + _31.Store(376, asuint(f.c[3].d[0][2])); + _31.Store(380, asuint(f.c[3].d[0][3])); + _31.Store(384, asuint(f.c[3].d[1][0])); + _31.Store(388, asuint(f.c[3].d[1][1])); + _31.Store(392, asuint(f.c[3].d[1][2])); + _31.Store(396, asuint(f.c[3].d[1][3])); + _31.Store(400, asuint(f.c[3].baz[0].c)); + _31.Store(404, asuint(f.c[3].baz[1].c)); + _31.Store(408, asuint(f.c[4].d[0][0])); + _31.Store(412, asuint(f.c[4].d[0][1])); + _31.Store(416, asuint(f.c[4].d[0][2])); + _31.Store(420, asuint(f.c[4].d[0][3])); + _31.Store(424, asuint(f.c[4].d[1][0])); + _31.Store(428, asuint(f.c[4].d[1][1])); + _31.Store(432, asuint(f.c[4].d[1][2])); + _31.Store(436, asuint(f.c[4].d[1][3])); + _31.Store(440, asuint(f.c[4].baz[0].c)); + _31.Store(444, asuint(f.c[4].baz[1].c)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.comp new file mode 100644 index 0000000000..c748200b96 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.comp @@ -0,0 +1,23 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer wo : register(u1); +ByteAddressBuffer ro : register(t0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160)))); + wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480)))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.force-uav.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.force-uav.comp new file mode 100644 index 0000000000..97d046d89a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/access-chains.force-uav.comp @@ -0,0 +1,23 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer wo : register(u1); +RWByteAddressBuffer ro : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160)))); + wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480)))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/address-buffers.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/address-buffers.comp new file mode 100644 index 0000000000..7f1c7975bc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/address-buffers.comp @@ -0,0 +1,17 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer WriteOnly : register(u2); +ByteAddressBuffer ReadOnly : register(t0); +RWByteAddressBuffer ReadWrite : register(u1); + +void comp_main() +{ + WriteOnly.Store4(0, asuint(asfloat(ReadOnly.Load4(0)))); + ReadWrite.Store4(0, asuint(asfloat(ReadWrite.Load4(0)) + 10.0f.xxxx)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/atomic.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/atomic.comp new file mode 100644 index 0000000000..e6ff891e8c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/atomic.comp @@ -0,0 +1,91 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer ssbo : register(u2); +RWTexture2D uImage : register(u0); +RWTexture2D iImage : register(u1); + +groupshared int int_atomic; +groupshared uint uint_atomic; +groupshared int int_atomic_array[1]; +groupshared uint uint_atomic_array[1]; + +void comp_main() +{ + uint _19; + InterlockedAdd(uImage[int2(1, 5)], 1u, _19); + uint _27; + InterlockedAdd(uImage[int2(1, 5)], 1u, _27); + iImage[int2(1, 6)] = int(_27).x; + uint _32; + InterlockedOr(uImage[int2(1, 5)], 1u, _32); + uint _34; + InterlockedXor(uImage[int2(1, 5)], 1u, _34); + uint _36; + InterlockedAnd(uImage[int2(1, 5)], 1u, _36); + uint _38; + InterlockedMin(uImage[int2(1, 5)], 1u, _38); + uint _40; + InterlockedMax(uImage[int2(1, 5)], 1u, _40); + uint _44; + InterlockedCompareExchange(uImage[int2(1, 5)], 10u, 2u, _44); + int _47; + InterlockedAdd(iImage[int2(1, 6)], 1, _47); + int _49; + InterlockedOr(iImage[int2(1, 6)], 1, _49); + int _51; + InterlockedXor(iImage[int2(1, 6)], 1, _51); + int _53; + InterlockedAnd(iImage[int2(1, 6)], 1, _53); + int _55; + InterlockedMin(iImage[int2(1, 6)], 1, _55); + int _57; + InterlockedMax(iImage[int2(1, 6)], 1, _57); + int _61; + InterlockedCompareExchange(iImage[int2(1, 5)], 10, 2, _61); + uint _68; + ssbo.InterlockedAdd(0, 1u, _68); + uint _70; + ssbo.InterlockedOr(0, 1u, _70); + uint _72; + ssbo.InterlockedXor(0, 1u, _72); + uint _74; + ssbo.InterlockedAnd(0, 1u, _74); + uint _76; + ssbo.InterlockedMin(0, 1u, _76); + uint _78; + ssbo.InterlockedMax(0, 1u, _78); + uint _80; + ssbo.InterlockedExchange(0, 1u, _80); + uint _82; + ssbo.InterlockedCompareExchange(0, 10u, 2u, _82); + int _85; + ssbo.InterlockedAdd(4, 1, _85); + int _87; + ssbo.InterlockedOr(4, 1, _87); + int _89; + ssbo.InterlockedXor(4, 1, _89); + int _91; + ssbo.InterlockedAnd(4, 1, _91); + int _93; + ssbo.InterlockedMin(4, 1, _93); + int _95; + ssbo.InterlockedMax(4, 1, _95); + int _97; + ssbo.InterlockedExchange(4, 1, _97); + int _99; + ssbo.InterlockedCompareExchange(4, 10, 2, _99); + int _102; + InterlockedAdd(int_atomic, 10, _102); + uint _105; + InterlockedAdd(uint_atomic, 10u, _105); + int _110; + InterlockedAdd(int_atomic_array[0], 10, _110); + uint _115; + InterlockedAdd(uint_atomic_array[0], 10u, _115); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/barriers.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/barriers.comp new file mode 100644 index 0000000000..15af8ac11d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/barriers.comp @@ -0,0 +1,81 @@ +static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); + +void barrier_shared() +{ + GroupMemoryBarrier(); +} + +void full_barrier() +{ + AllMemoryBarrier(); +} + +void image_barrier() +{ + DeviceMemoryBarrier(); +} + +void buffer_barrier() +{ + DeviceMemoryBarrier(); +} + +void group_barrier() +{ + AllMemoryBarrier(); +} + +void barrier_shared_exec() +{ + GroupMemoryBarrierWithGroupSync(); +} + +void full_barrier_exec() +{ + AllMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); +} + +void image_barrier_exec() +{ + DeviceMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); +} + +void buffer_barrier_exec() +{ + DeviceMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); +} + +void group_barrier_exec() +{ + AllMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); +} + +void exec_barrier() +{ + GroupMemoryBarrierWithGroupSync(); +} + +void comp_main() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + exec_barrier(); +} + +[numthreads(4, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/builtins.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/builtins.comp new file mode 100644 index 0000000000..5d84883b2f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/builtins.comp @@ -0,0 +1,32 @@ +static const uint3 gl_WorkGroupSize = uint3(8u, 4u, 2u); + +static uint3 gl_WorkGroupID; +static uint3 gl_LocalInvocationID; +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_LocalInvocationID : SV_GroupThreadID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +void comp_main() +{ + uint3 local_id = gl_LocalInvocationID; + uint3 global_id = gl_GlobalInvocationID; + uint local_index = gl_LocalInvocationIndex; + uint3 work_group_size = gl_WorkGroupSize; + uint3 work_group_id = gl_WorkGroupID; +} + +[numthreads(8, 4, 2)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_LocalInvocationID = stage_input.gl_LocalInvocationID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..dbd8cf704e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/composite-array-initialization.comp @@ -0,0 +1,63 @@ +struct Data +{ + float a; + float b; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 4.0f +#endif +static const float X = SPIRV_CROSS_CONSTANT_ID_0; + +static const uint3 gl_WorkGroupSize = uint3(2u, 1u, 1u); + +static const Data _21 = { 1.0f, 2.0f }; +static const Data _24 = { 3.0f, 4.0f }; +static const Data _25[2] = { { 1.0f, 2.0f }, { 3.0f, 4.0f } }; +static const Data _30 = { 3.0f, 5.0f }; + +RWByteAddressBuffer _61 : register(u0); + +static uint3 gl_WorkGroupID; +static uint3 gl_LocalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_LocalInvocationID : SV_GroupThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +static Data data[2]; +static Data data2[2]; + +Data combine(Data a, Data b) +{ + Data _46 = { a.a + b.a, a.b + b.b }; + return _46; +} + +void comp_main() +{ + data = _25; + Data _28 = { X, 2.0f }; + Data _31[2] = { _28, _30 }; + data2 = _31; + if (gl_LocalInvocationIndex == 0u) + { + Data param = data[gl_LocalInvocationID.x]; + Data param_1 = data2[gl_LocalInvocationID.x]; + Data _79 = combine(param, param_1); + _61.Store(gl_WorkGroupID.x * 8 + 0, asuint(_79.a)); + _61.Store(gl_WorkGroupID.x * 8 + 4, asuint(_79.b)); + } +} + +[numthreads(2, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_LocalInvocationID = stage_input.gl_LocalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/globallycoherent.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/globallycoherent.comp new file mode 100644 index 0000000000..236f341e1a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/globallycoherent.comp @@ -0,0 +1,20 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +globallycoherent RWByteAddressBuffer _29 : register(u3); +ByteAddressBuffer _33 : register(t2); +RWTexture2D uImageIn : register(u0); +globallycoherent RWTexture2D uImageOut : register(u1); + +void comp_main() +{ + int2 coord = int2(9, 7); + float4 indata = uImageIn[coord].xxxx; + uImageOut[coord] = indata.x; + _29.Store(0, asuint(asfloat(_33.Load(0)))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/image.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/image.comp new file mode 100644 index 0000000000..89a9940942 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/image.comp @@ -0,0 +1,73 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWTexture2D uImageInF : register(u0); +RWTexture2D uImageOutF : register(u1); +RWTexture2D uImageInI : register(u2); +RWTexture2D uImageOutI : register(u3); +RWTexture2D uImageInU : register(u4); +RWTexture2D uImageOutU : register(u5); +RWBuffer uImageInBuffer : register(u6); +RWBuffer uImageOutBuffer : register(u7); +RWTexture2D uImageInF2 : register(u8); +RWTexture2D uImageOutF2 : register(u9); +RWTexture2D uImageInI2 : register(u10); +RWTexture2D uImageOutI2 : register(u11); +RWTexture2D uImageInU2 : register(u12); +RWTexture2D uImageOutU2 : register(u13); +RWBuffer uImageInBuffer2 : register(u14); +RWBuffer uImageOutBuffer2 : register(u15); +RWTexture2D uImageInF4 : register(u16); +RWTexture2D uImageOutF4 : register(u17); +RWTexture2D uImageInI4 : register(u18); +RWTexture2D uImageOutI4 : register(u19); +RWTexture2D uImageInU4 : register(u20); +RWTexture2D uImageOutU4 : register(u21); +RWBuffer uImageInBuffer4 : register(u22); +RWBuffer uImageOutBuffer4 : register(u23); +RWTexture2D uImageNoFmtF : register(u24); +RWTexture2D uImageNoFmtU : register(u25); +RWTexture2D uImageNoFmtI : register(u26); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + float4 f = uImageInF[int2(gl_GlobalInvocationID.xy)].xxxx; + uImageOutF[int2(gl_GlobalInvocationID.xy)] = f.x; + int4 i = uImageInI[int2(gl_GlobalInvocationID.xy)].xxxx; + uImageOutI[int2(gl_GlobalInvocationID.xy)] = i.x; + uint4 u = uImageInU[int2(gl_GlobalInvocationID.xy)].xxxx; + uImageOutU[int2(gl_GlobalInvocationID.xy)] = u.x; + float4 b = uImageInBuffer[int(gl_GlobalInvocationID.x)].xxxx; + uImageOutBuffer[int(gl_GlobalInvocationID.x)] = b.x; + float4 f2 = uImageInF2[int2(gl_GlobalInvocationID.xy)].xyyy; + uImageOutF2[int2(gl_GlobalInvocationID.xy)] = f2.xy; + int4 i2 = uImageInI2[int2(gl_GlobalInvocationID.xy)].xyyy; + uImageOutI2[int2(gl_GlobalInvocationID.xy)] = i2.xy; + uint4 u2 = uImageInU2[int2(gl_GlobalInvocationID.xy)].xyyy; + uImageOutU2[int2(gl_GlobalInvocationID.xy)] = u2.xy; + float4 b2 = uImageInBuffer2[int(gl_GlobalInvocationID.x)].xyyy; + uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = b2.xy; + float4 f4 = uImageInF4[int2(gl_GlobalInvocationID.xy)]; + uImageOutF4[int2(gl_GlobalInvocationID.xy)] = f4; + int4 i4 = uImageInI4[int2(gl_GlobalInvocationID.xy)]; + uImageOutI4[int2(gl_GlobalInvocationID.xy)] = i4; + uint4 u4 = uImageInU4[int2(gl_GlobalInvocationID.xy)]; + uImageOutU4[int2(gl_GlobalInvocationID.xy)] = u4; + float4 b4 = uImageInBuffer4[int(gl_GlobalInvocationID.x)]; + uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = b4; + uImageNoFmtF[int2(gl_GlobalInvocationID.xy)] = b2; + uImageNoFmtU[int2(gl_GlobalInvocationID.xy)] = u4; + uImageNoFmtI[int2(gl_GlobalInvocationID.xy)] = i4; +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/image.nonwritable-uav-texture.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/image.nonwritable-uav-texture.comp new file mode 100644 index 0000000000..1e11b08777 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/image.nonwritable-uav-texture.comp @@ -0,0 +1,73 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +Texture2D uImageInF : register(t0); +RWTexture2D uImageOutF : register(u1); +Texture2D uImageInI : register(t2); +RWTexture2D uImageOutI : register(u3); +Texture2D uImageInU : register(t4); +RWTexture2D uImageOutU : register(u5); +Buffer uImageInBuffer : register(t6); +RWBuffer uImageOutBuffer : register(u7); +Texture2D uImageInF2 : register(t8); +RWTexture2D uImageOutF2 : register(u9); +Texture2D uImageInI2 : register(t10); +RWTexture2D uImageOutI2 : register(u11); +Texture2D uImageInU2 : register(t12); +RWTexture2D uImageOutU2 : register(u13); +Buffer uImageInBuffer2 : register(t14); +RWBuffer uImageOutBuffer2 : register(u15); +Texture2D uImageInF4 : register(t16); +RWTexture2D uImageOutF4 : register(u17); +Texture2D uImageInI4 : register(t18); +RWTexture2D uImageOutI4 : register(u19); +Texture2D uImageInU4 : register(t20); +RWTexture2D uImageOutU4 : register(u21); +Buffer uImageInBuffer4 : register(t22); +RWBuffer uImageOutBuffer4 : register(u23); +RWTexture2D uImageNoFmtF : register(u24); +RWTexture2D uImageNoFmtU : register(u25); +RWTexture2D uImageNoFmtI : register(u26); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + float4 f = uImageInF[int2(gl_GlobalInvocationID.xy)]; + uImageOutF[int2(gl_GlobalInvocationID.xy)] = f.x; + int4 i = uImageInI[int2(gl_GlobalInvocationID.xy)]; + uImageOutI[int2(gl_GlobalInvocationID.xy)] = i.x; + uint4 u = uImageInU[int2(gl_GlobalInvocationID.xy)]; + uImageOutU[int2(gl_GlobalInvocationID.xy)] = u.x; + float4 b = uImageInBuffer[int(gl_GlobalInvocationID.x)]; + uImageOutBuffer[int(gl_GlobalInvocationID.x)] = b.x; + float4 f2 = uImageInF2[int2(gl_GlobalInvocationID.xy)]; + uImageOutF2[int2(gl_GlobalInvocationID.xy)] = f2.xy; + int4 i2 = uImageInI2[int2(gl_GlobalInvocationID.xy)]; + uImageOutI2[int2(gl_GlobalInvocationID.xy)] = i2.xy; + uint4 u2 = uImageInU2[int2(gl_GlobalInvocationID.xy)]; + uImageOutU2[int2(gl_GlobalInvocationID.xy)] = u2.xy; + float4 b2 = uImageInBuffer2[int(gl_GlobalInvocationID.x)]; + uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = b2.xy; + float4 f4 = uImageInF4[int2(gl_GlobalInvocationID.xy)]; + uImageOutF4[int2(gl_GlobalInvocationID.xy)] = f4; + int4 i4 = uImageInI4[int2(gl_GlobalInvocationID.xy)]; + uImageOutI4[int2(gl_GlobalInvocationID.xy)] = i4; + uint4 u4 = uImageInU4[int2(gl_GlobalInvocationID.xy)]; + uImageOutU4[int2(gl_GlobalInvocationID.xy)] = u4; + float4 b4 = uImageInBuffer4[int(gl_GlobalInvocationID.x)]; + uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = b4; + uImageNoFmtF[int2(gl_GlobalInvocationID.xy)] = b2; + uImageNoFmtU[int2(gl_GlobalInvocationID.xy)] = u4; + uImageNoFmtI[int2(gl_GlobalInvocationID.xy)] = i4; +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/inverse.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/inverse.comp new file mode 100644 index 0000000000..698f647cec --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/inverse.comp @@ -0,0 +1,124 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _15 : register(u0); +ByteAddressBuffer _20 : register(t1); + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float2x2 spvInverse(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 2x2 matrix. +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float3x3 spvInverse(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the determinant of a 3x3 matrix. +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +float4x4 spvInverse(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +void comp_main() +{ + float2x2 _23 = asfloat(uint2x2(_20.Load2(0), _20.Load2(8))); + float2x2 _24 = spvInverse(_23); + _15.Store2(0, asuint(_24[0])); + _15.Store2(8, asuint(_24[1])); + float3x3 _29 = asfloat(uint3x3(_20.Load3(16), _20.Load3(32), _20.Load3(48))); + float3x3 _30 = spvInverse(_29); + _15.Store3(16, asuint(_30[0])); + _15.Store3(32, asuint(_30[1])); + _15.Store3(48, asuint(_30[2])); + float4x4 _35 = asfloat(uint4x4(_20.Load4(64), _20.Load4(80), _20.Load4(96), _20.Load4(112))); + float4x4 _36 = spvInverse(_35); + _15.Store4(64, asuint(_36[0])); + _15.Store4(80, asuint(_36[1])); + _15.Store4(96, asuint(_36[2])); + _15.Store4(112, asuint(_36[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-alone.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-alone.comp new file mode 100644 index 0000000000..ff71a0e103 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-alone.comp @@ -0,0 +1,19 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _10 : register(u0); +cbuffer SPIRV_Cross_NumWorkgroups +{ + uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0); +}; + + +void comp_main() +{ + _10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-with-builtins.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-with-builtins.comp new file mode 100644 index 0000000000..cc326db332 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/num-workgroups-with-builtins.comp @@ -0,0 +1,26 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _10 : register(u0); +cbuffer SPIRV_Cross_NumWorkgroups +{ + uint3 SPIRV_Cross_NumWorkgroups_1_count : packoffset(c0); +}; + + +static uint3 gl_WorkGroupID; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; +}; + +void comp_main() +{ + _10.Store3(0, SPIRV_Cross_NumWorkgroups_1_count + gl_WorkGroupID); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/outer-product.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/outer-product.comp new file mode 100644 index 0000000000..e58c02fe0b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/outer-product.comp @@ -0,0 +1,50 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _21 : register(u0); +ByteAddressBuffer _26 : register(t1); + +void comp_main() +{ + float2x2 _32 = float2x2(asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load2(0)).y); + _21.Store2(0, asuint(_32[0])); + _21.Store2(8, asuint(_32[1])); + float2x3 _41 = float2x3(asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load2(0)).y); + _21.Store3(16, asuint(_41[0])); + _21.Store3(32, asuint(_41[1])); + float2x4 _50 = float2x4(asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load2(0)).y); + _21.Store4(48, asuint(_50[0])); + _21.Store4(64, asuint(_50[1])); + float3x2 _58 = float3x2(asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load3(16)).z); + _21.Store2(80, asuint(_58[0])); + _21.Store2(88, asuint(_58[1])); + _21.Store2(96, asuint(_58[2])); + float3x3 _66 = float3x3(asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load3(16)).z); + _21.Store3(112, asuint(_66[0])); + _21.Store3(128, asuint(_66[1])); + _21.Store3(144, asuint(_66[2])); + float3x4 _74 = float3x4(asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load3(16)).z); + _21.Store4(160, asuint(_74[0])); + _21.Store4(176, asuint(_74[1])); + _21.Store4(192, asuint(_74[2])); + float4x2 _82 = float4x2(asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load2(0)) * asfloat(_26.Load4(32)).w); + _21.Store2(208, asuint(_82[0])); + _21.Store2(216, asuint(_82[1])); + _21.Store2(224, asuint(_82[2])); + _21.Store2(232, asuint(_82[3])); + float4x3 _90 = float4x3(asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load3(16)) * asfloat(_26.Load4(32)).w); + _21.Store3(240, asuint(_90[0])); + _21.Store3(256, asuint(_90[1])); + _21.Store3(272, asuint(_90[2])); + _21.Store3(288, asuint(_90[3])); + float4x4 _98 = float4x4(asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).x, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).y, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).z, asfloat(_26.Load4(32)) * asfloat(_26.Load4(32)).w); + _21.Store4(304, asuint(_98[0])); + _21.Store4(320, asuint(_98[1])); + _21.Store4(336, asuint(_98[2])); + _21.Store4(352, asuint(_98[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp new file mode 100644 index 0000000000..b680c7ccef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp @@ -0,0 +1,224 @@ +struct Ray +{ + float3 pos; + float tmin; + float3 dir; + float tmax; +}; + +RWByteAddressBuffer _17 : register(u0); +RWByteAddressBuffer _257 : register(u2); +uniform RaytracingAccelerationStructure rtas : register(t1); + +static RayQuery rayQuery; + +Ray makeRayDesc() +{ + Ray ray; + ray.pos = 0.0f.xxx; + ray.dir = float3(1.0f, 0.0f, 0.0f); + ray.tmin = 0.0f; + ray.tmax = 9999.0f; + return ray; +} + +void doSomething() +{ + _17.Store(0, 0u); + _17.Store(4, 0u); +} + +void comp_main() +{ + Ray ray = makeRayDesc(); + RayDesc _1ident = {ray.pos, ray.tmin, ray.dir, ray.tmax}; + rayQuery.TraceRayInline(rtas, 0u, 255u, _1ident); + float4x3 _mat4x3; + float3x4 _mat3x4; + for (;;) + { + bool _67 = rayQuery.Proceed(); + if (_67) + { + uint _71 = rayQuery.CandidateType(); + uint candidateType = _71; + switch (candidateType) + { + case 0u: + { + rayQuery.Abort(); + float4x3 _79 = rayQuery.CandidateObjectToWorld4x3(); + _mat4x3 = _79; + _mat3x4 = transpose(_mat4x3); + rayQuery.CommitNonOpaqueTriangleHit(); + bool _87 = rayQuery.CommittedTriangleFrontFace(); + if (_87) + { + doSomething(); + } + float2 _92 = rayQuery.CommittedTriangleBarycentrics(); + if (_92.x == 0.0f) + { + doSomething(); + } + int _98 = rayQuery.CommittedInstanceID(); + if (_98 > 0) + { + doSomething(); + } + int _103 = rayQuery.CommittedInstanceIndex(); + if (_103 > 0) + { + doSomething(); + } + float3 _108 = rayQuery.CommittedObjectRayDirection(); + if (_108.x > 0.0f) + { + doSomething(); + } + float3 _114 = rayQuery.CommittedObjectRayOrigin(); + if (_114.x > 0.0f) + { + doSomething(); + } + int _120 = rayQuery.CommittedPrimitiveIndex(); + if (_120 > 0) + { + doSomething(); + } + float _125 = rayQuery.CommittedRayT(); + if (_125 > 0.0f) + { + doSomething(); + } + uint _130 = rayQuery.CommittedInstanceContributionToHitGroupIndex(); + if (_130 > 0u) + { + doSomething(); + } + break; + } + case 1u: + { + float4x3 _136 = rayQuery.CandidateObjectToWorld4x3(); + _mat4x3 = _136; + _mat3x4 = transpose(_mat4x3); + bool _139 = rayQuery.CandidateProceduralPrimitiveNonOpaque(); + if (_139) + { + doSomething(); + } + float t = 0.5f; + rayQuery.CommitProceduralPrimitiveHit(t); + rayQuery.Abort(); + break; + } + } + continue; + } + else + { + break; + } + } + if (_mat3x4[0].x == _mat4x3[0].x) + { + doSomething(); + } + uint _157 = rayQuery.CommittedStatus(); + uint committedStatus = _157; + switch (committedStatus) + { + case 0u: + { + float4x3 _163 = rayQuery.CandidateWorldToObject4x3(); + _mat4x3 = _163; + _mat3x4 = transpose(_mat4x3); + break; + } + case 1u: + { + float4x3 _167 = rayQuery.CommittedWorldToObject4x3(); + _mat4x3 = _167; + _mat3x4 = transpose(_mat4x3); + bool _170 = rayQuery.CommittedTriangleFrontFace(); + if (_170) + { + doSomething(); + } + float2 _174 = rayQuery.CommittedTriangleBarycentrics(); + if (_174.y == 0.0f) + { + doSomething(); + } + break; + } + case 2u: + { + int _182 = rayQuery.CommittedGeometryIndex(); + if (_182 > 0) + { + doSomething(); + } + int _187 = rayQuery.CommittedInstanceIndex(); + if (_187 > 0) + { + doSomething(); + } + int _192 = rayQuery.CommittedInstanceID(); + if (_192 > 0) + { + doSomething(); + } + float3 _197 = rayQuery.CommittedObjectRayDirection(); + if (_197.z > 0.0f) + { + doSomething(); + } + float3 _204 = rayQuery.CommittedObjectRayOrigin(); + if (_204.x > 0.0f) + { + doSomething(); + } + int _210 = rayQuery.CommittedPrimitiveIndex(); + if (_210 > 0) + { + doSomething(); + } + float _215 = rayQuery.CommittedRayT(); + if (_215 > 0.0f) + { + doSomething(); + } + break; + } + } + if (_mat3x4[0].x == _mat4x3[0].x) + { + doSomething(); + } + uint _230 = rayQuery.RayFlags(); + if (_230 > 256u) + { + doSomething(); + } + float _236 = rayQuery.RayTMin(); + if (_236 > 0.0f) + { + doSomething(); + } + float3 _242 = rayQuery.WorldRayOrigin(); + float3 o = _242; + float3 _244 = rayQuery.WorldRayDirection(); + float3 d = _244; + if (o.x == d.z) + { + doSomething(); + } +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..30ac03f84f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/rmw-matrix.comp @@ -0,0 +1,22 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _11 : register(u0); + +void comp_main() +{ + _11.Store(0, asuint(asfloat(_11.Load(0)) * asfloat(_11.Load(96)))); + _11.Store4(16, asuint(asfloat(_11.Load4(16)) * asfloat(_11.Load4(112)))); + float4x4 _35 = asfloat(uint4x4(_11.Load4(128), _11.Load4(144), _11.Load4(160), _11.Load4(176))); + float4x4 _37 = asfloat(uint4x4(_11.Load4(32), _11.Load4(48), _11.Load4(64), _11.Load4(80))); + float4x4 _38 = mul(_35, _37); + _11.Store4(32, asuint(_38[0])); + _11.Store4(48, asuint(_38[1])); + _11.Store4(64, asuint(_38[2])); + _11.Store4(80, asuint(_38[3])); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/rwbuffer-matrix.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/rwbuffer-matrix.comp new file mode 100644 index 0000000000..197c9a9513 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/rwbuffer-matrix.comp @@ -0,0 +1,139 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _28 : register(u0); +cbuffer UBO : register(b1) +{ + int _68_index0 : packoffset(c0); + int _68_index1 : packoffset(c0.y); +}; + + +void row_to_col() +{ + float4x4 _55 = asfloat(uint4x4(_28.Load(64), _28.Load(80), _28.Load(96), _28.Load(112), _28.Load(68), _28.Load(84), _28.Load(100), _28.Load(116), _28.Load(72), _28.Load(88), _28.Load(104), _28.Load(120), _28.Load(76), _28.Load(92), _28.Load(108), _28.Load(124))); + _28.Store4(0, asuint(_55[0])); + _28.Store4(16, asuint(_55[1])); + _28.Store4(32, asuint(_55[2])); + _28.Store4(48, asuint(_55[3])); + float2x2 _58 = asfloat(uint2x2(_28.Load(144), _28.Load(152), _28.Load(148), _28.Load(156))); + _28.Store2(128, asuint(_58[0])); + _28.Store2(136, asuint(_58[1])); + float2x3 _61 = asfloat(uint2x3(_28.Load(192), _28.Load(200), _28.Load(208), _28.Load(196), _28.Load(204), _28.Load(212))); + _28.Store3(160, asuint(_61[0])); + _28.Store3(176, asuint(_61[1])); + float3x2 _64 = asfloat(uint3x2(_28.Load(240), _28.Load(256), _28.Load(244), _28.Load(260), _28.Load(248), _28.Load(264))); + _28.Store2(216, asuint(_64[0])); + _28.Store2(224, asuint(_64[1])); + _28.Store2(232, asuint(_64[2])); +} + +void col_to_row() +{ + float4x4 _34 = asfloat(uint4x4(_28.Load4(0), _28.Load4(16), _28.Load4(32), _28.Load4(48))); + _28.Store(64, asuint(_34[0].x)); + _28.Store(68, asuint(_34[1].x)); + _28.Store(72, asuint(_34[2].x)); + _28.Store(76, asuint(_34[3].x)); + _28.Store(80, asuint(_34[0].y)); + _28.Store(84, asuint(_34[1].y)); + _28.Store(88, asuint(_34[2].y)); + _28.Store(92, asuint(_34[3].y)); + _28.Store(96, asuint(_34[0].z)); + _28.Store(100, asuint(_34[1].z)); + _28.Store(104, asuint(_34[2].z)); + _28.Store(108, asuint(_34[3].z)); + _28.Store(112, asuint(_34[0].w)); + _28.Store(116, asuint(_34[1].w)); + _28.Store(120, asuint(_34[2].w)); + _28.Store(124, asuint(_34[3].w)); + float2x2 _40 = asfloat(uint2x2(_28.Load2(128), _28.Load2(136))); + _28.Store(144, asuint(_40[0].x)); + _28.Store(148, asuint(_40[1].x)); + _28.Store(152, asuint(_40[0].y)); + _28.Store(156, asuint(_40[1].y)); + float2x3 _46 = asfloat(uint2x3(_28.Load3(160), _28.Load3(176))); + _28.Store(192, asuint(_46[0].x)); + _28.Store(196, asuint(_46[1].x)); + _28.Store(200, asuint(_46[0].y)); + _28.Store(204, asuint(_46[1].y)); + _28.Store(208, asuint(_46[0].z)); + _28.Store(212, asuint(_46[1].z)); + float3x2 _52 = asfloat(uint3x2(_28.Load2(216), _28.Load2(224), _28.Load2(232))); + _28.Store(240, asuint(_52[0].x)); + _28.Store(244, asuint(_52[1].x)); + _28.Store(248, asuint(_52[2].x)); + _28.Store(256, asuint(_52[0].y)); + _28.Store(260, asuint(_52[1].y)); + _28.Store(264, asuint(_52[2].y)); +} + +void write_dynamic_index_row() +{ + _28.Store(_68_index0 * 4 + _68_index1 * 16 + 64, asuint(1.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 8 + 144, asuint(2.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 8 + 192, asuint(3.0f)); + _28.Store(_68_index0 * 4 + _68_index1 * 16 + 240, asuint(4.0f)); + _28.Store(_68_index0 * 4 + 64, asuint(1.0f.x)); + _28.Store(_68_index0 * 4 + 80, asuint(1.0f.xxxx.y)); + _28.Store(_68_index0 * 4 + 96, asuint(1.0f.xxxx.z)); + _28.Store(_68_index0 * 4 + 112, asuint(1.0f.xxxx.w)); + _28.Store(_68_index0 * 4 + 144, asuint(2.0f.x)); + _28.Store(_68_index0 * 4 + 152, asuint(2.0f.xx.y)); + _28.Store(_68_index0 * 4 + 192, asuint(3.0f.x)); + _28.Store(_68_index0 * 4 + 200, asuint(3.0f.xxx.y)); + _28.Store(_68_index0 * 4 + 208, asuint(3.0f.xxx.z)); + _28.Store(_68_index0 * 4 + 240, asuint(4.0f.x)); + _28.Store(_68_index0 * 4 + 256, asuint(4.0f.xx.y)); +} + +void write_dynamic_index_col() +{ + _28.Store(_68_index0 * 16 + _68_index1 * 4 + 0, asuint(1.0f)); + _28.Store(_68_index0 * 8 + _68_index1 * 4 + 128, asuint(2.0f)); + _28.Store(_68_index0 * 16 + _68_index1 * 4 + 160, asuint(3.0f)); + _28.Store(_68_index0 * 8 + _68_index1 * 4 + 216, asuint(4.0f)); + _28.Store4(_68_index0 * 16 + 0, asuint(1.0f.xxxx)); + _28.Store2(_68_index0 * 8 + 128, asuint(2.0f.xx)); + _28.Store3(_68_index0 * 16 + 160, asuint(3.0f.xxx)); + _28.Store2(_68_index0 * 8 + 216, asuint(4.0f.xx)); +} + +void read_dynamic_index_row() +{ + float a0 = asfloat(_28.Load(_68_index0 * 4 + _68_index1 * 16 + 64)); + float a1 = asfloat(_28.Load(_68_index0 * 4 + _68_index1 * 8 + 144)); + float a2 = asfloat(_28.Load(_68_index0 * 4 + _68_index1 * 8 + 192)); + float a3 = asfloat(_28.Load(_68_index0 * 4 + _68_index1 * 16 + 240)); + float4 v0 = asfloat(uint4(_28.Load(_68_index0 * 4 + 64), _28.Load(_68_index0 * 4 + 80), _28.Load(_68_index0 * 4 + 96), _28.Load(_68_index0 * 4 + 112))); + float2 v1 = asfloat(uint2(_28.Load(_68_index0 * 4 + 144), _28.Load(_68_index0 * 4 + 152))); + float3 v2 = asfloat(uint3(_28.Load(_68_index0 * 4 + 192), _28.Load(_68_index0 * 4 + 200), _28.Load(_68_index0 * 4 + 208))); + float2 v3 = asfloat(uint2(_28.Load(_68_index0 * 4 + 240), _28.Load(_68_index0 * 4 + 256))); +} + +void read_dynamic_index_col() +{ + float a0 = asfloat(_28.Load(_68_index0 * 16 + _68_index1 * 4 + 0)); + float a1 = asfloat(_28.Load(_68_index0 * 8 + _68_index1 * 4 + 128)); + float a2 = asfloat(_28.Load(_68_index0 * 16 + _68_index1 * 4 + 160)); + float a3 = asfloat(_28.Load(_68_index0 * 8 + _68_index1 * 4 + 216)); + float4 v0 = asfloat(_28.Load4(_68_index0 * 16 + 0)); + float2 v1 = asfloat(_28.Load2(_68_index0 * 8 + 128)); + float3 v2 = asfloat(_28.Load3(_68_index0 * 16 + 160)); + float2 v3 = asfloat(_28.Load2(_68_index0 * 8 + 216)); +} + +void comp_main() +{ + row_to_col(); + col_to_row(); + write_dynamic_index_row(); + write_dynamic_index_col(); + read_dynamic_index_row(); + read_dynamic_index_col(); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..db2bbe9698 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,16 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _9 : register(u0); + +void comp_main() +{ + _9.Store(8, asuint(distance(asfloat(_9.Load(0)), asfloat(_9.Load(4))))); + _9.Store(12, asuint(length(asfloat(_9.Load(0))))); + _9.Store(16, asuint(sign(asfloat(_9.Load(0))))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/shared.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/shared.comp new file mode 100644 index 0000000000..5d12900382 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/shared.comp @@ -0,0 +1,31 @@ +static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u); + +ByteAddressBuffer _22 : register(t0); +RWByteAddressBuffer _44 : register(u1); + +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +groupshared float sShared[4]; + +void comp_main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = asfloat(_22.Load(ident * 4 + 0)); + sShared[gl_LocalInvocationIndex] = idata; + GroupMemoryBarrierWithGroupSync(); + _44.Store(ident * 4 + 0, asuint(sShared[(4u - gl_LocalInvocationIndex) - 1u])); +} + +[numthreads(4, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..4e7c5e6167 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,51 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +static const int c = SPIRV_CROSS_CONSTANT_ID_2; +static const int d = (c + 50); +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 400 +#endif +static const int e = SPIRV_CROSS_CONSTANT_ID_3; +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _22 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + _22.Store(gl_GlobalInvocationID.x * 4 + 2800, uint(int(_22.Load(gl_GlobalInvocationID.x * 4 + 2800)) + (int(_22.Load(gl_GlobalInvocationID.x * 4 + 2400)) + e))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..55ebf32bb6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,43 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +static const uint _26 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +static const uint _27 = SPIRV_CROSS_CONSTANT_ID_10; +static const uint3 gl_WorkGroupSize = uint3(_27, 20u, 1u); +static const uint _32 = gl_WorkGroupSize.x; +static const uint _33 = (_26 + _32); +static const uint _34 = gl_WorkGroupSize.y; +static const uint _35 = (_33 + _34); +static const int _42 = (1 - a); + +RWByteAddressBuffer _23 : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + int spec_const_array_size[b]; + spec_const_array_size[0] = 10; + spec_const_array_size[1] = 40; + spec_const_array_size[a] = a; + _23.Store((_35 + gl_GlobalInvocationID.x) * 4 + 0, uint(b + spec_const_array_size[_42])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array-length.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..82657cacfc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array-length.comp @@ -0,0 +1,17 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer _11 : register(u1); + +void comp_main() +{ + uint _14; + _11.GetDimensions(_14); + _14 = (_14 - 16) / 16; + _11.Store(0, uint(int(_14))); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array.comp b/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array.comp new file mode 100644 index 0000000000..dab20325b0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/comp/ssbo-array.comp @@ -0,0 +1,13 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer ssbo0 : register(u0); + +void comp_main() +{ +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/array.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/array.flatten.vert new file mode 100644 index 0000000000..948a198e6a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/array.flatten.vert @@ -0,0 +1,30 @@ +uniform float4 UBO[56]; + +static float4 gl_Position; +static float4 aVertex; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4 a4 = UBO[23]; + float4 offset = (UBO[50] + UBO[45]) + UBO[54].x.xxxx; + gl_Position = (mul(aVertex, float4x4(UBO[40], UBO[41], UBO[42], UBO[43])) + UBO[55]) + offset; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..778acd4803 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/basic.flatten.vert @@ -0,0 +1,35 @@ +uniform float4 UBO[4]; + +static float4 gl_Position; +static float4 aVertex; +static float3 vNormal; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 vNormal : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vNormal = aNormal; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vNormal = vNormal; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/copy.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/copy.flatten.vert new file mode 100644 index 0000000000..f85c890b11 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/copy.flatten.vert @@ -0,0 +1,53 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + Light light; + for (int i = 0; i < 4; i++) + { + Light _51 = {UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]}; + Light _52 = _51; + light.Position = _52.Position; + light.Radius = _52.Radius; + light.Color = _52.Color; + float3 L = aVertex.xyz - light.Position; + vColor += ((UBO[i * 2 + 5] * clamp(1.0f - (length(L) / light.Radius), 0.0f, 1.0f)) * dot(aNormal, normalize(L))); + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/dynamic.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..787eefcdbe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/dynamic.flatten.vert @@ -0,0 +1,47 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + for (int i = 0; i < 4; i++) + { + float3 L = aVertex.xyz - UBO[i * 2 + 4].xyz; + vColor += ((UBO[i * 2 + 5] * clamp(1.0f - (length(L) / UBO[i * 2 + 4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(L))); + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..59ec525f41 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,29 @@ +uniform float4 UBO[4]; + +static float3 FragColor; +static float3 vNormal; + +struct SPIRV_Cross_Input +{ + nointerpolation float3 vNormal : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4x4 _19 = float4x4(UBO[0], UBO[1], UBO[2], UBO[3]); + FragColor = mul(vNormal, float3x3(_19[0].xyz, _19[1].xyz, _19[2].xyz)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vNormal = stage_input.vNormal; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..b69a72dc11 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/matrixindex.flatten.vert @@ -0,0 +1,41 @@ +uniform float4 UBO[14]; + +static float4 gl_Position; +static float4 oA; +static float4 oB; +static float4 oC; +static float4 oD; +static float4 oE; + +struct SPIRV_Cross_Output +{ + float4 oA : TEXCOORD0; + float4 oB : TEXCOORD1; + float4 oC : TEXCOORD2; + float4 oD : TEXCOORD3; + float4 oE : TEXCOORD4; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 0.0f.xxxx; + oA = UBO[1]; + oB = float4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y); + oC = UBO[9]; + oD = float4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x); + oE = float4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.oA = oA; + stage_output.oB = oB; + stage_output.oC = oC; + stage_output.oD = oD; + stage_output.oE = oE; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..f21f05ec44 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/multiindex.flatten.vert @@ -0,0 +1,28 @@ +uniform float4 UBO[15]; + +static float4 gl_Position; +static int2 aIndex; + +struct SPIRV_Cross_Input +{ + int2 aIndex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aIndex = stage_input.aIndex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..5bfb4dc065 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/push-constant.flatten.vert @@ -0,0 +1,35 @@ +uniform float4 PushMe[6]; + +static float4 gl_Position; +static float4 Pos; +static float2 vRot; +static float2 Rot; + +struct SPIRV_Cross_Input +{ + float2 Rot : TEXCOORD0; + float4 Pos : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float2 vRot : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(Pos, float4x4(PushMe[0], PushMe[1], PushMe[2], PushMe[3])); + vRot = mul(Rot, float2x2(PushMe[4].xy, PushMe[4].zw)) + PushMe[5].z.xx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Pos = stage_input.Pos; + Rot = stage_input.Rot; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vRot = vRot; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..801def3b43 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/rowmajor.flatten.vert @@ -0,0 +1,29 @@ +uniform float4 UBO[12]; + +static float4 gl_Position; +static float4 aVertex; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float2 v = mul(transpose(float4x2(UBO[8].xy, UBO[9].xy, UBO[10].xy, UBO[11].xy)), aVertex); + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])) + mul(aVertex, transpose(float4x4(UBO[4], UBO[5], UBO[6], UBO[7]))); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..9b97bf59e2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.flatten.vert @@ -0,0 +1,44 @@ +struct Light +{ + float3 Position; + float Radius; + float4 Color; +}; + +uniform float4 UBO[6]; + +static float4 gl_Position; +static float4 aVertex; +static float4 vColor; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 vColor : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, float4x4(UBO[0], UBO[1], UBO[2], UBO[3])); + vColor = 0.0f.xxxx; + float3 L = aVertex.xyz - UBO[4].xyz; + vColor += ((UBO[5] * clamp(1.0f - (length(L) / UBO[4].w), 0.0f, 1.0f)) * dot(aNormal, normalize(L))); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..39b0a80802 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,48 @@ +struct Foo +{ + column_major float3x4 MVP0; + column_major float3x4 MVP1; +}; + +uniform float4 UBO[8]; + +static float4 v0; +static float4 v1; +static float3 V0; +static float3 V1; + +struct SPIRV_Cross_Input +{ + float4 v0 : TEXCOORD0; + float4 v1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 V0 : TEXCOORD0; + float3 V1 : TEXCOORD1; +}; + +void vert_main() +{ + Foo _19 = {transpose(float4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(float4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))}; + Foo _20 = _19; + Foo f; + f.MVP0 = _20.MVP0; + f.MVP1 = _20.MVP1; + float3 a = mul(f.MVP0, v0); + float3 b = mul(f.MVP1, v1); + V0 = a; + V1 = b; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v0 = stage_input.v0; + v1 = stage_input.v1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.V0 = V0; + stage_output.V1 = V1; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/shaders-hlsl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..1091a17e99 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/swizzle.flatten.vert @@ -0,0 +1,45 @@ +uniform float4 UBO[8]; + +static float4 gl_Position; +static float4 oA; +static float4 oB; +static float4 oC; +static float4 oD; +static float4 oE; +static float4 oF; + +struct SPIRV_Cross_Output +{ + float4 oA : TEXCOORD0; + float4 oB : TEXCOORD1; + float4 oC : TEXCOORD2; + float4 oD : TEXCOORD3; + float4 oE : TEXCOORD4; + float4 oF : TEXCOORD5; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 0.0f.xxxx; + oA = UBO[0]; + oB = float4(UBO[1].xy, UBO[1].zw); + oC = float4(UBO[2].x, UBO[3].xyz); + oD = float4(UBO[4].xyz, UBO[4].w); + oE = float4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w); + oF = float4(UBO[6].x, UBO[6].zw, UBO[7].x); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.oA = oA; + stage_output.oB = oB; + stage_output.oC = oC; + stage_output.oD = oD; + stage_output.oE = oE; + stage_output.oF = oF; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/flatten/types.flatten.frag b/third_party/spirv-cross/reference/shaders-hlsl/flatten/types.flatten.frag new file mode 100644 index 0000000000..feb0b36096 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/flatten/types.flatten.frag @@ -0,0 +1,23 @@ +uniform int4 UBO1[2]; +uniform uint4 UBO2[2]; +uniform float4 UBO0[2]; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = ((((float4(UBO1[0]) + float4(UBO1[1])) + float4(UBO2[0])) + float4(UBO2[1])) + UBO0[0]) + UBO0[1]; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..407fa2bda4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,30 @@ +static const float _17[5] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + +static float4 FragColor; +static float4 v0; + +struct SPIRV_Cross_Input +{ + float4 v0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + for (int i = 0; i < 4; i++, FragColor += _17[i].xxxx) + { + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + v0 = stage_input.v0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm30.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm30.frag new file mode 100644 index 0000000000..d3697d650f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm30.frag @@ -0,0 +1,26 @@ +static float3 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + FragColor = vColor.xyz; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor, 0.0); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm50.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm50.frag new file mode 100644 index 0000000000..52f6fed6c1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic-color-3comp.sm50.frag @@ -0,0 +1,26 @@ +static float3 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float3 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vColor.xyz; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/basic.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic.frag new file mode 100644 index 0000000000..6d067041c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/basic.frag @@ -0,0 +1,32 @@ +Texture2D uTex : register(t0); +SamplerState _uTex_sampler : register(s0); + +static float4 FragColor; +static float4 vColor; +static float2 vTex; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; + float2 vTex : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vColor * uTex.Sample(_uTex_sampler, vTex); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/bit-conversions.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/bit-conversions.frag new file mode 100644 index 0000000000..2ed359bfc7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/bit-conversions.frag @@ -0,0 +1,27 @@ +static float2 value; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 value : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int i = asint(value.x); + FragColor = float4(1.0f, 0.0f, asfloat(i), 1.0f); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + value = stage_input.value; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/boolean-mix.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/boolean-mix.frag new file mode 100644 index 0000000000..f3e84898d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/boolean-mix.frag @@ -0,0 +1,27 @@ +static float2 FragColor; +static float2 x0; + +struct SPIRV_Cross_Input +{ + float2 x0 : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float2 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool2 _27 = (x0.x > x0.y).xx; + FragColor = float2(_27.x ? float2(1.0f, 0.0f).x : float2(0.0f, 1.0f).x, _27.y ? float2(1.0f, 0.0f).y : float2(0.0f, 1.0f).y); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + x0 = stage_input.x0; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/builtins.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/builtins.frag new file mode 100644 index 0000000000..8432c42f80 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/builtins.frag @@ -0,0 +1,34 @@ +static float4 gl_FragCoord; +static float gl_FragDepth; +static float4 FragColor; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + float gl_FragDepth : SV_Depth; +}; + +void frag_main() +{ + FragColor = gl_FragCoord + vColor; + gl_FragDepth = 0.5f; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vColor = stage_input.vColor; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/bvec-operations.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/bvec-operations.frag new file mode 100644 index 0000000000..2398d8c6af --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/bvec-operations.frag @@ -0,0 +1,29 @@ +static float2 value; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 value : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool2 _25 = bool2(value.x == 0.0f, value.y == 0.0f); + bool2 bools1 = bool2(!_25.x, !_25.y); + bool2 bools2 = bool2(value.x <= float2(1.5f, 0.5f).x, value.y <= float2(1.5f, 0.5f).y); + FragColor = float4(1.0f, 0.0f, float(bools1.x), float(bools2.x)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + value = stage_input.value; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/clip-cull-distance.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/clip-cull-distance.frag new file mode 100644 index 0000000000..52f1ac30b6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/clip-cull-distance.frag @@ -0,0 +1,30 @@ +static float gl_ClipDistance[2]; +static float gl_CullDistance[1]; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float2 gl_ClipDistance0 : SV_ClipDistance0; + float gl_CullDistance0 : SV_CullDistance0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = (gl_ClipDistance[0] + gl_CullDistance[0]) + gl_ClipDistance[1]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_ClipDistance[0] = stage_input.gl_ClipDistance0.x; + gl_ClipDistance[1] = stage_input.gl_ClipDistance0.y; + gl_CullDistance[0] = stage_input.gl_CullDistance0.x; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-parameter.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-parameter.frag new file mode 100644 index 0000000000..66330805f1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-parameter.frag @@ -0,0 +1,44 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); +Texture2D uSamplerShadow : register(t1); +SamplerComparisonState _uSamplerShadow_sampler : register(s1); + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float4 samp2(Texture2D s, SamplerState _s_sampler) +{ + return s.Sample(_s_sampler, 1.0f.xx) + s.Load(int3(int2(10, 10), 0)); +} + +float4 samp3(Texture2D s, SamplerState _s_sampler) +{ + return samp2(s, _s_sampler); +} + +float samp4(Texture2D s, SamplerComparisonState _s_sampler) +{ + return s.SampleCmp(_s_sampler, 1.0f.xxx.xy, 1.0f); +} + +float samp(Texture2D s0, SamplerState _s0_sampler, Texture2D s1, SamplerComparisonState _s1_sampler) +{ + return samp3(s0, _s0_sampler).x + samp4(s1, _s1_sampler); +} + +void frag_main() +{ + FragColor = samp(uSampler, _uSampler_sampler, uSamplerShadow, _uSamplerShadow_sampler); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-shadow.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-shadow.frag new file mode 100644 index 0000000000..8d48008d38 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/combined-texture-sampler-shadow.frag @@ -0,0 +1,40 @@ +Texture2D uDepth : register(t2); +SamplerComparisonState uSampler : register(s0); +SamplerState uSampler1 : register(s1); + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float samp2(Texture2D t, SamplerComparisonState s) +{ + return t.SampleCmp(s, 1.0f.xxx.xy, 1.0f); +} + +float samp3(Texture2D t, SamplerState s) +{ + return t.Sample(s, 1.0f.xx).x; +} + +float samp(Texture2D t, SamplerComparisonState s, SamplerState s1) +{ + float r0 = samp2(t, s); + float r1 = samp3(t, s1); + return r0 + r1; +} + +void frag_main() +{ + FragColor = samp(uDepth, uSampler, uSampler1); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..b2f995484d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,41 @@ +RWByteAddressBuffer _34 : register(u0); +Texture2D Buf : register(t1); +SamplerState _Buf_sampler : register(s1); + +static float4 gl_FragCoord; +static int vIn; +static int vIn2; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIn : TEXCOORD0; + nointerpolation int vIn2 : TEXCOORD1; + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + int4 coords = Buf.Load(int3(int2(gl_FragCoord.xy), 0)); + float4 foo = asfloat(_34.Load4((coords.x % 16) * 16 + 0)); + int c = vIn * vIn; + int d = vIn2 * vIn2; + FragColor = (foo + foo) + asfloat(_34.Load4((c + d) * 16 + 0)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vIn = stage_input.vIn; + vIn2 = stage_input.vIn2; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/constant-composites.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..306ca5cadb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,38 @@ +struct Foo +{ + float a; + float b; +}; + +static const float _16[4] = { 1.0f, 4.0f, 3.0f, 2.0f }; +static const Foo _24 = { 10.0f, 20.0f }; +static const Foo _27 = { 30.0f, 40.0f }; +static const Foo _28[2] = { { 10.0f, 20.0f }, { 30.0f, 40.0f } }; + +static float4 FragColor; +static int _line; + +struct SPIRV_Cross_Input +{ + nointerpolation int _line : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _16[_line].xxxx; + FragColor += (_28[_line].a * _28[1 - _line].a).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _line = stage_input._line; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..6a31ce0488 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,56 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); + +static float4 FragColor; +static float4 vInput; + +struct SPIRV_Cross_Input +{ + float4 vInput : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = vInput; + float4 t = uSampler.Sample(_uSampler_sampler, vInput.xy); + float4 d0 = ddx(vInput); + float4 d1 = ddy(vInput); + float4 d2 = fwidth(vInput); + float4 d3 = ddx_coarse(vInput); + float4 d4 = ddy_coarse(vInput); + float4 d5 = fwidth(vInput); + float4 d6 = ddx_fine(vInput); + float4 d7 = ddy_fine(vInput); + float4 d8 = fwidth(vInput); + float _56_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vInput.zw); + float2 _56 = _56_tmp.xx; + float2 lod = _56; + if (vInput.y > 10.0f) + { + FragColor += t; + FragColor += d0; + FragColor += d1; + FragColor += d2; + FragColor += d3; + FragColor += d4; + FragColor += d5; + FragColor += d6; + FragColor += d7; + FragColor += d8; + FragColor += lod.xyxy; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput = stage_input.vInput; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/demote-to-helper.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/demote-to-helper.frag new file mode 100644 index 0000000000..743a4228ba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/demote-to-helper.frag @@ -0,0 +1,9 @@ +void frag_main() +{ + discard; +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-greater-than.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..b9f50db00a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-greater-than.frag @@ -0,0 +1,19 @@ +static float gl_FragDepth; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_DepthGreaterEqual; +}; + +void frag_main() +{ + gl_FragDepth = 0.5f; +} + +[earlydepthstencil] +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-less-than.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-less-than.frag new file mode 100644 index 0000000000..a702fd9f8e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/depth-less-than.frag @@ -0,0 +1,19 @@ +static float gl_FragDepth; +struct SPIRV_Cross_Output +{ + float gl_FragDepth : SV_DepthLessEqual; +}; + +void frag_main() +{ + gl_FragDepth = 0.5f; +} + +[earlydepthstencil] +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_FragDepth = gl_FragDepth; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/dual-source-blending.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..961e800010 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/dual-source-blending.frag @@ -0,0 +1,23 @@ +static float4 FragColor0; +static float4 FragColor1; + +struct SPIRV_Cross_Output +{ + float4 FragColor0 : SV_Target0; + float4 FragColor1 : SV_Target1; +}; + +void frag_main() +{ + FragColor0 = 1.0f.xxxx; + FragColor1 = 2.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor0 = FragColor0; + stage_output.FragColor1 = FragColor1; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/early-fragment-test.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/early-fragment-test.frag new file mode 100644 index 0000000000..ae2569d5cf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/early-fragment-test.frag @@ -0,0 +1,9 @@ +void frag_main() +{ +} + +[earlydepthstencil] +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..12e1e7f5fd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,44 @@ +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = 0.0f.xxxx; + int i = 0; + int _36; + for (;;) + { + if (i < 3) + { + int a = i; + FragColor[a] += float(i); + if (false) + { + _36 = 1; + } + else + { + int _41 = i; + i = _41 + 1; + _36 = _41; + } + continue; + } + else + { + break; + } + } +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/fp16-packing.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/fp16-packing.frag new file mode 100644 index 0000000000..54b91e2aa5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/fp16-packing.frag @@ -0,0 +1,44 @@ +static float2 FP32Out; +static uint FP16; +static uint FP16Out; +static float2 FP32; + +struct SPIRV_Cross_Input +{ + nointerpolation uint FP16 : TEXCOORD0; + nointerpolation float2 FP32 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float2 FP32Out : SV_Target0; + uint FP16Out : SV_Target1; +}; + +uint spvPackHalf2x16(float2 value) +{ + uint2 Packed = f32tof16(value); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackHalf2x16(uint value) +{ + return f16tof32(uint2(value & 0xffff, value >> 16)); +} + +void frag_main() +{ + FP32Out = spvUnpackHalf2x16(FP16); + FP16Out = spvPackHalf2x16(FP32); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + FP16 = stage_input.FP16; + FP32 = stage_input.FP32; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FP32Out = FP32Out; + stage_output.FP16Out = FP16Out; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/front-facing.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/front-facing.frag new file mode 100644 index 0000000000..4ed09a2bd1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/front-facing.frag @@ -0,0 +1,39 @@ +static bool gl_FrontFacing; +static float4 FragColor; +static float4 vA; +static float4 vB; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; + bool gl_FrontFacing : SV_IsFrontFace; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + if (gl_FrontFacing) + { + FragColor = vA; + } + else + { + FragColor = vB; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FrontFacing = stage_input.gl_FrontFacing; + vA = stage_input.vA; + vB = stage_input.vB; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/hyperbolic.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/hyperbolic.frag new file mode 100644 index 0000000000..ac6febb45c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/hyperbolic.frag @@ -0,0 +1,65 @@ +static float4 result; +static float scalar; +static float3 _vector; + +struct SPIRV_Cross_Input +{ + float scalar : TEXCOORD0; + float3 _vector : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 result : SV_Target0; +}; + +void frag_main() +{ + result = 1.0f.xxxx; + result.w *= sinh(scalar); + result.w *= cosh(scalar); + result.w *= tanh(scalar); + result.w *= log(scalar + sqrt(scalar * scalar + 1.0f)); + result.w *= log(scalar + sqrt(scalar * scalar - 1.0f)); + result.w *= (log((1.0f + scalar) / (1.0f - scalar)) * 0.5f); + float4 _58 = result; + float3 _60 = _58.xyz * sinh(_vector); + result.x = _60.x; + result.y = _60.y; + result.z = _60.z; + float4 _72 = result; + float3 _74 = _72.xyz * cosh(_vector); + result.x = _74.x; + result.y = _74.y; + result.z = _74.z; + float4 _83 = result; + float3 _85 = _83.xyz * tanh(_vector); + result.x = _85.x; + result.y = _85.y; + result.z = _85.z; + float4 _94 = result; + float3 _96 = _94.xyz * log(_vector + sqrt(_vector * _vector + 1.0f)); + result.x = _96.x; + result.y = _96.y; + result.z = _96.z; + float4 _105 = result; + float3 _107 = _105.xyz * log(_vector + sqrt(_vector * _vector - 1.0f)); + result.x = _107.x; + result.y = _107.y; + result.z = _107.z; + float4 _116 = result; + float3 _118 = _116.xyz * (log((1.0f + _vector) / (1.0f - _vector)) * 0.5f); + result.x = _118.x; + result.y = _118.y; + result.z = _118.z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + scalar = stage_input.scalar; + _vector = stage_input._vector; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.result = result; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-selective.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-selective.frag new file mode 100644 index 0000000000..69fe83fd28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-selective.frag @@ -0,0 +1,146 @@ +Texture1D uSampler1DUint : register(t0); +SamplerState _uSampler1DUint_sampler : register(s0); +Texture1D uSampler1DInt : register(t0); +SamplerState _uSampler1DInt_sampler : register(s0); +Texture1D uSampler1DFloat : register(t0); +SamplerState _uSampler1DFloat_sampler : register(s0); +Texture2DArray uSampler2DArray : register(t2); +SamplerState _uSampler2DArray_sampler : register(s2); +Texture3D uSampler3D : register(t3); +SamplerState _uSampler3D_sampler : register(s3); +TextureCube uSamplerCube : register(t4); +SamplerState _uSamplerCube_sampler : register(s4); +TextureCubeArray uSamplerCubeArray : register(t5); +SamplerState _uSamplerCubeArray_sampler : register(s5); +Buffer uSamplerBuffer : register(t6); +Texture2DMS uSamplerMS : register(t7); +SamplerState _uSamplerMS_sampler : register(s7); +Texture2DMSArray uSamplerMSArray : register(t8); +SamplerState _uSamplerMSArray_sampler : register(s8); +Texture2D uSampler2D : register(t1); +SamplerState _uSampler2D_sampler : register(s1); + +uint spvTextureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} + +uint spvTextureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} + +uint spvTextureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(Texture2DArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint3 spvTextureSize(Texture3D Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint spvTextureSize(Buffer Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint2 spvTextureSize(TextureCube Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(TextureCubeArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint2 spvTextureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(Texture2DMSArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z, Param); + return ret; +} + +void frag_main() +{ + uint _17_dummy_parameter; + int a = int(spvTextureSize(uSampler1DUint, uint(0), _17_dummy_parameter)); + uint _24_dummy_parameter; + a = int(spvTextureSize(uSampler1DInt, uint(0), _24_dummy_parameter)); + uint _32_dummy_parameter; + a = int(spvTextureSize(uSampler1DFloat, uint(0), _32_dummy_parameter)); + uint _42_dummy_parameter; + int3 c = int3(spvTextureSize(uSampler2DArray, uint(0), _42_dummy_parameter)); + uint _50_dummy_parameter; + int3 d = int3(spvTextureSize(uSampler3D, uint(0), _50_dummy_parameter)); + uint _60_dummy_parameter; + int2 e = int2(spvTextureSize(uSamplerCube, uint(0), _60_dummy_parameter)); + uint _68_dummy_parameter; + int3 f = int3(spvTextureSize(uSamplerCubeArray, uint(0), _68_dummy_parameter)); + uint _76_dummy_parameter; + int g = int(spvTextureSize(uSamplerBuffer, 0u, _76_dummy_parameter)); + uint _84_dummy_parameter; + int2 h = int2(spvTextureSize(uSamplerMS, 0u, _84_dummy_parameter)); + uint _92_dummy_parameter; + int3 i = int3(spvTextureSize(uSamplerMSArray, 0u, _92_dummy_parameter)); + int _100; + spvTextureSize(uSampler2D, 0u, _100); + int l1 = int(_100); + int _104; + spvTextureSize(uSampler2DArray, 0u, _104); + int l2 = int(_104); + int _108; + spvTextureSize(uSampler3D, 0u, _108); + int l3 = int(_108); + int _112; + spvTextureSize(uSamplerCube, 0u, _112); + int l4 = int(_112); + int _116; + spvTextureSize(uSamplerMS, 0u, _116); + int s0 = int(_116); + int _120; + spvTextureSize(uSamplerMSArray, 0u, _120); + int s1 = int(_120); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.frag new file mode 100644 index 0000000000..6626ed2f84 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.frag @@ -0,0 +1,64 @@ +RWTexture1D uImage1D : register(u0); +RWTexture2D uImage2D : register(u1); +RWTexture2DArray uImage2DArray : register(u2); +RWTexture3D uImage3D : register(u3); +RWBuffer uImageBuffer : register(u6); + +uint3 spvImageSize(RWTexture2DArray Tex, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z); + Param = 0u; + return ret; +} + +uint2 spvImageSize(RWTexture2D Tex, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y); + Param = 0u; + return ret; +} + +uint spvImageSize(RWTexture1D Tex, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint3 spvImageSize(RWTexture3D Tex, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z); + Param = 0u; + return ret; +} + +uint spvImageSize(RWBuffer Tex, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +void frag_main() +{ + uint _14_dummy_parameter; + int a = int(spvImageSize(uImage1D, _14_dummy_parameter)); + uint _22_dummy_parameter; + int2 b = int2(spvImageSize(uImage2D, _22_dummy_parameter)); + uint _30_dummy_parameter; + int3 c = int3(spvImageSize(uImage2DArray, _30_dummy_parameter)); + uint _36_dummy_parameter; + int3 d = int3(spvImageSize(uImage3D, _36_dummy_parameter)); + uint _42_dummy_parameter; + int e = int(spvImageSize(uImageBuffer, _42_dummy_parameter)); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag new file mode 100644 index 0000000000..1e77c2c911 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag @@ -0,0 +1,63 @@ +RWTexture1D uImage1D : register(u0); +RWTexture2D uImage2D : register(u1); +Texture2DArray uImage2DArray : register(t2); +RWTexture3D uImage3D : register(u3); +RWBuffer uImageBuffer : register(u6); + +uint3 spvTextureSize(Texture2DArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint2 spvImageSize(RWTexture2D Tex, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y); + Param = 0u; + return ret; +} + +uint spvImageSize(RWTexture1D Tex, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint3 spvImageSize(RWTexture3D Tex, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z); + Param = 0u; + return ret; +} + +uint spvImageSize(RWBuffer Tex, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +void frag_main() +{ + uint _14_dummy_parameter; + int a = int(spvImageSize(uImage1D, _14_dummy_parameter)); + uint _22_dummy_parameter; + int2 b = int2(spvImageSize(uImage2D, _22_dummy_parameter)); + uint _30_dummy_parameter; + int3 c = int3(spvTextureSize(uImage2DArray, 0u, _30_dummy_parameter)); + uint _36_dummy_parameter; + int3 d = int3(spvImageSize(uImage3D, _36_dummy_parameter)); + uint _42_dummy_parameter; + int e = int(spvImageSize(uImageBuffer, _42_dummy_parameter)); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query.frag new file mode 100644 index 0000000000..0e4b26baca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/image-query.frag @@ -0,0 +1,132 @@ +Texture1D uSampler1D : register(t0); +SamplerState _uSampler1D_sampler : register(s0); +Texture2D uSampler2D : register(t1); +SamplerState _uSampler2D_sampler : register(s1); +Texture2DArray uSampler2DArray : register(t2); +SamplerState _uSampler2DArray_sampler : register(s2); +Texture3D uSampler3D : register(t3); +SamplerState _uSampler3D_sampler : register(s3); +TextureCube uSamplerCube : register(t4); +SamplerState _uSamplerCube_sampler : register(s4); +TextureCubeArray uSamplerCubeArray : register(t5); +SamplerState _uSamplerCubeArray_sampler : register(s5); +Buffer uSamplerBuffer : register(t6); +Texture2DMS uSamplerMS : register(t7); +SamplerState _uSamplerMS_sampler : register(s7); +Texture2DMSArray uSamplerMSArray : register(t8); +SamplerState _uSamplerMSArray_sampler : register(s8); + +uint spvTextureSize(Texture1D Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(Level, ret.x, Param); + return ret; +} + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(Texture2DArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint3 spvTextureSize(Texture3D Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint spvTextureSize(Buffer Tex, uint Level, out uint Param) +{ + uint ret; + Tex.GetDimensions(ret.x); + Param = 0u; + return ret; +} + +uint2 spvTextureSize(TextureCube Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(TextureCubeArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(Level, ret.x, ret.y, ret.z, Param); + return ret; +} + +uint2 spvTextureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint3 spvTextureSize(Texture2DMSArray Tex, uint Level, out uint Param) +{ + uint3 ret; + Tex.GetDimensions(ret.x, ret.y, ret.z, Param); + return ret; +} + +void frag_main() +{ + uint _17_dummy_parameter; + int a = int(spvTextureSize(uSampler1D, uint(0), _17_dummy_parameter)); + uint _27_dummy_parameter; + int2 b = int2(spvTextureSize(uSampler2D, uint(0), _27_dummy_parameter)); + uint _37_dummy_parameter; + int3 c = int3(spvTextureSize(uSampler2DArray, uint(0), _37_dummy_parameter)); + uint _45_dummy_parameter; + int3 d = int3(spvTextureSize(uSampler3D, uint(0), _45_dummy_parameter)); + uint _53_dummy_parameter; + int2 e = int2(spvTextureSize(uSamplerCube, uint(0), _53_dummy_parameter)); + uint _61_dummy_parameter; + int3 f = int3(spvTextureSize(uSamplerCubeArray, uint(0), _61_dummy_parameter)); + uint _69_dummy_parameter; + int g = int(spvTextureSize(uSamplerBuffer, 0u, _69_dummy_parameter)); + uint _77_dummy_parameter; + int2 h = int2(spvTextureSize(uSamplerMS, 0u, _77_dummy_parameter)); + uint _85_dummy_parameter; + int3 i = int3(spvTextureSize(uSamplerMSArray, 0u, _85_dummy_parameter)); + int _89; + spvTextureSize(uSampler1D, 0u, _89); + int l0 = int(_89); + int _93; + spvTextureSize(uSampler2D, 0u, _93); + int l1 = int(_93); + int _97; + spvTextureSize(uSampler2DArray, 0u, _97); + int l2 = int(_97); + int _101; + spvTextureSize(uSampler3D, 0u, _101); + int l3 = int(_101); + int _105; + spvTextureSize(uSamplerCube, 0u, _105); + int l4 = int(_105); + int _109; + spvTextureSize(uSamplerCubeArray, 0u, _109); + int l5 = int(_109); + int _113; + spvTextureSize(uSamplerMS, 0u, _113); + int s0 = int(_113); + int _117; + spvTextureSize(uSamplerMSArray, 0u, _117); + int s1 = int(_117); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment-ms.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..954fa1a94b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment-ms.frag @@ -0,0 +1,39 @@ +Texture2DMS uSubpass0 : register(t0); +Texture2DMS uSubpass1 : register(t1); + +static float4 gl_FragCoord; +static int gl_SampleID; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; + uint gl_SampleID : SV_SampleIndex; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 load_subpasses(Texture2DMS uInput) +{ + float4 _24 = uInput.Load(int2(gl_FragCoord.xy), gl_SampleID); + return _24; +} + +void frag_main() +{ + FragColor = (uSubpass0.Load(int2(gl_FragCoord.xy), 1) + uSubpass1.Load(int2(gl_FragCoord.xy), 2)) + load_subpasses(uSubpass0); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + gl_SampleID = stage_input.gl_SampleID; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment.frag new file mode 100644 index 0000000000..b0e297c55f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/input-attachment.frag @@ -0,0 +1,35 @@ +Texture2D uSubpass0 : register(t0); +Texture2D uSubpass1 : register(t1); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 load_subpasses(Texture2D uInput) +{ + return uInput.Load(int3(int2(gl_FragCoord.xy), 0)); +} + +void frag_main() +{ + FragColor = uSubpass0.Load(int3(int2(gl_FragCoord.xy), 0)) + load_subpasses(uSubpass1); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/io-block.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/io-block.frag new file mode 100644 index 0000000000..812a44d813 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/io-block.frag @@ -0,0 +1,34 @@ +struct VertexOut +{ + float4 a; + float4 b; +}; + +static float4 FragColor; +static VertexOut _12; + +struct SPIRV_Cross_Input +{ + float4 VertexOut_a : TEXCOORD1; + float4 VertexOut_b : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _12.a + _12.b; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + _12.a = stage_input.VertexOut_a; + _12.b = stage_input.VertexOut_b; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag new file mode 100644 index 0000000000..2af0e513b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag @@ -0,0 +1,32 @@ +uniform sampler2D uSampler; + +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + float2 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + float3 _23 = float3(vUV, 5.0f); + FragColor = tex2Dproj(uSampler, float4(_23.xy, 0.0, _23.z)); + FragColor += tex2Dbias(uSampler, float4(vUV, 0.0, 3.0f)); + FragColor += tex2Dlod(uSampler, float4(vUV, 0.0, 2.0f)); + FragColor += tex2Dgrad(uSampler, vUV, 4.0f.xx, 5.0f.xx); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/lut-promotion.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/lut-promotion.frag new file mode 100644 index 0000000000..d148bc12cb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/lut-promotion.frag @@ -0,0 +1,55 @@ +static const float _16[16] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f }; +static const float4 _60[4] = { 0.0f.xxxx, 1.0f.xxxx, 8.0f.xxxx, 5.0f.xxxx }; +static const float4 _104[4] = { 20.0f.xxxx, 30.0f.xxxx, 50.0f.xxxx, 60.0f.xxxx }; + +static float FragColor; +static int index; + +struct SPIRV_Cross_Input +{ + nointerpolation int index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _16[index]; + if (index < 10) + { + FragColor += _16[index ^ 1]; + } + else + { + FragColor += _16[index & 1]; + } + if (index > 30) + { + FragColor += _60[index & 3].y; + } + else + { + FragColor += _60[index & 1].x; + } + float4 foobar[4] = _60; + if (index > 30) + { + foobar[1].z = 20.0f; + } + FragColor += foobar[index & 3].z; + float4 baz[4] = _60; + baz = _104; + FragColor += baz[index & 3].z; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + index = stage_input.index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/matrix-input.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/matrix-input.frag new file mode 100644 index 0000000000..92d87d396e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/matrix-input.frag @@ -0,0 +1,26 @@ +static float4 FragColor; +static float4x4 m; + +struct SPIRV_Cross_Input +{ + float4x4 m : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = ((m[0] + m[1]) + m[2]) + m[3]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + m = stage_input.m; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/mod.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/mod.frag new file mode 100644 index 0000000000..1da8f21e45 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/mod.frag @@ -0,0 +1,71 @@ +static float4 a4; +static float4 b4; +static float3 a3; +static float3 b3; +static float2 a2; +static float2 b2; +static float a1; +static float b1; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 a4 : TEXCOORD0; + float3 a3 : TEXCOORD1; + float2 a2 : TEXCOORD2; + float a1 : TEXCOORD3; + float4 b4 : TEXCOORD4; + float3 b3 : TEXCOORD5; + float2 b2 : TEXCOORD6; + float b1 : TEXCOORD7; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float mod(float x, float y) +{ + return x - y * floor(x / y); +} + +float2 mod(float2 x, float2 y) +{ + return x - y * floor(x / y); +} + +float3 mod(float3 x, float3 y) +{ + return x - y * floor(x / y); +} + +float4 mod(float4 x, float4 y) +{ + return x - y * floor(x / y); +} + +void frag_main() +{ + float4 m0 = mod(a4, b4); + float3 m1 = mod(a3, b3); + float2 m2 = mod(a2, b2); + float m3 = mod(a1, b1); + FragColor = ((m0 + m1.xyzx) + m2.xyxy) + m3.xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a4 = stage_input.a4; + b4 = stage_input.b4; + a3 = stage_input.a3; + b3 = stage_input.b3; + a2 = stage_input.a2; + b2 = stage_input.b2; + a1 = stage_input.a1; + b1 = stage_input.b1; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/mrt.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/mrt.frag new file mode 100644 index 0000000000..e69e91196a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/mrt.frag @@ -0,0 +1,31 @@ +static float4 RT0; +static float4 RT1; +static float4 RT2; +static float4 RT3; + +struct SPIRV_Cross_Output +{ + float4 RT0 : SV_Target0; + float4 RT1 : SV_Target1; + float4 RT2 : SV_Target2; + float4 RT3 : SV_Target3; +}; + +void frag_main() +{ + RT0 = 1.0f.xxxx; + RT1 = 2.0f.xxxx; + RT2 = 3.0f.xxxx; + RT3 = 4.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.RT0 = RT0; + stage_output.RT1 = RT1; + stage_output.RT2 = RT2; + stage_output.RT3 = RT3; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return.frag new file mode 100644 index 0000000000..3b50282fe0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return.frag @@ -0,0 +1,8 @@ +void frag_main() +{ +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return2.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return2.frag new file mode 100644 index 0000000000..a22ffa7725 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/no-return2.frag @@ -0,0 +1,17 @@ +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vColor : TEXCOORD0; +}; + +void frag_main() +{ + float4 v = vColor; +} + +void main(SPIRV_Cross_Input stage_input) +{ + vColor = stage_input.vColor; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag new file mode 100644 index 0000000000..cd5a6eee94 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag @@ -0,0 +1,121 @@ +struct UBO_1_1 +{ + float4 v[64]; +}; + +ConstantBuffer ubos[] : register(b2, space9); +RWByteAddressBuffer ssbos[] : register(u3, space10); +Texture2D uSamplers[] : register(t0, space0); +SamplerState uSamps[] : register(s1, space3); +Texture2D uCombinedSamplers[] : register(t4, space2); +SamplerState _uCombinedSamplers_sampler[] : register(s4, space2); +Texture2DMS uSamplersMS[] : register(t0, space1); +RWTexture2D uImages[] : register(u5, space7); +RWTexture2D uImagesU32[] : register(u5, space8); + +static int vIndex; +static float4 FragColor; +static float2 vUV; + +struct SPIRV_Cross_Input +{ + nointerpolation int vIndex : TEXCOORD0; + float2 vUV : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +uint2 spvTextureSize(Texture2DMS Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y, Param); + return ret; +} + +uint2 spvImageSize(RWTexture2D Tex, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(ret.x, ret.y); + Param = 0u; + return ret; +} + +void frag_main() +{ + int i = vIndex; + FragColor = uSamplers[NonUniformResourceIndex(i + 10)].Sample(uSamps[NonUniformResourceIndex(i + 40)], vUV); + int _49 = i + 10; + FragColor = uCombinedSamplers[NonUniformResourceIndex(_49)].Sample(_uCombinedSamplers_sampler[NonUniformResourceIndex(_49)], vUV); + int _65 = i + 20; + int _69 = i + 40; + FragColor += ubos[NonUniformResourceIndex(_65)].v[_69]; + int _83 = i + 50; + int _88 = i + 60; + FragColor += asfloat(ssbos[NonUniformResourceIndex(_83)].Load4(_88 * 16 + 16)); + int _96 = i + 60; + int _100 = i + 70; + ssbos[NonUniformResourceIndex(_96)].Store4(_100 * 16 + 16, asuint(20.0f.xxxx)); + int _106 = i + 10; + FragColor = uSamplers[NonUniformResourceIndex(_106)].Load(int3(int2(vUV), 0)); + int _116 = i + 100; + uint _122; + ssbos[_116].InterlockedAdd(0, 100u, _122); + float _136_tmp = uSamplers[NonUniformResourceIndex(i + 10)].CalculateLevelOfDetail(uSamps[NonUniformResourceIndex(i + 40)], vUV); + float2 _136 = _136_tmp.xx; + float2 queried = _136; + int _139 = i + 10; + float _143_tmp = uCombinedSamplers[NonUniformResourceIndex(_139)].CalculateLevelOfDetail(_uCombinedSamplers_sampler[NonUniformResourceIndex(_139)], vUV); + float2 _143 = _143_tmp.xx; + queried += _143; + float4 _147 = FragColor; + float2 _149 = _147.xy + queried; + FragColor.x = _149.x; + FragColor.y = _149.y; + int _157 = i + 20; + int _160; + spvTextureSize(uSamplers[NonUniformResourceIndex(_157)], 0u, _160); + FragColor.x += float(int(_160)); + int _172 = i + 20; + int _176; + spvTextureSize(uSamplersMS[NonUniformResourceIndex(_172)], 0u, _176); + FragColor.y += float(int(_176)); + int _184 = i + 20; + uint _187_dummy_parameter; + float4 _189 = FragColor; + float2 _191 = _189.xy + float2(int2(spvTextureSize(uSamplers[NonUniformResourceIndex(_184)], uint(0), _187_dummy_parameter))); + FragColor.x = _191.x; + FragColor.y = _191.y; + int _202 = i + 50; + FragColor += uImages[NonUniformResourceIndex(_202)][int2(vUV)].xxxx; + int _213 = i + 20; + uint _216_dummy_parameter; + float4 _218 = FragColor; + float2 _220 = _218.xy + float2(int2(spvImageSize(uImages[NonUniformResourceIndex(_213)], _216_dummy_parameter))); + FragColor.x = _220.x; + FragColor.y = _220.y; + int _227 = i + 60; + uImages[NonUniformResourceIndex(_227)][int2(vUV)] = 50.0f.x; + int _240 = i + 70; + uint _248; + InterlockedAdd(uImagesU32[NonUniformResourceIndex(_240)][int2(vUV)], 40u, _248); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/partial-write-preserve.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..bb5b9056e7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/partial-write-preserve.frag @@ -0,0 +1,76 @@ +struct B +{ + float a; + float b; +}; + +static const B _80 = { 10.0f, 20.0f }; + +cbuffer UBO : register(b0) +{ + int _42_some_value : packoffset(c0); +}; + + +void partial_inout(inout float4 x) +{ + x.x = 10.0f; +} + +void complete_inout(out float4 x) +{ + x = 50.0f.xxxx; +} + +void branchy_inout(inout float4 v) +{ + v.y = 20.0f; + if (_42_some_value == 20) + { + v = 50.0f.xxxx; + } +} + +void branchy_inout_2(out float4 v) +{ + if (_42_some_value == 20) + { + v = 50.0f.xxxx; + } + else + { + v = 70.0f.xxxx; + } + v.y = 20.0f; +} + +void partial_inout(inout B b) +{ + b.b = 40.0f; +} + +void frag_main() +{ + float4 a = 10.0f.xxxx; + float4 param = a; + partial_inout(param); + a = param; + float4 param_1; + complete_inout(param_1); + a = param_1; + float4 param_2 = a; + branchy_inout(param_2); + a = param_2; + float4 param_3; + branchy_inout_2(param_3); + a = param_3; + B b = _80; + B param_4 = b; + partial_inout(param_4); + b = param_4; +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag new file mode 100644 index 0000000000..8923f96a75 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag @@ -0,0 +1,24 @@ +RWByteAddressBuffer _9 : register(u6, space0); +globallycoherent RasterizerOrderedByteAddressBuffer _42 : register(u3, space0); +RasterizerOrderedByteAddressBuffer _52 : register(u4, space0); +RWTexture2D img4 : register(u5, space0); +RasterizerOrderedTexture2D img : register(u0, space0); +RasterizerOrderedTexture2D img3 : register(u2, space0); +RasterizerOrderedTexture2D img2 : register(u1, space0); + +void frag_main() +{ + _9.Store(0, uint(0)); + img4[int2(1, 1)] = float4(1.0f, 0.0f, 0.0f, 1.0f); + img[int2(0, 0)] = img3[int2(0, 0)]; + uint _39; + InterlockedAdd(img2[int2(0, 0)], 1u, _39); + _42.Store(0, uint(int(_42.Load(0)) + 42)); + uint _55; + _42.InterlockedAnd(4, _52.Load(0), _55); +} + +void main() +{ + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/point-coord-compat.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/point-coord-compat.frag new file mode 100644 index 0000000000..629153982d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/point-coord-compat.frag @@ -0,0 +1,19 @@ +static float2 FragColor; + +struct SPIRV_Cross_Output +{ + float2 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float2(0.5f, 0.5f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/query-lod.desktop.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..a9d4bd83d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/query-lod.desktop.frag @@ -0,0 +1,31 @@ +Texture2D uSampler : register(t0); +SamplerState _uSampler_sampler : register(s0); + +static float4 FragColor; +static float2 vTexCoord; + +struct SPIRV_Cross_Input +{ + float2 vTexCoord : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float _19_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vTexCoord); + float2 _19 = _19_tmp.xx; + FragColor = _19.xyxy; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vTexCoord = stage_input.vTexCoord; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag new file mode 100644 index 0000000000..bbe3e4a7d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag @@ -0,0 +1,21 @@ +globallycoherent RWByteAddressBuffer _12 : register(u0); + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = asfloat(_12.Load4(0)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.frag new file mode 100644 index 0000000000..02252f9cbc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/readonly-coherent-ssbo.frag @@ -0,0 +1,21 @@ +ByteAddressBuffer _12 : register(t0); + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = asfloat(_12.Load4(0)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/resources.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/resources.frag new file mode 100644 index 0000000000..2a3b2be51f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/resources.frag @@ -0,0 +1,44 @@ +cbuffer CBuffer : register(b3) +{ + float4 cbuf_a : packoffset(c0); +}; + +cbuffer PushMe +{ + float4 registers_d : packoffset(c0); +}; + +Texture2D uSampledImage : register(t4); +SamplerState _uSampledImage_sampler : register(s4); +Texture2D uTexture : register(t5); +SamplerState uSampler : register(s6); + +static float2 vTex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 vTex : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 c0 = uSampledImage.Sample(_uSampledImage_sampler, vTex); + float4 c1 = uTexture.Sample(uSampler, vTex); + float4 c2 = cbuf_a + registers_d; + FragColor = (c0 + c1) + c2; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/row-major-layout-in-struct.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/row-major-layout-in-struct.frag new file mode 100644 index 0000000000..5fc45b2b3d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/row-major-layout-in-struct.frag @@ -0,0 +1,47 @@ +struct NonFoo +{ + float4x4 v; + float4x4 w; +}; + +struct Foo +{ + row_major float4x4 v; + row_major float4x4 w; +}; + +cbuffer UBO : register(b0) +{ + Foo _17_foo : packoffset(c0); +}; + + +static float4 FragColor; +static float4 vUV; + +struct SPIRV_Cross_Input +{ + float4 vUV : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + NonFoo f; + f.v = _17_foo.v; + f.w = _17_foo.w; + FragColor = mul(mul(vUV, f.w), f.v); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUV = stage_input.vUV; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-cmp-level-zero.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-cmp-level-zero.frag new file mode 100644 index 0000000000..5c583c66fa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-cmp-level-zero.frag @@ -0,0 +1,53 @@ +Texture2D uSampler2D : register(t0); +SamplerComparisonState _uSampler2D_sampler : register(s0); +Texture2DArray uSampler2DArray : register(t1); +SamplerComparisonState _uSampler2DArray_sampler : register(s1); +TextureCube uSamplerCube : register(t2); +SamplerComparisonState _uSamplerCube_sampler : register(s2); +TextureCubeArray uSamplerCubeArray : register(t3); +SamplerComparisonState _uSamplerCubeArray_sampler : register(s3); + +static float3 vUVRef; +static float4 vDirRef; +static float FragColor; + +struct SPIRV_Cross_Input +{ + float3 vUVRef : TEXCOORD0; + float4 vDirRef : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float s0 = uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)); + float s1 = uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1)); + float s2 = uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w); + float s3 = uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f); + float l0 = uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)); + float l1 = uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1)); + float l2 = uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w); + float4 _75 = vDirRef; + float4 _80 = _75; + _80.z = _75.w; + float p0 = uSampler2D.SampleCmp(_uSampler2D_sampler, _80.xy / _80.z, _75.z / _80.z, int2(1, 1)); + float4 _84 = vDirRef; + float4 _87 = _84; + _87.z = _84.w; + float p1 = uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, _87.xy / _87.z, _84.z / _87.z, int2(1, 1)); + FragColor = (((((((s0 + s1) + s2) + s3) + l0) + l1) + l2) + p0) + p1; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vUVRef = stage_input.vUVRef; + vDirRef = stage_input.vDirRef; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in-and-out.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in-and-out.frag new file mode 100644 index 0000000000..185a09821e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in-and-out.frag @@ -0,0 +1,30 @@ +static int gl_SampleMaskIn; +static int gl_SampleMask; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + uint gl_SampleMaskIn : SV_Coverage; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + uint gl_SampleMask : SV_Coverage; +}; + +void frag_main() +{ + FragColor = 1.0f.xxxx; + gl_SampleMask = gl_SampleMaskIn; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_SampleMaskIn = stage_input.gl_SampleMaskIn; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_SampleMask = gl_SampleMask; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in.frag new file mode 100644 index 0000000000..8f6cfaf9e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-in.frag @@ -0,0 +1,32 @@ +static int gl_SampleID; +static int gl_SampleMaskIn; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + uint gl_SampleID : SV_SampleIndex; + uint gl_SampleMaskIn : SV_Coverage; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + if ((gl_SampleMaskIn & (1 << gl_SampleID)) != 0) + { + FragColor = 1.0f.xxxx; + } +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_SampleID = stage_input.gl_SampleID; + gl_SampleMaskIn = stage_input.gl_SampleMaskIn; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-out.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-out.frag new file mode 100644 index 0000000000..a966c03218 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sample-mask-out.frag @@ -0,0 +1,23 @@ +static int gl_SampleMask; +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; + uint gl_SampleMask : SV_Coverage; +}; + +void frag_main() +{ + FragColor = 1.0f.xxxx; + gl_SampleMask = 0; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_SampleMask = gl_SampleMask; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-array.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-array.frag new file mode 100644 index 0000000000..fd08d4230d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-array.frag @@ -0,0 +1,45 @@ +Texture2D uCombined[4] : register(t0); +SamplerState _uCombined_sampler[4] : register(s0); +Texture2D uTex[4] : register(t4); +SamplerState uSampler[4] : register(s8); +RWTexture2D uImage[8] : register(u12); + +static float4 gl_FragCoord; +static float2 vTex; +static int vIndex; + +struct SPIRV_Cross_Input +{ + float2 vTex : TEXCOORD0; + nointerpolation int vIndex : TEXCOORD1; + float4 gl_FragCoord : SV_Position; +}; + +float4 sample_in_function(Texture2D samp, SamplerState _samp_sampler) +{ + return samp.Sample(_samp_sampler, vTex); +} + +float4 sample_in_function2(Texture2D tex, SamplerState samp) +{ + return tex.Sample(samp, vTex); +} + +void frag_main() +{ + float4 color = uCombined[vIndex].Sample(_uCombined_sampler[vIndex], vTex); + color += uTex[vIndex].Sample(uSampler[vIndex], vTex); + int _72 = vIndex + 1; + color += sample_in_function(uCombined[_72], _uCombined_sampler[_72]); + color += sample_in_function2(uTex[vIndex + 1], uSampler[vIndex + 1]); + uImage[vIndex][int2(gl_FragCoord.xy)] = color; +} + +void main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + vTex = stage_input.vTex; + vIndex = stage_input.vIndex; + frag_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-image-arrays.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-image-arrays.frag new file mode 100644 index 0000000000..856f04cf47 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/sampler-image-arrays.frag @@ -0,0 +1,54 @@ +Texture2D uSampler[4] : register(t0); +SamplerState _uSampler_sampler[4] : register(s0); +Texture2D uTextures[4] : register(t8); +SamplerState uSamplers[4] : register(s4); + +static int vIndex; +static float2 vTex; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + nointerpolation float2 vTex : TEXCOORD0; + nointerpolation int vIndex : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +float4 sample_from_global() +{ + return uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex + 0.100000001490116119384765625f.xx); +} + +float4 sample_from_argument(Texture2D samplers[4], SamplerState _samplers_sampler[4]) +{ + return samplers[vIndex].Sample(_samplers_sampler[vIndex], vTex + 0.20000000298023223876953125f.xx); +} + +float4 sample_single_from_argument(Texture2D samp, SamplerState _samp_sampler) +{ + return samp.Sample(_samp_sampler, vTex + 0.300000011920928955078125f.xx); +} + +void frag_main() +{ + FragColor = 0.0f.xxxx; + FragColor += uTextures[2].Sample(uSamplers[1], vTex); + FragColor += uSampler[vIndex].Sample(_uSampler_sampler[vIndex], vTex); + FragColor += sample_from_global(); + FragColor += sample_from_argument(uSampler, _uSampler_sampler); + FragColor += sample_single_from_argument(uSampler[3], _uSampler_sampler[3]); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIndex = stage_input.vIndex; + vTex = stage_input.vTex; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..6c2d0be4f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/scalar-refract-reflect.frag @@ -0,0 +1,49 @@ +static float FragColor; +static float3 vRefract; + +struct SPIRV_Cross_Input +{ + float3 vRefract : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +float spvReflect(float i, float n) +{ + return i - 2.0 * dot(n, i) * n; +} + +float spvRefract(float i, float n, float eta) +{ + float NoI = n * i; + float NoI2 = NoI * NoI; + float k = 1.0 - eta * eta * (1.0 - NoI2); + if (k < 0.0) + { + return 0.0; + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +void frag_main() +{ + FragColor = spvRefract(vRefract.x, vRefract.y, vRefract.z); + FragColor += spvReflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vRefract = stage_input.vRefract; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag new file mode 100644 index 0000000000..08d8b0e185 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag @@ -0,0 +1,32 @@ +uniform sampler2D uSamp; +uniform sampler2D SPIRV_Cross_CombineduTuS; + +static float4 FragColor; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +float4 samp(sampler2D uSamp_1) +{ + return tex2D(uSamp_1, 0.5f.xx); +} + +float4 samp_1(sampler2D SPIRV_Cross_CombinedTS) +{ + return tex2D(SPIRV_Cross_CombinedTS, 0.5f.xx); +} + +void frag_main() +{ + FragColor = samp(uSamp) + samp_1(SPIRV_Cross_CombineduTuS); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..415886dd31 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-block-size.frag @@ -0,0 +1,37 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +static const int Value = SPIRV_CROSS_CONSTANT_ID_10; + +cbuffer SpecConstArray : register(b0) +{ + float4 _15_samples[Value] : packoffset(c0); +}; + + +static float4 FragColor; +static int Index; + +struct SPIRV_Cross_Input +{ + nointerpolation int Index : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = _15_samples[Index]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Index = stage_input.Index; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..942da54f04 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/spec-constant-ternary.frag @@ -0,0 +1,26 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 10u +#endif +static const uint s = SPIRV_CROSS_CONSTANT_ID_0; +static const bool _13 = (s > 20u); +static const uint f = _13 ? 30u : 50u; + +static float FragColor; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = float(f); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..be36b82266 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unreachable-break.frag @@ -0,0 +1,55 @@ +cbuffer UBO : register(b0) +{ + int _13_cond : packoffset(c0); + int _13_cond2 : packoffset(c0.y); +}; + + +static float4 FragColor; +static float4 vInput; + +struct SPIRV_Cross_Input +{ + float4 vInput : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + bool frog = false; + switch (_13_cond) + { + case 1: + { + if (_13_cond2 < 50) + { + break; + } + else + { + discard; + } + break; // unreachable workaround + } + default: + { + frog = true; + break; + } + } + bool4 _45 = frog.xxxx; + FragColor = float4(_45.x ? 10.0f.xxxx.x : 20.0f.xxxx.x, _45.y ? 10.0f.xxxx.y : 20.0f.xxxx.y, _45.z ? 10.0f.xxxx.z : 20.0f.xxxx.z, _45.w ? 10.0f.xxxx.w : 20.0f.xxxx.w); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput = stage_input.vInput; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..d7ec92f0aa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/switch-unsigned-case.frag @@ -0,0 +1,38 @@ +cbuffer Buff : register(b0) +{ + uint _15_TestVal : packoffset(c0); +}; + + +static float4 fsout_Color; + +struct SPIRV_Cross_Output +{ + float4 fsout_Color : SV_Target0; +}; + +void frag_main() +{ + fsout_Color = 1.0f.xxxx; + switch (_15_TestVal) + { + case 0u: + { + fsout_Color = 0.100000001490116119384765625f.xxxx; + break; + } + case 1u: + { + fsout_Color = 0.20000000298023223876953125f.xxxx; + break; + } + } +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.fsout_Color = fsout_Color; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/swizzle-scalar.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/swizzle-scalar.frag new file mode 100644 index 0000000000..ab310b82f2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/swizzle-scalar.frag @@ -0,0 +1,41 @@ +static float4 Float; +static float vFloat; +static int4 Int; +static int vInt; +static float4 Float2; +static int4 Int2; + +struct SPIRV_Cross_Input +{ + nointerpolation float vFloat : TEXCOORD0; + nointerpolation int vInt : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 Float : SV_Target0; + int4 Int : SV_Target1; + float4 Float2 : SV_Target2; + int4 Int2 : SV_Target3; +}; + +void frag_main() +{ + Float = vFloat.xxxx * 2.0f; + Int = vInt.xxxx * int4(2, 2, 2, 2); + Float2 = 10.0f.xxxx; + Int2 = int4(10, 10, 10, 10); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vFloat = stage_input.vFloat; + vInt = stage_input.vInt; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.Float = Float; + stage_output.Int = Int; + stage_output.Float2 = Float2; + stage_output.Int2 = Int2; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling-ms.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling-ms.frag new file mode 100644 index 0000000000..854ad5016d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling-ms.frag @@ -0,0 +1,33 @@ +Texture2DMS uTex : register(t0); +SamplerState _uTex_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTex.Load(int2(gl_FragCoord.xy), 0); + FragColor += uTex.Load(int2(gl_FragCoord.xy), 1); + FragColor += uTex.Load(int2(gl_FragCoord.xy), 2); + FragColor += uTex.Load(int2(gl_FragCoord.xy), 3); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.frag new file mode 100644 index 0000000000..583217511f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.frag @@ -0,0 +1,106 @@ +Texture1D tex1d : register(t0); +SamplerState _tex1d_sampler : register(s0); +Texture2D tex2d : register(t1); +SamplerState _tex2d_sampler : register(s1); +Texture3D tex3d : register(t2); +SamplerState _tex3d_sampler : register(s2); +TextureCube texCube : register(t3); +SamplerState _texCube_sampler : register(s3); +Texture1D tex1dShadow : register(t4); +SamplerComparisonState _tex1dShadow_sampler : register(s4); +Texture2D tex2dShadow : register(t5); +SamplerComparisonState _tex2dShadow_sampler : register(s5); +TextureCube texCubeShadow : register(t6); +SamplerComparisonState _texCubeShadow_sampler : register(s6); +Texture1DArray tex1dArray : register(t7); +SamplerState _tex1dArray_sampler : register(s7); +Texture2DArray tex2dArray : register(t8); +SamplerState _tex2dArray_sampler : register(s8); +TextureCubeArray texCubeArray : register(t9); +SamplerState _texCubeArray_sampler : register(s9); +Texture2D separateTex2d : register(t12); +SamplerState samplerNonDepth : register(s11); +Texture2D separateTex2dDepth : register(t13); +SamplerComparisonState samplerDepth : register(s10); + +static float texCoord1d; +static float2 texCoord2d; +static float3 texCoord3d; +static float4 texCoord4d; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float texCoord1d : TEXCOORD0; + float2 texCoord2d : TEXCOORD1; + float3 texCoord3d : TEXCOORD2; + float4 texCoord4d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 texcolor = tex1d.Sample(_tex1d_sampler, texCoord1d); + texcolor += tex1d.Sample(_tex1d_sampler, texCoord1d, 1); + texcolor += tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f); + texcolor += tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f); + float2 _41 = float2(texCoord1d, 2.0f); + texcolor += tex1d.Sample(_tex1d_sampler, _41.x / _41.y); + texcolor += tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f); + texcolor += tex2d.Sample(_tex2d_sampler, texCoord2d); + texcolor += tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2)); + texcolor += tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f); + texcolor += tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + float3 _88 = float3(texCoord2d, 2.0f); + texcolor += tex2d.Sample(_tex2d_sampler, _88.xy / _88.z); + texcolor += tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f); + texcolor += tex3d.Sample(_tex3d_sampler, texCoord3d); + texcolor += tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3)); + texcolor += tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f); + texcolor += tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); + float4 _135 = float4(texCoord3d, 2.0f); + texcolor += tex3d.Sample(_tex3d_sampler, _135.xyz / _135.w); + texcolor += tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f); + texcolor += texCube.Sample(_texCube_sampler, texCoord3d); + texcolor += texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f); + texcolor += texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f); + float3 _170 = float3(texCoord1d, 0.0f, 0.0f); + texcolor.w += tex1dShadow.SampleCmp(_tex1dShadow_sampler, _170.x, _170.z); + float3 _188 = float3(texCoord2d, 0.0f); + texcolor.w += tex2dShadow.SampleCmp(_tex2dShadow_sampler, _188.xy, _188.z); + float4 _204 = float4(texCoord3d, 0.0f); + texcolor.w += texCubeShadow.SampleCmp(_texCubeShadow_sampler, _204.xyz, _204.w); + texcolor += tex1dArray.Sample(_tex1dArray_sampler, texCoord2d); + texcolor += tex2dArray.Sample(_tex2dArray_sampler, texCoord3d); + texcolor += texCubeArray.Sample(_texCubeArray_sampler, texCoord4d); + texcolor += tex2d.GatherRed(_tex2d_sampler, texCoord2d); + texcolor += tex2d.GatherRed(_tex2d_sampler, texCoord2d); + texcolor += tex2d.GatherGreen(_tex2d_sampler, texCoord2d); + texcolor += tex2d.GatherBlue(_tex2d_sampler, texCoord2d); + texcolor += tex2d.GatherAlpha(_tex2d_sampler, texCoord2d); + texcolor += tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1)); + texcolor += tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1)); + texcolor += tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1)); + texcolor += tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1)); + texcolor += tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1)); + texcolor += tex2d.Load(int3(int2(1, 2), 0)); + texcolor += separateTex2d.Sample(samplerNonDepth, texCoord2d); + texcolor.w += separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z); + FragColor = texcolor; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + texCoord1d = stage_input.texCoord1d; + texCoord2d = stage_input.texCoord2d; + texCoord3d = stage_input.texCoord3d; + texCoord4d = stage_input.texCoord4d; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.sm30.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.sm30.frag new file mode 100644 index 0000000000..10c6c06531 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/tex-sampling.sm30.frag @@ -0,0 +1,83 @@ +uniform sampler1D tex1d; +uniform sampler2D tex2d; +uniform sampler3D tex3d; +uniform samplerCUBE texCube; +uniform sampler1D tex1dShadow; +uniform sampler2D tex2dShadow; + +static float texCoord1d; +static float2 texCoord2d; +static float3 texCoord3d; +static float4 FragColor; +static float4 texCoord4d; + +struct SPIRV_Cross_Input +{ + float texCoord1d : TEXCOORD0; + float2 texCoord2d : TEXCOORD1; + float3 texCoord3d : TEXCOORD2; + float4 texCoord4d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : COLOR0; +}; + +void frag_main() +{ + float4 texcolor = tex1D(tex1d, texCoord1d); + texcolor += tex1Dlod(tex1d, float4(texCoord1d, 0.0, 0.0, 2.0f)); + texcolor += tex1Dgrad(tex1d, texCoord1d, 1.0f, 2.0f); + float2 _34 = float2(texCoord1d, 2.0f); + texcolor += tex1Dproj(tex1d, float4(_34.x, 0.0, 0.0, _34.y)); + texcolor += tex1Dbias(tex1d, float4(texCoord1d, 0.0, 0.0, 1.0f)); + texcolor += tex2D(tex2d, texCoord2d); + texcolor += tex2Dlod(tex2d, float4(texCoord2d, 0.0, 2.0f)); + texcolor += tex2Dgrad(tex2d, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f)); + float3 _73 = float3(texCoord2d, 2.0f); + texcolor += tex2Dproj(tex2d, float4(_73.xy, 0.0, _73.z)); + texcolor += tex2Dbias(tex2d, float4(texCoord2d, 0.0, 1.0f)); + texcolor += tex3D(tex3d, texCoord3d); + texcolor += tex3Dlod(tex3d, float4(texCoord3d, 2.0f)); + texcolor += tex3Dgrad(tex3d, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); + float4 _112 = float4(texCoord3d, 2.0f); + texcolor += tex3Dproj(tex3d, float4(_112.xyz, _112.w)); + texcolor += tex3Dbias(tex3d, float4(texCoord3d, 1.0f)); + texcolor += texCUBE(texCube, texCoord3d); + texcolor += texCUBElod(texCube, float4(texCoord3d, 2.0f)); + texcolor += texCUBEbias(texCube, float4(texCoord3d, 1.0f)); + float3 _147 = float3(texCoord1d, 0.0f, 0.0f); + texcolor.w += tex1Dproj(tex1dShadow, float4(_147.x, 0.0, _147.z, 1.0)).x; + float3 _159 = float3(texCoord1d, 0.0f, 0.0f); + texcolor.w += tex1Dlod(tex1dShadow, float4(_159.x, 0.0, _159.z, 2.0f)).x; + float4 _168 = float4(texCoord1d, 0.0f, 0.0f, 2.0f); + float4 _171 = _168; + _171.y = _168.w; + texcolor.w += tex1Dproj(tex1dShadow, float4(_171.x, 0.0, _168.z, _171.y)).x; + float3 _179 = float3(texCoord1d, 0.0f, 0.0f); + texcolor.w += tex1Dbias(tex1dShadow, float4(_179.x, 0.0, _179.z, 1.0f)).x; + float3 _194 = float3(texCoord2d, 0.0f); + texcolor.w += tex2Dproj(tex2dShadow, float4(_194.xy, _194.z, 1.0)).x; + float3 _205 = float3(texCoord2d, 0.0f); + texcolor.w += tex2Dlod(tex2dShadow, float4(_205.xy, _205.z, 2.0f)).x; + float4 _216 = float4(texCoord2d, 0.0f, 2.0f); + float4 _219 = _216; + _219.z = _216.w; + texcolor.w += tex2Dproj(tex2dShadow, float4(_219.xy, _216.z, _219.z)).x; + float3 _229 = float3(texCoord2d, 0.0f); + texcolor.w += tex2Dbias(tex2dShadow, float4(_229.xy, _229.z, 1.0f)).x; + FragColor = texcolor; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + texCoord1d = stage_input.texCoord1d; + texCoord2d = stage_input.texCoord2d; + texCoord3d = stage_input.texCoord3d; + texCoord4d = stage_input.texCoord4d; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = float4(FragColor); + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..c7ae589dd2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,31 @@ +Texture2D uTexture : register(t0); +SamplerState _uTexture_sampler : register(s0); + +static float4 gl_FragCoord; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float4 gl_FragCoord : SV_Position; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = uTexture.Load(int3(int2(gl_FragCoord.xy), 0), int2(1, 1)); + FragColor += uTexture.Load(int3(int2(gl_FragCoord.xy), 0), int2(-1, 1)); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_FragCoord = stage_input.gl_FragCoord; + gl_FragCoord.w = 1.0 / gl_FragCoord.w; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..f98a512657 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-proj-shadow.frag @@ -0,0 +1,53 @@ +Texture1D uShadow1D : register(t0); +SamplerComparisonState _uShadow1D_sampler : register(s0); +Texture2D uShadow2D : register(t1); +SamplerComparisonState _uShadow2D_sampler : register(s1); +Texture1D uSampler1D : register(t2); +SamplerState _uSampler1D_sampler : register(s2); +Texture2D uSampler2D : register(t3); +SamplerState _uSampler2D_sampler : register(s3); +Texture3D uSampler3D : register(t4); +SamplerState _uSampler3D_sampler : register(s4); + +static float FragColor; +static float4 vClip4; +static float2 vClip2; +static float3 vClip3; + +struct SPIRV_Cross_Input +{ + float3 vClip3 : TEXCOORD0; + float4 vClip4 : TEXCOORD1; + float2 vClip2 : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 _17 = vClip4; + float4 _20 = _17; + _20.y = _17.w; + FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, _20.x / _20.y, _17.z / _20.y); + float4 _27 = vClip4; + float4 _30 = _27; + _30.z = _27.w; + FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, _30.xy / _30.z, _27.z / _30.z); + FragColor = uSampler1D.Sample(_uSampler1D_sampler, vClip2.x / vClip2.y).x; + FragColor = uSampler2D.Sample(_uSampler2D_sampler, vClip3.xy / vClip3.z).x; + FragColor = uSampler3D.Sample(_uSampler3D_sampler, vClip4.xyz / vClip4.w).x; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vClip4 = stage_input.vClip4; + vClip2 = stage_input.vClip2; + vClip3 = stage_input.vClip3; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..dd2eb251fc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,30 @@ +Texture2D uTex : register(t0); +SamplerState uSampler : register(s1); + +static int2 FooOut; + +struct SPIRV_Cross_Output +{ + int2 FooOut : SV_Target0; +}; + +uint2 spvTextureSize(Texture2D Tex, uint Level, out uint Param) +{ + uint2 ret; + Tex.GetDimensions(Level, ret.x, ret.y, Param); + return ret; +} + +void frag_main() +{ + uint _23_dummy_parameter; + FooOut = int2(spvTextureSize(uTex, uint(0), _23_dummy_parameter)); +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FooOut = FooOut; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/unary-enclose.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/unary-enclose.frag new file mode 100644 index 0000000000..597c57f800 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/unary-enclose.frag @@ -0,0 +1,32 @@ +static float4 FragColor; +static float4 vIn; +static int4 vIn1; + +struct SPIRV_Cross_Input +{ + float4 vIn : TEXCOORD0; + nointerpolation int4 vIn1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + FragColor = -(-vIn); + int4 a = ~(~vIn1); + bool b = false; + b = !(!b); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vIn = stage_input.vIn; + vIn1 = stage_input.vIn1; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/unorm-snorm-packing.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/unorm-snorm-packing.frag new file mode 100644 index 0000000000..95786b93b6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/unorm-snorm-packing.frag @@ -0,0 +1,111 @@ +static float4 FP32Out; +static uint UNORM8; +static uint SNORM8; +static uint UNORM16; +static uint SNORM16; +static uint UNORM8Out; +static float4 FP32; +static uint SNORM8Out; +static uint UNORM16Out; +static uint SNORM16Out; + +struct SPIRV_Cross_Input +{ + nointerpolation uint SNORM8 : TEXCOORD0; + nointerpolation uint UNORM8 : TEXCOORD1; + nointerpolation uint SNORM16 : TEXCOORD2; + nointerpolation uint UNORM16 : TEXCOORD3; + nointerpolation float4 FP32 : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float4 FP32Out : SV_Target0; + uint UNORM8Out : SV_Target1; + uint SNORM8Out : SV_Target2; + uint UNORM16Out : SV_Target3; + uint SNORM16Out : SV_Target4; +}; + +uint spvPackUnorm4x8(float4 value) +{ + uint4 Packed = uint4(round(saturate(value) * 255.0)); + return Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24); +} + +float4 spvUnpackUnorm4x8(uint value) +{ + uint4 Packed = uint4(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, value >> 24); + return float4(Packed) / 255.0; +} + +uint spvPackSnorm4x8(float4 value) +{ + int4 Packed = int4(round(clamp(value, -1.0, 1.0) * 127.0)) & 0xff; + return uint(Packed.x | (Packed.y << 8) | (Packed.z << 16) | (Packed.w << 24)); +} + +float4 spvUnpackSnorm4x8(uint value) +{ + int SignedValue = int(value); + int4 Packed = int4(SignedValue << 24, SignedValue << 16, SignedValue << 8, SignedValue) >> 24; + return clamp(float4(Packed) / 127.0, -1.0, 1.0); +} + +uint spvPackUnorm2x16(float2 value) +{ + uint2 Packed = uint2(round(saturate(value) * 65535.0)); + return Packed.x | (Packed.y << 16); +} + +float2 spvUnpackUnorm2x16(uint value) +{ + uint2 Packed = uint2(value & 0xffff, value >> 16); + return float2(Packed) / 65535.0; +} + +uint spvPackSnorm2x16(float2 value) +{ + int2 Packed = int2(round(clamp(value, -1.0, 1.0) * 32767.0)) & 0xffff; + return uint(Packed.x | (Packed.y << 16)); +} + +float2 spvUnpackSnorm2x16(uint value) +{ + int SignedValue = int(value); + int2 Packed = int2(SignedValue << 16, SignedValue) >> 16; + return clamp(float2(Packed) / 32767.0, -1.0, 1.0); +} + +void frag_main() +{ + FP32Out = spvUnpackUnorm4x8(UNORM8); + FP32Out = spvUnpackSnorm4x8(SNORM8); + float2 _21 = spvUnpackUnorm2x16(UNORM16); + FP32Out.x = _21.x; + FP32Out.y = _21.y; + float2 _31 = spvUnpackSnorm2x16(SNORM16); + FP32Out.x = _31.x; + FP32Out.y = _31.y; + UNORM8Out = spvPackUnorm4x8(FP32); + SNORM8Out = spvPackSnorm4x8(FP32); + UNORM16Out = spvPackUnorm2x16(FP32.xy); + SNORM16Out = spvPackSnorm2x16(FP32.zw); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + UNORM8 = stage_input.UNORM8; + SNORM8 = stage_input.SNORM8; + UNORM16 = stage_input.UNORM16; + SNORM16 = stage_input.SNORM16; + FP32 = stage_input.FP32; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FP32Out = FP32Out; + stage_output.UNORM8Out = UNORM8Out; + stage_output.SNORM8Out = SNORM8Out; + stage_output.UNORM16Out = UNORM16Out; + stage_output.SNORM16Out = SNORM16Out; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/frag/various-glsl-ops.frag b/third_party/spirv-cross/reference/shaders-hlsl/frag/various-glsl-ops.frag new file mode 100644 index 0000000000..f0b345482b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/frag/various-glsl-ops.frag @@ -0,0 +1,28 @@ +static float2 interpolant; +static float4 FragColor; + +struct SPIRV_Cross_Input +{ + float2 interpolant : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float4 FragColor : SV_Target0; +}; + +void frag_main() +{ + float4 color = float4(0.0f, 0.0f, 0.0f, EvaluateAttributeSnapped(interpolant, 0.100000001490116119384765625f.xx).x); + color += float4(0.0f, 0.0f, 0.0f, ddx_coarse(interpolant.x)); + FragColor = color; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + interpolant = stage_input.interpolant; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.FragColor = FragColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh b/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..dad35928c7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh @@ -0,0 +1,97 @@ +struct BlockOut +{ + float4 a; + float4 b; +}; + +struct BlockOutPrim +{ + float4 a; + float4 b; +}; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(2u, 3u, 4u); + +static uint3 gl_WorkGroupID; +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +struct gl_MeshPerVertexEXT +{ + float4 vOut : TEXCOORD0; + BlockOut outputs : TEXCOORD2; + float4 gl_Position : SV_Position; + float gl_ClipDistance[1] : SV_ClipDistance; + float2 gl_CullDistance : SV_CullDistance; +}; + +struct gl_MeshPerPrimitiveEXT +{ + float4 vPrim : TEXCOORD1; + BlockOutPrim prim_outputs : TEXCOORD4; + uint gl_PrimitiveID : SV_PrimitiveID; + uint gl_Layer : SV_RenderTargetArrayIndex; + uint gl_ViewportIndex : SV_ViewportArrayIndex; + uint gl_PrimitiveShadingRateEXT : SV_ShadingRate; + bool gl_CullPrimitiveEXT : SV_CullPrimitive; +}; + +groupshared float shared_float[16]; + +void main3(inout uint2 gl_PrimitiveLineIndicesEXT[22], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22]) +{ + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uint2(0u, 1u) + gl_LocalInvocationIndex.xx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; +} + +void main2(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], TaskPayload _payload, inout uint2 gl_PrimitiveLineIndicesEXT[22]) +{ + SetMeshOutputCounts(24u, 22u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = float4(float3(gl_GlobalInvocationID), 1.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 6.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].vOut = float4(float3(gl_GlobalInvocationID), 2.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.a = 5.0f.xxxx; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.b = 6.0f.xxxx; + GroupMemoryBarrierWithGroupSync(); + if (gl_LocalInvocationIndex < 22u) + { + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].vPrim = float4(float3(gl_WorkGroupID), 3.0f); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.a = _payload.a.xxxx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.b = _payload.b.xxxx; + main3(gl_PrimitiveLineIndicesEXT, gl_MeshPrimitivesEXT); + } +} + +void mesh_main(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], TaskPayload _payload, inout uint2 gl_PrimitiveLineIndicesEXT[22]) +{ + main2(gl_MeshVerticesEXT, gl_MeshPrimitivesEXT, _payload, gl_PrimitiveLineIndicesEXT); +} + +[outputtopology("line")] +[numthreads(2, 3, 4)] +void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], in payload TaskPayload _payload, out indices uint2 gl_PrimitiveLineIndicesEXT[22]) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + mesh_main(gl_MeshVerticesEXT, gl_MeshPrimitivesEXT, _payload, gl_PrimitiveLineIndicesEXT); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh b/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..e636453da4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh @@ -0,0 +1,87 @@ +struct BlockOut +{ + float4 a; + float4 b; +}; + +struct BlockOutPrim +{ + float4 a; + float4 b; +}; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(2u, 3u, 4u); + +static uint3 gl_WorkGroupID; +static uint3 gl_GlobalInvocationID; +static uint gl_LocalInvocationIndex; +struct SPIRV_Cross_Input +{ + uint3 gl_WorkGroupID : SV_GroupID; + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; + uint gl_LocalInvocationIndex : SV_GroupIndex; +}; + +struct gl_MeshPerVertexEXT +{ + float4 vOut : TEXCOORD0; + BlockOut outputs : TEXCOORD2; + float4 gl_Position : SV_Position; + float gl_ClipDistance[1] : SV_ClipDistance; + float2 gl_CullDistance : SV_CullDistance; +}; + +struct gl_MeshPerPrimitiveEXT +{ + float4 vPrim : TEXCOORD1; + BlockOutPrim prim_outputs : TEXCOORD4; + uint gl_PrimitiveID : SV_PrimitiveID; + uint gl_Layer : SV_RenderTargetArrayIndex; + uint gl_ViewportIndex : SV_ViewportArrayIndex; + uint gl_PrimitiveShadingRateEXT : SV_ShadingRate; + bool gl_CullPrimitiveEXT : SV_CullPrimitive; +}; + +groupshared float shared_float[16]; + +void mesh_main(inout gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], inout gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], TaskPayload _payload, inout uint3 gl_PrimitiveTriangleIndicesEXT[22]) +{ + SetMeshOutputCounts(24u, 22u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = float4(float3(gl_GlobalInvocationID), 1.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 3.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0f; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].vOut = float4(float3(gl_GlobalInvocationID), 2.0f); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.a = 5.0f.xxxx; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].outputs.b = 6.0f.xxxx; + GroupMemoryBarrierWithGroupSync(); + if (gl_LocalInvocationIndex < 22u) + { + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].vPrim = float4(float3(gl_WorkGroupID), 3.0f); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.a = _payload.a.xxxx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].prim_outputs.b = _payload.b.xxxx; + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uint3(0u, 1u, 2u) + gl_LocalInvocationIndex.xxx; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} + +[outputtopology("triangle")] +[numthreads(2, 3, 4)] +void main(SPIRV_Cross_Input stage_input, out vertices gl_MeshPerVertexEXT gl_MeshVerticesEXT[24], out primitives gl_MeshPerPrimitiveEXT gl_MeshPrimitivesEXT[22], in payload TaskPayload _payload, out indices uint3 gl_PrimitiveTriangleIndicesEXT[22]) +{ + gl_WorkGroupID = stage_input.gl_WorkGroupID; + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex; + mesh_main(gl_MeshVerticesEXT, gl_MeshPrimitivesEXT, _payload, gl_PrimitiveTriangleIndicesEXT); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task b/third_party/spirv-cross/reference/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task new file mode 100644 index 0000000000..2f5ae1b81d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task @@ -0,0 +1,24 @@ +struct TaskPayload +{ + float a; + float b; + int c; +}; + +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +groupshared TaskPayload _payload; + +void task_main() +{ + _payload.a = 1.2000000476837158203125f; + _payload.b = 2.2999999523162841796875f; + _payload.c = 3; + DispatchMesh(1u, 2u, 3u, _payload); +} + +[numthreads(1, 1, 1)] +void main() +{ + task_main(); +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/basic.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/basic.vert new file mode 100644 index 0000000000..e0bcebf725 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/basic.vert @@ -0,0 +1,39 @@ +cbuffer UBO : register(b0) +{ + row_major float4x4 _16_uMVP : packoffset(c0); +}; + + +static float4 gl_Position; +static float4 aVertex; +static float3 vNormal; +static float3 aNormal; + +struct SPIRV_Cross_Input +{ + float4 aVertex : TEXCOORD0; + float3 aNormal : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float3 vNormal : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(aVertex, _16_uMVP); + vNormal = aNormal; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + aVertex = stage_input.aVertex; + aNormal = stage_input.aNormal; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vNormal = vNormal; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/clip-cull-distance.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/clip-cull-distance.vert new file mode 100644 index 0000000000..7e0d104acd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/clip-cull-distance.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static float gl_ClipDistance[2]; +static float gl_CullDistance[1]; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; + float2 gl_ClipDistance0 : SV_ClipDistance0; + float gl_CullDistance0 : SV_CullDistance0; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_ClipDistance[0] = 0.0f; + gl_ClipDistance[1] = 0.0f; + gl_CullDistance[0] = 4.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.gl_ClipDistance0.x = gl_ClipDistance[0]; + stage_output.gl_ClipDistance0.y = gl_ClipDistance[1]; + stage_output.gl_CullDistance0.x = gl_CullDistance[0]; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/instancing.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/instancing.vert new file mode 100644 index 0000000000..48b2df20d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/instancing.vert @@ -0,0 +1,28 @@ +static float4 gl_Position; +static int gl_VertexIndex; +static int gl_InstanceIndex; +struct SPIRV_Cross_Input +{ + uint gl_VertexIndex : SV_VertexID; + uint gl_InstanceIndex : SV_InstanceID; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + gl_VertexIndex = int(stage_input.gl_VertexIndex); + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/invariant.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/invariant.vert new file mode 100644 index 0000000000..5473962686 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/invariant.vert @@ -0,0 +1,40 @@ +static float4 gl_Position; +static float4 vInput0; +static float4 vInput1; +static float4 vInput2; +static float4 vColor; + +struct SPIRV_Cross_Input +{ + float4 vInput0 : TEXCOORD0; + float4 vInput1 : TEXCOORD1; + float4 vInput2 : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + precise float4 vColor : TEXCOORD0; + precise float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + float4 _20 = vInput1 * vInput2; + float4 _21 = vInput0 + _20; + gl_Position = _21; + float4 _27 = vInput0 - vInput1; + float4 _29 = _27 * vInput2; + vColor = _29; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput0 = stage_input.vInput0; + vInput1 = stage_input.vInput1; + vInput2 = stage_input.vInput2; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vColor = vColor; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/legacy-int-attribute.sm30.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/legacy-int-attribute.sm30.vert new file mode 100644 index 0000000000..84e283483b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/legacy-int-attribute.sm30.vert @@ -0,0 +1,36 @@ +uniform float4 gl_HalfPixel; + +static float4 gl_Position; +static int4 attr_int4; +static int attr_int1; + +struct SPIRV_Cross_Input +{ + float4 attr_int4 : TEXCOORD0; + float attr_int1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : POSITION; +}; + +void vert_main() +{ + gl_Position.x = float(attr_int4[attr_int1]); + gl_Position.y = 0.0f; + gl_Position.z = 0.0f; + gl_Position.w = 0.0f; + gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w; + gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + attr_int4 = stage_input.attr_int4; + attr_int1 = stage_input.attr_int1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/locations.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/locations.vert new file mode 100644 index 0000000000..da9fa45ede --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/locations.vert @@ -0,0 +1,77 @@ +struct Foo +{ + float3 a; + float3 b; + float3 c; +}; + +struct VertexOut +{ + float3 color; + float3 foo; +}; + +static float4 gl_Position; +static float4 Input2; +static float4 Input4; +static float4 Input0; +static float vLocation0; +static float vLocation1; +static float vLocation2[2]; +static Foo vLocation4; +static float vLocation9; +static VertexOut vout; + +struct SPIRV_Cross_Input +{ + float4 Input0 : TEXCOORD0; + float4 Input2 : TEXCOORD2; + float4 Input4 : TEXCOORD4; +}; + +struct SPIRV_Cross_Output +{ + float vLocation0 : TEXCOORD0; + float vLocation1 : TEXCOORD1; + float vLocation2[2] : TEXCOORD2; + Foo vLocation4 : TEXCOORD4; + float3 VertexOut_color : TEXCOORD7; + float3 VertexOut_foo : TEXCOORD8; + float vLocation9 : TEXCOORD9; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = ((1.0f.xxxx + Input2) + Input4) + Input0; + vLocation0 = 0.0f; + vLocation1 = 1.0f; + vLocation2[0] = 2.0f; + vLocation2[1] = 2.0f; + Foo foo; + foo.a = 1.0f.xxx; + foo.b = 1.0f.xxx; + foo.c = 1.0f.xxx; + vLocation4 = foo; + vLocation9 = 9.0f; + vout.color = 2.0f.xxx; + vout.foo = 4.0f.xxx; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + Input2 = stage_input.Input2; + Input4 = stage_input.Input4; + Input0 = stage_input.Input0; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vLocation0 = vLocation0; + stage_output.vLocation1 = vLocation1; + stage_output.vLocation2 = vLocation2; + stage_output.vLocation4 = vLocation4; + stage_output.vLocation9 = vLocation9; + stage_output.VertexOut_color = vout.color; + stage_output.VertexOut_foo = vout.foo; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-attribute.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-attribute.vert new file mode 100644 index 0000000000..a3d0eef56e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-attribute.vert @@ -0,0 +1,35 @@ +static float4 gl_Position; +static float4x4 m; +static float3 pos; + +struct SPIRV_Cross_Input +{ + float3 pos : TEXCOORD0; + float4 m_0 : TEXCOORD1_0; + float4 m_1 : TEXCOORD1_1; + float4 m_2 : TEXCOORD1_2; + float4 m_3 : TEXCOORD1_3; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = mul(float4(pos, 1.0f), m); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + m[0] = stage_input.m_0; + m[1] = stage_input.m_1; + m[2] = stage_input.m_2; + m[3] = stage_input.m_3; + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-output.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-output.vert new file mode 100644 index 0000000000..dc776cb5ec --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/matrix-output.vert @@ -0,0 +1,23 @@ +static float4 gl_Position; +static float4x4 m; + +struct SPIRV_Cross_Output +{ + float4x4 m : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + m = float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 1.0f)); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.m = m; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/no-contraction.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/no-contraction.vert new file mode 100644 index 0000000000..ad37dc23f1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/no-contraction.vert @@ -0,0 +1,45 @@ +static float4 gl_Position; +static float4 vA; +static float4 vB; +static float4 vC; + +struct SPIRV_Cross_Input +{ + float4 vA : TEXCOORD0; + float4 vB : TEXCOORD1; + float4 vC : TEXCOORD2; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + precise float4 _15 = vA * vB; + float4 mul = _15; + precise float4 _19 = vA + vB; + float4 add = _19; + precise float4 _23 = vA - vB; + float4 sub = _23; + precise float4 _27 = vA * vB; + precise float4 _30 = _27 + vC; + float4 mad = _30; + precise float4 _34 = mul + add; + precise float4 _36 = _34 + sub; + precise float4 _38 = _36 + mad; + float4 summed = _38; + gl_Position = summed; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vA = stage_input.vA; + vB = stage_input.vB; + vC = stage_input.vC; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/no-input.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/no-input.vert new file mode 100644 index 0000000000..c98544dbe8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/no-input.vert @@ -0,0 +1,18 @@ +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size-compat.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size-compat.vert new file mode 100644 index 0000000000..95f45d02f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size-compat.vert @@ -0,0 +1,20 @@ +static float4 gl_Position; +static float gl_PointSize; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_PointSize = 1.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size.sm30.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size.sm30.vert new file mode 100644 index 0000000000..7f9eba4742 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/point-size.sm30.vert @@ -0,0 +1,26 @@ +uniform float4 gl_HalfPixel; + +static float4 gl_Position; +static float gl_PointSize; +struct SPIRV_Cross_Output +{ + float4 gl_Position : POSITION; + float gl_PointSize : PSIZE; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + gl_PointSize = 4.0f; + gl_Position.x = gl_Position.x - gl_HalfPixel.x * gl_Position.w; + gl_Position.y = gl_Position.y + gl_HalfPixel.y * gl_Position.w; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.gl_PointSize = gl_PointSize; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/qualifiers.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/qualifiers.vert new file mode 100644 index 0000000000..bbf7dc61e4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/qualifiers.vert @@ -0,0 +1,56 @@ +struct Block +{ + float vFlat; + float vCentroid; + float vSample; + float vNoperspective; +}; + +static float4 gl_Position; +static float vFlat; +static float vCentroid; +static float vSample; +static float vNoperspective; +static Block vout; + +struct SPIRV_Cross_Output +{ + nointerpolation float vFlat : TEXCOORD0; + centroid float vCentroid : TEXCOORD1; + sample float vSample : TEXCOORD2; + noperspective float vNoperspective : TEXCOORD3; + nointerpolation float Block_vFlat : TEXCOORD4; + centroid float Block_vCentroid : TEXCOORD5; + sample float Block_vSample : TEXCOORD6; + noperspective float Block_vNoperspective : TEXCOORD7; + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = 1.0f.xxxx; + vFlat = 0.0f; + vCentroid = 1.0f; + vSample = 2.0f; + vNoperspective = 3.0f; + vout.vFlat = 0.0f; + vout.vCentroid = 1.0f; + vout.vSample = 2.0f; + vout.vNoperspective = 3.0f; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.vFlat = vFlat; + stage_output.vCentroid = vCentroid; + stage_output.vSample = vSample; + stage_output.vNoperspective = vNoperspective; + stage_output.Block_vFlat = vout.vFlat; + stage_output.Block_vCentroid = vout.vCentroid; + stage_output.Block_vSample = vout.vSample; + stage_output.Block_vNoperspective = vout.vNoperspective; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..f656c0a79f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/read-from-row-major-array.vert @@ -0,0 +1,65 @@ +cbuffer Block : register(b0) +{ + column_major float2x3 _104_var[3][4] : packoffset(c0); +}; + + +static float4 gl_Position; +static float4 a_position; +static float v_vtxResult; + +struct SPIRV_Cross_Input +{ + float4 a_position : TEXCOORD0; +}; + +struct SPIRV_Cross_Output +{ + float v_vtxResult : TEXCOORD0; + float4 gl_Position : SV_Position; +}; + +float compare_float(float a, float b) +{ + return float(abs(a - b) < 0.0500000007450580596923828125f); +} + +float compare_vec3(float3 a, float3 b) +{ + float param = a.x; + float param_1 = b.x; + float param_2 = a.y; + float param_3 = b.y; + float param_4 = a.z; + float param_5 = b.z; + return (compare_float(param, param_1) * compare_float(param_2, param_3)) * compare_float(param_4, param_5); +} + +float compare_mat2x3(float2x3 a, float2x3 b) +{ + float3 param = a[0]; + float3 param_1 = b[0]; + float3 param_2 = a[1]; + float3 param_3 = b[1]; + return compare_vec3(param, param_1) * compare_vec3(param_2, param_3); +} + +void vert_main() +{ + gl_Position = a_position; + float result = 1.0f; + float2x3 param = _104_var[0][0]; + float2x3 param_1 = float2x3(float3(2.0f, 6.0f, -6.0f), float3(0.0f, 5.0f, 5.0f)); + result *= compare_mat2x3(param, param_1); + v_vtxResult = result; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a_position = stage_input.a_position; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.v_vtxResult = v_vtxResult; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/return-array.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/return-array.vert new file mode 100644 index 0000000000..3e021257bd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/return-array.vert @@ -0,0 +1,48 @@ +static const float4 _20[2] = { 10.0f.xxxx, 20.0f.xxxx }; + +static float4 gl_Position; +static float4 vInput0; +static float4 vInput1; + +struct SPIRV_Cross_Input +{ + float4 vInput0 : TEXCOORD0; + float4 vInput1 : TEXCOORD1; +}; + +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void test(out float4 spvReturnValue[2]) +{ + spvReturnValue = _20; +} + +void test2(out float4 spvReturnValue[2]) +{ + float4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + spvReturnValue = foobar; +} + +void vert_main() +{ + float4 _42[2]; + test(_42); + float4 _44[2]; + test2(_44); + gl_Position = _42[0] + _44[1]; +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + vInput0 = stage_input.vInput0; + vInput1 = stage_input.vInput1; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/sampler-buffers.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/sampler-buffers.vert new file mode 100644 index 0000000000..a4329dbf36 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/sampler-buffers.vert @@ -0,0 +1,27 @@ +Buffer uFloatSampler : register(t1); +Buffer uIntSampler : register(t2); +Buffer uUintSampler : register(t3); + +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +float4 sample_from_function(Buffer s0, Buffer s1, Buffer s2) +{ + return (s0.Load(20) + asfloat(s1.Load(40))) + asfloat(s2.Load(60)); +} + +void vert_main() +{ + gl_Position = sample_from_function(uFloatSampler, uIntSampler, uUintSampler); +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/struct-composite-decl.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/struct-composite-decl.vert new file mode 100644 index 0000000000..5b2c5824fc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/struct-composite-decl.vert @@ -0,0 +1,50 @@ +struct VOut +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +static VOut vout; +static float4 a; +static float4 b; +static float4 c; +static float4 d; + +struct SPIRV_Cross_Input +{ + float4 a : TEXCOORD0; + float4 b : TEXCOORD1; + float4 c : TEXCOORD2; + float4 d : TEXCOORD3; +}; + +struct SPIRV_Cross_Output +{ + VOut vout : TEXCOORD0; +}; + +void emit_result(VOut v) +{ + vout = v; +} + +void vert_main() +{ + VOut _26 = { a, b, c, d }; + VOut param = _26; + emit_result(param); +} + +SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) +{ + a = stage_input.a; + b = stage_input.b; + c = stage_input.c; + d = stage_input.d; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.vout = vout; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-hlsl/vert/texture_buffer.vert b/third_party/spirv-cross/reference/shaders-hlsl/vert/texture_buffer.vert new file mode 100644 index 0000000000..1c92f6fe65 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-hlsl/vert/texture_buffer.vert @@ -0,0 +1,21 @@ +Buffer uSamp : register(t4); +RWBuffer uSampo : register(u5); + +static float4 gl_Position; +struct SPIRV_Cross_Output +{ + float4 gl_Position : SV_Position; +}; + +void vert_main() +{ + gl_Position = uSamp.Load(10) + uSampo[100]; +} + +SPIRV_Cross_Output main() +{ + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + return stage_output; +} diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..d24b9666fa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct T +{ + float a; +}; + +struct T_1 +{ + float b; +}; + +struct SSBO1 +{ + T_1 foo[1]; +}; + +struct T_2 +{ + float c; + char _m0_final_padding[12]; +}; + +struct SSBO2 +{ + T_2 bar[1]; +}; + +kernel void main0(device SSBO1& _7 [[buffer(0)]], device SSBO2& _10 [[buffer(1)]]) +{ + T v = T{ 40.0 }; + _7.foo[10].b = v.a; + _10.bar[30].c = v.a; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp new file mode 100644 index 0000000000..c3f9f5e14e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int s32; + uint u32; + short s16; + ushort u16; + float f32; +}; + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + int _29 = _4.s32; + uint _30 = _4.u32; + short _31 = _4.s16; + ushort _32 = _4.u16; + float _33 = _4.f32; + _4.s32 = int(_31); + _4.u32 = uint(_31); + _4.s32 = int(short(_32)); + _4.u32 = uint(short(_32)); + _4.u32 = uint(ushort(_31)); + _4.u32 = uint(_32); + _4.s16 = short(_29); + _4.u16 = ushort(_29); + _4.s16 = short(_30); + _4.u16 = ushort(_30); + _4.u16 = ushort(_29); + _4.u16 = ushort(_30); + _4.f32 = float(_31); + _4.f32 = float(short(_32)); + _4.f32 = float(ushort(_31)); + _4.f32 = float(_32); + _4.s16 = short(_33); + _4.u16 = ushort(short(_33)); + _4.u16 = ushort(_33); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..1015d2a5ee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,23 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + uint a; + uint b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _5 [[buffer(0)]]) +{ + uint _20 = atomic_load_explicit((device atomic_uint*)&_5.b, memory_order_relaxed); + uint c = _20; + atomic_store_explicit((device atomic_uint*)&_5.a, c, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp new file mode 100644 index 0000000000..3fdf46bbc5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + uint a; + int b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + uint _26 = atomic_fetch_max_explicit((device atomic_uint*)&_4.a, 1u, memory_order_relaxed); + uint _27 = uint(atomic_fetch_min_explicit((device atomic_int*)&_4.a, int(1u), memory_order_relaxed)); + uint _28 = atomic_fetch_min_explicit((device atomic_uint*)&_4.a, 4294967295u, memory_order_relaxed); + uint _29 = uint(atomic_fetch_max_explicit((device atomic_int*)&_4.a, int(4294967295u), memory_order_relaxed)); + int _30 = atomic_fetch_max_explicit((device atomic_int*)&_4.b, -3, memory_order_relaxed); + int _31 = int(atomic_fetch_min_explicit((device atomic_uint*)&_4.b, uint(-3), memory_order_relaxed)); + int _32 = atomic_fetch_min_explicit((device atomic_int*)&_4.b, 4, memory_order_relaxed); + int _33 = int(atomic_fetch_max_explicit((device atomic_uint*)&_4.b, uint(4), memory_order_relaxed)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..4624ef0b7c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,23 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + uint count; + uint data[1]; +}; + +kernel void main0(device SSBO& _5 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _24 = atomic_fetch_add_explicit((device atomic_uint*)&_5.count, 1u, memory_order_relaxed); + if (_24 < 1024u) + { + _5.data[_24] = gl_GlobalInvocationID.x; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp new file mode 100644 index 0000000000..6747f073c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _7 +{ + device uchar* _m0; + device spvUnsafeArray* _m1; +}; + +static inline __attribute__((always_inline)) +device uint* _23(device _7& _2) +{ + device spvUnsafeArray* _26 = _2._m1; + device uint* _29 = reinterpret_cast(reinterpret_cast(_26) + 16ul); + *_29 = 1u; + return _29; +} + +kernel void main0(device _7& _2 [[buffer(0)]]) +{ + device uint* _31 = _23(_2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp new file mode 100644 index 0000000000..0d63f5fa75 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + half2 a; + float b; + float c; + half2 d; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + _4.b = as_type(_4.a); + _4.d = as_type(_4.c); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..8e198a94df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int4 ints; + uint4 uints; +}; + +kernel void main0(device SSBO& _3 [[buffer(0)]]) +{ + int4 _19 = _3.ints; + uint4 _20 = _3.uints; + _3.ints = popcount(_19); + _3.uints = uint4(popcount(_19)); + _3.ints = int4(popcount(_20)); + _3.uints = popcount(_20); + _3.ints = reverse_bits(_19); + _3.uints = reverse_bits(_20); + _3.ints = extract_bits(_19, uint(1), 11u); + _3.uints = uint4(extract_bits(int4(_20), 11u, uint(1))); + _3.ints = int4(extract_bits(uint4(_19), uint(1), 11u)); + _3.uints = extract_bits(_20, 11u, uint(1)); + _3.ints = insert_bits(_19, _19.wzyx, uint(1), 11u); + _3.uints = insert_bits(_20, _20.wzyx, 11u, uint(1)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..1be65ec7cd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,53 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL findLSB() function +template +inline T spvFindLSB(T x) +{ + return select(ctz(x), T(-1), x == T(0)); +} + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Implementation of the unsigned GLSL findMSB() function +template +inline T spvFindUMSB(T x) +{ + return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); +} + +struct SSBO +{ + uint4 u; + int4 i; +}; + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + uint4 _19 = _4.u; + int4 _20 = _4.i; + _4.u = spvFindLSB(_19); + _4.i = int4(spvFindLSB(_19)); + _4.u = uint4(spvFindLSB(_20)); + _4.i = spvFindLSB(_20); + _4.u = spvFindUMSB(_19); + _4.i = int4(spvFindUMSB(_19)); + _4.u = spvFindUMSB(uint4(_20)); + _4.i = int4(spvFindUMSB(uint4(_20))); + _4.u = uint4(spvFindSMSB(int4(_19))); + _4.i = spvFindSMSB(int4(_19)); + _4.u = uint4(spvFindSMSB(_20)); + _4.i = spvFindSMSB(_20); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp new file mode 100644 index 0000000000..734a66870b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp @@ -0,0 +1,77 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_CommonConstants +{ + uint g_count; + packed_uint3 g_padding4; +}; + +struct MyStruct +{ + float4 m_coefficients[4]; +}; + +struct type_RWStructuredBuffer_MyStruct +{ + MyStruct _m0[1]; +}; + +constant spvUnsafeArray _27 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); + +kernel void main0(constant type_CommonConstants& CommonConstants [[buffer(0)]], device type_RWStructuredBuffer_MyStruct& g_data [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + do + { + if (gl_GlobalInvocationID.x >= CommonConstants.g_count) + { + break; + } + g_data._m0[gl_GlobalInvocationID.x] = MyStruct{ { float4(0.0), float4(0.0), float4(0.0), float4(0.0) } }; + break; + } while(false); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp new file mode 100644 index 0000000000..f3f73fbd98 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _10 +{ + float _m0[4]; + float _m1[4]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct SSBO +{ + uint a; + int b; +}; + +constant spvUnsafeArray _31 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0 }); + +kernel void main0() +{ + spvUnsafeArray<_10, 2> _34 = spvUnsafeArray<_10, 2>({ _10{ { 1.0, 2.0, 3.0, 4.0 }, { 1.0, 2.0, 3.0, 4.0 } }, _10{ { 1.0, 2.0, 3.0, 4.0 }, { 1.0, 2.0, 3.0, 4.0 } } }); + + spvUnsafeArray foo; + foo[0] = 1.0; + foo = _31; + foo[1] = 2.0; + foo[2] = 3.0; + foo[3] = 4.0; + spvUnsafeArray foo2 = foo; + _10 _37 = _10{ { foo[0], foo[1], foo[2], foo[3] }, { foo2[0], foo2[1], foo2[2], foo2[3] } }; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp new file mode 100644 index 0000000000..74464092ef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct SomeBuffer; + +struct SomeBuffer +{ + float4 v; + ulong a; + uint2 b; +}; + +struct Registers +{ + ulong address; + uint2 address2; +}; + +kernel void main0(constant Registers& registers [[buffer(0)]]) +{ + device SomeBuffer* _44 = reinterpret_cast(registers.address); + device SomeBuffer* _45 = reinterpret_cast(registers.address); + device SomeBuffer* _46 = reinterpret_cast(as_type(registers.address2)); + _44->v = float4(1.0, 2.0, 3.0, 4.0); + _45->v = float4(1.0, 2.0, 3.0, 4.0); + _46->v = float4(1.0, 2.0, 3.0, 4.0); + _44->a = reinterpret_cast(_44); + _45->a = reinterpret_cast(_45); + _46->b = as_type(reinterpret_cast(_46)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp new file mode 100644 index 0000000000..2fe09814bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct Block +{ + uint2 _m0[2]; + uint2 _m1[2]; +}; + +struct SSBO +{ + Block _m0[3]; +}; + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + threadgroup uint2 _18[2]; + ssbo._m0[0u] = Block{ { ssbo._m0[0u]._m1[0], ssbo._m0[0u]._m1[1] }, { ssbo._m0[0u]._m1[0], ssbo._m0[0u]._m1[1] } }; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..37ed0211f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct Block +{ + float4 f; +}; + +constant float _15 = {}; + +kernel void main0(device Block& block [[buffer(0)]]) +{ + block.f = float4(0.100000001490116119384765625, 0.20000000298023223876953125, 0.300000011920928955078125, 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..a5b6fc32ce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,61 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct SSBO +{ + int values[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u); + +constant spvUnsafeArray indexable = spvUnsafeArray({ 0, 1, 2, 3 }); +constant spvUnsafeArray indexable_1 = spvUnsafeArray({ 4, 5, 6, 7 }); + +kernel void main0(device SSBO& _6 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + _6.values[gl_GlobalInvocationID.x] = indexable[gl_LocalInvocationID.x] + indexable_1[gl_LocalInvocationID.y]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp new file mode 100644 index 0000000000..09a31d68a8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp @@ -0,0 +1,60 @@ +#include +#include + +using namespace metal; + +struct _11 +{ + float2x2 _m0; +}; + +struct _12 +{ + float2x4 _m0; +}; + +struct B2 +{ + float4 elem2; +}; + +struct C +{ + float4 c; + B2 b2; + B2 b2_array[4]; + _12 _m3; +}; + +struct B1 +{ + float4 elem1; +}; + +struct A +{ + float4 a; + B1 b1; + B1 b1_array[4]; + _11 _m3; +}; + +struct _8 +{ + A a_block; + C c_block; +}; + +kernel void main0(device _8& _3 [[buffer(0)]]) +{ + A _31; + _31.a = _3.c_block.c; + _31.b1.elem1 = _3.c_block.b2.elem2; + _31.b1_array[0].elem1 = _3.c_block.b2_array[0].elem2; + _31.b1_array[1].elem1 = _3.c_block.b2_array[1].elem2; + _31.b1_array[2].elem1 = _3.c_block.b2_array[2].elem2; + _31.b1_array[3].elem1 = _3.c_block.b2_array[3].elem2; + _31._m3._m0 = transpose(float2x2(_3.c_block._m3._m0[0].xy, _3.c_block._m3._m0[1].xy)); + _3.a_block = _31; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp new file mode 100644 index 0000000000..54087ddc51 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct _8 +{ + char _m0_pad[4]; + uint _m0; +}; + +struct _9 +{ + char _m0_pad[8]; + uint _m0; +}; + +struct _4 +{ + uint _m0; + uint4 _m1[2]; + uint _m2; + char _m3_pad[12]; + _8 _m3; + float4 _m4; + float3 _m5; + float2 _m6; +}; + +struct _5 +{ + uint _m0; + uint _m1[2]; + uint _m2; + _9 _m3; + float4 _m4; + float3 _m5; + float2 _m6; +}; + +kernel void main0(device _5& _2 [[buffer(0)]], device _4& _3 [[buffer(1)]]) +{ + _4 _23; + _23._m0 = _2._m0; + (thread uint&)_23._m1[0] = _2._m1[0]; + (thread uint&)_23._m1[1] = _2._m1[1]; + _23._m2 = _2._m2; + _23._m3._m0 = _2._m3._m0; + _23._m4 = _2._m4; + _23._m5 = _2._m5; + _23._m6 = _2._m6; + _3 = _23; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp new file mode 100644 index 0000000000..2225981524 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct B2 +{ + float4 elem2; +}; + +struct C +{ + float4 c; + B2 b2; + B2 b2_array[4]; +}; + +struct B1 +{ + float4 elem1; +}; + +struct A +{ + float4 a; + B1 b1; + B1 b1_array[4]; +}; + +struct _8 +{ + A a_block; + C c_block; +}; + +kernel void main0(device _8& _3 [[buffer(0)]]) +{ + A _27; + _27.a = _3.c_block.c; + _27.b1.elem1 = _3.c_block.b2.elem2; + _27.b1_array[0].elem1 = _3.c_block.b2_array[0].elem2; + _27.b1_array[1].elem1 = _3.c_block.b2_array[1].elem2; + _27.b1_array[2].elem1 = _3.c_block.b2_array[2].elem2; + _27.b1_array[3].elem1 = _3.c_block.b2_array[3].elem2; + _3.a_block = _27; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp new file mode 100644 index 0000000000..b024b5539d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp @@ -0,0 +1,174 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Block +{ + uint2 _m0[2]; + uint2 _m1[2]; +}; + +struct SSBO +{ + Block _m0[3]; +}; + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + threadgroup uint2 _18[2]; + spvUnsafeArray _27; + spvArrayCopyFromDeviceToStack1(_27.elements, ssbo._m0[0u]._m1); + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _27.elements); + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _27.elements); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp new file mode 100644 index 0000000000..a029a283d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp @@ -0,0 +1,135 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Block +{ + uint2 _m0[2]; + uint2 _m1[2]; +}; + +struct SSBO +{ + Block _m0[3]; +}; + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + threadgroup uint2 _18[2]; + uint2 _27[2]; + spvArrayCopyFromDeviceToStack1(_27, ssbo._m0[0u]._m1); + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _27); + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _27); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp new file mode 100644 index 0000000000..3ebc0d9128 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp @@ -0,0 +1,179 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Block +{ + uint2 _m0[2]; + uint2 _m1[2]; +}; + +struct SSBO +{ + Block _m0[3]; +}; + +kernel void main0(device SSBO& ssbo [[buffer(0)]], constant SSBO& ubo [[buffer(1)]]) +{ + threadgroup uint2 _18[2]; + spvArrayCopyFromDeviceToDevice1(ssbo._m0[0u]._m0, ssbo._m0[0u]._m1); + spvArrayCopyFromConstantToDevice1(ssbo._m0[0u]._m0, ubo._m0[0u]._m1); + spvUnsafeArray _24; + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _24.elements); + spvArrayCopyFromThreadGroupToDevice1(ssbo._m0[0u]._m0, _18); + spvArrayCopyFromDeviceToThreadGroup1(_18, ssbo._m0[0u]._m1); + spvArrayCopyFromDeviceToStack1(_24.elements, ssbo._m0[0u]._m1); + spvArrayCopyFromConstantToThreadGroup1(_18, ubo._m0[0u]._m1); + spvArrayCopyFromConstantToStack1(_24.elements, ubo._m0[0u]._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp new file mode 100644 index 0000000000..6f63d36e6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp @@ -0,0 +1,140 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Block +{ + uint2 _m0[2]; + uint2 _m1[2]; +}; + +struct SSBO +{ + Block _m0[3]; +}; + +kernel void main0(device SSBO& ssbo [[buffer(0)]], constant SSBO& ubo [[buffer(1)]]) +{ + threadgroup uint2 _18[2]; + spvArrayCopyFromDeviceToDevice1(ssbo._m0[0u]._m0, ssbo._m0[0u]._m1); + spvArrayCopyFromConstantToDevice1(ssbo._m0[0u]._m0, ubo._m0[0u]._m1); + uint2 _24[2]; + spvArrayCopyFromStackToDevice1(ssbo._m0[0u]._m0, _24); + spvArrayCopyFromThreadGroupToDevice1(ssbo._m0[0u]._m0, _18); + spvArrayCopyFromDeviceToThreadGroup1(_18, ssbo._m0[0u]._m1); + spvArrayCopyFromDeviceToStack1(_24, ssbo._m0[0u]._m1); + spvArrayCopyFromConstantToThreadGroup1(_18, ubo._m0[0u]._m1); + spvArrayCopyFromConstantToStack1(_24, ubo._m0[0u]._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..e265f1bd97 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +struct UBO +{ + float v; +}; + +struct SSBO +{ + float v; +}; + +kernel void main0() +{ + threadgroup float w; + float v; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..ab7a336327 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Implementation of the unsigned GLSL findMSB() function +template +inline T spvFindUMSB(T x) +{ + return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); +} + +// Implementation of the GLSL sign() function for integer types +template::value>::type> +inline T sign(T x) +{ + return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); +} + +struct SSBO +{ + int4 ints; + uint4 uints; +}; + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + int4 _19 = _4.ints; + uint4 _20 = _4.uints; + _4.ints = abs(_19); + _4.uints = uint4(abs(_19)); + _4.ints = abs(int4(_20)); + _4.uints = uint4(abs(int4(_20))); + _4.ints = sign(_19); + _4.uints = uint4(sign(_19)); + _4.ints = sign(int4(_20)); + _4.uints = uint4(sign(int4(_20))); + _4.ints = spvFindSMSB(int4(_20)); + _4.uints = uint4(spvFindSMSB(int4(_20))); + _4.ints = int4(spvFindUMSB(uint4(_19))); + _4.uints = spvFindUMSB(uint4(_19)); + _4.ints = min(_19, _19); + _4.uints = uint4(min(_19, int4(_20))); + _4.ints = min(int4(_20), int4(_20)); + _4.uints = uint4(min(int4(_20), _19)); + _4.ints = int4(min(uint4(_19), _20)); + _4.uints = min(uint4(_19), _20); + _4.ints = int4(min(_20, uint4(_19))); + _4.uints = min(_20, uint4(_19)); + _4.ints = max(_19, _19); + _4.uints = uint4(max(_19, _19)); + _4.ints = max(int4(_20), _19); + _4.uints = uint4(max(int4(_20), _19)); + _4.ints = int4(max(uint4(_19), _20)); + _4.uints = max(uint4(_19), uint4(_19)); + _4.ints = int4(max(_20, uint4(_19))); + _4.uints = max(_20, uint4(_19)); + _4.ints = clamp(int4(_20), int4(_20), int4(_20)); + _4.uints = uint4(clamp(int4(_20), int4(_20), int4(_20))); + _4.ints = int4(clamp(uint4(_19), uint4(_19), uint4(_19))); + _4.uints = clamp(uint4(_19), uint4(_19), uint4(_19)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp new file mode 100644 index 0000000000..0063faceaa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct _8 +{ + float _m0; + float _m1; +}; + +struct _15 +{ + float _m0; + int _m1; +}; + +struct _3 +{ + float _m0; + int _m1; +}; + +kernel void main0(device _3& _4 [[buffer(0)]]) +{ + _8 _23; + _23._m0 = modf(20.0, _23._m1); + _15 _24; + _24._m0 = frexp(40.0, _24._m1); + _4._m0 = _23._m0; + _4._m0 = _23._m1; + _4._m0 = _24._m0; + _4._m1 = _24._m1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp new file mode 100644 index 0000000000..365f89f74f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 values[1]; +}; + +constant uint _10_tmp [[function_constant(1)]]; +constant uint _10 = is_function_constant_defined(_10_tmp) ? _10_tmp : 11u; +constant uint _11_tmp [[function_constant(2)]]; +constant uint _11 = is_function_constant_defined(_11_tmp) ? _11_tmp : 12u; +constant uint _4_tmp [[function_constant(3)]]; +constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 13u; +constant uint _5_tmp [[function_constant(4)]]; +constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 14u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(3u, _10, _11); + +kernel void main0(device SSBO& _8 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _8.values[gl_GlobalInvocationID.x] += float4(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp new file mode 100644 index 0000000000..2dcff36923 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 values[1]; +}; + +constant int _10_tmp [[function_constant(1)]]; +constant int _10 = is_function_constant_defined(_10_tmp) ? _10_tmp : 11; +constant int _11_tmp [[function_constant(2)]]; +constant int _11 = is_function_constant_defined(_11_tmp) ? _11_tmp : 12; +constant int _4_tmp [[function_constant(3)]]; +constant int _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 13; +constant int _5_tmp [[function_constant(4)]]; +constant int _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 14; +constant uint _29 = (uint(_4) + 3u); +constant uint3 _30 = uint3(_29, _5, 2u); + +kernel void main0(device SSBO& _8 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _8.values[gl_GlobalInvocationID.x] = ((((_8.values[gl_GlobalInvocationID.x] + float4(2.0)) + float3(_30).xyzz) * float(_4)) * float(_5)) * float(int(2u)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp new file mode 100644 index 0000000000..3c00707f2e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct _17 +{ + float2 _m0; + float2 _m1; +}; + +struct _4 +{ + uint2 _m0[324]; +}; + +struct _7 +{ + float2 _m0[648]; +}; + +struct _10 +{ + float2 _m0[648]; +}; + +kernel void main0(const device _4& _5 [[buffer(0)]], device _7& _8 [[buffer(1)]], device _10& _11 [[buffer(2)]]) +{ + for (uint _39 = 0u; _39 < 648u; _39 += 2u) + { + uint2 _40 = _5._m0[_39 / 2u]; + float2 _41 = as_type(_40); + float2 _76; + float2 _61 = modf(_41, _76); + _8._m0[_39] = _76; + _8._m0[_39 + 1u] = _61; + _17 _64; + _64._m0 = modf(_41, _64._m1); + _17 _42 = _64; + _11._m0[_39] = _42._m1; + _11._m0[_39 + 1u] = _42._m0; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp new file mode 100644 index 0000000000..2a8b59f0b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp @@ -0,0 +1,51 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + int _m0[1][4]; +}; + +struct _9 +{ + int _m0[1][17]; +}; + +struct _11 +{ + int _m0; +}; + +kernel void main0(device _7& _2 [[buffer(0)]], device _9& _3 [[buffer(1)]], constant _11& _4 [[buffer(2)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + if (int3(gl_WorkGroupID).x >= _4._m0) + { + return; + } + int _49; + if (int3(gl_LocalInvocationID).x == 1) + { + _3._m0[int3(gl_WorkGroupID).x][16] = &_2._m0[int3(gl_WorkGroupID).x] - &_2._m0[0]; + _49 = 0; + } + else + { + _49 = 0; + } + for (;;) + { + int _50 = _49 + 1; + _3._m0[int3(gl_WorkGroupID).x][(int3(gl_LocalInvocationID).x * 4) + _49] = &_2._m0[int3(gl_WorkGroupID).x][int3(gl_LocalInvocationID).x] - &_2._m0[int3(gl_WorkGroupID).x][_49]; + if (_50 == 4) + { + break; + } + else + { + _49 = _50; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp new file mode 100644 index 0000000000..69e76f3f38 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + int _m0; + int _m1[1]; +}; + +struct _9 +{ + int2 _m0[1]; +}; + +kernel void main0(device _7& _2 [[buffer(0)]], device _9& _3 [[buffer(1)]]) +{ + int _28 = _2._m0; + device int* _4 = &_2._m1[0]; + device int* _5 = &_2._m1[0 + _28]; + int _34; + if (!(_28 <= 0)) + { + _34 = 0; + for (;;) + { + device int* _36 = _4; + device int* _37 = _5; + int _35 = _34 + 1; + _4 = &_36[1]; + _5 = &_37[-1]; + _3._m0[_34] = int2(_36 - _37, _37 - _36); + if (_34 >= _28) + { + break; + } + else + { + _34 = _35; + } + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp new file mode 100644 index 0000000000..52916413e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + uint _m0[1]; +}; + +kernel void main0(device _7& _2 [[buffer(0)]], device _7& _3 [[buffer(1)]], device _7& _4 [[buffer(2)]], device _7& _5 [[buffer(3)]]) +{ + uint _18 = 0u; + uint _28 = _18 + 1u; + _5._m0[_18] = uint(&_2 == &_3); + uint _32 = _28 + 1u; + _5._m0[_28] = uint(&_2._m0 == &_3._m0); + uint _36 = _32 + 1u; + _5._m0[_32] = uint(&_2._m0[0u] == &_3._m0[0u]); + uint _40 = _36 + 1u; + _5._m0[_36] = uint(&_2 == &_4); + uint _44 = _40 + 1u; + _5._m0[_40] = uint(&_2._m0 == &_4._m0); + uint _48 = _44 + 1u; + _5._m0[_44] = uint(&_2._m0[0u] == &_4._m0[0u]); + uint _52 = _48 + 1u; + _5._m0[_48] = uint(&_3 == &_4); + uint _56 = _52 + 1u; + _5._m0[_52] = uint(&_3._m0 == &_4._m0); + _5._m0[_56] = uint(&_3._m0[0u] == &_4._m0[0u]); + _5._m0[_56 + 1u] = uint(&_2 == &_2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp new file mode 100644 index 0000000000..16d29c1d6c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct _6 +{ + float4x4 _m0; + float4x4 _m1; + float _m2; + float _m3; +}; + +struct _7 +{ + uint _m0[1]; +}; + +kernel void main0(device _6& _2 [[buffer(0)]], device _6& _3 [[buffer(1)]], device _7& _4 [[buffer(2)]]) +{ + uint _26 = 0u; + uint _39 = _26 + 1u; + _4._m0[_26] = (&_2._m2 == &_2._m3) ? 0u : 1u; + bool _40 = &_2._m2 == &_3._m2; + uint _43 = _39 + 1u; + _4._m0[_39] = _40 ? 0u : 1u; + bool _46 = (_40 ? &_2._m2 : &_2._m3) == (_40 ? &_3._m2 : &_3._m3); + uint _49 = _43 + 1u; + _4._m0[_43] = _46 ? 0u : 1u; + uint _54 = _49 + 1u; + _4._m0[_49] = ((_46 ? &_2._m2 : &_2._m3) == &((device float*)&_2._m0[0u])[0u]) ? 0u : 1u; + uint _56 = (&_2._m0 == &_2._m1) ? 0u : 1u; + uint _58 = _54 + 1u; + _4._m0[_54] = _56; + _4._m0[_58] = _56; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp new file mode 100644 index 0000000000..d9af203553 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct _7 +{ + uint _m0[1]; +}; + +kernel void main0(device _7& _2 [[buffer(0)]], device _7& _3 [[buffer(1)]], device _7& _4 [[buffer(2)]], device _7& _5 [[buffer(3)]]) +{ + uint _18 = 0u; + uint _28 = _18 + 1u; + _5._m0[_18] = uint(&_2 != &_3); + uint _32 = _28 + 1u; + _5._m0[_28] = uint(&_2._m0 != &_3._m0); + uint _36 = _32 + 1u; + _5._m0[_32] = uint(&_2._m0[0u] != &_3._m0[0u]); + uint _40 = _36 + 1u; + _5._m0[_36] = uint(&_2 != &_4); + uint _44 = _40 + 1u; + _5._m0[_40] = uint(&_2._m0 != &_4._m0); + uint _48 = _44 + 1u; + _5._m0[_44] = uint(&_2._m0[0u] != &_4._m0[0u]); + uint _52 = _48 + 1u; + _5._m0[_48] = uint(&_3 != &_4); + uint _56 = _52 + 1u; + _5._m0[_52] = uint(&_3._m0 != &_4._m0); + _5._m0[_56] = uint(&_3._m0[0u] != &_4._m0[0u]); + _5._m0[_56 + 1u] = uint(&_2 != &_2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp new file mode 100644 index 0000000000..dda8505099 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int values[1]; +}; + +constant int A_tmp [[function_constant(0)]]; +constant int A = is_function_constant_defined(A_tmp) ? A_tmp : 0; +constant int A_1_tmp [[function_constant(1)]]; +constant int A_1 = is_function_constant_defined(A_1_tmp) ? A_1_tmp : 1; +constant int A_2_tmp [[function_constant(2)]]; +constant int A_2 = is_function_constant_defined(A_2_tmp) ? A_2_tmp : 2; +constant int A_3_tmp [[function_constant(3)]]; +constant int A_3 = is_function_constant_defined(A_3_tmp) ? A_3_tmp : 3; +constant int A_4_tmp [[function_constant(4)]]; +constant int A_4 = is_function_constant_defined(A_4_tmp) ? A_4_tmp : 4; +constant int A_5_tmp [[function_constant(5)]]; +constant int A_5 = is_function_constant_defined(A_5_tmp) ? A_5_tmp : 5; +constant int A_6 = (A - A_1); +constant int A_7 = (A_6 - A_2); +constant int A_8 = (A_7 - A_3); +constant int A_9 = (A_8 - A_4); +constant int A_10 = (A_9 - A_5); +constant int A_11 = (A_10 + A_5); +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _5 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _5.values[gl_GlobalInvocationID.x] = A_11; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp new file mode 100644 index 0000000000..5b1ed8ae24 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct _6 +{ + float _m0[1]; +}; + +constant uint _3_tmp [[function_constant(0)]]; +constant uint _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 1u; +constant uint _4_tmp [[function_constant(2)]]; +constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 3u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_3, 2u, _4); + +kernel void main0(device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint3 _23 = gl_WorkGroupSize; + _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp new file mode 100644 index 0000000000..6e9768540b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; +}; + +struct SSBORead +{ + float b; +}; + +static inline __attribute__((always_inline)) +void copy_out(device float& A, device const float& B) +{ + A = B; +} + +kernel void main0(device SSBO& _7 [[buffer(0)]], const device SSBORead& _9 [[buffer(1)]]) +{ + copy_out(_7.a, _9.b); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp new file mode 100644 index 0000000000..7c9718d1c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct foo +{ + int a[128]; + uint b; + float2 c; +}; + +struct bar +{ + int d; +}; + +struct baz +{ + int e[128]; +}; + +static inline __attribute__((always_inline)) +device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb) +{ + return (cb.d != 0) ? &buf.a[0u] : &buf2.e[0u]; +} + +static inline __attribute__((always_inline)) +device int* select_buffer_null(device foo& buf, constant bar& cb) +{ + return (cb.d != 0) ? &buf.a[0u] : nullptr; +} + +static inline __attribute__((always_inline)) +threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128]) +{ + return (cb.d != 0) ? &tgsm[0u] : nullptr; +} + +kernel void main0(device foo& buf [[buffer(0)]], constant bar& cb [[buffer(1)]], device baz& buf2 [[buffer(2)]]) +{ + threadgroup int tgsm[128]; + device int* sbuf = select_buffer(buf, buf2, cb); + device int* sbuf2 = select_buffer_null(buf, cb); + threadgroup int* stgsm = select_tgsm(cb, tgsm); + threadgroup int* cur = stgsm; + device int* _73; + _73 = &buf.a[0u]; + threadgroup int* _76; + int _77; + for (;;) + { + _76 = cur; + _77 = *_73; + if (_77 != 0) + { + int _81 = *_76; + int _82 = _77 + _81; + *_73 = _82; + *_76 = _82; + cur = &_76[1u]; + _73 = &_73[1u]; + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag new file mode 100644 index 0000000000..a7d3550a7a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct UBOs +{ + float4 v; +}; + +struct spvDescriptorSetBuffer0 +{ + constant UBOs* ubos [[id(0)]][2]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = spvDescriptorSet0.ubos[0]->v + spvDescriptorSet0.ubos[1]->v; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag new file mode 100644 index 0000000000..b6fe72b8d1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBOs +{ + float4 v; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBOs* ubos_0 [[buffer(0)]], constant UBOs* ubos_1 [[buffer(1)]]) +{ + constant UBOs* ubos[] = + { + ubos_0, + ubos_1, + }; + + main0_out out = {}; + out.FragColor = ubos[0]->v + ubos[1]->v; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..e4397f828f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,85 @@ +#include +#include + +using namespace metal; + +struct anon_aa +{ + int foo; +}; + +struct anon_ab +{ + int foo; +}; + +struct anon_a +{ + anon_aa _aa; + anon_ab ab; +}; + +struct anon_ba +{ + int foo; +}; + +struct anon_bb +{ + int foo; +}; + +struct anon_b +{ + anon_ba _ba; + anon_bb bb; +}; + +struct VertexData +{ + anon_a _a; + anon_b b; +}; + +struct anon_ca +{ + int foo; +}; + +struct anon_c +{ + anon_ca _ca; +}; + +struct anon_da +{ + int foo; +}; + +struct anon_d +{ + anon_da da; +}; + +struct UBO +{ + anon_c _c; + anon_d d; +}; + +struct anon_e +{ + int a; +}; + +struct SSBO +{ + anon_e _m0; + anon_e _e; + anon_e f; +}; + +fragment void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag new file mode 100644 index 0000000000..2da91dac7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct type_Globals +{ + float4 _BorderWidths[4]; +}; + +struct main0_out +{ + float4 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Globals& _Globals [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float2 _31 = float2(_Globals._BorderWidths[0].x, _Globals._BorderWidths[1].x); + float2 _39; + if (gl_FragCoord.x > 0.0) + { + float2 _38 = _31; + _38.x = _Globals._BorderWidths[2].x; + _39 = _38; + } + else + { + _39 = _31; + } + out.out_var_SV_Target = float4(_39, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..a4bb56283a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,121 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant float4 _32 = {}; + +constant spvUnsafeArray _34 = spvUnsafeArray({ float4(0.0), float4(0.0) }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vInput [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _37 = in.vInput; + float4 _38 = _37; + _38.x = 1.0; + _38.y = 2.0; + _38.z = 3.0; + _38.w = 4.0; + out.FragColor = _38; + float4 _6 = _37; + _6.x = 1.0; + _6.y = 2.0; + _6.z = 3.0; + _6.w = 4.0; + out.FragColor = _6; + float4 _42 = _37; + _42.x = 1.0; + _42.y = 2.0; + _42.z = 3.0; + _42.w = 4.0; + out.FragColor = _42; + float4 _44 = _37; + _44.x = 1.0; + float4 _45 = _44; + _45.y = 2.0; + float4 _46 = _45; + _46.z = 3.0; + float4 _47 = _46; + _47.w = 4.0; + out.FragColor = _47 + _44; + out.FragColor = _47 + _45; + float4 _49; + _49.x = 1.0; + _49.y = 2.0; + _49.z = 3.0; + _49.w = 4.0; + out.FragColor = _49; + float4 _53 = float4(0.0); + _53.x = 1.0; + out.FragColor = _53; + spvUnsafeArray _54 = _34; + _54[1].z = 1.0; + _54[0].w = 2.0; + out.FragColor = _54[0]; + out.FragColor = _54[1]; + float4x4 _58 = float4x4(float4(0.0), float4(0.0), float4(0.0), float4(0.0)); + _58[1].z = 1.0; + _58[2].w = 2.0; + out.FragColor = _58[0]; + out.FragColor = _58[1]; + out.FragColor = _58[2]; + out.FragColor = _58[3]; + float4 PHI; + PHI = _46; + float4 _65 = PHI; + _65.w = 4.0; + out.FragColor = _65; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag new file mode 100644 index 0000000000..eb78db5367 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag @@ -0,0 +1,70 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _3 +{ + spvUnsafeArray _m0; + float _m1[2]; + spvUnsafeArray _m2; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ 1.0, 2.0 }); +constant spvUnsafeArray _16 = spvUnsafeArray({ 3.0, 4.0 }); +constant spvUnsafeArray _17 = spvUnsafeArray({ 5.0, 6.0 }); + +struct main0_out +{ + float m_2 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + _3 _23 = _3{ spvUnsafeArray({ 1.0, 2.0 }), { 3.0, 4.0 }, spvUnsafeArray({ 5.0, 6.0 }) }; + out.m_2 = 1.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag new file mode 100644 index 0000000000..faa528bc32 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag @@ -0,0 +1,170 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct _3 +{ + float _m0[4]; +}; + +fragment void main0() +{ + spvUnsafeArray _20; + _20[0u] = 0.0; + _20[1u] = 0.0; + _20[2u] = 0.0; + _20[3u] = 0.0; + _3 _19; + spvArrayCopyFromStackToStack1(_19._m0, _20.elements); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..fdf4a92b99 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,35 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct EmptyStructTest +{ +}; +struct EmptyStruct2Test +{ + EmptyStructTest _m0; +}; + +static inline __attribute__((always_inline)) +float GetValue(thread const EmptyStruct2Test& self) +{ + return 0.0; +} + +static inline __attribute__((always_inline)) +float GetValue_1(EmptyStruct2Test self) +{ + return 0.0; +} + +fragment void main0() +{ + EmptyStruct2Test emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(EmptyStruct2Test{ EmptyStructTest{ } }); + value = GetValue_1(EmptyStruct2Test{ { } }); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag new file mode 100644 index 0000000000..9a5e195b48 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct _5ma_in_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment _5ma_in_out _5ma_in() +{ + _5ma_in_out out = {}; + out.FragColor = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..887200f785 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint3 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d Tex [[texture(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target0 = Tex.read(uint2(in.in_var_TEXCOORD0.xy), in.in_var_TEXCOORD0.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-gather.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-gather.asm.frag new file mode 100644 index 0000000000..47253429a8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-gather.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d g_texture [[texture(0)]], sampler g_sampler [[sampler(0)]], sampler g_comp [[sampler(1)]]) +{ + main0_out out = {}; + out.out_var_SV_Target0 = g_texture.gather(g_sampler, in.in_var_TEXCOORD0, int2(0), component::x) * g_texture.gather(g_sampler, in.in_var_TEXCOORD0, int2(0), component::y); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag new file mode 100644 index 0000000000..2e43ab0c2a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d ShadowMap [[texture(0)]], sampler SampleNormal [[sampler(0)]], sampler SampleShadow [[sampler(1)]]) +{ + main0_out out = {}; + float _41; + if (in.in_var_TEXCOORD0.x > 0.5) + { + _41 = float(float4(ShadowMap.sample(SampleNormal, in.in_var_TEXCOORD0)).x <= 0.5); + } + else + { + _41 = ShadowMap.sample_compare(SampleShadow, in.in_var_TEXCOORD0, 0.5, level(0.0)); + } + out.out_var_SV_Target0 = float4(_41, _41, _41, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag new file mode 100644 index 0000000000..daeccaedc6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float b; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float ALIAS_0_a [[user(locn1)]]; + float ALIAS_0_b [[user(locn2)]]; + float ALIAS_1_a [[user(locn3)]]; + float ALIAS_1_b [[user(locn4)]]; + float ALIAS_2_a [[user(locn5)]]; + float ALIAS_2_b [[user(locn6)]]; + float ALIAS_3_a [[user(locn7)]]; + float ALIAS_3_b [[user(locn8)]]; + float ALIAS_1_0_a [[user(locn10)]]; + float ALIAS_1_0_b [[user(locn11)]]; + float ALIAS_1_1_a [[user(locn12)]]; + float ALIAS_1_1_b [[user(locn13)]]; + float ALIAS_1_2_a [[user(locn14)]]; + float ALIAS_1_2_b [[user(locn15)]]; + float ALIAS_1_3_a [[user(locn16)]]; + float ALIAS_1_3_b [[user(locn17)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray ALIAS = {}; + spvUnsafeArray ALIAS_1 = {}; + ALIAS[0].a = in.ALIAS_0_a; + ALIAS[0].b = in.ALIAS_0_b; + ALIAS[1].a = in.ALIAS_1_a; + ALIAS[1].b = in.ALIAS_1_b; + ALIAS[2].a = in.ALIAS_2_a; + ALIAS[2].b = in.ALIAS_2_b; + ALIAS[3].a = in.ALIAS_3_a; + ALIAS[3].b = in.ALIAS_3_b; + ALIAS_1[0].a = in.ALIAS_1_0_a; + ALIAS_1[0].b = in.ALIAS_1_0_b; + ALIAS_1[1].a = in.ALIAS_1_1_a; + ALIAS_1[1].b = in.ALIAS_1_1_b; + ALIAS_1[2].a = in.ALIAS_1_2_a; + ALIAS_1[2].b = in.ALIAS_1_2_b; + ALIAS_1[3].a = in.ALIAS_1_3_a; + ALIAS_1[3].b = in.ALIAS_1_3_b; + out.FragColor.x = ALIAS[0].a; + out.FragColor.y = ALIAS[1].b; + out.FragColor.z = ALIAS[2].a; + out.FragColor.w = ALIAS_1[3].b; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag new file mode 100644 index 0000000000..0643acfa72 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag @@ -0,0 +1,25 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d uInput, thread float4& gl_FragCoord) +{ + return uInput.read(uint2(gl_FragCoord.xy)); +} + +fragment main0_out main0(texture2d uSubpass0 [[texture(0)]], texture2d uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy)) + load_subpasses(uSubpass1, gl_FragCoord); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag new file mode 100644 index 0000000000..910c8fa734 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + float3 col; + int2 _18; + float _23; + float _21 = modf(0.1500000059604644775390625, _23); + col.x = _23; + int _24; + float _22 = frexp(0.1500000059604644775390625, _24); + _18.y = _24; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..3f552ebbd0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(any)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..cffd0bd1af --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +constant int uninit_int = {}; +constant int4 uninit_vector = {}; +constant float4x4 uninit_matrix = {}; + +struct Foo +{ + int a; +}; + +constant Foo uninit_foo = {}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + int _39 = {}; + if (in.vColor.x > 10.0) + { + _39 = 10; + } + else + { + _39 = 20; + } + out.FragColor = in.vColor; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag new file mode 100644 index 0000000000..09c740694a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO1 +{ + uint values1[1]; +}; + +struct SSBO0 +{ + uint values0[1]; +}; + +static inline __attribute__((always_inline)) +void callee2(thread float4& gl_FragCoord, device SSBO1& _7) +{ + int _31 = int(gl_FragCoord.x); + _7.values1[_31]++; +} + +static inline __attribute__((always_inline)) +void callee(thread float4& gl_FragCoord, device SSBO1& _7, device SSBO0& _9) +{ + int _39 = int(gl_FragCoord.x); + _9.values0[_39]++; + callee2(gl_FragCoord, _7); +} + +fragment void main0(device SSBO1& _7 [[buffer(0), raster_order_group(0)]], device SSBO0& _9 [[buffer(1)]], float4 gl_FragCoord [[position]]) +{ + callee(gl_FragCoord, _7, _9); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag new file mode 100644 index 0000000000..692e391bc8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag @@ -0,0 +1,52 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO1 +{ + uint values1[1]; +}; + +struct _12 +{ + uint _m0[1]; +}; + +struct SSBO0 +{ + uint values0[1]; +}; + +static inline __attribute__((always_inline)) +void callee2(thread float4& gl_FragCoord, device SSBO1& _7) +{ + int _44 = int(gl_FragCoord.x); + _7.values1[_44]++; +} + +static inline __attribute__((always_inline)) +void callee(thread float4& gl_FragCoord, device SSBO1& _7, device SSBO0& _9) +{ + int _52 = int(gl_FragCoord.x); + _9.values0[_52]++; + callee2(gl_FragCoord, _7); + if (true) + { + } +} + +static inline __attribute__((always_inline)) +void _35(thread float4& gl_FragCoord, device _12& _13) +{ + _13._m0[int(gl_FragCoord.x)] = 4u; +} + +fragment void main0(device SSBO1& _7 [[buffer(0), raster_order_group(0)]], device _12& _13 [[buffer(1)]], device SSBO0& _9 [[buffer(2), raster_order_group(0)]], float4 gl_FragCoord [[position]]) +{ + callee(gl_FragCoord, _7, _9); + _35(gl_FragCoord, _13); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag new file mode 100644 index 0000000000..659e97602b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO1 +{ + uint values1[1]; +}; + +struct SSBO0 +{ + uint values0[1]; +}; + +static inline __attribute__((always_inline)) +void callee2(thread float4& gl_FragCoord, device SSBO1& _7) +{ + int _37 = int(gl_FragCoord.x); + _7.values1[_37]++; +} + +static inline __attribute__((always_inline)) +void callee(thread float4& gl_FragCoord, device SSBO1& _7, device SSBO0& _9) +{ + int _45 = int(gl_FragCoord.x); + _9.values0[_45]++; + callee2(gl_FragCoord, _7); +} + +static inline __attribute__((always_inline)) +void _29() +{ +} + +static inline __attribute__((always_inline)) +void _31() +{ +} + +fragment void main0(device SSBO1& _7 [[buffer(0), raster_order_group(0)]], device SSBO0& _9 [[buffer(1), raster_order_group(0)]], float4 gl_FragCoord [[position]]) +{ + callee(gl_FragCoord, _7, _9); + _29(); + _31(); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag new file mode 100644 index 0000000000..5bc3c47ef9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float b = 10.0; + b = 20.0; + out.FragColor = b + b; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..5c8ec371e3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float _mat3(thread const float& a) +{ + return a + 1.0; +} + +static inline __attribute__((always_inline)) +float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(thread const int& a) +{ + return float(a) + 1.0; +} + +fragment main0_out main0() +{ + main0_out out = {}; + float param = 2.0; + int param_1 = 4; + out.FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..7fa8233db0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,71 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _15 +{ + float _m0; +}; + +constant spvUnsafeArray _29 = spvUnsafeArray({ 0.0, 1.0 }); +constant spvUnsafeArray _30 = spvUnsafeArray({ 1.0, 0.0 }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = false ? float4(1.0, 1.0, 0.0, 1.0) : float4(0.0, 0.0, 0.0, 1.0); + out.FragColor = float4(false); + out.FragColor = select(float4(0.0, 0.0, 0.0, 1.0), float4(1.0, 1.0, 0.0, 1.0), bool4(false, true, false, true)); + out.FragColor = float4(bool4(false, true, false, true)); + _15 _32 = false ? (_15{ 0.0 }) : (_15{ 1.0 }); + spvUnsafeArray _33 = true ? _29 : _30; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag new file mode 100644 index 0000000000..2f5cd66284 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + uint FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + uint _17 = uint(in.index); + out.FragColor = uint(simd_min(in.index)); + out.FragColor = uint(simd_max(int(_17))); + out.FragColor = simd_min(uint(in.index)); + out.FragColor = simd_max(_17); + out.FragColor = uint(quad_min(in.index)); + out.FragColor = uint(quad_max(int(_17))); + out.FragColor = quad_min(uint(in.index)); + out.FragColor = quad_max(_17); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..e179b7e233 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,75 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIndex [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + int i = 0; + main0_out out = {}; + int j; + int _30; + int _31; + if (in.vIndex != 0 && in.vIndex != 1 && in.vIndex != 11 && in.vIndex != 2 && in.vIndex != 3 && in.vIndex != 4 && in.vIndex != 5) + { + _30 = 2; + } + if (in.vIndex == 1 || in.vIndex == 11) + { + _31 = 1; + } + switch (in.vIndex) + { + case 0: + { + _30 = 3; + } + default: + { + j = _30; + _31 = 0; + } + case 1: + case 11: + { + j = _31; + } + case 2: + { + break; + } + case 3: + { + if (in.vIndex > 3) + { + i = 0; + break; + } + else + { + break; + } + } + case 4: + { + } + case 5: + { + i = 0; + break; + } + } + out.FragColor = float4(float(i)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag new file mode 100644 index 0000000000..32fdc2975a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag @@ -0,0 +1,190 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +// Wrapper function that swizzles depth texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherCompareSwizzle(const thread Tex& t, sampler s, uint sw, Ts... params) +{ + if (sw) + { + switch (spvSwizzle(sw & 0xFF)) + { + case spvSwizzle::none: + case spvSwizzle::red: + break; + case spvSwizzle::zero: + case spvSwizzle::green: + case spvSwizzle::blue: + case spvSwizzle::alpha: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + } + } + return t.gather_compare(s, spvForward(params)...); +} + +fragment void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], depth2d depth2d [[texture(6)]], depthcube depthCube [[texture(7)]], depth2d_array depth2dArray [[texture(8)]], depthcube_array depthCubeArray [[texture(9)]], texture2d texBuffer [[texture(10)]], sampler tex1dSamp [[sampler(0)]], sampler tex2dSamp [[sampler(1)]], sampler tex3dSamp [[sampler(2)]], sampler texCubeSamp [[sampler(3)]], sampler tex2dArraySamp [[sampler(4)]], sampler texCubeArraySamp [[sampler(5)]], sampler depth2dSamp [[sampler(6)]], sampler depthCubeSamp [[sampler(7)]], sampler depth2dArraySamp [[sampler(8)]], sampler depthCubeArraySamp [[sampler(9)]]) +{ + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + constant uint& depth2dSwzl = spvSwizzleConstants[6]; + constant uint& depthCubeSwzl = spvSwizzleConstants[7]; + constant uint& depth2dArraySwzl = spvSwizzleConstants[8]; + constant uint& depthCubeArraySwzl = spvSwizzleConstants[9]; + float4 c = spvTextureSwizzle(tex1d.sample(tex1dSamp, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSamp, float2(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float3(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSamp, float3(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySamp, float3(0.0).xy, uint(rint(float3(0.0).z))), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySamp, float4(0.0).xyz, uint(rint(float4(0.0).w))), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, float3(0.0, 0.0, 1.0).xy, 1.0), depth2dSwzl); + c.x = spvTextureSwizzle(depthCube.sample_compare(depthCubeSamp, float4(0.0, 0.0, 0.0, 1.0).xyz, 1.0), depthCubeSwzl); + c.x = spvTextureSwizzle(depth2dArray.sample_compare(depth2dArraySamp, float4(0.0, 0.0, 0.0, 1.0).xy, uint(rint(float4(0.0, 0.0, 0.0, 1.0).z)), 1.0), depth2dArraySwzl); + c.x = spvTextureSwizzle(depthCubeArray.sample_compare(depthCubeArraySamp, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0), depthCubeArraySwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSamp, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSamp, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl); + float4 _152 = float4(0.0, 0.0, 1.0, 1.0); + _152.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _152.xy / _152.z, 1.0 / _152.z), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSamp, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSamp, float2(0.0), level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float3(0.0), level(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSamp, float3(0.0), level(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySamp, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySamp, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, float3(0.0, 0.0, 1.0).xy, 1.0, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSamp, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSamp, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl); + float4 _202 = float4(0.0, 0.0, 1.0, 1.0); + _202.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _202.xy / _202.z, 1.0 / _202.z, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl); + c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl); + c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl); + c = spvTextureSwizzle(tex2dArray.read(uint2(int3(0).xy), uint(int3(0).z), 0), tex2dArraySwzl); + c = texBuffer.read(spvTexelBufferCoord(0)); + c = spvGatherSwizzle(tex2d, tex2dSamp, tex2dSwzl, component::x, float2(0.0), int2(0)); + c = spvGatherSwizzle(texCube, texCubeSamp, texCubeSwzl, component::y, float3(0.0)); + c = spvGatherSwizzle(tex2dArray, tex2dArraySamp, tex2dArraySwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0)); + c = spvGatherSwizzle(texCubeArray, texCubeArraySamp, texCubeArraySwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w))); + c = spvGatherCompareSwizzle(depth2d, depth2dSamp, depth2dSwzl, float2(0.0), 1.0); + c = spvGatherCompareSwizzle(depthCube, depthCubeSamp, depthCubeSwzl, float3(0.0), 1.0); + c = spvGatherCompareSwizzle(depth2dArray, depth2dArraySamp, depth2dArraySwzl, float3(0.0).xy, uint(rint(float3(0.0).z)), 1.0); + c = spvGatherCompareSwizzle(depthCubeArray, depthCubeArraySamp, depthCubeArraySwzl, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag new file mode 100644 index 0000000000..5ba57b3f62 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 _GLF_color [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float4 _13 = modf(float4(1.0, 0.0, 0.0, 1.0), out._GLF_color); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..8935cd63f9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +constant float4 undef = {}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vFloat [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(undef.x, in.vFloat.y, 0.0, in.vFloat.w) + float4(in.vFloat.z, in.vFloat.y, 0.0, in.vFloat.w); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc new file mode 100644 index 0000000000..3872124d5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc @@ -0,0 +1,82 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + + threadgroup C c[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + c[gl_InvocationID] = _18[gl_InvocationID]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.p_v = float4(0.0); + c[gl_InvocationID].v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..e576472f37 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup C spvStoragec[8][4]; + threadgroup C (&c)[4] = spvStoragec[(gl_GlobalInvocationID.x / 4) % 8]; + c[gl_GlobalInvocationID.x % 4] = _18[gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.p_v = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + c[gl_InvocationID].v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc new file mode 100644 index 0000000000..5c6ad2a8be --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc @@ -0,0 +1,81 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct main0_out +{ + float4 c_v; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ +}; +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + + threadgroup P p; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].c_v = _18[gl_InvocationID].v; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + p = P{ float4(0.0) }; + gl_out[gl_InvocationID].c_v = float4(1.0); + p.v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..12295e778e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc @@ -0,0 +1,84 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct main0_out +{ + float4 c_v; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ +}; +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].c_v = _18[gl_GlobalInvocationID.x % 4].v; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup P spvStoragep[8]; + threadgroup P (&p) = spvStoragep[(gl_GlobalInvocationID.x / 4) % 8]; + p = P{ float4(0.0) }; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].c_v = float4(1.0); + p.v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc new file mode 100644 index 0000000000..d5ff9d0bd2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _51 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _52 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 c_v; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + spvUnsafeArray _33 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].c_v = _18[gl_InvocationID].v; + gl_out[gl_InvocationID].gl_Position = _33[gl_InvocationID].gl_Position; + gl_out[gl_InvocationID].gl_ClipDistance = _33[gl_InvocationID].gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _33[gl_InvocationID].gl_CullDistance; + gl_out_masked[gl_InvocationID] = _33[gl_InvocationID]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.p_v = float4(0.0); + gl_out[gl_InvocationID].c_v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out_masked[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..32fb659893 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc @@ -0,0 +1,103 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _51 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _52 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 c_v; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + spvUnsafeArray _33 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].c_v = _18[gl_GlobalInvocationID.x % 4].v; + gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _33[gl_GlobalInvocationID.x % 4].gl_Position; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _33[gl_GlobalInvocationID.x % 4].gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _33[gl_GlobalInvocationID.x % 4].gl_CullDistance; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + gl_out_masked[gl_GlobalInvocationID.x % 4] = _33[gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.p_v = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].c_v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out_masked[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc new file mode 100644 index 0000000000..ce16f37975 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _51 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _52 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 c_v; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + spvUnsafeArray _33 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].c_v = _18[gl_InvocationID].v; + gl_out[gl_InvocationID].gl_PointSize = _33[gl_InvocationID].gl_PointSize; + gl_out[gl_InvocationID].gl_ClipDistance = _33[gl_InvocationID].gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _33[gl_InvocationID].gl_CullDistance; + gl_out_masked[gl_InvocationID] = _33[gl_InvocationID]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.p_v = float4(0.0); + gl_out[gl_InvocationID].c_v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..671aa25a02 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc @@ -0,0 +1,103 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct C +{ + float4 v; +}; + +struct P +{ + float4 v; +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _51 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _52 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 c_v; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 p_v; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _18 = spvUnsafeArray({ C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) }, C{ float4(0.0) } }); + spvUnsafeArray _33 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].c_v = _18[gl_GlobalInvocationID.x % 4].v; + gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _33[gl_GlobalInvocationID.x % 4].gl_PointSize; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _33[gl_GlobalInvocationID.x % 4].gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _33[gl_GlobalInvocationID.x % 4].gl_CullDistance; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + gl_out_masked[gl_GlobalInvocationID.x % 4] = _33[gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.p_v = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].c_v = float4(1.0); + patchOut.p_v = float4(2.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc new file mode 100644 index 0000000000..25fe13bf67 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc @@ -0,0 +1,90 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex +{ + float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position; + float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup float4 foo[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + foo[gl_InvocationID] = _15[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_Position; + gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.foo_patch = float4(0.0); + foo[gl_InvocationID] = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..750ef96d17 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc @@ -0,0 +1,93 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex +{ + float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position; + float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup float4 spvStoragefoo[8][4]; + threadgroup float4 (&foo)[4] = spvStoragefoo[(gl_GlobalInvocationID.x / 4) % 8]; + foo[gl_GlobalInvocationID.x % 4] = _15[gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_Position; + gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.foo_patch = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + foo[gl_InvocationID] = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc new file mode 100644 index 0000000000..e8f1146b42 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc @@ -0,0 +1,89 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex +{ + float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position; + float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ +}; +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup float4 foo_patch; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].foo = _15[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_Position; + gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + foo_patch = float4(0.0); + gl_out[gl_InvocationID].foo = float4(1.0); + foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc new file mode 100644 index 0000000000..a7c1e5d617 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex +{ + float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position; + float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + spvUnsafeArray _RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ +}; +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _29 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_Position; + gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4]._RESERVED_IDENTIFIER_FIXUP_gl_CullDistance; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup float4 spvStoragefoo_patch[8]; + threadgroup float4 (&foo_patch) = spvStoragefoo_patch[(gl_GlobalInvocationID.x / 4) % 8]; + foo_patch = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].foo = float4(1.0); + foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc new file mode 100644 index 0000000000..344751b04c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc @@ -0,0 +1,90 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _29 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].foo = _15[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = _29[gl_InvocationID].gl_Position; + gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID].gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID].gl_CullDistance; + gl_out_masked[gl_InvocationID] = _29[gl_InvocationID]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.foo_patch = float4(0.0); + gl_out[gl_InvocationID].foo = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out_masked[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..92731ec03a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc @@ -0,0 +1,93 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _29 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].gl_Position = _29[gl_GlobalInvocationID.x % 4].gl_Position; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4].gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4].gl_CullDistance; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + gl_out_masked[gl_GlobalInvocationID.x % 4] = _29[gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.foo_patch = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].foo = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out_masked[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc new file mode 100644 index 0000000000..2f11636a0c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc @@ -0,0 +1,90 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _29 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].foo = _15[gl_InvocationID]; + gl_out[gl_InvocationID].gl_PointSize = _29[gl_InvocationID].gl_PointSize; + gl_out[gl_InvocationID].gl_ClipDistance = _29[gl_InvocationID].gl_ClipDistance; + gl_out[gl_InvocationID].gl_CullDistance = _29[gl_InvocationID].gl_CullDistance; + gl_out_masked[gl_InvocationID] = _29[gl_InvocationID]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + patchOut.foo_patch = float4(0.0); + gl_out[gl_InvocationID].foo = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..7283eddb1f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc @@ -0,0 +1,93 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +constant spvUnsafeArray _15 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); +constant spvUnsafeArray _45 = spvUnsafeArray({ 0.0 }); +constant spvUnsafeArray _46 = spvUnsafeArray({ 0.0 }); + +struct main0_out +{ + float4 foo; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_patchOut +{ + float4 foo_patch; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _29 = spvUnsafeArray({ gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) }, gl_PerVertex{ float4(0.0), 0.0, spvUnsafeArray({ 0.0 }), spvUnsafeArray({ 0.0 }) } }); + + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].foo = _15[gl_GlobalInvocationID.x % 4]; + gl_out[gl_GlobalInvocationID.x % 4].gl_PointSize = _29[gl_GlobalInvocationID.x % 4].gl_PointSize; + gl_out[gl_GlobalInvocationID.x % 4].gl_ClipDistance = _29[gl_GlobalInvocationID.x % 4].gl_ClipDistance; + gl_out[gl_GlobalInvocationID.x % 4].gl_CullDistance = _29[gl_GlobalInvocationID.x % 4].gl_CullDistance; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + gl_out_masked[gl_GlobalInvocationID.x % 4] = _29[gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + patchOut.foo_patch = float4(0.0); + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].foo = float4(1.0); + patchOut.foo_patch = float4(2.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp new file mode 100644 index 0000000000..d2c368b8ed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp @@ -0,0 +1,16 @@ +#include +#include + +using namespace metal; + +struct SSBORow +{ + float v; + float4x4 row_major0; +}; + +kernel void main0(device SSBORow& _4 [[buffer(0)]]) +{ + _4.v = _4.row_major0[2][1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp new file mode 100644 index 0000000000..0ae12f0858 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct SSBOScalar +{ + float3 a; + float3x3 b; + float3x3 c; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float3x3 _20 = transpose(_4.b); + _4.b = _4.c; + _4.a = _20 * _4.a; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp new file mode 100644 index 0000000000..86bdd45279 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBOScalar +{ + packed_float3 a; + packed_float3 b; + packed_float3 c; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float3 _17 = float3(_4.b); + float3 _19 = float3(_4.c); + _4.c = _17; + _4.a = _17 * _19; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp new file mode 100644 index 0000000000..669420436b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBOScalar +{ + float4 a[16]; + float4 b[16]; + float4 c[16]; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float2 _27 = _4.b[10].xy; + float _29 = _4.c[10].x; + (device float2&)_4.b[10] = float2(10.0, 11.0); + (device float2&)_4.a[10] = _27 * _29; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp new file mode 100644 index 0000000000..23d25b8286 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct SSBOScalar +{ + float2 a; + packed_float3 b; + packed_float3 c; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float3 _21 = float3(_4.b); + float3 _24 = float3(_4.c); + _4.b = float3(1.0); + _4.a = _21.xy * _24.yz; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp new file mode 100644 index 0000000000..c21fcc7ffc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +typedef packed_float3 packed_rm_float3x3[3]; + +struct SSBOScalar +{ + packed_float3 a; + packed_rm_float3x3 b; + packed_rm_float3x3 c; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float3x3 _20 = transpose(float3x3(float3(_4.b[0]), float3(_4.b[1]), float3(_4.b[2]))); + _4.b[0] = float3x3(float3(_4.c[0]), float3(_4.c[1]), float3(_4.c[2]))[0]; + _4.b[1] = float3x3(float3(_4.c[0]), float3(_4.c[1]), float3(_4.c[2]))[1]; + _4.b[2] = float3x3(float3(_4.c[0]), float3(_4.c[1]), float3(_4.c[2]))[2]; + _4.a = _20 * float3(_4.a); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp new file mode 100644 index 0000000000..4c70aede48 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct SSBOScalar +{ + float2 a; + packed_float3 b; + packed_float3 c; + float3 d; +}; + +kernel void main0(device SSBOScalar& _4 [[buffer(0)]]) +{ + float3 _23 = float3(_4.b); + float3 _24 = _23; + _24.z = 2.0; + _4.a = _23.xy * _23.z; + _4.b = _24; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp new file mode 100644 index 0000000000..f12092cf8f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp @@ -0,0 +1,16 @@ +#include +#include + +using namespace metal; + +struct SSBORow +{ + float v; + float4x4 row_major0; +}; + +kernel void main0(device SSBORow& _4 [[buffer(0)]]) +{ + _4.v = ((device float*)&_4.row_major0[2u])[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag new file mode 100644 index 0000000000..f26e35c672 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[8]; + float b; +}; + +struct main0_out +{ + float2 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0].xy + Foo.a[1].xy) + float2(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag new file mode 100644 index 0000000000..6f8546532f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + packed_float3 a[1]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = float3(Foo.a[0]) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag new file mode 100644 index 0000000000..565ee64e04 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[12]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0].xyz + Foo.a[1].xyz) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag new file mode 100644 index 0000000000..8440b2f229 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[8]; + float b; +}; + +struct main0_out +{ + float2 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0u].xy + Foo.a[1u].xy) + float2(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag new file mode 100644 index 0000000000..9b347718ed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[8]; + float b; +}; + +struct main0_out +{ + float2 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (float2(Foo.a[0][0u], Foo.a[1][0u]) + float2(Foo.a[0][1u], Foo.a[1][1u])) + float2(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag new file mode 100644 index 0000000000..cd40af10f2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[12]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0u].xyz + Foo.a[1u].xyz) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag new file mode 100644 index 0000000000..86dfd6054b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float2x4 a; + char _m1_pad[8]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (float3(Foo.a[0][0u], Foo.a[1][0u], Foo.a[2][0u]) + float3(Foo.a[0][1u], Foo.a[1][1u], Foo.a[2][1u])) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag new file mode 100644 index 0000000000..7430a551fa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float2x4 a; + char _m1_pad[8]; + float b; +}; + +struct main0_out +{ + float2 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0u].xy + Foo.a[1u].xy) + float2(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag new file mode 100644 index 0000000000..19b7f1eebb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float4 a[1]; + char _m1_pad[12]; + float b; +}; + +struct main0_out +{ + float2 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (float2(Foo.a[0][0u], Foo.a[1][0u]) + float2(Foo.a[0][1u], Foo.a[1][1u])) + float2(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag new file mode 100644 index 0000000000..f8008525b6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float2x4 a; + char _m1_pad[12]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (Foo.a[0u].xyz + Foo.a[1u].xyz) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag new file mode 100644 index 0000000000..041b6e91d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct type_Foo +{ + float2x4 a; + char _m1_pad[12]; + float b; +}; + +struct main0_out +{ + float3 out_var_SV_Target [[color(0)]]; +}; + +fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = (float3(Foo.a[0][0u], Foo.a[1][0u], Foo.a[2][0u]) + float3(Foo.a[0][1u], Foo.a[1][1u], Foo.a[2][1u])) + float3(Foo.b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..6fbf2ff70f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vA [[user(locn0)]]; + int vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(0.0); + int _10 = {}; + int _15 = {}; + for (int _16 = 0, _17 = 0; _16 < in.vA; _17 = _15, _16 += _10) + { + if ((in.vA + _16) == 20) + { + _15 = 50; + } + else + { + _15 = ((in.vB + _16) == 40) ? 60 : _17; + } + _10 = _15 + 10; + out.FragColor += float4(1.0); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..5c30e05a4b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc @@ -0,0 +1,65 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _49 = spvUnsafeArray({ 0.0, 0.0, 0.0 }); +constant spvUnsafeArray, 4> _27 = spvUnsafeArray, 4>({ spvUnsafeArray({ 0.0, 0.0, 0.0 }), spvUnsafeArray({ 0.0, 0.0, 0.0 }), spvUnsafeArray({ 0.0, 0.0, 0.0 }), spvUnsafeArray({ 0.0, 0.0, 0.0 }) }); + +struct main0_out +{ + spvUnsafeArray foo; + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].foo = _27[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].foo[0] = float(gl_InvocationID); + gl_out[gl_InvocationID].foo[1] = float(gl_InvocationID) + 1.0; + gl_out[gl_InvocationID].foo[2] = float(gl_InvocationID) + 2.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..71498f5b20 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc @@ -0,0 +1,70 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Verts +{ + float a; + float2 b; +}; + +struct main0_out +{ + float verts_a; + float2 verts_b; + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _27 = spvUnsafeArray({ Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) } }); + + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].verts_a = _27[gl_InvocationID].a; + gl_out[gl_InvocationID].verts_b = _27[gl_InvocationID].b; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].verts_a = float(gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..d8b74bfa33 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc @@ -0,0 +1,80 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex +{ + float4 _RESERVED_IDENTIFIER_FIXUP_gl_Position; + float _RESERVED_IDENTIFIER_FIXUP_gl_PointSize; +}; + +struct Verts +{ + float a; + float2 b; +}; + +struct main0_out +{ + float verts_a; + float2 verts_b; + float4 gl_Position; + float gl_PointSize; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4> _17 = spvUnsafeArray<_RESERVED_IDENTIFIER_FIXUP_gl_PerVertex, 4>({ _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0 }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0 }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0 }, _RESERVED_IDENTIFIER_FIXUP_gl_PerVertex{ float4(0.0), 0.0 } }); + spvUnsafeArray _27 = spvUnsafeArray({ Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) }, Verts{ 0.0, float2(0.0) } }); + + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].gl_Position = _17[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_Position; + gl_out[gl_InvocationID].gl_PointSize = _17[gl_InvocationID]._RESERVED_IDENTIFIER_FIXUP_gl_PointSize; + gl_out[gl_InvocationID].verts_a = _27[gl_InvocationID].a; + gl_out[gl_InvocationID].verts_b = _27[gl_InvocationID].b; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].verts_a = float(gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..a10731bb28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float2 b; + float4 c; +}; + +struct main0_out +{ + Foo foo; + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvUnsafeArray _27 = spvUnsafeArray({ Foo{ 0.0, float2(0.0), float4(0.0) }, Foo{ 0.0, float2(0.0), float4(0.0) }, Foo{ 0.0, float2(0.0), float4(0.0) }, Foo{ 0.0, float2(0.0), float4(0.0) } }); + + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].foo = _27[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].foo.a = float(gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc new file mode 100644 index 0000000000..c606f6a075 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc @@ -0,0 +1,125 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct cb1_struct +{ + float4 _m0[1]; +}; + +struct main0_out +{ + float3 vocp0; + float4 vocp1; +}; + +struct main0_in +{ + float4 v0 [[attribute(0)]]; + float4 v1 [[attribute(1)]]; + float3 vicp0 [[attribute(2)]]; + float4 vicp1 [[attribute(4)]]; +}; + +static inline __attribute__((always_inline)) +void fork0_epilogue(thread const float4& _87, thread const float4& _88, thread const float4& _89, device half (&gl_TessLevelOuter)[3]) +{ + gl_TessLevelOuter[0u] = half(_87.x); + gl_TessLevelOuter[1u] = half(_88.x); + gl_TessLevelOuter[2u] = half(_89.x); +} + +static inline __attribute__((always_inline)) +void fork0(uint vForkInstanceId, device half (&gl_TessLevelOuter)[3], thread spvUnsafeArray& opc, constant cb1_struct& cb0_0, thread float4& _48, thread float4& _49, thread float4& _50) +{ + float4 r0; + r0.x = as_type(vForkInstanceId); + opc[as_type(r0.x)].x = cb0_0._m0[0u].x; + _48 = opc[0u]; + _49 = opc[1u]; + _50 = opc[2u]; + fork0_epilogue(_48, _49, _50, gl_TessLevelOuter); +} + +static inline __attribute__((always_inline)) +void fork1_epilogue(thread const float4& _109, device half &gl_TessLevelInner) +{ + gl_TessLevelInner = half(_109.x); +} + +static inline __attribute__((always_inline)) +void fork1(device half &gl_TessLevelInner, thread spvUnsafeArray& opc, constant cb1_struct& cb0_0, thread float4& _56) +{ + opc[3u].x = cb0_0._m0[0u].x; + _56 = opc[3u]; + fork1_epilogue(_56, gl_TessLevelInner); +} + +kernel void main0(main0_in in [[stage_in]], constant cb1_struct& cb0_0 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray, 2> vicp; + spvUnsafeArray _153 = spvUnsafeArray({ gl_in[0].v0, gl_in[1].v0, gl_in[2].v0 }); + vicp[0u] = _153; + spvUnsafeArray _154 = spvUnsafeArray({ gl_in[0].v1, gl_in[1].v1, gl_in[2].v1 }); + vicp[1u] = _154; + gl_out[gl_InvocationID].vocp0 = gl_in[gl_InvocationID].vicp0; + gl_out[gl_InvocationID].vocp1 = gl_in[gl_InvocationID].vicp1; + spvUnsafeArray opc; + float4 _48; + float4 _49; + float4 _50; + fork0(0u, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor, opc, cb0_0, _48, _49, _50); + fork0(1u, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor, opc, cb0_0, _48, _49, _50); + fork0(2u, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor, opc, cb0_0, _48, _49, _50); + float4 _56; + fork1(spvTessLevel[gl_PrimitiveID].insideTessellationFactor, opc, cb0_0, _56); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc new file mode 100644 index 0000000000..6585e77204 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _19 = spvUnsafeArray({ 1.0, 2.0 }); +constant spvUnsafeArray _25 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0 }); + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_19[0]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_25[0]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_25[1]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_25[2]); + spvUnsafeArray inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor), 0.0 }); + spvUnsafeArray outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), 0.0 }); + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..0c6c1dc813 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc @@ -0,0 +1,62 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _25 = spvUnsafeArray({ 0.0, 0.0, 0.0, 0.0 }); + +struct main0_out +{ + float v; + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + gl_out[gl_InvocationID].v = _25[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].v = float(gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc new file mode 100644 index 0000000000..e1357064b8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -0,0 +1,139 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexOutput +{ + float4 pos; + float2 uv; +}; + +struct HSOut +{ + float4 pos; + float2 uv; +}; + +struct HSConstantOut +{ + spvUnsafeArray EdgeTess; + float InsideTess; +}; + +struct VertexOutput_1 +{ + float2 uv; +}; + +struct HSOut_1 +{ + float2 uv; +}; + +struct main0_out +{ + HSOut_1 _entryPointOutput; + float4 gl_Position; +}; + +struct main0_in +{ + float2 p_uv [[attribute(0)]]; + float4 gl_Position [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +HSOut _hs_main(thread const spvUnsafeArray& p, thread const uint& i) +{ + HSOut _output; + _output.pos = p[i].pos; + _output.uv = p[i].uv; + return _output; +} + +static inline __attribute__((always_inline)) +HSConstantOut PatchHS(thread const spvUnsafeArray& _patch) +{ + HSConstantOut _output; + _output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x; + _output.EdgeTess[1] = (float2(1.0) + _patch[0].uv).x; + _output.EdgeTess[2] = (float2(1.0) + _patch[0].uv).x; + _output.InsideTess = (float2(1.0) + _patch[0].uv).x; + return _output; +} + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray p; + p[0].pos = gl_in[0].gl_Position; + p[0].uv = gl_in[0].p_uv; + p[1].pos = gl_in[1].gl_Position; + p[1].uv = gl_in[1].p_uv; + p[2].pos = gl_in[2].gl_Position; + p[2].uv = gl_in[2].p_uv; + uint i = gl_InvocationID; + spvUnsafeArray param = p; + uint param_1 = i; + HSOut flattenTemp = _hs_main(param, param_1); + gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; + gl_out[gl_InvocationID]._entryPointOutput.uv = flattenTemp.uv; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (int(gl_InvocationID) == 0) + { + spvUnsafeArray param_2 = p; + HSConstantOut _patchConstantResult = PatchHS(param_2); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_patchConstantResult.EdgeTess[0]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_patchConstantResult.EdgeTess[1]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_patchConstantResult.EdgeTess[2]); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_patchConstantResult.InsideTess); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc new file mode 100644 index 0000000000..c3ace1b9e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc @@ -0,0 +1,138 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexOutput +{ + float4 pos; + float2 uv; +}; + +struct HSOut +{ + float4 pos; + float2 uv; +}; + +struct HSConstantOut +{ + spvUnsafeArray EdgeTess; + float InsideTess; +}; + +struct VertexOutput_1 +{ + float2 uv; +}; + +struct HSOut_1 +{ + float2 uv; +}; + +struct main0_out +{ + HSOut_1 _entryPointOutput; + float4 gl_Position; +}; + +struct main0_in +{ + VertexOutput_1 p; + ushort2 m_171; + float4 gl_Position; +}; + +static inline __attribute__((always_inline)) +HSOut _hs_main(thread const spvUnsafeArray& p, thread const uint& i) +{ + HSOut _output; + _output.pos = p[i].pos; + _output.uv = p[i].uv; + return _output; +} + +static inline __attribute__((always_inline)) +HSConstantOut PatchHS(thread const spvUnsafeArray& _patch) +{ + HSConstantOut _output; + _output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x; + _output.EdgeTess[1] = (float2(1.0) + _patch[0].uv).x; + _output.EdgeTess[2] = (float2(1.0) + _patch[0].uv).x; + _output.InsideTess = (float2(1.0) + _patch[0].uv).x; + return _output; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 3; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1); + spvUnsafeArray p; + p[0].pos = gl_in[0].gl_Position; + p[0].uv = gl_in[0].p.uv; + p[1].pos = gl_in[1].gl_Position; + p[1].uv = gl_in[1].p.uv; + p[2].pos = gl_in[2].gl_Position; + p[2].uv = gl_in[2].p.uv; + uint i = gl_InvocationID; + spvUnsafeArray param = p; + uint param_1 = i; + HSOut flattenTemp = _hs_main(param, param_1); + gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; + gl_out[gl_InvocationID]._entryPointOutput.uv = flattenTemp.uv; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (int(gl_InvocationID) == 0) + { + spvUnsafeArray param_2 = p; + HSConstantOut _patchConstantResult = PatchHS(param_2); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_patchConstantResult.EdgeTess[0]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_patchConstantResult.EdgeTess[1]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_patchConstantResult.EdgeTess[2]); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_patchConstantResult.InsideTess); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc new file mode 100644 index 0000000000..d6d0bc0149 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _27 = spvUnsafeArray({ 0.0, 0.0 }); +constant spvUnsafeArray _33 = spvUnsafeArray({ 0.0, 0.0, 0.0, 0.0 }); + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(0.0); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(5.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(6.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc new file mode 100644 index 0000000000..979f4329f5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _27 = spvUnsafeArray({ 0.0, 0.0 }); +constant spvUnsafeArray _33 = spvUnsafeArray({ 0.0, 0.0, 0.0, 0.0 }); + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(0.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(0.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(0.0); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(5.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc new file mode 100644 index 0000000000..b6e40bc835 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc @@ -0,0 +1,35 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +static inline __attribute__((always_inline)) +void store_tess_level_in_func(device half &gl_TessLevelInner, device half (&gl_TessLevelOuter)[3]) +{ + gl_TessLevelInner = half(1.0); + gl_TessLevelOuter[0] = half(3.0); + gl_TessLevelOuter[1] = half(4.0); + gl_TessLevelOuter[2] = half(5.0); +} + +static inline __attribute__((always_inline)) +float load_tess_level_in_func(device half &gl_TessLevelInner, device half (&gl_TessLevelOuter)[3]) +{ + return float(gl_TessLevelInner) + float(gl_TessLevelOuter[1]); +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + store_tess_level_in_func(spvTessLevel[gl_PrimitiveID].insideTessellationFactor, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor); + float v = load_tess_level_in_func(spvTessLevel[gl_PrimitiveID].insideTessellationFactor, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor); + gl_out[gl_InvocationID].gl_Position = float4(v); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese new file mode 100644 index 0000000000..7fa0f5a4e4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 out_var_CUSTOM_VALUE [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + out.out_var_CUSTOM_VALUE = float4(gl_TessLevelOuter[0] + gl_TessLevelInner[0], gl_TessLevelOuter[1] + gl_TessLevelInner[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese new file mode 100644 index 0000000000..05a8113331 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float o0 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in0 [[attribute(0)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + out.o0 = patchIn.gl_in[0u].in0.z; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert new file mode 100644 index 0000000000..3e91bb9eb2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert @@ -0,0 +1,128 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct PerVertex +{ + float4 v_color; + float2 v_texPos; + float3 v_worldPosition; +}; + +struct u_objToWorlds +{ + float4x4 u_objToWorld; +}; + +struct CameraData +{ + float4x4 u_projectFromView; + float4x4 u_projectFromWorld; + float4x4 u_clipFromPixels; + float4x4 u_viewFromWorld; + float4x4 u_worldFromView; + float4x4 u_viewFromProject; + packed_float3 u_cameraPosition; + float pad0; + packed_float3 u_cameraRight; + float pad1; + packed_float3 u_cameraUp; + float pad2; + packed_float3 u_cameraForward; + float pad3; + float2 u_clipPlanes; + float2 u_invProjParams; + float2 u_viewportSize; + float2 u_invViewportSize; + float2 u_viewportOffset; + float2 u_fragToLightGrid; + float2 u_screenToLightGrid; + float2 pad4; + float4 u_lightGridZParams; +}; + +struct LightData +{ + float4 posRadius; + float3 color; + float4 axis; + float3 directionalParams; + float4 spotParams; + float4 shadowSize; + float4x4 cookieFromWorld; + float4x4 shadowFromWorld; + uint shadowTextureValid; + uint lightCookieValid; + float minLightDistance; + float pad; +}; + +struct SceneSettings +{ + CameraData u_cameras[2]; + float3 u_centerPosition; + float3 u_centerRight; + float3 u_centerUp; + float3 u_centerForward; + float2 u_times; + uint u_lightFXMask; + LightData u_lights[8]; + float3 u_globalLightDir; + float3 u_globalLightDiffuseColor; + float3 u_globalLightSpecularColor; + float2 u_distanceFog; + float2 u_heightFog; + float4 u_fogColor; + uint u_debugMode; +}; + +struct LightContext +{ + float3 u_ambientIBLTint; + float3 u_specularIBLTint; + float3 u_iblAABBMin; + float3 u_iblAABBMax; + float3 u_iblAABBCenter; + float LightContext_unusued0; + float u_exposureMultiplier; +}; + +struct main0_out +{ + float4 m_3_v_color [[user(locn1)]]; + float2 m_3_v_texPos [[user(locn2)]]; + float3 m_3_v_worldPosition [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 a_position [[attribute(0)]]; + float2 a_texcoord [[attribute(1)]]; + float4 a_color [[attribute(2)]]; +}; + +static inline __attribute__((always_inline)) +void DrawWorldVS(thread PerVertex& _3, thread float4& a_color, thread float2& a_texcoord, thread float3& a_position, thread float4& gl_Position, constant u_objToWorlds& _12, constant SceneSettings& _17) +{ + _3.v_color = a_color; + _3.v_texPos = a_texcoord; + _3.v_worldPosition = a_position; + float4 worldSpacePosition = _12.u_objToWorld * float4(a_position, 1.0); + gl_Position = _17.u_cameras[0].u_projectFromWorld * worldSpacePosition; +} + +vertex main0_out main0(main0_in in [[stage_in]], constant u_objToWorlds& _12 [[buffer(0)]], constant SceneSettings& _17 [[buffer(1)]]) +{ + main0_out out = {}; + PerVertex _3 = {}; + DrawWorldVS(_3, in.a_color, in.a_texcoord, in.a_position, out.gl_Position, _12, _17); + out.m_3_v_color = _3.v_color; + out.m_3_v_texPos = _3.v_texPos; + out.m_3_v_worldPosition = _3.v_worldPosition; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..6c8f938270 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct Vert +{ + float a; + float b; +}; + +struct Foo +{ + float c; + float d; +}; + +struct main0_out +{ + float m_3_a [[user(locn0)]]; + float m_3_b [[user(locn1)]]; + float foo_c [[user(locn2)]]; + float foo_d [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + Vert _3 = Vert{ 0.0, 0.0 }; + Foo foo = Foo{ 0.0, 0.0 }; + out.gl_Position = float4(0.0); + out.m_3_a = _3.a; + out.m_3_b = _3.b; + out.foo_c = foo.c; + out.foo_d = foo.d; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..54b88ba9c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(0.0); + out.gl_PointSize = 0.0; + out.gl_Position = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert new file mode 100644 index 0000000000..ea89378b10 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert @@ -0,0 +1,31 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct type_Float2Array +{ + float4 arr[3]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +static inline __attribute__((always_inline)) +float4 src_VSMain(thread const uint& i, constant type_Float2Array& Float2Array) +{ + return float4(Float2Array.arr[i].x, Float2Array.arr[i].y, 0.0, 1.0); +} + +vertex main0_out main0(constant type_Float2Array& Float2Array [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + uint param_var_i = gl_VertexIndex; + out.gl_Position = src_VSMain(param_var_i, Float2Array); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert new file mode 100644 index 0000000000..07bcb9f101 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert @@ -0,0 +1,89 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _14 +{ + float _m0[3]; +}; + +struct _15 +{ + float _m0[3]; +}; + +constant spvUnsafeArray _93 = spvUnsafeArray({ 1.0, 2.0, 1.0 }); +constant spvUnsafeArray _94 = spvUnsafeArray({ -1.0, -2.0, -1.0 }); + +struct main0_out +{ + float4 m_4 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_3 [[attribute(0)]]; + float4 m_5 [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +float4 _102(float4 _107) +{ + float4 _109 = _107; + _14 _110 = _14{ { 1.0, 2.0, 1.0 } }; + _15 _111 = _15{ { -1.0, -2.0, -1.0 } }; + _109.y = (_110._m0[2] + _111._m0[2]) + _109.y; + return _109; +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.m_3; + out.m_4 = _102(in.m_5); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert new file mode 100644 index 0000000000..f007a67f22 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +vertex main0_out main0(uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + const uint gl_ViewIndex = 0; + out.gl_Position = float4(float(int(gl_ViewIndex))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..95b61a40db --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +struct Test +{ +}; +vertex void main0() +{ + Test t = Test{ }; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag new file mode 100644 index 0000000000..18d98993e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant float _21 = {}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + spvUnsafeArray _23; + for (int _25 = 0; _25 < 2; ) + { + _23[_25] = 0.0; + _25++; + continue; + } + float _37; + if (as_type(3.0) != 0u) + { + _37 = _23[0]; + } + else + { + _37 = _21; + } + out.gl_Position = float4(0.0, 0.0, 0.0, _37); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert new file mode 100644 index 0000000000..750afcf25b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert @@ -0,0 +1,20 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +device float* thread * constant _9 = {}; + +static inline __attribute__((always_inline)) +void _10(device float* thread * const thread & _11) +{ +} + +vertex void main0() +{ + device float* thread * _14 = _9; + _10(_14); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp new file mode 100644 index 0000000000..eab1df4fce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp @@ -0,0 +1,172 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 1u, 1u); + +kernel void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + threadgroup float shared_group[8][8]; + threadgroup float shared_group_alt[8][8]; + spvUnsafeArray blob; + for (int i = 0; i < 8; i++) + { + blob[i] = float(i); + } + spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob.elements); + threadgroup_barrier(mem_flags::mem_threadgroup); + spvUnsafeArray copied_blob; + spvArrayCopyFromThreadGroupToStack1(copied_blob.elements, shared_group[gl_LocalInvocationIndex ^ 1u]); + spvArrayCopyFromThreadGroupToThreadGroup1(shared_group_alt[gl_LocalInvocationIndex], shared_group[gl_LocalInvocationIndex]); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp new file mode 100644 index 0000000000..ae8c5b0295 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp @@ -0,0 +1,90 @@ +#include +#include + +using namespace metal; + +struct Baz +{ + int e; + int f; +}; + +struct Foo +{ + int a; + int b; +}; + +struct Bar +{ + int c; + int d; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(3u, 3u, 2u); + +struct spvDescriptorSetBuffer0 +{ + constant Foo* m_34 [[id(0)]]; + constant Bar* m_40 [[id(1)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + device Baz* baz [[id(0)]][3][3][2]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant uint* spvDynamicOffsets [[buffer(23)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + constant auto& _34 = *(constant Foo* )((constant char* )spvDescriptorSet0.m_34 + spvDynamicOffsets[0]); + device Baz* baz[3][3][2] = + { + { + { + (device Baz* )((device char* )spvDescriptorSet1.baz[0][0][0] + spvDynamicOffsets[1]), + (device Baz* )((device char* )spvDescriptorSet1.baz[0][0][1] + spvDynamicOffsets[2]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[0][1][0] + spvDynamicOffsets[3]), + (device Baz* )((device char* )spvDescriptorSet1.baz[0][1][1] + spvDynamicOffsets[4]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[0][2][0] + spvDynamicOffsets[5]), + (device Baz* )((device char* )spvDescriptorSet1.baz[0][2][1] + spvDynamicOffsets[6]), + }, + }, + { + { + (device Baz* )((device char* )spvDescriptorSet1.baz[1][0][0] + spvDynamicOffsets[7]), + (device Baz* )((device char* )spvDescriptorSet1.baz[1][0][1] + spvDynamicOffsets[8]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[1][1][0] + spvDynamicOffsets[9]), + (device Baz* )((device char* )spvDescriptorSet1.baz[1][1][1] + spvDynamicOffsets[10]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[1][2][0] + spvDynamicOffsets[11]), + (device Baz* )((device char* )spvDescriptorSet1.baz[1][2][1] + spvDynamicOffsets[12]), + }, + }, + { + { + (device Baz* )((device char* )spvDescriptorSet1.baz[2][0][0] + spvDynamicOffsets[13]), + (device Baz* )((device char* )spvDescriptorSet1.baz[2][0][1] + spvDynamicOffsets[14]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[2][1][0] + spvDynamicOffsets[15]), + (device Baz* )((device char* )spvDescriptorSet1.baz[2][1][1] + spvDynamicOffsets[16]), + }, + { + (device Baz* )((device char* )spvDescriptorSet1.baz[2][2][0] + spvDynamicOffsets[17]), + (device Baz* )((device char* )spvDescriptorSet1.baz[2][2][1] + spvDynamicOffsets[18]), + }, + }, + }; + + uint3 coords = gl_GlobalInvocationID; + baz[coords.x][coords.y][coords.z]->e = _34.a + (*spvDescriptorSet0.m_40).c; + baz[coords.x][coords.y][coords.z]->f = _34.b * (*spvDescriptorSet0.m_40).d; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp new file mode 100644 index 0000000000..bf26b3b280 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct Ref; + +struct Ref +{ + float4 v; +}; + +struct Registers +{ + device Ref* foo; +}; + +kernel void main0(constant Registers& _14 [[buffer(0)]]) +{ + device Ref* __restrict ref = _14.foo; + ref->v = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp new file mode 100644 index 0000000000..2e86f996c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct SSBO0 +{ + short4 inputs[1]; +}; + +struct SSBO1 +{ + int4 outputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO0& _25 [[buffer(0)]], device SSBO1& _39 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + half2 a = as_type(_25.inputs[ident].xy); + ((device int*)&_39.outputs[ident])[0u] = int(as_type(a + half2(half(1.0)))); + ((device int*)&_39.outputs[ident])[1u] = as_type(_25.inputs[ident].zw); + ((device int*)&_39.outputs[ident])[2u] = int(as_type(ushort2(_25.inputs[ident].xy))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp new file mode 100644 index 0000000000..fa65e3bb4d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct SSBO1 +{ + short4 outputs[1]; +}; + +struct SSBO0 +{ + int4 inputs[1]; +}; + +struct UBO +{ + half4 const0; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO1& _21 [[buffer(0)]], device SSBO0& _29 [[buffer(1)]], constant UBO& _40 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + int _33 = ((device int*)&_29.inputs[ident])[0u]; + short2 _47 = as_type(_33) + as_type(_40.const0.xy); + ((device short*)&_21.outputs[ident])[0u] = _47.x; + ((device short*)&_21.outputs[ident])[1u] = _47.y; + int _57 = ((device int*)&_29.inputs[ident])[1u]; + short2 _67 = short2(as_type(uint(_57)) - as_type(_40.const0.zw)); + ((device short*)&_21.outputs[ident])[2u] = _67.x; + ((device short*)&_21.outputs[ident])[3u] = _67.y; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..7f797add16 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL findLSB() function +template +inline T spvFindLSB(T x) +{ + return select(ctz(x), T(-1), x == T(0)); +} + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Implementation of the unsigned GLSL findMSB() function +template +inline T spvFindUMSB(T x) +{ + return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); +} + +kernel void main0() +{ + int signed_value = 0; + uint unsigned_value = 0u; + int s = extract_bits(signed_value, uint(5), uint(20)); + uint u = extract_bits(unsigned_value, uint(6), uint(21)); + s = insert_bits(s, 40, uint(5), uint(4)); + u = insert_bits(u, 60u, uint(5), uint(4)); + u = reverse_bits(u); + s = reverse_bits(s); + int v0 = int(popcount(u)); + int v1 = popcount(s); + int v2 = int(spvFindUMSB(u)); + int v3 = spvFindSMSB(s); + int v4 = int(spvFindLSB(u)); + int v5 = spvFindLSB(s); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp new file mode 100644 index 0000000000..7864e0fb76 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct SSBO; + +struct S +{ + float3 v; +}; + +struct SSBO +{ + S s[1]; +}; + +struct PC +{ + uint2 ptr; +}; + +kernel void main0(constant PC& pc [[buffer(0)]]) +{ + device SSBO* ssbo = reinterpret_cast(as_type(pc.ptr)); + ssbo->s[0].v = float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp new file mode 100644 index 0000000000..b1790b23df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp @@ -0,0 +1,289 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL radians() function +template +inline T radians(T d) +{ + return d * T(0.01745329251); +} + +// Implementation of the GLSL degrees() function +template +inline T degrees(T r) +{ + return r * T(57.2957795131); +} + +// Implementation of the GLSL findLSB() function +template +inline T spvFindLSB(T x) +{ + return select(ctz(x), T(-1), x == T(0)); +} + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Implementation of the unsigned GLSL findMSB() function +template +inline T spvFindUMSB(T x) +{ + return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); +} + +// Implementation of the GLSL sign() function for integer types +template::value>::type> +inline T sign(T x) +{ + return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); +} + +// Returns the determinant of a 2x2 matrix. +static inline __attribute__((always_inline)) +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the determinant of a 3x3 matrix. +static inline __attribute__((always_inline)) +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float4x4 spvInverse4x4(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float3x3 spvInverse3x3(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float2x2 spvInverse2x2(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +template +[[clang::optnone]] T spvReflect(T i, T n) +{ + return i - T(2) * i * n * n; +} + +template +inline T spvRefract(T i, T n, T eta) +{ + T NoI = n * i; + T NoI2 = NoI * NoI; + T k = T(1) - eta * eta * (T(1) - NoI2); + if (k < T(0)) + { + return T(0); + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +template +inline T spvFaceForward(T n, T i, T nref) +{ + return i * nref < T(0) ? n : -n; +} + +struct SSBO +{ + float res; + int ires; + uint ures; + float4 f32; + int4 s32; + uint4 u32; + float2x2 m2; + float3x3 m3; + float4x4 m4; +}; + +struct ResType +{ + float _m0; + int _m1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _19 [[buffer(0)]]) +{ + _19.res = round(((device float*)&_19.f32)[0u]); + _19.res = rint(((device float*)&_19.f32)[0u]); + _19.res = trunc(((device float*)&_19.f32)[0u]); + _19.res = abs(((device float*)&_19.f32)[0u]); + _19.ires = abs(((device int*)&_19.s32)[0u]); + _19.res = sign(((device float*)&_19.f32)[0u]); + _19.ires = sign(((device int*)&_19.s32)[0u]); + _19.res = floor(((device float*)&_19.f32)[0u]); + _19.res = ceil(((device float*)&_19.f32)[0u]); + _19.res = fract(((device float*)&_19.f32)[0u]); + _19.res = radians(((device float*)&_19.f32)[0u]); + _19.res = degrees(((device float*)&_19.f32)[0u]); + _19.res = sin(((device float*)&_19.f32)[0u]); + _19.res = cos(((device float*)&_19.f32)[0u]); + _19.res = tan(((device float*)&_19.f32)[0u]); + _19.res = asin(((device float*)&_19.f32)[0u]); + _19.res = acos(((device float*)&_19.f32)[0u]); + _19.res = atan(((device float*)&_19.f32)[0u]); + _19.res = fast::sinh(((device float*)&_19.f32)[0u]); + _19.res = fast::cosh(((device float*)&_19.f32)[0u]); + _19.res = precise::tanh(((device float*)&_19.f32)[0u]); + _19.res = asinh(((device float*)&_19.f32)[0u]); + _19.res = acosh(((device float*)&_19.f32)[0u]); + _19.res = atanh(((device float*)&_19.f32)[0u]); + _19.res = precise::atan2(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.res = pow(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.res = exp(((device float*)&_19.f32)[0u]); + _19.res = log(((device float*)&_19.f32)[0u]); + _19.res = exp2(((device float*)&_19.f32)[0u]); + _19.res = log2(((device float*)&_19.f32)[0u]); + _19.res = sqrt(((device float*)&_19.f32)[0u]); + _19.res = rsqrt(((device float*)&_19.f32)[0u]); + _19.res = abs(((device float*)&_19.f32)[0u]); + _19.res = abs(((device float*)&_19.f32)[0u] - ((device float*)&_19.f32)[1u]); + _19.res = sign(((device float*)&_19.f32)[0u]); + _19.res = spvFaceForward(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + _19.res = spvReflect(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.res = spvRefract(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + _19.res = length(_19.f32.xy); + _19.res = distance(_19.f32.xy, _19.f32.zw); + float2 v2 = fast::normalize(_19.f32.xy); + v2 = faceforward(_19.f32.xy, _19.f32.yz, _19.f32.zw); + v2 = reflect(_19.f32.xy, _19.f32.zw); + v2 = refract(_19.f32.xy, _19.f32.yz, ((device float*)&_19.f32)[3u]); + float3 v3 = cross(_19.f32.xyz, _19.f32.yzw); + _19.res = determinant(_19.m2); + _19.res = determinant(_19.m3); + _19.res = determinant(_19.m4); + _19.m2 = spvInverse2x2(_19.m2); + _19.m3 = spvInverse3x3(_19.m3); + _19.m4 = spvInverse4x4(_19.m4); + float tmp; + float _287 = modf(((device float*)&_19.f32)[0u], tmp); + _19.res = _287; + _19.res = fast::min(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.ures = min(((device uint*)&_19.u32)[0u], ((device uint*)&_19.u32)[1u]); + _19.ires = min(((device int*)&_19.s32)[0u], ((device int*)&_19.s32)[1u]); + _19.res = fast::max(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.ures = max(((device uint*)&_19.u32)[0u], ((device uint*)&_19.u32)[1u]); + _19.ires = max(((device int*)&_19.s32)[0u], ((device int*)&_19.s32)[1u]); + _19.res = fast::clamp(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + _19.ures = clamp(((device uint*)&_19.u32)[0u], ((device uint*)&_19.u32)[1u], ((device uint*)&_19.u32)[2u]); + _19.ires = clamp(((device int*)&_19.s32)[0u], ((device int*)&_19.s32)[1u], ((device int*)&_19.s32)[2u]); + _19.res = mix(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + _19.res = step(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u]); + _19.res = smoothstep(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + _19.res = fma(((device float*)&_19.f32)[0u], ((device float*)&_19.f32)[1u], ((device float*)&_19.f32)[2u]); + ResType _387; + _387._m0 = frexp(((device float*)&_19.f32)[0u], _387._m1); + int itmp = _387._m1; + _19.res = _387._m0; + _19.res = ldexp(((device float*)&_19.f32)[0u], itmp); + _19.ures = pack_float_to_snorm4x8(_19.f32); + _19.ures = pack_float_to_unorm4x8(_19.f32); + _19.ures = pack_float_to_snorm2x16(_19.f32.xy); + _19.ures = pack_float_to_unorm2x16(_19.f32.xy); + _19.ures = as_type(half2(_19.f32.xy)); + v2 = unpack_snorm2x16_to_float(((device uint*)&_19.u32)[0u]); + v2 = unpack_unorm2x16_to_float(((device uint*)&_19.u32)[0u]); + v2 = float2(as_type(((device uint*)&_19.u32)[0u])); + float4 v4 = unpack_snorm4x8_to_float(((device uint*)&_19.u32)[0u]); + v4 = unpack_unorm4x8_to_float(((device uint*)&_19.u32)[0u]); + _19.s32 = spvFindLSB(_19.s32); + _19.s32 = int4(spvFindLSB(_19.u32)); + _19.s32 = spvFindSMSB(_19.s32); + _19.s32 = int4(spvFindUMSB(_19.u32)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..de1695b068 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float _abs; +}; + +struct Foo_1 +{ + float _abs; +}; + +struct SSBO +{ + Foo_1 foo; + Foo_1 foo2; +}; + +kernel void main0(device SSBO& _7 [[buffer(0)]]) +{ + Foo f; + f._abs = _7.foo._abs; + int _abs = 10; + _7.foo2._abs = f._abs; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/implicit-integer-promotion.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/implicit-integer-promotion.comp new file mode 100644 index 0000000000..de487e357e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/implicit-integer-promotion.comp @@ -0,0 +1,93 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct BUF0 +{ + half2 f16s; + ushort2 u16; + short2 i16; + ushort4 u16s; + short4 i16s; + half f16; +}; + +static inline __attribute__((always_inline)) +void test_u16(device BUF0& _24) +{ + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] + ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] - ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] * ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] / ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] % ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] << ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] >> ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(~((device ushort*)&_24.u16)[0u])); + _24.f16 += as_type(ushort(-((device ushort*)&_24.u16)[0u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] ^ ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] & ((device ushort*)&_24.u16)[1u])); + _24.f16 += as_type(ushort(((device ushort*)&_24.u16)[0u] | ((device ushort*)&_24.u16)[1u])); +} + +static inline __attribute__((always_inline)) +void test_i16(device BUF0& _24) +{ + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] + ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] - ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] * ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] / ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] % ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] << ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] >> ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(~((device short*)&_24.i16)[0u])); + _24.f16 += as_type(short(-((device short*)&_24.i16)[0u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] ^ ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] & ((device short*)&_24.i16)[1u])); + _24.f16 += as_type(short(((device short*)&_24.i16)[0u] | ((device short*)&_24.i16)[1u])); +} + +static inline __attribute__((always_inline)) +void test_u16s(device BUF0& _24) +{ + _24.f16s += as_type(_24.u16s.xy + _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy - _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy * _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy / _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy % _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy << _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy >> _24.u16s.zw); + _24.f16s += as_type(~_24.u16s.xy); + _24.f16s += as_type(-_24.u16s.xy); + _24.f16s += as_type(_24.u16s.xy ^ _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy & _24.u16s.zw); + _24.f16s += as_type(_24.u16s.xy | _24.u16s.zw); +} + +static inline __attribute__((always_inline)) +void test_i16s(device BUF0& _24) +{ + _24.f16s += as_type(_24.i16s.xy + _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy - _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy * _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy / _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy % _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy << _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy >> _24.i16s.zw); + _24.f16s += as_type(~_24.i16s.xy); + _24.f16s += as_type(-_24.i16s.xy); + _24.f16s += as_type(_24.i16s.xy ^ _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy & _24.i16s.zw); + _24.f16s += as_type(_24.i16s.xy | _24.i16s.zw); +} + +kernel void main0(device BUF0& _24 [[buffer(0)]]) +{ + test_u16(_24); + test_i16(_24); + test_u16s(_24); + test_i16s(_24); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int16min-literal.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int16min-literal.comp new file mode 100644 index 0000000000..d73768c343 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int16min-literal.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + half b; +}; + +struct SSBO +{ + half a; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant UBO& _12 [[buffer(0)]], device SSBO& _24 [[buffer(1)]]) +{ + short v = as_type(_12.b); + v = short(v ^ short(-32768)); + _24.a = as_type(v); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64.invalid.msl22.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64.invalid.msl22.comp new file mode 100644 index 0000000000..d5bbbb47fc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64.invalid.msl22.comp @@ -0,0 +1,106 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct M0 +{ + long v; + spvUnsafeArray b; + ulong c; + spvUnsafeArray d; +}; + +struct SSBO0_Type +{ + long4 a; + M0 m0; +}; + +struct SSBO1_Type +{ + ulong4 b; + M0 m0; +}; + +struct SSBO2_Type +{ + spvUnsafeArray a; + spvUnsafeArray b; +}; + +struct SSBO3_Type +{ + spvUnsafeArray a; + spvUnsafeArray b; +}; + +struct SSBO +{ + int s32; + uint u32; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _96 [[buffer(0)]]) +{ + SSBO0_Type ssbo_0; + ssbo_0.a += long4(10l, 20l, 30l, 40l); + SSBO1_Type ssbo_1; + ssbo_1.b += ulong4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul); + ssbo_0.a += long4(20l); + ssbo_0.a = abs(ssbo_0.a + long4(ssbo_1.b)); + ssbo_0.a += long4(1l); + ssbo_1.b += ulong4(long4(1l)); + ssbo_0.a -= long4(1l); + ssbo_1.b -= ulong4(long4(1l)); + SSBO2_Type ssbo_2; + ssbo_2.a[0] += 1l; + SSBO3_Type ssbo_3; + ssbo_3.a[0] += 2l; + _96.s32 = int(uint(((ulong(ssbo_0.a.x) + ssbo_1.b.y) + ulong(ssbo_2.a[1])) + ulong(ssbo_3.a[2]))); + _96.u32 = uint(((ulong(ssbo_0.a.y) + ssbo_1.b.z) + ulong(ssbo_2.a[0])) + ulong(ssbo_3.a[1])); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64min-literal.msl22.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64min-literal.msl22.comp new file mode 100644 index 0000000000..a8f2b0e270 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/int64min-literal.msl22.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float b; +}; + +struct SSBO +{ + float a; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant UBO& _12 [[buffer(0)]], device SSBO& _25 [[buffer(1)]]) +{ + long v = long(as_type(_12.b)); + v ^= long(0x8000000000000000ul); + _25.a = as_type(int(v)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..db2294fe6c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/intmin-literal.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; +}; + +struct UBO +{ + float b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], constant UBO& _14 [[buffer(1)]]) +{ + _9.a = as_type(as_type(_14.b) ^ int(0x80000000)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/loop.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/loop.comp new file mode 100644 index 0000000000..34fe64b0a2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/loop.comp @@ -0,0 +1,91 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4x4 mvp; + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _24 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float4 idat = _24.in_data[ident]; + int k = 0; + uint i = 0u; + if (idat.y == 20.0) + { + do + { + k *= 2; + i++; + } while (i < ident); + } + switch (k) + { + case 10: + { + for (;;) + { + i++; + if (i > 10u) + { + break; + } + continue; + } + break; + } + default: + { + for (;;) + { + i += 2u; + if (i > 20u) + { + break; + } + continue; + } + break; + } + } + while (k < 10) + { + idat *= 2.0; + k++; + } + for (uint i_1 = 0u; i_1 < 16u; i_1++, k++) + { + for (uint j = 0u; j < 30u; j++) + { + idat = _24.mvp * idat; + } + } + k = 0; + for (;;) + { + k++; + if (k > 10) + { + k += 2; + } + else + { + k += 3; + continue; + } + k += 10; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/return.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/return.comp new file mode 100644 index 0000000000..04cacea9d5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/return.comp @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + if (ident == 2u) + { + _27.out_data[ident] = float4(20.0); + } + else + { + if (ident == 4u) + { + _27.out_data[ident] = float4(10.0); + return; + } + } + int i = 0; + while (i < 20) + { + if (i == 10) + { + break; + } + return; + } + _27.out_data[ident] = float4(10.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp new file mode 100644 index 0000000000..ba278ccde7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 a[16]; + float4 b[16]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _14 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _14.b[gl_GlobalInvocationID.x] = float4(_14.a[gl_GlobalInvocationID.x].x); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp new file mode 100644 index 0000000000..49758ca3e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp @@ -0,0 +1,151 @@ +#include +#include + +using namespace metal; + +typedef packed_float2 packed_float2x2[2]; +typedef packed_float3 packed_float2x3[2]; +typedef packed_float3 packed_rm_float3x2[2]; + +struct S0 +{ + packed_float2 a[1]; + float b; +}; + +struct S1 +{ + packed_float3 a; + float b; +}; + +struct S2 +{ + packed_float3 a[1]; + float b; +}; + +struct S3 +{ + packed_float2 a; + float b; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; +}; + +struct SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + float2x2 m0; + float2x2 m1; + packed_float2x3 m2[4]; + float3x2 m3; + float2x2 m4; + float2x2 m5[9]; + float3x2 m6[4][2]; + packed_rm_float3x2 m7; + float array[1]; +}; + +struct S0_1 +{ + float2 a[1]; + char _m1_pad[8]; + float b; + char _m0_final_padding[12]; +}; + +struct S1_1 +{ + packed_float3 a; + float b; +}; + +struct S2_1 +{ + float3 a[1]; + float b; + char _m0_final_padding[12]; +}; + +struct S3_1 +{ + float2 a; + float b; +}; + +struct Content_1 +{ + S0_1 m0s[1]; + S1_1 m1s[1]; + S2_1 m2s[1]; + S0_1 m0; + S1_1 m1; + S2_1 m2; + S3_1 m3; + float m4; + char _m0_final_padding[12]; +}; + +struct SSBO0 +{ + Content_1 content; + Content_1 content1[2]; + Content_1 content2; + float2x4 m0; + float2x4 m1; + float2x3 m2[4]; + float3x4 m3; + float2x4 m4; + float2x4 m5[9]; + float3x4 m6[4][2]; + float2x3 m7; + float4 array[1]; +}; + +struct SSBO2 +{ + float m0; + packed_float2x2 m1; + packed_rm_float3x2 m2; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO1& ssbo_scalar [[buffer(0)]], device SSBO0& ssbo_140 [[buffer(1)]], device SSBO2& ssbo_scalar2 [[buffer(2)]]) +{ + ssbo_scalar.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0]; + ssbo_scalar.content.m0s[0].b = ssbo_140.content.m0s[0].b; + ssbo_scalar.content.m1s[0].a = float3(ssbo_140.content.m1s[0].a); + ssbo_scalar.content.m1s[0].b = ssbo_140.content.m1s[0].b; + ssbo_scalar.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0]; + ssbo_scalar.content.m2s[0].b = ssbo_140.content.m2s[0].b; + ssbo_scalar.content.m0.a[0] = ssbo_140.content.m0.a[0]; + ssbo_scalar.content.m0.b = ssbo_140.content.m0.b; + ssbo_scalar.content.m1.a = float3(ssbo_140.content.m1.a); + ssbo_scalar.content.m1.b = ssbo_140.content.m1.b; + ssbo_scalar.content.m2.a[0] = ssbo_140.content.m2.a[0]; + ssbo_scalar.content.m2.b = ssbo_140.content.m2.b; + ssbo_scalar.content.m3.a = ssbo_140.content.m3.a; + ssbo_scalar.content.m3.b = ssbo_140.content.m3.b; + ssbo_scalar.content.m4 = ssbo_140.content.m4; + ssbo_scalar.content.m1.a = float2x3(float3(ssbo_scalar.m2[1][0]), float3(ssbo_scalar.m2[1][1])) * float2(ssbo_scalar.content.m0.a[0]); + ssbo_scalar.m0 = float2x2(float2(ssbo_scalar2.m1[0]), float2(ssbo_scalar2.m1[1])); + ssbo_scalar2.m1[0] = float2(ssbo_scalar.m4[0][0], ssbo_scalar.m4[1][0]); + ssbo_scalar2.m1[1] = float2(ssbo_scalar.m4[0][1], ssbo_scalar.m4[1][1]); + ssbo_scalar2.m2[0] = float3(ssbo_scalar.m3[0][0], ssbo_scalar.m3[1][0], ssbo_scalar.m3[2][0]); + ssbo_scalar2.m2[1] = float3(ssbo_scalar.m3[0][1], ssbo_scalar.m3[1][1], ssbo_scalar.m3[2][1]); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp new file mode 100644 index 0000000000..651991e351 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], unsupported-built-in-type gl_WorkGroupSize [[unsupported-built-in]]) +{ + uint gl_NumSubgroups = gl_WorkGroupSize.x * gl_WorkGroupSize.y * gl_WorkGroupSize.z; + uint gl_SubgroupID = gl_LocalInvocationIndex; + uint gl_SubgroupSize = 1; + uint gl_SubgroupInvocationID = 0; + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + threadgroup_barrier(mem_flags::mem_device); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_texture); + bool elected = true; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp new file mode 100644 index 0000000000..b1337e2532 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp @@ -0,0 +1,327 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return simd_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!simd_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)simd_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return simd_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!simd_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)simd_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + simd_vote vote = simd_ballot(value); + // simd_ballot() returns a 64-bit integer-like object, but + // SPIR-V callers expect a uint4. We must convert. + // FIXME: This won't include higher bits if Apple ever supports + // 128 lanes in an SIMD-group. + return uint4(as_type((simd_vote::vote_t)vote), 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return simd_all(all(value == simd_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return simd_all(value) || !simd_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return simd_all(all(value == (vec)simd_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return simd_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!simd_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)simd_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return simd_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!simd_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)simd_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return simd_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!simd_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)simd_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[simdgroups_per_threadgroup]], uint gl_SubgroupID [[simdgroup_index_in_threadgroup]], uint gl_SubgroupSize [[thread_execution_width]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + uint4 gl_SubgroupEqMask = gl_SubgroupInvocationID >= 32 ? uint4(0, (1 << (gl_SubgroupInvocationID - 32)), uint2(0)) : uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID, 32u), 0)), uint2(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID + 1, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID - 1, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID + 1, 32u), 0)), uint2(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + bool _39 = simd_is_first(); + bool elected = _39; + _9.FragColor = float4(gl_SubgroupEqMask).x; + _9.FragColor = float4(gl_SubgroupGeMask).x; + _9.FragColor = float4(gl_SubgroupGtMask).x; + _9.FragColor = float4(gl_SubgroupLeMask).x; + _9.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + bool has_all = simd_all(true); + bool has_any = simd_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 added = simd_sum(float4(20.0)); + int4 iadded = simd_sum(int4(20)); + float4 multiplied = simd_product(float4(20.0)); + int4 imultiplied = simd_product(int4(20)); + float4 lo = simd_min(float4(20.0)); + float4 hi = simd_max(float4(20.0)); + int4 slo = simd_min(int4(20)); + int4 shi = simd_max(int4(20)); + uint4 ulo = simd_min(uint4(20u)); + uint4 uhi = simd_max(uint4(20u)); + uint4 anded = simd_and(ballot_value); + uint4 ored = simd_or(ballot_value); + uint4 xored = simd_xor(ballot_value); + bool4 anded_b = simd_and(ballot_value == uint4(42u)); + bool4 ored_b = simd_or(ballot_value == uint4(42u)); + bool4 xored_b = simd_xor(ballot_value == uint4(42u)); + added = simd_prefix_inclusive_sum(added); + iadded = simd_prefix_inclusive_sum(iadded); + multiplied = simd_prefix_inclusive_product(multiplied); + imultiplied = simd_prefix_inclusive_product(imultiplied); + added = simd_prefix_exclusive_sum(multiplied); + multiplied = simd_prefix_exclusive_product(multiplied); + iadded = simd_prefix_exclusive_sum(imultiplied); + imultiplied = simd_prefix_exclusive_product(imultiplied); + added = quad_sum(added); + multiplied = quad_product(multiplied); + iadded = quad_sum(iadded); + imultiplied = quad_product(imultiplied); + lo = quad_min(lo); + hi = quad_max(hi); + ulo = quad_min(ulo); + uhi = quad_max(uhi); + slo = quad_min(slo); + shi = quad_max(shi); + anded = quad_and(anded); + ored = quad_or(ored); + xored = quad_xor(xored); + anded_b = quad_and(anded == uint4(2u)); + ored_b = quad_or(ored == uint4(3u)); + xored_b = quad_xor(xored == uint4(4u)); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp new file mode 100644 index 0000000000..462c78fb70 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp @@ -0,0 +1,322 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return simd_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!simd_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)simd_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return simd_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!simd_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)simd_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + simd_vote vote = simd_ballot(value); + // simd_ballot() returns a 64-bit integer-like object, but + // SPIR-V callers expect a uint4. We must convert. + // FIXME: This won't include higher bits if Apple ever supports + // 128 lanes in an SIMD-group. + return uint4(as_type((simd_vote::vote_t)vote), 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return simd_all(all(value == simd_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return simd_all(value) || !simd_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return simd_all(all(value == (vec)simd_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return simd_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!simd_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)simd_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return simd_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!simd_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)simd_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return simd_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!simd_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)simd_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[simdgroups_per_threadgroup]], uint gl_SubgroupID [[simdgroup_index_in_threadgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + uint gl_SubgroupSize = 32; + uint4 gl_SubgroupEqMask = gl_SubgroupInvocationID >= 32 ? uint4(0, (1 << (gl_SubgroupInvocationID - 32)), uint2(0)) : uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID, 32 - gl_SubgroupInvocationID), uint3(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID + 1, 32 - gl_SubgroupInvocationID - 1), uint3(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + bool _39 = simd_is_first(); + bool elected = _39; + _9.FragColor = float4(gl_SubgroupEqMask).x; + _9.FragColor = float4(gl_SubgroupGeMask).x; + _9.FragColor = float4(gl_SubgroupGtMask).x; + _9.FragColor = float4(gl_SubgroupLeMask).x; + _9.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + bool has_all = simd_all(true); + bool has_any = simd_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 added = simd_sum(float4(20.0)); + int4 iadded = simd_sum(int4(20)); + float4 multiplied = simd_product(float4(20.0)); + int4 imultiplied = simd_product(int4(20)); + float4 lo = simd_min(float4(20.0)); + float4 hi = simd_max(float4(20.0)); + int4 slo = simd_min(int4(20)); + int4 shi = simd_max(int4(20)); + uint4 ulo = simd_min(uint4(20u)); + uint4 uhi = simd_max(uint4(20u)); + uint4 anded = simd_and(ballot_value); + uint4 ored = simd_or(ballot_value); + uint4 xored = simd_xor(ballot_value); + added = simd_prefix_inclusive_sum(added); + iadded = simd_prefix_inclusive_sum(iadded); + multiplied = simd_prefix_inclusive_product(multiplied); + imultiplied = simd_prefix_inclusive_product(imultiplied); + added = simd_prefix_exclusive_sum(multiplied); + multiplied = simd_prefix_exclusive_product(multiplied); + iadded = simd_prefix_exclusive_sum(imultiplied); + imultiplied = simd_prefix_exclusive_product(imultiplied); + added = quad_sum(added); + multiplied = quad_product(multiplied); + iadded = quad_sum(iadded); + imultiplied = quad_product(imultiplied); + lo = quad_min(lo); + hi = quad_max(hi); + ulo = quad_min(ulo); + uhi = quad_max(uhi); + slo = quad_min(slo); + shi = quad_max(shi); + anded = quad_and(anded); + ored = quad_or(ored); + xored = quad_xor(xored); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp new file mode 100644 index 0000000000..1791ceca1a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp @@ -0,0 +1,151 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return quad_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!quad_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)quad_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return quad_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!quad_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)quad_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return quad_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!quad_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)quad_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return quad_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!quad_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)quad_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[quadgroups_per_threadgroup]], uint gl_SubgroupID [[quadgroup_index_in_threadgroup]], uint gl_SubgroupSize [[thread_execution_width]], uint gl_SubgroupInvocationID [[thread_index_in_quadgroup]]) +{ + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp new file mode 100644 index 0000000000..3910e82440 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp @@ -0,0 +1,282 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return quad_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!quad_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)quad_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + return uint4((quad_vote::vote_t)quad_ballot(value), 0, 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID + 1), uint3(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return quad_all(all(value == quad_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return quad_all(value) || !quad_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return quad_all(all(value == (vec)quad_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return quad_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!quad_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)quad_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return quad_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!quad_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)quad_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return quad_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!quad_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)quad_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return quad_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!quad_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)quad_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[quadgroups_per_threadgroup]], uint gl_SubgroupID [[quadgroup_index_in_threadgroup]], uint gl_SubgroupSize [[thread_execution_width]], uint gl_SubgroupInvocationID [[thread_index_in_quadgroup]]) +{ + uint4 gl_SubgroupEqMask = uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID, gl_SubgroupSize - gl_SubgroupInvocationID), uint3(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID + 1, gl_SubgroupSize - gl_SubgroupInvocationID - 1), uint3(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID + 1), uint3(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID), uint3(0)); + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + bool _39 = quad_is_first(); + bool elected = _39; + _9.FragColor = float4(gl_SubgroupEqMask).x; + _9.FragColor = float4(gl_SubgroupGeMask).x; + _9.FragColor = float4(gl_SubgroupGtMask).x; + _9.FragColor = float4(gl_SubgroupLeMask).x; + _9.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + bool has_all = quad_all(true); + bool has_any = quad_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp new file mode 100644 index 0000000000..71916ebb98 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp @@ -0,0 +1,316 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return simd_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!simd_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)simd_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return simd_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!simd_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)simd_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + return uint4((simd_vote::vote_t)simd_ballot(value), 0, 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupSize), uint3(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID + 1), uint3(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return simd_all(all(value == simd_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return simd_all(value) || !simd_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return simd_all(all(value == (vec)simd_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return simd_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!simd_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)simd_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return simd_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!simd_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)simd_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return simd_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!simd_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)simd_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct SSBO +{ + float FragColor; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]], uint gl_NumSubgroups [[simdgroups_per_threadgroup]], uint gl_SubgroupID [[simdgroup_index_in_threadgroup]], uint gl_SubgroupSize [[thread_execution_width]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + uint4 gl_SubgroupEqMask = uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID, gl_SubgroupSize - gl_SubgroupInvocationID), uint3(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, gl_SubgroupInvocationID + 1, gl_SubgroupSize - gl_SubgroupInvocationID - 1), uint3(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID + 1), uint3(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, gl_SubgroupInvocationID), uint3(0)); + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + simdgroup_barrier(mem_flags::mem_device); + simdgroup_barrier(mem_flags::mem_threadgroup); + simdgroup_barrier(mem_flags::mem_texture); + bool _39 = simd_is_first(); + bool elected = _39; + _9.FragColor = float4(gl_SubgroupEqMask).x; + _9.FragColor = float4(gl_SubgroupGeMask).x; + _9.FragColor = float4(gl_SubgroupGtMask).x; + _9.FragColor = float4(gl_SubgroupLeMask).x; + _9.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + bool has_all = simd_all(true); + bool has_any = simd_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 added = simd_sum(float4(20.0)); + int4 iadded = simd_sum(int4(20)); + float4 multiplied = simd_product(float4(20.0)); + int4 imultiplied = simd_product(int4(20)); + float4 lo = simd_min(float4(20.0)); + float4 hi = simd_max(float4(20.0)); + int4 slo = simd_min(int4(20)); + int4 shi = simd_max(int4(20)); + uint4 ulo = simd_min(uint4(20u)); + uint4 uhi = simd_max(uint4(20u)); + uint4 anded = simd_and(ballot_value); + uint4 ored = simd_or(ballot_value); + uint4 xored = simd_xor(ballot_value); + added = simd_prefix_inclusive_sum(added); + iadded = simd_prefix_inclusive_sum(iadded); + multiplied = simd_prefix_inclusive_product(multiplied); + imultiplied = simd_prefix_inclusive_product(imultiplied); + added = simd_prefix_exclusive_sum(multiplied); + multiplied = simd_prefix_exclusive_product(multiplied); + iadded = simd_prefix_exclusive_sum(imultiplied); + imultiplied = simd_prefix_exclusive_product(imultiplied); + added = quad_sum(added); + multiplied = quad_product(multiplied); + iadded = quad_sum(iadded); + imultiplied = quad_product(imultiplied); + lo = quad_min(lo); + hi = quad_max(hi); + ulo = quad_min(ulo); + uhi = quad_max(uhi); + slo = quad_min(slo); + shi = quad_max(shi); + anded = quad_and(anded); + ored = quad_or(ored); + xored = quad_xor(xored); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..328b42ce9f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct A +{ + float3 a; + float3 b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device A& _14 [[buffer(0)]]) +{ + bool3 c = _14.b < float3(1.0); + _14.a = select(float3(1.0, 0.0, 0.0), float3(0.0, 0.0, 1.0), c); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..2e37a32653 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct A +{ + float3x3 a; + float b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device A& _14 [[buffer(0)]]) +{ + bool c = _14.b < 1.0; + _14.a = c ? float3x3(float3(1.0), float3(1.0), float3(1.0)) : float3x3(float3(0.0), float3(0.0), float3(0.0)); + _14.a = c ? float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)) : float3x3(float3(0.0), float3(0.0), float3(0.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-input-component.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-input-component.frag new file mode 100644 index 0000000000..9a65918a7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-input-component.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 Foo3 [[user(locn0)]]; + float Foo1 [[user(locn0_3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.Foo3, in.Foo1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.frag new file mode 100644 index 0000000000..45b05b9dba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 m_location_0 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float FragColor0 = {}; + float2 FragColor1 = {}; + float FragColor3 = {}; + FragColor0 = 1.0; + FragColor1 = float2(2.0, 3.0); + FragColor3 = 4.0; + out.m_location_0.x = FragColor0; + out.m_location_0.yz = FragColor1; + out.m_location_0.w = FragColor3; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag new file mode 100644 index 0000000000..0e4bee12f6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 m_location_0 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float FragColor0 = {}; + float2 FragColor1 = {}; + FragColor0 = 1.0; + FragColor1 = float2(2.0, 3.0); + out.m_location_0.x = FragColor0; + out.m_location_0.yz = FragColor1; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-input-component.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-input-component.vert new file mode 100644 index 0000000000..7a099f503b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-input-component.vert @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 Foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_location_0 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float3 Foo3 = {}; + float Foo1 = {}; + Foo3 = in.m_location_0.xyz; + Foo1 = in.m_location_0.w; + out.gl_Position = float4(Foo3, Foo1); + out.Foo = Foo3 + float3(Foo1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-output-component.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-output-component.vert new file mode 100644 index 0000000000..cf135b5128 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/components/vertex-output-component.vert @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 Foo3 [[user(locn0)]]; + float Foo1 [[user(locn0_3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vFoo [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.vFoo; + out.Foo3 = in.vFoo.xyz; + out.Foo1 = in.vFoo.w; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/16bit-constants.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/16bit-constants.invalid.frag new file mode 100644 index 0000000000..542beb3189 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/16bit-constants.invalid.frag @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + half foo [[color(0)]]; + short bar [[color(1)]]; + ushort baz [[color(2)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.foo = half(1.0); + out.bar = short(2); + out.baz = ushort(3); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag new file mode 100644 index 0000000000..35ba5f7931 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 m_4 [[color(0)]]; +}; + +struct main0_in +{ + float2 m_3 [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 _19(thread float2& _3, texture2d _5, sampler _5Smplr) +{ + return _5.sample(_5Smplr, _3); +} + +fragment main0_out main0(main0_in in [[stage_in]], texture2d _5 [[texture(0)]], sampler _5Smplr [[sampler(0)]]) +{ + main0_out out = {}; + out.m_4 = _19(in.m_3, _5, _5Smplr); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag new file mode 100644 index 0000000000..0e0348bf85 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + bool _9 = simd_is_helper_thread(); + bool helper = _9; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/depth-image-gather.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/depth-image-gather.asm.frag new file mode 100644 index 0000000000..025e225856 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/depth-image-gather.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d g_depthTexture [[texture(0)]], sampler g_sampler [[sampler(0)]], sampler g_comp [[sampler(1)]]) +{ + main0_out out = {}; + out.out_var_SV_Target0 = g_depthTexture.gather_compare(g_comp, in.in_var_TEXCOORD0, 0.5) * g_depthTexture.gather(g_sampler, in.in_var_TEXCOORD0, int2(0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag new file mode 100644 index 0000000000..5f8dc7203e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct spvDescriptorSetBuffer0 +{ + texture2d uTexture2 [[id(0)]]; + sampler uTexture2Smplr [[id(1)]]; + texture2d uTexture1 [[id(2)]]; + sampler uTexture1Smplr [[id(3)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], texture2d uTextureDiscrete2 [[texture(0)]], sampler uTextureDiscrete2Smplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = spvDescriptorSet0.uTexture2.sample(spvDescriptorSet0.uTexture2Smplr, in.vUV); + out.FragColor += uTextureDiscrete2.sample(uTextureDiscrete2Smplr, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag new file mode 100644 index 0000000000..16182ae2e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag @@ -0,0 +1,185 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +// Implementation of the GLSL radians() function +template +inline T radians(T d) +{ + return d * T(0.01745329251); +} + +// Implementation of the GLSL degrees() function +template +inline T degrees(T r) +{ + return r * T(57.2957795131); +} + +struct ResType +{ + half4 _m0; + int4 _m1; +}; + +struct main0_in +{ + half v1 [[user(locn0)]]; + half2 v2 [[user(locn1)]]; + half3 v3 [[user(locn2)]]; + half4 v4 [[user(locn3)]]; +}; + +static inline __attribute__((always_inline)) +half2x2 test_mat2(thread const half2& a, thread const half2& b, thread const half2& c, thread const half2& d) +{ + return half2x2(half2(a), half2(b)) * half2x2(half2(c), half2(d)); +} + +static inline __attribute__((always_inline)) +half3x3 test_mat3(thread const half3& a, thread const half3& b, thread const half3& c, thread const half3& d, thread const half3& e, thread const half3& f) +{ + return half3x3(half3(a), half3(b), half3(c)) * half3x3(half3(d), half3(e), half3(f)); +} + +static inline __attribute__((always_inline)) +void test_constants() +{ + half a = half(1.0); + half b = half(1.5); + half c = half(-1.5); + half d = half(0.0 / 0.0); + half e = half(1.0 / 0.0); + half f = half(-1.0 / 0.0); + half g = half(1014.0); + half h = half(9.5367431640625e-07); +} + +static inline __attribute__((always_inline)) +half test_result() +{ + return half(1.0); +} + +static inline __attribute__((always_inline)) +void test_conversions() +{ + half one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = one != half(0.0); + float d = float(one); + half a2 = half(a); + half b2 = half(b); + half c2 = half(c); + half d2 = half(d); +} + +static inline __attribute__((always_inline)) +void test_builtins(thread half4& v4, thread half3& v3, thread half& v1) +{ + half4 res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = precise::atan2(v4, v3.xyzz); + res = atan(v4); + res = fast::sinh(v4); + res = fast::cosh(v4); + res = precise::tanh(v4); + res = asinh(v4); + res = acosh(v4); + res = atanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = rsqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + res = rint(v4); + res = ceil(v4); + res = fract(v4); + res = mod(v4, v4); + half4 tmp; + half4 _223 = modf(v4, tmp); + res = _223; + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = mix(v4, v4, v4); + res = select(v4, v4, v4 < v4); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + bool4 btmp = isnan(v4); + btmp = isinf(v4); + res = fma(v4, v4, v4); + ResType _267; + _267._m0 = frexp(v4, _267._m1); + int4 itmp = _267._m1; + res = _267._m0; + res = ldexp(res, itmp); + uint pack0 = as_type(v4.xy); + uint pack1 = as_type(v4.zw); + res = half4(as_type(pack0), as_type(pack1)); + half t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + half3 res3 = cross(v3, v3); + res = fast::normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + btmp = v4 < v4; + btmp = v4 <= v4; + btmp = v4 > v4; + btmp = v4 >= v4; + btmp = v4 == v4; + btmp = v4 != v4; + res = dfdx(v4); + res = dfdy(v4); + res = dfdx(v4); + res = dfdy(v4); + res = dfdx(v4); + res = dfdy(v4); + res = fwidth(v4); + res = fwidth(v4); + res = fwidth(v4); +} + +fragment void main0(main0_in in [[stage_in]]) +{ + half2 param = in.v2; + half2 param_1 = in.v2; + half2 param_2 = in.v3.xy; + half2 param_3 = in.v3.xy; + half2x2 m0 = test_mat2(param, param_1, param_2, param_3); + half3 param_4 = in.v3; + half3 param_5 = in.v3; + half3 param_6 = in.v3; + half3 param_7 = in.v4.xyz; + half3 param_8 = in.v4.xyz; + half3 param_9 = in.v4.yzw; + half3x3 m1 = test_mat3(param_4, param_5, param_6, param_7, param_8, param_9); + test_constants(); + test_conversions(); + test_builtins(in.v4, in.v3, in.v1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/image-gather.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/image-gather.frag new file mode 100644 index 0000000000..db793c14ee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/image-gather.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSamp [[texture(0)]], depth2d uSampShadow [[texture(1)]], sampler uSampSmplr [[sampler(0)]], sampler uSampShadowSmplr [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = uSamp.gather(uSampSmplr, in.vUV.xy, int2(0), component::x); + out.FragColor += uSamp.gather(uSampSmplr, in.vUV.xy, int2(0), component::y); + out.FragColor += uSampShadow.gather_compare(uSampShadowSmplr, in.vUV.xy, in.vUV.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/in_block_assign.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/in_block_assign.frag new file mode 100644 index 0000000000..6b7afc4d2c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/in_block_assign.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct VOUT +{ + float4 a; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 Clip_a [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + VOUT Clip = {}; + Clip.a = in.Clip_a; + VOUT tmp = Clip; + tmp.a += float4(1.0); + out.FragColor = tmp.a; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag new file mode 100644 index 0000000000..f597a6eb88 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag @@ -0,0 +1,69 @@ +#include +#include + +using namespace metal; + +struct main0_in +{ + float v1 [[user(locn0)]]; + float2 v2 [[user(locn1)]]; + float3 v3 [[user(locn2)]]; + float4 v4 [[user(locn3)]]; + half h1 [[user(locn4)]]; + half2 h2 [[user(locn5)]]; + half3 h3 [[user(locn6)]]; + half4 h4 [[user(locn7)]]; +}; + +fragment void main0(main0_in in [[stage_in]]) +{ + float res = fast::min(in.v1, in.v1); + res = fast::max(in.v1, in.v1); + res = fast::clamp(in.v1, in.v1, in.v1); + res = precise::min(in.v1, in.v1); + res = precise::max(in.v1, in.v1); + res = precise::clamp(in.v1, in.v1, in.v1); + float2 res2 = fast::min(in.v2, in.v2); + res2 = fast::max(in.v2, in.v2); + res2 = fast::clamp(in.v2, in.v2, in.v2); + res2 = precise::min(in.v2, in.v2); + res2 = precise::max(in.v2, in.v2); + res2 = precise::clamp(in.v2, in.v2, in.v2); + float3 res3 = fast::min(in.v3, in.v3); + res3 = fast::max(in.v3, in.v3); + res3 = fast::clamp(in.v3, in.v3, in.v3); + res3 = precise::min(in.v3, in.v3); + res3 = precise::max(in.v3, in.v3); + res3 = precise::clamp(in.v3, in.v3, in.v3); + float4 res4 = fast::min(in.v4, in.v4); + res4 = fast::max(in.v4, in.v4); + res4 = fast::clamp(in.v4, in.v4, in.v4); + res4 = precise::min(in.v4, in.v4); + res4 = precise::max(in.v4, in.v4); + res4 = precise::clamp(in.v4, in.v4, in.v4); + half hres = min(in.h1, in.h1); + hres = max(in.h1, in.h1); + hres = clamp(in.h1, in.h1, in.h1); + hres = min(in.h1, in.h1); + hres = max(in.h1, in.h1); + hres = clamp(in.h1, in.h1, in.h1); + half2 hres2 = min(in.h2, in.h2); + hres2 = max(in.h2, in.h2); + hres2 = clamp(in.h2, in.h2, in.h2); + hres2 = min(in.h2, in.h2); + hres2 = max(in.h2, in.h2); + hres2 = clamp(in.h2, in.h2, in.h2); + half3 hres3 = min(in.h3, in.h3); + hres3 = max(in.h3, in.h3); + hres3 = clamp(in.h3, in.h3, in.h3); + hres3 = min(in.h3, in.h3); + hres3 = max(in.h3, in.h3); + hres3 = clamp(in.h3, in.h3, in.h3); + half4 hres4 = min(in.h4, in.h4); + hres4 = max(in.h4, in.h4); + hres4 = clamp(in.h4, in.h4, in.h4); + hres4 = min(in.h4, in.h4); + hres4 = max(in.h4, in.h4); + hres4 = clamp(in.h4, in.h4, in.h4); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag new file mode 100644 index 0000000000..7835e01307 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag @@ -0,0 +1,69 @@ +#include +#include + +using namespace metal; + +struct main0_in +{ + float v1 [[user(locn0)]]; + float2 v2 [[user(locn1)]]; + float3 v3 [[user(locn2)]]; + float4 v4 [[user(locn3)]]; + half h1 [[user(locn4)]]; + half2 h2 [[user(locn5)]]; + half3 h3 [[user(locn6)]]; + half4 h4 [[user(locn7)]]; +}; + +fragment void main0(main0_in in [[stage_in]]) +{ + float res = fast::min(in.v1, in.v1); + res = fast::max(in.v1, in.v1); + res = fast::clamp(in.v1, in.v1, in.v1); + res = fast::min(in.v1, in.v1); + res = fast::max(in.v1, in.v1); + res = fast::clamp(in.v1, in.v1, in.v1); + float2 res2 = fast::min(in.v2, in.v2); + res2 = fast::max(in.v2, in.v2); + res2 = fast::clamp(in.v2, in.v2, in.v2); + res2 = fast::min(in.v2, in.v2); + res2 = fast::max(in.v2, in.v2); + res2 = fast::clamp(in.v2, in.v2, in.v2); + float3 res3 = fast::min(in.v3, in.v3); + res3 = fast::max(in.v3, in.v3); + res3 = fast::clamp(in.v3, in.v3, in.v3); + res3 = fast::min(in.v3, in.v3); + res3 = fast::max(in.v3, in.v3); + res3 = fast::clamp(in.v3, in.v3, in.v3); + float4 res4 = fast::min(in.v4, in.v4); + res4 = fast::max(in.v4, in.v4); + res4 = fast::clamp(in.v4, in.v4, in.v4); + res4 = fast::min(in.v4, in.v4); + res4 = fast::max(in.v4, in.v4); + res4 = fast::clamp(in.v4, in.v4, in.v4); + half hres = min(in.h1, in.h1); + hres = max(in.h1, in.h1); + hres = clamp(in.h1, in.h1, in.h1); + hres = min(in.h1, in.h1); + hres = max(in.h1, in.h1); + hres = clamp(in.h1, in.h1, in.h1); + half2 hres2 = min(in.h2, in.h2); + hres2 = max(in.h2, in.h2); + hres2 = clamp(in.h2, in.h2, in.h2); + hres2 = min(in.h2, in.h2); + hres2 = max(in.h2, in.h2); + hres2 = clamp(in.h2, in.h2, in.h2); + half3 hres3 = min(in.h3, in.h3); + hres3 = max(in.h3, in.h3); + hres3 = clamp(in.h3, in.h3, in.h3); + hres3 = min(in.h3, in.h3); + hres3 = max(in.h3, in.h3); + hres3 = clamp(in.h3, in.h3, in.h3); + half4 hres4 = min(in.h4, in.h4); + hres4 = max(in.h4, in.h4); + hres4 = clamp(in.h4, in.h4, in.h4); + hres4 = min(in.h4, in.h4); + hres4 = max(in.h4, in.h4); + hres4 = clamp(in.h4, in.h4, in.h4); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag new file mode 100644 index 0000000000..f1ad5c5fb2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; + int vIndex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], array, 10> uTex [[texture(0)]], sampler Immut [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex[in.vIndex].sample(Immut, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag new file mode 100644 index 0000000000..cc35b38ba1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO1 +{ + uint values1[1]; +}; + +struct SSBO0 +{ + uint values0[1]; +}; + +static inline __attribute__((always_inline)) +void callee2(device SSBO1& _14, thread float4& gl_FragCoord) +{ + int _25 = int(gl_FragCoord.x); + _14.values1[_25]++; +} + +static inline __attribute__((always_inline)) +void callee(device SSBO1& _14, thread float4& gl_FragCoord, device SSBO0& _35) +{ + int _38 = int(gl_FragCoord.x); + _35.values0[_38]++; + callee2(_14, gl_FragCoord); +} + +fragment void main0(device SSBO1& _14 [[buffer(0), raster_order_group(0)]], device SSBO0& _35 [[buffer(1), raster_order_group(0)]], float4 gl_FragCoord [[position]]) +{ + callee(_14, gl_FragCoord, _35); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag new file mode 100644 index 0000000000..b5ffd11f40 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + interpolant a_0 [[user(locn0)]]; + interpolant a_1 [[user(locn1)]]; + interpolant b_0 [[user(locn2)]]; + interpolant b_1 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray a = {}; + spvUnsafeArray b = {}; + a[0] = in.a_0.interpolate_at_centroid(); + a[1] = in.a_1.interpolate_at_centroid(); + b[0] = in.b_0.interpolate_at_centroid(); + b[1] = in.b_1.interpolate_at_centroid(); + out.FragColor.x = in.a_0.interpolate_at_offset(float2(0.5) + 0.4375).x; + out.FragColor.y = in.a_1.interpolate_at_offset(float2(0.5) + 0.4375).y; + out.FragColor.z = in.b_0.interpolate_at_offset(float2(0.5) + 0.4375).z; + out.FragColor.w = in.b_1.interpolate_at_offset(float2(0.5) + 0.4375).w; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag new file mode 100644 index 0000000000..ec25d06787 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float a[1]; + float2 b[2]; +}; + +struct UBOEnhancedLayout +{ + float c[1]; + float2 d[2]; + char _m2_pad[9976]; + float e; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIndex [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _17 [[buffer(0)]], constant UBOEnhancedLayout& _30 [[buffer(1)]]) +{ + main0_out out = {}; + out.FragColor = (_17.a[in.vIndex] + _30.c[in.vIndex]) + _30.e; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag new file mode 100644 index 0000000000..58985c6354 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag @@ -0,0 +1,57 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float Samp(thread const float3& uv, depth2d uTex, sampler uSamp) +{ + return uTex.sample_compare(uSamp, uv.xy, uv.z); +} + +static inline __attribute__((always_inline)) +float Samp2(thread const float3& uv, depth2d uSampler, sampler uSamplerSmplr, thread float3& vUV) +{ + return uSampler.sample_compare(uSamplerSmplr, vUV.xy, vUV.z); +} + +static inline __attribute__((always_inline)) +float Samp3(depth2d uT, sampler uS, thread const float3& uv, thread float3& vUV) +{ + return uT.sample_compare(uS, vUV.xy, vUV.z); +} + +static inline __attribute__((always_inline)) +float Samp4(depth2d uS, sampler uSSmplr, thread const float3& uv, thread float3& vUV) +{ + return uS.sample_compare(uSSmplr, vUV.xy, vUV.z); +} + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uTex [[texture(0)]], depth2d uSampler [[texture(1)]], sampler uSamp [[sampler(0)]], sampler uSamplerSmplr [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = uSampler.sample_compare(uSamplerSmplr, in.vUV.xy, in.vUV.z); + out.FragColor += uTex.sample_compare(uSamp, in.vUV.xy, in.vUV.z); + float3 param = in.vUV; + out.FragColor += Samp(param, uTex, uSamp); + float3 param_1 = in.vUV; + out.FragColor += Samp2(param_1, uSampler, uSamplerSmplr, in.vUV); + float3 param_2 = in.vUV; + out.FragColor += Samp3(uTex, uSamp, param_2, in.vUV); + float3 param_3 = in.vUV; + out.FragColor += Samp4(uSampler, uSamplerSmplr, param_3, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag new file mode 100644 index 0000000000..51ec74ee97 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Test +{ + short a; + short2 b; + short3 c; + short4 d; +}; + +struct Test2 +{ + spvUnsafeArray a; + spvUnsafeArray b; + spvUnsafeArray c; + spvUnsafeArray d; + Test e; +}; + +constant spvUnsafeArray _40 = spvUnsafeArray({ true, false }); +constant spvUnsafeArray _44 = spvUnsafeArray({ bool2(true, false), bool2(false, true) }); +constant spvUnsafeArray _48 = spvUnsafeArray({ bool3(true, false, true), bool3(false, true, false) }); +constant spvUnsafeArray _52 = spvUnsafeArray({ bool4(true, false, true, false), bool4(false, true, false, true) }); +constant spvUnsafeArray _82 = spvUnsafeArray({ true, true }); +constant spvUnsafeArray _85 = spvUnsafeArray({ bool2(true), bool2(false) }); +constant spvUnsafeArray _87 = spvUnsafeArray({ bool3(true), bool3(false) }); +constant spvUnsafeArray _89 = spvUnsafeArray({ bool4(true), bool4(false) }); + +fragment void main0() +{ + spvUnsafeArray _95 = spvUnsafeArray({ Test{ short(true), short2(bool2(true, false)), short3(bool3(true)), short4(bool4(false)) }, Test{ short(false), short2(bool2(false, true)), short3(bool3(false)), short4(bool4(true)) } }); + + Test t; + t.a = short(true); + t.b = short2(bool2(true, false)); + t.c = short3(bool3(true, false, true)); + t.d = short4(bool4(true, false, true, false)); + Test2 t2; + t2.a = { short(_40[0]), short(_40[1]) }; + t2.b = { short2(_44[0]), short2(_44[1]) }; + t2.c = { short3(_48[0]), short3(_48[1]) }; + t2.d = { short4(_52[0]), short4(_52[1]) }; + bool a = bool(t.a); + bool2 b = bool2(t.b); + bool3 c = bool3(t.c); + bool4 d = bool4(t.d); + spvUnsafeArray a2 = { bool(t2.a[0]), bool(t2.a[1]) }; + spvUnsafeArray b2 = { bool2(t2.b[0]), bool2(t2.b[1]) }; + spvUnsafeArray c2 = { bool3(t2.c[0]), bool3(t2.c[1]) }; + spvUnsafeArray d2 = { bool4(t2.d[0]), bool4(t2.d[1]) }; + t = Test{ short(true), short2(bool2(true, false)), short3(bool3(true)), short4(bool4(false)) }; + t2 = Test2{ spvUnsafeArray({ short(true), short(true) }), spvUnsafeArray({ short2(bool2(true)), short2(bool2(false)) }), spvUnsafeArray({ short3(bool3(true)), short3(bool3(false)) }), spvUnsafeArray({ short4(bool4(true)), short4(bool4(false)) }), Test{ short(true), short2(bool2(true, false)), short3(bool3(true)), short4(bool4(false)) } }; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag new file mode 100644 index 0000000000..7680908a44 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag @@ -0,0 +1,314 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline T spvSubgroupBroadcast(T value, ushort lane) +{ + return simd_broadcast(value, lane); +} + +template<> +inline bool spvSubgroupBroadcast(bool value, ushort lane) +{ + return !!simd_broadcast((ushort)value, lane); +} + +template +inline vec spvSubgroupBroadcast(vec value, ushort lane) +{ + return (vec)simd_broadcast((vec)value, lane); +} + +template +inline T spvSubgroupBroadcastFirst(T value) +{ + return simd_broadcast_first(value); +} + +template<> +inline bool spvSubgroupBroadcastFirst(bool value) +{ + return !!simd_broadcast_first((ushort)value); +} + +template +inline vec spvSubgroupBroadcastFirst(vec value) +{ + return (vec)simd_broadcast_first((vec)value); +} + +inline uint4 spvSubgroupBallot(bool value) +{ + simd_vote vote = simd_ballot(value); + // simd_ballot() returns a 64-bit integer-like object, but + // SPIR-V callers expect a uint4. We must convert. + // FIXME: This won't include higher bits if Apple ever supports + // 128 lanes in an SIMD-group. + return uint4(as_type((simd_vote::vote_t)vote), 0, 0); +} + +inline bool spvSubgroupBallotBitExtract(uint4 ballot, uint bit) +{ + return !!extract_bits(ballot[bit / 32], bit % 32, 1); +} + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +template +inline bool spvSubgroupAllEqual(T value) +{ + return simd_all(all(value == simd_broadcast_first(value))); +} + +template<> +inline bool spvSubgroupAllEqual(bool value) +{ + return simd_all(value) || !simd_any(value); +} + +template +inline bool spvSubgroupAllEqual(vec value) +{ + return simd_all(all(value == (vec)simd_broadcast_first((vec)value))); +} + +template +inline T spvSubgroupShuffle(T value, ushort lane) +{ + return simd_shuffle(value, lane); +} + +template<> +inline bool spvSubgroupShuffle(bool value, ushort lane) +{ + return !!simd_shuffle((ushort)value, lane); +} + +template +inline vec spvSubgroupShuffle(vec value, ushort lane) +{ + return (vec)simd_shuffle((vec)value, lane); +} + +template +inline T spvSubgroupShuffleXor(T value, ushort mask) +{ + return simd_shuffle_xor(value, mask); +} + +template<> +inline bool spvSubgroupShuffleXor(bool value, ushort mask) +{ + return !!simd_shuffle_xor((ushort)value, mask); +} + +template +inline vec spvSubgroupShuffleXor(vec value, ushort mask) +{ + return (vec)simd_shuffle_xor((vec)value, mask); +} + +template +inline T spvSubgroupShuffleUp(T value, ushort delta) +{ + return simd_shuffle_up(value, delta); +} + +template<> +inline bool spvSubgroupShuffleUp(bool value, ushort delta) +{ + return !!simd_shuffle_up((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleUp(vec value, ushort delta) +{ + return (vec)simd_shuffle_up((vec)value, delta); +} + +template +inline T spvSubgroupShuffleDown(T value, ushort delta) +{ + return simd_shuffle_down(value, delta); +} + +template<> +inline bool spvSubgroupShuffleDown(bool value, ushort delta) +{ + return !!simd_shuffle_down((ushort)value, delta); +} + +template +inline vec spvSubgroupShuffleDown(vec value, ushort delta) +{ + return (vec)simd_shuffle_down((vec)value, delta); +} + +template +inline T spvQuadBroadcast(T value, uint lane) +{ + return quad_broadcast(value, lane); +} + +template<> +inline bool spvQuadBroadcast(bool value, uint lane) +{ + return !!quad_broadcast((ushort)value, lane); +} + +template +inline vec spvQuadBroadcast(vec value, uint lane) +{ + return (vec)quad_broadcast((vec)value, lane); +} + +template +inline T spvQuadSwap(T value, uint dir) +{ + return quad_shuffle_xor(value, dir + 1); +} + +template<> +inline bool spvQuadSwap(bool value, uint dir) +{ + return !!quad_shuffle_xor((ushort)value, dir + 1); +} + +template +inline vec spvQuadSwap(vec value, uint dir) +{ + return (vec)quad_shuffle_xor((vec)value, dir + 1); +} + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SubgroupSize [[threads_per_simdgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + main0_out out = {}; + uint4 gl_SubgroupEqMask = gl_SubgroupInvocationID >= 32 ? uint4(0, (1 << (gl_SubgroupInvocationID - 32)), uint2(0)) : uint4(1 << gl_SubgroupInvocationID, uint3(0)); + uint4 gl_SubgroupGeMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID, 32u), 0)), uint2(0)); + uint4 gl_SubgroupGtMask = uint4(insert_bits(0u, 0xFFFFFFFF, min(gl_SubgroupInvocationID + 1, 32u), (uint)max(min((int)gl_SubgroupSize, 32) - (int)gl_SubgroupInvocationID - 1, 0)), insert_bits(0u, 0xFFFFFFFF, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0), (uint)max((int)gl_SubgroupSize - (int)max(gl_SubgroupInvocationID + 1, 32u), 0)), uint2(0)); + uint4 gl_SubgroupLeMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + uint4 gl_SubgroupLtMask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + out.FragColor = float(gl_SubgroupSize); + out.FragColor = float(gl_SubgroupInvocationID); + bool _24 = simd_is_first(); + bool elected = _24; + out.FragColor = float4(gl_SubgroupEqMask).x; + out.FragColor = float4(gl_SubgroupGeMask).x; + out.FragColor = float4(gl_SubgroupGtMask).x; + out.FragColor = float4(gl_SubgroupLeMask).x; + out.FragColor = float4(gl_SubgroupLtMask).x; + float4 broadcasted = spvSubgroupBroadcast(float4(10.0), 8u); + bool2 broadcasted_bool = spvSubgroupBroadcast(bool2(true), 8u); + float3 first = spvSubgroupBroadcastFirst(float3(20.0)); + bool4 first_bool = spvSubgroupBroadcastFirst(bool4(false)); + uint4 ballot_value = spvSubgroupBallot(true); + bool inverse_ballot_value = spvSubgroupBallotBitExtract(ballot_value, gl_SubgroupInvocationID); + bool bit_extracted = spvSubgroupBallotBitExtract(uint4(10u), 8u); + uint bit_count = spvSubgroupBallotBitCount(ballot_value, gl_SubgroupSize); + uint inclusive_bit_count = spvSubgroupBallotInclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint exclusive_bit_count = spvSubgroupBallotExclusiveBitCount(ballot_value, gl_SubgroupInvocationID); + uint lsb = spvSubgroupBallotFindLSB(ballot_value, gl_SubgroupSize); + uint msb = spvSubgroupBallotFindMSB(ballot_value, gl_SubgroupSize); + uint shuffled = spvSubgroupShuffle(10u, 8u); + bool shuffled_bool = spvSubgroupShuffle(true, 9u); + uint shuffled_xor = spvSubgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = spvSubgroupShuffleXor(false, 9u); + uint shuffled_up = spvSubgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = spvSubgroupShuffleUp(true, 4u); + uint shuffled_down = spvSubgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = spvSubgroupShuffleDown(false, 4u); + bool has_all = simd_all(true); + bool has_any = simd_any(true); + bool has_equal = spvSubgroupAllEqual(0); + has_equal = spvSubgroupAllEqual(true); + has_equal = spvSubgroupAllEqual(float3(0.0, 1.0, 2.0)); + has_equal = spvSubgroupAllEqual(bool4(true, true, false, true)); + float4 added = simd_sum(float4(20.0)); + int4 iadded = simd_sum(int4(20)); + float4 multiplied = simd_product(float4(20.0)); + int4 imultiplied = simd_product(int4(20)); + float4 lo = simd_min(float4(20.0)); + float4 hi = simd_max(float4(20.0)); + int4 slo = simd_min(int4(20)); + int4 shi = simd_max(int4(20)); + uint4 ulo = simd_min(uint4(20u)); + uint4 uhi = simd_max(uint4(20u)); + uint4 anded = simd_and(ballot_value); + uint4 ored = simd_or(ballot_value); + uint4 xored = simd_xor(ballot_value); + added = simd_prefix_inclusive_sum(added); + iadded = simd_prefix_inclusive_sum(iadded); + multiplied = simd_prefix_inclusive_product(multiplied); + imultiplied = simd_prefix_inclusive_product(imultiplied); + added = simd_prefix_exclusive_sum(multiplied); + multiplied = simd_prefix_exclusive_product(multiplied); + iadded = simd_prefix_exclusive_sum(imultiplied); + imultiplied = simd_prefix_exclusive_product(imultiplied); + added = quad_sum(added); + multiplied = quad_product(multiplied); + iadded = quad_sum(iadded); + imultiplied = quad_product(imultiplied); + lo = quad_min(lo); + hi = quad_max(hi); + ulo = quad_min(ulo); + uhi = quad_max(uhi); + slo = quad_min(slo); + shi = quad_max(shi); + anded = quad_and(anded); + ored = quad_or(ored); + xored = quad_xor(xored); + float4 swap_horiz = spvQuadSwap(float4(20.0), 0u); + bool4 swap_horiz_bool = spvQuadSwap(bool4(true), 0u); + float4 swap_vertical = spvQuadSwap(float4(20.0), 1u); + bool4 swap_vertical_bool = spvQuadSwap(bool4(true), 1u); + float4 swap_diagonal = spvQuadSwap(float4(20.0), 2u); + bool4 swap_diagonal_bool = spvQuadSwap(bool4(true), 2u); + float4 quad_broadcast0 = spvQuadBroadcast(float4(20.0), 3u); + bool4 quad_broadcast_bool = spvQuadBroadcast(bool4(true), 3u); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag new file mode 100644 index 0000000000..c67984892d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(1)]]; +}; + +fragment main0_out main0(float4 uInput [[color(1)]]) +{ + main0_out out = {}; + out.FragColor = uInput; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag new file mode 100644 index 0000000000..c67984892d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(1)]]; +}; + +fragment main0_out main0(float4 uInput [[color(1)]]) +{ + main0_out out = {}; + out.FragColor = uInput; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag new file mode 100644 index 0000000000..950895d088 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 samp3(float4 uS) +{ + return uS; +} + +static inline __attribute__((always_inline)) +float4 samp(float4 uSub) +{ + return uSub + samp3(uSub); +} + +static inline __attribute__((always_inline)) +float4 samp2(float4 uS) +{ + return uS + samp3(uS); +} + +fragment main0_out main0(float4 uSub [[color(0)]]) +{ + main0_out out = {}; + out.FragColor = samp(uSub) + samp2(uSub); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag new file mode 100644 index 0000000000..950895d088 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 samp3(float4 uS) +{ + return uS; +} + +static inline __attribute__((always_inline)) +float4 samp(float4 uSub) +{ + return uSub + samp3(uSub); +} + +static inline __attribute__((always_inline)) +float4 samp2(float4 uS) +{ + return uS + samp3(uS); +} + +fragment main0_out main0(float4 uSub [[color(0)]]) +{ + main0_out out = {}; + out.FragColor = samp(uSub) + samp2(uSub); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag new file mode 100644 index 0000000000..8c7f67b68b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct spvDescriptorSetBuffer0 +{ + sampler uSampler [[id(8)]]; + texture2d uTex [[id(9)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], float4 uSub [[color(1)]]) +{ + main0_out out = {}; + out.FragColor = uSub + spvDescriptorSet0.uTex.sample(spvDescriptorSet0.uSampler, float2(0.5)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag new file mode 100644 index 0000000000..9108927ee4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(float4 uSub [[color(1)]], texture2d uTex [[texture(9)]], sampler uSampler [[sampler(8)]]) +{ + main0_out out = {}; + out.FragColor = uSub + uTex.sample(uSampler, float2(0.5)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag new file mode 100644 index 0000000000..8c7f67b68b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct spvDescriptorSetBuffer0 +{ + sampler uSampler [[id(8)]]; + texture2d uTex [[id(9)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], float4 uSub [[color(1)]]) +{ + main0_out out = {}; + out.FragColor = uSub + spvDescriptorSet0.uTex.sample(spvDescriptorSet0.uSampler, float2(0.5)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag new file mode 100644 index 0000000000..9108927ee4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(float4 uSub [[color(1)]], texture2d uTex [[texture(9)]], sampler uSampler [[sampler(8)]]) +{ + main0_out out = {}; + out.FragColor = uSub + uTex.sample(uSampler, float2(0.5)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag new file mode 100644 index 0000000000..8b56f3334c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag @@ -0,0 +1,148 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +fragment void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], texture2d texBuffer [[texture(6)]], sampler tex1dSmplr [[sampler(0)]], sampler tex2dSmplr [[sampler(1)]], sampler tex3dSmplr [[sampler(2)]], sampler texCubeSmplr [[sampler(3)]], sampler tex2dArraySmplr [[sampler(4)]], sampler texCubeArraySmplr [[sampler(5)]]) +{ + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + float4 c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0)), texCubeSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z))), tex2dArraySwzl)); + c = float4(spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w))), texCubeArraySwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0), level(0.0)), texCubeSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), tex2dArraySwzl)); + c = float4(spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), texCubeArraySwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.read(uint2(int3(0).xy), uint(int3(0).z), 0), tex2dArraySwzl)); + c = float4(texBuffer.read(spvTexelBufferCoord(0))); + c = float4(spvGatherSwizzle(tex2d, tex2dSmplr, tex2dSwzl, component::x, float2(0.0), int2(0))); + c = float4(spvGatherSwizzle(texCube, texCubeSmplr, texCubeSwzl, component::y, float3(0.0))); + c = float4(spvGatherSwizzle(tex2dArray, tex2dArraySmplr, tex2dArraySwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0))); + c = float4(spvGatherSwizzle(texCubeArray, texCubeArraySmplr, texCubeArraySwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w)))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag new file mode 100644 index 0000000000..b60382ab6a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag @@ -0,0 +1,197 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +// Wrapper function that swizzles depth texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherCompareSwizzle(const thread Tex& t, sampler s, uint sw, Ts... params) +{ + if (sw) + { + switch (spvSwizzle(sw & 0xFF)) + { + case spvSwizzle::none: + case spvSwizzle::red: + break; + case spvSwizzle::zero: + case spvSwizzle::green: + case spvSwizzle::blue: + case spvSwizzle::alpha: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + } + } + return t.gather_compare(s, spvForward(params)...); +} + +static inline __attribute__((always_inline)) +float4 doSwizzle(texture1d tex1d, sampler tex1dSmplr, constant uint& tex1dSwzl, texture2d tex2d, sampler tex2dSmplr, constant uint& tex2dSwzl, texture3d tex3d, sampler tex3dSmplr, constant uint& tex3dSwzl, texturecube texCube, sampler texCubeSmplr, constant uint& texCubeSwzl, texture2d_array tex2dArray, sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, texturecube_array texCubeArray, sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, depth2d depth2d, sampler depth2dSmplr, constant uint& depth2dSwzl, depthcube depthCube, sampler depthCubeSmplr, constant uint& depthCubeSwzl, depth2d_array depth2dArray, sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, depthcube_array depthCubeArray, sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, texture2d texBuffer) +{ + float4 c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z))), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w))), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, float3(0.0, 0.0, 1.0).xy, 1.0), depth2dSwzl); + c.x = spvTextureSwizzle(depthCube.sample_compare(depthCubeSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz, 1.0), depthCubeSwzl); + c.x = spvTextureSwizzle(depth2dArray.sample_compare(depth2dArraySmplr, float4(0.0, 0.0, 0.0, 1.0).xy, uint(rint(float4(0.0, 0.0, 0.0, 1.0).z)), 1.0), depth2dArraySwzl); + c.x = spvTextureSwizzle(depthCubeArray.sample_compare(depthCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0), depthCubeArraySwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl); + float4 _103 = float4(0.0, 0.0, 1.0, 1.0); + _103.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _103.xy / _103.z, 1.0 / _103.z), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0), level(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, float3(0.0, 0.0, 1.0).xy, 1.0, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl); + float4 _131 = float4(0.0, 0.0, 1.0, 1.0); + _131.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _131.xy / _131.z, 1.0 / _131.z, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl); + c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl); + c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl); + c = spvTextureSwizzle(tex2dArray.read(uint2(int3(0).xy), uint(int3(0).z), 0), tex2dArraySwzl); + c = texBuffer.read(spvTexelBufferCoord(0)); + c = spvGatherSwizzle(tex2d, tex2dSmplr, tex2dSwzl, component::x, float2(0.0), int2(0)); + c = spvGatherSwizzle(texCube, texCubeSmplr, texCubeSwzl, component::y, float3(0.0)); + c = spvGatherSwizzle(tex2dArray, tex2dArraySmplr, tex2dArraySwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0)); + c = spvGatherSwizzle(texCubeArray, texCubeArraySmplr, texCubeArraySwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w))); + c = spvGatherCompareSwizzle(depth2d, depth2dSmplr, depth2dSwzl, float2(0.0), 1.0); + c = spvGatherCompareSwizzle(depthCube, depthCubeSmplr, depthCubeSwzl, float3(0.0), 1.0); + c = spvGatherCompareSwizzle(depth2dArray, depth2dArraySmplr, depth2dArraySwzl, float3(0.0).xy, uint(rint(float3(0.0).z)), 1.0); + c = spvGatherCompareSwizzle(depthCubeArray, depthCubeArraySmplr, depthCubeArraySwzl, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0); + return c; +} + +fragment void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], depth2d depth2d [[texture(6)]], depthcube depthCube [[texture(7)]], depth2d_array depth2dArray [[texture(8)]], depthcube_array depthCubeArray [[texture(9)]], texture2d texBuffer [[texture(10)]], sampler tex1dSmplr [[sampler(0)]], sampler tex2dSmplr [[sampler(1)]], sampler tex3dSmplr [[sampler(2)]], sampler texCubeSmplr [[sampler(3)]], sampler tex2dArraySmplr [[sampler(4)]], sampler texCubeArraySmplr [[sampler(5)]], sampler depth2dSmplr [[sampler(6)]], sampler depthCubeSmplr [[sampler(7)]], sampler depth2dArraySmplr [[sampler(8)]], sampler depthCubeArraySmplr [[sampler(9)]]) +{ + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + constant uint& depth2dSwzl = spvSwizzleConstants[6]; + constant uint& depthCubeSwzl = spvSwizzleConstants[7]; + constant uint& depth2dArraySwzl = spvSwizzleConstants[8]; + constant uint& depthCubeArraySwzl = spvSwizzleConstants[9]; + float4 c = doSwizzle(tex1d, tex1dSmplr, tex1dSwzl, tex2d, tex2dSmplr, tex2dSwzl, tex3d, tex3dSmplr, tex3dSwzl, texCube, texCubeSmplr, texCubeSwzl, tex2dArray, tex2dArraySmplr, tex2dArraySwzl, texCubeArray, texCubeArraySmplr, texCubeArraySwzl, depth2d, depth2dSmplr, depth2dSwzl, depthCube, depthCubeSmplr, depthCubeSwzl, depth2dArray, depth2dArraySmplr, depth2dArraySwzl, depthCubeArray, depthCubeArraySmplr, depthCubeArraySwzl, texBuffer); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag new file mode 100644 index 0000000000..70d4e447ff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag @@ -0,0 +1,148 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +fragment void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], texture2d texBuffer [[texture(6)]], sampler tex1dSmplr [[sampler(0)]], sampler tex2dSmplr [[sampler(1)]], sampler tex3dSmplr [[sampler(2)]], sampler texCubeSmplr [[sampler(3)]], sampler tex2dArraySmplr [[sampler(4)]], sampler texCubeArraySmplr [[sampler(5)]]) +{ + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + float4 c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0)), texCubeSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z))), tex2dArraySwzl)); + c = float4(spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w))), texCubeArraySwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0), level(0.0)), texCubeSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), tex2dArraySwzl)); + c = float4(spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), texCubeArraySwzl)); + c = float4(spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl)); + c = float4(spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl)); + c = float4(spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl)); + c = float4(spvTextureSwizzle(tex2dArray.read(uint2(int3(0).xy), uint(int3(0).z), 0), tex2dArraySwzl)); + c = float4(texBuffer.read(spvTexelBufferCoord(0))); + c = float4(spvGatherSwizzle(tex2d, tex2dSmplr, tex2dSwzl, component::x, float2(0.0), int2(0))); + c = float4(spvGatherSwizzle(texCube, texCubeSmplr, texCubeSwzl, component::y, float3(0.0))); + c = float4(spvGatherSwizzle(tex2dArray, tex2dArraySmplr, tex2dArraySwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0))); + c = float4(spvGatherSwizzle(texCubeArray, texCubeArraySmplr, texCubeArraySwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w)))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag new file mode 100644 index 0000000000..255a0532b0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag @@ -0,0 +1,190 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +// Wrapper function that swizzles depth texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherCompareSwizzle(const thread Tex& t, sampler s, uint sw, Ts... params) +{ + if (sw) + { + switch (spvSwizzle(sw & 0xFF)) + { + case spvSwizzle::none: + case spvSwizzle::red: + break; + case spvSwizzle::zero: + case spvSwizzle::green: + case spvSwizzle::blue: + case spvSwizzle::alpha: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + } + } + return t.gather_compare(s, spvForward(params)...); +} + +fragment void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], depth2d depth2d [[texture(6)]], depthcube depthCube [[texture(7)]], depth2d_array depth2dArray [[texture(8)]], depthcube_array depthCubeArray [[texture(9)]], texture2d texBuffer [[texture(10)]], sampler tex1dSmplr [[sampler(0)]], sampler tex2dSmplr [[sampler(1)]], sampler tex3dSmplr [[sampler(2)]], sampler texCubeSmplr [[sampler(3)]], sampler tex2dArraySmplr [[sampler(4)]], sampler texCubeArraySmplr [[sampler(5)]], sampler depth2dSmplr [[sampler(6)]], sampler depthCubeSmplr [[sampler(7)]], sampler depth2dArraySmplr [[sampler(8)]], sampler depthCubeArraySmplr [[sampler(9)]]) +{ + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + constant uint& depth2dSwzl = spvSwizzleConstants[6]; + constant uint& depthCubeSwzl = spvSwizzleConstants[7]; + constant uint& depth2dArraySwzl = spvSwizzleConstants[8]; + constant uint& depthCubeArraySwzl = spvSwizzleConstants[9]; + float4 c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z))), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w))), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, float3(0.0, 0.0, 1.0).xy, 1.0), depth2dSwzl); + c.x = spvTextureSwizzle(depthCube.sample_compare(depthCubeSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz, 1.0), depthCubeSwzl); + c.x = spvTextureSwizzle(depth2dArray.sample_compare(depth2dArraySmplr, float4(0.0, 0.0, 0.0, 1.0).xy, uint(rint(float4(0.0, 0.0, 0.0, 1.0).z)), 1.0), depth2dArraySwzl); + c.x = spvTextureSwizzle(depthCubeArray.sample_compare(depthCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0), depthCubeArraySwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl); + float4 _100 = float4(0.0, 0.0, 1.0, 1.0); + _100.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _100.xy / _100.z, 1.0 / _100.z), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl); + c = spvTextureSwizzle(texCube.sample(texCubeSmplr, float3(0.0), level(0.0)), texCubeSwzl); + c = spvTextureSwizzle(tex2dArray.sample(tex2dArraySmplr, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), tex2dArraySwzl); + c = spvTextureSwizzle(texCubeArray.sample(texCubeArraySmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), texCubeArraySwzl); + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, float3(0.0, 0.0, 1.0).xy, 1.0, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), tex1dSwzl); + c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), tex2dSwzl); + c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl); + float4 _128 = float4(0.0, 0.0, 1.0, 1.0); + _128.z = 1.0; + c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _128.xy / _128.z, 1.0 / _128.z, level(0.0)), depth2dSwzl); + c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl); + c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl); + c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl); + c = spvTextureSwizzle(tex2dArray.read(uint2(int3(0).xy), uint(int3(0).z), 0), tex2dArraySwzl); + c = texBuffer.read(spvTexelBufferCoord(0)); + c = spvGatherSwizzle(tex2d, tex2dSmplr, tex2dSwzl, component::x, float2(0.0), int2(0)); + c = spvGatherSwizzle(texCube, texCubeSmplr, texCubeSwzl, component::y, float3(0.0)); + c = spvGatherSwizzle(tex2dArray, tex2dArraySmplr, tex2dArraySwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0)); + c = spvGatherSwizzle(texCubeArray, texCubeArraySmplr, texCubeArraySwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w))); + c = spvGatherCompareSwizzle(depth2d, depth2dSmplr, depth2dSwzl, float2(0.0), 1.0); + c = spvGatherCompareSwizzle(depthCube, depthCubeSmplr, depthCubeSwzl, float3(0.0), 1.0); + c = spvGatherCompareSwizzle(depth2dArray, depth2dArraySmplr, depth2dArraySwzl, float3(0.0).xy, uint(rint(float3(0.0).z)), 1.0); + c = spvGatherCompareSwizzle(depthCubeArray, depthCubeArraySmplr, depthCubeArraySwzl, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..8fcb19a850 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSamp [[texture(0)]], sampler uSampSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uSamp.gather(uSampSmplr, in.vUV, int2(0), component::y); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag new file mode 100644 index 0000000000..7c60182078 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float4 v; +}; + +struct UBO +{ + Foo foo; +}; + +struct spvDescriptorSetBuffer0 +{ + constant UBO* ubos [[id(0)]][2]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = spvDescriptorSet0.ubos[1]->foo.v; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag new file mode 100644 index 0000000000..0b1ca91f54 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float4 v; +}; + +struct UBO +{ + Foo foo; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO* ubos_0 [[buffer(0)]], constant UBO* ubos_1 [[buffer(1)]]) +{ + constant UBO* ubos[] = + { + ubos_0, + ubos_1, + }; + + main0_out out = {}; + out.FragColor = ubos[1]->foo.v; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag new file mode 100644 index 0000000000..ce3291a28e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 v; + float4x4 m; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _13 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = (_13.m * in.vColor) + _13.v; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..0720087a63 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + int a; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + int uninit_function_int = {}; + int uninit_int = {}; + int4 uninit_vector = {}; + float4x4 uninit_matrix = {}; + Foo uninit_foo = {}; + if (in.vColor.x > 10.0) + { + uninit_function_int = 10; + } + else + { + uninit_function_int = 20; + } + out.FragColor = in.vColor; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag new file mode 100644 index 0000000000..f42aeb876a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + bool _12 = gl_HelperInvocation; + float _15 = float(_12); + out.FragColor = _15; + gl_HelperInvocation = true, discard_fragment(); + bool _16 = gl_HelperInvocation; + float _17 = float(_16); + out.FragColor = _17; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp new file mode 100644 index 0000000000..0dd52ab36d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + packed_float3 v[16]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _13 [[buffer(0)]]) +{ + _13.v[1] = float3(_13.v[0]); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp new file mode 100644 index 0000000000..025cd42546 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v[16]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _13 [[buffer(0)]]) +{ + _13.v[1] = _13.v[0]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp new file mode 100644 index 0000000000..f1a3719158 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/isolated-scalar-access.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v; + float4x4 cm; + float4x4 rm; + packed_float3 v3; + float f; +}; + +kernel void main0(device SSBO& _12 [[buffer(0)]]) +{ + threadgroup float4 shared_vec4; + threadgroup float3 shared_vec3; + ((device float*)&_12.v)[0u] = 10.0; + _12.v3[1u] = 40.0; + ((device float*)&_12.cm[1])[2u] = 20.0; + ((device float*)&_12.rm[1u])[3] = 30.0; + ((threadgroup float*)&shared_vec4)[2u] = 40.0; + ((threadgroup float*)&shared_vec3)[1u] = 1.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/load-store-col-rows.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/load-store-col-rows.comp new file mode 100644 index 0000000000..3c9acfa3cc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/load-store-col-rows.comp @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_float2x3[2]; +typedef packed_float3 packed_rm_float3x2[2]; + +struct SSBO1 +{ + float2x4 a; + float2x4 a2; +}; + +struct SSBO2 +{ + packed_float2x3 b; + packed_rm_float3x2 b2; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_column(device SSBO1& _21) +{ + float2 u = _21.a[0].xy; + float2 v = _21.a[1].xy; + u += v; + (device float2&)_21.a[0] = u; + (device float2&)_21.a[1] = v; +} + +static inline __attribute__((always_inline)) +void load_store_row(device SSBO1& _21) +{ + float2 u = float2(_21.a2[0][0], _21.a2[1][0]); + float2 v = float2(_21.a2[0][1], _21.a2[1][1]); + u += v; + ((device float*)&_21.a2[0])[0] = u.x; + ((device float*)&_21.a2[1])[0] = u.y; + ((device float*)&_21.a2[0])[1] = v.x; + ((device float*)&_21.a2[1])[1] = v.y; +} + +static inline __attribute__((always_inline)) +void load_store_packed_column(device SSBO2& _58) +{ + float3 u = float3(_58.b[0]); + float3 v = float3(_58.b[1]); + u += v; + _58.b[0] = u; + _58.b[1] = v; +} + +static inline __attribute__((always_inline)) +void load_store_packed_row(device SSBO2& _58) +{ + float2 u = float2(_58.b2[0][0], _58.b2[1][0]); + float2 v = float2(_58.b2[0][1], _58.b2[1][1]); + u += v; + ((device float*)&_58.b2[0])[0] = u.x; + ((device float*)&_58.b2[1])[0] = u.y; + ((device float*)&_58.b2[0])[1] = v.x; + ((device float*)&_58.b2[1])[1] = v.y; +} + +kernel void main0(device SSBO1& _21 [[buffer(0)]], device SSBO2& _58 [[buffer(1)]]) +{ + load_store_column(_21); + load_store_row(_21); + load_store_packed_column(_58); + load_store_packed_row(_58); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp new file mode 100644 index 0000000000..7bd7e43cd2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x2 col_major0; + float2x2 col_major1; +}; + +struct SSBORow +{ + float2x2 row_major0; + float2x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp new file mode 100644 index 0000000000..192d260fbc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x4 col_major0; + float2x4 col_major1; +}; + +struct SSBORow +{ + float2x4 row_major0; + float2x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x2 loaded = float2x2(_29.col_major0[0].xy, _29.col_major0[1].xy); + (device float2&)_29.col_major1[0] = loaded[0]; + (device float2&)_29.col_major1[1] = loaded[1]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x2 loaded = transpose(float2x2(_41.row_major0[0].xy, _41.row_major0[1].xy)); + (device float2&)_41.row_major0[0] = float2(loaded[0][0], loaded[1][0]); + (device float2&)_41.row_major0[1] = float2(loaded[0][1], loaded[1][1]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + (device float2&)_29.col_major0[0] = float2x2(_29.col_major1[0].xy, _29.col_major1[1].xy)[0]; + (device float2&)_29.col_major0[1] = float2x2(_29.col_major1[0].xy, _29.col_major1[1].xy)[1]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float2(float2x2(_29.col_major0[0].xy, _29.col_major0[1].xy)[0][0], float2x2(_29.col_major0[0].xy, _29.col_major0[1].xy)[1][0]); + (device float2&)_41.row_major0[1] = float2(float2x2(_29.col_major0[0].xy, _29.col_major0[1].xy)[0][1], float2x2(_29.col_major0[0].xy, _29.col_major0[1].xy)[1][1]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[0] = float2(float2x2(_41.row_major0[0].xy, _41.row_major0[1].xy)[0][0], float2x2(_41.row_major0[0].xy, _41.row_major0[1].xy)[1][0]); + (device float2&)_29.col_major0[1] = float2(float2x2(_41.row_major0[0].xy, _41.row_major0[1].xy)[0][1], float2x2(_41.row_major0[0].xy, _41.row_major0[1].xy)[1][1]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float2x2(_41.row_major1[0].xy, _41.row_major1[1].xy)[0]; + (device float2&)_41.row_major0[1] = float2x2(_41.row_major1[0].xy, _41.row_major1[1].xy)[1]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1].x; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp new file mode 100644 index 0000000000..7bd7e43cd2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x2 col_major0; + float2x2 col_major1; +}; + +struct SSBORow +{ + float2x2 row_major0; + float2x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp new file mode 100644 index 0000000000..964629ceb9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_float2x3[2]; + +struct SSBOCol +{ + packed_float2x3 col_major0; + packed_float2x3 col_major1; +}; + +struct SSBORow +{ + float3x2 row_major0; + float3x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x3 loaded = float2x3(float3(_29.col_major0[0]), float3(_29.col_major0[1])); + _29.col_major1[0] = loaded[0]; + _29.col_major1[1] = loaded[1]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0[0] = float2x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]))[0]; + _29.col_major0[1] = float2x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]))[1]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(float2x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]))); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0] = float3(_41.row_major0[0][0], _41.row_major0[1][0], _41.row_major0[2][0]); + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1][0]; + _41.row_major0[1][1] = _29.col_major0[1][1]; + _41.row_major0[2][1] = _29.col_major0[1][2]; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0][1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = _29.col_major0[0][1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp new file mode 100644 index 0000000000..875a53043a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp @@ -0,0 +1,93 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x3 col_major0; + float2x3 col_major1; +}; + +struct SSBORow +{ + float3x4 row_major0; + float3x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x3 loaded = transpose(float3x2(_41.row_major0[0].xy, _41.row_major0[1].xy, _41.row_major0[2].xy)); + (device float2&)_41.row_major0[0] = float2(loaded[0][0], loaded[1][0]); + (device float2&)_41.row_major0[1] = float2(loaded[0][1], loaded[1][1]); + (device float2&)_41.row_major0[2] = float2(loaded[0][2], loaded[1][2]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float2(_29.col_major0[0][0], _29.col_major0[1][0]); + (device float2&)_41.row_major0[1] = float2(_29.col_major0[0][1], _29.col_major0[1][1]); + (device float2&)_41.row_major0[2] = float2(_29.col_major0[0][2], _29.col_major0[1][2]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(float3x2(_41.row_major0[0].xy, _41.row_major0[1].xy, _41.row_major0[2].xy)); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float3x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy)[0]; + (device float2&)_41.row_major0[1] = float3x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy)[1]; + (device float2&)_41.row_major0[2] = float3x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy)[2]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1].x; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1].y; + ((device float*)&_41.row_major0[2])[1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp new file mode 100644 index 0000000000..2ffef2f596 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x3 col_major0; + float2x3 col_major1; +}; + +struct SSBORow +{ + float3x2 row_major0; + float3x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp new file mode 100644 index 0000000000..275d41eebc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x4 col_major0; + float2x4 col_major1; +}; + +struct SSBORow +{ + float4x2 row_major0; + float4x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp new file mode 100644 index 0000000000..3b45baf99d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp @@ -0,0 +1,97 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x4 col_major0; + float2x4 col_major1; +}; + +struct SSBORow +{ + float4x4 row_major0; + float4x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x4 loaded = transpose(float4x2(_41.row_major0[0].xy, _41.row_major0[1].xy, _41.row_major0[2].xy, _41.row_major0[3].xy)); + (device float2&)_41.row_major0[0] = float2(loaded[0][0], loaded[1][0]); + (device float2&)_41.row_major0[1] = float2(loaded[0][1], loaded[1][1]); + (device float2&)_41.row_major0[2] = float2(loaded[0][2], loaded[1][2]); + (device float2&)_41.row_major0[3] = float2(loaded[0][3], loaded[1][3]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float2(_29.col_major0[0][0], _29.col_major0[1][0]); + (device float2&)_41.row_major0[1] = float2(_29.col_major0[0][1], _29.col_major0[1][1]); + (device float2&)_41.row_major0[2] = float2(_29.col_major0[0][2], _29.col_major0[1][2]); + (device float2&)_41.row_major0[3] = float2(_29.col_major0[0][3], _29.col_major0[1][3]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(float4x2(_41.row_major0[0].xy, _41.row_major0[1].xy, _41.row_major0[2].xy, _41.row_major0[3].xy)); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + (device float2&)_41.row_major0[0] = float4x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy, _41.row_major1[3].xy)[0]; + (device float2&)_41.row_major0[1] = float4x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy, _41.row_major1[3].xy)[1]; + (device float2&)_41.row_major0[2] = float4x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy, _41.row_major1[3].xy)[2]; + (device float2&)_41.row_major0[3] = float4x2(_41.row_major1[0].xy, _41.row_major1[1].xy, _41.row_major1[2].xy, _41.row_major1[3].xy)[3]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1].x; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1].y; + ((device float*)&_41.row_major0[2])[1] = _29.col_major0[1].z; + ((device float*)&_41.row_major0[3])[1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp new file mode 100644 index 0000000000..275d41eebc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float2x4 col_major0; + float2x4 col_major1; +}; + +struct SSBORow +{ + float4x2 row_major0; + float4x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float2x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float2x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp new file mode 100644 index 0000000000..e1e5640d35 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp @@ -0,0 +1,91 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_rm_float3x2[2]; + +struct SSBOCol +{ + float3x2 col_major0; + float3x2 col_major1; +}; + +struct SSBORow +{ + packed_rm_float3x2 row_major0; + packed_rm_float3x2 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x2 loaded = transpose(float2x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]))); + _41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); + _41.row_major0[1] = float3(loaded[0][1], loaded[1][1], loaded[2][1]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0[0] = float3(_29.col_major0[0][0], _29.col_major0[1][0], _29.col_major0[2][0]); + _41.row_major0[1] = float3(_29.col_major0[0][1], _29.col_major0[1][1], _29.col_major0[2][1]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(float2x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]))); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0[0] = float2x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]))[0]; + _41.row_major0[1] = float2x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]))[1]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1].x; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = _41.row_major0[1u][0]; + _41.row_major0[1u][0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp new file mode 100644 index 0000000000..cf41383107 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x4 col_major0; + float3x4 col_major1; +}; + +struct SSBORow +{ + float2x3 row_major0; + float2x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x2 loaded = float3x2(_29.col_major0[0].xy, _29.col_major0[1].xy, _29.col_major0[2].xy); + (device float2&)_29.col_major1[0] = loaded[0]; + (device float2&)_29.col_major1[1] = loaded[1]; + (device float2&)_29.col_major1[2] = loaded[2]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + (device float2&)_29.col_major0[0] = float3x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy)[0]; + (device float2&)_29.col_major0[1] = float3x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy)[1]; + (device float2&)_29.col_major0[2] = float3x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy)[2]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(float3x2(_29.col_major0[0].xy, _29.col_major0[1].xy, _29.col_major0[2].xy)); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[0] = float2(_41.row_major0[0][0], _41.row_major0[1][0]); + (device float2&)_29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + (device float2&)_29.col_major0[2] = float2(_41.row_major0[0][2], _41.row_major0[1][2]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp new file mode 100644 index 0000000000..c057d31df4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x2 col_major0; + float3x2 col_major1; +}; + +struct SSBORow +{ + float2x3 row_major0; + float2x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp new file mode 100644 index 0000000000..e754b5dc4d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp @@ -0,0 +1,102 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_float3x3[3]; +typedef packed_float3 packed_rm_float3x3[3]; + +struct SSBOCol +{ + packed_float3x3 col_major0; + packed_float3x3 col_major1; +}; + +struct SSBORow +{ + packed_rm_float3x3 row_major0; + packed_rm_float3x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x3 loaded = float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2])); + _29.col_major1[0] = loaded[0]; + _29.col_major1[1] = loaded[1]; + _29.col_major1[2] = loaded[2]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x3 loaded = transpose(float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))); + _41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); + _41.row_major0[1] = float3(loaded[0][1], loaded[1][1], loaded[2][1]); + _41.row_major0[2] = float3(loaded[0][2], loaded[1][2], loaded[2][2]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0[0] = float3x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]))[0]; + _29.col_major0[1] = float3x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]))[1]; + _29.col_major0[2] = float3x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]))[2]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0[0] = float3(float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[0][0], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[1][0], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[2][0]); + _41.row_major0[1] = float3(float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[0][1], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[1][1], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[2][1]); + _41.row_major0[2] = float3(float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[0][2], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[1][2], float3x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]))[2][2]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0] = float3(float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[0][0], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[1][0], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[2][0]); + _29.col_major0[1] = float3(float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[0][1], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[1][1], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[2][1]); + _29.col_major0[2] = float3(float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[0][2], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[1][2], float3x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]))[2][2]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0[0] = float3x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]))[0]; + _41.row_major0[1] = float3x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]))[1]; + _41.row_major0[2] = float3x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]))[2]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1][0]; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1][1]; + ((device float*)&_41.row_major0[2])[1] = _29.col_major0[1][2]; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0][1u] = _41.row_major0[1u][0]; + _41.row_major0[1u][0] = _29.col_major0[0][1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp new file mode 100644 index 0000000000..e522e59632 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x3 col_major0; + float3x3 col_major1; +}; + +struct SSBORow +{ + float3x3 row_major0; + float3x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp new file mode 100644 index 0000000000..e522e59632 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x3 col_major0; + float3x3 col_major1; +}; + +struct SSBORow +{ + float3x3 row_major0; + float3x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp new file mode 100644 index 0000000000..7c5c913b76 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp @@ -0,0 +1,99 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_rm_float3x4[4]; + +struct SSBOCol +{ + float3x4 col_major0; + float3x4 col_major1; +}; + +struct SSBORow +{ + packed_rm_float3x4 row_major0; + packed_rm_float3x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x4 loaded = transpose(float4x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]), float3(_41.row_major0[3]))); + _41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); + _41.row_major0[1] = float3(loaded[0][1], loaded[1][1], loaded[2][1]); + _41.row_major0[2] = float3(loaded[0][2], loaded[1][2], loaded[2][2]); + _41.row_major0[3] = float3(loaded[0][3], loaded[1][3], loaded[2][3]); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0[0] = float3(_29.col_major0[0][0], _29.col_major0[1][0], _29.col_major0[2][0]); + _41.row_major0[1] = float3(_29.col_major0[0][1], _29.col_major0[1][1], _29.col_major0[2][1]); + _41.row_major0[2] = float3(_29.col_major0[0][2], _29.col_major0[1][2], _29.col_major0[2][2]); + _41.row_major0[3] = float3(_29.col_major0[0][3], _29.col_major0[1][3], _29.col_major0[2][3]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(float4x3(float3(_41.row_major0[0]), float3(_41.row_major0[1]), float3(_41.row_major0[2]), float3(_41.row_major0[3]))); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0[0] = float4x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]), float3(_41.row_major1[3]))[0]; + _41.row_major0[1] = float4x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]), float3(_41.row_major1[3]))[1]; + _41.row_major0[2] = float4x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]), float3(_41.row_major1[3]))[2]; + _41.row_major0[3] = float4x3(float3(_41.row_major1[0]), float3(_41.row_major1[1]), float3(_41.row_major1[2]), float3(_41.row_major1[3]))[3]; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + ((device float*)&_41.row_major0[0])[1] = _29.col_major0[1].x; + ((device float*)&_41.row_major0[1])[1] = _29.col_major0[1].y; + ((device float*)&_41.row_major0[2])[1] = _29.col_major0[1].z; + ((device float*)&_41.row_major0[3])[1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = _41.row_major0[1u][0]; + _41.row_major0[1u][0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp new file mode 100644 index 0000000000..929d327002 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x4 col_major0; + float3x4 col_major1; +}; + +struct SSBORow +{ + float4x3 row_major0; + float4x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp new file mode 100644 index 0000000000..929d327002 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float3x4 col_major0; + float3x4 col_major1; +}; + +struct SSBORow +{ + float4x3 row_major0; + float4x3 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float3x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float3x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp new file mode 100644 index 0000000000..e9d4a4db85 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x2 col_major0; + float4x2 col_major1; +}; + +struct SSBORow +{ + float2x4 row_major0; + float2x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp new file mode 100644 index 0000000000..e211083cef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp @@ -0,0 +1,95 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x4 col_major0; + float4x4 col_major1; +}; + +struct SSBORow +{ + float2x4 row_major0; + float2x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x2 loaded = float4x2(_29.col_major0[0].xy, _29.col_major0[1].xy, _29.col_major0[2].xy, _29.col_major0[3].xy); + (device float2&)_29.col_major1[0] = loaded[0]; + (device float2&)_29.col_major1[1] = loaded[1]; + (device float2&)_29.col_major1[2] = loaded[2]; + (device float2&)_29.col_major1[3] = loaded[3]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + (device float2&)_29.col_major0[0] = float4x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy, _29.col_major1[3].xy)[0]; + (device float2&)_29.col_major0[1] = float4x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy, _29.col_major1[3].xy)[1]; + (device float2&)_29.col_major0[2] = float4x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy, _29.col_major1[3].xy)[2]; + (device float2&)_29.col_major0[3] = float4x2(_29.col_major1[0].xy, _29.col_major1[1].xy, _29.col_major1[2].xy, _29.col_major1[3].xy)[3]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(float4x2(_29.col_major0[0].xy, _29.col_major0[1].xy, _29.col_major0[2].xy, _29.col_major0[3].xy)); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[0] = float2(_41.row_major0[0][0], _41.row_major0[1][0]); + (device float2&)_29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + (device float2&)_29.col_major0[2] = float2(_41.row_major0[0][2], _41.row_major0[1][2]); + (device float2&)_29.col_major0[3] = float2(_41.row_major0[0][3], _41.row_major0[1][3]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + (device float2&)_29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp new file mode 100644 index 0000000000..e9d4a4db85 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x2 col_major0; + float4x2 col_major1; +}; + +struct SSBORow +{ + float2x4 row_major0; + float2x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x2 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x2 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float2(_41.row_major0[0][1], _41.row_major0[1][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp new file mode 100644 index 0000000000..7735f00a6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +typedef packed_float3 packed_float4x3[4]; + +struct SSBOCol +{ + packed_float4x3 col_major0; + packed_float4x3 col_major1; +}; + +struct SSBORow +{ + float3x4 row_major0; + float3x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x3 loaded = float4x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]), float3(_29.col_major0[3])); + _29.col_major1[0] = loaded[0]; + _29.col_major1[1] = loaded[1]; + _29.col_major1[2] = loaded[2]; + _29.col_major1[3] = loaded[3]; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0[0] = float4x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]), float3(_29.col_major1[3]))[0]; + _29.col_major0[1] = float4x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]), float3(_29.col_major1[3]))[1]; + _29.col_major0[2] = float4x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]), float3(_29.col_major1[3]))[2]; + _29.col_major0[3] = float4x3(float3(_29.col_major1[0]), float3(_29.col_major1[1]), float3(_29.col_major1[2]), float3(_29.col_major1[3]))[3]; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(float4x3(float3(_29.col_major0[0]), float3(_29.col_major0[1]), float3(_29.col_major0[2]), float3(_29.col_major0[3]))); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0] = float3(_41.row_major0[0][0], _41.row_major0[1][0], _41.row_major0[2][0]); + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _29.col_major0[2] = float3(_41.row_major0[0][2], _41.row_major0[1][2], _41.row_major0[2][2]); + _29.col_major0[3] = float3(_41.row_major0[0][3], _41.row_major0[1][3], _41.row_major0[2][3]); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1][0]; + _41.row_major0[1][1] = _29.col_major0[1][1]; + _41.row_major0[2][1] = _29.col_major0[1][2]; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[0][1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = _29.col_major0[0][1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp new file mode 100644 index 0000000000..adb99bddf5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x3 col_major0; + float4x3 col_major1; +}; + +struct SSBORow +{ + float3x4 row_major0; + float3x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp new file mode 100644 index 0000000000..adb99bddf5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x3 col_major0; + float4x3 col_major1; +}; + +struct SSBORow +{ + float3x4 row_major0; + float3x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x3 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x3 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float3(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp new file mode 100644 index 0000000000..e1b2343c7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x4 col_major0; + float4x4 col_major1; +}; + +struct SSBORow +{ + float4x4 row_major0; + float4x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp new file mode 100644 index 0000000000..e1b2343c7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x4 col_major0; + float4x4 col_major1; +}; + +struct SSBORow +{ + float4x4 row_major0; + float4x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp new file mode 100644 index 0000000000..e1b2343c7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBOCol +{ + float4x4 col_major0; + float4x4 col_major1; +}; + +struct SSBORow +{ + float4x4 row_major0; + float4x4 row_major1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void load_store_to_variable_col_major(device SSBOCol& _29) +{ + float4x4 loaded = _29.col_major0; + _29.col_major1 = loaded; +} + +static inline __attribute__((always_inline)) +void load_store_to_variable_row_major(device SSBORow& _41) +{ + float4x4 loaded = transpose(_41.row_major0); + _41.row_major0 = transpose(loaded); +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_col_major(device SSBOCol& _29) +{ + _29.col_major0 = _29.col_major1; +} + +static inline __attribute__((always_inline)) +void copy_col_major_to_row_major(device SSBOCol& _29, device SSBORow& _41) +{ + _41.row_major0 = transpose(_29.col_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_col_major(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0 = transpose(_41.row_major0); +} + +static inline __attribute__((always_inline)) +void copy_row_major_to_row_major(device SSBORow& _41) +{ + _41.row_major0 = _41.row_major1; +} + +static inline __attribute__((always_inline)) +void copy_columns(device SSBOCol& _29, device SSBORow& _41) +{ + _29.col_major0[1] = float4(_41.row_major0[0][1], _41.row_major0[1][1], _41.row_major0[2][1], _41.row_major0[3][1]); + _41.row_major0[0][1] = _29.col_major0[1].x; + _41.row_major0[1][1] = _29.col_major0[1].y; + _41.row_major0[2][1] = _29.col_major0[1].z; + _41.row_major0[3][1] = _29.col_major0[1].w; +} + +static inline __attribute__((always_inline)) +void copy_elements(device SSBOCol& _29, device SSBORow& _41) +{ + ((device float*)&_29.col_major0[0])[1u] = ((device float*)&_41.row_major0[1u])[0]; + ((device float*)&_41.row_major0[1u])[0] = ((device float*)&_29.col_major0[0])[1u]; +} + +kernel void main0(device SSBOCol& _29 [[buffer(0)]], device SSBORow& _41 [[buffer(1)]]) +{ + load_store_to_variable_col_major(_29); + load_store_to_variable_row_major(_41); + copy_col_major_to_col_major(_29); + copy_col_major_to_row_major(_29, _41); + copy_row_major_to_col_major(_29, _41); + copy_row_major_to_row_major(_41); + copy_columns(_29, _41); + copy_elements(_29, _41); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp new file mode 100644 index 0000000000..2384e3648e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float3x3 m0; + float3x3 m1; + float3 v0; + float3 v1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.v0 = _11.v1 * (_11.m1 * _11.m0); + _11.v0 = (_11.v1 * _11.m1) * _11.m0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp new file mode 100644 index 0000000000..3fb36e0561 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +typedef packed_float3 packed_float3x3[3]; + +struct SSBO +{ + packed_float3x3 m0; + packed_float3x3 m1; + packed_float3 v0; + packed_float3 v1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.v0 = (float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2])) * float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2]))) * float3(_11.v1); + _11.v0 = float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2])) * (float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2])) * float3(_11.v1)); + _11.v0 = (float3(_11.v1) * float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2]))) * float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2])); + _11.v0 = float3(_11.v1) * (float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2])) * float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp new file mode 100644 index 0000000000..40f00886dd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float2x4 m0; + float2x4 m1; + float2 v0; + float2 v1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.v0 = (float2x2(_11.m0[0].xy, _11.m0[1].xy) * float2x2(_11.m1[0].xy, _11.m1[1].xy)) * _11.v1; + _11.v0 = float2x2(_11.m0[0].xy, _11.m0[1].xy) * (float2x2(_11.m1[0].xy, _11.m1[1].xy) * _11.v1); + _11.v0 = (_11.v1 * float2x2(_11.m0[0].xy, _11.m0[1].xy)) * float2x2(_11.m1[0].xy, _11.m1[1].xy); + _11.v0 = _11.v1 * (float2x2(_11.m0[0].xy, _11.m0[1].xy) * float2x2(_11.m1[0].xy, _11.m1[1].xy)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp new file mode 100644 index 0000000000..7130c9a8e0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +typedef packed_float3 packed_rm_float3x3[3]; + +struct SSBO +{ + packed_rm_float3x3 m0; + packed_rm_float3x3 m1; + packed_float3 v0; + packed_float3 v1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.v0 = float3(_11.v1) * (float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2])) * float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2]))); + _11.v0 = (float3(_11.v1) * float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2]))) * float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2])); + _11.v0 = float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2])) * (float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2])) * float3(_11.v1)); + _11.v0 = (float3x3(float3(_11.m1[0]), float3(_11.m1[1]), float3(_11.m1[2])) * float3x3(float3(_11.m0[0]), float3(_11.m0[1]), float3(_11.m0[2]))) * float3(_11.v1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp new file mode 100644 index 0000000000..f061dd6662 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float2x4 m0; + float2x4 m1; + float2 v0; + float2 v1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.v0 = _11.v1 * (float2x2(_11.m1[0].xy, _11.m1[1].xy) * float2x2(_11.m0[0].xy, _11.m0[1].xy)); + _11.v0 = (_11.v1 * float2x2(_11.m1[0].xy, _11.m1[1].xy)) * float2x2(_11.m0[0].xy, _11.m0[1].xy); + _11.v0 = float2x2(_11.m1[0].xy, _11.m1[1].xy) * (float2x2(_11.m0[0].xy, _11.m0[1].xy) * _11.v1); + _11.v0 = (float2x2(_11.m1[0].xy, _11.m1[1].xy) * float2x2(_11.m0[0].xy, _11.m0[1].xy)) * _11.v1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/member-padding.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/member-padding.comp new file mode 100644 index 0000000000..4f653ecdd6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/member-padding.comp @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + char _m0_pad[16]; + float a; + char _m1_pad[20]; + float b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]]) +{ + _9.a = 10.0; + _9.b = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp new file mode 100644 index 0000000000..4d5ba324a0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v1[4]; + float4 v2[4]; + float3 v3[4]; + float4 v4[4]; + float4 v1_array_of_array[4][4]; + float4 v2_array_of_array[4][4]; + float3 v3_array_of_array[4][4]; + float4 v4_array_of_array[4][4]; + float4 v_unsized[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _29 [[buffer(0)]]) +{ + float loaded1 = _29.v1[1].x; + (device float&)_29.v1[2] = loaded1; + float2 loaded2 = _29.v2[1].xy; + (device float2&)_29.v2[2] = loaded2; + float3 loaded3 = _29.v3[1]; + _29.v3[2] = loaded3; + float4 loaded4 = _29.v4[1]; + _29.v4[2] = loaded4; + loaded1 = _29.v1_array_of_array[1][2].x; + (device float&)_29.v1_array_of_array[2][3] = loaded1; + loaded2 = _29.v2_array_of_array[1][2].xy; + (device float2&)_29.v2_array_of_array[2][3] = loaded2; + loaded3 = _29.v3_array_of_array[1][2]; + _29.v3_array_of_array[2][3] = loaded3; + loaded4 = _29.v4_array_of_array[1][2]; + _29.v4_array_of_array[2][3] = loaded4; + loaded1 = _29.v_unsized[1].x; + (device float&)_29.v_unsized[2] = loaded1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-alignment.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-alignment.comp new file mode 100644 index 0000000000..34647b46f4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-alignment.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + packed_float3 a; + float b; +}; + +struct SSBO +{ + float2 a; + float b; + char _m2_pad[4]; + Foo foo; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _12 [[buffer(0)]]) +{ + ((device float*)&_12.a)[0u] = 10.0; + _12.b = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp new file mode 100644 index 0000000000..587ee4ad15 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + packed_float3 a; +}; + +struct SSBOScalar +{ + Foo v[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) +{ + buffer_scalar.v[1].a[1u] = 1.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp new file mode 100644 index 0000000000..e0652b933d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing-recursive.comp @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + packed_float4 a; +}; + +struct Bar +{ + Foo a; +}; + +struct Baz +{ + Bar a; +}; + +struct SSBOScalar +{ + float v; + Baz baz; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) +{ + buffer_scalar.baz.a.a.a[3u] = 10.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp new file mode 100644 index 0000000000..a86809fee9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-packing.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + packed_float3 a; +}; + +struct Bar +{ + packed_float3 a; +}; + +struct SSBOScalar +{ + Foo foo; + Bar bar; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBOScalar& buffer_scalar [[buffer(0)]]) +{ + buffer_scalar.foo.a[0u] = 10.0; + buffer_scalar.bar.a[0u] = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp new file mode 100644 index 0000000000..c30fd070ec --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct A +{ + float v; + char _m0_final_padding[12]; +}; + +struct B +{ + float2 v; + char _m0_final_padding[8]; +}; + +struct C +{ + float3 v; +}; + +struct D +{ + float4 v; +}; + +struct E +{ + float4 a; + float2 b; + char _m0_final_padding[8]; +}; + +struct SSBO +{ + A a[2][4]; + B b[2][4]; + C c[2][4]; + D d[2][4]; + float2x4 e[2][4]; + E f[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _32 [[buffer(0)]]) +{ + _32.f[0].a = float4(2.0); + float2x2 tmp = float2x2(_32.e[0][1][0].xy, _32.e[0][1][1].xy); + (device float2&)_32.e[1][2][0] = tmp[0]; + (device float2&)_32.e[1][2][1] = tmp[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding.comp b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding.comp new file mode 100644 index 0000000000..98f039fc98 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/packing/struct-size-padding.comp @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct A +{ + float v; + char _m0_final_padding[12]; +}; + +struct B +{ + float2 v; + char _m0_final_padding[8]; +}; + +struct C +{ + float3 v; +}; + +struct D +{ + float4 v; +}; + +struct E +{ + float4 a; + float2 b; + char _m0_final_padding[8]; +}; + +struct SSBO +{ + A a[4]; + B b[4]; + C c[4]; + D d[4]; + float2x4 e[4]; + E f[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _26 [[buffer(0)]]) +{ + _26.f[0].a = float4(2.0); + float2x2 tmp = float2x2(_26.e[1][0].xy, _26.e[1][1].xy); + (device float2&)_26.e[2][0] = tmp[0]; + (device float2&)_26.e[2][1] = tmp[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc new file mode 100644 index 0000000000..aa1e46c308 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/copy-tess-level.tesc @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _14 = spvUnsafeArray({ 1.0, 2.0 }); +constant spvUnsafeArray _21 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0 }); + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(_14[0]); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(_14[1]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_21[0]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_21[1]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(_21[2]); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(_21[3]); + spvUnsafeArray inner = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1]) }); + spvUnsafeArray outer = spvUnsafeArray({ float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]) }); + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc new file mode 100644 index 0000000000..f55e47baf0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc @@ -0,0 +1,71 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_in +{ + uint3 m_57; + ushort2 m_61; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_ClipDistance[0] = gl_in[gl_InvocationID].gl_ClipDistance[0]; + gl_out[gl_InvocationID].gl_ClipDistance[1] = gl_in[gl_InvocationID].gl_ClipDistance[1]; + gl_out[gl_InvocationID].gl_CullDistance[0] = gl_in[gl_InvocationID].gl_CullDistance[0]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc new file mode 100644 index 0000000000..c76da101bc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +static inline __attribute__((always_inline)) +void store_tess_level_in_func(device half (&gl_TessLevelInner)[2], device half (&gl_TessLevelOuter)[4]) +{ + gl_TessLevelInner[0] = half(1.0); + gl_TessLevelInner[1] = half(2.0); + gl_TessLevelOuter[0] = half(3.0); + gl_TessLevelOuter[1] = half(4.0); + gl_TessLevelOuter[2] = half(5.0); + gl_TessLevelOuter[3] = half(6.0); +} + +static inline __attribute__((always_inline)) +float load_tess_level_in_func(device half (&gl_TessLevelInner)[2], device half (&gl_TessLevelOuter)[4]) +{ + return float(gl_TessLevelInner[0]) + float(gl_TessLevelOuter[1]); +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + store_tess_level_in_func(spvTessLevel[gl_PrimitiveID].insideTessellationFactor, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor); + float v = load_tess_level_in_func(spvTessLevel[gl_PrimitiveID].insideTessellationFactor, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor); + gl_out[gl_InvocationID].gl_Position = float4(v); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese b/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese new file mode 100644 index 0000000000..15f04e7371 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese @@ -0,0 +1,80 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 FragColors [[attribute(2)]]; + float4 gl_Position [[attribute(1)]]; +}; + +struct main0_patchIn +{ + float4 FragColor [[attribute(0)]]; + float4 gl_TessLevelOuter [[attribute(3)]]; + float2 gl_TessLevelInner [[attribute(4)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], uint gl_PrimitiveID [[patch_id]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + out.gl_Position = (((((float4(1.0) + patchIn.FragColor) + patchIn.gl_in[0].FragColors) + patchIn.gl_in[1].FragColors) + float4(gl_TessLevelInner[0])) + float4(gl_TessLevelOuter[int(gl_PrimitiveID) & 1])) + patchIn.gl_in[0].gl_Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese b/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese new file mode 100644 index 0000000000..09c5cd7502 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; + float gl_ClipDistance_0 [[attribute(1)]]; + float gl_ClipDistance_1 [[attribute(2)]]; + float gl_CullDistance_0 [[attribute(3)]]; + float gl_CullDistance_1 [[attribute(4)]]; + float gl_CullDistance_2 [[attribute(5)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position.x = patchIn.gl_in[0].gl_ClipDistance_0; + out.gl_Position.y = patchIn.gl_in[1].gl_CullDistance_0; + out.gl_Position.z = patchIn.gl_in[0].gl_ClipDistance_1; + out.gl_Position.w = patchIn.gl_in[1].gl_CullDistance_1; + out.gl_Position += patchIn.gl_in[0].gl_Position; + out.gl_Position += patchIn.gl_in[1].gl_Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/cull-distance.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/cull-distance.for-tess.vert new file mode 100644 index 0000000000..5c2311d741 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/cull-distance.for-tess.vert @@ -0,0 +1,62 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position; + spvUnsafeArray gl_CullDistance; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_CullDistance[0] = 1.0; + out.gl_CullDistance[1] = 3.0; + out.gl_Position = float4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert new file mode 100644 index 0000000000..190ad95c26 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert @@ -0,0 +1,200 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct attr_desc +{ + int type; + int attribute_size; + int starting_offset; + int stride; + int swap_bytes; + int is_volatile; +}; + +struct VertexBuffer +{ + float4x4 scale_offset_mat; + uint vertex_base_index; + int4 input_attributes[16]; +}; + +struct VertexConstantsBuffer +{ + float4 vc[16]; +}; + +struct main0_out +{ + float4 tc0 [[user(locn0)]]; + float4 back_color [[user(locn10)]]; + float4 gl_Position [[position]]; +}; + +static inline __attribute__((always_inline)) +attr_desc fetch_desc(thread const int& location, constant VertexBuffer& _227) +{ + int attribute_flags = _227.input_attributes[location].w; + attr_desc result; + result.type = _227.input_attributes[location].x; + result.attribute_size = _227.input_attributes[location].y; + result.starting_offset = _227.input_attributes[location].z; + result.stride = attribute_flags & 255; + result.swap_bytes = (attribute_flags >> 8) & 1; + result.is_volatile = (attribute_flags >> 9) & 1; + return result; +} + +static inline __attribute__((always_inline)) +uint get_bits(thread const uint4& v, thread const int& swap) +{ + if (swap != 0) + { + return ((v.w | (v.z << uint(8))) | (v.y << uint(16))) | (v.x << uint(24)); + } + return ((v.x | (v.y << uint(8))) | (v.z << uint(16))) | (v.w << uint(24)); +} + +static inline __attribute__((always_inline)) +float4 fetch_attr(thread const attr_desc& desc, thread const int& vertex_id, texture2d input_stream) +{ + float4 result = float4(0.0, 0.0, 0.0, 1.0); + bool reverse_order = false; + int first_byte = (vertex_id * desc.stride) + desc.starting_offset; + uint4 tmp; + for (int n = 0; n < 4; n++) + { + if (n == desc.attribute_size) + { + break; + } + switch (desc.type) + { + case 0: + { + int _131 = first_byte; + first_byte = _131 + 1; + tmp.x = input_stream.read(spvTexelBufferCoord(_131)).x; + int _138 = first_byte; + first_byte = _138 + 1; + tmp.y = input_stream.read(spvTexelBufferCoord(_138)).x; + uint4 param = tmp; + int param_1 = desc.swap_bytes; + result[n] = float(get_bits(param, param_1)); + break; + } + case 1: + { + int _156 = first_byte; + first_byte = _156 + 1; + tmp.x = input_stream.read(spvTexelBufferCoord(_156)).x; + int _163 = first_byte; + first_byte = _163 + 1; + tmp.y = input_stream.read(spvTexelBufferCoord(_163)).x; + int _170 = first_byte; + first_byte = _170 + 1; + tmp.z = input_stream.read(spvTexelBufferCoord(_170)).x; + int _177 = first_byte; + first_byte = _177 + 1; + tmp.w = input_stream.read(spvTexelBufferCoord(_177)).x; + uint4 param_2 = tmp; + int param_3 = desc.swap_bytes; + result[n] = as_type(get_bits(param_2, param_3)); + break; + } + case 2: + { + int _195 = first_byte; + first_byte = _195 + 1; + result[n] = float(input_stream.read(spvTexelBufferCoord(_195)).x); + reverse_order = desc.swap_bytes != 0; + break; + } + } + } + float4 _210; + if (reverse_order) + { + _210 = result.wzyx; + } + else + { + _210 = result; + } + return _210; +} + +static inline __attribute__((always_inline)) +float4 read_location(thread const int& location, constant VertexBuffer& _227, thread uint& gl_VertexIndex, texture2d buff_in_2, texture2d buff_in_1) +{ + int param = location; + attr_desc desc = fetch_desc(param, _227); + int vertex_id = int(gl_VertexIndex) - int(_227.vertex_base_index); + if (desc.is_volatile != 0) + { + attr_desc param_1 = desc; + int param_2 = vertex_id; + return fetch_attr(param_1, param_2, buff_in_2); + } + else + { + attr_desc param_3 = desc; + int param_4 = vertex_id; + return fetch_attr(param_3, param_4, buff_in_1); + } +} + +static inline __attribute__((always_inline)) +void vs_adjust(thread float4& dst_reg0, thread float4& dst_reg1, thread float4& dst_reg7, constant VertexBuffer& _227, thread uint& gl_VertexIndex, texture2d buff_in_2, texture2d buff_in_1, constant VertexConstantsBuffer& _309) +{ + int param = 3; + float4 in_diff_color = read_location(param, _227, gl_VertexIndex, buff_in_2, buff_in_1); + int param_1 = 0; + float4 in_pos = read_location(param_1, _227, gl_VertexIndex, buff_in_2, buff_in_1); + int param_2 = 8; + float4 in_tc0 = read_location(param_2, _227, gl_VertexIndex, buff_in_2, buff_in_1); + dst_reg1 = in_diff_color * _309.vc[13]; + float4 tmp0; + tmp0.x = float4(dot(float4(in_pos.xyz, 1.0), _309.vc[4])).x; + tmp0.y = float4(dot(float4(in_pos.xyz, 1.0), _309.vc[5])).y; + tmp0.z = float4(dot(float4(in_pos.xyz, 1.0), _309.vc[6])).z; + float4 tmp1; + tmp1.x = in_tc0.xy.x; + tmp1.y = in_tc0.xy.y; + tmp1.z = _309.vc[15].x; + dst_reg7.y = float4(dot(float4(tmp1.xyz, 1.0), _309.vc[8])).y; + dst_reg7.x = float4(dot(float4(tmp1.xyz, 1.0), _309.vc[7])).x; + dst_reg0.y = float4(dot(float4(tmp0.xyz, 1.0), _309.vc[1])).y; + dst_reg0.x = float4(dot(float4(tmp0.xyz, 1.0), _309.vc[0])).x; +} + +vertex main0_out main0(constant VertexBuffer& _227 [[buffer(0)]], constant VertexConstantsBuffer& _309 [[buffer(1)]], texture2d buff_in_2 [[texture(0)]], texture2d buff_in_1 [[texture(1)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + float4 dst_reg0 = float4(0.0, 0.0, 0.0, 1.0); + float4 dst_reg1 = float4(0.0); + float4 dst_reg7 = float4(0.0); + float4 param = dst_reg0; + float4 param_1 = dst_reg1; + float4 param_2 = dst_reg7; + vs_adjust(param, param_1, param_2, _227, gl_VertexIndex, buff_in_2, buff_in_1, _309); + dst_reg0 = param; + dst_reg1 = param_1; + dst_reg7 = param_2; + out.gl_Position = dst_reg0; + out.back_color = dst_reg1; + out.tc0 = dst_reg7; + out.gl_Position *= _227.scale_offset_mat; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/layer.msl11.invalid.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/layer.msl11.invalid.vert new file mode 100644 index 0000000000..b6f39dca3e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/layer.msl11.invalid.vert @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +struct main0_in +{ + float4 coord [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.coord; + out.gl_Layer = uint(int(in.coord.z)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/modf-storage-class.capture.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/modf-storage-class.capture.vert new file mode 100644 index 0000000000..87f4e95517 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/modf-storage-class.capture.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 f [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 f2 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]]) +{ + device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvIndirectParams[0] + gl_VertexIndex - gl_BaseVertex]; + float4 _35; + float4 _21 = modf(in.f2, _35); + out.f = _35; + out.gl_Position = _21; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert new file mode 100644 index 0000000000..9cdf12439a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert @@ -0,0 +1,157 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +constant float4 _68[4] = { float4(0.0), float4(1.0), float4(2.0), float4(3.0) }; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + int Index1 [[attribute(0)]]; + int Index2 [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +float4 consume_constant_arrays2(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) +{ + float4 indexable[4]; + spvArrayCopyFromStackToStack1(indexable, positions); + float4 indexable_1[4]; + spvArrayCopyFromStackToStack1(indexable_1, positions2); + return indexable[Index1] + indexable_1[Index2]; +} + +static inline __attribute__((always_inline)) +float4 consume_constant_arrays(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) +{ + return consume_constant_arrays2(positions, positions2, Index1, Index2); +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + float4 _68_array_copy[4] = { float4(0.0), float4(1.0), float4(2.0), float4(3.0) }; + main0_out out = {}; + float4 LUT2[4]; + LUT2[0] = float4(10.0); + LUT2[1] = float4(11.0); + LUT2[2] = float4(12.0); + LUT2[3] = float4(13.0); + out.gl_Position = consume_constant_arrays(_68_array_copy, LUT2, in.Index1, in.Index2); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..f7d0453ae1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _68 = spvUnsafeArray({ float4(0.0), float4(1.0), float4(2.0), float4(3.0) }); + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + int Index1 [[attribute(0)]]; + int Index2 [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +float4 consume_constant_arrays2(spvUnsafeArray positions, spvUnsafeArray positions2, thread int& Index1, thread int& Index2) +{ + spvUnsafeArray indexable = positions; + spvUnsafeArray indexable_1 = positions2; + return indexable[Index1] + indexable_1[Index2]; +} + +static inline __attribute__((always_inline)) +float4 consume_constant_arrays(spvUnsafeArray positions, spvUnsafeArray positions2, thread int& Index1, thread int& Index2) +{ + return consume_constant_arrays2(positions, positions2, Index1, Index2); +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray LUT2; + LUT2[0] = float4(10.0); + LUT2[1] = float4(11.0); + LUT2[2] = float4(12.0); + LUT2[3] = float4(13.0); + out.gl_Position = consume_constant_arrays(_68, LUT2, in.Index1, in.Index2); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert new file mode 100644 index 0000000000..f8209ae6fc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 Pos [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert new file mode 100644 index 0000000000..9e024c2095 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +vertex void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert new file mode 100644 index 0000000000..e5316c072a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_ViewportIndex [[viewport_array_index]]; +}; + +struct main0_in +{ + float4 coord [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.coord; + out.gl_ViewportIndex = uint(int(in.coord.z)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag b/third_party/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag new file mode 100644 index 0000000000..48dad41780 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag @@ -0,0 +1,204 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +// Wrapper function that swizzles texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherSwizzle(const thread Tex& t, sampler s, uint sw, component c, Ts... params) METAL_CONST_ARG(c) +{ + if (sw) + { + switch (spvSwizzle((sw >> (uint(c) * 8)) & 0xFF)) + { + case spvSwizzle::none: + break; + case spvSwizzle::zero: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + case spvSwizzle::red: + return t.gather(s, spvForward(params)..., component::x); + case spvSwizzle::green: + return t.gather(s, spvForward(params)..., component::y); + case spvSwizzle::blue: + return t.gather(s, spvForward(params)..., component::z); + case spvSwizzle::alpha: + return t.gather(s, spvForward(params)..., component::w); + } + } + switch (c) + { + case component::x: + return t.gather(s, spvForward(params)..., component::x); + case component::y: + return t.gather(s, spvForward(params)..., component::y); + case component::z: + return t.gather(s, spvForward(params)..., component::z); + case component::w: + return t.gather(s, spvForward(params)..., component::w); + } +} + +// Wrapper function that swizzles depth texture gathers. +template class Tex, typename... Ts> +inline vec spvGatherCompareSwizzle(const thread Tex& t, sampler s, uint sw, Ts... params) +{ + if (sw) + { + switch (spvSwizzle(sw & 0xFF)) + { + case spvSwizzle::none: + case spvSwizzle::red: + break; + case spvSwizzle::zero: + case spvSwizzle::green: + case spvSwizzle::blue: + case spvSwizzle::alpha: + return vec(0, 0, 0, 0); + case spvSwizzle::one: + return vec(1, 1, 1, 1); + } + } + return t.gather_compare(s, spvForward(params)...); +} + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 do_samples(texture1d t1, sampler t1Smplr, constant uint& t1Swzl, texture2d t2, constant uint& t2Swzl, texture3d t3, sampler t3Smplr, constant uint& t3Swzl, texturecube tc, constant uint& tcSwzl, texture2d_array t2a, sampler t2aSmplr, constant uint& t2aSwzl, texturecube_array tca, sampler tcaSmplr, constant uint& tcaSwzl, texture2d tb, depth2d d2, sampler d2Smplr, constant uint& d2Swzl, depthcube dc, sampler dcSmplr, constant uint& dcSwzl, depth2d_array d2a, constant uint& d2aSwzl, depthcube_array dca, sampler dcaSmplr, constant uint& dcaSwzl, sampler defaultSampler, sampler shadowSampler) +{ + float4 c = spvTextureSwizzle(t1.sample(t1Smplr, 0.0), t1Swzl); + c = spvTextureSwizzle(t2.sample(defaultSampler, float2(0.0)), t2Swzl); + c = spvTextureSwizzle(t3.sample(t3Smplr, float3(0.0)), t3Swzl); + c = spvTextureSwizzle(tc.sample(defaultSampler, float3(0.0)), tcSwzl); + c = spvTextureSwizzle(t2a.sample(t2aSmplr, float3(0.0).xy, uint(rint(float3(0.0).z))), t2aSwzl); + c = spvTextureSwizzle(tca.sample(tcaSmplr, float4(0.0).xyz, uint(rint(float4(0.0).w))), tcaSwzl); + c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, float3(0.0, 0.0, 1.0).xy, 1.0), d2Swzl); + c.x = spvTextureSwizzle(dc.sample_compare(dcSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz, 1.0), dcSwzl); + c.x = spvTextureSwizzle(d2a.sample_compare(shadowSampler, float4(0.0, 0.0, 0.0, 1.0).xy, uint(rint(float4(0.0, 0.0, 0.0, 1.0).z)), 1.0), d2aSwzl); + c.x = spvTextureSwizzle(dca.sample_compare(dcaSmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0), dcaSwzl); + c = spvTextureSwizzle(t1.sample(t1Smplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), t1Swzl); + c = spvTextureSwizzle(t2.sample(defaultSampler, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z), t2Swzl); + c = spvTextureSwizzle(t3.sample(t3Smplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), t3Swzl); + float4 _119 = float4(0.0, 0.0, 1.0, 1.0); + _119.z = 1.0; + c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _119.xy / _119.z, 1.0 / _119.z), d2Swzl); + c = spvTextureSwizzle(t1.sample(t1Smplr, 0.0), t1Swzl); + c = spvTextureSwizzle(t2.sample(defaultSampler, float2(0.0), level(0.0)), t2Swzl); + c = spvTextureSwizzle(t3.sample(t3Smplr, float3(0.0), level(0.0)), t3Swzl); + c = spvTextureSwizzle(tc.sample(defaultSampler, float3(0.0), level(0.0)), tcSwzl); + c = spvTextureSwizzle(t2a.sample(t2aSmplr, float3(0.0).xy, uint(rint(float3(0.0).z)), level(0.0)), t2aSwzl); + c = spvTextureSwizzle(tca.sample(tcaSmplr, float4(0.0).xyz, uint(rint(float4(0.0).w)), level(0.0)), tcaSwzl); + c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, float3(0.0, 0.0, 1.0).xy, 1.0, level(0.0)), d2Swzl); + c = spvTextureSwizzle(t1.sample(t1Smplr, float2(0.0, 1.0).x / float2(0.0, 1.0).y), t1Swzl); + c = spvTextureSwizzle(t2.sample(defaultSampler, float3(0.0, 0.0, 1.0).xy / float3(0.0, 0.0, 1.0).z, level(0.0)), t2Swzl); + c = spvTextureSwizzle(t3.sample(t3Smplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), t3Swzl); + float4 _153 = float4(0.0, 0.0, 1.0, 1.0); + _153.z = 1.0; + c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _153.xy / _153.z, 1.0 / _153.z, level(0.0)), d2Swzl); + c = spvTextureSwizzle(t1.read(uint(0)), t1Swzl); + c = spvTextureSwizzle(t2.read(uint2(int2(0)), 0), t2Swzl); + c = spvTextureSwizzle(t3.read(uint3(int3(0)), 0), t3Swzl); + c = spvTextureSwizzle(t2a.read(uint2(int3(0).xy), uint(int3(0).z), 0), t2aSwzl); + c = tb.read(spvTexelBufferCoord(0)); + c = spvGatherSwizzle(t2, defaultSampler, t2Swzl, component::x, float2(0.0), int2(0)); + c = spvGatherSwizzle(tc, defaultSampler, tcSwzl, component::y, float3(0.0)); + c = spvGatherSwizzle(t2a, t2aSmplr, t2aSwzl, component::z, float3(0.0).xy, uint(rint(float3(0.0).z)), int2(0)); + c = spvGatherSwizzle(tca, tcaSmplr, tcaSwzl, component::w, float4(0.0).xyz, uint(rint(float4(0.0).w))); + c = spvGatherCompareSwizzle(d2, d2Smplr, d2Swzl, float2(0.0), 1.0); + c = spvGatherCompareSwizzle(dc, dcSmplr, dcSwzl, float3(0.0), 1.0); + c = spvGatherCompareSwizzle(d2a, shadowSampler, d2aSwzl, float3(0.0).xy, uint(rint(float3(0.0).z)), 1.0); + c = spvGatherCompareSwizzle(dca, dcaSmplr, dcaSwzl, float4(0.0).xyz, uint(rint(float4(0.0).w)), 1.0); + return c; +} + +fragment main0_out main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture1d tex1d [[texture(0)]], texture2d tex2d [[texture(1)]], texture3d tex3d [[texture(2)]], texturecube texCube [[texture(3)]], texture2d_array tex2dArray [[texture(4)]], texturecube_array texCubeArray [[texture(5)]], texture2d texBuffer [[texture(6)]], depth2d depth2d [[texture(7)]], depthcube depthCube [[texture(8)]], depth2d_array depth2dArray [[texture(9)]], depthcube_array depthCubeArray [[texture(10)]], sampler defaultSampler [[sampler(0)]], sampler shadowSampler [[sampler(1)]], sampler tex1dSmplr [[sampler(2)]], sampler tex3dSmplr [[sampler(3)]], sampler tex2dArraySmplr [[sampler(4)]], sampler texCubeArraySmplr [[sampler(5)]], sampler depth2dSmplr [[sampler(6)]], sampler depthCubeSmplr [[sampler(7)]], sampler depthCubeArraySmplr [[sampler(8)]]) +{ + main0_out out = {}; + constant uint& tex1dSwzl = spvSwizzleConstants[0]; + constant uint& tex2dSwzl = spvSwizzleConstants[1]; + constant uint& tex3dSwzl = spvSwizzleConstants[2]; + constant uint& texCubeSwzl = spvSwizzleConstants[3]; + constant uint& tex2dArraySwzl = spvSwizzleConstants[4]; + constant uint& texCubeArraySwzl = spvSwizzleConstants[5]; + constant uint& depth2dSwzl = spvSwizzleConstants[7]; + constant uint& depthCubeSwzl = spvSwizzleConstants[8]; + constant uint& depth2dArraySwzl = spvSwizzleConstants[9]; + constant uint& depthCubeArraySwzl = spvSwizzleConstants[10]; + out.fragColor = do_samples(tex1d, tex1dSmplr, tex1dSwzl, tex2d, tex2dSwzl, tex3d, tex3dSmplr, tex3dSwzl, texCube, texCubeSwzl, tex2dArray, tex2dArraySmplr, tex2dArraySwzl, texCubeArray, texCubeArraySmplr, texCubeArraySwzl, texBuffer, depth2d, depth2dSmplr, depth2dSwzl, depthCube, depthCubeSmplr, depthCubeSwzl, depth2dArray, depth2dArraySwzl, depthCubeArray, depthCubeArraySmplr, depthCubeArraySwzl, defaultSampler, shadowSampler); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/amd/shader_trinary_minmax.msl21.comp b/third_party/spirv-cross/reference/shaders-msl/amd/shader_trinary_minmax.msl21.comp new file mode 100644 index 0000000000..1440471964 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/amd/shader_trinary_minmax.msl21.comp @@ -0,0 +1,14 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +kernel void main0() +{ + int t11 = min3(0, 3, 2); + int t12 = max3(0, 3, 2); + int t13 = median3(0, 3, 2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..272337fc12 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct u0_counters +{ + uint c; +}; + +kernel void main0(device u0_counters& u0_counter [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _29 = atomic_fetch_sub_explicit((device atomic_uint*)&u0_counter.c, 1, memory_order_relaxed); + float4 r0; + r0.x = as_type(_29); + u0.write(uint4(uint(int(gl_GlobalInvocationID.x))), spvTexelBufferCoord(((uint(as_type(r0.x)) * 1u) + (uint(0) >> 2u)))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..4518248b89 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct u0_counters +{ + uint c; +}; + +kernel void main0(device u0_counters& u0_counter [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _29 = atomic_fetch_add_explicit((device atomic_uint*)&u0_counter.c, 1, memory_order_relaxed); + float4 r0; + r0.x = as_type(_29); + u0.write(uint4(uint(int(gl_GlobalInvocationID.x))), spvTexelBufferCoord(((uint(as_type(r0.x)) * 1u) + (uint(0) >> 2u)))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..cbbf27d65d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& __restrict _5 [[buffer(0)]], device _4& __restrict _6 [[buffer(1)]]) +{ + _6._m0 = _5._m1 + uint4(_5._m0); + _6._m0 = uint4(_5._m0) + _5._m1; + _6._m0 = _5._m1 + _5._m1; + _6._m0 = uint4(_5._m0 + _5._m0); + _6._m1 = int4(_5._m1 + _5._m1); + _6._m1 = _5._m0 + _5._m0; + _6._m1 = int4(_5._m1) + _5._m0; + _6._m1 = _5._m0 + int4(_5._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..a55d8916df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& __restrict _5 [[buffer(0)]], device _4& __restrict _6 [[buffer(1)]]) +{ + _6._m0 = uint4(int4(_5._m1) < _5._m0); + _6._m0 = uint4(int4(_5._m1) <= _5._m0); + _6._m0 = uint4(_5._m1 < uint4(_5._m0)); + _6._m0 = uint4(_5._m1 <= uint4(_5._m0)); + _6._m0 = uint4(int4(_5._m1) > _5._m0); + _6._m0 = uint4(int4(_5._m1) >= _5._m0); + _6._m0 = uint4(_5._m1 > uint4(_5._m0)); + _6._m0 = uint4(_5._m1 >= uint4(_5._m0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..4176830588 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = uint4(int4(_23) >> _22); + _6._m0 = uint4(_22 >> int4(_23)); + _6._m0 = uint4(int4(_23) >> int4(_23)); + _6._m0 = uint4(_22 >> _22); + _6._m1 = int4(_23) >> int4(_23); + _6._m1 = _22 >> _22; + _6._m1 = int4(_23) >> _22; + _6._m1 = _22 >> int4(_23); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..6b80dff310 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = uint4(int4(_23) / _22); + _6._m0 = uint4(_22 / int4(_23)); + _6._m0 = uint4(int4(_23) / int4(_23)); + _6._m0 = uint4(_22 / _22); + _6._m1 = int4(_23) / int4(_23); + _6._m1 = _22 / _22; + _6._m1 = int4(_23) / _22; + _6._m1 = _22 / int4(_23); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..1dfca39181 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct _3 +{ + int4 _m0; + uint4 _m1; +}; + +struct _4 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]]) +{ + int4 _22 = _5._m0; + uint4 _23 = _5._m1; + _6._m0 = _23 >> uint4(_22); + _6._m0 = uint4(_22) >> _23; + _6._m0 = _23 >> _23; + _6._m0 = uint4(_22) >> uint4(_22); + _6._m1 = int4(_23 >> _23); + _6._m1 = int4(uint4(_22) >> uint4(_22)); + _6._m1 = int4(_23 >> uint4(_22)); + _6._m1 = int4(uint4(_22) >> _23); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..6dcc14ea8d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,46 @@ +#include +#include + +using namespace metal; + +struct A +{ + int a; + int b; +}; + +struct A_1 +{ + A Data[1]; +}; + +struct A_2 +{ + int a; + int b; + char _m0_final_padding[8]; +}; + +struct A_3 +{ + A_2 Data[1024]; +}; + +struct B +{ + A Data[1]; +}; + +struct B_1 +{ + A_2 Data[1024]; +}; + +kernel void main0(device A_1& C1 [[buffer(0)]], constant A_3& C2 [[buffer(1)]], device B& C3 [[buffer(2)]], constant B_1& C4 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + C1.Data[gl_GlobalInvocationID.x].a = C2.Data[gl_GlobalInvocationID.x].a; + C1.Data[gl_GlobalInvocationID.x].b = C2.Data[gl_GlobalInvocationID.x].b; + C3.Data[gl_GlobalInvocationID.x].a = C4.Data[gl_GlobalInvocationID.x].a; + C3.Data[gl_GlobalInvocationID.x].b = C4.Data[gl_GlobalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp new file mode 100644 index 0000000000..ac78a65196 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct cb5_struct +{ + float4 _m0[5]; +}; + +kernel void main0(constant cb5_struct& cb0_5 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + float4 r0; + r0.x = as_type(int(gl_LocalInvocationID.x) << 4); + r0.y = as_type(int(gl_LocalInvocationID.x)); + uint _44 = as_type(r0.x) >> 2u; + uint4 _51 = as_type(cb0_5._m0[uint(as_type(r0.y)) + 1u]); + u0.write(_51.xxxx, spvTexelBufferCoord(_44)); + u0.write(_51.yyyy, spvTexelBufferCoord((_44 + 1u))); + u0.write(_51.zzzz, spvTexelBufferCoord((_44 + 2u))); + u0.write(_51.wwww, spvTexelBufferCoord((_44 + 3u))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp new file mode 100644 index 0000000000..89e8d83ea7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp @@ -0,0 +1,24 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct cb +{ + float value; +}; + +kernel void main0(constant cb& _6 [[buffer(0)]], texture2d _buffer [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + _buffer.write(float4(_6.value), spvTexelBufferCoord(((32u * gl_WorkGroupID.x) + gl_LocalInvocationIndex))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp new file mode 100644 index 0000000000..986e909663 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct _19 +{ +}; +struct _5 +{ + int _m0; + _19 _m1; + char _m2_pad[4]; + _19 _m2; + char _m3_pad[4]; + int _m3; +}; + +kernel void main0(device _5& _3 [[buffer(0)]], device _5& _4 [[buffer(1)]]) +{ + _4 = _3; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp new file mode 100644 index 0000000000..4bcfeb21ab --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct _19 +{ +}; +struct _5 +{ + int _m0; + char _m1_pad[12]; + _19 _m1; + char _m2_pad[16]; + _19 _m2; + char _m3_pad[16]; + int _m3; +}; + +kernel void main0(constant _5& _3 [[buffer(0)]], device _5& _4 [[buffer(1)]]) +{ + _4 = _3; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/duplicate-spec-id.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/duplicate-spec-id.asm.comp new file mode 100644 index 0000000000..90bebdd6fc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/duplicate-spec-id.asm.comp @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct StorageBuffer +{ + float values[1]; +}; + +constant int foo_tmp [[function_constant(0)]]; +constant int foo = is_function_constant_defined(foo_tmp) ? foo_tmp : 1; +constant float bar = is_function_constant_defined(foo_tmp) ? as_type(foo_tmp) : 2.0; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device StorageBuffer& ssbo [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + ssbo.values[gl_LocalInvocationIndex] = float(foo) + bar; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..ec1b2a2da2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct ssbo +{ + uint _data[1]; +}; + +static inline __attribute__((always_inline)) +void Load(thread const uint& size, const device ssbo& ssbo_1) +{ + int byteAddrTemp = int(size >> uint(2)); + uint4 data = uint4(ssbo_1._data[byteAddrTemp], ssbo_1._data[byteAddrTemp + 1], ssbo_1._data[byteAddrTemp + 2], ssbo_1._data[byteAddrTemp + 3]); +} + +static inline __attribute__((always_inline)) +void _main(thread const uint3& id, const device ssbo& ssbo_1) +{ + uint param = 4u; + Load(param, ssbo_1); +} + +kernel void main0(const device ssbo& ssbo_1 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint3 id = gl_GlobalInvocationID; + uint3 param = id; + _main(param, ssbo_1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp new file mode 100644 index 0000000000..536556391e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp @@ -0,0 +1,22 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +void _main(thread const uint3& id, texture2d TargetTexture) +{ + float2 loaded = TargetTexture.read(uint2(id.xy)).xy; + float2 storeTemp = loaded + float2(1.0); + TargetTexture.write(storeTemp.xyyy, uint2((id.xy + uint2(1u)))); +} + +kernel void main0(texture2d TargetTexture [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint3 id = gl_WorkGroupID; + uint3 param = id; + _main(param, TargetTexture); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..3584373379 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct _6 +{ + int4 _m0; + uint4 _m1; +}; + +struct _7 +{ + uint4 _m0; + int4 _m1; +}; + +kernel void main0(device _6& __restrict _8 [[buffer(0)]], device _7& __restrict _9 [[buffer(1)]]) +{ + _9._m0 = _8._m1 + uint4(_8._m0); + _9._m0 = uint4(_8._m0) + _8._m1; + _9._m0 = _8._m1 + _8._m1; + _9._m0 = uint4(_8._m0 + _8._m0); + _9._m1 = int4(_8._m1 + _8._m1); + _9._m1 = _8._m0 + _8._m0; + _9._m1 = int4(_8._m1) + _8._m0; + _9._m1 = _8._m0 + int4(_8._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp new file mode 100644 index 0000000000..42c13f7a4d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp @@ -0,0 +1,111 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _29 +{ + spvUnsafeArray, 3> _m0; +}; + +struct _7 +{ + int _m0[1]; +}; + +constant int3 _32 = {}; +constant int _3_tmp [[function_constant(0)]]; +constant int _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 0; +constant int _4_tmp [[function_constant(1)]]; +constant int _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 0; +constant int _5_tmp [[function_constant(2)]]; +constant int _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 0; +constant spvUnsafeArray _36 = spvUnsafeArray({ _3, 0, 0 }); +constant spvUnsafeArray _37 = spvUnsafeArray({ _3, _4, 0 }); +constant spvUnsafeArray _38 = spvUnsafeArray({ _3, _4, _5 }); +constant spvUnsafeArray _39 = spvUnsafeArray({ _4, 0, 0 }); +constant spvUnsafeArray _40 = spvUnsafeArray({ _4, _5, 0 }); +constant spvUnsafeArray _41 = spvUnsafeArray({ _4, _5, _3 }); +constant spvUnsafeArray _42 = spvUnsafeArray({ _5, 0, 0 }); +constant spvUnsafeArray _43 = spvUnsafeArray({ _5, _3, 0 }); +constant spvUnsafeArray _44 = spvUnsafeArray({ _5, _3, _4 }); +constant spvUnsafeArray, 3> _45 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }) }); +constant spvUnsafeArray, 3> _46 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ 0, 0, 0 }) }); +constant spvUnsafeArray, 3> _47 = spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ _5, _3, _4 }) }); +constant _29 _48 = _29{ spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _3 }), spvUnsafeArray({ _5, _3, _4 }) }) }; +constant _29 _49 = _29{ spvUnsafeArray, 3>({ spvUnsafeArray({ _3, _4, _5 }), spvUnsafeArray({ _4, _5, _5 }), spvUnsafeArray({ _5, _3, _4 }) }) }; +constant int _50 = _48._m0[0][0]; +constant int _51 = _48._m0[1][0]; +constant int _52 = _48._m0[0][1]; +constant int _53 = _48._m0[2][2]; +constant int _54 = _48._m0[2][0]; +constant int _55 = _48._m0[1][1]; +constant bool _56 = (_50 == _51); +constant bool _57 = (_52 == _53); +constant bool _58 = (_54 == _55); +constant int _59 = int(_56); +constant int _60 = int(_57); +constant int _61 = _58 ? 2 : 1; +constant int3 _62 = int3(_3, 0, 0); +constant int3 _63 = int3(0, _4, 0); +constant int3 _64 = int3(0, 0, _5); +constant int3 _65 = int3(_62.x, 0, _62.z); +constant int3 _66 = int3(0, _63.y, _63.x); +constant int3 _67 = int3(_64.z, 0, _64.z); +constant int3 _68 = int3(_65.y, _65.x, _66.y); +constant int3 _69 = int3(_67.z, _68.y, _68.z); +constant int _70 = _69.x; +constant int _71 = _69.y; +constant int _72 = _69.z; +constant int _73 = (_70 - _71); +constant int _74 = (_73 * _72); + +constant spvUnsafeArray _33 = spvUnsafeArray({ 0, 0, 0 }); +constant spvUnsafeArray, 3> _34 = spvUnsafeArray, 3>({ spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }), spvUnsafeArray({ 0, 0, 0 }) }); + +kernel void main0(device _7& _8 [[buffer(0)]], device _7& _9 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _9._m0[gl_GlobalInvocationID.x] = _8._m0[gl_GlobalInvocationID.x] + ((((1 - _59) * _60) * (_61 - 1)) * _74); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/quantize.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..672c2b2088 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/quantize.asm.comp @@ -0,0 +1,34 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct SpvHalfTypeSelector; +template <> struct SpvHalfTypeSelector { public: using H = half; }; +template struct SpvHalfTypeSelector> { using H = vec; }; +template::H> +[[clang::optnone]] F spvQuantizeToF16(F fval) +{ + H hval = H(fval); + hval = select(copysign(H(0), hval), hval, isnormal(hval) || isinf(hval) || isnan(hval)); + return F(hval); +} + +struct SSBO0 +{ + float scalar; + float2 vec2_val; + float3 vec3_val; + float4 vec4_val; +}; + +kernel void main0(device SSBO0& _4 [[buffer(0)]]) +{ + _4.scalar = spvQuantizeToF16(_4.scalar); + _4.vec2_val = spvQuantizeToF16(_4.vec2_val); + _4.vec3_val = spvQuantizeToF16(_4.vec3_val); + _4.vec4_val = spvQuantizeToF16(_4.vec4_val); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/relaxed-block-layout.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/relaxed-block-layout.asm.comp new file mode 100644 index 0000000000..6728a4e2d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/relaxed-block-layout.asm.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct foo +{ + uint bar; + packed_float3 baz; + uchar quux; + packed_uchar4 blah; + packed_half2 wibble; +}; + +kernel void main0(device foo& _8 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]]) +{ + _8.bar = gl_LocalInvocationID.x; + _8.baz = float3(gl_GlobalInvocationID); + _8.blah = uchar4(uint4(uint4(uchar4(_8.blah)).xyz + gl_WorkGroupID, 0u)); + _8.wibble = half2(float2(half2(_8.wibble)) * float2(gl_NumWorkGroups.xy)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..1e2880f4e8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; +}; + +constant uint _5_tmp [[function_constant(10)]]; +constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u; +constant uint _6_tmp [[function_constant(12)]]; +constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_5, 20u, _6); + +kernel void main0(device SSBO& _4 [[buffer(0)]]) +{ + _4.a += 1.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp new file mode 100644 index 0000000000..fa7d269821 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp @@ -0,0 +1,24 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct bufA +{ + uint _data[1]; +}; + +static inline __attribute__((always_inline)) +void _main(device bufA& bufA_1, device bufA& bufB) +{ + bufA_1._data[0] = 0u; + bufB._data[0] = 0u; +} + +kernel void main0(device bufA& bufA_1 [[buffer(0)]], device bufA& bufB [[buffer(1)]]) +{ + _main(bufA_1, bufB); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/uint_smulextended.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/uint_smulextended.asm.comp new file mode 100644 index 0000000000..6996f7fd26 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/uint_smulextended.asm.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct _4 +{ + uint _m0[1]; +}; + +struct _20 +{ + uint _m0; + uint _m1; +}; + +kernel void main0(device _4& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]], device _4& _7 [[buffer(2)]], device _4& _8 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _20 _28; + _28._m0 = uint(int(_5._m0[gl_GlobalInvocationID.x]) * int(_6._m0[gl_GlobalInvocationID.x])); + _28._m1 = uint(mulhi(int(_5._m0[gl_GlobalInvocationID.x]), int(_6._m0[gl_GlobalInvocationID.x]))); + _7._m0[gl_GlobalInvocationID.x] = _28._m0; + _8._m0[gl_GlobalInvocationID.x] = _28._m1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..e3ded1f208 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _20 +{ + int _m0; + int _m1; +}; + +struct _5 +{ + int _m0[10]; +}; + +struct _7 +{ + int _m0[10]; +}; + +constant int _28 = {}; + +static inline __attribute__((always_inline)) +int _39(thread const int& _41, thread const _20& _42) +{ + return _41 + _42._m1; +} + +kernel void main0(device _5& _6 [[buffer(0)]], device _7& _8 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int _32 = _8._m0[gl_GlobalInvocationID.x]; + _20 _33 = _20{ _28, 200 }; + _6._m0[gl_GlobalInvocationID.x] = _39(_32, _33); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp new file mode 100644 index 0000000000..d0f2790d8d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp @@ -0,0 +1,42 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _21 +{ + int _m0; + int _m1; +}; + +struct _5 +{ + int _m0[10]; +}; + +struct _7 +{ + int _m0[10]; +}; + +constant int _29 = {}; +constant int _9_tmp [[function_constant(0)]]; +constant int _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 0; +constant _21 _30 = _21{ _9, _29 }; + +static inline __attribute__((always_inline)) +int _42(thread const int& _44, thread const _21& _45, thread const _21& _46) +{ + return (_44 + _45._m0) + _46._m1; +} + +kernel void main0(device _5& _6 [[buffer(0)]], device _7& _8 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int _34 = _8._m0[gl_GlobalInvocationID.x]; + _21 _35 = _30; + _21 _36 = _21{ _29, 200 }; + _6._m0[gl_GlobalInvocationID.x] = _42(_34, _35, _36); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp new file mode 100644 index 0000000000..dafd6d5d4f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp @@ -0,0 +1,63 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct foo +{ + int a[128]; + uint b; + float2 c; +}; + +struct bar +{ + int d; +}; + +static inline __attribute__((always_inline)) +device foo* select_buffer(device foo& a, constant bar& cb) +{ + return (cb.d != 0) ? &a : nullptr; +} + +static inline __attribute__((always_inline)) +thread uint3* select_input(thread uint3& gl_GlobalInvocationID, thread uint3& gl_LocalInvocationID, constant bar& cb) +{ + return (cb.d != 0) ? &gl_GlobalInvocationID : &gl_LocalInvocationID; +} + +kernel void main0(device foo& buf [[buffer(0)]], constant bar& cb [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + device foo* _46 = select_buffer(buf, cb); + device foo* _45 = _46; + thread uint3* _47 = select_input(gl_GlobalInvocationID, gl_LocalInvocationID, cb); + device foo* _48 = _45; + device int* _52; + device int* _55; + _52 = &_48->a[0u]; + _55 = &buf.a[0u]; + int _57; + int _58; + for (;;) + { + _57 = *_52; + _58 = *_55; + if (_57 != _58) + { + int _66 = (_57 + _58) + int((*_47).x); + *_52 = _66; + *_55 = _66; + _52 = &_52[1u]; + _55 = &_55[1u]; + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp new file mode 100644 index 0000000000..00c490c77f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct foo +{ + int a; +}; + +struct bar +{ + int b; +}; + +static inline __attribute__((always_inline)) +device int* _24(device foo& a, device bar& b, thread uint3& gl_GlobalInvocationID) +{ + return (gl_GlobalInvocationID.x != 0u) ? &a.a : &b.b; +} + +kernel void main0(device foo& x [[buffer(0)]], device bar& y [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + device int* _34 = _24(x, y, gl_GlobalInvocationID); + device int* _33 = _34; + int _37 = x.a; + *_33 = 0; + y.b = _37 + _37; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp new file mode 100644 index 0000000000..9fb68a6319 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp @@ -0,0 +1,34 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct cb1_struct +{ + float4 _RESERVED_IDENTIFIER_FIXUP_m0[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u); + +static inline __attribute__((always_inline)) +int2 get_texcoord(thread const int2& base, thread const int2& index, thread uint3& gl_LocalInvocationID) +{ + return (base * int3(gl_LocalInvocationID).xy) + index; +} + +kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + int2 r0 = int2(int2(u0.get_width(), u0.get_height()) >> int2(uint2(4u))); + for (int i = 0; i < r0.y; i++) + { + for (int j = 0; j < r0.x; j++) + { + int2 param = r0; + int2 param_1 = int2(i, j); + u0.write(cb0_1._RESERVED_IDENTIFIER_FIXUP_m0[0].xxxx, uint2(get_texcoord(param, param_1, gl_LocalInvocationID))); + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp b/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp new file mode 100644 index 0000000000..405556b9ff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct cb1_struct +{ + float4 _RESERVED_IDENTIFIER_FIXUP_m0[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u); + +kernel void main0(constant cb1_struct& cb0_1 [[buffer(0)]], texture2d u0 [[texture(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + int2 r0 = int2(int2(u0.get_width(), u0.get_height()) >> int2(uint2(4u))); + for (int i = 0; i < r0.y; i++) + { + for (int j = 0; j < r0.x; j++) + { + u0.write(cb0_1._RESERVED_IDENTIFIER_FIXUP_m0[0].xxxx, uint2(((r0 * int3(gl_LocalInvocationID).xy) + int2(i, j)))); + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..703dd0a951 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uSampler [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample(uSampler, in.vUV); + out.FragColor += uTex.sample(uSampler, in.vUV, int2(1)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..3628c4eaae --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/default-member-names.asm.frag @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct _9 +{ + float _m0; +}; + +struct _10 +{ + float _m0; + float _m1; + float _m2; + float _m3; + float _m4; + float _m5; + float _m6; + float _m7; + float _m8; + float _m9; + float _m10; + float _m11; + _9 _m12; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + _10 _21; + out.m_3 = float4(_21._m0, _21._m1, _21._m2, _21._m3); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag new file mode 100644 index 0000000000..cf06cddc8a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _7 +{ + float4 _m0[64]; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +struct main0_in +{ + float4 m_2 [[user(locn1)]]; +}; + +static inline __attribute__((always_inline)) +void _108(int _109, texture2d _8, device _7& _10) +{ + int2 _113 = int2(_109 - 8 * (_109 / 8), _109 / 8); + _10._m0[_109] = _8.read(uint2(_113), 0); +} + +static inline __attribute__((always_inline)) +float4 _98(float4 _119, texture2d _8, device _7& _10) +{ + for (int _121 = 0; _121 < 64; _121++) + { + _108(_121, _8, _10); + } + return _119; +} + +fragment main0_out main0(main0_in in [[stage_in]], device _7& _10 [[buffer(0)]], texture2d _8 [[texture(0)]]) +{ + main0_out out = {}; + float4 _97 = _98(in.m_2, _8, _10); + out.m_3 = _97; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag new file mode 100644 index 0000000000..ee781a9671 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag @@ -0,0 +1,46 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct _7 +{ + float4 _m0[64]; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +struct main0_in +{ + float4 m_2 [[user(locn1)]]; +}; + +static inline __attribute__((always_inline)) +void _108(int _109, texture2d _8, sampler _9, device _7& _10) +{ + _10._m0[_109] = _8.sample(_9, (float2(int2(_109 - 8 * (_109 / 8), _109 / 8)) / float2(8.0)), level(0.0)); +} + +static inline __attribute__((always_inline)) +float4 _98(float4 _121, texture2d _8, sampler _9, device _7& _10) +{ + for (int _123 = 0; _123 < 64; _123++) + { + _108(_123, _8, _9, _10); + } + return _121; +} + +fragment main0_out main0(main0_in in [[stage_in]], device _7& _10 [[buffer(0)]], texture2d _8 [[texture(0)]], sampler _9 [[sampler(0)]]) +{ + main0_out out = {}; + float4 _97 = _98(in.m_2, _8, _9, _10); + out.m_3 = _97; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag new file mode 100644 index 0000000000..1870f67194 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct _4 +{ + float4 _m0; +}; + +struct _6 +{ + int _m0; +}; + +struct _7 +{ + float4 _m0; +}; + +struct main0_out +{ + float4 m_3 [[color(0)]]; +}; + +fragment main0_out main0(const device _4* _5_0 [[buffer(0)]], const device _4* _5_1 [[buffer(1)]], const device _4* _5_2 [[buffer(2)]], const device _4* _5_3 [[buffer(3)]], constant _6& _20 [[buffer(4)]], constant _7* _8_0 [[buffer(5)]], constant _7* _8_1 [[buffer(6)]], constant _7* _8_2 [[buffer(7)]], constant _7* _8_3 [[buffer(8)]]) +{ + const device _4* _5[] = + { + _5_0, + _5_1, + _5_2, + _5_3, + }; + + constant _7* _8[] = + { + _8_0, + _8_1, + _8_2, + _8_3, + }; + + main0_out out = {}; + out.m_3 = _5[_20._m0]->_m0 + (_8[_20._m0]->_m0 * float4(0.20000000298023223876953125)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag new file mode 100644 index 0000000000..b64ccabe6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o1 [[color(1)]]; + float4 o3 [[color(3)]]; + float4 o6 [[color(6)]]; + float4 o7 [[color(7)]]; +}; + +fragment main0_out main0() +{ + float4 o0; + float4 o2; + float4 o4; + float4 o5; + float gl_FragDepth; + int gl_FragStencilRefARB; + main0_out out = {}; + o0 = float4(0.0, 0.0, 0.0, 1.0); + out.o1 = float4(1.0, 0.0, 0.0, 1.0); + o2 = float4(0.0, 1.0, 0.0, 1.0); + out.o3 = float4(0.0, 0.0, 1.0, 1.0); + o4 = float4(1.0, 0.0, 1.0, 0.5); + o5 = float4(0.25); + out.o6 = float4(0.75); + out.o7 = float4(1.0); + gl_FragDepth = 0.89999997615814208984375; + gl_FragStencilRefARB = uint(127); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..e30c5864b2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct EmptyStructTest +{ +}; +static inline __attribute__((always_inline)) +float GetValue(thread const EmptyStructTest& self) +{ + return 0.0; +} + +static inline __attribute__((always_inline)) +float GetValue_1(EmptyStructTest self) +{ + return 0.0; +} + +fragment void main0() +{ + EmptyStructTest emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(EmptyStructTest{ }); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag new file mode 100644 index 0000000000..d946104d8f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Foo +{ + float3 a; + float b; +}; + +struct Foo_1 +{ + packed_float3 a; + float b; +}; + +struct buf +{ + Foo_1 results[16]; + float4 bar; +}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 _main(thread const float4& pos, constant buf& _11) +{ + int _46 = int(pos.x) % 16; + Foo foo; + foo.a = float3(_11.results[_46].a); + foo.b = _11.results[_46].b; + return float4(dot(foo.a, _11.bar.xyz), foo.b, 0.0, 0.0); +} + +fragment main0_out main0(constant buf& _11 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 pos = gl_FragCoord; + float4 param = pos; + out._entryPointOutput = _main(param, _11); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..ebc73d52df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/frem.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = fmod(in.vA, in.vB); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..40fe5c5d81 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,51 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 foo(thread const float4& foo_1) +{ + return foo_1 + float4(1.0); +} + +static inline __attribute__((always_inline)) +float4 foo(thread const float3& foo_1) +{ + return foo_1.xyzz + float4(1.0); +} + +static inline __attribute__((always_inline)) +float4 foo_1(thread const float4& foo_2) +{ + return foo_2 + float4(2.0); +} + +static inline __attribute__((always_inline)) +float4 foo(thread const float2& foo_2) +{ + return foo_2.xyxy + float4(2.0); +} + +fragment main0_out main0() +{ + main0_out out = {}; + float4 foo_3 = float4(1.0); + float4 foo_2 = foo(foo_3); + float3 foo_5 = float3(1.0); + float4 foo_4 = foo(foo_5); + float4 foo_7 = float4(1.0); + float4 foo_6 = foo_1(foo_7); + float2 foo_9 = float2(1.0); + float4 foo_8 = foo(foo_9); + out.FragColor = ((foo_2 + foo_4) + foo_6) + foo_8; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..0d691b306d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + int2 Size [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.Size = int2(uTexture.get_width(), uTexture.get_height()) + int2(uTexture.get_width(1), uTexture.get_height(1)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..830df0c7e9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,49 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 v0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uImage [[texture(0)]], sampler uImageSmplr [[sampler(0)]]) +{ + main0_out out = {}; + int i = 0; + float phi; + float4 _36; + phi = 1.0; + _36 = float4(1.0, 2.0, 1.0, 2.0); + for (;;) + { + out.FragColor = _36; + if (i < 4) + { + if (in.v0[i] > 0.0) + { + float2 _48 = float2(phi); + i++; + phi += 2.0; + _36 = uImage.sample(uImageSmplr, _48, level(0.0)); + continue; + } + else + { + break; + } + } + else + { + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..067719896b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float3(as_type(0x7f800000u /* inf */), as_type(0xff800000u /* -inf */), as_type(0x7fc00000u /* nan */)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag new file mode 100644 index 0000000000..6407b32b2e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct Input +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 inp_v0 [[user(locn0)]]; + float2 inp_v1 [[user(locn1), center_no_perspective]]; + float3 inp_v2 [[user(locn2), centroid_perspective]]; + float4 inp_v3 [[user(locn3), centroid_no_perspective]]; + float inp_v4 [[user(locn4), sample_perspective]]; + float inp_v5 [[user(locn5), sample_no_perspective]]; + float inp_v6 [[user(locn6), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Input inp = {}; + inp.v0 = in.inp_v0; + inp.v1 = in.inp_v1; + inp.v2 = in.inp_v2; + inp.v3 = in.inp_v3; + inp.v4 = in.inp_v4; + inp.v5 = in.inp_v5; + inp.v6 = in.inp_v6; + out.FragColor = float4(inp.v0.x + inp.v1.y, inp.v2.xy, ((inp.v3.w * inp.v4) + inp.v5) - inp.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..38fbd27ba3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vColor [[user(locn0)]]; +}; + +#line 6 "test.frag" +static inline __attribute__((always_inline)) +void func(thread float& FragColor, thread float& vColor) +{ +#line 8 "test.frag" + FragColor = 1.0; +#line 9 "test.frag" + FragColor = 2.0; +#line 10 "test.frag" + if (vColor < 0.0) + { +#line 12 "test.frag" + FragColor = 3.0; + } + else + { +#line 16 "test.frag" + FragColor = 4.0; + } +#line 19 "test.frag" + for (int i = 0; float(i) < (40.0 + vColor); i += (int(vColor) + 5)) + { +#line 21 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 22 "test.frag" + FragColor += 0.300000011920928955078125; + } +#line 25 "test.frag" + switch (int(vColor)) + { + case 0: + { +#line 28 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + FragColor += 0.4000000059604644775390625; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + FragColor += 0.800000011920928955078125; +#line 37 "test.frag" + break; + } + } + do + { +#line 42 "test.frag" + FragColor += (10.0 + vColor); + } while (FragColor < 100.0); +} + +#line 46 "test.frag" +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; +#line 48 "test.frag" + func(out.FragColor, in.vColor); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..2cebdec49f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/locations-components.asm.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o0 [[color(0)]]; +}; + +struct main0_in +{ + float2 m_2 [[user(locn1)]]; + float m_3 [[user(locn1_2)]]; + float m_4 [[user(locn2), flat]]; + uint m_5 [[user(locn2_1)]]; + uint m_6 [[user(locn2_2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 v1; + v1 = float4(in.m_2.x, in.m_2.y, v1.z, v1.w); + v1.z = in.m_3; + float4 v2; + v2.x = in.m_4; + v2.y = as_type(in.m_5); + v2.z = as_type(in.m_6); + float4 r0; + r0.x = as_type(as_type(v2.y) + as_type(v2.z)); + out.o0.y = float(as_type(r0.x)); + out.o0.x = v1.y + v2.x; + out.o0 = float4(out.o0.x, out.o0.y, v1.z, v1.x); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..41193536e6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _46 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 }); +constant spvUnsafeArray _76 = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); +constant spvUnsafeArray _90 = spvUnsafeArray({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) }); + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + spvUnsafeArray foobar = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + spvUnsafeArray baz = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + main0_out out = {}; + out.FragColor = _46[in.index]; + if (in.index < 10) + { + out.FragColor += _46[in.index ^ 1]; + } + else + { + out.FragColor += _46[in.index & 1]; + } + if (in.index > 30) + { + out.FragColor += _76[in.index & 3].y; + } + else + { + out.FragColor += _76[in.index & 1].x; + } + if (in.index > 30) + { + foobar[1].z = 20.0; + } + out.FragColor += foobar[in.index & 3].z; + baz = _90; + out.FragColor += baz[in.index & 3].z; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/min-lod.msl22.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/min-lod.msl22.asm.frag new file mode 100644 index 0000000000..5193b2cda8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/min-lod.msl22.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uSampler.sample(uSamplerSmplr, in.vUV, min_lod_clamp(4.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..f8104f8165 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,70 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct D +{ + float4 a; + float b; +}; + +constant spvUnsafeArray _14 = spvUnsafeArray({ float4(0.0), float4(0.0), float4(0.0), float4(0.0) }); + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float a = 0.0; + float4 b = float4(0.0); + float2x3 c = float2x3(float3(0.0), float3(0.0)); + D d = D{ float4(0.0), 0.0 }; + out.FragColor = a; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-image-sampled-image.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-image-sampled-image.asm.frag new file mode 100644 index 0000000000..972daee615 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/op-image-sampled-image.asm.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct push_cb +{ + float4 cb0[1]; +}; + +struct main0_out +{ + float4 o0 [[color(0)]]; +}; + +fragment main0_out main0(constant push_cb& _19 [[buffer(0)]], texture2d t0 [[texture(0)]], sampler dummy_sampler [[sampler(0)]]) +{ + main0_out out = {}; + float4 r0; + r0 = float4(_19.cb0[0u].z, _19.cb0[0u].w, r0.z, r0.w); + r0 = float4(r0.x, r0.y, float2(0.0).x, float2(0.0).y); + out.o0 = t0.read(uint2(as_type(r0.xy)) + uint2(int2(-1, -2)), as_type(r0.w)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..46648f6d30 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Registers +{ + float foo; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float add_value(float v, float w) +{ + return v + w; +} + +fragment main0_out main0(constant Registers& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = add_value(10.0, registers.foo); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..036774d661 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,12 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + for (int _22 = 35; _22 >= 0; _22--) + { + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag new file mode 100644 index 0000000000..02ec4751bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag @@ -0,0 +1,187 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _13 +{ + float4 x; + float4 y; + float4 z; + spvUnsafeArray u; + spvUnsafeArray v; + spvUnsafeArray w; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + interpolant foo [[user(locn0)]]; + interpolant bar [[user(locn1)]]; + interpolant baz [[user(locn2)]]; + int sid [[user(locn3)]]; + interpolant a_0 [[user(locn4)]]; + interpolant a_1 [[user(locn5)]]; + interpolant b_0 [[user(locn6)]]; + interpolant b_1 [[user(locn7)]]; + interpolant c_0 [[user(locn8)]]; + interpolant c_1 [[user(locn9)]]; + interpolant s_x [[user(locn10)]]; + interpolant s_y [[user(locn11)]]; + interpolant s_z [[user(locn12)]]; + interpolant s_u_0 [[user(locn13)]]; + interpolant s_u_1 [[user(locn14)]]; + interpolant s_v_0 [[user(locn15)]]; + interpolant s_v_1 [[user(locn16)]]; + interpolant s_w_0 [[user(locn17)]]; + interpolant s_w_1 [[user(locn18)]]; + interpolant s_w_2 [[user(locn19)]]; +}; + +static inline __attribute__((always_inline)) +void func(thread float4& FragColor, thread float2 baz, thread spvUnsafeArray& a, thread _13& s, thread main0_in& in) +{ + float2 _237 = FragColor.xy + baz; + FragColor = float4(_237.x, _237.y, FragColor.z, FragColor.w); + FragColor.x += in.baz.interpolate_at_centroid().x; + FragColor.y += in.baz.interpolate_at_sample(3).y; + FragColor.z += in.baz.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).y; + float2 _262 = FragColor.xy + in.a_1.interpolate_at_centroid(); + FragColor = float4(_262.x, _262.y, FragColor.z, FragColor.w); + float2 _269 = FragColor.xy + in.a_0.interpolate_at_sample(2); + FragColor = float4(_269.x, _269.y, FragColor.z, FragColor.w); + float2 _276 = FragColor.xy + in.a_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + FragColor = float4(_276.x, _276.y, FragColor.z, FragColor.w); + FragColor += s.z; + float2 _288 = FragColor.xy + in.s_z.interpolate_at_centroid().yy; + FragColor = float4(_288.x, _288.y, FragColor.z, FragColor.w); + float2 _296 = FragColor.yz + in.s_z.interpolate_at_sample(3).xy; + FragColor = float4(FragColor.x, _296.x, _296.y, FragColor.w); + float2 _304 = FragColor.zw + in.s_z.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).wx; + FragColor = float4(FragColor.x, FragColor.y, _304.x, _304.y); + FragColor += s.u[0]; + FragColor += in.s_u_1.interpolate_at_centroid(); + FragColor += in.s_u_0.interpolate_at_sample(2); + FragColor += in.s_u_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); +} + +fragment main0_out main0(main0_in in [[stage_in]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + spvUnsafeArray a = {}; + _13 s = {}; + spvUnsafeArray b = {}; + spvUnsafeArray c = {}; + a[0] = in.a_0.interpolate_at_center(); + a[1] = in.a_1.interpolate_at_center(); + s.x = in.s_x.interpolate_at_center(); + s.y = in.s_y.interpolate_at_centroid(); + s.z = in.s_z.interpolate_at_sample(gl_SampleID); + s.u[0] = in.s_u_0.interpolate_at_centroid(); + s.u[1] = in.s_u_1.interpolate_at_centroid(); + s.v[0] = in.s_v_0.interpolate_at_sample(gl_SampleID); + s.v[1] = in.s_v_1.interpolate_at_sample(gl_SampleID); + s.w[0] = in.s_w_0.interpolate_at_center(); + s.w[1] = in.s_w_1.interpolate_at_center(); + s.w[2] = in.s_w_2.interpolate_at_center(); + b[0] = in.b_0.interpolate_at_centroid(); + b[1] = in.b_1.interpolate_at_centroid(); + c[0] = in.c_0.interpolate_at_sample(gl_SampleID); + c[1] = in.c_1.interpolate_at_sample(gl_SampleID); + out.FragColor = in.foo.interpolate_at_center(); + out.FragColor += in.foo.interpolate_at_centroid(); + out.FragColor += in.foo.interpolate_at_sample(in.sid); + out.FragColor += in.foo.interpolate_at_offset(float2(0.100000001490116119384765625) + 0.4375); + float3 _65 = out.FragColor.xyz + in.bar.interpolate_at_centroid(); + out.FragColor = float4(_65.x, _65.y, _65.z, out.FragColor.w); + float3 _71 = out.FragColor.xyz + in.bar.interpolate_at_centroid(); + out.FragColor = float4(_71.x, _71.y, _71.z, out.FragColor.w); + float3 _78 = out.FragColor.xyz + in.bar.interpolate_at_sample(in.sid); + out.FragColor = float4(_78.x, _78.y, _78.z, out.FragColor.w); + float3 _84 = out.FragColor.xyz + in.bar.interpolate_at_offset(float2(-0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_84.x, _84.y, _84.z, out.FragColor.w); + float2 _91 = out.FragColor.xy + b[0]; + out.FragColor = float4(_91.x, _91.y, out.FragColor.z, out.FragColor.w); + float2 _98 = out.FragColor.xy + in.b_1.interpolate_at_centroid(); + out.FragColor = float4(_98.x, _98.y, out.FragColor.z, out.FragColor.w); + float2 _105 = out.FragColor.xy + in.b_0.interpolate_at_sample(2); + out.FragColor = float4(_105.x, _105.y, out.FragColor.z, out.FragColor.w); + float2 _112 = out.FragColor.xy + in.b_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_112.x, _112.y, out.FragColor.z, out.FragColor.w); + float2 _119 = out.FragColor.xy + c[0]; + out.FragColor = float4(_119.x, _119.y, out.FragColor.z, out.FragColor.w); + float2 _127 = out.FragColor.xy + in.c_1.interpolate_at_centroid().xy; + out.FragColor = float4(_127.x, _127.y, out.FragColor.z, out.FragColor.w); + float2 _135 = out.FragColor.xy + in.c_0.interpolate_at_sample(2).yx; + out.FragColor = float4(_135.x, _135.y, out.FragColor.z, out.FragColor.w); + float2 _143 = out.FragColor.xy + in.c_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375).xx; + out.FragColor = float4(_143.x, _143.y, out.FragColor.z, out.FragColor.w); + out.FragColor += s.x; + out.FragColor += in.s_x.interpolate_at_centroid(); + out.FragColor += in.s_x.interpolate_at_sample(in.sid); + out.FragColor += in.s_x.interpolate_at_offset(float2(0.100000001490116119384765625) + 0.4375); + out.FragColor += s.y; + out.FragColor += in.s_y.interpolate_at_centroid(); + out.FragColor += in.s_y.interpolate_at_sample(in.sid); + out.FragColor += in.s_y.interpolate_at_offset(float2(-0.100000001490116119384765625) + 0.4375); + float2 _184 = out.FragColor.xy + s.v[0]; + out.FragColor = float4(_184.x, _184.y, out.FragColor.z, out.FragColor.w); + float2 _191 = out.FragColor.xy + in.s_v_1.interpolate_at_centroid(); + out.FragColor = float4(_191.x, _191.y, out.FragColor.z, out.FragColor.w); + float2 _198 = out.FragColor.xy + in.s_v_0.interpolate_at_sample(2); + out.FragColor = float4(_198.x, _198.y, out.FragColor.z, out.FragColor.w); + float2 _205 = out.FragColor.xy + in.s_v_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + out.FragColor = float4(_205.x, _205.y, out.FragColor.z, out.FragColor.w); + out.FragColor.x += s.w[0]; + out.FragColor.x += in.s_w_1.interpolate_at_centroid(); + out.FragColor.x += in.s_w_0.interpolate_at_sample(2); + out.FragColor.x += in.s_w_1.interpolate_at_offset(float2(-0.100000001490116119384765625, 0.100000001490116119384765625) + 0.4375); + func(out.FragColor, in.baz.interpolate_at_sample(gl_SampleID), a, s, in); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..aed8fd382a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float out_var_SV_Target [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d g_Texture [[texture(0)]], sampler g_Sampler [[sampler(0)]], sampler g_CompareSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.out_var_SV_Target = float4(g_Texture.sample(g_Sampler, in.in_var_TEXCOORD0)).x + g_Texture.sample_compare(g_CompareSampler, in.in_var_TEXCOORD0, 0.5, level(0.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..2ea037407f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,82 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myType +{ + float data; +}; + +struct main0_out +{ + float4 o_color [[color(0)]]; +}; + +fragment main0_out main0(float4 gl_FragCoord [[position]]) +{ + spvUnsafeArray _21 = spvUnsafeArray({ myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } }); + + main0_out out = {}; + float2 uv = gl_FragCoord.xy; + int index = int(mod(uv.x, 4.0)); + myType elt = _21[index]; + if (elt.data > 0.0) + { + out.o_color = float4(0.0, 1.0, 0.0, 1.0); + } + else + { + out.o_color = float4(1.0, 0.0, 0.0, 1.0); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..f0cdd574de --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/srem.asm.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int4 vA [[user(locn0)]]; + int4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.vA - in.vB * (in.vA / in.vB)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..d59013daaf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,65 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _20 = spvUnsafeArray({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) }); + +struct main0_out +{ + float4 FragColors_0 [[color(0)]]; + float4 FragColors_1 [[color(1)]]; + float4 FragColor [[color(2)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + spvUnsafeArray FragColors = spvUnsafeArray({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) }); + out.FragColor = float4(5.0); + out.FragColors_0 = FragColors[0]; + out.FragColors_1 = FragColors[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-different-sizes.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-different-sizes.asm.frag new file mode 100644 index 0000000000..1ee9eebf00 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-different-sizes.asm.frag @@ -0,0 +1,78 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + int sw0 = 42; + int result = 0; + switch (sw0) + { + case -42: + { + result = 42; + } + case 420: + { + result = 420; + } + case -1234: + { + result = 420; + break; + } + } + char sw1 = char(10); + switch (sw1) + { + case -42: + { + result = 42; + } + case 42: + { + result = 420; + } + case -123: + { + result = 512; + break; + } + } + short sw2 = short(10); + switch (sw2) + { + case -42: + { + result = 42; + } + case 42: + { + result = 420; + } + case -1234: + { + result = 512; + break; + } + } + short sw3 = short(10); + switch (sw3) + { + case -42: + { + result = 42; + } + case 42: + { + result = 420; + } + case -1234: + { + result = 512; + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag new file mode 100644 index 0000000000..5ec002e780 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + long sw = 42l; + int result = 0; + switch (sw) + { + case -42l: + { + result = 42; + } + case 420l: + { + result = 420; + } + case -34359738368l: + { + result = 420; + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag new file mode 100644 index 0000000000..2bf44c207b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + ulong sw = 42ul; + int result = 0; + switch (sw) + { + case 42ul: + { + result = 42; + } + case 420ul: + { + result = 420; + } + case 343597383680ul: + { + result = 420; + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..dd308c32ad --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.frag new file mode 100644 index 0000000000..ab5be64984 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.frag @@ -0,0 +1,121 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + spvUnsafeArray _m0; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _102 = float3(_100.x, _100.y, _70.z); + _102.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102)) + { + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag new file mode 100644 index 0000000000..ab5be64984 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag @@ -0,0 +1,121 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + spvUnsafeArray _m0; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _102 = float3(_100.x, _100.y, _70.z); + _102.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102)) + { + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz)); + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..97345820b6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + half4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + half2 UV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = half4(uTexture.sample(uTextureSmplr, float2(in.UV))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..2cefeb6693 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +constant float4 _38 = {}; +constant float4 _47 = {}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float4 _27; + do + { + float2 _26 = float2(0.0); + if (_26.x != 0.0) + { + _27 = float4(1.0, 0.0, 0.0, 1.0); + break; + } + else + { + _27 = float4(1.0, 1.0, 0.0, 1.0); + break; + } + _27 = _38; + break; + } while (false); + out._entryPointOutput = _27; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..e512bdca49 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,36 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float sample_combined(thread float3& vUV, depth2d uShadow, sampler uShadowSmplr) +{ + return uShadow.sample_compare(uShadowSmplr, vUV.xy, vUV.z); +} + +static inline __attribute__((always_inline)) +float sample_separate(thread float3& vUV, depth2d uTexture, sampler uSampler) +{ + return uTexture.sample_compare(uSampler, vUV.xy, vUV.z); +} + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow [[texture(0)]], depth2d uTexture [[texture(1)]], sampler uShadowSmplr [[sampler(0)]], sampler uSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = sample_combined(in.vUV, uShadow, uShadowSmplr) + sample_separate(in.vUV, uTexture, uSampler); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.asm.frag new file mode 100644 index 0000000000..624408c4d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.asm.frag @@ -0,0 +1,59 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 c [[user(locn2)]]; + float2 d [[user(locn3)]]; + float3 e [[user(locn4)]]; + float3 f [[user(locn5)]]; + float4 g [[user(locn6)]]; + float4 h [[user(locn7)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float t0 = a; + float t1 = b; + bool c1 = (isunordered(a, b) || a == b); + c1 = a != b; + bool c2 = a != b; + bool c3 = (isunordered(a, b) || a < b); + bool c4 = (isunordered(a, b) || a > b); + bool c5 = (isunordered(a, b) || a <= b); + bool c6 = (isunordered(a, b) || a >= b); + bool2 c7 = (isunordered(in.c, in.d) || in.c == in.d); + bool2 c8 = in.c != in.d; + bool2 c9 = (isunordered(in.c, in.d) || in.c < in.d); + bool2 c10 = (isunordered(in.c, in.d) || in.c > in.d); + bool2 c11 = (isunordered(in.c, in.d) || in.c <= in.d); + bool2 c12 = (isunordered(in.c, in.d) || in.c >= in.d); + bool3 c13 = (isunordered(in.e, in.f) || in.e == in.f); + bool3 c14 = in.e != in.f; + bool3 c15 = (isunordered(in.e, in.f) || in.e < in.f); + bool3 c16 = (isunordered(in.e, in.f) || in.e > in.f); + bool3 c17 = (isunordered(in.e, in.f) || in.e <= in.f); + bool3 c18 = (isunordered(in.e, in.f) || in.e >= in.f); + bool4 c19 = (isunordered(in.g, in.h) || in.g == in.h); + bool4 c20 = in.g != in.h; + bool4 c21 = (isunordered(in.g, in.h) || in.g < in.h); + bool4 c22 = (isunordered(in.g, in.h) || in.g > in.h); + bool4 c23 = (isunordered(in.g, in.h) || in.g <= in.h); + bool4 c24 = (isunordered(in.g, in.h) || in.g >= in.h); + out.FragColor = float4(t0 + t1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag new file mode 100644 index 0000000000..4848280635 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag @@ -0,0 +1,59 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 c [[user(locn2)]]; + float2 d [[user(locn3)]]; + float3 e [[user(locn4)]]; + float3 f [[user(locn5)]]; + float4 g [[user(locn6)]]; + float4 h [[user(locn7)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float t0 = a; + float t1 = b; + bool c1 = a == b; + c1 = a != b; + bool c2 = a != b; + bool c3 = a < b; + bool c4 = a > b; + bool c5 = a <= b; + bool c6 = a >= b; + bool2 c7 = in.c == in.d; + bool2 c8 = in.c != in.d; + bool2 c9 = in.c < in.d; + bool2 c10 = in.c > in.d; + bool2 c11 = in.c <= in.d; + bool2 c12 = in.c >= in.d; + bool3 c13 = in.e == in.f; + bool3 c14 = in.e != in.f; + bool3 c15 = in.e < in.f; + bool3 c16 = in.e > in.f; + bool3 c17 = in.e <= in.f; + bool3 c18 = in.e >= in.f; + bool4 c19 = in.g == in.h; + bool4 c20 = in.g != in.h; + bool4 c21 = in.g < in.h; + bool4 c22 = in.g > in.h; + bool4 c23 = in.g <= in.h; + bool4 c24 = in.g >= in.h; + out.FragColor = float4(t0 + t1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..7ae4aa5e60 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/unreachable.asm.frag @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +constant float4 _21 = {}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int counter [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _24; + _24 = _21; + float4 _33; + for (;;) + { + if (in.counter == 10) + { + _33 = float4(10.0); + break; + } + else + { + _33 = float4(30.0); + break; + } + } + out.FragColor = _33; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..9e73be477a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,336 @@ +#include +#include + +using namespace metal; + +struct _28 +{ + float4 _m0; +}; + +struct _6 +{ + float4 _m0; + float _m1; + float4 _m2; +}; + +struct _10 +{ + float3 _m0; + packed_float3 _m1; + float _m2; + packed_float3 _m3; + float _m4; + packed_float3 _m5; + float _m6; + packed_float3 _m7; + float _m8; + packed_float3 _m9; + float _m10; + packed_float3 _m11; + float _m12; + float2 _m13; + float2 _m14; + packed_float3 _m15; + float _m16; + float _m17; + float _m18; + float _m19; + float _m20; + float4 _m21; + float4 _m22; + float4x4 _m23; + float4 _m24; +}; + +struct _18 +{ + float4x4 _m0; + float4x4 _m1; + float4x4 _m2; + float4x4 _m3; + float4 _m4; + float4 _m5; + float _m6; + float _m7; + float _m8; + float _m9; + packed_float3 _m10; + float _m11; + packed_float3 _m12; + float _m13; + packed_float3 _m14; + float _m15; + packed_float3 _m16; + float _m17; + float _m18; + float _m19; + float2 _m20; + float2 _m21; + float2 _m22; + float4 _m23; + float2 _m24; + float2 _m25; + float2 _m26; + char _m27_pad[8]; + packed_float3 _m27; + float _m28; + float _m29; + float _m30; + float _m31; + float _m32; + float2 _m33; + float _m34; + float _m35; + float3 _m36; + float4x4 _m37[2]; + float4 _m38[2]; +}; + +struct _20 +{ + float4 _m0; + float4 _m1; + float2 _m2; + float2 _m3; + float3 _m4; + float _m5; + float3 _m6; + float _m7; + float4 _m8; + float4 _m9; + float4 _m10; + float3 _m11; + float _m12; + float3 _m13; + float _m14; + float3 _m15; + float4 _m16; + float3 _m17; + float _m18; + float3 _m19; + float2 _m20; +}; + +struct _21 +{ + float4 _m0; +}; + +constant _28 _74 = {}; + +struct main0_out +{ + float4 m_5 [[color(0)]]; +}; + +fragment main0_out main0(constant _6& _7 [[buffer(0)]], constant _10& _11 [[buffer(1)]], constant _18& _19 [[buffer(2)]], texture2d _8 [[texture(0)]], texture2d _12 [[texture(1)]], texture2d _14 [[texture(2)]], sampler _9 [[sampler(0)]], sampler _13 [[sampler(1)]], sampler _15 [[sampler(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + _28 _77; + _77._m0 = float4(0.0); + float2 _82 = gl_FragCoord.xy * _19._m23.xy; + float4 _88 = _7._m2 * _7._m0.xyxy; + float2 _97 = fast::clamp(_82 + (float3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _109 = float3(_11._m5) * fast::clamp(_8.sample(_9, _97, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _113 = _12.sample(_13, _97, level(0.0)); + float3 _129; + if (_113.y > 0.0) + { + _129 = _109 + (_14.sample(_15, _97, level(0.0)).xyz * fast::clamp(_113.y * _113.z, 0.0, 1.0)); + } + else + { + _129 = _109; + } + float3 _133 = float4(0.0).xyz + (_129 * 0.5); + float4 _134 = float4(_133.x, _133.y, _133.z, float4(0.0).w); + _77._m0 = _134; + float2 _144 = fast::clamp(_82 + (float3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _156 = float3(_11._m5) * fast::clamp(_8.sample(_9, _144, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _160 = _12.sample(_13, _144, level(0.0)); + float3 _176; + if (_160.y > 0.0) + { + _176 = _156 + (_14.sample(_15, _144, level(0.0)).xyz * fast::clamp(_160.y * _160.z, 0.0, 1.0)); + } + else + { + _176 = _156; + } + float3 _180 = _134.xyz + (_176 * 0.5); + float4 _181 = float4(_180.x, _180.y, _180.z, _134.w); + _77._m0 = _181; + float2 _191 = fast::clamp(_82 + (float3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _203 = float3(_11._m5) * fast::clamp(_8.sample(_9, _191, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _207 = _12.sample(_13, _191, level(0.0)); + float3 _223; + if (_207.y > 0.0) + { + _223 = _203 + (_14.sample(_15, _191, level(0.0)).xyz * fast::clamp(_207.y * _207.z, 0.0, 1.0)); + } + else + { + _223 = _203; + } + float3 _227 = _181.xyz + (_223 * 0.75); + float4 _228 = float4(_227.x, _227.y, _227.z, _181.w); + _77._m0 = _228; + float2 _238 = fast::clamp(_82 + (float3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _250 = float3(_11._m5) * fast::clamp(_8.sample(_9, _238, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _254 = _12.sample(_13, _238, level(0.0)); + float3 _270; + if (_254.y > 0.0) + { + _270 = _250 + (_14.sample(_15, _238, level(0.0)).xyz * fast::clamp(_254.y * _254.z, 0.0, 1.0)); + } + else + { + _270 = _250; + } + float3 _274 = _228.xyz + (_270 * 0.5); + float4 _275 = float4(_274.x, _274.y, _274.z, _228.w); + _77._m0 = _275; + float2 _285 = fast::clamp(_82 + (float3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _297 = float3(_11._m5) * fast::clamp(_8.sample(_9, _285, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _301 = _12.sample(_13, _285, level(0.0)); + float3 _317; + if (_301.y > 0.0) + { + _317 = _297 + (_14.sample(_15, _285, level(0.0)).xyz * fast::clamp(_301.y * _301.z, 0.0, 1.0)); + } + else + { + _317 = _297; + } + float3 _321 = _275.xyz + (_317 * 0.5); + float4 _322 = float4(_321.x, _321.y, _321.z, _275.w); + _77._m0 = _322; + float2 _332 = fast::clamp(_82 + (float3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _344 = float3(_11._m5) * fast::clamp(_8.sample(_9, _332, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _348 = _12.sample(_13, _332, level(0.0)); + float3 _364; + if (_348.y > 0.0) + { + _364 = _344 + (_14.sample(_15, _332, level(0.0)).xyz * fast::clamp(_348.y * _348.z, 0.0, 1.0)); + } + else + { + _364 = _344; + } + float3 _368 = _322.xyz + (_364 * 0.75); + float4 _369 = float4(_368.x, _368.y, _368.z, _322.w); + _77._m0 = _369; + float2 _379 = fast::clamp(_82 + (float3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _391 = float3(_11._m5) * fast::clamp(_8.sample(_9, _379, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _395 = _12.sample(_13, _379, level(0.0)); + float3 _411; + if (_395.y > 0.0) + { + _411 = _391 + (_14.sample(_15, _379, level(0.0)).xyz * fast::clamp(_395.y * _395.z, 0.0, 1.0)); + } + else + { + _411 = _391; + } + float3 _415 = _369.xyz + (_411 * 1.0); + float4 _416 = float4(_415.x, _415.y, _415.z, _369.w); + _77._m0 = _416; + float2 _426 = fast::clamp(_82 + (float3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _438 = float3(_11._m5) * fast::clamp(_8.sample(_9, _426, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _442 = _12.sample(_13, _426, level(0.0)); + float3 _458; + if (_442.y > 0.0) + { + _458 = _438 + (_14.sample(_15, _426, level(0.0)).xyz * fast::clamp(_442.y * _442.z, 0.0, 1.0)); + } + else + { + _458 = _438; + } + float3 _462 = _416.xyz + (_458 * 0.75); + float4 _463 = float4(_462.x, _462.y, _462.z, _416.w); + _77._m0 = _463; + float2 _473 = fast::clamp(_82 + (float3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _485 = float3(_11._m5) * fast::clamp(_8.sample(_9, _473, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _489 = _12.sample(_13, _473, level(0.0)); + float3 _505; + if (_489.y > 0.0) + { + _505 = _485 + (_14.sample(_15, _473, level(0.0)).xyz * fast::clamp(_489.y * _489.z, 0.0, 1.0)); + } + else + { + _505 = _485; + } + float3 _509 = _463.xyz + (_505 * 0.5); + float4 _510 = float4(_509.x, _509.y, _509.z, _463.w); + _77._m0 = _510; + float2 _520 = fast::clamp(_82 + (float3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _532 = float3(_11._m5) * fast::clamp(_8.sample(_9, _520, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _536 = _12.sample(_13, _520, level(0.0)); + float3 _552; + if (_536.y > 0.0) + { + _552 = _532 + (_14.sample(_15, _520, level(0.0)).xyz * fast::clamp(_536.y * _536.z, 0.0, 1.0)); + } + else + { + _552 = _532; + } + float3 _556 = _510.xyz + (_552 * 0.5); + float4 _557 = float4(_556.x, _556.y, _556.z, _510.w); + _77._m0 = _557; + float2 _567 = fast::clamp(_82 + (float3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _579 = float3(_11._m5) * fast::clamp(_8.sample(_9, _567, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _583 = _12.sample(_13, _567, level(0.0)); + float3 _599; + if (_583.y > 0.0) + { + _599 = _579 + (_14.sample(_15, _567, level(0.0)).xyz * fast::clamp(_583.y * _583.z, 0.0, 1.0)); + } + else + { + _599 = _579; + } + float3 _603 = _557.xyz + (_599 * 0.75); + float4 _604 = float4(_603.x, _603.y, _603.z, _557.w); + _77._m0 = _604; + float2 _614 = fast::clamp(_82 + (float3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _626 = float3(_11._m5) * fast::clamp(_8.sample(_9, _614, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _630 = _12.sample(_13, _614, level(0.0)); + float3 _646; + if (_630.y > 0.0) + { + _646 = _626 + (_14.sample(_15, _614, level(0.0)).xyz * fast::clamp(_630.y * _630.z, 0.0, 1.0)); + } + else + { + _646 = _626; + } + float3 _650 = _604.xyz + (_646 * 0.5); + float4 _651 = float4(_650.x, _650.y, _650.z, _604.w); + _77._m0 = _651; + float2 _661 = fast::clamp(_82 + (float3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + float3 _673 = float3(_11._m5) * fast::clamp(_8.sample(_9, _661, level(0.0)).w * _7._m1, 0.0, 1.0); + float4 _677 = _12.sample(_13, _661, level(0.0)); + float3 _693; + if (_677.y > 0.0) + { + _693 = _673 + (_14.sample(_15, _661, level(0.0)).xyz * fast::clamp(_677.y * _677.z, 0.0, 1.0)); + } + else + { + _693 = _673; + } + float3 _697 = _651.xyz + (_693 * 0.5); + float4 _698 = float4(_697.x, _697.y, _697.z, _651.w); + _77._m0 = _698; + float3 _702 = _698.xyz / float3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5); + _77._m0 = float4(_702.x, _702.y, _702.z, _698.w); + _77._m0.w = 1.0; + out.m_5 = _77._m0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc new file mode 100644 index 0000000000..6c9903e02b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct TessLevels +{ + float inner0; + float inner1; + float outer0; + float outer1; + float outer2; + float outer3; +}; + +kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(sb_levels.outer1); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(sb_levels.outer2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc new file mode 100644 index 0000000000..79395a4bbb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct TessLevels +{ + float inner0; + float inner1; + float outer0; + float outer1; + float outer2; + float outer3; +}; + +kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(sb_levels.outer1); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(sb_levels.outer2); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese b/third_party/spirv-cross/reference/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese new file mode 100644 index 0000000000..7fd48b4f7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + out.gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert new file mode 100644 index 0000000000..ae42798e31 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct VSOut +{ + float4 pos; + float2 clip; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +VSOut _main(thread const float4& pos) +{ + VSOut vout; + vout.pos = pos; + vout.clip = pos.xy; + return vout; +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 pos = in.pos; + float4 param = pos; + VSOut flattenTemp = _main(param); + out.gl_Position = flattenTemp.pos; + out.gl_ClipDistance[0] = flattenTemp.clip.x; + out.gl_ClipDistance[1] = flattenTemp.clip.y; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert new file mode 100644 index 0000000000..c1e59b9c14 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert @@ -0,0 +1,45 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct VSOut +{ + float4 pos; + float2 clip; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +struct main0_in +{ + float4 pos [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +VSOut _main(thread const float4& pos) +{ + VSOut vout; + vout.pos = pos; + vout.clip = pos.xy; + return vout; +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 pos = in.pos; + float4 param = pos; + VSOut flattenTemp = _main(param); + out.gl_Position = flattenTemp.pos; + out.gl_ClipDistance[0] = flattenTemp.clip.x; + out.gl_ClipDistance[1] = flattenTemp.clip.y; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/copy-memory-interface.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/copy-memory-interface.asm.vert new file mode 100644 index 0000000000..63ab796e8e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/copy-memory-interface.asm.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 o1 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v0 [[attribute(0)]]; + float4 v1 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.v0; + out.o1 = in.v1; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..b94687a52b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,66 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct V2F +{ + float4 Position; + float4 Color; +}; + +struct InstanceData +{ + float4x4 MATRIX_MVP; + float4 Color; +}; + +struct InstanceData_1 +{ + float4x4 MATRIX_MVP; + float4 Color; +}; + +struct gInstanceData +{ + InstanceData_1 _data[1]; +}; + +struct main0_out +{ + float4 _entryPointOutput_Color [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 PosL [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +V2F _VS(thread const float3& PosL, thread const uint& instanceID, const device gInstanceData& gInstanceData_1) +{ + InstanceData instData; + instData.MATRIX_MVP = transpose(gInstanceData_1._data[instanceID].MATRIX_MVP); + instData.Color = gInstanceData_1._data[instanceID].Color; + V2F v2f; + v2f.Position = instData.MATRIX_MVP * float4(PosL, 1.0); + v2f.Color = instData.Color; + return v2f; +} + +vertex main0_out main0(main0_in in [[stage_in]], const device gInstanceData& gInstanceData_1 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + float3 PosL = in.PosL; + uint instanceID = gl_InstanceIndex; + float3 param = PosL; + uint param_1 = instanceID; + V2F flattenTemp = _VS(param, param_1, gInstanceData_1); + out.gl_Position = flattenTemp.Position; + out._entryPointOutput_Color = flattenTemp.Color; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/fake-builtin-input.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/fake-builtin-input.asm.vert new file mode 100644 index 0000000000..3079ae9bcb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/fake-builtin-input.asm.vert @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + half4 out_var_SV_Target [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 in_var_POSITION [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = float4(in.in_var_POSITION, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert new file mode 100644 index 0000000000..d74c43b3f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position, invariant]]; +}; + +static inline __attribute__((always_inline)) +float4 _main() +{ + return float4(1.0); +} + +vertex main0_out main0() +{ + main0_out out = {}; + float4 _14 = _main(); + out.gl_Position = _14; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert new file mode 100644 index 0000000000..1926ff9e14 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _9 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _9.umatrix * float4(_9.uquad[int(gl_VertexIndex)].x, _9.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_9.flags.flags[0] != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert new file mode 100644 index 0000000000..ee20638574 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint2 flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _9 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _9.umatrix * float4(_9.uquad[int(gl_VertexIndex)].x, _9.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_9.flags.flags[0].x != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/packing-test.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packing-test.asm.vert new file mode 100644 index 0000000000..ac2d30c8df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/packing-test.asm.vert @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct TestStruct +{ + float4x4 transforms[6]; +}; + +struct CB0 +{ + TestStruct CB0[16]; +}; + +vertex void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..074a47a652 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,52 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct SpvHalfTypeSelector; +template <> struct SpvHalfTypeSelector { public: using H = half; }; +template struct SpvHalfTypeSelector> { using H = vec; }; +template::H> +[[clang::optnone]] F spvQuantizeToF16(F fval) +{ + H hval = H(fval); + hval = select(copysign(H(0), hval), hval, isnormal(hval) || isinf(hval) || isnan(hval)); + return F(hval); +} + +constant int _7_tmp [[function_constant(201)]]; +constant int _7 = is_function_constant_defined(_7_tmp) ? _7_tmp : -10; +constant int _20 = (_7 + 2); +constant uint _8_tmp [[function_constant(202)]]; +constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u; +constant uint _25 = (_8 % 5u); +constant int _30 = _7 - (-3) * (_7 / (-3)); +constant int4 _32 = int4(20, 30, _20, _30); +constant int2 _34 = int2(_32.y, _32.x); +constant int _35 = _32.y; +constant float _9_tmp [[function_constant(200)]]; +constant float _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 3.141590118408203125; +constant float _41 = spvQuantizeToF16(_9); + +struct main0_out +{ + int m_4 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + float4 pos = float4(0.0); + pos.y += float(_20); + pos.z += float(_25); + pos += float4(_32); + float2 _59 = pos.xy + float2(_34); + pos = float4(_59.x, _59.y, pos.z, pos.w); + out.gl_Position = pos; + out.m_4 = _35; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..30df905e6a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +static inline __attribute__((always_inline)) +float4 _main(thread const uint& vid, thread const uint& iid) +{ + return float4(float(vid + iid)); +} + +vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + uint vid = gl_VertexIndex; + uint iid = gl_InstanceIndex; + uint param = vid; + uint param_1 = iid; + out.gl_Position = _main(param, param_1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp b/third_party/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp new file mode 100644 index 0000000000..85185e6df6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +void set_f(thread int& f) +{ + f = 40; +} + +static inline __attribute__((always_inline)) +void set_shared_u(threadgroup int& u) +{ + u = 50; +} + +kernel void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + threadgroup int u; + int f; + set_f(f); + set_shared_u(u); + if (gl_LocalInvocationIndex == 0u) + { + f = 10; + } + else + { + f = 30; + u = 20; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp new file mode 100644 index 0000000000..18cfd68c19 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct SSBO3 +{ + float4 v; +}; + +struct SSBO0 +{ + float4 v; +}; + +struct SSBO1 +{ + float4 v; +}; + +struct SSBO2 +{ + float4 v; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + const device SSBO0* ssbo0 [[id(0)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + const device SSBO1* ssbo1 [[id(0)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], device SSBO3& ssbo3 [[buffer(2)]], const device SSBO2& ssbo2 [[buffer(3)]]) +{ + ssbo3.v = ((*spvDescriptorSet0.ssbo0).v + (*spvDescriptorSet1.ssbo1).v) + ssbo2.v; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp new file mode 100644 index 0000000000..c23a9d1d00 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp @@ -0,0 +1,11 @@ +#include +#include + +using namespace metal; + +kernel void main0(texture2d uImage [[texture(0)]], texture2d uImageRead [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int2 coord = int2(gl_GlobalInvocationID.xy); + uImage.write(uImageRead.read(uint2(coord)), uint2(coord)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp new file mode 100644 index 0000000000..9bd15acf75 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct spvDescriptorSetBuffer0 +{ + texture2d uImage [[id(0)]]; + texture2d uImageRead [[id(1)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int2 coord = int2(gl_GlobalInvocationID.xy); + spvDescriptorSet0.uImage.write(spvDescriptorSet0.uImageRead.read(uint2(coord)), uint2(coord)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/array-length.comp b/third_party/spirv-cross/reference/shaders-msl/comp/array-length.comp new file mode 100644 index 0000000000..4f86ae8ba9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/array-length.comp @@ -0,0 +1,39 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + uint size; + float4 v[1]; +}; + +struct SSBO1 +{ + float bz[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +uint get_size(device SSBO& _14, constant uint& _14BufferSize, device SSBO1* (&ssbos)[2], constant uint* ssbosBufferSize) +{ + return uint(int((_14BufferSize - 16) / 16) + int((ssbosBufferSize[1] - 0) / 4)); +} + +kernel void main0(constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO& _14 [[buffer(0)]], device SSBO1* ssbos_0 [[buffer(1)]], device SSBO1* ssbos_1 [[buffer(2)]]) +{ + device SSBO1* ssbos[] = + { + ssbos_0, + ssbos_1, + }; + + constant uint& _14BufferSize = spvBufferSizeConstants[0]; + constant uint* ssbosBufferSize = &spvBufferSizeConstants[1]; + _14.size = get_size(_14, _14BufferSize, ssbos, ssbosBufferSize); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp b/third_party/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp new file mode 100644 index 0000000000..73f39846ae --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + uint size; + float4 v[1]; +}; + +struct SSBO1 +{ + float bz[1]; +}; + +struct SSBO2 +{ + uint size2; + float4 w[1]; +}; + +struct SSBO3 +{ + float bz[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO* m_16 [[id(0)]]; + constant uint* spvBufferSizeConstants [[id(1)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + device SSBO1* ssbos [[id(0)]][2]; + constant uint* spvBufferSizeConstants [[id(2)]]; +}; + +static inline __attribute__((always_inline)) +uint get_size(device SSBO& _16, constant uint& _16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& _38, constant uint& _38BufferSize, device SSBO3* (&ssbos2)[2], constant uint* ssbos2BufferSize) +{ + uint len = uint(int((_16BufferSize - 16) / 16)); + len += uint(int((ssbosBufferSize[1] - 0) / 4)); + len += uint(int((_38BufferSize - 16) / 16)); + len += uint(int((ssbos2BufferSize[0] - 0) / 4)); + return len; +} + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant uint* spvBufferSizeConstants [[buffer(25)]], device SSBO2& _38 [[buffer(2)]], device SSBO3* ssbos2_0 [[buffer(3)]], device SSBO3* ssbos2_1 [[buffer(4)]]) +{ + device SSBO3* ssbos2[] = + { + ssbos2_0, + ssbos2_1, + }; + + constant uint& spvDescriptorSet0_m_16BufferSize = spvDescriptorSet0.spvBufferSizeConstants[0]; + constant uint* spvDescriptorSet1_ssbosBufferSize = &spvDescriptorSet1.spvBufferSizeConstants[0]; + constant uint& _38BufferSize = spvBufferSizeConstants[2]; + constant uint* ssbos2BufferSize = &spvBufferSizeConstants[3]; + (*spvDescriptorSet0.m_16).size = get_size((*spvDescriptorSet0.m_16), spvDescriptorSet0_m_16BufferSize, spvDescriptorSet1.ssbos, spvDescriptorSet1_ssbosBufferSize, _38, _38BufferSize, ssbos2, ssbos2BufferSize); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/atomic-float.msl3.comp b/third_party/spirv-cross/reference/shaders-msl/comp/atomic-float.msl3.comp new file mode 100644 index 0000000000..051bfbc003 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/atomic-float.msl3.comp @@ -0,0 +1,20 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float f32; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + float _18 = atomic_fetch_add_explicit((device atomic_float*)&ssbo.f32, 1.0, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/atomic.comp b/third_party/spirv-cross/reference/shaders-msl/comp/atomic.comp new file mode 100644 index 0000000000..fca72bfcfe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/atomic.comp @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + uint u32; + int i32; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& ssbo [[buffer(0)]]) +{ + threadgroup uint shared_u32; + threadgroup int shared_i32; + uint _16 = atomic_fetch_add_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _18 = atomic_fetch_or_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _20 = atomic_fetch_xor_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _22 = atomic_fetch_and_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _24 = atomic_fetch_min_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _26 = atomic_fetch_max_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _28 = atomic_exchange_explicit((device atomic_uint*)&ssbo.u32, 1u, memory_order_relaxed); + uint _32; + do + { + _32 = 10u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&ssbo.u32, &_32, 2u, memory_order_relaxed, memory_order_relaxed) && _32 == 10u); + int _36 = atomic_fetch_add_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _38 = atomic_fetch_or_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _40 = atomic_fetch_xor_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _42 = atomic_fetch_and_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _44 = atomic_fetch_min_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _46 = atomic_fetch_max_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _48 = atomic_exchange_explicit((device atomic_int*)&ssbo.i32, 1, memory_order_relaxed); + int _52; + do + { + _52 = 10; + } while (!atomic_compare_exchange_weak_explicit((device atomic_int*)&ssbo.i32, &_52, 2, memory_order_relaxed, memory_order_relaxed) && _52 == 10); + shared_u32 = 10u; + shared_i32 = 10; + uint _57 = atomic_fetch_add_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _58 = atomic_fetch_or_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _59 = atomic_fetch_xor_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _60 = atomic_fetch_and_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _61 = atomic_fetch_min_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _62 = atomic_fetch_max_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _63 = atomic_exchange_explicit((threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed); + uint _64; + do + { + _64 = 10u; + } while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_uint*)&shared_u32, &_64, 2u, memory_order_relaxed, memory_order_relaxed) && _64 == 10u); + int _65 = atomic_fetch_add_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _66 = atomic_fetch_or_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _67 = atomic_fetch_xor_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _68 = atomic_fetch_and_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _69 = atomic_fetch_min_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _70 = atomic_fetch_max_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _71 = atomic_exchange_explicit((threadgroup atomic_int*)&shared_i32, 1, memory_order_relaxed); + int _72; + do + { + _72 = 10; + } while (!atomic_compare_exchange_weak_explicit((threadgroup atomic_int*)&shared_i32, &_72, 2, memory_order_relaxed, memory_order_relaxed) && _72 == 10); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/barriers.comp b/third_party/spirv-cross/reference/shaders-msl/comp/barriers.comp new file mode 100644 index 0000000000..82813906f6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/barriers.comp @@ -0,0 +1,90 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +static inline __attribute__((always_inline)) +void barrier_shared() +{ + threadgroup_barrier(mem_flags::mem_threadgroup); +} + +static inline __attribute__((always_inline)) +void full_barrier() +{ + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void image_barrier() +{ + threadgroup_barrier(mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void buffer_barrier() +{ + threadgroup_barrier(mem_flags::mem_device); +} + +static inline __attribute__((always_inline)) +void group_barrier() +{ + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void barrier_shared_exec() +{ + threadgroup_barrier(mem_flags::mem_threadgroup); +} + +static inline __attribute__((always_inline)) +void full_barrier_exec() +{ + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void image_barrier_exec() +{ + threadgroup_barrier(mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void buffer_barrier_exec() +{ + threadgroup_barrier(mem_flags::mem_device); +} + +static inline __attribute__((always_inline)) +void group_barrier_exec() +{ + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); +} + +static inline __attribute__((always_inline)) +void exec_barrier() +{ + threadgroup_barrier(mem_flags::mem_threadgroup); +} + +kernel void main0() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + exec_barrier(); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp new file mode 100644 index 0000000000..42518f0d1d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.comp @@ -0,0 +1,36 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float4 idata = _23.in_data[ident]; + if (dot(idata, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _52 = atomic_fetch_add_explicit((device atomic_uint*)&_48.counter, 1u, memory_order_relaxed); + _45.out_data[_52] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp new file mode 100644 index 0000000000..92d517cffb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.comp @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint _59_tmp [[function_constant(10)]]; +constant uint _59 = is_function_constant_defined(_59_tmp) ? _59_tmp : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_59, 1u, 1u); + +kernel void main0(const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 spvDispatchBase [[grid_origin]]) +{ + gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; + gl_WorkGroupID += spvDispatchBase; + uint ident = gl_GlobalInvocationID.x; + uint workgroup = gl_WorkGroupID.x; + float4 idata = _27.in_data[ident]; + if (dot(idata, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _56 = atomic_fetch_add_explicit((device atomic_uint*)&_52.counter, 1u, memory_order_relaxed); + _49.out_data[_56] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp new file mode 100644 index 0000000000..87b0b44291 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.dispatchbase.msl11.comp @@ -0,0 +1,39 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +struct SSBO3 +{ + uint counter; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant uint3& spvDispatchBase [[buffer(29)]], const device SSBO& _27 [[buffer(0)]], device SSBO2& _49 [[buffer(1)]], device SSBO3& _52 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + gl_GlobalInvocationID += spvDispatchBase * gl_WorkGroupSize; + gl_WorkGroupID += spvDispatchBase; + uint ident = gl_GlobalInvocationID.x; + uint workgroup = gl_WorkGroupID.x; + float4 idata = _27.in_data[ident]; + if (dot(idata, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _56 = atomic_fetch_add_explicit((device atomic_uint*)&_52.counter, 1u, memory_order_relaxed); + _49.out_data[_56] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/basic.inline-block.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/basic.inline-block.msl2.comp new file mode 100644 index 0000000000..337b1b7336 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/basic.inline-block.msl2.comp @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +typedef packed_float4 packed_float4x4[4]; + +struct Baz +{ + int f; + int g; +}; + +struct X +{ + int x; + int y; + float z; +}; + +struct Foo +{ + int a; + int b; + packed_float4x4 c; + X x[2]; +}; + +struct Bar +{ + int d; + int e; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(3u, 3u, 2u); + +struct spvDescriptorSetBuffer0 +{ + constant Bar* m_38 [[id(0)]]; + Foo m_32 [[id(1)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + device Baz* baz [[id(0)]][3]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint3 coords = gl_GlobalInvocationID; + spvDescriptorSet1.baz[coords.x]->f = spvDescriptorSet0.m_32.a + (*spvDescriptorSet0.m_38).d; + spvDescriptorSet1.baz[coords.x]->g = spvDescriptorSet0.m_32.b * (*spvDescriptorSet0.m_38).e; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp new file mode 100644 index 0000000000..f79a8b5206 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct SSBO; + +struct UBO +{ + uint2 b; +}; + +struct SSBO +{ + packed_float3 a1; + float a2; +}; + +kernel void main0(constant UBO& _10 [[buffer(0)]]) +{ + (reinterpret_cast(as_type(_10.b)))->a1 = float3(1.0, 2.0, 3.0); + uint2 v2 = as_type(reinterpret_cast(reinterpret_cast(as_type(_10.b + uint2(32u))))); + float3 v3 = float3((reinterpret_cast(as_type(v2)))->a1); + (reinterpret_cast(as_type(v2)))->a1 = v3 + float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp new file mode 100644 index 0000000000..35b7af540c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp @@ -0,0 +1,67 @@ +#include +#include + +using namespace metal; + +struct t21; + +struct t24 +{ + int4 m0[2]; + int m1; + ulong2 m2[2]; + device t21* m3; + float2x4 m4; +}; + +struct t21 +{ + int4 m0[2]; + int m1; + ulong2 m2[2]; + device t21* m3; + float2x4 m4; +}; + +struct t35 +{ + int m0[32]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(constant t24& u24 [[buffer(0)]], constant t35& u35 [[buffer(1)]], texture2d v295 [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + int v8 = 0; + v8 |= (u24.m0[0].x - 0); + v8 |= (u24.m0[u35.m0[1]].x - 1); + v8 |= (u24.m1 - 2); + v8 |= int(u24.m4[0u][0] - 3.0); + v8 |= int(u24.m4[1u][0] - 5.0); + v8 |= int(u24.m4[0u][1] - 4.0); + v8 |= int(u24.m4[1u][1] - 6.0); + v8 |= (((device t21*)u24.m2[0].x)->m0[0].x - 3); + v8 |= (((device t21*)u24.m2[0].x)->m0[u35.m0[1]].x - 4); + v8 |= (((device t21*)u24.m2[0].x)->m1 - 5); + v8 |= int(((device t21*)u24.m2[0].x)->m4[0u][0] - 6.0); + v8 |= int(((device t21*)u24.m2[0].x)->m4[1u][0] - 8.0); + v8 |= int(((device t21*)u24.m2[0].x)->m4[0u][1] - 7.0); + v8 |= int(((device t21*)u24.m2[0].x)->m4[1u][1] - 9.0); + v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m0[0].x - 6); + v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m0[u35.m0[1]].x - 7); + v8 |= (((device t21*)u24.m2[u35.m0[1]].x)->m1 - 8); + v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][0] - 9.0); + v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][0] - 11.0); + v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[0u][1] - 10.0); + v8 |= int(((device t21*)u24.m2[u35.m0[1]].x)->m4[1u][1] - 12.0); + v8 |= (u24.m3->m0[0].x - 9); + v8 |= (u24.m3->m0[u35.m0[1]].x - 10); + v8 |= (u24.m3->m1 - 11); + v8 |= int(u24.m3->m4[0u][0] - 12.0); + v8 |= int(u24.m3->m4[1u][0] - 14.0); + v8 |= int(u24.m3->m4[0u][1] - 13.0); + v8 |= int(u24.m3->m4[1u][1] - 15.0); + uint4 v284 = select(uint4(1u, 0u, 0u, 1u), uint4(0u), bool4(v8 != 0)); + v295.write(v284, uint2(int2(gl_GlobalInvocationID.xy))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address.msl2.comp new file mode 100644 index 0000000000..f0f5ea9a65 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/buffer_device_address.msl2.comp @@ -0,0 +1,43 @@ +#include +#include + +using namespace metal; + +struct Position; +struct PositionReferences; + +struct Position +{ + float2 positions[1]; +}; + +struct Registers +{ + device PositionReferences* references; + float fract_time; +}; + +struct PositionReferences +{ + device Position* buffers[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u); + +kernel void main0(constant Registers& registers [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint2 local_offset = gl_GlobalInvocationID.xy; + uint local_index = ((local_offset.y * 8u) * gl_NumWorkGroups.x) + local_offset.x; + uint slice = gl_WorkGroupID.z; + device Position* __restrict positions = registers.references->buffers[slice]; + float offset = 6.283125400543212890625 * fract(registers.fract_time + (float(slice) * 0.100000001490116119384765625)); + float2 pos = float2(local_offset); + pos.x += (0.20000000298023223876953125 * sin((2.2000000476837158203125 * pos.x) + offset)); + pos.y += (0.20000000298023223876953125 * sin((2.25 * pos.y) + (2.0 * offset))); + pos.x += (0.20000000298023223876953125 * cos((1.7999999523162841796875 * pos.y) + (3.0 * offset))); + pos.y += (0.20000000298023223876953125 * cos((2.849999904632568359375 * pos.x) + (4.0 * offset))); + pos.x += (0.5 * sin(offset)); + pos.y += (0.5 * sin(offset + 0.300000011920928955078125)); + positions->positions[local_index] = (pos / ((float2(8.0) * float2(gl_NumWorkGroups.xy)) - float2(1.0))) - float2(0.5); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/builtins.comp b/third_party/spirv-cross/reference/shaders-msl/comp/builtins.comp new file mode 100644 index 0000000000..4f03b09980 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/builtins.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 4u, 2u); + +kernel void main0(uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + uint3 local_id = gl_LocalInvocationID; + uint3 global_id = gl_GlobalInvocationID; + uint local_index = gl_LocalInvocationIndex; + uint3 work_group_size = gl_WorkGroupSize; + uint3 num_work_groups = gl_NumWorkGroups; + uint3 work_group_id = gl_WorkGroupID; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..ce1bef3f8e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp @@ -0,0 +1,82 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +void out_test_0(thread const int& cond, thread int& i) +{ + if (cond == 0) + { + i = 40; + } + else + { + i = 60; + } +} + +static inline __attribute__((always_inline)) +void out_test_1(thread const int& cond, thread int& i) +{ + switch (cond) + { + case 40: + { + i = 40; + break; + } + default: + { + i = 70; + break; + } + } +} + +static inline __attribute__((always_inline)) +void inout_test_0(thread const int& cond, thread int& i) +{ + if (cond == 0) + { + i = 40; + } +} + +static inline __attribute__((always_inline)) +void inout_test_1(thread const int& cond, thread int& i) +{ + switch (cond) + { + case 40: + { + i = 40; + break; + } + } +} + +kernel void main0() +{ + int cond = 40; + int i = 50; + int param = cond; + int param_1 = i; + out_test_0(param, param_1); + i = param_1; + int param_2 = cond; + int param_3 = i; + out_test_1(param_2, param_3); + i = param_3; + int param_4 = cond; + int param_5 = i; + inout_test_0(param_4, param_5); + i = param_5; + int param_6 = cond; + int param_7 = i; + inout_test_1(param_6, param_7); + i = param_7; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/coherent-block.comp b/third_party/spirv-cross/reference/shaders-msl/comp/coherent-block.comp new file mode 100644 index 0000000000..58bbacb7f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/coherent-block.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 value; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(volatile device SSBO& _10 [[buffer(0)]]) +{ + _10.value = float4(20.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/coherent-image.comp b/third_party/spirv-cross/reference/shaders-msl/comp/coherent-image.comp new file mode 100644 index 0000000000..5090484464 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/coherent-image.comp @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int4 value; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(volatile device SSBO& _10 [[buffer(0)]], texture2d uImage [[texture(0)]]) +{ + _10.value = uImage.read(uint2(int2(10))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/complex-composite-constant-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/complex-composite-constant-array.comp new file mode 100644 index 0000000000..d3d15242bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/complex-composite-constant-array.comp @@ -0,0 +1,65 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct SSBO +{ + float4x4 a; + uint index; +}; + +constant spvUnsafeArray _32 = spvUnsafeArray({ float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)), float4x4(float4(2.0, 0.0, 0.0, 0.0), float4(0.0, 2.0, 0.0, 0.0), float4(0.0, 0.0, 2.0, 0.0), float4(0.0, 0.0, 0.0, 2.0)) }); + +static inline __attribute__((always_inline)) +void write_global(device SSBO& _14) +{ + _14.a = _32[_14.index]; +} + +kernel void main0(device SSBO& _14 [[buffer(0)]]) +{ + write_global(_14); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp b/third_party/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp new file mode 100644 index 0000000000..fc0d57500b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Foo0 +{ + float a; +}; + +struct Foo1 +{ + Foo0 a; +}; + +struct Foo2 +{ + Foo1 a; + float weight; +}; + +struct Foo0_1 +{ + float a; +}; + +struct Foo1_1 +{ + Foo0_1 a; +}; + +struct Foo2_1 +{ + Foo1_1 a; + float weight; +}; + +struct SSBO +{ + Foo2_1 outputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u); + +static inline __attribute__((always_inline)) +void Zero(thread Foo0& v) +{ + v.a = 0.0; +} + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + threadgroup Foo2 coeffs[64]; + Foo2 data; + data.weight = 0.0; + Foo0 param; + Zero(param); + data.a.a = param; + coeffs[gl_LocalInvocationIndex] = data; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_LocalInvocationIndex == 0u) + { + _53.outputs[gl_WorkGroupID.x].a.a.a = coeffs[0].a.a.a; + _53.outputs[gl_WorkGroupID.x].weight = coeffs[0].weight; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..0010718d34 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Data +{ + float a; + float b; +}; + +constant float X_tmp [[function_constant(0)]]; +constant float X = is_function_constant_defined(X_tmp) ? X_tmp : 4.0; + +struct Data_1 +{ + float a; + float b; +}; + +struct SSBO +{ + Data_1 outdata[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); + +constant spvUnsafeArray _25 = spvUnsafeArray({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }); + +static inline __attribute__((always_inline)) +Data combine(thread const Data& a, thread const Data& b) +{ + return Data{ a.a + b.a, a.b + b.b }; +} + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + spvUnsafeArray data = spvUnsafeArray({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }); + spvUnsafeArray _31 = spvUnsafeArray({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } }); + spvUnsafeArray data2 = _31; + Data param = data[gl_LocalInvocationID.x]; + Data param_1 = data2[gl_LocalInvocationID.x]; + Data _73 = combine(param, param_1); + _53.outdata[gl_WorkGroupID.x].a = _73.a; + _53.outdata[gl_WorkGroupID.x].b = _73.b; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.force-native-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.force-native-array.comp new file mode 100644 index 0000000000..1d451a9592 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.force-native-array.comp @@ -0,0 +1,158 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct Data +{ + float a; + float b; +}; + +constant float X_tmp [[function_constant(0)]]; +constant float X = is_function_constant_defined(X_tmp) ? X_tmp : 4.0; + +struct Data_1 +{ + float a; + float b; +}; + +struct SSBO +{ + Data_1 outdata[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); + +constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; + +static inline __attribute__((always_inline)) +Data combine(thread const Data& a, thread const Data& b) +{ + return Data{ a.a + b.a, a.b + b.b }; +} + +kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + Data data[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; + Data _31[2] = { Data{ X, 2.0 }, Data{ 3.0, 5.0 } }; + Data data2[2]; + spvArrayCopyFromStackToStack1(data2, _31); + Data param = data[gl_LocalInvocationID.x]; + Data param_1 = data2[gl_LocalInvocationID.x]; + Data _73 = combine(param, param_1); + _53.outdata[gl_WorkGroupID.x].a = _73.a; + _53.outdata[gl_WorkGroupID.x].b = _73.b; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/composite-construct.comp b/third_party/spirv-cross/reference/shaders-msl/comp/composite-construct.comp new file mode 100644 index 0000000000..808ef790e0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/composite-construct.comp @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct SSBO0 +{ + float4 as[1]; +}; + +struct SSBO1 +{ + float4 bs[1]; +}; + +struct Composite +{ + float4 a; + float4 b; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +constant spvUnsafeArray _43 = spvUnsafeArray({ float4(20.0), float4(40.0) }); + +kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + spvUnsafeArray _37 = spvUnsafeArray({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }); + spvUnsafeArray values = _37; + Composite c = Composite{ values[0], _43[1] }; + _16.as[0] = values[gl_LocalInvocationIndex]; + _32.bs[1] = c.b; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp b/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp new file mode 100644 index 0000000000..904f96abba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct BUF +{ + int a; + float b; + float c; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +constant spvUnsafeArray _16 = spvUnsafeArray({ 1.0, 2.0 }); +constant spvUnsafeArray _19 = spvUnsafeArray({ 3.0, 4.0 }); +constant spvUnsafeArray, 2> _20 = spvUnsafeArray, 2>({ spvUnsafeArray({ 1.0, 2.0 }), spvUnsafeArray({ 3.0, 4.0 }) }); +constant spvUnsafeArray, 2>, 2> _21 = spvUnsafeArray, 2>, 2>({ spvUnsafeArray, 2>({ spvUnsafeArray({ 1.0, 2.0 }), spvUnsafeArray({ 3.0, 4.0 }) }), spvUnsafeArray, 2>({ spvUnsafeArray({ 1.0, 2.0 }), spvUnsafeArray({ 3.0, 4.0 }) }) }); + +kernel void main0(device BUF& o [[buffer(0)]]) +{ + spvUnsafeArray, 2>, 2> c = _21; + o.a = int(c[1][1][1]); + spvUnsafeArray _43 = spvUnsafeArray({ o.b, o.c }); + spvUnsafeArray _48 = spvUnsafeArray({ o.b, o.b }); + spvUnsafeArray, 2> _49 = spvUnsafeArray, 2>({ _43, _48 }); + spvUnsafeArray _54 = spvUnsafeArray({ o.c, o.c }); + spvUnsafeArray _59 = spvUnsafeArray({ o.c, o.b }); + spvUnsafeArray, 2> _60 = spvUnsafeArray, 2>({ _54, _59 }); + spvUnsafeArray, 2>, 2> _61 = spvUnsafeArray, 2>, 2>({ _49, _60 }); + spvUnsafeArray, 2>, 2> d = _61; + spvUnsafeArray, 2>, 2> e = d; + o.b = e[1][0][1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp new file mode 100644 index 0000000000..0eacb269b2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp @@ -0,0 +1,364 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToStack2(thread T (&dst)[A][B], constant T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup2(threadgroup T (&dst)[A][B], constant T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToStack2(thread T (&dst)[A][B], thread const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup2(threadgroup T (&dst)[A][B], thread const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack2(thread T (&dst)[A][B], threadgroup const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup2(threadgroup T (&dst)[A][B], threadgroup const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToDevice2(device T (&dst)[A][B], device const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToDevice1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToDevice2(device T (&dst)[A][B], constant T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToDevice1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToDevice2(device T (&dst)[A][B], thread const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToDevice1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice2(device T (&dst)[A][B], threadgroup const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToDevice1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToStack2(thread T (&dst)[A][B], device const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup2(threadgroup T (&dst)[A][B], device const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToStack3(thread T (&dst)[A][B][C], constant T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup3(threadgroup T (&dst)[A][B][C], constant T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToThreadGroup2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToStack3(thread T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup3(threadgroup T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToThreadGroup2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack3(thread T (&dst)[A][B][C], threadgroup const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup3(threadgroup T (&dst)[A][B][C], threadgroup const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToThreadGroup2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToDevice3(device T (&dst)[A][B][C], device const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToDevice2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToDevice3(device T (&dst)[A][B][C], constant T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToDevice2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToDevice3(device T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToDevice2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice3(device T (&dst)[A][B][C], threadgroup const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToDevice2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToStack3(thread T (&dst)[A][B][C], device const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup3(threadgroup T (&dst)[A][B][C], device const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromDeviceToThreadGroup2(dst[i], src[i]); + } +} + +struct BUF +{ + int a; + float b; + float c; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +constant float _16[2] = { 1.0, 2.0 }; +constant float _19[2] = { 3.0, 4.0 }; +constant float _20[2][2] = { { 1.0, 2.0 }, { 3.0, 4.0 } }; +constant float _21[2][2][2] = { { { 1.0, 2.0 }, { 3.0, 4.0 } }, { { 1.0, 2.0 }, { 3.0, 4.0 } } }; + +kernel void main0(device BUF& o [[buffer(0)]]) +{ + float c[2][2][2]; + spvArrayCopyFromConstantToStack3(c, _21); + o.a = int(c[1][1][1]); + float _43[2] = { o.b, o.c }; + float _48[2] = { o.b, o.b }; + float _49[2][2] = { { _43[0], _43[1] }, { _48[0], _48[1] } }; + float _54[2] = { o.c, o.c }; + float _59[2] = { o.c, o.b }; + float _60[2][2] = { { _54[0], _54[1] }, { _59[0], _59[1] } }; + float _61[2][2][2] = { { { _49[0][0], _49[0][1] }, { _49[1][0], _49[1][1] } }, { { _60[0][0], _60[0][1] }, { _60[1][0], _60[1][1] } } }; + float d[2][2][2]; + spvArrayCopyFromStackToStack3(d, _61); + float e[2][2][2]; + spvArrayCopyFromStackToStack3(e, d); + o.b = e[1][0][1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp b/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp new file mode 100644 index 0000000000..13578363b7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/culling.comp @@ -0,0 +1,36 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct SSBO +{ + float in_data[1]; +}; + +struct SSBO2 +{ + float out_data[1]; +}; + +struct SSBO3 +{ + uint count; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float idata = _22.in_data[ident]; + if (idata > 12.0) + { + uint _45 = atomic_fetch_add_explicit((device atomic_uint*)&_41.count, 1u, memory_order_relaxed); + _38.out_data[_45] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/defer-parens.comp b/third_party/spirv-cross/reference/shaders-msl/comp/defer-parens.comp new file mode 100644 index 0000000000..9a567fa6eb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/defer-parens.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 data; + int index; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _13 [[buffer(0)]]) +{ + float4 d = _13.data; + _13.data = float4(d.x, d.yz + float2(10.0), d.w); + _13.data = (d + d) + d; + _13.data = (d.yz + float2(10.0)).xxyy; + float t = (d.yz + float2(10.0)).y; + _13.data = float4(t); + t = (d.zw + float2(10.0))[_13.index]; + _13.data = float4(t); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp b/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp new file mode 100644 index 0000000000..2b4de9ebb7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/dowhile.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4x4 mvp; + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + int i = 0; + float4 idat = _28.in_data[ident]; + do + { + idat = _28.mvp * idat; + i++; + } while (i < 16); + _52.out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/force-recompile-hooks.swizzle.comp b/third_party/spirv-cross/reference/shaders-msl/comp/force-recompile-hooks.swizzle.comp new file mode 100644 index 0000000000..856efeabaf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/force-recompile-hooks.swizzle.comp @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +kernel void main0(constant uint* spvSwizzleConstants [[buffer(30)]], texture2d foo [[texture(0)]], texture2d bar [[texture(1)]], sampler fooSmplr [[sampler(0)]]) +{ + constant uint& fooSwzl = spvSwizzleConstants[0]; + float4 a = spvTextureSwizzle(foo.sample(fooSmplr, float2(1.0), level(0.0)), fooSwzl); + bar.write(a, uint2(int2(0))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/functions.comp b/third_party/spirv-cross/reference/shaders-msl/comp/functions.comp new file mode 100644 index 0000000000..b107260878 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/functions.comp @@ -0,0 +1,19 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +void myfunc(threadgroup int (&foo)[1337]) +{ + foo[0] = 13; +} + +kernel void main0() +{ + threadgroup int foo[1337]; + myfunc(foo); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp b/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp new file mode 100644 index 0000000000..f6b8845343 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +static inline __attribute__((always_inline)) +float getB(device myBlock& myStorage, thread uint3& gl_GlobalInvocationID) +{ + return myStorage.b[gl_GlobalInvocationID.x]; +} + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod(getB(myStorage, gl_GlobalInvocationID) + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp b/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp new file mode 100644 index 0000000000..333485a256 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod(myStorage.b[gl_GlobalInvocationID.x] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp new file mode 100644 index 0000000000..24a6c04841 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct SSBO +{ + float4 outdata; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +struct spvDescriptorSetBuffer0 +{ + texture2d uImage [[id(0)]]; + device atomic_uint* uImage_atomic [[id(1)]]; + device SSBO* m_31 [[id(2)]]; + texture2d uTexture [[id(3)]]; + sampler uTextureSmplr [[id(4)]]; +}; + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _26 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.uImage_atomic[spvImage2DAtomicCoord(int2(gl_GlobalInvocationID.xy), spvDescriptorSet0.uImage)], 10u, memory_order_relaxed); + uint ret = _26; + (*spvDescriptorSet0.m_31).outdata = spvDescriptorSet0.uTexture.sample(spvDescriptorSet0.uTextureSmplr, float2(gl_GlobalInvocationID.xy), level(0.0)) + float4(float(ret)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.comp b/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.comp new file mode 100644 index 0000000000..60d5421e56 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/image-atomic-automatic-bindings.comp @@ -0,0 +1,29 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct SSBO +{ + float4 outdata; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _31 [[buffer(1)]], texture2d uImage [[texture(0)]], device atomic_uint* uImage_atomic [[buffer(0)]], texture2d uTexture [[texture(1)]], sampler uTextureSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint _26 = atomic_fetch_add_explicit((device atomic_uint*)&uImage_atomic[spvImage2DAtomicCoord(int2(gl_GlobalInvocationID.xy), uImage)], 10u, memory_order_relaxed); + uint ret = _26; + _31.outdata = uTexture.sample(uTextureSmplr, float2(gl_GlobalInvocationID.xy), level(0.0)) + float4(float(ret)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/image-cube-array-load-store.comp b/third_party/spirv-cross/reference/shaders-msl/comp/image-cube-array-load-store.comp new file mode 100644 index 0000000000..c0b83c46c8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/image-cube-array-load-store.comp @@ -0,0 +1,14 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(texturecube_array uImageIn [[texture(0)]], texturecube_array uImageOut [[texture(1)]]) +{ + int3 coord = int3(9, 7, 11); + float4 indata = uImageIn.read(uint2(coord.xy), uint(coord.z) % 6u, uint(coord.z) / 6u); + uImageOut.write(indata, uint2(coord.xy), uint(coord.z) % 6u, uint(coord.z) / 6u); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/image.comp b/third_party/spirv-cross/reference/shaders-msl/comp/image.comp new file mode 100644 index 0000000000..e7c9c763a3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/image.comp @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(texture2d uImageIn [[texture(0)]], texture2d uImageOut [[texture(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 v = uImageIn.read(uint2((int2(gl_GlobalInvocationID.xy) + int2(uImageIn.get_width(), uImageIn.get_height())))); + uImageOut.write(v, uint2(int2(gl_GlobalInvocationID.xy))); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/insert.comp b/third_party/spirv-cross/reference/shaders-msl/comp/insert.comp new file mode 100644 index 0000000000..c4611ba222 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/insert.comp @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float4 v; + v.x = 10.0; + v.y = 30.0; + v.z = 70.0; + v.w = 90.0; + _27.out_data[gl_GlobalInvocationID.x] = v; + ((device float*)&_27.out_data[gl_GlobalInvocationID.x])[1u] = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp b/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp new file mode 100644 index 0000000000..0a1d298b0d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/inverse.comp @@ -0,0 +1,130 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns the determinant of a 2x2 matrix. +static inline __attribute__((always_inline)) +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the determinant of a 3x3 matrix. +static inline __attribute__((always_inline)) +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float4x4 spvInverse4x4(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float3x3 spvInverse3x3(float3x3 m) +{ + float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet2x2(m[1][1], m[1][2], m[2][1], m[2][2]); + adj[0][1] = -spvDet2x2(m[0][1], m[0][2], m[2][1], m[2][2]); + adj[0][2] = spvDet2x2(m[0][1], m[0][2], m[1][1], m[1][2]); + + adj[1][0] = -spvDet2x2(m[1][0], m[1][2], m[2][0], m[2][2]); + adj[1][1] = spvDet2x2(m[0][0], m[0][2], m[2][0], m[2][2]); + adj[1][2] = -spvDet2x2(m[0][0], m[0][2], m[1][0], m[1][2]); + + adj[2][0] = spvDet2x2(m[1][0], m[1][1], m[2][0], m[2][1]); + adj[2][1] = -spvDet2x2(m[0][0], m[0][1], m[2][0], m[2][1]); + adj[2][2] = spvDet2x2(m[0][0], m[0][1], m[1][0], m[1][1]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float2x2 spvInverse2x2(float2x2 m) +{ + float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = m[1][1]; + adj[0][1] = -m[0][1]; + + adj[1][0] = -m[1][0]; + adj[1][1] = m[0][0]; + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +struct MatrixOut +{ + float2x2 m2out; + float3x3 m3out; + float4x4 m4out; +}; + +struct MatrixIn +{ + float2x2 m2in; + float3x3 m3in; + float4x4 m4in; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device MatrixOut& _15 [[buffer(0)]], const device MatrixIn& _20 [[buffer(1)]]) +{ + _15.m2out = spvInverse2x2(_20.m2in); + _15.m3out = spvInverse3x3(_20.m3in); + _15.m4out = spvInverse4x4(_20.m4in); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp b/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp new file mode 100644 index 0000000000..4505990588 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationID.x] = mod(myStorage.b[gl_LocalInvocationID.x] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp b/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp new file mode 100644 index 0000000000..67426dd3f6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b[1]; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationIndex] = mod(myStorage.b[gl_LocalInvocationIndex] + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/local-size-duplicate-spec-id.comp b/third_party/spirv-cross/reference/shaders-msl/comp/local-size-duplicate-spec-id.comp new file mode 100644 index 0000000000..9e8e901ae5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/local-size-duplicate-spec-id.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct StorageBuffer +{ + uint values[1]; +}; + +constant int local_size_x_val_tmp [[function_constant(0)]]; +constant int local_size_x_val = is_function_constant_defined(local_size_x_val_tmp) ? local_size_x_val_tmp : 1; +constant int local_size_y_val_tmp [[function_constant(1)]]; +constant int local_size_y_val = is_function_constant_defined(local_size_y_val_tmp) ? local_size_y_val_tmp : 1; +constant int local_size_z_val_tmp [[function_constant(2)]]; +constant int local_size_z_val = is_function_constant_defined(local_size_z_val_tmp) ? local_size_z_val_tmp : 1; +constant uint _22 = is_function_constant_defined(local_size_x_val_tmp) ? uint(local_size_x_val_tmp) : 1u; +constant uint _23 = is_function_constant_defined(local_size_y_val_tmp) ? uint(local_size_y_val_tmp) : 1u; +constant uint _24 = is_function_constant_defined(local_size_z_val_tmp) ? uint(local_size_z_val_tmp) : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, _23, _24); + +kernel void main0(device StorageBuffer& ssbo [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + ssbo.values[gl_LocalInvocationIndex] = 1u; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/mat3-row-maj-read-write-const.comp b/third_party/spirv-cross/reference/shaders-msl/comp/mat3-row-maj-read-write-const.comp new file mode 100644 index 0000000000..3de0ef44f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/mat3-row-maj-read-write-const.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct model_t +{ + float3x3 mtx_rm; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device model_t& model [[buffer(0)]]) +{ + float3x3 mtx_cm = transpose(model.mtx_rm); + float3x3 mtx1 = mtx_cm * float3x3(float3(4.0, -3.0, 1.0), float3(-7.0, 7.0, -7.0), float3(-5.0, 6.0, -8.0)); + if (mtx1[0].x != 0.0) + { + model.mtx_rm = transpose(float3x3(float3(-5.0, -3.0, -5.0), float3(-2.0, 2.0, -5.0), float3(6.0, 3.0, -8.0))); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/mat3.comp b/third_party/spirv-cross/reference/shaders-msl/comp/mat3.comp new file mode 100644 index 0000000000..fcb8f7a60f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/mat3.comp @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float3x3 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + _22.out_data[ident] = float3x3(float3(10.0), float3(20.0), float3(40.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp b/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp new file mode 100644 index 0000000000..9c43d7321b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/mod.comp @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float4 v = mod(_23.in_data[ident], _33.out_data[ident]); + _33.out_data[ident] = v; + uint4 vu = as_type(_23.in_data[ident]) % as_type(_33.out_data[ident]); + _33.out_data[ident] = as_type(vu); + int4 vi = as_type(_23.in_data[ident]) % as_type(_33.out_data[ident]); + _33.out_data[ident] = as_type(vi); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp b/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp new file mode 100644 index 0000000000..5a5ac3dbd7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/modf.comp @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float4 i; + float4 _31 = modf(_23.in_data[ident], i); + float4 v = _31; + _35.out_data[ident] = v; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp b/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp new file mode 100644 index 0000000000..e589642dbd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/outer-product.comp @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float2x2 m22; + float2x3 m23; + float2x4 m24; + float3x2 m32; + float3x3 m33; + float3x4 m34; + float4x2 m42; + float4x3 m43; + float4x4 m44; +}; + +struct ReadSSBO +{ + float2 v2; + float3 v3; + float4 v4; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _21 [[buffer(0)]], const device ReadSSBO& _26 [[buffer(1)]]) +{ + _21.m22 = float2x2(_26.v2 * _26.v2.x, _26.v2 * _26.v2.y); + _21.m23 = float2x3(_26.v3 * _26.v2.x, _26.v3 * _26.v2.y); + _21.m24 = float2x4(_26.v4 * _26.v2.x, _26.v4 * _26.v2.y); + _21.m32 = float3x2(_26.v2 * _26.v3.x, _26.v2 * _26.v3.y, _26.v2 * _26.v3.z); + _21.m33 = float3x3(_26.v3 * _26.v3.x, _26.v3 * _26.v3.y, _26.v3 * _26.v3.z); + _21.m34 = float3x4(_26.v4 * _26.v3.x, _26.v4 * _26.v3.y, _26.v4 * _26.v3.z); + _21.m42 = float4x2(_26.v2 * _26.v4.x, _26.v2 * _26.v4.y, _26.v2 * _26.v4.z, _26.v2 * _26.v4.w); + _21.m43 = float4x3(_26.v3 * _26.v4.x, _26.v3 * _26.v4.y, _26.v3 * _26.v4.z, _26.v3 * _26.v4.w); + _21.m44 = float4x4(_26.v4 * _26.v4.x, _26.v4 * _26.v4.y, _26.v4 * _26.v4.z, _26.v4 * _26.v4.w); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-1.comp b/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-1.comp new file mode 100644 index 0000000000..61297429a6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-1.comp @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct T1 +{ + float3 a; + float b; +}; + +struct T1_1 +{ + packed_float3 a; + float b; +}; + +struct Buffer0 +{ + T1_1 buf0[1]; +}; + +struct Buffer1 +{ + float buf1[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u); + +kernel void main0(device Buffer0& _15 [[buffer(0)]], device Buffer1& _34 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + T1 v; + v.a = float3(_15.buf0[0].a); + v.b = _15.buf0[0].b; + float x = v.b; + _34.buf1[gl_GlobalInvocationID.x] = x; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-2.comp new file mode 100644 index 0000000000..4b91f3ca93 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/packing-test-2.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct T1 +{ + packed_float3 a; + float b; +}; + +struct Buffer0 +{ + T1 buf0[1]; +}; + +struct Buffer1 +{ + float buf1[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(32u, 1u, 1u); + +kernel void main0(device Buffer0& _14 [[buffer(0)]], device Buffer1& _24 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + float x = _14.buf0[0].b; + _24.buf1[gl_GlobalInvocationID.x] = x; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp new file mode 100644 index 0000000000..dd3f7c3e0c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp @@ -0,0 +1,142 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO_A +{ + float data[1]; +}; + +struct UBO_C +{ + float4 data[1024]; +}; + +struct Registers +{ + float reg; +}; + +struct SSBO_B +{ + uint2 data[1]; +}; + +struct UBO_D +{ + uint4 data[1024]; +}; + +struct SSBO_BRO +{ + uint2 data[1]; +}; + +struct SSBO_As +{ + float data[1]; +}; + +struct UBO_Cs +{ + float4 data[1024]; +}; + +struct SSBO_Bs +{ + uint2 data[1024]; +}; + +struct UBO_Ds +{ + uint4 data[1024]; +}; + +struct SSBO_BsRO +{ + uint2 data[1024]; +}; + +struct SSBO_E +{ + float data[1]; +}; + +struct UBO_G +{ + float4 data[1024]; +}; + +struct SSBO_F +{ + uint2 data[1]; +}; + +struct UBO_H +{ + uint4 data[1024]; +}; + +struct SSBO_I +{ + uint2 data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO_A* ssbo_a [[id(0)]]; + constant UBO_C* ubo_c [[id(1)]]; + device SSBO_As* ssbo_as [[id(2)]][4]; + constant UBO_Cs* ubo_cs [[id(6)]][4]; +}; + +static inline __attribute__((always_inline)) +void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, const device SSBO_BRO& ssbo_b_readonly) +{ + ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x].x + _42.reg; + ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; +} + +static inline __attribute__((always_inline)) +void func1(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_As* const device (&ssbo_as)[4], constant UBO_Cs* const device (&ubo_cs)[4]) +{ + ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_cs[gl_WorkGroupID.x]->data[0].x; +} + +static inline __attribute__((always_inline)) +void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* const device (&ssbo_bs)[4], constant UBO_Ds* const device (&ubo_ds)[4], const device SSBO_BsRO* const device (&ssbo_bs_readonly)[4]) +{ + ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; +} + +static inline __attribute__((always_inline)) +void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, const device SSBO_I& ssbo_i) +{ + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; +} + +kernel void main0(const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding0 [[buffer(2)]], constant void* spvBufferAliasSet2Binding1 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding0; + constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; + device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; + constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; + const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_b = (device SSBO_B&)(*spvDescriptorSet0.ssbo_a); + constant auto& ubo_d = (constant UBO_D&)(*spvDescriptorSet0.ubo_c); + const device auto& ssbo_b_readonly = (const device SSBO_BRO&)(*spvDescriptorSet0.ssbo_a); + const device auto& ssbo_bs = (device SSBO_Bs* const device (&)[4])spvDescriptorSet0.ssbo_as; + const device auto& ubo_ds = (constant UBO_Ds* const device (&)[4])spvDescriptorSet0.ubo_cs; + const device auto& ssbo_bs_readonly = (const device SSBO_BsRO* const device (&)[4])spvDescriptorSet0.ssbo_as; + func0((*spvDescriptorSet0.ssbo_a), gl_GlobalInvocationID, (*spvDescriptorSet0.ubo_c), gl_WorkGroupID, _42, ssbo_b, ubo_d, ssbo_b_readonly); + func1(gl_GlobalInvocationID, gl_WorkGroupID, spvDescriptorSet0.ssbo_as, spvDescriptorSet0.ubo_cs); + func2(gl_GlobalInvocationID, gl_WorkGroupID, ssbo_bs, ubo_ds, ssbo_bs_readonly); + func3(gl_GlobalInvocationID, gl_WorkGroupID, ssbo_e, ubo_g, ssbo_f, ubo_h, ssbo_i); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp new file mode 100644 index 0000000000..f04671642e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp @@ -0,0 +1,142 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO_A +{ + float data[1]; +}; + +struct UBO_C +{ + float4 data[1024]; +}; + +struct Registers +{ + float reg; +}; + +struct SSBO_B +{ + uint2 data[1]; +}; + +struct UBO_D +{ + uint4 data[1024]; +}; + +struct SSBO_BRO +{ + uint2 data[1]; +}; + +struct SSBO_As +{ + float data[1]; +}; + +struct UBO_Cs +{ + float4 data[1024]; +}; + +struct SSBO_Bs +{ + uint2 data[1024]; +}; + +struct UBO_Ds +{ + uint4 data[1024]; +}; + +struct SSBO_BsRO +{ + uint2 data[1024]; +}; + +struct SSBO_E +{ + float data[1]; +}; + +struct UBO_G +{ + float4 data[1024]; +}; + +struct SSBO_F +{ + uint2 data[1]; +}; + +struct UBO_H +{ + uint4 data[1024]; +}; + +struct SSBO_I +{ + uint2 data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(64u, 1u, 1u); + +struct spvDescriptorSetBuffer0 +{ + device SSBO_A* ssbo_a [[id(0)]]; + constant UBO_C* ubo_c [[id(1)]]; + device SSBO_As* ssbo_as [[id(2)]][4]; + constant UBO_Cs* ubo_cs [[id(6)]][4]; +}; + +static inline __attribute__((always_inline)) +void func0(device SSBO_A& ssbo_a, thread uint3& gl_GlobalInvocationID, constant UBO_C& ubo_c, thread uint3& gl_WorkGroupID, constant Registers& _42, device SSBO_B& ssbo_b, constant UBO_D& ubo_d, const device SSBO_BRO& ssbo_b_readonly) +{ + ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x].x + _42.reg; + ssbo_b.data[gl_GlobalInvocationID.x] = ubo_d.data[gl_WorkGroupID.y].xy + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; +} + +static inline __attribute__((always_inline)) +void func1(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_As* constant (&ssbo_as)[4], constant UBO_Cs* constant (&ubo_cs)[4]) +{ + ssbo_as[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_cs[gl_WorkGroupID.x]->data[0].x; +} + +static inline __attribute__((always_inline)) +void func2(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_Bs* constant (&ssbo_bs)[4], constant UBO_Ds* constant (&ubo_ds)[4], const device SSBO_BsRO* constant (&ssbo_bs_readonly)[4]) +{ + ssbo_bs[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x] = ubo_ds[gl_WorkGroupID.x]->data[0].xy + ssbo_bs_readonly[gl_WorkGroupID.x]->data[gl_GlobalInvocationID.x]; +} + +static inline __attribute__((always_inline)) +void func3(thread uint3& gl_GlobalInvocationID, thread uint3& gl_WorkGroupID, device SSBO_E& ssbo_e, constant UBO_G& ubo_g, device SSBO_F& ssbo_f, constant UBO_H& ubo_h, const device SSBO_I& ssbo_i) +{ + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x].x; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y].xy + ssbo_i.data[gl_GlobalInvocationID.x]; +} + +kernel void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant Registers& _42 [[buffer(1)]], device void* spvBufferAliasSet2Binding0 [[buffer(2)]], constant void* spvBufferAliasSet2Binding1 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]]) +{ + device auto& ssbo_e = *(device SSBO_E*)spvBufferAliasSet2Binding0; + constant auto& ubo_g = *(constant UBO_G*)spvBufferAliasSet2Binding1; + device auto& ssbo_f = *(device SSBO_F*)spvBufferAliasSet2Binding0; + constant auto& ubo_h = *(constant UBO_H*)spvBufferAliasSet2Binding1; + const device auto& ssbo_i = *(const device SSBO_I*)spvBufferAliasSet2Binding0; + device auto& ssbo_b = (device SSBO_B&)(*spvDescriptorSet0.ssbo_a); + constant auto& ubo_d = (constant UBO_D&)(*spvDescriptorSet0.ubo_c); + const device auto& ssbo_b_readonly = (const device SSBO_BRO&)(*spvDescriptorSet0.ssbo_a); + constant auto& ssbo_bs = (device SSBO_Bs* constant (&)[4])spvDescriptorSet0.ssbo_as; + constant auto& ubo_ds = (constant UBO_Ds* constant (&)[4])spvDescriptorSet0.ubo_cs; + constant auto& ssbo_bs_readonly = (const device SSBO_BsRO* constant (&)[4])spvDescriptorSet0.ssbo_as; + func0((*spvDescriptorSet0.ssbo_a), gl_GlobalInvocationID, (*spvDescriptorSet0.ubo_c), gl_WorkGroupID, _42, ssbo_b, ubo_d, ssbo_b_readonly); + func1(gl_GlobalInvocationID, gl_WorkGroupID, spvDescriptorSet0.ssbo_as, spvDescriptorSet0.ubo_cs); + func2(gl_GlobalInvocationID, gl_WorkGroupID, ssbo_bs, ubo_ds, ssbo_bs_readonly); + func3(gl_GlobalInvocationID, gl_WorkGroupID, ssbo_e, ubo_g, ssbo_f, ubo_h, ssbo_i); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp b/third_party/spirv-cross/reference/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp new file mode 100644 index 0000000000..dde7f47b08 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp @@ -0,0 +1,71 @@ +#include +#include +#if __METAL_VERSION__ >= 230 +#include +using namespace metal::raytracing; +#endif + +using namespace metal; + +struct Params +{ + uint ray_flags; + uint cull_mask; + char _m2_pad[8]; + packed_float3 origin; + float tmin; + packed_float3 dir; + float tmax; + float thit; +}; + +kernel void main0(constant Params& _18 [[buffer(1)]], raytracing::acceleration_structure AS0 [[buffer(0)]], raytracing::acceleration_structure AS1 [[buffer(2)]]) +{ + raytracing::intersection_query q; + q.reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS0, intersection_params()); + raytracing::intersection_query q2[2]; + q2[1].reset(ray(_18.origin, _18.dir, _18.tmin, _18.tmax), AS1, intersection_params()); + bool _63 = q.next(); + bool res = _63; + q2[0].abort(); + q.commit_bounding_box_intersection(_18.thit); + q2[1].commit_triangle_intersection(); + float _71 = q.get_ray_min_distance(); + float fval = _71; + float3 _74 = q.get_world_space_ray_direction(); + float3 fvals = _74; + float3 _75 = q.get_world_space_ray_origin(); + fvals = _75; + uint _80 = uint(q2[1].get_committed_intersection_type()); + uint type = _80; + uint _83 = uint(q2[0].get_candidate_intersection_type()) - 1; + type = _83; + bool _85 = q2[1].is_candidate_non_opaque_bounding_box(); + res = _85; + float _87 = q2[1].get_committed_distance(); + fval = _87; + float _89 = q2[1].get_candidate_triangle_distance(); + fval = _89; + int _92 = q.get_committed_user_instance_id(); + int ival = _92; + int _94 = q2[0].get_candidate_instance_id(); + ival = _94; + int _96 = q2[1].get_candidate_geometry_id(); + ival = _96; + int _97 = q.get_committed_primitive_id(); + ival = _97; + float2 _100 = q2[0].get_candidate_triangle_barycentric_coord(); + fvals.x = _100.x; + fvals.y = _100.y; + bool _107 = q.is_committed_triangle_front_facing(); + res = _107; + float3 _108 = q.get_candidate_ray_direction(); + fvals = _108; + float3 _110 = q2[0].get_committed_ray_origin(); + fvals = _110; + float4x3 _114 = q.get_candidate_object_to_world_transform(); + float4x3 matrices = _114; + float4x3 _116 = q2[1].get_committed_world_to_object_transform(); + matrices = _116; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp b/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp new file mode 100644 index 0000000000..0cf8d8e321 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/read-write-only.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + float4 data4; + float4 data5; +}; + +struct SSBO0 +{ + float4 data0; + float4 data1; +}; + +struct SSBO1 +{ + float4 data2; + float4 data3; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _10 [[buffer(0)]], const device SSBO0& _15 [[buffer(1)]], device SSBO1& _21 [[buffer(2)]]) +{ + _10.data4 = _15.data0 + _21.data2; + _10.data5 = _15.data1 + _21.data3; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/shaders-msl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..b53a3a75c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/rmw-matrix.comp @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; + float4 b; + float4x4 c; + float a1; + float4 b1; + float4x4 c1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _11 [[buffer(0)]]) +{ + _11.a *= _11.a1; + _11.b *= _11.b1; + _11.c = _11.c * _11.c1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/rmw-opt.comp b/third_party/spirv-cross/reference/shaders-msl/comp/rmw-opt.comp new file mode 100644 index 0000000000..229154fc21 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/rmw-opt.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int a; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]]) +{ + _9.a += 10; + _9.a -= 10; + _9.a *= 10; + _9.a /= 10; + _9.a = _9.a << 2; + _9.a = _9.a >> 3; + _9.a &= 40; + _9.a ^= 10; + _9.a %= 40; + _9.a |= 1; + bool c = false; + bool d = true; + c = c && d; + d = d || c; + _9.a = int(c && d); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/shaders-msl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..9bf8781774 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float a; + float b; + float c; + float d; + float e; + float f; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _9 [[buffer(0)]]) +{ + _9.c = abs(_9.a - _9.b); + _9.d = abs(_9.a); + _9.e = sign(_9.a); + _9.f = abs((_9.a - 1.0) - (_9.b - 2.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..62c4bb0547 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + float out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u); + +static inline __attribute__((always_inline)) +void work(threadgroup float (&foo)[4][4], thread uint3& gl_LocalInvocationID, thread uint& gl_LocalInvocationIndex, device SSBO& _67, thread uint3& gl_GlobalInvocationID) +{ + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + threadgroup_barrier(mem_flags::mem_threadgroup); + float x = 0.0; + x += foo[gl_LocalInvocationID.x][0]; + x += foo[gl_LocalInvocationID.x][1]; + x += foo[gl_LocalInvocationID.x][2]; + x += foo[gl_LocalInvocationID.x][3]; + _67.out_data[gl_GlobalInvocationID.x] = x; +} + +kernel void main0(device SSBO& _67 [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup float foo[4][4]; + work(foo, gl_LocalInvocationID, gl_LocalInvocationIndex, _67, gl_GlobalInvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-array-of-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-array-of-array.comp new file mode 100644 index 0000000000..173b31cde6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-array-of-array.comp @@ -0,0 +1,1286 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + spvStorage_float4x3 a[2]; + float b; + spvUnsafeArray c; +}; + +struct S2 +{ + int4 a; + spvUnsafeArray, 1>, 3> b; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +bool compare_float(thread const float& a, thread const float& b) +{ + return abs(a - b) < 0.0500000007450580596923828125; +} + +static inline __attribute__((always_inline)) +bool compare_vec3(thread const float3& a, thread const float3& b) +{ + float param = a.x; + float param_1 = b.x; + bool _85 = compare_float(param, param_1); + bool _95; + if (_85) + { + float param_2 = a.y; + float param_3 = b.y; + _95 = compare_float(param_2, param_3); + } + else + { + _95 = _85; + } + bool _106; + if (_95) + { + float param_4 = a.z; + float param_5 = b.z; + _106 = compare_float(param_4, param_5); + } + else + { + _106 = _95; + } + return _106; +} + +static inline __attribute__((always_inline)) +bool compare_mat4x3(thread const float4x3& a, thread const float4x3& b) +{ + float3 param = a[0]; + float3 param_1 = b[0]; + bool _116 = compare_vec3(param, param_1); + bool _127; + if (_116) + { + float3 param_2 = a[1]; + float3 param_3 = b[1]; + _127 = compare_vec3(param_2, param_3); + } + else + { + _127 = _116; + } + bool _138; + if (_127) + { + float3 param_4 = a[2]; + float3 param_5 = b[2]; + _138 = compare_vec3(param_4, param_5); + } + else + { + _138 = _127; + } + bool _149; + if (_138) + { + float3 param_6 = a[3]; + float3 param_7 = b[3]; + _149 = compare_vec3(param_6, param_7); + } + else + { + _149 = _138; + } + return _149; +} + +static inline __attribute__((always_inline)) +bool compare_vec2(thread const float2& a, thread const float2& b) +{ + float param = a.x; + float param_1 = b.x; + bool _65 = compare_float(param, param_1); + bool _76; + if (_65) + { + float param_2 = a.y; + float param_3 = b.y; + _76 = compare_float(param_2, param_3); + } + else + { + _76 = _65; + } + return _76; +} + +static inline __attribute__((always_inline)) +bool compare_ivec4(thread const int4& a, thread const int4& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_bool(thread const bool& a, thread const bool& b) +{ + return a == b; +} + +kernel void main0(device block& _383 [[buffer(0)]]) +{ + threadgroup S1 s1; + threadgroup S2 s2; + s1.a[0] = spvStorage_float4x3(float4x3(float3(0.0, 2.0, -8.0), float3(6.0, 7.0, 5.0), float3(-6.0, 1.0, 9.0), float3(-4.0, -3.0, 4.0))); + s1.a[1] = spvStorage_float4x3(float4x3(float3(4.0, 9.0, -9.0), float3(-8.0, -9.0, 8.0), float3(0.0, 4.0, -4.0), float3(7.0, 2.0, -1.0))); + s1.b = 7.0; + s1.c[0] = float2(-5.0, -4.0); + s1.c[1] = float2(3.0, -5.0); + s1.c[2] = float2(-3.0, -1.0); + s2.a = int4(1, 0, -3, 1); + s2.b[0][0][0] = short(true); + s2.b[0][0][1] = short(false); + s2.b[0][0][2] = short(false); + s2.b[1][0][0] = short(true); + s2.b[1][0][1] = short(false); + s2.b[1][0][2] = short(true); + s2.b[2][0][0] = short(false); + s2.b[2][0][1] = short(true); + s2.b[2][0][2] = short(true); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool allOk = true; + bool _242; + if (allOk) + { + float4x3 param = float4x3(float3(0.0, 2.0, -8.0), float3(6.0, 7.0, 5.0), float3(-6.0, 1.0, 9.0), float3(-4.0, -3.0, 4.0)); + float4x3 param_1 = float4x3(s1.a[0]); + _242 = compare_mat4x3(param, param_1); + } + else + { + _242 = allOk; + } + allOk = _242; + bool _251; + if (allOk) + { + float4x3 param_2 = float4x3(float3(4.0, 9.0, -9.0), float3(-8.0, -9.0, 8.0), float3(0.0, 4.0, -4.0), float3(7.0, 2.0, -1.0)); + float4x3 param_3 = float4x3(s1.a[1]); + _251 = compare_mat4x3(param_2, param_3); + } + else + { + _251 = allOk; + } + allOk = _251; + bool _260; + if (allOk) + { + float param_4 = 7.0; + float param_5 = s1.b; + _260 = compare_float(param_4, param_5); + } + else + { + _260 = allOk; + } + allOk = _260; + bool _269; + if (allOk) + { + float2 param_6 = float2(-5.0, -4.0); + float2 param_7 = s1.c[0]; + _269 = compare_vec2(param_6, param_7); + } + else + { + _269 = allOk; + } + allOk = _269; + bool _278; + if (allOk) + { + float2 param_8 = float2(3.0, -5.0); + float2 param_9 = s1.c[1]; + _278 = compare_vec2(param_8, param_9); + } + else + { + _278 = allOk; + } + allOk = _278; + bool _287; + if (allOk) + { + float2 param_10 = float2(-3.0, -1.0); + float2 param_11 = s1.c[2]; + _287 = compare_vec2(param_10, param_11); + } + else + { + _287 = allOk; + } + allOk = _287; + bool _296; + if (allOk) + { + int4 param_12 = int4(1, 0, -3, 1); + int4 param_13 = s2.a; + _296 = compare_ivec4(param_12, param_13); + } + else + { + _296 = allOk; + } + allOk = _296; + bool _305; + if (allOk) + { + bool param_14 = true; + bool param_15 = bool(s2.b[0][0][0]); + _305 = compare_bool(param_14, param_15); + } + else + { + _305 = allOk; + } + allOk = _305; + bool _314; + if (allOk) + { + bool param_16 = false; + bool param_17 = bool(s2.b[0][0][1]); + _314 = compare_bool(param_16, param_17); + } + else + { + _314 = allOk; + } + allOk = _314; + bool _323; + if (allOk) + { + bool param_18 = false; + bool param_19 = bool(s2.b[0][0][2]); + _323 = compare_bool(param_18, param_19); + } + else + { + _323 = allOk; + } + allOk = _323; + bool _332; + if (allOk) + { + bool param_20 = true; + bool param_21 = bool(s2.b[1][0][0]); + _332 = compare_bool(param_20, param_21); + } + else + { + _332 = allOk; + } + allOk = _332; + bool _341; + if (allOk) + { + bool param_22 = false; + bool param_23 = bool(s2.b[1][0][1]); + _341 = compare_bool(param_22, param_23); + } + else + { + _341 = allOk; + } + allOk = _341; + bool _350; + if (allOk) + { + bool param_24 = true; + bool param_25 = bool(s2.b[1][0][2]); + _350 = compare_bool(param_24, param_25); + } + else + { + _350 = allOk; + } + allOk = _350; + bool _359; + if (allOk) + { + bool param_26 = false; + bool param_27 = bool(s2.b[2][0][0]); + _359 = compare_bool(param_26, param_27); + } + else + { + _359 = allOk; + } + allOk = _359; + bool _368; + if (allOk) + { + bool param_28 = true; + bool param_29 = bool(s2.b[2][0][1]); + _368 = compare_bool(param_28, param_29); + } + else + { + _368 = allOk; + } + allOk = _368; + bool _377; + if (allOk) + { + bool param_30 = true; + bool param_31 = bool(s2.b[2][0][2]); + _377 = compare_bool(param_30, param_31); + } + else + { + _377 = allOk; + } + allOk = _377; + if (allOk) + { + _383.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-cast.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-cast.comp new file mode 100644 index 0000000000..c764c1fdbd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-cast.comp @@ -0,0 +1,1065 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + float4 a; + spvStorage_float3x2 b; + short4 c; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +bool compare_float(thread const float& a, thread const float& b) +{ + return abs(a - b) < 0.0500000007450580596923828125; +} + +static inline __attribute__((always_inline)) +bool compare_vec4(thread const float4& a, thread const float4& b) +{ + float param = a.x; + float param_1 = b.x; + bool _78 = compare_float(param, param_1); + bool _88; + if (_78) + { + float param_2 = a.y; + float param_3 = b.y; + _88 = compare_float(param_2, param_3); + } + else + { + _88 = _78; + } + bool _99; + if (_88) + { + float param_4 = a.z; + float param_5 = b.z; + _99 = compare_float(param_4, param_5); + } + else + { + _99 = _88; + } + bool _110; + if (_99) + { + float param_6 = a.w; + float param_7 = b.w; + _110 = compare_float(param_6, param_7); + } + else + { + _110 = _99; + } + return _110; +} + +static inline __attribute__((always_inline)) +bool compare_vec2(thread const float2& a, thread const float2& b) +{ + float param = a.x; + float param_1 = b.x; + bool _58 = compare_float(param, param_1); + bool _69; + if (_58) + { + float param_2 = a.y; + float param_3 = b.y; + _69 = compare_float(param_2, param_3); + } + else + { + _69 = _58; + } + return _69; +} + +static inline __attribute__((always_inline)) +bool compare_mat3x2(thread const float3x2& a, thread const float3x2& b) +{ + float2 param = a[0]; + float2 param_1 = b[0]; + bool _121 = compare_vec2(param, param_1); + bool _132; + if (_121) + { + float2 param_2 = a[1]; + float2 param_3 = b[1]; + _132 = compare_vec2(param_2, param_3); + } + else + { + _132 = _121; + } + bool _143; + if (_132) + { + float2 param_4 = a[2]; + float2 param_5 = b[2]; + _143 = compare_vec2(param_4, param_5); + } + else + { + _143 = _132; + } + return _143; +} + +static inline __attribute__((always_inline)) +bool compare_bvec4(thread const bool4& a, thread const bool4& b) +{ + return all(a == b); +} + +kernel void main0(device block& _212 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a = float4(1.0, -5.0, -9.0, -5.0); + s1.b = spvStorage_float3x2(float3x2(float2(1.0, -7.0), float2(1.0, 2.0), float2(8.0, 7.0))); + s1.c = short4(bool4(false, true, false, false)); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool allOk = true; + bool _188; + if (allOk) + { + float4 param = float4(1.0, -5.0, -9.0, -5.0); + float4 param_1 = s1.a; + _188 = compare_vec4(param, param_1); + } + else + { + _188 = allOk; + } + allOk = _188; + bool _197; + if (allOk) + { + float3x2 param_2 = float3x2(float2(1.0, -7.0), float2(1.0, 2.0), float2(8.0, 7.0)); + float3x2 param_3 = float3x2(s1.b); + _197 = compare_mat3x2(param_2, param_3); + } + else + { + _197 = allOk; + } + allOk = _197; + bool _206; + if (allOk) + { + bool4 param_4 = bool4(false, true, false, false); + bool4 param_5 = bool4(s1.c); + _206 = compare_bvec4(param_4, param_5); + } + else + { + _206 = allOk; + } + allOk = _206; + if (allOk) + { + _212.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct-array.comp new file mode 100644 index 0000000000..db5ed440f8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct-array.comp @@ -0,0 +1,1316 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct sA +{ + spvStorage_float2x3 mA; +}; + +struct sB +{ + spvStorage_float2x2 mA; + spvStorage_float3x2 mB; + uint3 mC; +}; + +struct sC +{ + sA mA; + sB mB; +}; + +struct sD +{ + sC mA; +}; + +struct sE +{ + spvStorage_float3x2 mA; + spvStorage_float4x3 mB; +}; + +struct sF +{ + sE mA; +}; + +struct sG +{ + sF mA; +}; + +struct sH +{ + spvUnsafeArray mA; +}; + +struct S1 +{ + sD a; + sG b; + spvUnsafeArray c; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +bool compare_float(thread const float& a, thread const float& b) +{ + return abs(a - b) < 0.0500000007450580596923828125; +} + +static inline __attribute__((always_inline)) +bool compare_vec3(thread const float3& a, thread const float3& b) +{ + float param = a.x; + float param_1 = b.x; + bool _106 = compare_float(param, param_1); + bool _116; + if (_106) + { + float param_2 = a.y; + float param_3 = b.y; + _116 = compare_float(param_2, param_3); + } + else + { + _116 = _106; + } + bool _127; + if (_116) + { + float param_4 = a.z; + float param_5 = b.z; + _127 = compare_float(param_4, param_5); + } + else + { + _127 = _116; + } + return _127; +} + +static inline __attribute__((always_inline)) +bool compare_mat2x3(thread const float2x3& a, thread const float2x3& b) +{ + float3 param = a[0]; + float3 param_1 = b[0]; + bool _158 = compare_vec3(param, param_1); + bool _168; + if (_158) + { + float3 param_2 = a[1]; + float3 param_3 = b[1]; + _168 = compare_vec3(param_2, param_3); + } + else + { + _168 = _158; + } + return _168; +} + +static inline __attribute__((always_inline)) +bool compare_vec2(thread const float2& a, thread const float2& b) +{ + float param = a.x; + float param_1 = b.x; + bool _86 = compare_float(param, param_1); + bool _97; + if (_86) + { + float param_2 = a.y; + float param_3 = b.y; + _97 = compare_float(param_2, param_3); + } + else + { + _97 = _86; + } + return _97; +} + +static inline __attribute__((always_inline)) +bool compare_mat2(thread const float2x2& a, thread const float2x2& b) +{ + float2 param = a[0]; + float2 param_1 = b[0]; + bool _138 = compare_vec2(param, param_1); + bool _149; + if (_138) + { + float2 param_2 = a[1]; + float2 param_3 = b[1]; + _149 = compare_vec2(param_2, param_3); + } + else + { + _149 = _138; + } + return _149; +} + +static inline __attribute__((always_inline)) +bool compare_mat3x2(thread const float3x2& a, thread const float3x2& b) +{ + float2 param = a[0]; + float2 param_1 = b[0]; + bool _177 = compare_vec2(param, param_1); + bool _187; + if (_177) + { + float2 param_2 = a[1]; + float2 param_3 = b[1]; + _187 = compare_vec2(param_2, param_3); + } + else + { + _187 = _177; + } + bool _198; + if (_187) + { + float2 param_4 = a[2]; + float2 param_5 = b[2]; + _198 = compare_vec2(param_4, param_5); + } + else + { + _198 = _187; + } + return _198; +} + +static inline __attribute__((always_inline)) +bool compare_uvec3(thread const uint3& a, thread const uint3& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_mat4x3(thread const float4x3& a, thread const float4x3& b) +{ + float3 param = a[0]; + float3 param_1 = b[0]; + bool _207 = compare_vec3(param, param_1); + bool _217; + if (_207) + { + float3 param_2 = a[1]; + float3 param_3 = b[1]; + _217 = compare_vec3(param_2, param_3); + } + else + { + _217 = _207; + } + bool _227; + if (_217) + { + float3 param_4 = a[2]; + float3 param_5 = b[2]; + _227 = compare_vec3(param_4, param_5); + } + else + { + _227 = _217; + } + bool _238; + if (_227) + { + float3 param_6 = a[3]; + float3 param_7 = b[3]; + _238 = compare_vec3(param_6, param_7); + } + else + { + _238 = _227; + } + return _238; +} + +static inline __attribute__((always_inline)) +bool compare_bvec3(thread const bool3& a, thread const bool3& b) +{ + return all(a == b); +} + +kernel void main0(device block& _424 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a.mA.mA.mA = spvStorage_float2x3(float2x3(float3(6.0, 8.0, 8.0), float3(0.0, -4.0, -5.0))); + s1.a.mA.mB.mA = spvStorage_float2x2(float2x2(float2(9.0, -4.0), float2(-6.0, -1.0))); + s1.a.mA.mB.mB = spvStorage_float3x2(float3x2(float2(-1.0, -2.0), float2(1.0, 6.0), float2(5.0, 7.0))); + s1.a.mA.mB.mC = uint3(3u, 1u, 5u); + s1.b.mA.mA.mA = spvStorage_float3x2(float3x2(float2(8.0, 3.0), float2(0.0, 2.0), float2(1.0, 8.0))); + s1.b.mA.mA.mB = spvStorage_float4x3(float4x3(float3(0.0, 9.0, -1.0), float3(-1.0, -7.0, 7.0), float3(-4.0, -3.0, 1.0), float3(-4.0, -9.0, 1.0))); + s1.c[0].mA[0] = short3(bool3(true, false, false)); + s1.c[0].mA[1] = short3(bool3(true, false, false)); + s1.c[1].mA[0] = short3(bool3(false)); + s1.c[1].mA[1] = short3(bool3(false)); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool allOk = true; + bool _337; + if (allOk) + { + float2x3 param = float2x3(float3(6.0, 8.0, 8.0), float3(0.0, -4.0, -5.0)); + float2x3 param_1 = float2x3(s1.a.mA.mA.mA); + _337 = compare_mat2x3(param, param_1); + } + else + { + _337 = allOk; + } + allOk = _337; + bool _346; + if (allOk) + { + float2x2 param_2 = float2x2(float2(9.0, -4.0), float2(-6.0, -1.0)); + float2x2 param_3 = float2x2(s1.a.mA.mB.mA); + _346 = compare_mat2(param_2, param_3); + } + else + { + _346 = allOk; + } + allOk = _346; + bool _355; + if (allOk) + { + float3x2 param_4 = float3x2(float2(-1.0, -2.0), float2(1.0, 6.0), float2(5.0, 7.0)); + float3x2 param_5 = float3x2(s1.a.mA.mB.mB); + _355 = compare_mat3x2(param_4, param_5); + } + else + { + _355 = allOk; + } + allOk = _355; + bool _364; + if (allOk) + { + uint3 param_6 = uint3(3u, 1u, 5u); + uint3 param_7 = s1.a.mA.mB.mC; + _364 = compare_uvec3(param_6, param_7); + } + else + { + _364 = allOk; + } + allOk = _364; + bool _373; + if (allOk) + { + float3x2 param_8 = float3x2(float2(8.0, 3.0), float2(0.0, 2.0), float2(1.0, 8.0)); + float3x2 param_9 = float3x2(s1.b.mA.mA.mA); + _373 = compare_mat3x2(param_8, param_9); + } + else + { + _373 = allOk; + } + allOk = _373; + bool _382; + if (allOk) + { + float4x3 param_10 = float4x3(float3(0.0, 9.0, -1.0), float3(-1.0, -7.0, 7.0), float3(-4.0, -3.0, 1.0), float3(-4.0, -9.0, 1.0)); + float4x3 param_11 = float4x3(s1.b.mA.mA.mB); + _382 = compare_mat4x3(param_10, param_11); + } + else + { + _382 = allOk; + } + allOk = _382; + bool _391; + if (allOk) + { + bool3 param_12 = bool3(true, false, false); + bool3 param_13 = bool3(s1.c[0].mA[0]); + _391 = compare_bvec3(param_12, param_13); + } + else + { + _391 = allOk; + } + allOk = _391; + bool _400; + if (allOk) + { + bool3 param_14 = bool3(true, false, false); + bool3 param_15 = bool3(s1.c[0].mA[1]); + _400 = compare_bvec3(param_14, param_15); + } + else + { + _400 = allOk; + } + allOk = _400; + bool _409; + if (allOk) + { + bool3 param_16 = bool3(false); + bool3 param_17 = bool3(s1.c[1].mA[0]); + _409 = compare_bvec3(param_16, param_17); + } + else + { + _409 = allOk; + } + allOk = _409; + bool _418; + if (allOk) + { + bool3 param_18 = bool3(false); + bool3 param_19 = bool3(s1.c[1].mA[1]); + _418 = compare_bvec3(param_18, param_19); + } + else + { + _418 = allOk; + } + allOk = _418; + if (allOk) + { + _424.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct.comp new file mode 100644 index 0000000000..2526c6c93b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-matrix-nested-struct.comp @@ -0,0 +1,1473 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +struct spvStorageMatrix +{ + vec columns[Cols]; + + spvStorageMatrix() thread = default; + thread spvStorageMatrix& operator=(initializer_list> cols) thread + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const thread matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const thread spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const constant matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const constant spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const device matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const device spvStorageMatrix& m) thread = default; + + spvStorageMatrix(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) thread = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const ray_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) thread = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) thread = default; + thread spvStorageMatrix& operator=(const object_data matrix& m) thread + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + thread spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) thread = default; + #endif + + operator matrix() const thread + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const thread + { + return columns[idx]; + } + thread vec& operator[](size_t idx) thread + { + return columns[idx]; + } + + spvStorageMatrix() constant = default; + + spvStorageMatrix(const thread matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const constant matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const device matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) constant = default; + + spvStorageMatrix(const threadgroup matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) constant = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) constant = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) constant + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) constant = default; + #endif + + operator matrix() const constant + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const constant + { + return columns[idx]; + } + + spvStorageMatrix() device = default; + device spvStorageMatrix& operator=(initializer_list> cols) device + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const thread matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const thread spvStorageMatrix& m) device = default; + + spvStorageMatrix(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const constant matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const constant spvStorageMatrix& m) device = default; + + spvStorageMatrix(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const device matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const device spvStorageMatrix& m) device = default; + + spvStorageMatrix(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) device = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const ray_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) device = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) device = default; + device spvStorageMatrix& operator=(const object_data matrix& m) device + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + device spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) device = default; + #endif + + operator matrix() const device + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const device + { + return columns[idx]; + } + device vec& operator[](size_t idx) device + { + return columns[idx]; + } + + spvStorageMatrix() threadgroup = default; + threadgroup spvStorageMatrix& operator=(initializer_list> cols) threadgroup + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const thread matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const constant matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const device matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup = default; + threadgroup spvStorageMatrix& operator=(const object_data matrix& m) threadgroup + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup = default; + #endif + + operator matrix() const threadgroup + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup + { + return columns[idx]; + } + threadgroup vec& operator[](size_t idx) threadgroup + { + return columns[idx]; + } + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix() threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(initializer_list> cols) threadgroup_imageblock + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const thread matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const thread spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const constant matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const constant spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const device matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const device spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) threadgroup_imageblock = default; + + spvStorageMatrix(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) threadgroup_imageblock = default; + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + threadgroup_imageblock spvStorageMatrix& operator=(const object_data matrix& m) threadgroup_imageblock + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + threadgroup_imageblock spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) threadgroup_imageblock = default; + #endif + + operator matrix() const threadgroup_imageblock + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const threadgroup_imageblock + { + return columns[idx]; + } + threadgroup_imageblock vec& operator[](size_t idx) threadgroup_imageblock + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix() ray_data = default; + ray_data spvStorageMatrix& operator=(initializer_list> cols) ray_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const thread matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const constant matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const device matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) ray_data = default; + + spvStorageMatrix(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) ray_data = default; + #endif + + spvStorageMatrix(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const ray_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) ray_data = default; + + #ifdef __HAVE_MESH__ + spvStorageMatrix(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) ray_data = default; + ray_data spvStorageMatrix& operator=(const object_data matrix& m) ray_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + ray_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) ray_data = default; + #endif + + operator matrix() const ray_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const ray_data + { + return columns[idx]; + } + ray_data vec& operator[](size_t idx) ray_data + { + return columns[idx]; + } + #endif + + #ifdef __HAVE_MESH__ + spvStorageMatrix() object_data = default; + object_data spvStorageMatrix& operator=(initializer_list> cols) object_data + { + size_t i; + thread vec* col; + for (i = 0, col = cols.begin(); i < Cols; ++i, ++col) + columns[i] = *col; + return *this; + } + + spvStorageMatrix(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const thread spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const thread matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const thread spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const constant spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const constant matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const constant spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const device spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const device matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const device spvStorageMatrix& m) object_data = default; + + spvStorageMatrix(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup spvStorageMatrix& m) object_data = default; + + #ifdef __HAVE_IMAGEBLOCKS__ + spvStorageMatrix(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const threadgroup_imageblock matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const threadgroup_imageblock spvStorageMatrix& m) object_data = default; + #endif + + #ifdef __HAVE_RAYTRACING__ + spvStorageMatrix(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const ray_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const ray_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const ray_data spvStorageMatrix& m) object_data = default; + #endif + + spvStorageMatrix(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + } + spvStorageMatrix(const object_data spvStorageMatrix& m) object_data = default; + object_data spvStorageMatrix& operator=(const object_data matrix& m) object_data + { + for (size_t i = 0; i < Cols; ++i) + columns[i] = m.columns[i]; + return *this; + } + object_data spvStorageMatrix& operator=(const object_data spvStorageMatrix& m) object_data = default; + + operator matrix() const object_data + { + matrix m; + for (int i = 0; i < Cols; ++i) + m.columns[i] = columns[i]; + return m; + } + + vec operator[](size_t idx) const object_data + { + return columns[idx]; + } + object_data vec& operator[](size_t idx) object_data + { + return columns[idx]; + } + #endif + +}; + +template +matrix transpose(spvStorageMatrix m) +{ + return transpose(matrix(m)); +} + +typedef spvStorageMatrix spvStorage_half2x2; +typedef spvStorageMatrix spvStorage_half2x3; +typedef spvStorageMatrix spvStorage_half2x4; +typedef spvStorageMatrix spvStorage_half3x2; +typedef spvStorageMatrix spvStorage_half3x3; +typedef spvStorageMatrix spvStorage_half3x4; +typedef spvStorageMatrix spvStorage_half4x2; +typedef spvStorageMatrix spvStorage_half4x3; +typedef spvStorageMatrix spvStorage_half4x4; +typedef spvStorageMatrix spvStorage_float2x2; +typedef spvStorageMatrix spvStorage_float2x3; +typedef spvStorageMatrix spvStorage_float2x4; +typedef spvStorageMatrix spvStorage_float3x2; +typedef spvStorageMatrix spvStorage_float3x3; +typedef spvStorageMatrix spvStorage_float3x4; +typedef spvStorageMatrix spvStorage_float4x2; +typedef spvStorageMatrix spvStorage_float4x3; +typedef spvStorageMatrix spvStorage_float4x4; + +struct S1 +{ + uint a; + float4 b; +}; + +struct sA +{ + spvStorage_float4x4 mA; + short3 mB; + short4 mC; +}; + +struct sB +{ + short2 mA; +}; + +struct sC +{ + float mA; + uint4 mB; + float mC; +}; + +struct sD +{ + sA mA; + sB mB; + sC mC; +}; + +struct sE +{ + sD mA; +}; + +struct sF +{ + uint3 mA; + short mB; +}; + +struct sG +{ + sF mA; + spvStorage_float3x2 mB; +}; + +struct sH +{ + sG mA; + float2 mB; +}; + +struct sI +{ + spvStorage_float2x2 mA; + short3 mB; + short4 mC; +}; + +struct sJ +{ + sI mA; + short3 mB; +}; + +struct sK +{ + short2 mA; + sJ mB; + int2 mC; +}; + +struct S2 +{ + sE a; + int3 b; + sH c; + sK d; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +bool compare_uint(thread const uint& a, thread const uint& b) +{ + return a == b; +} + +static inline __attribute__((always_inline)) +bool compare_float(thread const float& a, thread const float& b) +{ + return abs(a - b) < 0.0500000007450580596923828125; +} + +static inline __attribute__((always_inline)) +bool compare_vec4(thread const float4& a, thread const float4& b) +{ + float param = a.x; + float param_1 = b.x; + bool _147 = compare_float(param, param_1); + bool _157; + if (_147) + { + float param_2 = a.y; + float param_3 = b.y; + _157 = compare_float(param_2, param_3); + } + else + { + _157 = _147; + } + bool _168; + if (_157) + { + float param_4 = a.z; + float param_5 = b.z; + _168 = compare_float(param_4, param_5); + } + else + { + _168 = _157; + } + bool _179; + if (_168) + { + float param_6 = a.w; + float param_7 = b.w; + _179 = compare_float(param_6, param_7); + } + else + { + _179 = _168; + } + return _179; +} + +static inline __attribute__((always_inline)) +bool compare_mat4(thread const float4x4& a, thread const float4x4& b) +{ + float4 param = a[0]; + float4 param_1 = b[0]; + bool _239 = compare_vec4(param, param_1); + bool _249; + if (_239) + { + float4 param_2 = a[1]; + float4 param_3 = b[1]; + _249 = compare_vec4(param_2, param_3); + } + else + { + _249 = _239; + } + bool _259; + if (_249) + { + float4 param_4 = a[2]; + float4 param_5 = b[2]; + _259 = compare_vec4(param_4, param_5); + } + else + { + _259 = _249; + } + bool _270; + if (_259) + { + float4 param_6 = a[3]; + float4 param_7 = b[3]; + _270 = compare_vec4(param_6, param_7); + } + else + { + _270 = _259; + } + return _270; +} + +static inline __attribute__((always_inline)) +bool compare_bvec3(thread const bool3& a, thread const bool3& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_bvec4(thread const bool4& a, thread const bool4& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_bvec2(thread const bool2& a, thread const bool2& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_uvec4(thread const uint4& a, thread const uint4& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_ivec3(thread const int3& a, thread const int3& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_uvec3(thread const uint3& a, thread const uint3& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_bool(thread const bool& a, thread const bool& b) +{ + return a == b; +} + +static inline __attribute__((always_inline)) +bool compare_vec2(thread const float2& a, thread const float2& b) +{ + float param = a.x; + float param_1 = b.x; + bool _127 = compare_float(param, param_1); + bool _138; + if (_127) + { + float param_2 = a.y; + float param_3 = b.y; + _138 = compare_float(param_2, param_3); + } + else + { + _138 = _127; + } + return _138; +} + +static inline __attribute__((always_inline)) +bool compare_mat3x2(thread const float3x2& a, thread const float3x2& b) +{ + float2 param = a[0]; + float2 param_1 = b[0]; + bool _209 = compare_vec2(param, param_1); + bool _219; + if (_209) + { + float2 param_2 = a[1]; + float2 param_3 = b[1]; + _219 = compare_vec2(param_2, param_3); + } + else + { + _219 = _209; + } + bool _230; + if (_219) + { + float2 param_4 = a[2]; + float2 param_5 = b[2]; + _230 = compare_vec2(param_4, param_5); + } + else + { + _230 = _219; + } + return _230; +} + +static inline __attribute__((always_inline)) +bool compare_mat2(thread const float2x2& a, thread const float2x2& b) +{ + float2 param = a[0]; + float2 param_1 = b[0]; + bool _189 = compare_vec2(param, param_1); + bool _200; + if (_189) + { + float2 param_2 = a[1]; + float2 param_3 = b[1]; + _200 = compare_vec2(param_2, param_3); + } + else + { + _200 = _189; + } + return _200; +} + +static inline __attribute__((always_inline)) +bool compare_ivec2(thread const int2& a, thread const int2& b) +{ + return all(a == b); +} + +kernel void main0(device block& _612 [[buffer(0)]]) +{ + threadgroup S1 s1; + threadgroup S2 s2; + s1.a = 0u; + s1.b = float4(8.0, 8.0, 0.0, -4.0); + s2.a.mA.mA.mA = spvStorage_float4x4(float4x4(float4(-5.0, 9.0, -4.0, -6.0), float4(-1.0, -1.0, -2.0, 1.0), float4(6.0, 5.0, 7.0, -2.0), float4(-4.0, -9.0, 8.0, 3.0))); + s2.a.mA.mA.mB = short3(bool3(true, false, false)); + s2.a.mA.mA.mC = short4(bool4(true, true, true, false)); + s2.a.mA.mB.mA = short2(bool2(true)); + s2.a.mA.mC.mA = 7.0; + s2.a.mA.mC.mB = uint4(8u, 6u, 2u, 0u); + s2.a.mA.mC.mC = -9.0; + s2.b = int3(1, -4, 0); + s2.c.mA.mA.mA = uint3(4u, 9u, 1u); + s2.c.mA.mA.mB = short(false); + s2.c.mA.mB = spvStorage_float3x2(float3x2(float2(3.0, -5.0), float2(-1.0, -5.0), float2(-1.0, -9.0))); + s2.c.mB = float2(-6.0, -9.0); + s2.d.mA = short2(bool2(true, false)); + s2.d.mB.mA.mA = spvStorage_float2x2(float2x2(float2(-2.0, 3.0), float2(7.0, 2.0))); + s2.d.mB.mA.mB = short3(bool3(false)); + s2.d.mB.mA.mC = short4(bool4(false, false, false, true)); + s2.d.mB.mB = short3(bool3(true, false, false)); + s2.d.mC = int2(-9, 0); + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool allOk = true; + bool _435; + if (allOk) + { + uint param = 0u; + uint param_1 = s1.a; + _435 = compare_uint(param, param_1); + } + else + { + _435 = allOk; + } + allOk = _435; + bool _444; + if (allOk) + { + float4 param_2 = float4(8.0, 8.0, 0.0, -4.0); + float4 param_3 = s1.b; + _444 = compare_vec4(param_2, param_3); + } + else + { + _444 = allOk; + } + allOk = _444; + bool _453; + if (allOk) + { + float4x4 param_4 = float4x4(float4(-5.0, 9.0, -4.0, -6.0), float4(-1.0, -1.0, -2.0, 1.0), float4(6.0, 5.0, 7.0, -2.0), float4(-4.0, -9.0, 8.0, 3.0)); + float4x4 param_5 = float4x4(s2.a.mA.mA.mA); + _453 = compare_mat4(param_4, param_5); + } + else + { + _453 = allOk; + } + allOk = _453; + bool _462; + if (allOk) + { + bool3 param_6 = bool3(true, false, false); + bool3 param_7 = bool3(s2.a.mA.mA.mB); + _462 = compare_bvec3(param_6, param_7); + } + else + { + _462 = allOk; + } + allOk = _462; + bool _471; + if (allOk) + { + bool4 param_8 = bool4(true, true, true, false); + bool4 param_9 = bool4(s2.a.mA.mA.mC); + _471 = compare_bvec4(param_8, param_9); + } + else + { + _471 = allOk; + } + allOk = _471; + bool _480; + if (allOk) + { + bool2 param_10 = bool2(true); + bool2 param_11 = bool2(s2.a.mA.mB.mA); + _480 = compare_bvec2(param_10, param_11); + } + else + { + _480 = allOk; + } + allOk = _480; + bool _489; + if (allOk) + { + float param_12 = 7.0; + float param_13 = s2.a.mA.mC.mA; + _489 = compare_float(param_12, param_13); + } + else + { + _489 = allOk; + } + allOk = _489; + bool _498; + if (allOk) + { + uint4 param_14 = uint4(8u, 6u, 2u, 0u); + uint4 param_15 = s2.a.mA.mC.mB; + _498 = compare_uvec4(param_14, param_15); + } + else + { + _498 = allOk; + } + allOk = _498; + bool _507; + if (allOk) + { + float param_16 = -9.0; + float param_17 = s2.a.mA.mC.mC; + _507 = compare_float(param_16, param_17); + } + else + { + _507 = allOk; + } + allOk = _507; + bool _516; + if (allOk) + { + int3 param_18 = int3(1, -4, 0); + int3 param_19 = s2.b; + _516 = compare_ivec3(param_18, param_19); + } + else + { + _516 = allOk; + } + allOk = _516; + bool _525; + if (allOk) + { + uint3 param_20 = uint3(4u, 9u, 1u); + uint3 param_21 = s2.c.mA.mA.mA; + _525 = compare_uvec3(param_20, param_21); + } + else + { + _525 = allOk; + } + allOk = _525; + bool _534; + if (allOk) + { + bool param_22 = false; + bool param_23 = bool(s2.c.mA.mA.mB); + _534 = compare_bool(param_22, param_23); + } + else + { + _534 = allOk; + } + allOk = _534; + bool _543; + if (allOk) + { + float3x2 param_24 = float3x2(float2(3.0, -5.0), float2(-1.0, -5.0), float2(-1.0, -9.0)); + float3x2 param_25 = float3x2(s2.c.mA.mB); + _543 = compare_mat3x2(param_24, param_25); + } + else + { + _543 = allOk; + } + allOk = _543; + bool _552; + if (allOk) + { + float2 param_26 = float2(-6.0, -9.0); + float2 param_27 = s2.c.mB; + _552 = compare_vec2(param_26, param_27); + } + else + { + _552 = allOk; + } + allOk = _552; + bool _561; + if (allOk) + { + bool2 param_28 = bool2(true, false); + bool2 param_29 = bool2(s2.d.mA); + _561 = compare_bvec2(param_28, param_29); + } + else + { + _561 = allOk; + } + allOk = _561; + bool _570; + if (allOk) + { + float2x2 param_30 = float2x2(float2(-2.0, 3.0), float2(7.0, 2.0)); + float2x2 param_31 = float2x2(s2.d.mB.mA.mA); + _570 = compare_mat2(param_30, param_31); + } + else + { + _570 = allOk; + } + allOk = _570; + bool _579; + if (allOk) + { + bool3 param_32 = bool3(false); + bool3 param_33 = bool3(s2.d.mB.mA.mB); + _579 = compare_bvec3(param_32, param_33); + } + else + { + _579 = allOk; + } + allOk = _579; + bool _588; + if (allOk) + { + bool4 param_34 = bool4(false, false, false, true); + bool4 param_35 = bool4(s2.d.mB.mA.mC); + _588 = compare_bvec4(param_34, param_35); + } + else + { + _588 = allOk; + } + allOk = _588; + bool _597; + if (allOk) + { + bool3 param_36 = bool3(true, false, false); + bool3 param_37 = bool3(s2.d.mB.mB); + _597 = compare_bvec3(param_36, param_37); + } + else + { + _597 = allOk; + } + allOk = _597; + bool _606; + if (allOk) + { + int2 param_38 = int2(-9, 0); + int2 param_39 = s2.d.mC; + _606 = compare_ivec2(param_38, param_39); + } + else + { + _606 = allOk; + } + allOk = _606; + if (allOk) + { + _612.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared-struct-bool-cast.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared-struct-bool-cast.comp new file mode 100644 index 0000000000..806cb0a86c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared-struct-bool-cast.comp @@ -0,0 +1,110 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct S1 +{ + int3 a; + uint2 b; + short4 c; + uint d; +}; + +struct block +{ + uint passed; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +bool compare_ivec3(thread const int3& a, thread const int3& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_uvec2(thread const uint2& a, thread const uint2& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_bvec4(thread const bool4& a, thread const bool4& b) +{ + return all(a == b); +} + +static inline __attribute__((always_inline)) +bool compare_uint(thread const uint& a, thread const uint& b) +{ + return a == b; +} + +kernel void main0(device block& _132 [[buffer(0)]]) +{ + threadgroup S1 s1; + s1.a = int3(6, 8, 8); + s1.b = uint2(4u); + s1.c = short4(bool4(false, false, false, true)); + s1.d = 6u; + threadgroup_barrier(mem_flags::mem_threadgroup); + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); + bool allOk = true; + bool _99; + if (allOk) + { + int3 param = int3(6, 8, 8); + int3 param_1 = s1.a; + _99 = compare_ivec3(param, param_1); + } + else + { + _99 = allOk; + } + allOk = _99; + bool _108; + if (allOk) + { + uint2 param_2 = uint2(4u); + uint2 param_3 = s1.b; + _108 = compare_uvec2(param_2, param_3); + } + else + { + _108 = allOk; + } + allOk = _108; + bool _117; + if (allOk) + { + bool4 param_4 = bool4(false, false, false, true); + bool4 param_5 = bool4(s1.c); + _117 = compare_bvec4(param_4, param_5); + } + else + { + _117 = allOk; + } + allOk = _117; + bool _126; + if (allOk) + { + uint param_6 = 6u; + uint param_7 = s1.d; + _126 = compare_uint(param_6, param_7); + } + else + { + _126 = allOk; + } + allOk = _126; + if (allOk) + { + _132.passed++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp b/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp new file mode 100644 index 0000000000..c9ffde15e8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/shared.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float in_data[1]; +}; + +struct SSBO2 +{ + float out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +kernel void main0(const device SSBO& _22 [[buffer(0)]], device SSBO2& _44 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + threadgroup float sShared[4]; + uint ident = gl_GlobalInvocationID.x; + float idata = _22.in_data[ident]; + sShared[gl_LocalInvocationIndex] = idata; + threadgroup_barrier(mem_flags::mem_threadgroup); + _44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..8f54f0528d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,49 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +constant int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +constant int c = SPIRV_CROSS_CONSTANT_ID_2; +constant int d = (c + 50); + +struct SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +constant int e_tmp [[function_constant(3)]]; +constant int e = is_function_constant_defined(e_tmp) ? e_tmp : 400; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _22 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..de30edec15 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; +constant int a_tmp [[function_constant(0)]]; +constant int a = is_function_constant_defined(a_tmp) ? a_tmp : 1; + +struct SSBO +{ + int v[1]; +}; + +constant uint _21 = (uint(a) + 0u); +constant uint _22_tmp [[function_constant(10)]]; +constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u; +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(_22, 20u, 1u); +constant uint _27 = gl_WorkGroupSize.x; +constant uint _28 = (_21 + _27); +constant uint _29 = gl_WorkGroupSize.y; +constant uint _30 = (_28 + _29); +constant int _32 = (1 - a); + +kernel void main0(device SSBO& _17 [[buffer(0)]]) +{ + spvUnsafeArray spec_const_array_size; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/storage-buffer-std140-vector-array.comp b/third_party/spirv-cross/reference/shaders-msl/comp/storage-buffer-std140-vector-array.comp new file mode 100644 index 0000000000..5593629c06 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/storage-buffer-std140-vector-array.comp @@ -0,0 +1,96 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Sub +{ + spvUnsafeArray f; + spvUnsafeArray f2; + spvUnsafeArray f3; + spvUnsafeArray f4; +}; + +struct Sub_1 +{ + float4 f[2]; + float4 f2[2]; + float3 f3[2]; + float4 f4[2]; +}; + +struct SSBO +{ + Sub_1 sub[2]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + Sub foo; + foo.f[0] = _27.sub[gl_WorkGroupID.x].f[0].x; + foo.f[1] = _27.sub[gl_WorkGroupID.x].f[1].x; + foo.f2[0] = _27.sub[gl_WorkGroupID.x].f2[0].xy; + foo.f2[1] = _27.sub[gl_WorkGroupID.x].f2[1].xy; + foo.f3[0] = _27.sub[gl_WorkGroupID.x].f3[0]; + foo.f3[1] = _27.sub[gl_WorkGroupID.x].f3[1]; + foo.f4[0] = _27.sub[gl_WorkGroupID.x].f4[0]; + foo.f4[1] = _27.sub[gl_WorkGroupID.x].f4[1]; + foo.f[gl_GlobalInvocationID.x] += 1.0; + foo.f2[gl_GlobalInvocationID.x] += float2(2.0); + foo.f3[gl_GlobalInvocationID.x] += float3(3.0); + foo.f4[gl_GlobalInvocationID.x] += float4(4.0); + (device float&)_27.sub[gl_WorkGroupID.x].f[0] = foo.f[0]; + (device float&)_27.sub[gl_WorkGroupID.x].f[1] = foo.f[1]; + (device float2&)_27.sub[gl_WorkGroupID.x].f2[0] = foo.f2[0]; + (device float2&)_27.sub[gl_WorkGroupID.x].f2[1] = foo.f2[1]; + _27.sub[gl_WorkGroupID.x].f3[0] = foo.f3[0]; + _27.sub[gl_WorkGroupID.x].f3[1] = foo.f3[1]; + _27.sub[gl_WorkGroupID.x].f4[0] = foo.f4[0]; + _27.sub[gl_WorkGroupID.x].f4[1] = foo.f4[1]; + (device float&)_27.sub[0].f[0] = _27.sub[0].f[0].x + 5.0; + (device float2&)_27.sub[0].f2[1] = _27.sub[0].f2[1].xy + float2(5.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp b/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp new file mode 100644 index 0000000000..8f2ab2d60c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/struct-layout.comp @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct Foo +{ + float4x4 m; +}; + +struct SSBO2 +{ + Foo out_data[1]; +}; + +struct SSBO +{ + Foo in_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _23 [[buffer(0)]], const device SSBO& _30 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + _23.out_data[ident].m = _30.in_data[ident].m * _30.in_data[ident].m; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/struct-nested.comp b/third_party/spirv-cross/reference/shaders-msl/comp/struct-nested.comp new file mode 100644 index 0000000000..e3d04bedaa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/struct-nested.comp @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct s1 +{ + int a; +}; + +struct s2 +{ + s1 b; +}; + +struct s1_1 +{ + int a; +}; + +struct s2_1 +{ + s1_1 b; +}; + +struct dstbuffer +{ + s2_1 test[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device dstbuffer& _19 [[buffer(0)]]) +{ + s2 testVal; + testVal.b.a = 0; + _19.test[0].b.a = testVal.b.a; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/struct-packing.comp b/third_party/spirv-cross/reference/shaders-msl/comp/struct-packing.comp new file mode 100644 index 0000000000..dc1654399d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/struct-packing.comp @@ -0,0 +1,152 @@ +#include +#include + +using namespace metal; + +struct S0 +{ + float2 a[1]; + float b; + char _m0_final_padding[4]; +}; + +struct S1 +{ + packed_float3 a; + float b; +}; + +struct S2 +{ + float3 a[1]; + float b; + char _m0_final_padding[12]; +}; + +struct S3 +{ + float2 a; + float b; +}; + +struct S4 +{ + float2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + S4 m3s[8]; + char _m0_final_padding[8]; +}; + +struct SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + float2x2 m0; + float2x2 m1; + float2x3 m2[4]; + float3x2 m3; + float2x2 m4; + float2x2 m5[9]; + float3x2 m6[4][2]; + float2x3 m7; + float array[1]; +}; + +struct S0_1 +{ + float2 a[1]; + char _m1_pad[8]; + float b; + char _m0_final_padding[12]; +}; + +struct S1_1 +{ + packed_float3 a; + float b; +}; + +struct S2_1 +{ + float3 a[1]; + float b; + char _m0_final_padding[12]; +}; + +struct S3_1 +{ + float2 a; + float b; +}; + +struct S4_1 +{ + float2 c; + char _m0_final_padding[8]; +}; + +struct Content_1 +{ + S0_1 m0s[1]; + S1_1 m1s[1]; + S2_1 m2s[1]; + S0_1 m0; + S1_1 m1; + S2_1 m2; + S3_1 m3; + float m4; + char _m8_pad[8]; + S4_1 m3s[8]; +}; + +struct SSBO0 +{ + Content_1 content; + Content_1 content1[2]; + Content_1 content2; + float4 array[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO1& ssbo_430 [[buffer(0)]], device SSBO0& ssbo_140 [[buffer(1)]]) +{ + Content_1 _60 = ssbo_140.content; + ssbo_430.content.m0s[0].a[0] = _60.m0s[0].a[0]; + ssbo_430.content.m0s[0].b = _60.m0s[0].b; + ssbo_430.content.m1s[0].a = float3(_60.m1s[0].a); + ssbo_430.content.m1s[0].b = _60.m1s[0].b; + ssbo_430.content.m2s[0].a[0] = _60.m2s[0].a[0]; + ssbo_430.content.m2s[0].b = _60.m2s[0].b; + ssbo_430.content.m0.a[0] = _60.m0.a[0]; + ssbo_430.content.m0.b = _60.m0.b; + ssbo_430.content.m1.a = float3(_60.m1.a); + ssbo_430.content.m1.b = _60.m1.b; + ssbo_430.content.m2.a[0] = _60.m2.a[0]; + ssbo_430.content.m2.b = _60.m2.b; + ssbo_430.content.m3.a = _60.m3.a; + ssbo_430.content.m3.b = _60.m3.b; + ssbo_430.content.m4 = _60.m4; + ssbo_430.content.m3s[0].c = _60.m3s[0].c; + ssbo_430.content.m3s[1].c = _60.m3s[1].c; + ssbo_430.content.m3s[2].c = _60.m3s[2].c; + ssbo_430.content.m3s[3].c = _60.m3s[3].c; + ssbo_430.content.m3s[4].c = _60.m3s[4].c; + ssbo_430.content.m3s[5].c = _60.m3s[5].c; + ssbo_430.content.m3s[6].c = _60.m3s[6].c; + ssbo_430.content.m3s[7].c = _60.m3s[7].c; + ssbo_430.content.m1.a = ssbo_430.content.m3.a * ssbo_430.m6[1][1]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/threadgroup-boolean-workaround.comp b/third_party/spirv-cross/reference/shaders-msl/comp/threadgroup-boolean-workaround.comp new file mode 100644 index 0000000000..f0d417bec7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/threadgroup-boolean-workaround.comp @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 values[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); + +static inline __attribute__((always_inline)) +void in_function(threadgroup short4 (&foo)[4], thread uint& gl_LocalInvocationIndex, device SSBO& _23, thread uint3& gl_GlobalInvocationID) +{ + foo[gl_LocalInvocationIndex] = short4(_23.values[gl_GlobalInvocationID.x] != float4(10.0)); + threadgroup_barrier(mem_flags::mem_threadgroup); + _23.values[gl_GlobalInvocationID.x] = select(float4(40.0), float4(30.0), bool4(foo[gl_LocalInvocationIndex ^ 3u])); +} + +kernel void main0(device SSBO& _23 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + threadgroup short4 foo[4]; + in_function(foo, gl_LocalInvocationIndex, _23, gl_GlobalInvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp b/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp new file mode 100644 index 0000000000..e92e71d61d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp @@ -0,0 +1,53 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4x4 mvp; + float4 in_data[1]; +}; + +struct SSBO2 +{ + float4 out_data[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + uint ident = gl_GlobalInvocationID.x; + float4 idat = _24.in_data[ident]; + int k = 0; + for (;;) + { + int _39 = k; + int _40 = _39 + 1; + k = _40; + if (_40 < 10) + { + idat *= 2.0; + k++; + continue; + } + else + { + break; + } + } + for (uint i = 0u; i < 16u; i++, k++) + { + for (uint j = 0u; j < 30u; j++) + { + idat = _24.mvp * idat; + } + } + do + { + k++; + } while (k > 10); + _89.out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/type-alias.comp b/third_party/spirv-cross/reference/shaders-msl/comp/type-alias.comp new file mode 100644 index 0000000000..e3ac031668 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/type-alias.comp @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct S0 +{ + float4 a; +}; + +struct S1 +{ + float4 a; +}; + +struct S0_1 +{ + float4 a; +}; + +struct SSBO0 +{ + S0_1 s0s[1]; +}; + +struct S1_1 +{ + float4 a; +}; + +struct SSBO1 +{ + S1_1 s1s[1]; +}; + +struct SSBO2 +{ + float4 outputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +static inline __attribute__((always_inline)) +float4 overload(thread const S0& s0) +{ + return s0.a; +} + +static inline __attribute__((always_inline)) +float4 overload(thread const S1& s1) +{ + return s1.a; +} + +kernel void main0(device SSBO0& _36 [[buffer(0)]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + S0 s0; + s0.a = _36.s0s[gl_GlobalInvocationID.x].a; + S1 s1; + s1.a = _55.s1s[gl_GlobalInvocationID.x].a; + S0 param = s0; + S1 param_1 = s1; + _66.outputs[gl_GlobalInvocationID.x] = overload(param) + overload(param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/type_casting_i64.msl22.comp b/third_party/spirv-cross/reference/shaders-msl/comp/type_casting_i64.msl22.comp new file mode 100644 index 0000000000..6820b077a1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/type_casting_i64.msl22.comp @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct dst_buff_t +{ + int m0[1]; +}; + +struct src_buff_t +{ + int m0[1]; +}; + +constant int base_val_tmp [[function_constant(0)]]; +constant int base_val = is_function_constant_defined(base_val_tmp) ? base_val_tmp : 0; +constant long shift_val_tmp [[function_constant(1)]]; +constant long shift_val = is_function_constant_defined(shift_val_tmp) ? shift_val_tmp : 0l; +constant int offset = (base_val >> int(shift_val)); +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device dst_buff_t& dst_buff [[buffer(0)]], device src_buff_t& src_buff [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + dst_buff.m0[gl_GlobalInvocationID.x] = src_buff.m0[gl_GlobalInvocationID.x] + offset; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/udiv.comp b/third_party/spirv-cross/reference/shaders-msl/comp/udiv.comp new file mode 100644 index 0000000000..7f7315b882 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/udiv.comp @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct SSBO2 +{ + uint outputs[1]; +}; + +struct SSBO +{ + uint inputs[1]; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO& _23 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +{ + _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp b/third_party/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp new file mode 100644 index 0000000000..310cda7fef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct myBlock +{ + int a; + float b; +}; + +kernel void main0(device myBlock& myStorage [[buffer(0)]]) +{ + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b = mod(myStorage.b + 0.0199999995529651641845703125, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/reference/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..cea12980c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,179 @@ +#include +#include + +using namespace metal; + +struct SSBOUint +{ + uint a; + uint b; + uint c; + uint d; + uint2 a2; + uint2 b2; + uint2 c2; + uint2 d2; + uint3 a3; + uint3 b3; + uint3 c3; + uint3 d3; + uint4 a4; + uint4 b4; + uint4 c4; + uint4 d4; +}; + +struct ResType +{ + uint _m0; + uint _m1; +}; + +struct ResType_1 +{ + uint2 _m0; + uint2 _m1; +}; + +struct ResType_2 +{ + uint3 _m0; + uint3 _m1; +}; + +struct ResType_3 +{ + uint4 _m0; + uint4 _m1; +}; + +struct SSBOInt +{ + int a; + int b; + int c; + int d; + int2 a2; + int2 b2; + int2 c2; + int2 d2; + int3 a3; + int3 b3; + int3 c3; + int3 d3; + int4 a4; + int4 b4; + int4 c4; + int4 d4; +}; + +struct ResType_4 +{ + int _m0; + int _m1; +}; + +struct ResType_5 +{ + int2 _m0; + int2 _m1; +}; + +struct ResType_6 +{ + int3 _m0; + int3 _m1; +}; + +struct ResType_7 +{ + int4 _m0; + int4 _m1; +}; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); + +kernel void main0(device SSBOUint& u [[buffer(0)]], device SSBOInt& i [[buffer(1)]]) +{ + ResType _25; + _25._m0 = u.a + u.b; + _25._m1 = select(uint(1), uint(0), _25._m0 >= max(u.a, u.b)); + u.d = _25._m1; + u.c = _25._m0; + ResType_1 _40; + _40._m0 = u.a2 + u.b2; + _40._m1 = select(uint2(1), uint2(0), _40._m0 >= max(u.a2, u.b2)); + u.d2 = _40._m1; + u.c2 = _40._m0; + ResType_2 _55; + _55._m0 = u.a3 + u.b3; + _55._m1 = select(uint3(1), uint3(0), _55._m0 >= max(u.a3, u.b3)); + u.d3 = _55._m1; + u.c3 = _55._m0; + ResType_3 _70; + _70._m0 = u.a4 + u.b4; + _70._m1 = select(uint4(1), uint4(0), _70._m0 >= max(u.a4, u.b4)); + u.d4 = _70._m1; + u.c4 = _70._m0; + ResType _79; + _79._m0 = u.a - u.b; + _79._m1 = select(uint(1), uint(0), u.a >= u.b); + u.d = _79._m1; + u.c = _79._m0; + ResType_1 _88; + _88._m0 = u.a2 - u.b2; + _88._m1 = select(uint2(1), uint2(0), u.a2 >= u.b2); + u.d2 = _88._m1; + u.c2 = _88._m0; + ResType_2 _97; + _97._m0 = u.a3 - u.b3; + _97._m1 = select(uint3(1), uint3(0), u.a3 >= u.b3); + u.d3 = _97._m1; + u.c3 = _97._m0; + ResType_3 _106; + _106._m0 = u.a4 - u.b4; + _106._m1 = select(uint4(1), uint4(0), u.a4 >= u.b4); + u.d4 = _106._m1; + u.c4 = _106._m0; + ResType _116; + _116._m0 = u.a * u.b; + _116._m1 = mulhi(u.a, u.b); + u.d = _116._m0; + u.c = _116._m1; + ResType_1 _125; + _125._m0 = u.a2 * u.b2; + _125._m1 = mulhi(u.a2, u.b2); + u.d2 = _125._m0; + u.c2 = _125._m1; + ResType_2 _134; + _134._m0 = u.a3 * u.b3; + _134._m1 = mulhi(u.a3, u.b3); + u.d3 = _134._m0; + u.c3 = _134._m1; + ResType_3 _143; + _143._m0 = u.a4 * u.b4; + _143._m1 = mulhi(u.a4, u.b4); + u.d4 = _143._m0; + u.c4 = _143._m1; + ResType_4 _160; + _160._m0 = i.a * i.b; + _160._m1 = mulhi(i.a, i.b); + i.d = _160._m0; + i.c = _160._m1; + ResType_5 _171; + _171._m0 = i.a2 * i.b2; + _171._m1 = mulhi(i.a2, i.b2); + i.d2 = _171._m0; + i.c2 = _171._m1; + ResType_6 _182; + _182._m0 = i.a3 * i.b3; + _182._m1 = mulhi(i.a3, i.b3); + i.d3 = _182._m0; + i.c3 = _182._m1; + ResType_7 _193; + _193._m0 = i.a4 * i.b4; + _193._m1 = mulhi(i.a4, i.b4); + i.d4 = _193._m0; + i.c4 = _193._m1; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..7957b209d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,13 @@ +#include +#include + +using namespace metal; + +fragment void main0(texture2d_ms uImageMS [[texture(0)]], texture2d_array uImageArray [[texture(1)]], texture2d uImage [[texture(2)]]) +{ + float4 a = uImageMS.read(uint2(int2(1, 2)), 2); + float4 b = uImageArray.read(uint2(int3(1, 2, 4).xy), uint(int3(1, 2, 4).z)); + uImage.write(a, uint2(int2(2, 3))); + uImageArray.write(b, uint2(int3(2, 3, 7).xy), uint(int3(2, 3, 7).z)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..922796b749 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(float(int(uSampler.get_num_mip_levels()))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..330bc64037 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], texture2d_ms uImage [[texture(1)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(float(int(uSampler.get_num_samples()) + int(uImage.get_num_samples()))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc new file mode 100644 index 0000000000..01fceeb6c7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float3 vVertex; +}; + +struct main0_patchOut +{ + spvUnsafeArray vPatch; +}; + +struct main0_in +{ + float3 vInput [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput + gl_in[gl_InvocationID ^ 1].vInput; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0) + { + patchOut.vPatch[0] = float3(10.0); + patchOut.vPatch[1] = float3(20.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..6aca015783 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + float3 vFoo; +}; + +struct main0_in +{ + uint3 m_78; + ushort2 m_82; + float4 gl_Position; +}; + +static inline __attribute__((always_inline)) +void set_position(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device main0_in* thread & gl_in) +{ + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 1]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 1; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); + set_position(gl_out, gl_InvocationID, gl_in); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..054b4e7418 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,47 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + float3 vFoo; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +void set_position(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup main0_in* thread & gl_in) +{ + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 1) + return; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); + set_position(gl_out, gl_InvocationID, gl_in); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..184a4a6f9b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct Boo +{ + float3 a; + uint3 b; +}; + +struct main0_out +{ + Boo vVertex; +}; + +struct main0_in +{ + Boo vInput; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc new file mode 100644 index 0000000000..f5fd60a9f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct Boo +{ + float3 a; + float3 b; +}; + +struct main0_out +{ + Boo vVertex; +}; + +struct main0_in +{ + float3 vInput_a [[attribute(0)]]; + float3 vInput_b [[attribute(1)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + Boo _25 = Boo{ gl_in[gl_InvocationID].vInput_a, gl_in[gl_InvocationID].vInput_b }; + gl_out[gl_InvocationID].vVertex = _25; + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..dff8cb7bbd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + out.gl_Position = ((patchIn.gl_in[0].gl_Position * gl_TessCoord.x) + (patchIn.gl_in[1].gl_Position * gl_TessCoord.y)) + (patchIn.gl_in[2].gl_Position * gl_TessCoord.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert new file mode 100644 index 0000000000..a414c98542 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(10.0); + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 4.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..2d98929051 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(10.0); + out.gl_ClipDistance[0] = 1.0; + out.gl_ClipDistance[1] = 4.0; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert new file mode 100644 index 0000000000..b3c8b6bb27 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], uint3 spvDispatchBase [[grid_origin]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + uint gl_BaseVertex = spvDispatchBase.x; + uint gl_BaseInstance = spvDispatchBase.y; + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert new file mode 100644 index 0000000000..a32c1948f8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(uint gl_BaseVertex [[base_vertex]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/basic.flatten.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..f4549abab2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/multiindex.flatten.vert @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 Data[3][5]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + int2 aIndex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _20 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _20.Data[in.aIndex.x][in.aIndex.y]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..8f2e8c173f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/push-constant.flatten.vert @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct PushMe +{ + float4x4 MVP; + float2x2 Rot; + float Arr[4]; +}; + +struct main0_out +{ + float2 vRot [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 Rot [[attribute(0)]]; + float4 Pos [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant PushMe& registers [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = registers.MVP * in.Pos; + out.vRot = (registers.Rot * in.Rot) + float2(registers.Arr[2]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..3ea30e65c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/rowmajor.flatten.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVPR; + float4x4 uMVPC; + float4x4 uMVP; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + float2 v = float4x2(_18.uMVP[0].xy, _18.uMVP[1].xy, _18.uMVP[2].xy, _18.uMVP[3].xy) * in.aVertex; + out.gl_Position = (_18.uMVPR * in.aVertex) + (in.aVertex * _18.uMVPC); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..f79a794cde --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/struct.flatten.vert @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light light; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _18.uMVP * in.aVertex; + out.vColor = float4(0.0); + float3 L = in.aVertex.xyz - float3(_18.light.Position); + out.vColor += ((_18.light.Color * fast::clamp(1.0 - (length(L) / _18.light.Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(L))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..05a6bbaeb3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/swizzle.flatten.vert @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 A; + float2 B0; + float2 B1; + float C0; + float3 C1; + packed_float3 D0; + float D1; + float E0; + float E1; + float E2; + float E3; + float F0; + float2 F1; + float F2; +}; + +struct main0_out +{ + float4 oA [[user(locn0)]]; + float4 oB [[user(locn1)]]; + float4 oC [[user(locn2)]]; + float4 oD [[user(locn3)]]; + float4 oE [[user(locn4)]]; + float4 oF [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant UBO& _22 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = float4(0.0); + out.oA = _22.A; + out.oB = float4(_22.B0, _22.B1); + out.oC = float4(_22.C0, _22.C1) + float4(_22.C1.xy, _22.C1.z, _22.C0); + out.oD = float4(_22.D0[0], _22.D0[1], _22.D0[2], _22.D1) + float4(float2(_22.D0[0], _22.D0[1]), _22.D0[2u], _22.D1); + out.oE = float4(_22.E0, _22.E1, _22.E2, _22.E3); + out.oF = float4(_22.F0, _22.F1, _22.F2); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/flatten/types.flatten.frag b/third_party/spirv-cross/reference/shaders-msl/flatten/types.flatten.frag new file mode 100644 index 0000000000..cee53d9e58 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/flatten/types.flatten.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct UBO1 +{ + int4 c; + int4 d; +}; + +struct UBO2 +{ + uint4 e; + uint4 f; +}; + +struct UBO0 +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO1& _14 [[buffer(0)]], constant UBO2& _29 [[buffer(1)]], constant UBO0& _41 [[buffer(2)]]) +{ + main0_out out = {}; + out.FragColor = ((((float4(_14.c) + float4(_14.d)) + float4(_29.e)) + float4(_29.f)) + _41.a) + _41.b; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag b/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag new file mode 100644 index 0000000000..7516b11dbc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -0,0 +1,96 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 ssbo; +}; + +struct SSBOs +{ + float4 ssbo; +}; + +struct Push +{ + float4 push; +}; + +struct UBO +{ + float4 ubo; +}; + +struct UBOs +{ + float4 ubo; +}; + +struct spvDescriptorSetBuffer0 +{ + texture2d uTexture [[id(0)]]; + sampler uTextureSmplr [[id(1)]]; + array, 2> uTextures [[id(2)]]; + array uTexturesSmplr [[id(4)]]; + constant UBO* m_90 [[id(6)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + array, 4> uTexture2 [[id(0)]]; + array uSampler [[id(4)]]; + device SSBO* m_60 [[id(6)]]; + const device SSBOs* ssbos [[id(7)]][2]; +}; + +struct spvDescriptorSetBuffer2 +{ + constant UBOs* ubos [[id(0)]][4]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_in_function2(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) +{ + float4 ret = uTexture.sample(uTextureSmplr, vUV); + ret += uTexture2[2].sample(uSampler[1], vUV); + ret += uTextures[1].sample(uTexturesSmplr[1], vUV); + ret += _60.ssbo; + ret += ssbos[0]->ssbo; + ret += registers.push; + return ret; +} + +static inline __attribute__((always_inline)) +float4 sample_in_function(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& _60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& _90, constant UBOs* constant (&ubos)[4]) +{ + float4 ret = sample_in_function2(uTexture, uTextureSmplr, vUV, uTexture2, uSampler, uTextures, uTexturesSmplr, _60, ssbos, registers); + ret += _90.ubo; + ret += ubos[0]->ubo; + return ret; +} + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]], constant Push& registers [[buffer(3)]]) +{ + main0_out out = {}; + out.FragColor = sample_in_function(spvDescriptorSet0.uTexture, spvDescriptorSet0.uTextureSmplr, in.vUV, spvDescriptorSet1.uTexture2, spvDescriptorSet1.uSampler, spvDescriptorSet0.uTextures, spvDescriptorSet0.uTexturesSmplr, (*spvDescriptorSet1.m_60), spvDescriptorSet1.ssbos, registers, (*spvDescriptorSet0.m_90), spvDescriptorSet2.ubos); + out.FragColor += (*spvDescriptorSet0.m_90).ubo; + out.FragColor += (*spvDescriptorSet1.m_60).ssbo; + out.FragColor += spvDescriptorSet2.ubos[1]->ubo; + out.FragColor += registers.push; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-component-io.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-component-io.frag new file mode 100644 index 0000000000..9b4c5b5204 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-component-io.frag @@ -0,0 +1,99 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 m_location_0 [[color(0)]]; + float4 m_location_1 [[color(1)]]; + float4 m_location_2 [[color(2)]]; +}; + +struct main0_in +{ + float InC_0 [[user(locn0_1), flat]]; + float InA_0 [[user(locn1), flat]]; + float InC_1 [[user(locn1_1), flat]]; + float2 InB_0 [[user(locn1_2), flat]]; + float InA_1 [[user(locn2), flat]]; + float InC_2 [[user(locn2_1), flat]]; + float2 InB_1 [[user(locn2_2), flat]]; + float InD [[user(locn3_1), sample_perspective]]; + float InE [[user(locn4_2), center_no_perspective]]; + float InF [[user(locn5_3), centroid_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + float D = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + InA[0] = in.InA_0; + InA[1] = in.InA_1; + InB[0] = in.InB_0; + InB[1] = in.InB_1; + InC[0] = in.InC_0; + InC[1] = in.InC_1; + InC[2] = in.InC_2; + A = InA; + B = InB; + C = InC; + D = (in.InD + in.InE) + in.InF; + out.m_location_1.x = A[0]; + out.m_location_2.x = A[1]; + out.m_location_1.zw = B[0]; + out.m_location_2.zw = B[1]; + out.m_location_0.y = C[0]; + out.m_location_1.y = C[1]; + out.m_location_2.y = C[2]; + out.m_location_0.w = D; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..cdedd73a74 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,62 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _17 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 5.0 }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + for (int i = 0; i < 4; i++, out.FragColor += float4(_17[i])) + { + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-of-array-lut.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-array-lut.frag new file mode 100644 index 0000000000..ba553824e7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-array-lut.frag @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _17 = spvUnsafeArray({ 1.0, 2.0, 3.0 }); +constant spvUnsafeArray _21 = spvUnsafeArray({ 4.0, 5.0, 6.0 }); +constant spvUnsafeArray, 2> _22 = spvUnsafeArray, 2>({ spvUnsafeArray({ 1.0, 2.0, 3.0 }), spvUnsafeArray({ 4.0, 5.0, 6.0 }) }); + +struct main0_out +{ + float vOutput [[color(0)]]; +}; + +struct main0_in +{ + int vIndex1 [[user(locn0)]]; + int vIndex2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.vOutput = _22[in.vIndex1][in.vIndex2]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..9c02d302ed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,117 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct UBO +{ + uint index; +}; + +struct UBO2 +{ + uint index2; +}; + +struct spvDescriptorSetBuffer0 +{ + array, 4> uSampler [[id(0)]]; + array uSamplerSmplr [[id(4)]]; + constant UBO* uUBO [[id(8)]]; + constant UBO2* m_50 [[id(9)]]; + constant uint* spvSwizzleConstants [[id(10)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_in_func(constant array, 4>& uSampler, constant array& uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) +{ + return spvTextureSwizzle(uSampler[uUBO.index].sample(uSamplerSmplr[uUBO.index], vUV), uSamplerSwzl[uUBO.index]); +} + +static inline __attribute__((always_inline)) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +{ + return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant uint* spvSwizzleConstants [[buffer(30)]]) +{ + main0_out out = {}; + constant uint* spvDescriptorSet0_uSamplerSwzl = &spvDescriptorSet0.spvSwizzleConstants[0]; + out.FragColor = sample_in_func(spvDescriptorSet0.uSampler, spvDescriptorSet0.uSamplerSmplr, spvDescriptorSet0_uSamplerSwzl, (*spvDescriptorSet0.uUBO), in.vUV); + out.FragColor += sample_single_in_func(spvDescriptorSet0.uSampler[(*spvDescriptorSet0.m_50).index2], spvDescriptorSet0.uSamplerSmplr[(*spvDescriptorSet0.m_50).index2], spvDescriptorSet0_uSamplerSwzl[(*spvDescriptorSet0.m_50).index2], in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag new file mode 100644 index 0000000000..978ecbe1ef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag @@ -0,0 +1,108 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct UBO +{ + uint index; +}; + +struct UBO2 +{ + uint index2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_in_func(thread const array, 4>& uSampler, thread const array& uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) +{ + return spvTextureSwizzle(uSampler[uUBO.index].sample(uSamplerSmplr[uUBO.index], vUV), uSamplerSwzl[uUBO.index]); +} + +static inline __attribute__((always_inline)) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +{ + return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvSwizzleConstants [[buffer(30)]], constant UBO& uUBO [[buffer(0)]], constant UBO2& _50 [[buffer(1)]], array, 4> uSampler [[texture(0)]], array uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* uSamplerSwzl = &spvSwizzleConstants[0]; + out.FragColor = sample_in_func(uSampler, uSamplerSmplr, uSamplerSwzl, uUBO, in.vUV); + out.FragColor += sample_single_in_func(uSampler[_50.index2], uSamplerSmplr[_50.index2], uSamplerSwzl[_50.index2], in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..43a61e1f05 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,114 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct spvDescriptorSetBuffer0 +{ + array, 4> uSampler0 [[id(0)]]; + array uSampler0Smplr [[id(4)]]; + constant uint* spvSwizzleConstants [[id(8)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_in_func_1(constant array, 4>& uSampler0, constant array& uSampler0Smplr, constant uint* uSampler0Swzl, thread float2& vUV) +{ + return spvTextureSwizzle(uSampler0[2].sample(uSampler0Smplr[2], vUV), uSampler0Swzl[2]); +} + +static inline __attribute__((always_inline)) +float4 sample_in_func_2(thread float2& vUV, texture2d uSampler1, sampler uSampler1Smplr, constant uint& uSampler1Swzl) +{ + return spvTextureSwizzle(uSampler1.sample(uSampler1Smplr, vUV), uSampler1Swzl); +} + +static inline __attribute__((always_inline)) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +{ + return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], constant uint* spvSwizzleConstants [[buffer(30)]], texture2d uSampler1 [[texture(0)]], sampler uSampler1Smplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* spvDescriptorSet0_uSampler0Swzl = &spvDescriptorSet0.spvSwizzleConstants[0]; + constant uint& uSampler1Swzl = spvSwizzleConstants[0]; + out.FragColor = sample_in_func_1(spvDescriptorSet0.uSampler0, spvDescriptorSet0.uSampler0Smplr, spvDescriptorSet0_uSampler0Swzl, in.vUV); + out.FragColor += sample_in_func_2(in.vUV, uSampler1, uSampler1Smplr, uSampler1Swzl); + out.FragColor += sample_single_in_func(spvDescriptorSet0.uSampler0[1], spvDescriptorSet0.uSampler0Smplr[1], spvDescriptorSet0_uSampler0Swzl[1], in.vUV); + out.FragColor += sample_single_in_func(uSampler1, uSampler1Smplr, uSampler1Swzl, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag new file mode 100644 index 0000000000..1db803c560 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template struct spvRemoveReference { typedef T type; }; +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type& x) +{ + return static_cast(x); +} +template inline constexpr thread T&& spvForward(thread typename spvRemoveReference::type&& x) +{ + return static_cast(x); +} + +enum class spvSwizzle : uint +{ + none = 0, + zero, + one, + red, + green, + blue, + alpha +}; + +template +inline T spvGetSwizzle(vec x, T c, spvSwizzle s) +{ + switch (s) + { + case spvSwizzle::none: + return c; + case spvSwizzle::zero: + return 0; + case spvSwizzle::one: + return 1; + case spvSwizzle::red: + return x.r; + case spvSwizzle::green: + return x.g; + case spvSwizzle::blue: + return x.b; + case spvSwizzle::alpha: + return x.a; + } +} + +// Wrapper function that swizzles texture samples and fetches. +template +inline vec spvTextureSwizzle(vec x, uint s) +{ + if (!s) + return x; + return vec(spvGetSwizzle(x, x.r, spvSwizzle((s >> 0) & 0xFF)), spvGetSwizzle(x, x.g, spvSwizzle((s >> 8) & 0xFF)), spvGetSwizzle(x, x.b, spvSwizzle((s >> 16) & 0xFF)), spvGetSwizzle(x, x.a, spvSwizzle((s >> 24) & 0xFF))); +} + +template +inline T spvTextureSwizzle(T x, uint s) +{ + return spvTextureSwizzle(vec(x, 0, 0, 1), s).x; +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_in_func(thread const array, 4>& uSampler, thread const array& uSamplerSmplr, constant uint* uSamplerSwzl, thread float2& vUV) +{ + return spvTextureSwizzle(uSampler[2].sample(uSamplerSmplr[2], vUV), uSamplerSwzl[2]); +} + +static inline __attribute__((always_inline)) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +{ + return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); +} + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvSwizzleConstants [[buffer(30)]], array, 4> uSampler [[texture(0)]], array uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + constant uint* uSamplerSwzl = &spvSwizzleConstants[0]; + out.FragColor = sample_in_func(uSampler, uSamplerSmplr, uSamplerSwzl, in.vUV); + out.FragColor += sample_single_in_func(uSampler[1], uSamplerSmplr[1], uSamplerSwzl[1], in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag new file mode 100644 index 0000000000..1259283caa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct Vertices +{ + float2 uvs[1]; +}; + +struct main0_out +{ + float2 value [[color(0)]]; +}; + +struct main0_in +{ + float3 gl_BaryCoordNoPerspEXT [[barycentric_coord, center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device Vertices& _19 [[buffer(0)]], uint gl_PrimitiveID [[primitive_id]]) +{ + main0_out out = {}; + int prim = int(gl_PrimitiveID); + float2 uv0 = _19.uvs[(3 * prim) + 0]; + float2 uv1 = _19.uvs[(3 * prim) + 1]; + float2 uv2 = _19.uvs[(3 * prim) + 2]; + out.value = ((uv0 * in.gl_BaryCoordNoPerspEXT.x) + (uv1 * in.gl_BaryCoordNoPerspEXT.y)) + (uv2 * in.gl_BaryCoordNoPerspEXT.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv.msl22.frag new file mode 100644 index 0000000000..386d2d26f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/barycentric-nv.msl22.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct Vertices +{ + float2 uvs[1]; +}; + +struct main0_out +{ + float2 value [[color(0)]]; +}; + +struct main0_in +{ + float3 gl_BaryCoordEXT [[barycentric_coord, center_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device Vertices& _19 [[buffer(0)]], uint gl_PrimitiveID [[primitive_id]]) +{ + main0_out out = {}; + int prim = int(gl_PrimitiveID); + float2 uv0 = _19.uvs[(3 * prim) + 0]; + float2 uv1 = _19.uvs[(3 * prim) + 1]; + float2 uv2 = _19.uvs[(3 * prim) + 2]; + out.value = ((uv0 * in.gl_BaryCoordEXT.x) + (uv1 * in.gl_BaryCoordEXT.y)) + (uv2 * in.gl_BaryCoordEXT.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/basic.force-sample.frag b/third_party/spirv-cross/reference/shaders-msl/frag/basic.force-sample.frag new file mode 100644 index 0000000000..b9706b73f5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/basic.force-sample.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/basic.frag b/third_party/spirv-cross/reference/shaders-msl/frag/basic.frag new file mode 100644 index 0000000000..f33db61eba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/basic.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/binary-func-unpack-pack-arguments.frag b/third_party/spirv-cross/reference/shaders-msl/frag/binary-func-unpack-pack-arguments.frag new file mode 100644 index 0000000000..134cfe1847 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/binary-func-unpack-pack-arguments.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vIn [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = dot(in.vIn, float3(_15.color)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/binary-unpack-pack-arguments.frag b/third_party/spirv-cross/reference/shaders-msl/frag/binary-unpack-pack-arguments.frag new file mode 100644 index 0000000000..8bd538bec6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/binary-unpack-pack-arguments.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vIn [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = cross(in.vIn, float3(_15.color) - in.vIn); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.1d-as-2d.frag b/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.1d-as-2d.frag new file mode 100644 index 0000000000..ea49c067c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.1d-as-2d.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0)]]; + float4 FragColor1 [[color(1)]]; +}; + +struct main0_in +{ + float4 VertGeom [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) +{ + main0_out out = {}; + float4 texSample0 = TextureBase.sample(TextureBaseSmplr, float2(in.VertGeom.x, 0.5)); + float4 texSample1 = TextureDetail.sample(TextureDetailSmplr, float2(in.VertGeom.x, 0.5), int2(3, 0)); + int4 iResult0 = as_type(texSample0); + int4 iResult1 = as_type(texSample1); + out.FragColor0 = as_type(iResult0) * as_type(iResult1); + uint4 uResult0 = as_type(texSample0); + uint4 uResult1 = as_type(texSample1); + out.FragColor1 = as_type(uResult0) * as_type(uResult1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.frag b/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.frag new file mode 100644 index 0000000000..475b573a23 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/bitcasting.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0)]]; + float4 FragColor1 [[color(1)]]; +}; + +struct main0_in +{ + float4 VertGeom [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d TextureBase [[texture(0)]], texture2d TextureDetail [[texture(1)]], sampler TextureBaseSmplr [[sampler(0)]], sampler TextureDetailSmplr [[sampler(1)]]) +{ + main0_out out = {}; + float4 texSample0 = TextureBase.sample(TextureBaseSmplr, in.VertGeom.xy); + float4 texSample1 = TextureDetail.sample(TextureDetailSmplr, in.VertGeom.xy, int2(3, 2)); + int4 iResult0 = as_type(texSample0); + int4 iResult1 = as_type(texSample1); + out.FragColor0 = as_type(iResult0) * as_type(iResult1); + uint4 uResult0 = as_type(texSample0); + uint4 uResult1 = as_type(texSample1); + out.FragColor1 = as_type(uResult0) * as_type(uResult1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag b/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag new file mode 100644 index 0000000000..4f114ed724 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d buf [[texture(0)]], texture2d bufOut [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = buf.read(spvTexelBufferCoord(0)); + bufOut.write(out.FragColor, spvTexelBufferCoord(int(gl_FragCoord.x))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag new file mode 100644 index 0000000000..71496a4efe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture_buffer buf [[texture(0)]], texture_buffer bufOut [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = buf.read(uint(0)); + bufOut.write(out.FragColor, uint(int(gl_FragCoord.x))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/builtins.frag b/third_party/spirv-cross/reference/shaders-msl/frag/builtins.frag new file mode 100644 index 0000000000..f9085252b3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/builtins.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + float gl_FragDepth [[depth(any)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = gl_FragCoord + in.vColor; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/clip-distance-varying.frag b/third_party/spirv-cross/reference/shaders-msl/frag/clip-distance-varying.frag new file mode 100644 index 0000000000..9a72d5ba39 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/clip-distance-varying.frag @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_ClipDistance = {}; + gl_ClipDistance[0] = in.gl_ClipDistance_0; + gl_ClipDistance[1] = in.gl_ClipDistance_1; + out.FragColor = float4((1.0 - gl_ClipDistance[0]) - gl_ClipDistance[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..9cd8bdc21c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 results[1024]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIn [[user(locn0)]]; + int vIn2 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], device UBO& _34 [[buffer(0)]], texture2d Buf [[texture(0)]], sampler BufSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int4 coords = Buf.read(uint2(int2(gl_FragCoord.xy)), 0); + float4 foo = _34.results[coords.x % 16]; + int c = in.vIn * in.vIn; + int d = in.vIn2 * in.vIn2; + out.FragColor = (foo + foo) + _34.results[c + d]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/reference/shaders-msl/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..dfab4d26f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vTexCoord [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d Texture [[texture(0)]], sampler TextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float f = Texture.sample(TextureSmplr, in.vTexCoord).x; + out.FragColor = float4(f * f); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/constant-array.frag b/third_party/spirv-cross/reference/shaders-msl/frag/constant-array.frag new file mode 100644 index 0000000000..990860762c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/constant-array.frag @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foobar +{ + float a; + float b; +}; + +constant spvUnsafeArray _37 = spvUnsafeArray({ float4(1.0), float4(2.0), float4(3.0) }); +constant spvUnsafeArray _49 = spvUnsafeArray({ float4(1.0), float4(2.0) }); +constant spvUnsafeArray _54 = spvUnsafeArray({ float4(8.0), float4(10.0) }); +constant spvUnsafeArray, 2> _55 = spvUnsafeArray, 2>({ spvUnsafeArray({ float4(1.0), float4(2.0) }), spvUnsafeArray({ float4(8.0), float4(10.0) }) }); +constant spvUnsafeArray _75 = spvUnsafeArray({ Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 resolve(thread const Foobar& f) +{ + return float4(f.a + f.b); +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Foobar param = Foobar{ 10.0, 20.0 }; + Foobar param_1 = _75[in.index]; + out.FragColor = ((_37[in.index] + _55[in.index][in.index + 1]) + resolve(param)) + resolve(param_1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/constant-composites.frag b/third_party/spirv-cross/reference/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..e0fa980fb8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float b; +}; + +constant spvUnsafeArray _16 = spvUnsafeArray({ 1.0, 4.0, 3.0, 2.0 }); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int line [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + spvUnsafeArray _28 = spvUnsafeArray({ Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } }); + + main0_out out = {}; + out.FragColor = float4(_16[in.line]); + out.FragColor += float4(_28[in.line].a * _28[1 - in.line].a); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/shaders-msl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..4d10167130 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vInput [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = in.vInput; + float4 t = uSampler.sample(uSamplerSmplr, in.vInput.xy); + float4 d0 = dfdx(in.vInput); + float4 d1 = dfdy(in.vInput); + float4 d2 = fwidth(in.vInput); + float4 d3 = dfdx(in.vInput); + float4 d4 = dfdy(in.vInput); + float4 d5 = fwidth(in.vInput); + float4 d6 = dfdx(in.vInput); + float4 d7 = dfdy(in.vInput); + float4 d8 = fwidth(in.vInput); + if (in.vInput.y > 10.0) + { + out.FragColor += t; + out.FragColor += d0; + out.FragColor += d1; + out.FragColor += d2; + out.FragColor += d3; + out.FragColor += d4; + out.FragColor += d5; + out.FragColor += d6; + out.FragColor += d7; + out.FragColor += d8; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/cull-distance-varying.frag b/third_party/spirv-cross/reference/shaders-msl/frag/cull-distance-varying.frag new file mode 100644 index 0000000000..708a295710 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/cull-distance-varying.frag @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_CullDistance_0 [[user(cull0)]]; + float gl_CullDistance_1 [[user(cull1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_CullDistance = {}; + gl_CullDistance[0] = in.gl_CullDistance_0; + gl_CullDistance[1] = in.gl_CullDistance_1; + out.FragColor = float4((1.0 - gl_CullDistance[0]) - gl_CullDistance[1]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag new file mode 100644 index 0000000000..924ba7ecca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct buf0 +{ + float4 u_scale; +}; + +struct buf1 +{ + float4 u_bias; +}; + +struct main0_out +{ + float4 o_color [[color(0)]]; +}; + +struct main0_in +{ + float3 v_texCoord [[user(locn0)]]; + float v_lodBias [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array u_sampler [[texture(0)]], sampler u_samplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.o_color = float4(u_sampler.sample_compare(u_samplerSmplr, float2(in.v_texCoord.x, 0.5), uint(rint(in.v_texCoord.y)), in.v_texCoord.z, gradient2d(exp2(in.v_lodBias - 0.5) / float2(u_sampler.get_width(), 1.0), exp2(in.v_lodBias - 0.5) / float2(u_sampler.get_width(), 1.0))), 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/depth-greater-than.frag b/third_party/spirv-cross/reference/shaders-msl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..5861509fc1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/depth-greater-than.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(greater)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/depth-less-than.frag b/third_party/spirv-cross/reference/shaders-msl/frag/depth-less-than.frag new file mode 100644 index 0000000000..f1177fa640 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/depth-less-than.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float gl_FragDepth [[depth(less)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.gl_FragDepth = 0.5; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-early-frag-tests.frag b/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-early-frag-tests.frag new file mode 100644 index 0000000000..21884d81c5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-early-frag-tests.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 color_out [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0() +{ + float gl_FragDepth; + main0_out out = {}; + out.color_out = float4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988079071044921875; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-no-early-frag-tests.frag b/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-no-early-frag-tests.frag new file mode 100644 index 0000000000..57d810fafc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/depth-out-no-early-frag-tests.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 color_out [[color(0)]]; + float gl_FragDepth [[depth(less)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.color_out = float4(1.0, 0.0, 0.0, 1.0); + out.gl_FragDepth = 0.699999988079071044921875; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/disable-frag-output.frag-output.frag b/third_party/spirv-cross/reference/shaders-msl/frag/disable-frag-output.frag-output.frag new file mode 100644 index 0000000000..63bc45b8af --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/disable-frag-output.frag-output.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 buf1 [[color(1)]]; + float4 buf3 [[color(3)]]; + float4 buf6 [[color(6)]]; + float4 buf7 [[color(7)]]; +}; + +fragment main0_out main0() +{ + float4 buf0; + float4 buf2; + float4 buf4; + float4 buf5; + float gl_FragDepth; + int gl_FragStencilRefARB; + main0_out out = {}; + buf0 = float4(0.0, 0.0, 0.0, 1.0); + out.buf1 = float4(1.0, 0.0, 0.0, 1.0); + buf2 = float4(0.0, 1.0, 0.0, 1.0); + out.buf3 = float4(0.0, 0.0, 1.0, 1.0); + buf4 = float4(1.0, 0.0, 1.0, 0.5); + buf5 = float4(0.25); + out.buf6 = float4(0.75); + out.buf7 = float4(1.0); + gl_FragDepth = 0.89999997615814208984375; + gl_FragStencilRefARB = uint(127); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/dual-source-blending.frag b/third_party/spirv-cross/reference/shaders-msl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..37938bf8ca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/dual-source-blending.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor0 [[color(0), index(0)]]; + float4 FragColor1 [[color(0), index(1)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor0 = float4(1.0); + out.FragColor1 = float4(2.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/early-fragment-tests.frag b/third_party/spirv-cross/reference/shaders-msl/frag/early-fragment-tests.frag new file mode 100644 index 0000000000..850fdc9205 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/early-fragment-tests.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/false-loop-init.frag b/third_party/spirv-cross/reference/shaders-msl/frag/false-loop-init.frag new file mode 100644 index 0000000000..7a4d6d5a3f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/false-loop-init.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 result [[color(0)]]; +}; + +struct main0_in +{ + float4 accum [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.result = float4(0.0); + uint j; + for (int i = 0; i < 4; i += int(j)) + { + if (in.accum.y > 10.0) + { + j = 40u; + } + else + { + j = 30u; + } + out.result += in.accum; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/flush_params.frag b/third_party/spirv-cross/reference/shaders-msl/frag/flush_params.frag new file mode 100644 index 0000000000..905a179bc6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/flush_params.frag @@ -0,0 +1,40 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Structy +{ + float4 c; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +void foo2(thread Structy& f) +{ + f.c = float4(10.0); +} + +static inline __attribute__((always_inline)) +Structy foo() +{ + Structy param; + foo2(param); + Structy f = param; + return f; +} + +fragment main0_out main0() +{ + main0_out out = {}; + Structy s = foo(); + out.FragColor = s.c; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..847ec6532f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(0.0); + int i = 0; + int _36; + for (;;) + { + if (i < 3) + { + int a = i; + out.FragColor[a] += float(i); + if (false) + { + _36 = 1; + } + else + { + int _41 = i; + i = _41 + 1; + _36 = _41; + } + continue; + } + else + { + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-init.frag b/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-init.frag new file mode 100644 index 0000000000..9f3191b971 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/for-loop-init.frag @@ -0,0 +1,58 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + int FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = 16; + for (int i = 0; i < 25; i++) + { + out.FragColor += 10; + } + for (int i_1 = 1, j = 4; i_1 < 30; i_1++, j += 4) + { + out.FragColor += 11; + } + int k = 0; + for (; k < 20; k++) + { + out.FragColor += 12; + } + k += 3; + out.FragColor += k; + int l; + if (k == 40) + { + l = 0; + for (; l < 40; l++) + { + out.FragColor += 13; + } + return out; + } + else + { + l = k; + out.FragColor += l; + } + int2 i_2 = int2(0); + for (; i_2.x < 10; i_2.x += 4) + { + out.FragColor += i_2.y; + } + int o = k; + for (int m = k; m < 40; m++) + { + out.FragColor += m; + } + out.FragColor += o; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/fp16-packing.frag b/third_party/spirv-cross/reference/shaders-msl/frag/fp16-packing.frag new file mode 100644 index 0000000000..e21feb43ec --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/fp16-packing.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 FP32Out [[color(0)]]; + uint FP16Out [[color(1)]]; +}; + +struct main0_in +{ + uint FP16 [[user(locn0)]]; + float2 FP32 [[user(locn1), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FP32Out = float2(as_type(in.FP16)); + out.FP16Out = as_type(half2(in.FP32)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..648dc9cf89 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag @@ -0,0 +1,71 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct foo_t +{ + float x; + uint y; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 frag_body(device foo_t& foo, thread float4& gl_FragCoord, texture2d bar, device atomic_uint* bar_atomic, thread bool& gl_HelperInvocation) +{ + if (!gl_HelperInvocation) + { + foo.x = 1.0; + } + uint _25 = (!gl_HelperInvocation ? atomic_exchange_explicit((device atomic_uint*)&foo.y, 0u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + if (int(gl_FragCoord.x) == 3) + { + gl_HelperInvocation = true, discard_fragment(); + } + (gl_HelperInvocation ? ((void)0) : bar.write(uint4(1u), uint2(int2(gl_FragCoord.xy)))); + uint _50 = (!gl_HelperInvocation ? atomic_fetch_add_explicit((device atomic_uint*)&foo.y, 42u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _57 = (!gl_HelperInvocation ? atomic_fetch_or_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], 62u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed)); + uint _60 = (!gl_HelperInvocation ? atomic_fetch_and_explicit((device atomic_uint*)&foo.y, 65535u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _63 = (!gl_HelperInvocation ? atomic_fetch_xor_explicit((device atomic_uint*)&foo.y, 4294967040u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _65 = (!gl_HelperInvocation ? atomic_fetch_min_explicit((device atomic_uint*)&foo.y, 1u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _71 = (!gl_HelperInvocation ? atomic_fetch_max_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], 100u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed)); + uint _76; + if (!gl_HelperInvocation) + { + do + { + _76 = 100u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], &_76, 42u, memory_order_relaxed, memory_order_relaxed) && _76 == 100u); + } + else + { + _76 = atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed); + } + bool _77 = gl_HelperInvocation; + return float4(1.0, float(_77), 0.0, 1.0); +} + +fragment main0_out main0(device foo_t& foo [[buffer(0)]], texture2d bar [[texture(0)]], device atomic_uint* bar_atomic [[buffer(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + float4 _85 = frag_body(foo, gl_FragCoord, bar, bar_atomic, gl_HelperInvocation); + out.fragColor = _85; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag new file mode 100644 index 0000000000..0c11898b08 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag @@ -0,0 +1,49 @@ +#include +#include + +using namespace metal; + +struct foo +{ + int x; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +fragment main0_out main0(device foo& _24 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + if (gl_FragCoord.y == 7.0) + { + gl_HelperInvocation = true, discard_fragment(); + } + if (!gl_HelperInvocation) + { + _24.x = 0; + } + for (;;) + { + if (float(_24.x) < gl_FragCoord.x) + { + int _41 = _24.x; + int _43 = _41 + 1; + if (!gl_HelperInvocation) + { + _24.x = _43; + } + continue; + } + else + { + break; + } + } + out.fragColor = float4(float(_24.x), 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..c2ae69695f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag @@ -0,0 +1,70 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct foo_t +{ + float x; + uint y; +}; + +struct main0_out +{ + float4 fragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 frag_body(device foo_t& foo, thread float4& gl_FragCoord, texture2d bar, device atomic_uint* bar_atomic, thread bool& gl_HelperInvocation) +{ + if (!gl_HelperInvocation) + { + foo.x = 1.0; + } + uint _25 = (!gl_HelperInvocation ? atomic_exchange_explicit((device atomic_uint*)&foo.y, 0u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + if (int(gl_FragCoord.x) == 3) + { + gl_HelperInvocation = true, discard_fragment(); + } + (gl_HelperInvocation ? ((void)0) : bar.write(uint4(1u), uint2(int2(gl_FragCoord.xy)))); + uint _51 = (!gl_HelperInvocation ? atomic_fetch_add_explicit((device atomic_uint*)&foo.y, 42u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _58 = (!gl_HelperInvocation ? atomic_fetch_or_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], 62u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed)); + uint _61 = (!gl_HelperInvocation ? atomic_fetch_and_explicit((device atomic_uint*)&foo.y, 65535u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _64 = (!gl_HelperInvocation ? atomic_fetch_xor_explicit((device atomic_uint*)&foo.y, 4294967040u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _66 = (!gl_HelperInvocation ? atomic_fetch_min_explicit((device atomic_uint*)&foo.y, 1u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&foo.y, memory_order_relaxed)); + uint _72 = (!gl_HelperInvocation ? atomic_fetch_max_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], 100u, memory_order_relaxed) : atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed)); + uint _77; + if (!gl_HelperInvocation) + { + do + { + _77 = 100u; + } while (!atomic_compare_exchange_weak_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], &_77, 42u, memory_order_relaxed, memory_order_relaxed) && _77 == 100u); + } + else + { + _77 = atomic_load_explicit((device atomic_uint*)&bar_atomic[spvImage2DAtomicCoord(int2(gl_FragCoord.xy), bar)], memory_order_relaxed); + } + return float4(1.0, 0.0, 0.0, 1.0); +} + +fragment main0_out main0(device foo_t& foo [[buffer(0)]], texture2d bar [[texture(0)]], device atomic_uint* bar_atomic [[buffer(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + float4 _84 = frag_body(foo, gl_FragCoord, bar, bar_atomic, gl_HelperInvocation); + out.fragColor = _84; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag b/third_party/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag new file mode 100644 index 0000000000..6420bb9f4e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag @@ -0,0 +1,82 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColors_0 [[color(0)]]; + float4 FragColors_1 [[color(1)]]; + float4 FragColor2 [[color(2)]]; + float4 FragColor3 [[color(3)]]; +}; + +struct main0_in +{ + float3 vColor [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +void set_globals(thread spvUnsafeArray& FragColors, thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3) +{ + FragColors[0] = vColor.x; + FragColors[1] = vColor.y; + FragColor2 = vColor.xz; + FragColor3 = vColor.zzz; +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray FragColors = {}; + float2 FragColor2 = {}; + float3 FragColor3 = {}; + set_globals(FragColors, in.vColor, FragColor2, FragColor3); + out.FragColors_0 = float4(FragColors[0]); + out.FragColors_1 = float4(FragColors[1]); + out.FragColor2.xy = FragColor2; + out.FragColor3.xyz = FragColor3; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/front-facing.frag b/third_party/spirv-cross/reference/shaders-msl/frag/front-facing.frag new file mode 100644 index 0000000000..2f83642492 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/front-facing.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], bool gl_FrontFacing [[front_facing]]) +{ + main0_out out = {}; + if (gl_FrontFacing) + { + out.FragColor = in.vA; + } + else + { + out.FragColor = in.vB; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/gather-dref.frag b/third_party/spirv-cross/reference/shaders-msl/frag/gather-dref.frag new file mode 100644 index 0000000000..c5c5ccf0bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/gather-dref.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uT [[texture(0)]], sampler uTSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uT.gather_compare(uTSmplr, in.vUV.xy, in.vUV.z); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/gather-offset.frag b/third_party/spirv-cross/reference/shaders-msl/frag/gather-offset.frag new file mode 100644 index 0000000000..02b80194b5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/gather-offset.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uT [[texture(0)]], sampler uTSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uT.gather(uTSmplr, float2(0.5), int2(0), component::w); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag new file mode 100644 index 0000000000..36d1423909 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag @@ -0,0 +1,39 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 foo(texture2d uSampler, sampler uSamplerSmplr, thread float2& vUV) +{ + float4 color; + if (!simd_is_helper_thread()) + { + color = uSampler.sample(uSamplerSmplr, vUV, level(0.0)); + } + else + { + color = float4(1.0); + } + return color; +} + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = foo(uSampler, uSamplerSmplr, in.vUV); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag b/third_party/spirv-cross/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag new file mode 100644 index 0000000000..a35835846d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag @@ -0,0 +1,58 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4 v; +}; + +struct spvDescriptorSetBuffer0 +{ + array, 10000> uSamplers [[id(0)]]; + array uSamplersSmplr [[id(10000)]]; +}; + +struct spvDescriptorSetBuffer1 +{ + constant UBO* vs [[id(0)]][10000]; +}; + +struct spvDescriptorSetBuffer2 +{ + texture2d uSampler [[id(0)]]; + sampler uSamplerSmplr [[id(1)]]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 samp_array(const device array, 10000>& uSamplers, const device array& uSamplersSmplr, thread float2& vUV, constant UBO* const device (&vs)[10000]) +{ + return uSamplers[9999].sample(uSamplersSmplr[9999], vUV) + vs[5000]->v; +} + +static inline __attribute__((always_inline)) +float4 samp_single(thread float2& vUV, texture2d uSampler, sampler uSamplerSmplr) +{ + return uSampler.sample(uSamplerSmplr, vUV); +} + +fragment main0_out main0(main0_in in [[stage_in]], const device spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], const device spvDescriptorSetBuffer1& spvDescriptorSet1 [[buffer(1)]], constant spvDescriptorSetBuffer2& spvDescriptorSet2 [[buffer(2)]]) +{ + main0_out out = {}; + out.FragColor = samp_array(spvDescriptorSet0.uSamplers, spvDescriptorSet0.uSamplersSmplr, in.vUV, spvDescriptorSet1.vs) + samp_single(in.vUV, spvDescriptorSet2.uSampler, spvDescriptorSet2.uSamplerSmplr); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/illegal-name-test-0.frag b/third_party/spirv-cross/reference/shaders-msl/frag/illegal-name-test-0.frag new file mode 100644 index 0000000000..6b209b49d5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/illegal-name-test-0.frag @@ -0,0 +1,21 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float4 fragment0 = float4(10.0); + float4 compute0 = float4(10.0); + float4 kernel0 = float4(10.0); + float4 vertex0 = float4(10.0); + out.FragColor = ((fragment0 + compute0) + kernel0) + vertex0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag new file mode 100644 index 0000000000..2362597fa5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +void from_function(thread float2& FragColor, texture2d uSampler2D, sampler uSampler2DSmplr, thread float3& vUV, texture3d uSampler3D, sampler uSampler3DSmplr, texturecube uSamplerCube, sampler uSamplerCubeSmplr, texture2d uTexture2D, sampler uSampler, texture3d uTexture3D, texturecube uTextureCube) +{ + float2 _22; + _22.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, vUV.xy); + _22.y = uSampler2D.calculate_unclamped_lod(uSampler2DSmplr, vUV.xy); + FragColor += _22; + float2 _31; + _31.x = uSampler3D.calculate_clamped_lod(uSampler3DSmplr, vUV); + _31.y = uSampler3D.calculate_unclamped_lod(uSampler3DSmplr, vUV); + FragColor += _31; + float2 _40; + _40.x = uSamplerCube.calculate_clamped_lod(uSamplerCubeSmplr, vUV); + _40.y = uSamplerCube.calculate_unclamped_lod(uSamplerCubeSmplr, vUV); + FragColor += _40; + float2 _53; + _53.x = uTexture2D.calculate_clamped_lod(uSampler, vUV.xy); + _53.y = uTexture2D.calculate_unclamped_lod(uSampler, vUV.xy); + FragColor += _53; + float2 _62; + _62.x = uTexture3D.calculate_clamped_lod(uSampler, vUV); + _62.y = uTexture3D.calculate_unclamped_lod(uSampler, vUV); + FragColor += _62; + float2 _71; + _71.x = uTextureCube.calculate_clamped_lod(uSampler, vUV); + _71.y = uTextureCube.calculate_unclamped_lod(uSampler, vUV); + FragColor += _71; +} + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler2D [[texture(0)]], texture3d uSampler3D [[texture(1)]], texturecube uSamplerCube [[texture(2)]], texture2d uTexture2D [[texture(3)]], texture3d uTexture3D [[texture(4)]], texturecube uTextureCube [[texture(5)]], sampler uSampler2DSmplr [[sampler(0)]], sampler uSampler3DSmplr [[sampler(1)]], sampler uSamplerCubeSmplr [[sampler(2)]], sampler uSampler [[sampler(3)]]) +{ + main0_out out = {}; + out.FragColor = float2(0.0); + float2 _79; + _79.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, in.vUV.xy); + _79.y = uSampler2D.calculate_unclamped_lod(uSampler2DSmplr, in.vUV.xy); + out.FragColor += _79; + float2 _84; + _84.x = uSampler3D.calculate_clamped_lod(uSampler3DSmplr, in.vUV); + _84.y = uSampler3D.calculate_unclamped_lod(uSampler3DSmplr, in.vUV); + out.FragColor += _84; + float2 _89; + _89.x = uSamplerCube.calculate_clamped_lod(uSamplerCubeSmplr, in.vUV); + _89.y = uSamplerCube.calculate_unclamped_lod(uSamplerCubeSmplr, in.vUV); + out.FragColor += _89; + float2 _97; + _97.x = uTexture2D.calculate_clamped_lod(uSampler, in.vUV.xy); + _97.y = uTexture2D.calculate_unclamped_lod(uSampler, in.vUV.xy); + out.FragColor += _97; + float2 _104; + _104.x = uTexture3D.calculate_clamped_lod(uSampler, in.vUV); + _104.y = uTexture3D.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _104; + float2 _111; + _111.x = uTextureCube.calculate_clamped_lod(uSampler, in.vUV); + _111.y = uTextureCube.calculate_unclamped_lod(uSampler, in.vUV); + out.FragColor += _111; + from_function(out.FragColor, uSampler2D, uSampler2DSmplr, in.vUV, uSampler3D, uSampler3DSmplr, uSamplerCube, uSamplerCubeSmplr, uTexture2D, uSampler, uTexture3D, uTextureCube); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/in_block.frag b/third_party/spirv-cross/reference/shaders-msl/frag/in_block.frag new file mode 100644 index 0000000000..efb0cbd429 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/in_block.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +struct VertexOut +{ + float4 color; + float4 color2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 inputs_color [[user(locn2)]]; + float4 inputs_color2 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + VertexOut inputs = {}; + inputs.color = in.inputs_color; + inputs.color2 = in.inputs_color2; + out.FragColor = inputs.color + inputs.color2; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag b/third_party/spirv-cross/reference/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag new file mode 100644 index 0000000000..7b011ffb58 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Foo +{ + float a; + float b; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float foos_0_a [[user(locn1)]]; + float foos_0_b [[user(locn2)]]; + float foos_1_a [[user(locn3)]]; + float foos_1_b [[user(locn4)]]; + float foos_2_a [[user(locn5)]]; + float foos_2_b [[user(locn6)]]; + float foos_3_a [[user(locn7)]]; + float foos_3_b [[user(locn8)]]; + float bars_0_a [[user(locn10)]]; + float bars_0_b [[user(locn11)]]; + float bars_1_a [[user(locn12)]]; + float bars_1_b [[user(locn13)]]; + float bars_2_a [[user(locn14)]]; + float bars_2_b [[user(locn15)]]; + float bars_3_a [[user(locn16)]]; + float bars_3_b [[user(locn17)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray foos = {}; + spvUnsafeArray bars = {}; + foos[0].a = in.foos_0_a; + foos[0].b = in.foos_0_b; + foos[1].a = in.foos_1_a; + foos[1].b = in.foos_1_b; + foos[2].a = in.foos_2_a; + foos[2].b = in.foos_2_b; + foos[3].a = in.foos_3_a; + foos[3].b = in.foos_3_b; + bars[0].a = in.bars_0_a; + bars[0].b = in.bars_0_b; + bars[1].a = in.bars_1_a; + bars[1].b = in.bars_1_b; + bars[2].a = in.bars_2_a; + bars[2].b = in.bars_2_b; + bars[3].a = in.bars_3_a; + bars[3].b = in.bars_3_b; + out.FragColor.x = foos[0].a; + out.FragColor.y = foos[1].b; + out.FragColor.z = foos[2].a; + out.FragColor.w = bars[3].b; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/in_mat.frag b/third_party/spirv-cross/reference/shaders-msl/frag/in_mat.frag new file mode 100644 index 0000000000..cf7da2ef29 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/in_mat.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 outFragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 inPos [[user(locn0)]]; + float3 inNormal [[user(locn1)]]; + float4 inInvModelView_0 [[user(locn2)]]; + float4 inInvModelView_1 [[user(locn3)]]; + float4 inInvModelView_2 [[user(locn4)]]; + float4 inInvModelView_3 [[user(locn5)]]; + float inLodBias [[user(locn6)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube samplerColor [[texture(0)]], sampler samplerColorSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float4x4 inInvModelView = {}; + inInvModelView[0] = in.inInvModelView_0; + inInvModelView[1] = in.inInvModelView_1; + inInvModelView[2] = in.inInvModelView_2; + inInvModelView[3] = in.inInvModelView_3; + float3 cI = fast::normalize(in.inPos); + float3 cR = reflect(cI, fast::normalize(in.inNormal)); + cR = float3((inInvModelView * float4(cR, 0.0)).xyz); + cR.x *= (-1.0); + out.outFragColor = samplerColor.sample(samplerColorSmplr, cR, bias(in.inLodBias)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag new file mode 100644 index 0000000000..3f91c2c409 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_Layer) +{ + float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_Layer, gl_SampleID); + return _24; +} + +fragment main0_out main0(texture2d_ms_array uSubpass0 [[texture(0)]], texture2d_ms_array uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_Layer, 2)) + load_subpasses(uSubpass0, gl_SampleID, gl_FragCoord, gl_Layer); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..97629d8e44 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d_ms uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord) +{ + float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_SampleID); + return _24; +} + +fragment main0_out main0(texture2d_ms uSubpass0 [[texture(0)]], texture2d_ms uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), 1) + uSubpass1.read(uint2(gl_FragCoord.xy), 2)) + load_subpasses(uSubpass0, gl_SampleID, gl_FragCoord); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag new file mode 100644 index 0000000000..1b6b9f6aae --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) +{ + float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_ViewIndex, gl_SampleID); + return _24; +} + +fragment main0_out main0(constant uint* spvViewMask [[buffer(24)]], texture2d_ms_array uSubpass0 [[texture(0)]], texture2d_ms_array uSubpass1 [[texture(1)]], uint gl_SampleID [[sample_id]], float4 gl_FragCoord [[position]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = (uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 1) + uSubpass1.read(uint2(gl_FragCoord.xy), gl_ViewIndex, 2)) + load_subpasses(uSubpass0, gl_SampleID, gl_FragCoord, gl_ViewIndex); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag new file mode 100644 index 0000000000..934abd585f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag @@ -0,0 +1,25 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_Layer) +{ + return uInput.read(uint2(gl_FragCoord.xy), gl_Layer); +} + +fragment main0_out main0(texture2d_array uSubpass0 [[texture(0)]], texture2d_array uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy), gl_Layer) + load_subpasses(uSubpass1, gl_FragCoord, gl_Layer); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.frag new file mode 100644 index 0000000000..0643acfa72 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.frag @@ -0,0 +1,25 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d uInput, thread float4& gl_FragCoord) +{ + return uInput.read(uint2(gl_FragCoord.xy)); +} + +fragment main0_out main0(texture2d uSubpass0 [[texture(0)]], texture2d uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy)) + load_subpasses(uSubpass1, gl_FragCoord); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.multiview.frag b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.multiview.frag new file mode 100644 index 0000000000..6ba2421659 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/input-attachment.multiview.frag @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 load_subpasses(texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) +{ + return uInput.read(uint2(gl_FragCoord.xy), gl_ViewIndex); +} + +fragment main0_out main0(constant uint* spvViewMask [[buffer(24)]], texture2d_array uSubpass0 [[texture(0)]], texture2d_array uSubpass1 [[texture(1)]], float4 gl_FragCoord [[position]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = uSubpass0.read(uint2(gl_FragCoord.xy), gl_ViewIndex) + load_subpasses(uSubpass1, gl_FragCoord, gl_ViewIndex); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers-block.frag b/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers-block.frag new file mode 100644 index 0000000000..6148b8915c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers-block.frag @@ -0,0 +1,47 @@ +#include +#include + +using namespace metal; + +struct Input +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 inp_v0 [[user(locn0), centroid_no_perspective]]; + float2 inp_v1 [[user(locn1), centroid_no_perspective]]; + float3 inp_v2 [[user(locn2), centroid_no_perspective]]; + float4 inp_v3 [[user(locn3), centroid_no_perspective]]; + float inp_v4 [[user(locn4), centroid_no_perspective]]; + float inp_v5 [[user(locn5), centroid_no_perspective]]; + float inp_v6 [[user(locn6), centroid_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Input inp = {}; + inp.v0 = in.inp_v0; + inp.v1 = in.inp_v1; + inp.v2 = in.inp_v2; + inp.v3 = in.inp_v3; + inp.v4 = in.inp_v4; + inp.v5 = in.inp_v5; + inp.v6 = in.inp_v6; + out.FragColor = float4(inp.v0.x + inp.v1.y, inp.v2.xy, ((inp.v3.w * inp.v4) + inp.v5) - inp.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers.frag b/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers.frag new file mode 100644 index 0000000000..aff6e1b0f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/interpolation-qualifiers.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1), center_no_perspective]]; + float3 v2 [[user(locn2), centroid_perspective]]; + float4 v3 [[user(locn3), centroid_no_perspective]]; + float v4 [[user(locn4), sample_perspective]]; + float v5 [[user(locn5), sample_no_perspective]]; + float v6 [[user(locn6), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = float4(in.v0.x + in.v1.y, in.v2.xy, ((in.v3.w * in.v4) + in.v5) - in.v6); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag b/third_party/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag new file mode 100644 index 0000000000..b1e0e7311d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _16 = spvUnsafeArray({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 }); +constant spvUnsafeArray _60 = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); +constant spvUnsafeArray _104 = spvUnsafeArray({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) }); + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = _16[in.index]; + if (in.index < 10) + { + out.FragColor += _16[in.index ^ 1]; + } + else + { + out.FragColor += _16[in.index & 1]; + } + if (in.index > 30) + { + out.FragColor += _60[in.index & 3].y; + } + else + { + out.FragColor += _60[in.index & 1].x; + } + spvUnsafeArray foobar = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + if (in.index > 30) + { + foobar[1].z = 20.0; + } + out.FragColor += foobar[in.index & 3].z; + spvUnsafeArray baz = spvUnsafeArray({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) }); + baz = _104; + out.FragColor += baz[in.index & 3].z; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/mix.frag b/third_party/spirv-cross/reference/shaders-msl/frag/mix.frag new file mode 100644 index 0000000000..ee28bf9261 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/mix.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vIn0 [[user(locn0)]]; + float4 vIn1 [[user(locn1)]]; + float vIn2 [[user(locn2)]]; + float vIn3 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + bool4 l = bool4(false, true, false, false); + out.FragColor = select(in.vIn0, in.vIn1, l); + bool f = true; + out.FragColor = float4(f ? in.vIn3 : in.vIn2); + out.FragColor = select(in.vIn1, in.vIn0, bool4(f)); + out.FragColor = float4(f ? in.vIn2 : in.vIn3); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/modf-access-tracking-function.frag b/third_party/spirv-cross/reference/shaders-msl/frag/modf-access-tracking-function.frag new file mode 100644 index 0000000000..934561e809 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/modf-access-tracking-function.frag @@ -0,0 +1,33 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 vo0 [[color(0)]]; + float4 vo1 [[color(1)]]; +}; + +struct main0_in +{ + float4 v [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 modf_inner(thread float4& v, thread float4& vo1) +{ + float4 _16 = modf(v, vo1); + return _16; +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _20 = modf_inner(in.v, out.vo1); + out.vo0 = _20; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/mrt-array.frag b/third_party/spirv-cross/reference/shaders-msl/frag/mrt-array.frag new file mode 100644 index 0000000000..bc26828441 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/mrt-array.frag @@ -0,0 +1,94 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +// Implementation of the GLSL mod() function, which is slightly different than Metal fmod() +template +inline Tx mod(Tx x, Ty y) +{ + return x - y * floor(x / y); +} + +struct main0_out +{ + float4 FragColor_0 [[color(0)]]; + float4 FragColor_1 [[color(1)]]; + float4 FragColor_2 [[color(2)]]; + float4 FragColor_3 [[color(3)]]; +}; + +struct main0_in +{ + float4 vA [[user(locn0)]]; + float4 vB [[user(locn1)]]; +}; + +static inline __attribute__((always_inline)) +void write_deeper_in_function(thread spvUnsafeArray& FragColor, thread float4& vA, thread float4& vB) +{ + FragColor[3] = vA * vB; +} + +static inline __attribute__((always_inline)) +void write_in_function(thread spvUnsafeArray& FragColor, thread float4& vA, thread float4& vB) +{ + FragColor[2] = vA - vB; + write_deeper_in_function(FragColor, vA, vB); +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray FragColor = {}; + FragColor[0] = mod(in.vA, in.vB); + FragColor[1] = in.vA + in.vB; + write_in_function(FragColor, in.vA, in.vB); + out.FragColor_0 = FragColor[0]; + out.FragColor_1 = FragColor[1]; + out.FragColor_2 = FragColor[2]; + out.FragColor_3 = FragColor[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/nonuniform-qualifier.msl2.frag b/third_party/spirv-cross/reference/shaders-msl/frag/nonuniform-qualifier.msl2.frag new file mode 100644 index 0000000000..401703cbaf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/nonuniform-qualifier.msl2.frag @@ -0,0 +1,56 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4 v[64]; +}; + +struct SSBO +{ + float4 v[1]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int vIndex [[user(locn0)]]; + float2 vUV [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant UBO* ubos_0 [[buffer(0)]], constant UBO* ubos_1 [[buffer(1)]], const device SSBO* ssbos_0 [[buffer(2)]], const device SSBO* ssbos_1 [[buffer(3)]], array, 8> uSamplers [[texture(0)]], array, 8> uCombinedSamplers [[texture(8)]], array uSamps [[sampler(0)]], array uCombinedSamplersSmplr [[sampler(7)]]) +{ + constant UBO* ubos[] = + { + ubos_0, + ubos_1, + }; + + const device SSBO* ssbos[] = + { + ssbos_0, + ssbos_1, + }; + + main0_out out = {}; + int i = in.vIndex; + int _25 = i + 10; + int _37 = i + 40; + out.FragColor = uSamplers[_25].sample(uSamps[_37], in.vUV); + int _53 = i + 10; + out.FragColor = uCombinedSamplers[_53].sample(uCombinedSamplersSmplr[_53], in.vUV); + int _69 = i + 20; + int _73 = i + 40; + out.FragColor += ubos[_69]->v[_73]; + int _87 = i + 50; + int _91 = i + 60; + out.FragColor += ssbos[_87]->v[_91]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/packed-expression-vector-shuffle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/packed-expression-vector-shuffle.frag new file mode 100644 index 0000000000..2ed369353f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/packed-expression-vector-shuffle.frag @@ -0,0 +1,27 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + packed_float3 color; + float v; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + float4 f = float4(1.0); + f.x = _15.color[0]; + f.y = _15.color[1]; + f.z = _15.color[2]; + out.FragColor = f; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag b/third_party/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag new file mode 100644 index 0000000000..f82d8a5797 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag @@ -0,0 +1,55 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct VertexOutput +{ + float4 HPosition; +}; + +struct TestStruct +{ + float3 position; + float radius; +}; + +struct TestStruct_1 +{ + packed_float3 position; + float radius; +}; + +struct CB0 +{ + TestStruct_1 CB0[16]; +}; + +struct main0_out +{ + float4 _entryPointOutput [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 _main(thread const VertexOutput& IN, constant CB0& _RESERVED_IDENTIFIER_FIXUP_24) +{ + TestStruct st; + st.position = float3(_RESERVED_IDENTIFIER_FIXUP_24.CB0[1].position); + st.radius = _RESERVED_IDENTIFIER_FIXUP_24.CB0[1].radius; + float4 col = float4(st.position, st.radius); + return col; +} + +fragment main0_out main0(constant CB0& _RESERVED_IDENTIFIER_FIXUP_24 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + VertexOutput IN; + IN.HPosition = gl_FragCoord; + VertexOutput param = IN; + VertexOutput param_1 = param; + out._entryPointOutput = _main(param_1, _RESERVED_IDENTIFIER_FIXUP_24); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag b/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag new file mode 100644 index 0000000000..1bfaff53bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag @@ -0,0 +1,53 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct Buffer3 +{ + int baz; +}; + +struct Buffer +{ + int foo; + uint bar; +}; + +struct Buffer2 +{ + uint quux; +}; + +struct spvDescriptorSetBuffer0 +{ + device Buffer3* m_9 [[id(0)]]; + texture2d img4 [[id(1)]]; + texture2d img [[id(2), raster_order_group(0)]]; + texture2d img3 [[id(3), raster_order_group(0)]]; + texture2d img2 [[id(4), raster_order_group(0)]]; + device atomic_uint* img2_atomic [[id(5), raster_order_group(0)]]; + volatile device Buffer* m_42 [[id(6), raster_order_group(0)]]; + device Buffer2* m_52 [[id(7), raster_order_group(0)]]; +}; + +fragment void main0(constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]]) +{ + (*spvDescriptorSet0.m_9).baz = 0; + spvDescriptorSet0.img4.write(float4(1.0, 0.0, 0.0, 1.0), uint2(int2(1))); + spvDescriptorSet0.img.write(spvDescriptorSet0.img3.read(uint2(int2(0))), uint2(int2(0))); + uint _39 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.img2_atomic[spvImage2DAtomicCoord(int2(0), spvDescriptorSet0.img2)], 1u, memory_order_relaxed); + (*spvDescriptorSet0.m_42).foo += 42; + uint _55 = atomic_fetch_and_explicit((volatile device atomic_uint*)&(*spvDescriptorSet0.m_42).bar, (*spvDescriptorSet0.m_52).quux, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.frag b/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.frag new file mode 100644 index 0000000000..6a300e8c58 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/pixel-interlock-ordered.msl2.frag @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +// The required alignment of a linear texture of R32Uint format. +constant uint spvLinearTextureAlignmentOverride [[function_constant(65535)]]; +constant uint spvLinearTextureAlignment = is_function_constant_defined(spvLinearTextureAlignmentOverride) ? spvLinearTextureAlignmentOverride : 4; +// Returns buffer coords corresponding to 2D texture coords for emulating 2D texture atomics +#define spvImage2DAtomicCoord(tc, tex) (((((tex).get_width() + spvLinearTextureAlignment / 4 - 1) & ~( spvLinearTextureAlignment / 4 - 1)) * (tc).y) + (tc).x) + +struct Buffer3 +{ + int baz; +}; + +struct Buffer +{ + int foo; + uint bar; +}; + +struct Buffer2 +{ + uint quux; +}; + +fragment void main0(device Buffer3& _9 [[buffer(0)]], volatile device Buffer& _42 [[buffer(2), raster_order_group(0)]], device Buffer2& _52 [[buffer(3), raster_order_group(0)]], texture2d img4 [[texture(0)]], texture2d img [[texture(1), raster_order_group(0)]], texture2d img3 [[texture(2), raster_order_group(0)]], texture2d img2 [[texture(3), raster_order_group(0)]], device atomic_uint* img2_atomic [[buffer(1), raster_order_group(0)]]) +{ + _9.baz = 0; + img4.write(float4(1.0, 0.0, 0.0, 1.0), uint2(int2(1))); + img.write(img3.read(uint2(int2(0))), uint2(int2(0))); + uint _39 = atomic_fetch_add_explicit((device atomic_uint*)&img2_atomic[spvImage2DAtomicCoord(int2(0), img2)], 1u, memory_order_relaxed); + _42.foo += 42; + uint _55 = atomic_fetch_and_explicit((volatile device atomic_uint*)&_42.bar, _52.quux, memory_order_relaxed); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/pls.frag b/third_party/spirv-cross/reference/shaders-msl/frag/pls.frag new file mode 100644 index 0000000000..ee774a04af --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/pls.frag @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 PLSOut0 [[color(0)]]; + float4 PLSOut1 [[color(1)]]; + float4 PLSOut2 [[color(2)]]; + float4 PLSOut3 [[color(3)]]; +}; + +struct main0_in +{ + float4 PLSIn0 [[user(locn0)]]; + float4 PLSIn1 [[user(locn1)]]; + float4 PLSIn2 [[user(locn2)]]; + float4 PLSIn3 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.PLSOut0 = in.PLSIn0 * 2.0; + out.PLSOut1 = in.PLSIn1 * 6.0; + out.PLSOut2 = in.PLSIn2 * 7.0; + out.PLSOut3 = in.PLSIn3 * 4.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.ios.msl2.frag b/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.ios.msl2.frag new file mode 100644 index 0000000000..3b2885e2e2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.ios.msl2.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask, post_depth_coverage]]) +{ + main0_out out = {}; + out.FragColor = float4(float(gl_SampleMaskIn)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.msl23.frag new file mode 100644 index 0000000000..3b2885e2e2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/post-depth-coverage.msl23.frag @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +[[ early_fragment_tests ]] fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask, post_depth_coverage]]) +{ + main0_out out = {}; + out.FragColor = float4(float(gl_SampleMaskIn)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag b/third_party/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag new file mode 100644 index 0000000000..7c11a937a2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct AStruct +{ + float4 foobar; +}; + +struct main0_out +{ + float3 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +void someFunction(thread AStruct& s) +{ + s.foobar = float4(1.0); +} + +static inline __attribute__((always_inline)) +void otherFunction(thread float3& global_variable) +{ + global_variable = float3(1.0); +} + +fragment main0_out main0() +{ + main0_out out = {}; + AStruct param; + someFunction(param); + AStruct inputs = param; + float3 global_variable; + otherFunction(global_variable); + out.FragColor = global_variable; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag b/third_party/spirv-cross/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag new file mode 100644 index 0000000000..3ab6a47161 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag @@ -0,0 +1,60 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include +#if __METAL_VERSION__ >= 230 +#include +using namespace metal::raytracing; +#endif + +using namespace metal; + +struct main0_out +{ + float4 outColor [[color(0)]]; +}; + +struct main0_in +{ + float4 inPos [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +uint doRay(thread const float3& rayOrigin, thread const float3& rayDirection, thread const float& rayDistance, thread raytracing::intersection_query& rayQuery, thread const raytracing::acceleration_structure& topLevelAS) +{ + rayQuery.reset(ray(rayOrigin, rayDirection, 0.001000000047497451305389404296875, rayDistance), topLevelAS, intersection_params()); + for (;;) + { + bool _36 = rayQuery.next(); + if (_36) + { + continue; + } + else + { + break; + } + } + uint _40 = uint(rayQuery.get_committed_intersection_type()); + return _40; +} + +fragment main0_out main0(main0_in in [[stage_in]], raytracing::acceleration_structure topLevelAS [[buffer(0)]]) +{ + main0_out out = {}; + float3 rayOrigin = float3((in.inPos.xy * 4.0) - float2(2.0), 1.0); + float3 rayDirection = float3(0.0, 0.0, -1.0); + float rayDistance = 2.0; + float3 param = rayOrigin; + float3 param_1 = rayDirection; + float param_2 = rayDistance; + raytracing::intersection_query rayQuery; + uint _70 = doRay(param, param_1, param_2, rayQuery, topLevelAS); + if (_70 == 0u) + { + discard_fragment(); + } + out.outColor = in.inPos; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/read-cull-clip-distance-in-function.frag b/third_party/spirv-cross/reference/shaders-msl/frag/read-cull-clip-distance-in-function.frag new file mode 100644 index 0000000000..02d57d9bee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/read-cull-clip-distance-in-function.frag @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; + float gl_CullDistance_0 [[user(cull0)]]; + float gl_CullDistance_1 [[user(cull1)]]; +}; + +static inline __attribute__((always_inline)) +float4 read_in_func(thread spvUnsafeArray& gl_CullDistance, thread spvUnsafeArray& gl_ClipDistance) +{ + return float4(gl_CullDistance[0], gl_CullDistance[1], gl_ClipDistance[0], gl_ClipDistance[1]); +} + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_CullDistance = {}; + spvUnsafeArray gl_ClipDistance = {}; + gl_CullDistance[0] = in.gl_CullDistance_0; + gl_CullDistance[1] = in.gl_CullDistance_1; + gl_ClipDistance[0] = in.gl_ClipDistance_0; + gl_ClipDistance[1] = in.gl_ClipDistance_1; + out.FragColor = read_in_func(gl_CullDistance, gl_ClipDistance); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag b/third_party/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag new file mode 100644 index 0000000000..d72363a242 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 read_from_function(const device SSBO& _13) +{ + return _13.v; +} + +fragment main0_out main0(const device SSBO& _13 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = _13.v + read_from_function(_13); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/return-value-after-discard-terminator.frag b/third_party/spirv-cross/reference/shaders-msl/frag/return-value-after-discard-terminator.frag new file mode 100644 index 0000000000..d8895e0e7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/return-value-after-discard-terminator.frag @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct buff_t +{ + int m0[1024]; +}; + +struct main0_out +{ + float4 frag_clr [[color(0)]]; +}; + +fragment main0_out main0(device buff_t& buff [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int2 frag_coord = int2(int4(gl_FragCoord).xy); + int buff_idx = (frag_coord.y * 32) + frag_coord.x; + out.frag_clr = float4(0.0, 0.0, 1.0, 1.0); + buff.m0[buff_idx] = 1; + discard_fragment(); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag new file mode 100644 index 0000000000..f0bf396c50 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag @@ -0,0 +1,43 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float sample_normal2(depth2d tex, sampler uSampler, thread float3& vUV) +{ + return float4(tex.sample(uSampler, vUV.xy)).x; +} + +static inline __attribute__((always_inline)) +float sample_normal(depth2d tex, sampler uSampler, thread float3& vUV) +{ + return sample_normal2(tex, uSampler, vUV); +} + +static inline __attribute__((always_inline)) +float sample_comp(depth2d tex, thread float3& vUV, sampler uSamplerShadow) +{ + return tex.sample_compare(uSamplerShadow, vUV.xy, vUV.z); +} + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uTexture [[texture(0)]], sampler uSampler [[sampler(0)]], sampler uSamplerShadow [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = sample_normal(uTexture, uSampler, in.vUV); + out.FragColor += sample_comp(uTexture, in.vUV, uSamplerShadow); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag new file mode 100644 index 0000000000..27653a06a4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag @@ -0,0 +1,31 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float sample_depth_from_function(depth2d uT, sampler uS) +{ + return uT.sample_compare(uS, float3(0.5).xy, 0.5); +} + +static inline __attribute__((always_inline)) +float sample_color_from_function(texture2d uT, sampler uS) +{ + return uT.sample(uS, float2(0.5)).x; +} + +fragment main0_out main0(depth2d uDepth [[texture(0)]], texture2d uColor [[texture(1)]], sampler uSamplerShadow [[sampler(0)]], sampler uSampler [[sampler(1)]]) +{ + main0_out out = {}; + out.FragColor = sample_depth_from_function(uDepth, uSamplerShadow) + sample_color_from_function(uColor, uSampler); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag new file mode 100644 index 0000000000..626fe4c79c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = (gl_SampleMaskIn & 0x22 & (1 << gl_SampleID)); + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag new file mode 100644 index 0000000000..f478901b6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]]) +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = (gl_SampleMaskIn & 0x22); + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag new file mode 100644 index 0000000000..d04f2033bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.fixed-sample-mask.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.fixed-sample-mask.frag new file mode 100644 index 0000000000..76306b5ade --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.fixed-sample-mask.frag @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0; + out.gl_SampleMask &= 0x22; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.frag new file mode 100644 index 0000000000..6a282395d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-mask.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float4(1.0); + out.gl_SampleMask = 0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag new file mode 100644 index 0000000000..025f874d26 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int index [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +float4 getColor(thread const int& i, thread float2& gl_SamplePosition) +{ + return float4(gl_SamplePosition, float(i), 1.0); +} + +fragment main0_out main0(main0_in in [[stage_in]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + int param = in.index; + out.FragColor = getColor(param, gl_SamplePosition); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-position.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-position.frag new file mode 100644 index 0000000000..8d26acb9f1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-position.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + out.FragColor = float4(gl_SamplePosition, float(gl_SampleID), 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag new file mode 100644 index 0000000000..77acb3f9b9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_array tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float3 _28 = float3(gl_FragCoord.xy, float(gl_SampleID)); + out.FragColor = tex.sample(texSmplr, _28.xy, uint(rint(_28.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag new file mode 100644 index 0000000000..0f78738eea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float foo [[user(locn0), sample_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d_array tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float3 _26 = float3(gl_FragCoord.xy, in.foo); + out.FragColor = tex.sample(texSmplr, _26.xy, uint(rint(_26.z))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag new file mode 100644 index 0000000000..f8f357fe7c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + float2 gl_SamplePosition = get_sample_position(gl_SampleID); + out.FragColor = tex.sample(texSmplr, (gl_FragCoord.xy - gl_SamplePosition)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag new file mode 100644 index 0000000000..1ed8148d4c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d tex [[texture(0)]], sampler texSmplr [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleID [[sample_id]]) +{ + main0_out out = {}; + gl_FragCoord.xy += get_sample_position(gl_SampleID) - 0.5; + out.FragColor = tex.sample(texSmplr, gl_FragCoord.xy); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag new file mode 100644 index 0000000000..70278b1290 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vTex [[user(locn0), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor += ((uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), bias(2.0)) + uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), level(3.0))) + uSampler.sample(uSamplerSmplr, float2(in.vTex, 0.5), gradient2d(5.0, 8.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.frag new file mode 100644 index 0000000000..96914f8056 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-1d-lod.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float vTex [[user(locn0), flat]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture1d uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor += ((uSampler.sample(uSamplerSmplr, in.vTex) + uSampler.sample(uSamplerSmplr, in.vTex)) + uSampler.sample(uSamplerSmplr, in.vTex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag new file mode 100644 index 0000000000..924736ebb0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, float2(in.vUV.x, 0.5), uint(rint(in.vUV.y)), in.vUV.z, bias(1.0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.frag new file mode 100644 index 0000000000..092b11d18a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, level(0)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag new file mode 100644 index 0000000000..fdd4d16442 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, gradient2d(float2(0.0), float2(0.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag new file mode 100644 index 0000000000..f66f5d38c1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d_array uTex [[texture(0)]], sampler uShadow [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, level(0)) + uTex.sample_compare(uShadow, in.vUV.xy, uint(rint(in.vUV.z)), in.vUV.w, gradient2d(float2(1.0), float2(1.0))); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag new file mode 100644 index 0000000000..8d1934d4ef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag @@ -0,0 +1,48 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float2 vTex [[user(locn0), flat]]; + int vIndex [[user(locn1)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_from_global(thread int& vIndex, thread float2& vTex, thread const array, 4>& uSampler, thread const array& uSamplerSmplr) +{ + return uSampler[vIndex].sample(uSamplerSmplr[vIndex], (vTex + float2(0.100000001490116119384765625))); +} + +static inline __attribute__((always_inline)) +float4 sample_from_argument(thread const array, 4>& samplers, thread const array& samplersSmplr, thread int& vIndex, thread float2& vTex) +{ + return samplers[vIndex].sample(samplersSmplr[vIndex], (vTex + float2(0.20000000298023223876953125))); +} + +static inline __attribute__((always_inline)) +float4 sample_single_from_argument(texture2d samp, sampler sampSmplr, thread float2& vTex) +{ + return samp.sample(sampSmplr, (vTex + float2(0.300000011920928955078125))); +} + +fragment main0_out main0(main0_in in [[stage_in]], array, 4> uSampler [[texture(0)]], array, 4> uTextures [[texture(4)]], array uSamplerSmplr [[sampler(0)]], array uSamplers [[sampler(4)]]) +{ + main0_out out = {}; + out.FragColor = float4(0.0); + out.FragColor += uTextures[2].sample(uSamplers[1], in.vTex); + out.FragColor += uSampler[in.vIndex].sample(uSamplerSmplr[in.vIndex], in.vTex); + out.FragColor += sample_from_global(in.vIndex, in.vTex, uSampler, uSamplerSmplr); + out.FragColor += sample_from_argument(uSampler, uSamplerSmplr, in.vIndex, in.vTex); + out.FragColor += sample_single_from_argument(uSampler[3], uSamplerSmplr[3], in.vTex); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler-ms.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-ms.frag new file mode 100644 index 0000000000..1ceb3f96bd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler-ms.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d_ms uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + int2 coord = int2(gl_FragCoord.xy); + out.FragColor = ((uSampler.read(uint2(coord), 0) + uSampler.read(uint2(coord), 1)) + uSampler.read(uint2(coord), 2)) + uSampler.read(uint2(coord), 3); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/sampler.frag b/third_party/spirv-cross/reference/shaders-msl/frag/sampler.frag new file mode 100644 index 0000000000..84743fbd6e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/sampler.frag @@ -0,0 +1,32 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex [[user(locn1)]]; +}; + +static inline __attribute__((always_inline)) +float4 sample_texture(texture2d tex, sampler texSmplr, thread const float2& uv) +{ + return tex.sample(texSmplr, uv); +} + +fragment main0_out main0(main0_in in [[stage_in]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + float2 param = in.vTex; + out.FragColor = in.vColor * sample_texture(uTex, uTexSmplr, param); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/shaders-msl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..fc908cb3e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/scalar-refract-reflect.frag @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvReflect(T i, T n) +{ + return i - T(2) * i * n * n; +} + +template +inline T spvRefract(T i, T n, T eta) +{ + T NoI = n * i; + T NoI2 = NoI * NoI; + T k = T(1) - eta * eta * (T(1) - NoI2); + if (k < T(0)) + { + return T(0); + } + else + { + return eta * i - (eta * NoI + sqrt(k)) * n; + } +} + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vRefract [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = spvRefract(in.vRefract.x, in.vRefract.y, in.vRefract.z); + out.FragColor += spvReflect(in.vRefract.x, in.vRefract.y); + out.FragColor += refract(in.vRefract.xy, in.vRefract.yz, in.vRefract.z).y; + out.FragColor += reflect(in.vRefract.xy, in.vRefract.zy).y; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag b/third_party/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag new file mode 100644 index 0000000000..208f5d9095 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag @@ -0,0 +1,25 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 samp(texture2d t, sampler s) +{ + return t.sample(s, float2(0.5)); +} + +fragment main0_out main0(texture2d uDepth [[texture(0)]], sampler uSampler [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = samp(uDepth, uSampler); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag b/third_party/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag new file mode 100644 index 0000000000..e9694aa196 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag @@ -0,0 +1,102 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct SSBO +{ + char i8[16]; + uchar u8[16]; +}; + +struct Push +{ + char i8; + uchar u8; +}; + +struct UBO +{ + char i8; + uchar u8; +}; + +struct main0_out +{ + int4 FragColorInt [[color(0)]]; + uint4 FragColorUint [[color(1)]]; +}; + +struct main0_in +{ + int4 vColor [[user(locn0)]]; +}; + +static inline __attribute__((always_inline)) +void packing_int8(device SSBO& ssbo) +{ + short i16 = short(10); + int i32 = 20; + char2 i8_2 = as_type(i16); + char4 i8_4 = as_type(i32); + i16 = as_type(i8_2); + i32 = as_type(i8_4); + ssbo.i8[0] = i8_4.x; + ssbo.i8[1] = i8_4.y; + ssbo.i8[2] = i8_4.z; + ssbo.i8[3] = i8_4.w; +} + +static inline __attribute__((always_inline)) +void packing_uint8(device SSBO& ssbo) +{ + ushort u16 = ushort(10); + uint u32 = 20u; + uchar2 u8_2 = as_type(u16); + uchar4 u8_4 = as_type(u32); + u16 = as_type(u8_2); + u32 = as_type(u8_4); + ssbo.u8[0] = u8_4.x; + ssbo.u8[1] = u8_4.y; + ssbo.u8[2] = u8_4.z; + ssbo.u8[3] = u8_4.w; +} + +static inline __attribute__((always_inline)) +void compute_int8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread int4& FragColorInt) +{ + char4 tmp = char4(vColor); + tmp += char4(registers.i8); + tmp += char4(char(-40)); + tmp += char4(-50); + tmp += char4(char(10), char(20), char(30), char(40)); + tmp += char4(ssbo.i8[4]); + tmp += char4(ubo.i8); + FragColorInt = int4(tmp); +} + +static inline __attribute__((always_inline)) +void compute_uint8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread uint4& FragColorUint) +{ + uchar4 tmp = uchar4(char4(vColor)); + tmp += uchar4(registers.u8); + tmp += uchar4(uchar(216)); + tmp += uchar4(206); + tmp += uchar4(uchar(10), uchar(20), uchar(30), uchar(40)); + tmp += uchar4(ssbo.u8[4]); + tmp += uchar4(ubo.u8); + FragColorUint = uint4(tmp); +} + +fragment main0_out main0(main0_in in [[stage_in]], device SSBO& ssbo [[buffer(0)]], constant Push& registers [[buffer(1)]], constant UBO& ubo [[buffer(2)]]) +{ + main0_out out = {}; + packing_int8(ssbo); + packing_uint8(ssbo); + compute_int8(ssbo, in.vColor, registers, ubo, out.FragColorInt); + compute_uint8(ssbo, in.vColor, registers, ubo, out.FragColorUint); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..36456b814b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-block-size.frag @@ -0,0 +1,32 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +constant int Value = SPIRV_CROSS_CONSTANT_ID_10; + +struct SpecConstArray +{ + float4 samples[Value]; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int Index [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant SpecConstArray& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = _15.samples[in.Index]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..059006509a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/spec-constant-ternary.frag @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +constant uint s_tmp [[function_constant(0)]]; +constant uint s = is_function_constant_defined(s_tmp) ? s_tmp : 10u; +constant bool _13 = (s > 20u); +constant uint f = _13 ? 30u : 50u; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = float(f); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag new file mode 100644 index 0000000000..f3629e18be --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag @@ -0,0 +1,30 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 MRT0 [[color(0)]]; + float4 MRT1 [[color(1)]]; + uint gl_FragStencilRefARB [[stencil]]; +}; + +static inline __attribute__((always_inline)) +void update_stencil(thread uint& gl_FragStencilRefARB) +{ + gl_FragStencilRefARB = uint(int(gl_FragStencilRefARB) + 10); +} + +fragment main0_out main0() +{ + main0_out out = {}; + out.MRT0 = float4(1.0); + out.MRT1 = float4(1.0, 0.0, 1.0, 1.0); + out.gl_FragStencilRefARB = uint(100); + update_stencil(out.gl_FragStencilRefARB); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-builtins.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-builtins.msl22.frag new file mode 100644 index 0000000000..03a536f0c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-builtins.msl22.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + uint2 FragColor [[color(0)]]; +}; + +fragment main0_out main0(uint gl_SubgroupSize [[threads_per_simdgroup]], uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]]) +{ + main0_out out = {}; + out.FragColor.x = gl_SubgroupSize; + out.FragColor.y = gl_SubgroupInvocationID; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-globals-extract.msl22.frag b/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-globals-extract.msl22.frag new file mode 100644 index 0000000000..ec0911aed6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/subgroup-globals-extract.msl22.frag @@ -0,0 +1,86 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +inline uint spvSubgroupBallotFindLSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(ctz(ballot.x), select(32 + ctz(ballot.y), select(64 + ctz(ballot.z), select(96 + ctz(ballot.w), uint(-1), ballot.w == 0), ballot.z == 0), ballot.y == 0), ballot.x == 0); +} + +inline uint spvSubgroupBallotFindMSB(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + ballot &= mask; + return select(128 - (clz(ballot.w) + 1), select(96 - (clz(ballot.z) + 1), select(64 - (clz(ballot.y) + 1), select(32 - (clz(ballot.x) + 1), uint(-1), ballot.x == 0), ballot.y == 0), ballot.z == 0), ballot.w == 0); +} + +inline uint spvPopCount4(uint4 ballot) +{ + return popcount(ballot.x) + popcount(ballot.y) + popcount(ballot.z) + popcount(ballot.w); +} + +inline uint spvSubgroupBallotBitCount(uint4 ballot, uint gl_SubgroupSize) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupSize, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupSize - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotInclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID + 1, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID + 1 - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +inline uint spvSubgroupBallotExclusiveBitCount(uint4 ballot, uint gl_SubgroupInvocationID) +{ + uint4 mask = uint4(extract_bits(0xFFFFFFFF, 0, min(gl_SubgroupInvocationID, 32u)), extract_bits(0xFFFFFFFF, 0, (uint)max((int)gl_SubgroupInvocationID - 32, 0)), uint2(0)); + return spvPopCount4(ballot & mask); +} + +struct main0_out +{ + uint2 FragColor [[color(0)]]; +}; + +static inline __attribute__((always_inline)) +uint sub1(thread uint& gl_SubgroupSize) +{ + return spvSubgroupBallotFindLSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize); +} + +static inline __attribute__((always_inline)) +uint sub2(thread uint& gl_SubgroupSize) +{ + return spvSubgroupBallotFindMSB(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize); +} + +static inline __attribute__((always_inline)) +uint sub3(thread uint& gl_SubgroupSize) +{ + return spvSubgroupBallotBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupSize); +} + +static inline __attribute__((always_inline)) +uint sub4(thread uint& gl_SubgroupInvocationID) +{ + return spvSubgroupBallotInclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID); +} + +static inline __attribute__((always_inline)) +uint sub5(thread uint& gl_SubgroupInvocationID) +{ + return spvSubgroupBallotExclusiveBitCount(uint4(1u, 2u, 3u, 4u), gl_SubgroupInvocationID); +} + +fragment main0_out main0(uint gl_SubgroupInvocationID [[thread_index_in_simdgroup]], uint gl_SubgroupSize [[threads_per_simdgroup]]) +{ + main0_out out = {}; + out.FragColor.x = (((sub1(gl_SubgroupSize) + sub2(gl_SubgroupSize)) + sub3(gl_SubgroupSize)) + sub4(gl_SubgroupInvocationID)) + sub5(gl_SubgroupInvocationID); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/shaders-msl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..8d7903b79b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/switch-unreachable-break.frag @@ -0,0 +1,43 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + int cond; + int cond2; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(10.0); + switch (_15.cond) + { + case 1: + { + if (_15.cond2 < 50) + { + break; + } + else + { + discard_fragment(); + } + break; // unreachable workaround + } + default: + { + out.FragColor = float4(20.0); + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/shaders-msl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..4cd2b6852a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/switch-unsigned-case.frag @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct Buff +{ + uint TestVal; +}; + +struct main0_out +{ + float4 fsout_Color [[color(0)]]; +}; + +fragment main0_out main0(constant Buff& _15 [[buffer(0)]]) +{ + main0_out out = {}; + out.fsout_Color = float4(1.0); + switch (_15.TestVal) + { + case 0u: + { + out.fsout_Color = float4(0.100000001490116119384765625); + break; + } + case 1u: + { + out.fsout_Color = float4(0.20000000298023223876953125); + break; + } + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/swizzle.frag b/third_party/spirv-cross/reference/shaders-msl/frag/swizzle.frag new file mode 100644 index 0000000000..7a0494e064 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/swizzle.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vNormal [[user(locn1)]]; + float2 vUV [[user(locn2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d samp [[texture(0)]], sampler sampSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = float4(samp.sample(sampSmplr, in.vUV).xyz, 1.0); + out.FragColor = float4(samp.sample(sampSmplr, in.vUV).xz, 1.0, 4.0); + out.FragColor = float4(samp.sample(sampSmplr, in.vUV).xx, samp.sample(sampSmplr, (in.vUV + float2(0.100000001490116119384765625))).yy); + out.FragColor = float4(in.vNormal, 1.0); + out.FragColor = float4(in.vNormal + float3(1.7999999523162841796875), 1.0); + out.FragColor = float4(in.vUV, in.vUV + float2(1.7999999523162841796875)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag new file mode 100644 index 0000000000..98b9bb7ef8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], texture2d uTexture2 [[texture(1)]], sampler uTextureSmplr [[sampler(0)]], sampler uTexture2Smplr [[sampler(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(1)), 0); + out.FragColor += uTexture2.read(uint2(uint(int(gl_FragCoord.x)), 0) + uint2(uint(-1), 0), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..4d4301e1ca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(texture2d uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(1)), 0); + out.FragColor += uTexture.read(uint2(int2(gl_FragCoord.xy)) + uint2(int2(-1, 1)), 0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.frag new file mode 100644 index 0000000000..ae5764e820 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.frag @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube cubeSampler [[texture(0)]], texturecube_array cubeArraySampler [[texture(1)]], texture2d_array texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]]) +{ + main0_out out = {}; + float4 a = cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz); + float4 b = cubeArraySampler.sample(cubeArraySamplerSmplr, in.vUV.xyz, uint(rint(in.vUV.w))); + float4 c = texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(rint(in.vUV.xyz.z))); + out.FragColor = (a + b) + c; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag new file mode 100644 index 0000000000..a49604d5a3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag @@ -0,0 +1,61 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +float3 spvCubemapTo2DArrayFace(float3 P) +{ + float3 Coords = abs(P.xyz); + float CubeFace = 0; + float ProjectionAxis = 0; + float u = 0; + float v = 0; + if (Coords.x >= Coords.y && Coords.x >= Coords.z) + { + CubeFace = P.x >= 0 ? 0 : 1; + ProjectionAxis = Coords.x; + u = P.x >= 0 ? -P.z : P.z; + v = -P.y; + } + else if (Coords.y >= Coords.x && Coords.y >= Coords.z) + { + CubeFace = P.y >= 0 ? 2 : 3; + ProjectionAxis = Coords.y; + u = P.x; + v = P.y >= 0 ? P.z : -P.z; + } + else + { + CubeFace = P.z >= 0 ? 4 : 5; + ProjectionAxis = Coords.z; + u = P.z >= 0 ? P.x : -P.x; + v = -P.y; + } + u = 0.5 * (u/ProjectionAxis + 1); + v = 0.5 * (v/ProjectionAxis + 1); + return float3(u, v, CubeFace); +} + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vUV [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texturecube cubeSampler [[texture(0)]], texture2d_array cubeArraySampler [[texture(1)]], texture2d_array texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]]) +{ + main0_out out = {}; + float4 a = cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz); + float4 b = cubeArraySampler.sample(cubeArraySamplerSmplr, spvCubemapTo2DArrayFace(in.vUV.xyz).xy, uint(spvCubemapTo2DArrayFace(in.vUV.xyz).z) + (uint(rint(in.vUV.w)) * 6u)); + float4 c = texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(rint(in.vUV.xyz.z))); + out.FragColor = (a + b) + c; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texture-multisample-array.msl21.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texture-multisample-array.msl21.frag new file mode 100644 index 0000000000..ed1e81f3e8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texture-multisample-array.msl21.frag @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + int3 vCoord [[user(locn0)]]; + int vSample [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], texture2d_ms_array uTexture [[texture(0)]], sampler uTextureSmplr [[sampler(0)]]) +{ + main0_out out = {}; + out.FragColor = uTexture.read(uint2(in.vCoord.xy), uint(in.vCoord.z), in.vSample); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/reference/shaders-msl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..1ef450a2b3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/texture-proj-shadow.frag @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vClip3 [[user(locn0)]]; + float4 vClip4 [[user(locn1)]]; + float2 vClip2 [[user(locn2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], depth2d uShadow2D [[texture(0)]], texture1d uSampler1D [[texture(1)]], texture2d uSampler2D [[texture(2)]], texture3d uSampler3D [[texture(3)]], sampler uShadow2DSmplr [[sampler(0)]], sampler uSampler1DSmplr [[sampler(1)]], sampler uSampler2DSmplr [[sampler(2)]], sampler uSampler3DSmplr [[sampler(3)]]) +{ + main0_out out = {}; + float4 _17 = in.vClip4; + float4 _20 = _17; + _20.z = _17.w; + out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, _17.z / _20.z); + out.FragColor = uSampler1D.sample(uSampler1DSmplr, in.vClip2.x / in.vClip2.y).x; + out.FragColor = uSampler2D.sample(uSampler2DSmplr, in.vClip3.xy / in.vClip3.z).x; + out.FragColor = uSampler3D.sample(uSampler3DSmplr, in.vClip4.xyz / in.vClip4.w).x; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/ubo_layout.frag b/third_party/spirv-cross/reference/shaders-msl/frag/ubo_layout.frag new file mode 100644 index 0000000000..4ca603d643 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/ubo_layout.frag @@ -0,0 +1,37 @@ +#include +#include + +using namespace metal; + +struct Str +{ + float4x4 foo; +}; + +struct UBO1 +{ + Str foo; +}; + +struct Str_1 +{ + float4x4 foo; +}; + +struct UBO2 +{ + Str_1 foo; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0(constant UBO1& ubo1 [[buffer(0)]], constant UBO2& ubo0 [[buffer(1)]]) +{ + main0_out out = {}; + out.FragColor = float4(ubo1.foo.foo[0][0], ubo1.foo.foo[1][0], ubo1.foo.foo[2][0], ubo1.foo.foo[3][0]) + ubo0.foo.foo[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/unary-enclose.frag b/third_party/spirv-cross/reference/shaders-msl/frag/unary-enclose.frag new file mode 100644 index 0000000000..c33269f2bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/unary-enclose.frag @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vIn [[user(locn0)]]; + int4 vIn1 [[user(locn1)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.FragColor = -(-in.vIn); + int4 a = ~(~in.vIn1); + bool b = false; + b = !(!b); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag b/third_party/spirv-cross/reference/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag new file mode 100644 index 0000000000..1cb7aa7032 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + ushort2 a [[user(locn0)]]; + uint3 b [[user(locn1)]]; + ushort c_0 [[user(locn2)]]; + ushort c_1 [[user(locn3)]]; + uint4 e_0 [[user(locn4)]]; + uint4 e_1 [[user(locn5)]]; + float4 d [[user(locn6)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray c = {}; + spvUnsafeArray e = {}; + c[0] = in.c_0; + c[1] = in.c_1; + e[0] = in.e_0; + e[1] = in.e_1; + out.FragColor = float4(float(int(short(in.a.x))), float(int(in.b.x)), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag b/third_party/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag new file mode 100644 index 0000000000..c3ab221fc3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float FragColor [[color(0)]]; + float gl_FragDepth [[depth(any)]]; +}; + +static inline __attribute__((always_inline)) +void set_output_depth(thread float& gl_FragDepth) +{ + gl_FragDepth = 0.20000000298023223876953125; +} + +fragment main0_out main0() +{ + main0_out out = {}; + out.FragColor = 1.0; + set_output_depth(out.gl_FragDepth); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/intel/shader-integer-functions2.asm.comp b/third_party/spirv-cross/reference/shaders-msl/intel/shader-integer-functions2.asm.comp new file mode 100644 index 0000000000..1e5d889d46 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/intel/shader-integer-functions2.asm.comp @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct foo +{ + uint a; + uint b; + int c; + int d; +}; + +kernel void main0(device foo& _4 [[buffer(0)]]) +{ + _4.a = clz(_4.a); + _4.a = ctz(_4.a); + _4.a = absdiff(_4.c, _4.d); + _4.a = absdiff(_4.a, _4.b); + _4.c = addsat(_4.c, _4.d); + _4.a = addsat(_4.a, _4.b); + _4.c = hadd(_4.c, _4.d); + _4.a = hadd(_4.a, _4.b); + _4.c = rhadd(_4.c, _4.d); + _4.a = rhadd(_4.a, _4.b); + _4.c = subsat(_4.c, _4.d); + _4.a = subsat(_4.a, _4.b); + _4.c = int(short(_4.c)) * int(short(_4.d)); + _4.a = uint(ushort(_4.a)) * uint(ushort(_4.b)); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/reference/shaders-msl/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..3837c8bc04 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/legacy/vert/transpose.legacy.vert @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct Buffer +{ + float4x4 MVPRowMajor; + float4x4 MVPColMajor; + float4x4 M; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Buffer& _13 [[buffer(0)]]) +{ + main0_out out = {}; + float4 c0 = _13.M * (in.Position * _13.MVPRowMajor); + float4 c1 = _13.M * (_13.MVPColMajor * in.Position); + float4 c2 = _13.M * (_13.MVPRowMajor * in.Position); + float4 c3 = _13.M * (in.Position * _13.MVPColMajor); + out.gl_Position = ((c0 + c1) + c2) + c3; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc new file mode 100644 index 0000000000..24928da01d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc @@ -0,0 +1,188 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + spvUnsafeArray iFoo; + float4 ipFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup float4 spvStorageFoo[8][4][2]; + threadgroup float4 (&Foo)[4][2] = spvStorageFoo[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvArrayCopyFromDeviceToThreadGroup1(Foo[gl_InvocationID], gl_in[gl_InvocationID].iFoo.elements); + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..a08364e2b3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc @@ -0,0 +1,191 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + float4 iFoo_0 [[attribute(0)]]; + float4 iFoo_1 [[attribute(1)]]; + float4 ipFoo [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup float4 Foo[4][2]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvUnsafeArray _38 = spvUnsafeArray({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 }); + spvArrayCopyFromStackToThreadGroup1(Foo[gl_InvocationID], _38.elements); + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc new file mode 100644 index 0000000000..abc95ca899 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + spvUnsafeArray Foo; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + spvUnsafeArray iFoo; + float4 ipFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].Foo = gl_in[gl_InvocationID].iFoo; + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..3da1d18c61 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + spvUnsafeArray Foo; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray pFoo; +}; + +struct main0_in +{ + float4 iFoo_0 [[attribute(0)]]; + float4 iFoo_1 [[attribute(1)]]; + float4 ipFoo [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + gl_out[gl_InvocationID].gl_Position = float4(1.0); + spvUnsafeArray _38 = spvUnsafeArray({ gl_in[gl_InvocationID].iFoo_0, gl_in[gl_InvocationID].iFoo_1 }); + gl_out[gl_InvocationID].Foo = _38; + if (gl_InvocationID == 0) + { + spvUnsafeArray _56 = spvUnsafeArray({ gl_in[0].ipFoo, gl_in[1].ipFoo }); + patchOut.pFoo = _56; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..2bf5c257d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_b; + float4 m_22_c; + float4 m_22_d; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + V _22 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_b = _22.b; + out.m_22_c = _22.c; + out.m_22_d = _22.d; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..cc6364fcd7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_a; + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_b; +}; + +static inline __attribute__((always_inline)) +void write_in_function(threadgroup P& _11, device main0_patchOut& patchOut, device main0_out* thread & gl_out, thread uint& gl_InvocationID) +{ + _11.a = 1.0; + patchOut.m_11_b = 2.0; + gl_out[gl_InvocationID].c_a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup P _11; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_function(_11, patchOut, gl_out, gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc new file mode 100644 index 0000000000..7336d094c8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc @@ -0,0 +1,52 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_a; + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_b; +}; + +static inline __attribute__((always_inline)) +void write_in_function(threadgroup P& _11, device main0_patchOut& patchOut, device main0_out* thread & gl_out, thread uint& gl_InvocationID) +{ + _11.a = 1.0; + patchOut.m_11_b = 2.0; + gl_out[gl_InvocationID].c_a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup P spvStorage_11[8]; + threadgroup P (&_11) = spvStorage_11[(gl_GlobalInvocationID.x / 4) % 8]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_function(_11, patchOut, gl_out, gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.vert new file mode 100644 index 0000000000..ad6079061e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-0.vert @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_b [[user(locn1)]]; + float4 m_22_c [[user(locn2)]]; + float4 m_22_d [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + V _22 = {}; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_b = _22.b; + out.m_22_c = _22.c; + out.m_22_d = _22.d; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..2b535c312e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_a; + float4 m_22_c; + float4 m_22_d; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + V _22 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_a = _22.a; + out.m_22_c = _22.c; + out.m_22_d = _22.d; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..c3b54c7dff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc @@ -0,0 +1,49 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_a; + float m_11_b; +}; + +static inline __attribute__((always_inline)) +void write_in_function(device main0_patchOut& patchOut, threadgroup C (&c)[4], device main0_out* thread & gl_out, thread uint& gl_InvocationID) +{ + patchOut.m_11_a = 1.0; + patchOut.m_11_b = 2.0; + c[gl_InvocationID].a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup C c[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_function(patchOut, c, gl_out, gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc new file mode 100644 index 0000000000..a881a682a7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc @@ -0,0 +1,52 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct P +{ + float a; + float b; +}; + +struct C +{ + float a; + float b; +}; + +struct main0_out +{ + float c_b; + float4 gl_Position; +}; + +struct main0_patchOut +{ + float m_11_a; + float m_11_b; +}; + +static inline __attribute__((always_inline)) +void write_in_function(device main0_patchOut& patchOut, threadgroup C (&c)[4], device main0_out* thread & gl_out, thread uint& gl_InvocationID) +{ + patchOut.m_11_a = 1.0; + patchOut.m_11_b = 2.0; + c[gl_InvocationID].a = 3.0; + gl_out[gl_InvocationID].c_b = 4.0; + gl_out[gl_InvocationID].gl_Position = float4(1.0); +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup C spvStoragec[8][4]; + threadgroup C (&c)[4] = spvStoragec[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_function(patchOut, c, gl_out, gl_InvocationID); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.vert new file mode 100644 index 0000000000..3b830290f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs-block.mask-location-1.vert @@ -0,0 +1,34 @@ +#include +#include + +using namespace metal; + +struct V +{ + float4 a; + float4 b; + float4 c; + float4 d; +}; + +struct main0_out +{ + float4 m_22_a [[user(locn0)]]; + float4 m_22_c [[user(locn2)]]; + float4 m_22_d [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + V _22 = {}; + out.gl_Position = float4(1.0); + _22.a = float4(2.0); + _22.b = float4(3.0); + out.m_22_a = _22.a; + out.m_22_c = _22.c; + out.m_22_d = _22.d; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-clip-distance.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-clip-distance.vert new file mode 100644 index 0000000000..2a0508361e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-clip-distance.vert @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +static inline __attribute__((always_inline)) +void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread spvUnsafeArray& gl_ClipDistance) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +vertex main0_out main0() +{ + main0_out out = {}; + spvUnsafeArray gl_ClipDistance = {}; + write_in_func(out.v0, out.v1, out.gl_Position, out.gl_PointSize, gl_ClipDistance); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..53f76b575e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v1; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; +}; + +static inline __attribute__((always_inline)) +void write_in_func(thread float4& v0, device float4& v1, device float4& gl_Position, device float& gl_PointSize, device spvUnsafeArray& gl_ClipDistance) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float4 v0 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + write_in_func(v0, out.v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..e4f047d3e3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc @@ -0,0 +1,42 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v1; +}; + +static inline __attribute__((always_inline)) +void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device float4& v1, device main0_out* thread & gl_out) +{ + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].x = 2.0; + if (gl_InvocationID == 0) + { + v1 = float4(2.0); + ((device float*)&v1)[3u] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position.z = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v0[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(v0, gl_InvocationID, patchOut.v1, gl_out); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc new file mode 100644 index 0000000000..7465cc64db --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, device main0_out* thread & gl_out) +{ + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup float4 spvStoragev0[8][4]; + threadgroup float4 (&v0)[4] = spvStoragev0[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_func(v0, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.tesc new file mode 100644 index 0000000000..0ae265e9e7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.tesc @@ -0,0 +1,84 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(threadgroup float4 (&v0)[4], thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, device main0_out* thread & gl_out) +{ + v0[gl_InvocationID] = float4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v0[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(v0, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.vert new file mode 100644 index 0000000000..12c111aef4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-0.vert @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +static inline __attribute__((always_inline)) +void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2]) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +vertex main0_out main0() +{ + main0_out out = {}; + float4 v0 = {}; + write_in_func(v0, out.v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance); + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..8f9cfce536 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device float4& v0, thread float4& v1, device float4& gl_Position, device float& gl_PointSize, device spvUnsafeArray& gl_ClipDistance) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float4 v1 = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + write_in_func(out.v0, v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..85160a9dee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc @@ -0,0 +1,41 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ +}; +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4& v1) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.x = 2.0; + if (gl_InvocationID == 0) + { + v1 = float4(2.0); + ((threadgroup float*)&v1)[3u] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = float4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position.z = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v1; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(gl_out, gl_InvocationID, v1); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc new file mode 100644 index 0000000000..df057861ee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc @@ -0,0 +1,48 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4 (&v1)[2], device float4& v3) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((threadgroup float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((threadgroup float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + threadgroup float4 spvStoragev1[8][2]; + threadgroup float4 (&v1)[2] = spvStoragev1[(gl_GlobalInvocationID.x / 4) % 8]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_func(gl_out, gl_InvocationID, v1, patchOut.v3); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.tesc new file mode 100644 index 0000000000..0ad2727673 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.tesc @@ -0,0 +1,45 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0; + float4 gl_Position; + float gl_PointSize; +}; + +struct main0_patchOut +{ + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup float4 (&v1)[2], device float4& v3) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((threadgroup float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((threadgroup float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup float4 v1[2]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(gl_out, gl_InvocationID, v1, patchOut.v3); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.vert new file mode 100644 index 0000000000..2290e5cca4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-location-1.vert @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +static inline __attribute__((always_inline)) +void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2]) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +vertex main0_out main0() +{ + main0_out out = {}; + float4 v1 = {}; + write_in_func(out.v0, v1, out.gl_Position, out.gl_PointSize, out.gl_ClipDistance); + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert new file mode 100644 index 0000000000..07494ea399 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 v0; + float4 v1; + float4 gl_Position; + spvUnsafeArray gl_ClipDistance; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device float4& v0, device float4& v1, device float4& gl_Position, thread float& gl_PointSize, device spvUnsafeArray& gl_ClipDistance) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + float gl_PointSize = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + write_in_func(out.v0, out.v1, out.gl_Position, gl_PointSize, out.gl_ClipDistance); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc new file mode 100644 index 0000000000..05d58634ef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc @@ -0,0 +1,95 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4]) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out_masked[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.tesc new file mode 100644 index 0000000000..8ec2a663b7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.tesc @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4]) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out[gl_InvocationID].gl_Position = float4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out_masked[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.vert b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.vert new file mode 100644 index 0000000000..b37b92dd4a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-point-size.vert @@ -0,0 +1,38 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 v0 [[user(locn0)]]; + float4 v1 [[user(locn1)]]; + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +static inline __attribute__((always_inline)) +void write_in_func(thread float4& v0, thread float4& v1, thread float4& gl_Position, thread float& gl_PointSize, thread float (&gl_ClipDistance)[2]) +{ + v0 = float4(1.0); + v1 = float4(2.0); + gl_Position = float4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +vertex main0_out main0() +{ + main0_out out = {}; + float gl_PointSize = {}; + write_in_func(out.v0, out.v1, out.gl_Position, gl_PointSize, out.gl_ClipDistance); + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc new file mode 100644 index 0000000000..86bc7d37be --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc @@ -0,0 +1,95 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4]) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(10.0); + gl_out_masked[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + threadgroup gl_PerVertex spvStoragegl_out_masked[8][4]; + threadgroup gl_PerVertex (&gl_out_masked)[4] = spvStoragegl_out_masked[(gl_GlobalInvocationID.x / 4) % 8]; + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 4]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.tesc b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.tesc new file mode 100644 index 0000000000..da0d2a2d10 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/masking/write-outputs.mask-position.tesc @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct gl_PerVertex +{ + float4 gl_Position; + float gl_PointSize; + spvUnsafeArray gl_ClipDistance; + spvUnsafeArray gl_CullDistance; +}; + +struct main0_out +{ + float4 v0; + float gl_PointSize; +}; + +struct main0_patchOut +{ + spvUnsafeArray v1; + float4 v3; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray& v1, device float4& v3, threadgroup gl_PerVertex (&gl_out_masked)[4]) +{ + gl_out[gl_InvocationID].v0 = float4(1.0); + gl_out[gl_InvocationID].v0.z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = float4(2.0); + ((device float*)&v1[0])[0u] = 3.0; + v1[1] = float4(2.0); + ((device float*)&v1[1])[0u] = 5.0; + } + v3 = float4(5.0); + gl_out_masked[gl_InvocationID].gl_Position = float4(10.0); + gl_out_masked[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + threadgroup gl_PerVertex gl_out_masked[4]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(gl_out, gl_InvocationID, patchOut.v1, patchOut.v3, gl_out_masked); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc new file mode 100644 index 0000000000..c11c7410c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc @@ -0,0 +1,111 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct S +{ + int x; + float4 y; + spvUnsafeArray z; +}; + +struct TheBlock +{ + spvUnsafeArray blockFa; + spvUnsafeArray blockSa; + float blockF; +}; + +struct main0_patchOut +{ + float2 in_te_positionScale; + float2 in_te_positionOffset; + spvUnsafeArray tcBlock; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_179; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 5]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 5, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 5, spvIndirectParams[1] - 1); + float v = 1.2999999523162841796875; + for (int i0 = 0; i0 < 2; i0++) + { + for (int i1 = 0; i1 < 3; i1++) + { + patchOut.tcBlock[i0].blockFa[i1] = v; + v += 0.4000000059604644775390625; + } + for (int i1_1 = 0; i1_1 < 2; i1_1++) + { + patchOut.tcBlock[i0].blockSa[i1_1].x = int(v); + v += 0.4000000059604644775390625; + patchOut.tcBlock[i0].blockSa[i1_1].y = float4(v, v + 0.800000011920928955078125, v + 1.60000002384185791015625, v + 2.400000095367431640625); + v += 0.4000000059604644775390625; + for (int i2 = 0; i2 < 2; i2++) + { + patchOut.tcBlock[i0].blockSa[i1_1].z[i2] = v; + v += 0.4000000059604644775390625; + } + } + patchOut.tcBlock[i0].blockF = v; + v += 0.4000000059604644775390625; + } + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(gl_in[0].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(gl_in[1].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(gl_in[2].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(gl_in[3].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(gl_in[4].in_tc_attr.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(gl_in[5].in_tc_attr.x); + patchOut.in_te_positionScale = float2(gl_in[6].in_tc_attr.x, gl_in[7].in_tc_attr.x); + patchOut.in_te_positionOffset = float2(gl_in[8].in_tc_attr.x, gl_in[9].in_tc_attr.x); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/basic.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/basic.multi-patch.tesc new file mode 100644 index 0000000000..fe26831673 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/basic.multi-patch.tesc @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct main0_patchOut +{ + float3 vFoo; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/basic.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/basic.tesc new file mode 100644 index 0000000000..a9ff5b37ea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/basic.tesc @@ -0,0 +1,22 @@ +#include +#include + +using namespace metal; + +struct main0_patchOut +{ + float3 vFoo; +}; + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(8.8999996185302734375); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(6.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.900000095367431640625); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(4.900000095367431640625); + patchOut.vFoo = float3(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc new file mode 100644 index 0000000000..d266d2512a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc @@ -0,0 +1,134 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct Block_1 +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct main0_out +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; + float4 gl_Position; +}; + +struct main0_in +{ + spvUnsafeArray in_a; + float in_b; + float2x2 in_m; + Meep in_meep; + spvUnsafeArray in_meeps; + spvUnsafeArray in_B_a; + float in_B_b; + float2x2 in_B_m; + Meep in_B_meep; + spvUnsafeArray in_B_meeps; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device main0_in* thread & gl_in) +{ + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a[0]; + gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a[1]; + gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b; + gl_out[gl_InvocationID].m = gl_in[gl_InvocationID].in_m; + gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].in_meep.a; + gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].in_meep.b; + gl_out[gl_InvocationID].meeps[0].a = gl_in[gl_InvocationID].in_meeps[0].a; + gl_out[gl_InvocationID].meeps[0].b = gl_in[gl_InvocationID].in_meeps[0].b; + gl_out[gl_InvocationID].meeps[1].a = gl_in[gl_InvocationID].in_meeps[1].a; + gl_out[gl_InvocationID].meeps[1].b = gl_in[gl_InvocationID].in_meeps[1].b; + gl_out[gl_InvocationID].B_a[0] = gl_in[gl_InvocationID].in_B_a[0]; + gl_out[gl_InvocationID].B_a[1] = gl_in[gl_InvocationID].in_B_a[1]; + gl_out[gl_InvocationID].B_b = gl_in[gl_InvocationID].in_B_b; + gl_out[gl_InvocationID].B_m = gl_in[gl_InvocationID].in_B_m; + gl_out[gl_InvocationID].B_meep.a = gl_in[gl_InvocationID].in_B_meep.a; + gl_out[gl_InvocationID].B_meep.b = gl_in[gl_InvocationID].in_B_meep.b; + gl_out[gl_InvocationID].B_meeps[0].a = gl_in[gl_InvocationID].in_B_meeps[0].a; + gl_out[gl_InvocationID].B_meeps[0].b = gl_in[gl_InvocationID].in_B_meeps[0].b; + gl_out[gl_InvocationID].B_meeps[1].a = gl_in[gl_InvocationID].in_B_meeps[1].a; + gl_out[gl_InvocationID].B_meeps[1].b = gl_in[gl_InvocationID].in_B_meeps[1].b; +} + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + write_in_func(gl_out, gl_InvocationID, gl_in); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.tesc new file mode 100644 index 0000000000..48f10baec8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-control-point-inout-types.tesc @@ -0,0 +1,138 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct Block_1 +{ + spvUnsafeArray a; + float b; + float2x2 m; +}; + +struct main0_out +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; + float4 gl_Position; +}; + +struct main0_in +{ + float in_a_0 [[attribute(0)]]; + float in_a_1 [[attribute(1)]]; + float in_b [[attribute(2)]]; + float2 in_m_0 [[attribute(3)]]; + float2 in_m_1 [[attribute(4)]]; + float in_meep_a [[attribute(5)]]; + float in_meep_b [[attribute(6)]]; + float in_B_a_0 [[attribute(11)]]; + float in_B_a_1 [[attribute(12)]]; + float in_B_b [[attribute(13)]]; + float2 in_B_m_0 [[attribute(14)]]; + float2 in_B_m_1 [[attribute(15)]]; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup main0_in* thread & gl_in) +{ + gl_out[gl_InvocationID].gl_Position = float4(1.0); + gl_out[gl_InvocationID].a[0] = gl_in[gl_InvocationID].in_a_0; + gl_out[gl_InvocationID].a[1] = gl_in[gl_InvocationID].in_a_1; + gl_out[gl_InvocationID].b = gl_in[gl_InvocationID].in_b; + float2x2 _72 = float2x2(gl_in[gl_InvocationID].in_m_0, gl_in[gl_InvocationID].in_m_1); + gl_out[gl_InvocationID].m = _72; + gl_out[gl_InvocationID].meep.a = gl_in[gl_InvocationID].in_meep_a; + gl_out[gl_InvocationID].meep.b = gl_in[gl_InvocationID].in_meep_b; + gl_out[gl_InvocationID].meeps[0].a = 1.0; + gl_out[gl_InvocationID].meeps[0].b = 2.0; + gl_out[gl_InvocationID].meeps[1].a = 3.0; + gl_out[gl_InvocationID].meeps[1].b = 4.0; + gl_out[gl_InvocationID].B_a[0] = gl_in[gl_InvocationID].in_B_a_0; + gl_out[gl_InvocationID].B_a[1] = gl_in[gl_InvocationID].in_B_a_1; + gl_out[gl_InvocationID].B_b = gl_in[gl_InvocationID].in_B_b; + float2x2 _134 = float2x2(gl_in[gl_InvocationID].in_B_m_0, gl_in[gl_InvocationID].in_B_m_1); + gl_out[gl_InvocationID].B_m = _134; + gl_out[gl_InvocationID].B_meep.a = 10.0; + gl_out[gl_InvocationID].B_meep.b = 20.0; + gl_out[gl_InvocationID].B_meeps[0].a = 5.0; + gl_out[gl_InvocationID].B_meeps[0].b = 6.0; + gl_out[gl_InvocationID].B_meeps[1].a = 7.0; + gl_out[gl_InvocationID].B_meeps[1].b = 8.0; +} + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + write_in_func(gl_out, gl_InvocationID, gl_in); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/complex-patch-out-types.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-patch-out-types.tesc new file mode 100644 index 0000000000..bd24f58029 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/complex-patch-out-types.tesc @@ -0,0 +1,113 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Meep +{ + float a; + float b; +}; + +struct Block +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; +}; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_patchOut +{ + spvUnsafeArray a; + float b; + float2x2 m; + Meep meep; + spvUnsafeArray meeps; + spvUnsafeArray B_a; + float B_b; + float2x2 B_m; + Meep B_meep; + spvUnsafeArray B_meeps; +}; + +static inline __attribute__((always_inline)) +void write_in_func(device main0_out* thread & gl_out, thread uint& gl_InvocationID, device spvUnsafeArray& a, device float& b, device float2x2& m, device Meep& meep, device spvUnsafeArray& meeps, device main0_patchOut& patchOut) +{ + gl_out[gl_InvocationID].gl_Position = float4(1.0); + a[0] = 1.0; + a[1] = 2.0; + b = 3.0; + m = float2x2(float2(2.0, 0.0), float2(0.0, 2.0)); + meep.a = 4.0; + meep.b = 5.0; + meeps[0].a = 6.0; + meeps[0].b = 7.0; + meeps[1].a = 8.0; + meeps[1].b = 9.0; + patchOut.B_a[0] = 1.0; + patchOut.B_a[1] = 2.0; + patchOut.B_b = 3.0; + patchOut.B_m = float2x2(float2(4.0, 0.0), float2(0.0, 4.0)); + patchOut.B_meep.a = 4.0; + patchOut.B_meep.b = 5.0; + patchOut.B_meeps[0].a = 6.0; + patchOut.B_meeps[0].b = 7.0; + patchOut.B_meeps[1].a = 8.0; + patchOut.B_meeps[1].b = 9.0; +} + +kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + write_in_func(gl_out, gl_InvocationID, patchOut.a, patchOut.b, patchOut.m, patchOut.meep, patchOut.meeps, patchOut); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc new file mode 100644 index 0000000000..cd452b7428 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc @@ -0,0 +1,67 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4x4 vOutputs; +}; + +struct main0_in +{ + float4x4 vInputs; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + spvUnsafeArray _16 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); + spvUnsafeArray tmp = _16; + gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc new file mode 100644 index 0000000000..67b97a5111 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-matrix.tesc @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4x4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs_0 [[attribute(0)]]; + float4 vInputs_1 [[attribute(1)]]; + float4 vInputs_2 [[attribute(2)]]; + float4 vInputs_3 [[attribute(3)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + spvUnsafeArray _16 = spvUnsafeArray({ float4x4(gl_in[0].vInputs_0, gl_in[0].vInputs_1, gl_in[0].vInputs_2, gl_in[0].vInputs_3), float4x4(gl_in[1].vInputs_0, gl_in[1].vInputs_1, gl_in[1].vInputs_2, gl_in[1].vInputs_3), float4x4(gl_in[2].vInputs_0, gl_in[2].vInputs_1, gl_in[2].vInputs_2, gl_in[2].vInputs_3), float4x4(gl_in[3].vInputs_0, gl_in[3].vInputs_1, gl_in[3].vInputs_2, gl_in[3].vInputs_3), float4x4(gl_in[4].vInputs_0, gl_in[4].vInputs_1, gl_in[4].vInputs_2, gl_in[4].vInputs_3), float4x4(gl_in[5].vInputs_0, gl_in[5].vInputs_1, gl_in[5].vInputs_2, gl_in[5].vInputs_3), float4x4(gl_in[6].vInputs_0, gl_in[6].vInputs_1, gl_in[6].vInputs_2, gl_in[6].vInputs_3), float4x4(gl_in[7].vInputs_0, gl_in[7].vInputs_1, gl_in[7].vInputs_2, gl_in[7].vInputs_3), float4x4(gl_in[8].vInputs_0, gl_in[8].vInputs_1, gl_in[8].vInputs_2, gl_in[8].vInputs_3), float4x4(gl_in[9].vInputs_0, gl_in[9].vInputs_1, gl_in[9].vInputs_2, gl_in[9].vInputs_3), float4x4(gl_in[10].vInputs_0, gl_in[10].vInputs_1, gl_in[10].vInputs_2, gl_in[10].vInputs_3), float4x4(gl_in[11].vInputs_0, gl_in[11].vInputs_1, gl_in[11].vInputs_2, gl_in[11].vInputs_3), float4x4(gl_in[12].vInputs_0, gl_in[12].vInputs_1, gl_in[12].vInputs_2, gl_in[12].vInputs_3), float4x4(gl_in[13].vInputs_0, gl_in[13].vInputs_1, gl_in[13].vInputs_2, gl_in[13].vInputs_3), float4x4(gl_in[14].vInputs_0, gl_in[14].vInputs_1, gl_in[14].vInputs_2, gl_in[14].vInputs_3), float4x4(gl_in[15].vInputs_0, gl_in[15].vInputs_1, gl_in[15].vInputs_2, gl_in[15].vInputs_3), float4x4(gl_in[16].vInputs_0, gl_in[16].vInputs_1, gl_in[16].vInputs_2, gl_in[16].vInputs_3), float4x4(gl_in[17].vInputs_0, gl_in[17].vInputs_1, gl_in[17].vInputs_2, gl_in[17].vInputs_3), float4x4(gl_in[18].vInputs_0, gl_in[18].vInputs_1, gl_in[18].vInputs_2, gl_in[18].vInputs_3), float4x4(gl_in[19].vInputs_0, gl_in[19].vInputs_1, gl_in[19].vInputs_2, gl_in[19].vInputs_3), float4x4(gl_in[20].vInputs_0, gl_in[20].vInputs_1, gl_in[20].vInputs_2, gl_in[20].vInputs_3), float4x4(gl_in[21].vInputs_0, gl_in[21].vInputs_1, gl_in[21].vInputs_2, gl_in[21].vInputs_3), float4x4(gl_in[22].vInputs_0, gl_in[22].vInputs_1, gl_in[22].vInputs_2, gl_in[22].vInputs_3), float4x4(gl_in[23].vInputs_0, gl_in[23].vInputs_1, gl_in[23].vInputs_2, gl_in[23].vInputs_3), float4x4(gl_in[24].vInputs_0, gl_in[24].vInputs_1, gl_in[24].vInputs_2, gl_in[24].vInputs_3), float4x4(gl_in[25].vInputs_0, gl_in[25].vInputs_1, gl_in[25].vInputs_2, gl_in[25].vInputs_3), float4x4(gl_in[26].vInputs_0, gl_in[26].vInputs_1, gl_in[26].vInputs_2, gl_in[26].vInputs_3), float4x4(gl_in[27].vInputs_0, gl_in[27].vInputs_1, gl_in[27].vInputs_2, gl_in[27].vInputs_3), float4x4(gl_in[28].vInputs_0, gl_in[28].vInputs_1, gl_in[28].vInputs_2, gl_in[28].vInputs_3), float4x4(gl_in[29].vInputs_0, gl_in[29].vInputs_1, gl_in[29].vInputs_2, gl_in[29].vInputs_3), float4x4(gl_in[30].vInputs_0, gl_in[30].vInputs_1, gl_in[30].vInputs_2, gl_in[30].vInputs_3), float4x4(gl_in[31].vInputs_0, gl_in[31].vInputs_1, gl_in[31].vInputs_2, gl_in[31].vInputs_3) }); + spvUnsafeArray tmp = _16; + gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc new file mode 100644 index 0000000000..621721f824 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexData +{ + float4x4 a; + spvUnsafeArray b; + float4 c; +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + VertexData vInputs; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + spvUnsafeArray _19 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); + spvUnsafeArray tmp = _19; + VertexData tmp_single = gl_in[gl_InvocationID ^ 1].vInputs; + gl_out[gl_InvocationID].vOutputs = ((tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1]) + tmp[gl_InvocationID].c) + tmp_single.c; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc new file mode 100644 index 0000000000..8438f49f50 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array-of-struct.tesc @@ -0,0 +1,85 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct VertexData +{ + float4x4 a; + spvUnsafeArray b; + float4 c; +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs_a_0 [[attribute(0)]]; + float4 vInputs_a_1 [[attribute(1)]]; + float4 vInputs_a_2 [[attribute(2)]]; + float4 vInputs_a_3 [[attribute(3)]]; + float4 vInputs_b_0 [[attribute(4)]]; + float4 vInputs_b_1 [[attribute(5)]]; + float4 vInputs_c [[attribute(6)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + spvUnsafeArray _19 = spvUnsafeArray({ VertexData{ float4x4(gl_in[0].vInputs_a_0, gl_in[0].vInputs_a_1, gl_in[0].vInputs_a_2, gl_in[0].vInputs_a_3), spvUnsafeArray({ gl_in[0].vInputs_b_0, gl_in[0].vInputs_b_1 }), gl_in[0].vInputs_c }, VertexData{ float4x4(gl_in[1].vInputs_a_0, gl_in[1].vInputs_a_1, gl_in[1].vInputs_a_2, gl_in[1].vInputs_a_3), spvUnsafeArray({ gl_in[1].vInputs_b_0, gl_in[1].vInputs_b_1 }), gl_in[1].vInputs_c }, VertexData{ float4x4(gl_in[2].vInputs_a_0, gl_in[2].vInputs_a_1, gl_in[2].vInputs_a_2, gl_in[2].vInputs_a_3), spvUnsafeArray({ gl_in[2].vInputs_b_0, gl_in[2].vInputs_b_1 }), gl_in[2].vInputs_c }, VertexData{ float4x4(gl_in[3].vInputs_a_0, gl_in[3].vInputs_a_1, gl_in[3].vInputs_a_2, gl_in[3].vInputs_a_3), spvUnsafeArray({ gl_in[3].vInputs_b_0, gl_in[3].vInputs_b_1 }), gl_in[3].vInputs_c }, VertexData{ float4x4(gl_in[4].vInputs_a_0, gl_in[4].vInputs_a_1, gl_in[4].vInputs_a_2, gl_in[4].vInputs_a_3), spvUnsafeArray({ gl_in[4].vInputs_b_0, gl_in[4].vInputs_b_1 }), gl_in[4].vInputs_c }, VertexData{ float4x4(gl_in[5].vInputs_a_0, gl_in[5].vInputs_a_1, gl_in[5].vInputs_a_2, gl_in[5].vInputs_a_3), spvUnsafeArray({ gl_in[5].vInputs_b_0, gl_in[5].vInputs_b_1 }), gl_in[5].vInputs_c }, VertexData{ float4x4(gl_in[6].vInputs_a_0, gl_in[6].vInputs_a_1, gl_in[6].vInputs_a_2, gl_in[6].vInputs_a_3), spvUnsafeArray({ gl_in[6].vInputs_b_0, gl_in[6].vInputs_b_1 }), gl_in[6].vInputs_c }, VertexData{ float4x4(gl_in[7].vInputs_a_0, gl_in[7].vInputs_a_1, gl_in[7].vInputs_a_2, gl_in[7].vInputs_a_3), spvUnsafeArray({ gl_in[7].vInputs_b_0, gl_in[7].vInputs_b_1 }), gl_in[7].vInputs_c }, VertexData{ float4x4(gl_in[8].vInputs_a_0, gl_in[8].vInputs_a_1, gl_in[8].vInputs_a_2, gl_in[8].vInputs_a_3), spvUnsafeArray({ gl_in[8].vInputs_b_0, gl_in[8].vInputs_b_1 }), gl_in[8].vInputs_c }, VertexData{ float4x4(gl_in[9].vInputs_a_0, gl_in[9].vInputs_a_1, gl_in[9].vInputs_a_2, gl_in[9].vInputs_a_3), spvUnsafeArray({ gl_in[9].vInputs_b_0, gl_in[9].vInputs_b_1 }), gl_in[9].vInputs_c }, VertexData{ float4x4(gl_in[10].vInputs_a_0, gl_in[10].vInputs_a_1, gl_in[10].vInputs_a_2, gl_in[10].vInputs_a_3), spvUnsafeArray({ gl_in[10].vInputs_b_0, gl_in[10].vInputs_b_1 }), gl_in[10].vInputs_c }, VertexData{ float4x4(gl_in[11].vInputs_a_0, gl_in[11].vInputs_a_1, gl_in[11].vInputs_a_2, gl_in[11].vInputs_a_3), spvUnsafeArray({ gl_in[11].vInputs_b_0, gl_in[11].vInputs_b_1 }), gl_in[11].vInputs_c }, VertexData{ float4x4(gl_in[12].vInputs_a_0, gl_in[12].vInputs_a_1, gl_in[12].vInputs_a_2, gl_in[12].vInputs_a_3), spvUnsafeArray({ gl_in[12].vInputs_b_0, gl_in[12].vInputs_b_1 }), gl_in[12].vInputs_c }, VertexData{ float4x4(gl_in[13].vInputs_a_0, gl_in[13].vInputs_a_1, gl_in[13].vInputs_a_2, gl_in[13].vInputs_a_3), spvUnsafeArray({ gl_in[13].vInputs_b_0, gl_in[13].vInputs_b_1 }), gl_in[13].vInputs_c }, VertexData{ float4x4(gl_in[14].vInputs_a_0, gl_in[14].vInputs_a_1, gl_in[14].vInputs_a_2, gl_in[14].vInputs_a_3), spvUnsafeArray({ gl_in[14].vInputs_b_0, gl_in[14].vInputs_b_1 }), gl_in[14].vInputs_c }, VertexData{ float4x4(gl_in[15].vInputs_a_0, gl_in[15].vInputs_a_1, gl_in[15].vInputs_a_2, gl_in[15].vInputs_a_3), spvUnsafeArray({ gl_in[15].vInputs_b_0, gl_in[15].vInputs_b_1 }), gl_in[15].vInputs_c }, VertexData{ float4x4(gl_in[16].vInputs_a_0, gl_in[16].vInputs_a_1, gl_in[16].vInputs_a_2, gl_in[16].vInputs_a_3), spvUnsafeArray({ gl_in[16].vInputs_b_0, gl_in[16].vInputs_b_1 }), gl_in[16].vInputs_c }, VertexData{ float4x4(gl_in[17].vInputs_a_0, gl_in[17].vInputs_a_1, gl_in[17].vInputs_a_2, gl_in[17].vInputs_a_3), spvUnsafeArray({ gl_in[17].vInputs_b_0, gl_in[17].vInputs_b_1 }), gl_in[17].vInputs_c }, VertexData{ float4x4(gl_in[18].vInputs_a_0, gl_in[18].vInputs_a_1, gl_in[18].vInputs_a_2, gl_in[18].vInputs_a_3), spvUnsafeArray({ gl_in[18].vInputs_b_0, gl_in[18].vInputs_b_1 }), gl_in[18].vInputs_c }, VertexData{ float4x4(gl_in[19].vInputs_a_0, gl_in[19].vInputs_a_1, gl_in[19].vInputs_a_2, gl_in[19].vInputs_a_3), spvUnsafeArray({ gl_in[19].vInputs_b_0, gl_in[19].vInputs_b_1 }), gl_in[19].vInputs_c }, VertexData{ float4x4(gl_in[20].vInputs_a_0, gl_in[20].vInputs_a_1, gl_in[20].vInputs_a_2, gl_in[20].vInputs_a_3), spvUnsafeArray({ gl_in[20].vInputs_b_0, gl_in[20].vInputs_b_1 }), gl_in[20].vInputs_c }, VertexData{ float4x4(gl_in[21].vInputs_a_0, gl_in[21].vInputs_a_1, gl_in[21].vInputs_a_2, gl_in[21].vInputs_a_3), spvUnsafeArray({ gl_in[21].vInputs_b_0, gl_in[21].vInputs_b_1 }), gl_in[21].vInputs_c }, VertexData{ float4x4(gl_in[22].vInputs_a_0, gl_in[22].vInputs_a_1, gl_in[22].vInputs_a_2, gl_in[22].vInputs_a_3), spvUnsafeArray({ gl_in[22].vInputs_b_0, gl_in[22].vInputs_b_1 }), gl_in[22].vInputs_c }, VertexData{ float4x4(gl_in[23].vInputs_a_0, gl_in[23].vInputs_a_1, gl_in[23].vInputs_a_2, gl_in[23].vInputs_a_3), spvUnsafeArray({ gl_in[23].vInputs_b_0, gl_in[23].vInputs_b_1 }), gl_in[23].vInputs_c }, VertexData{ float4x4(gl_in[24].vInputs_a_0, gl_in[24].vInputs_a_1, gl_in[24].vInputs_a_2, gl_in[24].vInputs_a_3), spvUnsafeArray({ gl_in[24].vInputs_b_0, gl_in[24].vInputs_b_1 }), gl_in[24].vInputs_c }, VertexData{ float4x4(gl_in[25].vInputs_a_0, gl_in[25].vInputs_a_1, gl_in[25].vInputs_a_2, gl_in[25].vInputs_a_3), spvUnsafeArray({ gl_in[25].vInputs_b_0, gl_in[25].vInputs_b_1 }), gl_in[25].vInputs_c }, VertexData{ float4x4(gl_in[26].vInputs_a_0, gl_in[26].vInputs_a_1, gl_in[26].vInputs_a_2, gl_in[26].vInputs_a_3), spvUnsafeArray({ gl_in[26].vInputs_b_0, gl_in[26].vInputs_b_1 }), gl_in[26].vInputs_c }, VertexData{ float4x4(gl_in[27].vInputs_a_0, gl_in[27].vInputs_a_1, gl_in[27].vInputs_a_2, gl_in[27].vInputs_a_3), spvUnsafeArray({ gl_in[27].vInputs_b_0, gl_in[27].vInputs_b_1 }), gl_in[27].vInputs_c }, VertexData{ float4x4(gl_in[28].vInputs_a_0, gl_in[28].vInputs_a_1, gl_in[28].vInputs_a_2, gl_in[28].vInputs_a_3), spvUnsafeArray({ gl_in[28].vInputs_b_0, gl_in[28].vInputs_b_1 }), gl_in[28].vInputs_c }, VertexData{ float4x4(gl_in[29].vInputs_a_0, gl_in[29].vInputs_a_1, gl_in[29].vInputs_a_2, gl_in[29].vInputs_a_3), spvUnsafeArray({ gl_in[29].vInputs_b_0, gl_in[29].vInputs_b_1 }), gl_in[29].vInputs_c }, VertexData{ float4x4(gl_in[30].vInputs_a_0, gl_in[30].vInputs_a_1, gl_in[30].vInputs_a_2, gl_in[30].vInputs_a_3), spvUnsafeArray({ gl_in[30].vInputs_b_0, gl_in[30].vInputs_b_1 }), gl_in[30].vInputs_c }, VertexData{ float4x4(gl_in[31].vInputs_a_0, gl_in[31].vInputs_a_1, gl_in[31].vInputs_a_2, gl_in[31].vInputs_a_3), spvUnsafeArray({ gl_in[31].vInputs_b_0, gl_in[31].vInputs_b_1 }), gl_in[31].vInputs_c } }); + spvUnsafeArray tmp = _19; + int _27 = gl_InvocationID ^ 1; + VertexData _30 = VertexData{ float4x4(gl_in[_27].vInputs_a_0, gl_in[_27].vInputs_a_1, gl_in[_27].vInputs_a_2, gl_in[_27].vInputs_a_3), spvUnsafeArray({ gl_in[_27].vInputs_b_0, gl_in[_27].vInputs_b_1 }), gl_in[_27].vInputs_c }; + VertexData tmp_single = _30; + gl_out[gl_InvocationID].vOutputs = ((tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1]) + tmp[gl_InvocationID].c) + tmp_single.c; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc new file mode 100644 index 0000000000..b993c9979f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.multi-patch.tesc @@ -0,0 +1,68 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs; + ushort2 m_43; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + spvUnsafeArray _15 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); + spvUnsafeArray tmp = _15; + gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.tesc new file mode 100644 index 0000000000..5c1885729b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/load-control-point-array.tesc @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 vOutputs; +}; + +struct main0_in +{ + float4 vInputs [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + spvUnsafeArray _15 = spvUnsafeArray({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs }); + spvUnsafeArray tmp = _15; + gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID]; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/matrix-output.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/matrix-output.multi-patch.tesc new file mode 100644 index 0000000000..98b9dd0524 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/matrix-output.multi-patch.tesc @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float in_te_attr; + float4x3 in_te_data0; + float4x3 in_te_data1; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_103; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 3; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1); + float _15 = float(gl_InvocationID); + float4x3 d = float4x3(float3(_15, 0.0, 0.0), float3(0.0, _15, 0.0), float3(0.0, 0.0, _15), float3(0.0)); + gl_out[gl_InvocationID].in_te_data0 = d; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + int _42 = (gl_InvocationID + 1) % 3; + gl_out[gl_InvocationID].in_te_data1 = float4x3(d[0] + gl_out[_42].in_te_data0[0], d[1] + gl_out[_42].in_te_data0[1], d[2] + gl_out[_42].in_te_data0[2], d[3] + gl_out[_42].in_te_data0[3]); + gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.multi-patch.tesc new file mode 100644 index 0000000000..ae33de517a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.multi-patch.tesc @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_in +{ + uint3 m_82; + ushort2 m_86; + float4 gl_Position; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 4; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1); + if (gl_InvocationID == 0) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(5.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5)); + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.tesc new file mode 100644 index 0000000000..eafc50607d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/reload-tess-level.tesc @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position; +}; + +struct main0_in +{ + float4 gl_Position [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 4) + return; + if (gl_InvocationID == 0) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(3.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(4.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(5.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5)); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5)); + } + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/struct-output.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/struct-output.multi-patch.tesc new file mode 100644 index 0000000000..eaab245c1c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/struct-output.multi-patch.tesc @@ -0,0 +1,45 @@ +#include +#include + +using namespace metal; + +struct te_data +{ + float a; + float b; + uint c; +}; + +struct main0_out +{ + float in_te_attr; + te_data in_te_data0; + te_data in_te_data1; +}; + +struct main0_in +{ + float3 in_tc_attr; + ushort2 m_107; +}; + +kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_InvocationID = gl_GlobalInvocationID.x % 3; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1); + te_data d = te_data{ float(gl_InvocationID), float(gl_InvocationID + 1), uint(gl_InvocationID) }; + gl_out[gl_InvocationID].in_te_data0 = d; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + te_data e = gl_out[(gl_InvocationID + 1) % 3].in_te_data0; + gl_out[gl_InvocationID].in_te_data1 = te_data{ d.a + e.a, d.b + e.b, d.c + e.c }; + gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x; + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.multi-patch.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.multi-patch.tesc new file mode 100644 index 0000000000..0cd540ca15 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.multi-patch.tesc @@ -0,0 +1,135 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4 uScale; + float3 uCamPos; + float2 uPatchSize; + float2 uMaxTessLevel; + float uDistanceMod; + float4 uFrustum[6]; +}; + +struct main0_patchOut +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +struct main0_in +{ + float3 vPatchPosBase; + ushort2 m_430; +}; + +static inline __attribute__((always_inline)) +bool frustum_cull(thread const float2& p0, constant UBO& _41) +{ + float2 min_xz = (p0 - float2(10.0)) * _41.uScale.xy; + float2 max_xz = ((p0 + _41.uPatchSize) + float2(10.0)) * _41.uScale.xy; + float3 bb_min = float3(min_xz.x, -10.0, min_xz.y); + float3 bb_max = float3(max_xz.x, 10.0, max_xz.y); + float3 center = (bb_min + bb_max) * 0.5; + float radius = 0.5 * length(bb_max - bb_min); + float3 f0 = float3(dot(_41.uFrustum[0], float4(center, 1.0)), dot(_41.uFrustum[1], float4(center, 1.0)), dot(_41.uFrustum[2], float4(center, 1.0))); + float3 f1 = float3(dot(_41.uFrustum[3], float4(center, 1.0)), dot(_41.uFrustum[4], float4(center, 1.0)), dot(_41.uFrustum[5], float4(center, 1.0))); + bool _205 = any(f0 <= float3(-radius)); + bool _215; + if (!_205) + { + _215 = any(f1 <= float3(-radius)); + } + else + { + _215 = _205; + } + return !_215; +} + +static inline __attribute__((always_inline)) +float lod_factor(thread const float2& pos_, constant UBO& _41) +{ + float2 pos = pos_ * _41.uScale.xy; + float3 dist_to_cam = _41.uCamPos - float3(pos.x, 0.0, pos.y); + float level0 = log2((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod); + return fast::clamp(level0, 0.0, _41.uMaxTessLevel.x); +} + +static inline __attribute__((always_inline)) +float4 tess_level(thread const float4& lod, constant UBO& _41) +{ + return exp2(-lod) * _41.uMaxTessLevel.y; +} + +static inline __attribute__((always_inline)) +float tess_level(thread const float& lod, constant UBO& _41) +{ + return _41.uMaxTessLevel.y * exp2(-lod); +} + +static inline __attribute__((always_inline)) +void compute_tess_levels(thread const float2& p0, constant UBO& _41, device float2& vOutPatchPosBase, device float4& vPatchLods, device half (&gl_TessLevelOuter)[4], device half (&gl_TessLevelInner)[2]) +{ + vOutPatchPosBase = p0; + float2 param = p0 + (float2(-0.5) * _41.uPatchSize); + float l00 = lod_factor(param, _41); + float2 param_1 = p0 + (float2(0.5, -0.5) * _41.uPatchSize); + float l10 = lod_factor(param_1, _41); + float2 param_2 = p0 + (float2(1.5, -0.5) * _41.uPatchSize); + float l20 = lod_factor(param_2, _41); + float2 param_3 = p0 + (float2(-0.5, 0.5) * _41.uPatchSize); + float l01 = lod_factor(param_3, _41); + float2 param_4 = p0 + (float2(0.5) * _41.uPatchSize); + float l11 = lod_factor(param_4, _41); + float2 param_5 = p0 + (float2(1.5, 0.5) * _41.uPatchSize); + float l21 = lod_factor(param_5, _41); + float2 param_6 = p0 + (float2(-0.5, 1.5) * _41.uPatchSize); + float l02 = lod_factor(param_6, _41); + float2 param_7 = p0 + (float2(0.5, 1.5) * _41.uPatchSize); + float l12 = lod_factor(param_7, _41); + float2 param_8 = p0 + (float2(1.5) * _41.uPatchSize); + float l22 = lod_factor(param_8, _41); + float4 lods = float4(dot(float4(l01, l11, l02, l12), float4(0.25)), dot(float4(l00, l10, l01, l11), float4(0.25)), dot(float4(l10, l20, l11, l21), float4(0.25)), dot(float4(l11, l21, l12, l22), float4(0.25))); + vPatchLods = lods; + float4 outer_lods = fast::min(lods, lods.yzwx); + float4 param_9 = outer_lods; + float4 levels = tess_level(param_9, _41); + gl_TessLevelOuter[0] = half(levels.x); + gl_TessLevelOuter[1] = half(levels.y); + gl_TessLevelOuter[2] = half(levels.z); + gl_TessLevelOuter[3] = half(levels.w); + float min_lod = fast::min(fast::min(lods.x, lods.y), fast::min(lods.z, lods.w)); + float param_10 = fast::min(min_lod, l11); + float inner = tess_level(param_10, _41); + gl_TessLevelInner[0] = half(inner); + gl_TessLevelInner[1] = half(inner); +} + +kernel void main0(constant UBO& _41 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_GlobalInvocationID.x / 1]; + device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; + uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 1, spvIndirectParams[1] - 1); + float2 p0 = gl_in[0].vPatchPosBase.xy; + float2 param = p0; + if (!frustum_cull(param, _41)) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(-1.0); + } + else + { + float2 param_1 = p0; + compute_tess_levels(param_1, _41, patchOut.vOutPatchPosBase, patchOut.vPatchLods, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor, spvTessLevel[gl_PrimitiveID].insideTessellationFactor); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc b/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc new file mode 100644 index 0000000000..d7b72d9f05 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc @@ -0,0 +1,137 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4 uScale; + float3 uCamPos; + float2 uPatchSize; + float2 uMaxTessLevel; + float uDistanceMod; + float4 uFrustum[6]; +}; + +struct main0_patchOut +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +struct main0_in +{ + float2 vPatchPosBase [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +bool frustum_cull(thread const float2& p0, constant UBO& _41) +{ + float2 min_xz = (p0 - float2(10.0)) * _41.uScale.xy; + float2 max_xz = ((p0 + _41.uPatchSize) + float2(10.0)) * _41.uScale.xy; + float3 bb_min = float3(min_xz.x, -10.0, min_xz.y); + float3 bb_max = float3(max_xz.x, 10.0, max_xz.y); + float3 center = (bb_min + bb_max) * 0.5; + float radius = 0.5 * length(bb_max - bb_min); + float3 f0 = float3(dot(_41.uFrustum[0], float4(center, 1.0)), dot(_41.uFrustum[1], float4(center, 1.0)), dot(_41.uFrustum[2], float4(center, 1.0))); + float3 f1 = float3(dot(_41.uFrustum[3], float4(center, 1.0)), dot(_41.uFrustum[4], float4(center, 1.0)), dot(_41.uFrustum[5], float4(center, 1.0))); + bool _205 = any(f0 <= float3(-radius)); + bool _215; + if (!_205) + { + _215 = any(f1 <= float3(-radius)); + } + else + { + _215 = _205; + } + return !_215; +} + +static inline __attribute__((always_inline)) +float lod_factor(thread const float2& pos_, constant UBO& _41) +{ + float2 pos = pos_ * _41.uScale.xy; + float3 dist_to_cam = _41.uCamPos - float3(pos.x, 0.0, pos.y); + float level0 = log2((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod); + return fast::clamp(level0, 0.0, _41.uMaxTessLevel.x); +} + +static inline __attribute__((always_inline)) +float4 tess_level(thread const float4& lod, constant UBO& _41) +{ + return exp2(-lod) * _41.uMaxTessLevel.y; +} + +static inline __attribute__((always_inline)) +float tess_level(thread const float& lod, constant UBO& _41) +{ + return _41.uMaxTessLevel.y * exp2(-lod); +} + +static inline __attribute__((always_inline)) +void compute_tess_levels(thread const float2& p0, constant UBO& _41, device float2& vOutPatchPosBase, device float4& vPatchLods, device half (&gl_TessLevelOuter)[4], device half (&gl_TessLevelInner)[2]) +{ + vOutPatchPosBase = p0; + float2 param = p0 + (float2(-0.5) * _41.uPatchSize); + float l00 = lod_factor(param, _41); + float2 param_1 = p0 + (float2(0.5, -0.5) * _41.uPatchSize); + float l10 = lod_factor(param_1, _41); + float2 param_2 = p0 + (float2(1.5, -0.5) * _41.uPatchSize); + float l20 = lod_factor(param_2, _41); + float2 param_3 = p0 + (float2(-0.5, 0.5) * _41.uPatchSize); + float l01 = lod_factor(param_3, _41); + float2 param_4 = p0 + (float2(0.5) * _41.uPatchSize); + float l11 = lod_factor(param_4, _41); + float2 param_5 = p0 + (float2(1.5, 0.5) * _41.uPatchSize); + float l21 = lod_factor(param_5, _41); + float2 param_6 = p0 + (float2(-0.5, 1.5) * _41.uPatchSize); + float l02 = lod_factor(param_6, _41); + float2 param_7 = p0 + (float2(0.5, 1.5) * _41.uPatchSize); + float l12 = lod_factor(param_7, _41); + float2 param_8 = p0 + (float2(1.5) * _41.uPatchSize); + float l22 = lod_factor(param_8, _41); + float4 lods = float4(dot(float4(l01, l11, l02, l12), float4(0.25)), dot(float4(l00, l10, l01, l11), float4(0.25)), dot(float4(l10, l20, l11, l21), float4(0.25)), dot(float4(l11, l21, l12, l22), float4(0.25))); + vPatchLods = lods; + float4 outer_lods = fast::min(lods, lods.yzwx); + float4 param_9 = outer_lods; + float4 levels = tess_level(param_9, _41); + gl_TessLevelOuter[0] = half(levels.x); + gl_TessLevelOuter[1] = half(levels.y); + gl_TessLevelOuter[2] = half(levels.z); + gl_TessLevelOuter[3] = half(levels.w); + float min_lod = fast::min(fast::min(lods.x, lods.y), fast::min(lods.z, lods.w)); + float param_10 = fast::min(min_lod, l11); + float inner = tess_level(param_10, _41); + gl_TessLevelInner[0] = half(inner); + gl_TessLevelInner[1] = half(inner); +} + +kernel void main0(main0_in in [[stage_in]], constant UBO& _41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 1) + return; + float2 p0 = gl_in[0].vPatchPosBase; + float2 param = p0; + if (!frustum_cull(param, _41)) + { + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(-1.0); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(-1.0); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(-1.0); + } + else + { + float2 param_1 = p0; + compute_tess_levels(param_1, _41, patchOut.vOutPatchPosBase, patchOut.vPatchLods, spvTessLevel[gl_PrimitiveID].edgeTessellationFactor, spvTessLevel[gl_PrimitiveID].insideTessellationFactor); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese b/third_party/spirv-cross/reference/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese new file mode 100644 index 0000000000..44e495fb32 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct _35 +{ + float dummy; + float4 variableInStruct; +}; + +struct main0_out +{ + float outResult [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + spvUnsafeArray<_35, 3> testStructArray; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(float3 gl_TessCoord [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + float result = ((float(abs(gl_in[0].testStructArray[2].variableInStruct.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(gl_in[0].testStructArray[2].variableInStruct.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].testStructArray[2].variableInStruct.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].testStructArray[2].variableInStruct.w - 7.0) < 0.001000000047497451305389404296875); + out.outResult = result; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese b/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese new file mode 100644 index 0000000000..23c2cc3ecc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese @@ -0,0 +1,39 @@ +#include +#include + +using namespace metal; + +struct t35 +{ + float2 m0; + float4 m1; +}; + +struct t36 +{ + float2 m0; + t35 m1; +}; + +struct main0_out +{ + float v80 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 v40_m0; + t35 v40_m1; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(float3 gl_TessCoord [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + float v34 = ((float(abs(gl_in[0].v40_m1.m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(gl_in[0].v40_m1.m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].v40_m1.m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(gl_in[0].v40_m1.m1.w - 7.0) < 0.001000000047497451305389404296875); + out.v80 = v34; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.tese b/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.tese new file mode 100644 index 0000000000..711580d16a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/in-block-with-nested-struct.tese @@ -0,0 +1,44 @@ +#include +#include + +using namespace metal; + +struct t35 +{ + float2 m0; + float4 m1; +}; + +struct t36 +{ + float2 m0; + t35 m1; +}; + +struct main0_out +{ + float v80 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 v40_m0 [[attribute(0)]]; + float2 v40_m1_m0 [[attribute(1)]]; + float4 v40_m1_m1 [[attribute(2)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + out.gl_Position = float4((gl_TessCoord.xy * 2.0) - float2(1.0), 0.0, 1.0); + float v34 = ((float(abs(patchIn.gl_in[0].v40_m1_m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(patchIn.gl_in[0].v40_m1_m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(patchIn.gl_in[0].v40_m1_m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(patchIn.gl_in[0].v40_m1_m1.w - 7.0) < 0.001000000047497451305389404296875); + out.v80 = v34; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/input-array.tese b/third_party/spirv-cross/reference/shaders-msl/tese/input-array.tese new file mode 100644 index 0000000000..c94619602a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/input-array.tese @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Floats [[attribute(0)]]; + float4 Floats2 [[attribute(2)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +static inline __attribute__((always_inline)) +void set_position(thread float4& gl_Position, thread patch_control_point& gl_in, thread float3& gl_TessCoord) +{ + gl_Position = (gl_in[0].Floats * gl_TessCoord.x) + (gl_in[1].Floats2 * gl_TessCoord.y); +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + set_position(out.gl_Position, patchIn.gl_in, gl_TessCoord); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/input-types.raw-tess-in.tese b/third_party/spirv-cross/reference/shaders-msl/tese/input-types.raw-tess-in.tese new file mode 100644 index 0000000000..5295222096 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/input-types.raw-tess-in.tese @@ -0,0 +1,81 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct PatchBlock +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor; + float4 blocks_a; + float4 blocks_b; + Foo vFoos; +}; + +struct main0_patchIn +{ + float4 vColors; + float4 patch_block_a; + float4 patch_block_b; + Foo vFoo; +}; + +static inline __attribute__((always_inline)) +void set_from_function(thread float4& gl_Position, const device main0_in* thread & gl_in, thread PatchBlock& patch_block, const device float4& vColors, const device Foo& vFoo) +{ + gl_Position = gl_in[0].blocks_a; + gl_Position += gl_in[0].blocks_b; + gl_Position += gl_in[1].blocks_a; + gl_Position += gl_in[1].blocks_b; + gl_Position += patch_block.a; + gl_Position += patch_block.b; + gl_Position += gl_in[0].vColor; + gl_Position += gl_in[1].vColor; + gl_Position += vColors; + Foo foo = vFoo; + gl_Position += foo.a; + gl_Position += foo.b; + foo = gl_in[0].vFoos; + gl_Position += foo.a; + gl_Position += foo.b; + foo = gl_in[1].vFoos; + gl_Position += foo.a; + gl_Position += foo.b; +} + +[[ patch(quad, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device main0_patchIn* spvPatchIn [[buffer(20)]], const device main0_in* spvIn [[buffer(22)]]) +{ + main0_out out = {}; + PatchBlock patch_block = {}; + const device main0_in* gl_in = &spvIn[gl_PrimitiveID * 0]; + const device main0_patchIn& patchIn = spvPatchIn[gl_PrimitiveID]; + patch_block.a = patchIn.patch_block_a; + patch_block.b = patchIn.patch_block_b; + set_from_function(out.gl_Position, gl_in, patch_block, patchIn.vColors, patchIn.vFoo); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/input-types.tese b/third_party/spirv-cross/reference/shaders-msl/tese/input-types.tese new file mode 100644 index 0000000000..d25235a2a3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/input-types.tese @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct PatchBlock +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor [[attribute(0)]]; + float4 blocks_a [[attribute(4)]]; + float4 blocks_b [[attribute(5)]]; + float4 vFoos_a [[attribute(14)]]; + float4 vFoos_b [[attribute(15)]]; +}; + +struct main0_patchIn +{ + float4 vColors [[attribute(1)]]; + float4 patch_block_a [[attribute(6)]]; + float4 patch_block_b [[attribute(7)]]; + float4 vFoo_a [[attribute(8)]]; + float4 vFoo_b [[attribute(9)]]; + patch_control_point gl_in; +}; + +static inline __attribute__((always_inline)) +void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread PatchBlock& patch_block, thread float4& vColors, thread Foo& vFoo) +{ + gl_Position = gl_in[0].blocks_a; + gl_Position += gl_in[0].blocks_b; + gl_Position += gl_in[1].blocks_a; + gl_Position += gl_in[1].blocks_b; + gl_Position += patch_block.a; + gl_Position += patch_block.b; + gl_Position += gl_in[0].vColor; + gl_Position += gl_in[1].vColor; + gl_Position += vColors; + Foo foo = vFoo; + gl_Position += foo.a; + gl_Position += foo.b; + Foo _106 = Foo{ gl_in[0].vFoos_a, gl_in[0].vFoos_b }; + foo = _106; + gl_Position += foo.a; + gl_Position += foo.b; + Foo _120 = Foo{ gl_in[1].vFoos_a, gl_in[1].vFoos_b }; + foo = _120; + gl_Position += foo.a; + gl_Position += foo.b; +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + PatchBlock patch_block = {}; + Foo vFoo = {}; + patch_block.a = patchIn.patch_block_a; + patch_block.b = patchIn.patch_block_b; + vFoo.a = patchIn.vFoo_a; + vFoo.b = patchIn.vFoo_b; + set_from_function(out.gl_Position, patchIn.gl_in, patch_block, patchIn.vColors, vFoo); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese b/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese new file mode 100644 index 0000000000..b3024a9b52 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array-of-matrix.tese @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInputs_0 [[attribute(0)]]; + float4 vInputs_1 [[attribute(1)]]; + float4 vInputs_2 [[attribute(2)]]; + float4 vInputs_3 [[attribute(3)]]; +}; + +struct main0_patchIn +{ + float4 vBoo_0 [[attribute(4)]]; + float4 vBoo_1 [[attribute(5)]]; + float4 vBoo_2 [[attribute(6)]]; + float4 vBoo_3 [[attribute(7)]]; + int vIndex [[attribute(8)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray vBoo = {}; + vBoo[0] = patchIn.vBoo_0; + vBoo[1] = patchIn.vBoo_1; + vBoo[2] = patchIn.vBoo_2; + vBoo[3] = patchIn.vBoo_3; + spvUnsafeArray _16 = spvUnsafeArray({ float4x4(patchIn.gl_in[0].vInputs_0, patchIn.gl_in[0].vInputs_1, patchIn.gl_in[0].vInputs_2, patchIn.gl_in[0].vInputs_3), float4x4(patchIn.gl_in[1].vInputs_0, patchIn.gl_in[1].vInputs_1, patchIn.gl_in[1].vInputs_2, patchIn.gl_in[1].vInputs_3), float4x4(patchIn.gl_in[2].vInputs_0, patchIn.gl_in[2].vInputs_1, patchIn.gl_in[2].vInputs_2, patchIn.gl_in[2].vInputs_3), float4x4(patchIn.gl_in[3].vInputs_0, patchIn.gl_in[3].vInputs_1, patchIn.gl_in[3].vInputs_2, patchIn.gl_in[3].vInputs_3), float4x4(patchIn.gl_in[4].vInputs_0, patchIn.gl_in[4].vInputs_1, patchIn.gl_in[4].vInputs_2, patchIn.gl_in[4].vInputs_3), float4x4(patchIn.gl_in[5].vInputs_0, patchIn.gl_in[5].vInputs_1, patchIn.gl_in[5].vInputs_2, patchIn.gl_in[5].vInputs_3), float4x4(patchIn.gl_in[6].vInputs_0, patchIn.gl_in[6].vInputs_1, patchIn.gl_in[6].vInputs_2, patchIn.gl_in[6].vInputs_3), float4x4(patchIn.gl_in[7].vInputs_0, patchIn.gl_in[7].vInputs_1, patchIn.gl_in[7].vInputs_2, patchIn.gl_in[7].vInputs_3), float4x4(patchIn.gl_in[8].vInputs_0, patchIn.gl_in[8].vInputs_1, patchIn.gl_in[8].vInputs_2, patchIn.gl_in[8].vInputs_3), float4x4(patchIn.gl_in[9].vInputs_0, patchIn.gl_in[9].vInputs_1, patchIn.gl_in[9].vInputs_2, patchIn.gl_in[9].vInputs_3), float4x4(patchIn.gl_in[10].vInputs_0, patchIn.gl_in[10].vInputs_1, patchIn.gl_in[10].vInputs_2, patchIn.gl_in[10].vInputs_3), float4x4(patchIn.gl_in[11].vInputs_0, patchIn.gl_in[11].vInputs_1, patchIn.gl_in[11].vInputs_2, patchIn.gl_in[11].vInputs_3), float4x4(patchIn.gl_in[12].vInputs_0, patchIn.gl_in[12].vInputs_1, patchIn.gl_in[12].vInputs_2, patchIn.gl_in[12].vInputs_3), float4x4(patchIn.gl_in[13].vInputs_0, patchIn.gl_in[13].vInputs_1, patchIn.gl_in[13].vInputs_2, patchIn.gl_in[13].vInputs_3), float4x4(patchIn.gl_in[14].vInputs_0, patchIn.gl_in[14].vInputs_1, patchIn.gl_in[14].vInputs_2, patchIn.gl_in[14].vInputs_3), float4x4(patchIn.gl_in[15].vInputs_0, patchIn.gl_in[15].vInputs_1, patchIn.gl_in[15].vInputs_2, patchIn.gl_in[15].vInputs_3), float4x4(patchIn.gl_in[16].vInputs_0, patchIn.gl_in[16].vInputs_1, patchIn.gl_in[16].vInputs_2, patchIn.gl_in[16].vInputs_3), float4x4(patchIn.gl_in[17].vInputs_0, patchIn.gl_in[17].vInputs_1, patchIn.gl_in[17].vInputs_2, patchIn.gl_in[17].vInputs_3), float4x4(patchIn.gl_in[18].vInputs_0, patchIn.gl_in[18].vInputs_1, patchIn.gl_in[18].vInputs_2, patchIn.gl_in[18].vInputs_3), float4x4(patchIn.gl_in[19].vInputs_0, patchIn.gl_in[19].vInputs_1, patchIn.gl_in[19].vInputs_2, patchIn.gl_in[19].vInputs_3), float4x4(patchIn.gl_in[20].vInputs_0, patchIn.gl_in[20].vInputs_1, patchIn.gl_in[20].vInputs_2, patchIn.gl_in[20].vInputs_3), float4x4(patchIn.gl_in[21].vInputs_0, patchIn.gl_in[21].vInputs_1, patchIn.gl_in[21].vInputs_2, patchIn.gl_in[21].vInputs_3), float4x4(patchIn.gl_in[22].vInputs_0, patchIn.gl_in[22].vInputs_1, patchIn.gl_in[22].vInputs_2, patchIn.gl_in[22].vInputs_3), float4x4(patchIn.gl_in[23].vInputs_0, patchIn.gl_in[23].vInputs_1, patchIn.gl_in[23].vInputs_2, patchIn.gl_in[23].vInputs_3), float4x4(patchIn.gl_in[24].vInputs_0, patchIn.gl_in[24].vInputs_1, patchIn.gl_in[24].vInputs_2, patchIn.gl_in[24].vInputs_3), float4x4(patchIn.gl_in[25].vInputs_0, patchIn.gl_in[25].vInputs_1, patchIn.gl_in[25].vInputs_2, patchIn.gl_in[25].vInputs_3), float4x4(patchIn.gl_in[26].vInputs_0, patchIn.gl_in[26].vInputs_1, patchIn.gl_in[26].vInputs_2, patchIn.gl_in[26].vInputs_3), float4x4(patchIn.gl_in[27].vInputs_0, patchIn.gl_in[27].vInputs_1, patchIn.gl_in[27].vInputs_2, patchIn.gl_in[27].vInputs_3), float4x4(patchIn.gl_in[28].vInputs_0, patchIn.gl_in[28].vInputs_1, patchIn.gl_in[28].vInputs_2, patchIn.gl_in[28].vInputs_3), float4x4(patchIn.gl_in[29].vInputs_0, patchIn.gl_in[29].vInputs_1, patchIn.gl_in[29].vInputs_2, patchIn.gl_in[29].vInputs_3), float4x4(patchIn.gl_in[30].vInputs_0, patchIn.gl_in[30].vInputs_1, patchIn.gl_in[30].vInputs_2, patchIn.gl_in[30].vInputs_3), float4x4(patchIn.gl_in[31].vInputs_0, patchIn.gl_in[31].vInputs_1, patchIn.gl_in[31].vInputs_2, patchIn.gl_in[31].vInputs_3) }); + spvUnsafeArray tmp = _16; + out.gl_Position = (tmp[0][patchIn.vIndex] + tmp[1][patchIn.vIndex]) + vBoo[patchIn.vIndex]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array.tese b/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array.tese new file mode 100644 index 0000000000..5b008c63f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/load-control-point-array.tese @@ -0,0 +1,80 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInputs [[attribute(0)]]; +}; + +struct main0_patchIn +{ + float4 vBoo_0 [[attribute(1)]]; + float4 vBoo_1 [[attribute(2)]]; + float4 vBoo_2 [[attribute(3)]]; + float4 vBoo_3 [[attribute(4)]]; + int vIndex [[attribute(5)]]; + patch_control_point gl_in; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray vBoo = {}; + vBoo[0] = patchIn.vBoo_0; + vBoo[1] = patchIn.vBoo_1; + vBoo[2] = patchIn.vBoo_2; + vBoo[3] = patchIn.vBoo_3; + spvUnsafeArray _15 = spvUnsafeArray({ patchIn.gl_in[0].vInputs, patchIn.gl_in[1].vInputs, patchIn.gl_in[2].vInputs, patchIn.gl_in[3].vInputs, patchIn.gl_in[4].vInputs, patchIn.gl_in[5].vInputs, patchIn.gl_in[6].vInputs, patchIn.gl_in[7].vInputs, patchIn.gl_in[8].vInputs, patchIn.gl_in[9].vInputs, patchIn.gl_in[10].vInputs, patchIn.gl_in[11].vInputs, patchIn.gl_in[12].vInputs, patchIn.gl_in[13].vInputs, patchIn.gl_in[14].vInputs, patchIn.gl_in[15].vInputs, patchIn.gl_in[16].vInputs, patchIn.gl_in[17].vInputs, patchIn.gl_in[18].vInputs, patchIn.gl_in[19].vInputs, patchIn.gl_in[20].vInputs, patchIn.gl_in[21].vInputs, patchIn.gl_in[22].vInputs, patchIn.gl_in[23].vInputs, patchIn.gl_in[24].vInputs, patchIn.gl_in[25].vInputs, patchIn.gl_in[26].vInputs, patchIn.gl_in[27].vInputs, patchIn.gl_in[28].vInputs, patchIn.gl_in[29].vInputs, patchIn.gl_in[30].vInputs, patchIn.gl_in[31].vInputs }); + spvUnsafeArray tmp = _15; + out.gl_Position = (tmp[0] + tmp[1]) + vBoo[patchIn.vIndex]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/quad.domain.tese b/third_party/spirv-cross/reference/shaders-msl/tese/quad.domain.tese new file mode 100644 index 0000000000..10cdf5f10b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/quad.domain.tese @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + gl_TessCoord.y = 1.0 - gl_TessCoord.y; + out.gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/quad.tese b/third_party/spirv-cross/reference/shaders-msl/tese/quad.tese new file mode 100644 index 0000000000..e0c7944394 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/quad.tese @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +void set_position(thread float4& gl_Position, thread float3& gl_TessCoord, thread spvUnsafeArray& gl_TessLevelInner, thread spvUnsafeArray& gl_TessLevelOuter) +{ + gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0]) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner[0]) * gl_TessLevelOuter[2]), ((gl_TessCoord.y * gl_TessLevelInner[1]) * gl_TessLevelOuter[1]) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner[1]) * gl_TessLevelOuter[3]), 0.0, 1.0); +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + set_position(out.gl_Position, gl_TessCoord, gl_TessLevelInner, gl_TessLevelOuter); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese new file mode 100644 index 0000000000..7048546cea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese @@ -0,0 +1,78 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevelOuter [[attribute(0)]]; + float2 gl_TessLevelInner [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +float4 read_tess_levels(thread spvUnsafeArray& gl_TessLevelOuter, thread spvUnsafeArray& gl_TessLevelInner) +{ + return float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = patchIn.gl_TessLevelOuter[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevelOuter[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevelOuter[2]; + gl_TessLevelOuter[3] = patchIn.gl_TessLevelOuter[3]; + gl_TessLevelInner[0] = patchIn.gl_TessLevelInner[0]; + gl_TessLevelInner[1] = patchIn.gl_TessLevelInner[1]; + out.gl_Position = read_tess_levels(gl_TessLevelOuter, gl_TessLevelInner); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..f8f81b7574 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese @@ -0,0 +1,72 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +static inline __attribute__((always_inline)) +float4 read_tess_levels(thread spvUnsafeArray& gl_TessLevelOuter, thread spvUnsafeArray& gl_TessLevelInner) +{ + return float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +[[ patch(quad, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]; + gl_TessLevelOuter[1] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]; + gl_TessLevelOuter[2] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]; + gl_TessLevelOuter[3] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]; + gl_TessLevelInner[0] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0]; + gl_TessLevelInner[1] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1]; + out.gl_Position = read_tess_levels(gl_TessLevelOuter, gl_TessLevelInner); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.msl2.tese b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.msl2.tese new file mode 100644 index 0000000000..432ad7cc2d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.msl2.tese @@ -0,0 +1,75 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevel [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +float4 read_tess_levels(thread spvUnsafeArray& gl_TessLevelOuter, thread spvUnsafeArray& gl_TessLevelInner) +{ + return float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = patchIn.gl_TessLevel[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevel[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevel[2]; + gl_TessLevelInner[0] = patchIn.gl_TessLevel[3]; + out.gl_Position = read_tess_levels(gl_TessLevelOuter, gl_TessLevelInner); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..5be7c40174 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese @@ -0,0 +1,70 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +static inline __attribute__((always_inline)) +float4 read_tess_levels(thread spvUnsafeArray& gl_TessLevelOuter, thread spvUnsafeArray& gl_TessLevelInner) +{ + return float4(gl_TessLevelOuter[0], gl_TessLevelOuter[1], gl_TessLevelOuter[2], gl_TessLevelOuter[3]) + float2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +[[ patch(triangle, 0) ]] vertex main0_out main0(uint gl_PrimitiveID [[patch_id]], const device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + spvUnsafeArray gl_TessLevelInner = {}; + gl_TessLevelOuter[0] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]; + gl_TessLevelOuter[1] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]; + gl_TessLevelOuter[2] = spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]; + gl_TessLevelInner[0] = spvTessLevel[gl_PrimitiveID].insideTessellationFactor; + out.gl_Position = read_tess_levels(gl_TessLevelOuter, gl_TessLevelInner); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/set-from-function.tese b/third_party/spirv-cross/reference/shaders-msl/tese/set-from-function.tese new file mode 100644 index 0000000000..dfbbe0b702 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/set-from-function.tese @@ -0,0 +1,63 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Block +{ + float4 a; + float4 b; +}; + +struct Foo +{ + float4 a; + float4 b; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vColor [[attribute(0)]]; + float4 blocks_a [[attribute(2)]]; + float4 blocks_b [[attribute(3)]]; +}; + +struct main0_patchIn +{ + float4 vColors [[attribute(1)]]; + float4 vFoo_a [[attribute(4)]]; + float4 vFoo_b [[attribute(5)]]; + patch_control_point gl_in; +}; + +static inline __attribute__((always_inline)) +void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread float4& vColors, thread Foo& vFoo) +{ + gl_Position = gl_in[0].blocks_a; + gl_Position += gl_in[0].blocks_b; + gl_Position += gl_in[1].blocks_a; + gl_Position += gl_in[1].blocks_b; + gl_Position += gl_in[0].vColor; + gl_Position += gl_in[1].vColor; + gl_Position += vColors; + gl_Position += vFoo.a; + gl_Position += vFoo.b; +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]]) +{ + main0_out out = {}; + Foo vFoo = {}; + vFoo.a = patchIn.vFoo_a; + vFoo.b = patchIn.vFoo_b; + set_from_function(out.gl_Position, patchIn.gl_in, patchIn.vColors, vFoo); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/triangle-tess-level.tese b/third_party/spirv-cross/reference/shaders-msl/tese/triangle-tess-level.tese new file mode 100644 index 0000000000..86ccc4f023 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/triangle-tess-level.tese @@ -0,0 +1,69 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float4 gl_TessLevel [[attribute(0)]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray gl_TessLevelInner = {}; + spvUnsafeArray gl_TessLevelOuter = {}; + gl_TessLevelInner[0] = patchIn.gl_TessLevel[3]; + gl_TessLevelOuter[0] = patchIn.gl_TessLevel[0]; + gl_TessLevelOuter[1] = patchIn.gl_TessLevel[1]; + gl_TessLevelOuter[2] = patchIn.gl_TessLevel[2]; + out.gl_Position = float4((gl_TessCoord.x * gl_TessLevelInner[0]) * gl_TessLevelOuter[0], (gl_TessCoord.y * gl_TessLevelInner[0]) * gl_TessLevelOuter[1], (gl_TessCoord.z * gl_TessLevelInner[0]) * gl_TessLevelOuter[2], 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/triangle.tese b/third_party/spirv-cross/reference/shaders-msl/tese/triangle.tese new file mode 100644 index 0000000000..12715be198 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/triangle.tese @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0() +{ + main0_out out = {}; + out.gl_Position = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.raw-tess-in.tese b/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.raw-tess-in.tese new file mode 100644 index 0000000000..c2c9e1ce67 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.raw-tess-in.tese @@ -0,0 +1,77 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; + float4 uScale; + float2 uInvScale; + float3 uCamPos; + float2 uPatchSize; + float2 uInvHeightmapSize; +}; + +struct main0_out +{ + float3 vWorld [[user(locn0)]]; + float4 vGradNormalTex [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float2 vOutPatchPosBase; + float4 vPatchLods; +}; + +static inline __attribute__((always_inline)) +float2 lerp_vertex(thread const float2& tess_coord, const device float2& vOutPatchPosBase, constant UBO& _31) +{ + return vOutPatchPosBase + (tess_coord * _31.uPatchSize); +} + +static inline __attribute__((always_inline)) +float2 lod_factor(thread const float2& tess_coord, const device float4& vPatchLods) +{ + float2 x = mix(vPatchLods.yx, vPatchLods.zw, float2(tess_coord.x)); + float level0 = mix(x.x, x.y, tess_coord.y); + float floor_level = floor(level0); + float fract_level = level0 - floor_level; + return float2(floor_level, fract_level); +} + +static inline __attribute__((always_inline)) +float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, texture2d uHeightmapDisplacement, sampler uHeightmapDisplacementSmplr) +{ + return mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 0.5)), level(lod.x)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 1.0)), level(lod.x + 1.0)).xyz, float3(lod.y)); +} + +[[ patch(quad, 0) ]] vertex main0_out main0(constant UBO& _31 [[buffer(0)]], texture2d uHeightmapDisplacement [[texture(0)]], sampler uHeightmapDisplacementSmplr [[sampler(0)]], float2 gl_TessCoordIn [[position_in_patch]], uint gl_PrimitiveID [[patch_id]], const device main0_patchIn* spvPatchIn [[buffer(20)]]) +{ + main0_out out = {}; + const device main0_patchIn& patchIn = spvPatchIn[gl_PrimitiveID]; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + float2 tess_coord = gl_TessCoord.xy; + float2 param = tess_coord; + float2 pos = lerp_vertex(param, patchIn.vOutPatchPosBase, _31); + float2 param_1 = tess_coord; + float2 lod = lod_factor(param_1, patchIn.vPatchLods); + float2 tex = pos * _31.uInvHeightmapSize; + pos *= _31.uScale.xy; + float delta_mod = exp2(lod.x); + float2 off = _31.uInvHeightmapSize * delta_mod; + out.vGradNormalTex = float4(tex + (_31.uInvHeightmapSize * 0.5), tex * _31.uScale.zw); + float2 param_2 = tex; + float2 param_3 = off; + float2 param_4 = lod; + float3 height_displacement = sample_height_displacement(param_2, param_3, param_4, uHeightmapDisplacement, uHeightmapDisplacementSmplr); + pos += height_displacement.yz; + out.vWorld = float3(pos.x, height_displacement.x, pos.y); + out.gl_Position = _31.uMVP * float4(out.vWorld, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.tese b/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.tese new file mode 100644 index 0000000000..a30e5c763a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/tese/water_tess.tese @@ -0,0 +1,76 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; + float4 uScale; + float2 uInvScale; + float3 uCamPos; + float2 uPatchSize; + float2 uInvHeightmapSize; +}; + +struct main0_out +{ + float3 vWorld [[user(locn0)]]; + float4 vGradNormalTex [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_patchIn +{ + float2 vOutPatchPosBase [[attribute(0)]]; + float4 vPatchLods [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +float2 lerp_vertex(thread const float2& tess_coord, thread float2& vOutPatchPosBase, constant UBO& _31) +{ + return vOutPatchPosBase + (tess_coord * _31.uPatchSize); +} + +static inline __attribute__((always_inline)) +float2 lod_factor(thread const float2& tess_coord, thread float4& vPatchLods) +{ + float2 x = mix(vPatchLods.yx, vPatchLods.zw, float2(tess_coord.x)); + float level0 = mix(x.x, x.y, tess_coord.y); + float floor_level = floor(level0); + float fract_level = level0 - floor_level; + return float2(floor_level, fract_level); +} + +static inline __attribute__((always_inline)) +float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, texture2d uHeightmapDisplacement, sampler uHeightmapDisplacementSmplr) +{ + return mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 0.5)), level(lod.x)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 1.0)), level(lod.x + 1.0)).xyz, float3(lod.y)); +} + +[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant UBO& _31 [[buffer(0)]], texture2d uHeightmapDisplacement [[texture(0)]], sampler uHeightmapDisplacementSmplr [[sampler(0)]], float2 gl_TessCoordIn [[position_in_patch]]) +{ + main0_out out = {}; + float3 gl_TessCoord = float3(gl_TessCoordIn.x, gl_TessCoordIn.y, 0.0); + float2 tess_coord = gl_TessCoord.xy; + float2 param = tess_coord; + float2 pos = lerp_vertex(param, patchIn.vOutPatchPosBase, _31); + float2 param_1 = tess_coord; + float2 lod = lod_factor(param_1, patchIn.vPatchLods); + float2 tex = pos * _31.uInvHeightmapSize; + pos *= _31.uScale.xy; + float delta_mod = exp2(lod.x); + float2 off = _31.uInvHeightmapSize * delta_mod; + out.vGradNormalTex = float4(tex + (_31.uInvHeightmapSize * 0.5), tex * _31.uScale.zw); + float2 param_2 = tex; + float2 param_3 = off; + float2 param_4 = lod; + float3 height_displacement = sample_height_displacement(param_2, param_3, param_4, uHeightmapDisplacement, uHeightmapDisplacementSmplr); + pos += height_displacement.yz; + out.vWorld = float3(pos.x, height_displacement.x, pos.y); + out.gl_Position = _31.uMVP * float4(out.vWorld, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.for-tess.vert new file mode 100644 index 0000000000..24958eb50d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.for-tess.vert @@ -0,0 +1,98 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 m_location_0; + float4 m_location_1; + float4 m_location_2; + float4 gl_Position; +}; + +struct main0_in +{ + float4 m_location_0 [[attribute(0)]]; + float4 m_location_1 [[attribute(1)]]; + float4 m_location_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +kernel void main0(main0_in in [[stage_in]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + float D = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + float InD = {}; + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + InA[0] = in.m_location_1.x; + InA[1] = in.m_location_2.x; + InB[0] = in.m_location_1.zw; + InB[1] = in.m_location_2.zw; + InC[0] = in.m_location_0.y; + InC[1] = in.m_location_1.y; + InC[2] = in.m_location_2.y; + InD = in.m_location_0.w; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = in.Pos; + A = InA; + B = InB; + C = InC; + D = InD; + out.m_location_1.x = A[0]; + out.m_location_2.x = A[1]; + out.m_location_1.zw = B[0]; + out.m_location_2.zw = B[1]; + out.m_location_0.y = C[0]; + out.m_location_1.y = C[1]; + out.m_location_2.y = C[2]; + out.m_location_0.w = D; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.vert b/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.vert new file mode 100644 index 0000000000..352c9d2ef0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/array-component-io.vert @@ -0,0 +1,100 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float C_0 [[user(locn0_1)]]; + float D [[user(locn0_3)]]; + float A_0 [[user(locn1)]]; + float C_1 [[user(locn1_1)]]; + float2 B_0 [[user(locn1_2)]]; + float A_1 [[user(locn2)]]; + float C_2 [[user(locn2_1)]]; + float2 B_1 [[user(locn2_2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 m_location_0 [[attribute(0)]]; + float4 m_location_1 [[attribute(1)]]; + float4 m_location_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray A = {}; + spvUnsafeArray B = {}; + spvUnsafeArray C = {}; + spvUnsafeArray InA = {}; + spvUnsafeArray InB = {}; + spvUnsafeArray InC = {}; + float InD = {}; + InA[0] = in.m_location_1.x; + InA[1] = in.m_location_2.x; + InB[0] = in.m_location_1.zw; + InB[1] = in.m_location_2.zw; + InC[0] = in.m_location_0.y; + InC[1] = in.m_location_1.y; + InC[2] = in.m_location_2.y; + InD = in.m_location_0.w; + out.gl_Position = in.Pos; + A = InA; + B = InB; + C = InC; + out.D = InD; + out.A_0 = A[0]; + out.A_1 = A[1]; + out.B_0 = B[0]; + out.B_1 = B[1]; + out.C_0 = C[0]; + out.C_1 = C[1]; + out.C_2 = C[2]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/basic.capture.vert b/third_party/spirv-cross/reference/shaders-msl/vert/basic.capture.vert new file mode 100644 index 0000000000..a4177d3c30 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/basic.capture.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex void main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]]) +{ + device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvIndirectParams[0] + gl_VertexIndex - gl_BaseVertex]; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/basic.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/vert/basic.for-tess.vert new file mode 100644 index 0000000000..c99a95ac89 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/basic.for-tess.vert @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal; + float4 gl_Position; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/basic.vert b/third_party/spirv-cross/reference/shaders-msl/vert/basic.vert new file mode 100644 index 0000000000..ffb4357126 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/basic.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.uMVP * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert b/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert new file mode 100644 index 0000000000..9d856c4811 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/buffer_device_address.msl2.vert @@ -0,0 +1,49 @@ +#include +#include + +using namespace metal; + +struct Position; +struct PositionReferences; + +struct Position +{ + float2 positions[1]; +}; + +struct Registers +{ + float4x4 view_projection; + device PositionReferences* references; +}; + +struct PositionReferences +{ + device Position* buffers[1]; +}; + +struct main0_out +{ + float4 out_color [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant Registers& registers [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + int slice = int(gl_InstanceIndex); + const device Position* __restrict positions = registers.references->buffers[slice]; + float2 pos = positions->positions[int(gl_VertexIndex)] * 2.5; + pos += ((float2(float(slice % 8), float(slice / 8)) - float2(3.5)) * 3.0); + out.gl_Position = registers.view_projection * float4(pos, 0.0, 1.0); + int index_x = int(gl_VertexIndex) % 16; + int index_y = int(gl_VertexIndex) / 16; + float r = 0.5 + (0.300000011920928955078125 * sin(float(index_x))); + float g = 0.5 + (0.300000011920928955078125 * sin(float(index_y))); + int checkerboard = (index_x ^ index_y) & 1; + r *= ((float(checkerboard) * 0.800000011920928955078125) + 0.20000000298023223876953125); + g *= ((float(checkerboard) * 0.800000011920928955078125) + 0.20000000298023223876953125); + out.out_color = float4(r, g, 0.1500000059604644775390625, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.no-user-varying.vert b/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.no-user-varying.vert new file mode 100644 index 0000000000..c78105e0ce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.no-user-varying.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.Position; + out.gl_ClipDistance[0] = in.Position.x; + out.gl_ClipDistance[1] = in.Position.y; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.vert b/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.vert new file mode 100644 index 0000000000..af58f35ff5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/clip-distance-block.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [2]; + float gl_ClipDistance_0 [[user(clip0)]]; + float gl_ClipDistance_1 [[user(clip1)]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = in.Position; + out.gl_ClipDistance[0] = in.Position.x; + out.gl_ClipDistance[1] = in.Position.y; + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + out.gl_ClipDistance_1 = out.gl_ClipDistance[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/copy.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/vert/copy.flatten.vert new file mode 100644 index 0000000000..92757a6001 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/copy.flatten.vert @@ -0,0 +1,54 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light lights[4]; +}; + +struct Light_1 +{ + float3 Position; + float Radius; + float4 Color; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vColor = float4(0.0); + Light_1 light; + for (int i = 0; i < 4; i++) + { + light.Position = float3(_21.lights[i].Position); + light.Radius = _21.lights[i].Radius; + light.Color = _21.lights[i].Color; + float3 L = in.aVertex.xyz - light.Position; + out.vColor += ((_21.lights[i].Color * fast::clamp(1.0 - (length(L) / light.Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(L))); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/dynamic.flatten.vert b/third_party/spirv-cross/reference/shaders-msl/vert/dynamic.flatten.vert new file mode 100644 index 0000000000..43b3e112ce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/dynamic.flatten.vert @@ -0,0 +1,43 @@ +#include +#include + +using namespace metal; + +struct Light +{ + packed_float3 Position; + float Radius; + float4 Color; +}; + +struct UBO +{ + float4x4 uMVP; + Light lights[4]; +}; + +struct main0_out +{ + float4 vColor [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vColor = float4(0.0); + for (int i = 0; i < 4; i++) + { + float3 L = in.aVertex.xyz - float3(_21.lights[i].Position); + out.vColor += ((_21.lights[i].Color * fast::clamp(1.0 - (length(L) / _21.lights[i].Radius), 0.0, 1.0)) * dot(in.aNormal, fast::normalize(L))); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/float-math.invariant-float-math.vert b/third_party/spirv-cross/reference/shaders-msl/vert/float-math.invariant-float-math.vert new file mode 100644 index 0000000000..4b25e91b45 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/float-math.invariant-float-math.vert @@ -0,0 +1,136 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +template +[[clang::optnone]] T spvFMul(T l, T r) +{ + return fma(l, r, T(0)); +} + +template +[[clang::optnone]] vec spvFMulVectorMatrix(vec v, matrix m) +{ + vec res = vec(0); + for (uint i = Rows; i > 0; --i) + { + vec tmp(0); + for (uint j = 0; j < Cols; ++j) + { + tmp[j] = m[j][i - 1]; + } + res = fma(tmp, vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] vec spvFMulMatrixVector(matrix m, vec v) +{ + vec res = vec(0); + for (uint i = Cols; i > 0; --i) + { + res = fma(m[i - 1], vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] matrix spvFMulMatrixMatrix(matrix l, matrix r) +{ + matrix res; + for (uint i = 0; i < RCols; i++) + { + vec tmp(0); + for (uint j = 0; j < LCols; j++) + { + tmp = fma(vec(r[i][j]), l[j], tmp); + } + res[i] = tmp; + } + return res; +} + +struct Matrices +{ + float4x4 vpMatrix; + float4x4 wMatrix; + float4x3 wMatrix4x3; + float3x4 wMatrix3x4; +}; + +struct main0_out +{ + float3 OutNormal [[user(locn0)]]; + float4 OutWorldPos_0 [[user(locn1)]]; + float4 OutWorldPos_1 [[user(locn2)]]; + float4 OutWorldPos_2 [[user(locn3)]]; + float4 OutWorldPos_3 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 InPos [[attribute(0)]]; + float3 InNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]]) +{ + main0_out out = {}; + spvUnsafeArray OutWorldPos = {}; + out.gl_Position = spvFMulMatrixVector(spvFMulMatrixMatrix(_22.vpMatrix, _22.wMatrix), float4(in.InPos, 1.0)); + OutWorldPos[0] = spvFMulMatrixVector(_22.wMatrix, float4(in.InPos, 1.0)); + OutWorldPos[1] = spvFMulVectorMatrix(float4(in.InPos, 1.0), _22.wMatrix); + OutWorldPos[2] = spvFMulMatrixVector(_22.wMatrix3x4, in.InPos); + OutWorldPos[3] = spvFMulVectorMatrix(in.InPos, _22.wMatrix4x3); + out.OutNormal = spvFMulMatrixVector(_22.wMatrix, float4(in.InNormal, 0.0)).xyz; + out.OutWorldPos_0 = OutWorldPos[0]; + out.OutWorldPos_1 = OutWorldPos[1]; + out.OutWorldPos_2 = OutWorldPos[2]; + out.OutWorldPos_3 = OutWorldPos[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/float-math.vert b/third_party/spirv-cross/reference/shaders-msl/vert/float-math.vert new file mode 100644 index 0000000000..e96fdaedc2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/float-math.vert @@ -0,0 +1,87 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Matrices +{ + float4x4 vpMatrix; + float4x4 wMatrix; + float4x3 wMatrix4x3; + float3x4 wMatrix3x4; +}; + +struct main0_out +{ + float3 OutNormal [[user(locn0)]]; + float4 OutWorldPos_0 [[user(locn1)]]; + float4 OutWorldPos_1 [[user(locn2)]]; + float4 OutWorldPos_2 [[user(locn3)]]; + float4 OutWorldPos_3 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 InPos [[attribute(0)]]; + float3 InNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]]) +{ + main0_out out = {}; + spvUnsafeArray OutWorldPos = {}; + out.gl_Position = (_22.vpMatrix * _22.wMatrix) * float4(in.InPos, 1.0); + OutWorldPos[0] = _22.wMatrix * float4(in.InPos, 1.0); + OutWorldPos[1] = float4(in.InPos, 1.0) * _22.wMatrix; + OutWorldPos[2] = _22.wMatrix3x4 * in.InPos; + OutWorldPos[3] = in.InPos * _22.wMatrix4x3; + out.OutNormal = (_22.wMatrix * float4(in.InNormal, 0.0)).xyz; + out.OutWorldPos_0 = OutWorldPos[0]; + out.OutWorldPos_1 = OutWorldPos[1]; + out.OutWorldPos_2 = OutWorldPos[2]; + out.OutWorldPos_3 = OutWorldPos[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/functions.vert b/third_party/spirv-cross/reference/shaders-msl/vert/functions.vert new file mode 100644 index 0000000000..4300aa1350 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/functions.vert @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL radians() function +template +inline T radians(T d) +{ + return d * T(0.01745329251); +} + +// Implementation of the GLSL degrees() function +template +inline T degrees(T r) +{ + return r * T(57.2957795131); +} + +// Implementation of the GLSL findLSB() function +template +inline T spvFindLSB(T x) +{ + return select(ctz(x), T(-1), x == T(0)); +} + +// Implementation of the signed GLSL findMSB() function +template +inline T spvFindSMSB(T x) +{ + T v = select(x, T(-1) - x, x < T(0)); + return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); +} + +// Returns the determinant of a 2x2 matrix. +static inline __attribute__((always_inline)) +float spvDet2x2(float a1, float a2, float b1, float b2) +{ + return a1 * b2 - b1 * a2; +} + +// Returns the determinant of a 3x3 matrix. +static inline __attribute__((always_inline)) +float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3) +{ + return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3); +} + +// Returns the inverse of a matrix, by using the algorithm of calculating the classical +// adjoint and dividing by the determinant. The contents of the matrix are changed. +static inline __attribute__((always_inline)) +float4x4 spvInverse4x4(float4x4 m) +{ + float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) + + // Create the transpose of the cofactors, as the classical adjoint of the matrix. + adj[0][0] = spvDet3x3(m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][1] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[2][1], m[2][2], m[2][3], m[3][1], m[3][2], m[3][3]); + adj[0][2] = spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[3][1], m[3][2], m[3][3]); + adj[0][3] = -spvDet3x3(m[0][1], m[0][2], m[0][3], m[1][1], m[1][2], m[1][3], m[2][1], m[2][2], m[2][3]); + + adj[1][0] = -spvDet3x3(m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][1] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[2][0], m[2][2], m[2][3], m[3][0], m[3][2], m[3][3]); + adj[1][2] = -spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[3][0], m[3][2], m[3][3]); + adj[1][3] = spvDet3x3(m[0][0], m[0][2], m[0][3], m[1][0], m[1][2], m[1][3], m[2][0], m[2][2], m[2][3]); + + adj[2][0] = spvDet3x3(m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][1] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[2][0], m[2][1], m[2][3], m[3][0], m[3][1], m[3][3]); + adj[2][2] = spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[3][0], m[3][1], m[3][3]); + adj[2][3] = -spvDet3x3(m[0][0], m[0][1], m[0][3], m[1][0], m[1][1], m[1][3], m[2][0], m[2][1], m[2][3]); + + adj[3][0] = -spvDet3x3(m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][1] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[2][0], m[2][1], m[2][2], m[3][0], m[3][1], m[3][2]); + adj[3][2] = -spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[3][0], m[3][1], m[3][2]); + adj[3][3] = spvDet3x3(m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]); + + // Calculate the determinant as a combination of the cofactors of the first row. + float det = (adj[0][0] * m[0][0]) + (adj[0][1] * m[1][0]) + (adj[0][2] * m[2][0]) + (adj[0][3] * m[3][0]); + + // Divide the classical adjoint matrix by the determinant. + // If determinant is zero, matrix is not invertable, so leave it unchanged. + return (det != 0.0f) ? (adj * (1.0f / det)) : m; +} + +struct UBO +{ + float4x4 uMVP; + float3 rotDeg; + float3 rotRad; + int2 bits; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float3 vRotDeg [[user(locn1)]]; + float3 vRotRad [[user(locn2)]]; + int2 vLSB [[user(locn3)]]; + int2 vMSB [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = spvInverse4x4(_18.uMVP) * in.aVertex; + out.vNormal = in.aNormal; + out.vRotDeg = degrees(_18.rotRad); + out.vRotRad = radians(_18.rotDeg); + out.vLSB = spvFindLSB(_18.bits); + out.vMSB = spvFindSMSB(_18.bits); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-1.vert b/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-1.vert new file mode 100644 index 0000000000..5cea4ee2c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-1.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 V [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.V = float4(1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-2.vert b/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-2.vert new file mode 100644 index 0000000000..9e024c2095 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/implicit-position-2.vert @@ -0,0 +1,9 @@ +#include +#include + +using namespace metal; + +vertex void main0() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert b/third_party/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert new file mode 100644 index 0000000000..19bfa7311e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert @@ -0,0 +1,119 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct UBO +{ + float4x4 projection; + float4x4 model; + float lodBias; +}; + +struct main0_out +{ + float3 outPos [[user(locn0)]]; + float3 outNormal [[user(locn1)]]; + float4 outTransModel_0 [[user(locn2)]]; + float4 outTransModel_1 [[user(locn3)]]; + float4 outTransModel_2 [[user(locn4)]]; + float4 outTransModel_3 [[user(locn5)]]; + float outLodBias [[user(locn6)]]; + float4 color [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 inPos [[attribute(0)]]; + float4 colors_0 [[attribute(1)]]; + float4 colors_1 [[attribute(2)]]; + float4 colors_2 [[attribute(3)]]; + float3 inNormal [[attribute(4)]]; + float4 inViewMat_0 [[attribute(5)]]; + float4 inViewMat_1 [[attribute(6)]]; + float4 inViewMat_2 [[attribute(7)]]; + float4 inViewMat_3 [[attribute(8)]]; +}; + +static inline __attribute__((always_inline)) +void write_deeper_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray& colors) +{ + outTransModel[1].y = ubo.lodBias; + color = colors[2]; +} + +static inline __attribute__((always_inline)) +void write_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread spvUnsafeArray& colors, thread float3& inNormal) +{ + outTransModel[2] = float4(inNormal, 1.0); + write_deeper_in_function(outTransModel, ubo, color, colors); +} + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& ubo [[buffer(0)]]) +{ + main0_out out = {}; + float4x4 outTransModel = {}; + spvUnsafeArray colors = {}; + float4x4 inViewMat = {}; + colors[0] = in.colors_0; + colors[1] = in.colors_1; + colors[2] = in.colors_2; + inViewMat[0] = in.inViewMat_0; + inViewMat[1] = in.inViewMat_1; + inViewMat[2] = in.inViewMat_2; + inViewMat[3] = in.inViewMat_3; + out.gl_Position = (ubo.projection * ubo.model) * float4(in.inPos, 1.0); + out.outPos = float3((ubo.model * float4(in.inPos, 1.0)).xyz); + out.outNormal = float3x3(float3(float3(ubo.model[0].x, ubo.model[0].y, ubo.model[0].z)), float3(float3(ubo.model[1].x, ubo.model[1].y, ubo.model[1].z)), float3(float3(ubo.model[2].x, ubo.model[2].y, ubo.model[2].z))) * in.inNormal; + out.outLodBias = ubo.lodBias; + outTransModel = transpose(ubo.model) * inViewMat; + write_in_function(outTransModel, ubo, out.color, colors, in.inNormal); + out.outTransModel_0 = outTransModel[0]; + out.outTransModel_1 = outTransModel[1]; + out.outTransModel_2 = outTransModel[2]; + out.outTransModel_3 = outTransModel[3]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.frag b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.frag new file mode 100644 index 0000000000..cc2727682d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.frag @@ -0,0 +1,97 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Vert +{ + float3x3 wMatrix; + float4 wTmp; + spvUnsafeArray arr; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float3 vMatrix_0 [[user(locn0)]]; + float3 vMatrix_1 [[user(locn1)]]; + float3 vMatrix_2 [[user(locn2)]]; + float3 m_17_wMatrix_0 [[user(locn4)]]; + float3 m_17_wMatrix_1 [[user(locn5)]]; + float3 m_17_wMatrix_2 [[user(locn6)]]; + float4 m_17_wTmp [[user(locn7)]]; + float m_17_arr_0 [[user(locn8)]]; + float m_17_arr_1 [[user(locn9)]]; + float m_17_arr_2 [[user(locn10)]]; + float m_17_arr_3 [[user(locn11)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Vert _17 = {}; + float3x3 vMatrix = {}; + _17.wMatrix[0] = in.m_17_wMatrix_0; + _17.wMatrix[1] = in.m_17_wMatrix_1; + _17.wMatrix[2] = in.m_17_wMatrix_2; + _17.wTmp = in.m_17_wTmp; + _17.arr[0] = in.m_17_arr_0; + _17.arr[1] = in.m_17_arr_1; + _17.arr[2] = in.m_17_arr_2; + _17.arr[3] = in.m_17_arr_3; + vMatrix[0] = in.vMatrix_0; + vMatrix[1] = in.vMatrix_1; + vMatrix[2] = in.vMatrix_2; + out.FragColor = (_17.wMatrix[0].xxyy + _17.wTmp) + vMatrix[1].yyzz; + for (int i = 0; i < 4; i++) + { + out.FragColor += float4(_17.arr[i]); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.vert b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.vert new file mode 100644 index 0000000000..a05c933158 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-block-composites.vert @@ -0,0 +1,105 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct Vert +{ + spvUnsafeArray arr; + float3x3 wMatrix; + float4 wTmp; +}; + +struct main0_out +{ + float3 vMatrix_0 [[user(locn0)]]; + float3 vMatrix_1 [[user(locn1)]]; + float3 vMatrix_2 [[user(locn2)]]; + float m_20_arr_0 [[user(locn4)]]; + float m_20_arr_1 [[user(locn5)]]; + float m_20_arr_2 [[user(locn6)]]; + float3 m_20_wMatrix_0 [[user(locn7)]]; + float3 m_20_wMatrix_1 [[user(locn8)]]; + float3 m_20_wMatrix_2 [[user(locn9)]]; + float4 m_20_wTmp [[user(locn10)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 Matrix_0 [[attribute(0)]]; + float3 Matrix_1 [[attribute(1)]]; + float3 Matrix_2 [[attribute(2)]]; + float4 Pos [[attribute(4)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float3x3 vMatrix = {}; + Vert _20 = {}; + float3x3 Matrix = {}; + Matrix[0] = in.Matrix_0; + Matrix[1] = in.Matrix_1; + Matrix[2] = in.Matrix_2; + vMatrix = Matrix; + _20.wMatrix = Matrix; + _20.arr[0] = 1.0; + _20.arr[1] = 2.0; + _20.arr[2] = 3.0; + _20.wTmp = in.Pos; + out.gl_Position = in.Pos; + out.vMatrix_0 = vMatrix[0]; + out.vMatrix_1 = vMatrix[1]; + out.vMatrix_2 = vMatrix[2]; + out.m_20_arr_0 = _20.arr[0]; + out.m_20_arr_1 = _20.arr[1]; + out.m_20_arr_2 = _20.arr[2]; + out.m_20_wMatrix_0 = _20.wMatrix[0]; + out.m_20_wMatrix_1 = _20.wMatrix[1]; + out.m_20_wMatrix_2 = _20.wMatrix[2]; + out.m_20_wTmp = _20.wTmp; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-single-element-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-single-element-array.vert new file mode 100644 index 0000000000..6858db730e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/interface-block-single-element-array.vert @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct TDPickVertex +{ + float4 c; + spvUnsafeArray uv; +}; + +struct main0_out +{ + float4 oTDVert_c [[user(locn0)]]; + float3 oTDVert_uv_0 [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 P [[attribute(0)]]; + float3 uv_0 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + TDPickVertex oTDVert = {}; + spvUnsafeArray uv = {}; + uv[0] = in.uv_0; + out.gl_Position = float4(in.P, 1.0); + oTDVert.uv[0] = uv[0]; + oTDVert.c = float4(1.0); + out.oTDVert_c = oTDVert.c; + out.oTDVert_uv_0 = oTDVert.uv[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers-block.vert b/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers-block.vert new file mode 100644 index 0000000000..1ae24c7e5b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers-block.vert @@ -0,0 +1,55 @@ +#include +#include + +using namespace metal; + +struct Output +{ + float2 v0; + float2 v1; + float3 v2; + float4 v3; + float v4; + float v5; + float v6; +}; + +struct main0_out +{ + float2 outp_v0 [[user(locn0)]]; + float2 outp_v1 [[user(locn1)]]; + float3 outp_v2 [[user(locn2)]]; + float4 outp_v3 [[user(locn3)]]; + float outp_v4 [[user(locn4)]]; + float outp_v5 [[user(locn5)]]; + float outp_v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + Output outp = {}; + outp.v0 = in.Position.xy; + outp.v1 = in.Position.zw; + outp.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + outp.v3 = in.Position.xxyy; + outp.v4 = in.Position.w; + outp.v5 = in.Position.y; + outp.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + out.outp_v0 = outp.v0; + out.outp_v1 = outp.v1; + out.outp_v2 = outp.v2; + out.outp_v3 = outp.v3; + out.outp_v4 = outp.v4; + out.outp_v5 = outp.v5; + out.outp_v6 = outp.v6; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers.vert b/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 0000000000..ba2c4fbd23 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,36 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float2 v0 [[user(locn0)]]; + float2 v1 [[user(locn1)]]; + float3 v2 [[user(locn2)]]; + float4 v3 [[user(locn3)]]; + float v4 [[user(locn4)]]; + float v5 [[user(locn5)]]; + float v6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.v0 = in.Position.xy; + out.v1 = in.Position.zw; + out.v2 = float3(in.Position.x, in.Position.z * in.Position.y, in.Position.x); + out.v3 = in.Position.xxyy; + out.v4 = in.Position.w; + out.v5 = in.Position.y; + out.v6 = in.Position.x * in.Position.w; + out.gl_Position = in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/invariant.msl21.vert b/third_party/spirv-cross/reference/shaders-msl/vert/invariant.msl21.vert new file mode 100644 index 0000000000..73b0ec7449 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/invariant.msl21.vert @@ -0,0 +1,26 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position, invariant]]; +}; + +struct main0_in +{ + float4 vInput0 [[attribute(0)]]; + float4 vInput1 [[attribute(1)]]; + float4 vInput2 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _20 = in.vInput1 * in.vInput2; + float4 _21 = in.vInput0 + _20; + out.gl_Position = _21; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert b/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert new file mode 100644 index 0000000000..3c1e1a9c2e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert @@ -0,0 +1,37 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +void set_output(device float4& gl_Position, constant UBO& _18, thread float4& aVertex, device float3& vNormal, thread float3& aNormal) +{ + gl_Position = _18.uMVP * aVertex; + vNormal = aNormal; +} + +vertex void main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]]) +{ + device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvIndirectParams[0] + gl_VertexIndex - gl_BaseVertex]; + set_output(out.gl_Position, _18, in.aVertex, out.vNormal, in.aNormal); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.for-tess.vert new file mode 100644 index 0000000000..8777081def --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/leaf-function.for-tess.vert @@ -0,0 +1,39 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 uMVP; +}; + +struct main0_out +{ + float3 vNormal; + float4 gl_Position; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +void set_output(device float4& gl_Position, constant UBO& _18, thread float4& aVertex, device float3& vNormal, thread float3& aNormal) +{ + gl_Position = _18.uMVP * aVertex; + vNormal = aNormal; +} + +kernel void main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], device main0_out* spvOut [[buffer(28)]]) +{ + device main0_out& out = spvOut[gl_GlobalInvocationID.y * spvStageInputSize.x + gl_GlobalInvocationID.x]; + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + set_output(out.gl_Position, _18, in.aVertex, out.vNormal, in.aNormal); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no-contraction.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no-contraction.vert new file mode 100644 index 0000000000..26bef234e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no-contraction.vert @@ -0,0 +1,92 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +[[clang::optnone]] T spvFMul(T l, T r) +{ + return fma(l, r, T(0)); +} + +template +[[clang::optnone]] vec spvFMulVectorMatrix(vec v, matrix m) +{ + vec res = vec(0); + for (uint i = Rows; i > 0; --i) + { + vec tmp(0); + for (uint j = 0; j < Cols; ++j) + { + tmp[j] = m[j][i - 1]; + } + res = fma(tmp, vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] vec spvFMulMatrixVector(matrix m, vec v) +{ + vec res = vec(0); + for (uint i = Cols; i > 0; --i) + { + res = fma(m[i - 1], vec(v[i - 1]), res); + } + return res; +} + +template +[[clang::optnone]] matrix spvFMulMatrixMatrix(matrix l, matrix r) +{ + matrix res; + for (uint i = 0; i < RCols; i++) + { + vec tmp(0); + for (uint j = 0; j < LCols; j++) + { + tmp = fma(vec(r[i][j]), l[j], tmp); + } + res[i] = tmp; + } + return res; +} + +template +[[clang::optnone]] T spvFAdd(T l, T r) +{ + return fma(T(1), l, r); +} + +template +[[clang::optnone]] T spvFSub(T l, T r) +{ + return fma(T(-1), r, l); +} + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vA [[attribute(0)]]; + float4 vB [[attribute(1)]]; + float4 vC [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 mul = spvFMul(in.vA, in.vB); + float4 add = spvFAdd(in.vA, in.vB); + float4 sub = spvFSub(in.vA, in.vB); + float4 mad = spvFAdd(spvFMul(in.vA, in.vB), in.vC); + float4 summed = spvFAdd(spvFAdd(spvFAdd(mul, add), sub), mad); + out.gl_Position = summed; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no-disable-vertex-out.frag-output.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no-disable-vertex-out.frag-output.vert new file mode 100644 index 0000000000..14cc94937c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no-disable-vertex-out.frag-output.vert @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct buf +{ + float4x4 MVP; + float4 position[36]; + float4 attr[36]; +}; + +struct main0_out +{ + float4 texcoord [[user(locn0)]]; + float3 frag_pos [[user(locn1)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant buf& ubuf [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.texcoord = ubuf.attr[int(gl_VertexIndex)]; + out.gl_Position = ubuf.MVP * ubuf.position[int(gl_VertexIndex)]; + out.frag_pos = out.gl_Position.xyz; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.for-tess.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.for-tess.vert new file mode 100644 index 0000000000..984e83260a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.for-tess.vert @@ -0,0 +1,23 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_10_12 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_in +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_19 [[attribute(0)]]; +}; + +kernel void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_10_12& _RESERVED_IDENTIFIER_FIXUP_12 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint3 spvStageInputSize [[grid_size]], uint3 spvDispatchBase [[grid_origin]]) +{ + if (any(gl_GlobalInvocationID >= spvStageInputSize)) + return; + uint gl_VertexIndex = gl_GlobalInvocationID.x + spvDispatchBase.x; + _RESERVED_IDENTIFIER_FIXUP_12._RESERVED_IDENTIFIER_FIXUP_m0[int(gl_VertexIndex)] = in._RESERVED_IDENTIFIER_FIXUP_19; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..e804da6753 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,20 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_10_12 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_in +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_19 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_10_12& _RESERVED_IDENTIFIER_FIXUP_12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + _RESERVED_IDENTIFIER_FIXUP_12._RESERVED_IDENTIFIER_FIXUP_m0[int(gl_VertexIndex)] = in._RESERVED_IDENTIFIER_FIXUP_19; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..fb8060f072 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_33_35 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct _RESERVED_IDENTIFIER_FIXUP_38_40 +{ + uint4 _RESERVED_IDENTIFIER_FIXUP_m0[1024]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], device _RESERVED_IDENTIFIER_FIXUP_33_35& _RESERVED_IDENTIFIER_FIXUP_35 [[buffer(0)]], constant _RESERVED_IDENTIFIER_FIXUP_38_40& _RESERVED_IDENTIFIER_FIXUP_40 [[buffer(1)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + for (int _RESERVED_IDENTIFIER_FIXUP_19 = 0; _RESERVED_IDENTIFIER_FIXUP_19 < 1024; _RESERVED_IDENTIFIER_FIXUP_19++) + { + _RESERVED_IDENTIFIER_FIXUP_35._RESERVED_IDENTIFIER_FIXUP_m0[_RESERVED_IDENTIFIER_FIXUP_19] = _RESERVED_IDENTIFIER_FIXUP_40._RESERVED_IDENTIFIER_FIXUP_m0[_RESERVED_IDENTIFIER_FIXUP_19]; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..68c649ed6c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,31 @@ +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_19_21 +{ + uint _RESERVED_IDENTIFIER_FIXUP_m0; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], volatile device _RESERVED_IDENTIFIER_FIXUP_19_21& _RESERVED_IDENTIFIER_FIXUP_21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + uint _29 = atomic_fetch_add_explicit((volatile device atomic_uint*)&_RESERVED_IDENTIFIER_FIXUP_21._RESERVED_IDENTIFIER_FIXUP_m0, 1u, memory_order_relaxed); + uint _RESERVED_IDENTIFIER_FIXUP_26 = _29; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..dfe1c328d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,25 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_14 [[attribute(0)]]; +}; + +vertex void main0(main0_in in [[stage_in]], texture1d _RESERVED_IDENTIFIER_FIXUP_32 [[texture(0)]], texture1d _RESERVED_IDENTIFIER_FIXUP_35 [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = in._RESERVED_IDENTIFIER_FIXUP_14; + for (int _RESERVED_IDENTIFIER_FIXUP_19 = 0; _RESERVED_IDENTIFIER_FIXUP_19 < 128; _RESERVED_IDENTIFIER_FIXUP_19++) + { + _RESERVED_IDENTIFIER_FIXUP_32.write(_RESERVED_IDENTIFIER_FIXUP_35.read(uint(_RESERVED_IDENTIFIER_FIXUP_19)), uint(_RESERVED_IDENTIFIER_FIXUP_19)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-nested-struct-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-nested-struct-array.vert new file mode 100644 index 0000000000..cabcfcb521 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-nested-struct-array.vert @@ -0,0 +1,88 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct t21 +{ + float4 m0; + float4 m1; +}; + +struct t24 +{ + spvUnsafeArray m0; +}; + +struct main0_out +{ + float4 v26_m0_0_m0 [[user(locn0)]]; + float4 v26_m0_0_m1 [[user(locn1)]]; + float4 v26_m0_1_m0 [[user(locn2)]]; + float4 v26_m0_1_m1 [[user(locn3)]]; + float4 v26_m0_2_m0 [[user(locn4)]]; + float4 v26_m0_2_m1 [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v17 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + t24 v26 = {}; + out.gl_Position = in.v17; + v26.m0[1].m1 = float4(-4.0, -9.0, 3.0, 7.0); + out.v26_m0_0_m0 = v26.m0[0].m0; + out.v26_m0_0_m1 = v26.m0[0].m1; + out.v26_m0_1_m0 = v26.m0[1].m0; + out.v26_m0_1_m1 = v26.m0[1].m1; + out.v26_m0_2_m0 = v26.m0[2].m0; + out.v26_m0_2_m1 = v26.m0[2].m1; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-struct-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-struct-array.vert new file mode 100644 index 0000000000..61c7c18b54 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/out-block-with-struct-array.vert @@ -0,0 +1,83 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct t21 +{ + float m0; + float4 m1; +}; + +struct main0_out +{ + float v25_0_m0 [[user(locn0)]]; + float4 v25_0_m1 [[user(locn1)]]; + float v25_1_m0 [[user(locn2)]]; + float4 v25_1_m1 [[user(locn3)]]; + float v25_2_m0 [[user(locn4)]]; + float4 v25_2_m1 [[user(locn5)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 v17 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray v25 = {}; + out.gl_Position = in.v17; + v25[2].m1 = float4(-4.0, -9.0, 3.0, 7.0); + out.v25_0_m0 = v25[0].m0; + out.v25_0_m1 = v25[0].m1; + out.v25_1_m0 = v25[1].m0; + out.v25_1_m1 = v25[1].m1; + out.v25_2_m0 = v25[2].m0; + out.v25_2_m1 = v25[2].m1; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/out_block.vert b/third_party/spirv-cross/reference/shaders-msl/vert/out_block.vert new file mode 100644 index 0000000000..909a059bd2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/out_block.vert @@ -0,0 +1,41 @@ +#include +#include + +using namespace metal; + +struct Transform +{ + float4x4 transform; +}; + +struct VertexOut +{ + float4 color; + float4 color2; +}; + +struct main0_out +{ + float4 outputs_color [[user(locn2)]]; + float4 outputs_color2 [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float3 position [[attribute(0)]]; + float4 color [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant Transform& block [[buffer(0)]]) +{ + main0_out out = {}; + VertexOut outputs = {}; + out.gl_Position = block.transform * float4(in.position, 1.0); + outputs.color = in.color; + outputs.color2 = in.color + float4(1.0); + out.outputs_color = outputs.color; + out.outputs_color2 = outputs.color2; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool-to-uint.vert b/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool-to-uint.vert new file mode 100644 index 0000000000..6cc5520484 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool-to-uint.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _24 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _24.umatrix * float4(_24.uquad[int(gl_VertexIndex)].x, _24.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_24.flags.flags[0] != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool2-to-packed_uint2.vert b/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool2-to-packed_uint2.vert new file mode 100644 index 0000000000..4c46aaeb4e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/packed-bool2-to-packed_uint2.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct Struct +{ + uint2 flags[1]; +}; + +struct defaultUniformsVS +{ + Struct flags; + float4 uquad[4]; + float4x4 umatrix; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant defaultUniformsVS& _25 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) +{ + main0_out out = {}; + out.gl_Position = _25.umatrix * float4(_25.uquad[int(gl_VertexIndex)].x, _25.uquad[int(gl_VertexIndex)].y, in.a_position.z, in.a_position.w); + if (_25.flags.flags[0].x != 0u) + { + out.gl_Position.z = 0.0; + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/packed_matrix.vert b/third_party/spirv-cross/reference/shaders-msl/vert/packed_matrix.vert new file mode 100644 index 0000000000..e18d5f225a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/packed_matrix.vert @@ -0,0 +1,55 @@ +#include +#include + +using namespace metal; + +struct _RESERVED_IDENTIFIER_FIXUP_1365_18812 +{ + float3x4 _RESERVED_IDENTIFIER_FIXUP_m0; + float3x4 _RESERVED_IDENTIFIER_FIXUP_m1; +}; + +struct _RESERVED_IDENTIFIER_FIXUP_1126_22044 +{ + float4x4 _RESERVED_IDENTIFIER_FIXUP_m0; + float4x4 _RESERVED_IDENTIFIER_FIXUP_m1; + float _RESERVED_IDENTIFIER_FIXUP_m9; + char _m3_pad[12]; + packed_float3 _RESERVED_IDENTIFIER_FIXUP_m10; + float _RESERVED_IDENTIFIER_FIXUP_m11; + packed_float3 _RESERVED_IDENTIFIER_FIXUP_m12; + float _RESERVED_IDENTIFIER_FIXUP_m17; + float _RESERVED_IDENTIFIER_FIXUP_m18; + float _RESERVED_IDENTIFIER_FIXUP_m19; + float2 _RESERVED_IDENTIFIER_FIXUP_m20; +}; + +struct main0_out +{ + float3 _RESERVED_IDENTIFIER_FIXUP_3976 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 _RESERVED_IDENTIFIER_FIXUP_5275 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant _RESERVED_IDENTIFIER_FIXUP_1365_18812& _RESERVED_IDENTIFIER_FIXUP_18812 [[buffer(0)]], constant _RESERVED_IDENTIFIER_FIXUP_1126_22044& _RESERVED_IDENTIFIER_FIXUP_22044 [[buffer(1)]]) +{ + main0_out out = {}; + float3 _RESERVED_IDENTIFIER_FIXUP_2; + float3 _RESERVED_IDENTIFIER_FIXUP_23783; + for (;;) + { + _RESERVED_IDENTIFIER_FIXUP_23783 = fast::normalize(float4(in._RESERVED_IDENTIFIER_FIXUP_5275.xyz, 0.0) * _RESERVED_IDENTIFIER_FIXUP_18812._RESERVED_IDENTIFIER_FIXUP_m1); + break; + } + float4 _RESERVED_IDENTIFIER_FIXUP_14995 = _RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m0 * float4(float3(_RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m10) + (in._RESERVED_IDENTIFIER_FIXUP_5275.xyz * (_RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m17 + _RESERVED_IDENTIFIER_FIXUP_22044._RESERVED_IDENTIFIER_FIXUP_m18)), 1.0); + out._RESERVED_IDENTIFIER_FIXUP_3976 = _RESERVED_IDENTIFIER_FIXUP_23783; + float4 _RESERVED_IDENTIFIER_FIXUP_6282 = _RESERVED_IDENTIFIER_FIXUP_14995; + _RESERVED_IDENTIFIER_FIXUP_6282.y = -_RESERVED_IDENTIFIER_FIXUP_14995.y; + out.gl_Position = _RESERVED_IDENTIFIER_FIXUP_6282; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/pointsize.vert b/third_party/spirv-cross/reference/shaders-msl/vert/pointsize.vert new file mode 100644 index 0000000000..8e5782bde4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/pointsize.vert @@ -0,0 +1,33 @@ +#include +#include + +using namespace metal; + +struct params +{ + float4x4 mvp; + float psize; +}; + +struct main0_out +{ + float4 color [[user(locn0)]]; + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +struct main0_in +{ + float4 position [[attribute(0)]]; + float4 color0 [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant params& _19 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _19.mvp * in.position; + out.gl_PointSize = _19.psize; + out.color = in.color0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..d6ade7c38b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert @@ -0,0 +1,63 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct Block +{ + float3x4 var[3][4]; +}; + +struct main0_out +{ + float v_vtxResult [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 a_position [[attribute(0)]]; +}; + +static inline __attribute__((always_inline)) +float compare_float(thread const float& a, thread const float& b) +{ + return float(abs(a - b) < 0.0500000007450580596923828125); +} + +static inline __attribute__((always_inline)) +float compare_vec3(thread const float3& a, thread const float3& b) +{ + float param = a.x; + float param_1 = b.x; + float param_2 = a.y; + float param_3 = b.y; + float param_4 = a.z; + float param_5 = b.z; + return (compare_float(param, param_1) * compare_float(param_2, param_3)) * compare_float(param_4, param_5); +} + +static inline __attribute__((always_inline)) +float compare_mat2x3(thread const float2x3& a, thread const float2x3& b) +{ + float3 param = a[0]; + float3 param_1 = b[0]; + float3 param_2 = a[1]; + float3 param_3 = b[1]; + return compare_vec3(param, param_1) * compare_vec3(param_2, param_3); +} + +vertex main0_out main0(main0_in in [[stage_in]], constant Block& _104 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.a_position; + float result = 1.0; + float2x3 param = transpose(float3x2(_104.var[0][0][0].xy, _104.var[0][0][1].xy, _104.var[0][0][2].xy)); + float2x3 param_1 = float2x3(float3(2.0, 6.0, -6.0), float3(0.0, 5.0, 5.0)); + result *= compare_mat2x3(param, param_1); + out.v_vtxResult = result; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert b/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert new file mode 100644 index 0000000000..fad06d6afe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert @@ -0,0 +1,50 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct storage_block +{ + uint4 baz; + int2 quux; +}; + +struct constant_block +{ + float4 foo; + int bar; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 3 +#endif +constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; + +static inline __attribute__((always_inline)) +void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array, 3>& images) +{ + storage[0]->baz = uint4(constants[3]->foo); + storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; +} + +vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array, 3> images [[texture(0)]]) +{ + device storage_block* storage[] = + { + storage_0, + storage_1, + }; + + constant constant_block* constants[] = + { + constants_0, + constants_1, + constants_2, + constants_3, + }; + + doWork(storage, constants, images); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays.ios.vert b/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays.ios.vert new file mode 100644 index 0000000000..91be3a0477 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/resource-arrays.ios.vert @@ -0,0 +1,42 @@ +#include +#include + +using namespace metal; + +struct storage_block +{ + uint4 baz; + int2 quux; +}; + +struct constant_block +{ + float4 foo; + int bar; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 3 +#endif +constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; + +vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array, 3> images [[texture(0)]]) +{ + device storage_block* storage[] = + { + storage_0, + storage_1, + }; + + constant constant_block* constants[] = + { + constants_0, + constants_1, + constants_2, + constants_3, + }; + + storage[0]->baz = uint4(constants[3]->foo); + storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/return-array.force-native-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/return-array.force-native-array.vert new file mode 100644 index 0000000000..4793b4aca9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/return-array.force-native-array.vert @@ -0,0 +1,154 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToDevice1(device T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToDevice1(device T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToDevice1(device T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToDevice1(device T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToStack1(thread T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromDeviceToThreadGroup1(threadgroup T (&dst)[A], device const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +constant float4 _20[2] = { float4(10.0), float4(20.0) }; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInput0 [[attribute(0)]]; + float4 vInput1 [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +void test(thread float4 (&spvReturnValue)[2]) +{ + spvArrayCopyFromConstantToStack1(spvReturnValue, _20); +} + +static inline __attribute__((always_inline)) +void test2(thread float4 (&spvReturnValue)[2], thread float4& vInput0, thread float4& vInput1) +{ + float4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + spvArrayCopyFromStackToStack1(spvReturnValue, foobar); +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + float4 _42[2]; + test(_42); + float4 _44[2]; + test2(_44, in.vInput0, in.vInput1); + out.gl_Position = _42[0] + _44[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/return-array.vert b/third_party/spirv-cross/reference/shaders-msl/vert/return-array.vert new file mode 100644 index 0000000000..dacb0ba305 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/return-array.vert @@ -0,0 +1,81 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +constant spvUnsafeArray _20 = spvUnsafeArray({ float4(10.0), float4(20.0) }); + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vInput0 [[attribute(0)]]; + float4 vInput1 [[attribute(1)]]; +}; + +static inline __attribute__((always_inline)) +spvUnsafeArray test() +{ + return _20; +} + +static inline __attribute__((always_inline)) +spvUnsafeArray test2(thread float4& vInput0, thread float4& vInput1) +{ + spvUnsafeArray foobar; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + out.gl_Position = test()[0] + test2(in.vInput0, in.vInput1)[1]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert b/third_party/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert new file mode 100644 index 0000000000..91057da2ba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert @@ -0,0 +1,27 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +static inline __attribute__((always_inline)) +void write_outblock(thread float4& gl_Position, thread float& gl_PointSize) +{ + gl_PointSize = 1.0; + gl_Position = float4(gl_PointSize); +} + +vertex main0_out main0() +{ + main0_out out = {}; + write_outblock(out.gl_Position, out.gl_PointSize); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert b/third_party/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert new file mode 100644 index 0000000000..f5f647d458 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert @@ -0,0 +1,60 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Implementation of the GLSL sign() function for integer types +template::value>::type> +inline T sign(T x) +{ + return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); +} + +struct UBO +{ + float4x4 uMVP; + float4 uFloatVec4; + float3 uFloatVec3; + float2 uFloatVec2; + float uFloat; + int4 uIntVec4; + int3 uIntVec3; + int2 uIntVec2; + int uInt; +}; + +struct main0_out +{ + float4 vFloatVec4 [[user(locn0)]]; + float3 vFloatVec3 [[user(locn1)]]; + float2 vFloatVec2 [[user(locn2)]]; + float vFloat [[user(locn3)]]; + int4 vIntVec4 [[user(locn4)]]; + int3 vIntVec3 [[user(locn5)]]; + int2 vIntVec2 [[user(locn6)]]; + int vInt [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _21 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _21.uMVP * in.aVertex; + out.vFloatVec4 = sign(_21.uFloatVec4); + out.vFloatVec3 = sign(_21.uFloatVec3); + out.vFloatVec2 = sign(_21.uFloatVec2); + out.vFloat = sign(_21.uFloat); + out.vIntVec4 = sign(_21.uIntVec4); + out.vIntVec3 = sign(_21.uIntVec3); + out.vIntVec2 = sign(_21.uIntVec2); + out.vInt = sign(_21.uInt); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/signedness-mismatch.shader-inputs.vert b/third_party/spirv-cross/reference/shaders-msl/vert/signedness-mismatch.shader-inputs.vert new file mode 100644 index 0000000000..56e00199cb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/signedness-mismatch.shader-inputs.vert @@ -0,0 +1,74 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + ushort2 a [[attribute(0)]]; + uint3 b [[attribute(1)]]; + ushort c_0 [[attribute(2)]]; + ushort c_1 [[attribute(3)]]; + uint4 d_0 [[attribute(4)]]; + uint4 d_1 [[attribute(5)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]]) +{ + main0_out out = {}; + spvUnsafeArray c = {}; + spvUnsafeArray d = {}; + c[0] = in.c_0; + c[1] = in.c_1; + d[0] = in.d_0; + d[1] = in.d_1; + out.gl_Position = float4(float(int(short(in.a.x))), float(int(in.b.x)), float(uint(c[1])), float(d[0].w)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert b/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert new file mode 100644 index 0000000000..33c077c57a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(texture_buffer uSamp [[texture(0)]], texture_buffer uSampo [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = uSamp.read(uint(10)) + uSampo.read(uint(100)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert b/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert new file mode 100644 index 0000000000..9d8b5c49f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert @@ -0,0 +1,26 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(texture2d uSamp [[texture(0)]], texture2d uSampo [[texture(1)]]) +{ + main0_out out = {}; + out.gl_Position = uSamp.read(spvTexelBufferCoord(10)) + uSampo.read(spvTexelBufferCoord(100)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/ubo.alignment.vert b/third_party/spirv-cross/reference/shaders-msl/vert/ubo.alignment.vert new file mode 100644 index 0000000000..c48111ed67 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/ubo.alignment.vert @@ -0,0 +1,38 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 mvp; + float2 targSize; + char _m2_pad[8]; + packed_float3 color; + float opacity; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float3 vColor [[user(locn1)]]; + float2 vSize [[user(locn2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _18.mvp * in.aVertex; + out.vNormal = in.aNormal; + out.vColor = float3(_18.color) * _18.opacity; + out.vSize = _18.targSize * _18.opacity; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/ubo.vert b/third_party/spirv-cross/reference/shaders-msl/vert/ubo.vert new file mode 100644 index 0000000000..86ba1e9687 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/ubo.vert @@ -0,0 +1,30 @@ +#include +#include + +using namespace metal; + +struct UBO +{ + float4x4 mvp; +}; + +struct main0_out +{ + float3 vNormal [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 aVertex [[attribute(0)]]; + float3 aNormal [[attribute(1)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = _16.mvp * in.aVertex; + out.vNormal = in.aNormal; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-out-of-order-offests.vert b/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-out-of-order-offests.vert new file mode 100644 index 0000000000..4f71b20557 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-out-of-order-offests.vert @@ -0,0 +1,35 @@ +#include +#include + +using namespace metal; + +struct data_u_t +{ + int4 m1[3]; + uint m3; + uint3 m2; + int4 m0[8]; +}; + +struct main0_out +{ + float foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vtx_posn [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant data_u_t& data_u [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.vtx_posn; + int4 a = data_u.m1[1]; + uint3 b = data_u.m2; + int c = data_u.m0[4].x; + out.foo = float((uint3(a.xyz) + b).y * uint(c)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-packing-nested.vert b/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-packing-nested.vert new file mode 100644 index 0000000000..bfcae2a56c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/uniform-struct-packing-nested.vert @@ -0,0 +1,57 @@ +#include +#include + +using namespace metal; + +typedef packed_float4 packed_rm_float4x4[4]; + +struct s0 +{ + float3x4 m0; + packed_int4 m1; + packed_rm_float4x4 m2; + packed_uint2 m3; +}; + +struct s1 +{ + float4x4 m0; + int m1; + char _m2_pad[12]; + packed_uint3 m2; + s0 m3; +}; + +struct data_u_t +{ + float4 m1[5]; + float2x4 m3; + int4 m4; + s1 m2; + float3x4 m0; +}; + +struct main0_out +{ + float foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vtx_posn [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant data_u_t& data_u [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.vtx_posn; + float2 a = data_u.m1[3].xy; + int4 b = data_u.m4; + float2x3 c = transpose(float3x2(data_u.m0[0].xy, data_u.m0[1].xy, data_u.m0[2].xy)); + float3x4 d = transpose(float4x3(data_u.m2.m0[0].xyz, data_u.m2.m0[1].xyz, data_u.m2.m0[2].xyz, data_u.m2.m0[3].xyz)); + float4x4 e = transpose(float4x4(float4(data_u.m2.m3.m2[0]), float4(data_u.m2.m3.m2[1]), float4(data_u.m2.m3.m2[2]), float4(data_u.m2.m3.m2[3]))); + out.foo = (((a.y + float(b.z)) * c[1].z) * d[2].w) * e[3].w; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vert/unused-position.vert b/third_party/spirv-cross/reference/shaders-msl/vert/unused-position.vert new file mode 100644 index 0000000000..7dc4672139 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vert/unused-position.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; + float gl_PointSize [[point_size]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + out.gl_PointSize = 1.0; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag new file mode 100644 index 0000000000..f0935f6dcf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex_0 [[user(locn1)]]; + float2 vTex_1 [[user(locn2)]]; + float2 vTex_2 [[user(locn3)]]; + float2 vTex_3 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]]) +{ + main0_out out = {}; + spvUnsafeArray vTex = {}; + vTex[0] = in.vTex_0; + vTex[1] = in.vTex_1; + vTex[2] = in.vTex_2; + vTex[3] = in.vTex_3; + const uint gl_ViewIndex = spvViewMask[0]; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, vTex[int(gl_ViewIndex)]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag new file mode 100644 index 0000000000..67895e3e92 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag @@ -0,0 +1,73 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; + float2 vTex_0 [[user(locn1)]]; + float2 vTex_1 [[user(locn2)]]; + float2 vTex_2 [[user(locn3)]]; + float2 vTex_3 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_ViewIndex [[render_target_array_index]]) +{ + main0_out out = {}; + spvUnsafeArray vTex = {}; + vTex[0] = in.vTex_0; + vTex[1] = in.vTex_1; + vTex[2] = in.vTex_2; + vTex[3] = in.vTex_3; + gl_ViewIndex += spvViewMask[0]; + out.FragColor = in.vColor * uTex.sample(uTexSmplr, vTex[int(gl_ViewIndex)]); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..274cea2de1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag @@ -0,0 +1,24 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + bool _15 = gl_HelperInvocation; + gl_HelperInvocation = true, discard_fragment(); + if (!_15) + { + out.FragColor = float4(1.0, 0.0, 0.0, 1.0); + } + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..7af77d91f9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag @@ -0,0 +1,28 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +static inline __attribute__((always_inline)) +void foo(thread bool& gl_HelperInvocation) +{ + gl_HelperInvocation = true, discard_fragment(); +} + +static inline __attribute__((always_inline)) +void bar(thread bool& gl_HelperInvocation) +{ + bool _13 = gl_HelperInvocation; + bool helper = _13; +} + +fragment void main0() +{ + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + foo(gl_HelperInvocation); + bar(gl_HelperInvocation); +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag new file mode 100644 index 0000000000..ad3734bdbe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag @@ -0,0 +1,14 @@ +#include +#include + +using namespace metal; + +fragment void main0() +{ + bool gl_HelperInvocation = {}; + gl_HelperInvocation = simd_is_helper_thread(); + gl_HelperInvocation = true, discard_fragment(); + bool _9 = gl_HelperInvocation; + bool helper = _9; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..7b8c502b32 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct PushConstants +{ + float4 value0; + float4 value1; +}; + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +struct main0_in +{ + float4 vColor [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant PushConstants& push [[buffer(0)]]) +{ + main0_out out = {}; + out.FragColor = (in.vColor + push.value0) + push.value1; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag new file mode 100644 index 0000000000..74fe26eca2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag @@ -0,0 +1,126 @@ +#include +#include + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1.0 +#endif +constant float a = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2.0 +#endif +constant float b = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +constant int c = SPIRV_CROSS_CONSTANT_ID_3; +constant uint _18 = (uint(c) + 0u); +constant int _21 = (-c); +constant int _23 = (~c); +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 4 +#endif +constant int d = SPIRV_CROSS_CONSTANT_ID_4; +constant int _26 = (c + d); +constant int _28 = (c - d); +constant int _30 = (c * d); +constant int _32 = (c / d); +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 5u +#endif +constant uint e = SPIRV_CROSS_CONSTANT_ID_5; +#ifndef SPIRV_CROSS_CONSTANT_ID_6 +#define SPIRV_CROSS_CONSTANT_ID_6 6u +#endif +constant uint f = SPIRV_CROSS_CONSTANT_ID_6; +constant uint _36 = (e / f); +constant int _38 = (c % d); +constant uint _40 = (e % f); +constant int _42 = (c >> d); +constant uint _44 = (e >> f); +constant int _46 = (c << d); +constant int _48 = (c | d); +constant int _50 = (c ^ d); +constant int _52 = (c & d); +#ifndef SPIRV_CROSS_CONSTANT_ID_7 +#define SPIRV_CROSS_CONSTANT_ID_7 false +#endif +constant bool g = SPIRV_CROSS_CONSTANT_ID_7; +#ifndef SPIRV_CROSS_CONSTANT_ID_8 +#define SPIRV_CROSS_CONSTANT_ID_8 true +#endif +constant bool h = SPIRV_CROSS_CONSTANT_ID_8; +constant bool _58 = (g || h); +constant bool _60 = (g && h); +constant bool _62 = (!g); +constant bool _64 = (g == h); +constant bool _66 = (g != h); +constant bool _68 = (c == d); +constant bool _70 = (c != d); +constant bool _72 = (c < d); +constant bool _74 = (e < f); +constant bool _76 = (c > d); +constant bool _78 = (e > f); +constant bool _80 = (c <= d); +constant bool _82 = (e <= f); +constant bool _84 = (c >= d); +constant bool _86 = (e >= f); +constant int _92 = int(e + 0u); +constant bool _94 = (c != int(0u)); +constant bool _96 = (e != 0u); +constant int _100 = int(g); +constant uint _103 = uint(g); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float t0 = a; + float t1 = b; + uint c0 = _18; + int c1 = _21; + int c2 = _23; + int c3 = _26; + int c4 = _28; + int c5 = _30; + int c6 = _32; + uint c7 = _36; + int c8 = _38; + uint c9 = _40; + int c10 = _42; + uint c11 = _44; + int c12 = _46; + int c13 = _48; + int c14 = _50; + int c15 = _52; + bool c16 = _58; + bool c17 = _60; + bool c18 = _62; + bool c19 = _64; + bool c20 = _66; + bool c21 = _68; + bool c22 = _70; + bool c23 = _72; + bool c24 = _74; + bool c25 = _76; + bool c26 = _78; + bool c27 = _80; + bool c28 = _82; + bool c29 = _84; + bool c30 = _86; + int c31 = c8 + c3; + int c32 = _92; + bool c33 = _94; + bool c34 = _96; + int c35 = _100; + uint c36 = _103; + float c37 = float(g); + out.FragColor = float4(t0 + t1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.vk.frag b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..aa10a501a6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/frag/spec-constant.vk.frag @@ -0,0 +1,110 @@ +#include +#include + +using namespace metal; + +constant float a_tmp [[function_constant(1)]]; +constant float a = is_function_constant_defined(a_tmp) ? a_tmp : 1.0; +constant float b_tmp [[function_constant(2)]]; +constant float b = is_function_constant_defined(b_tmp) ? b_tmp : 2.0; +constant int c_tmp [[function_constant(3)]]; +constant int c = is_function_constant_defined(c_tmp) ? c_tmp : 3; +constant uint _18 = (uint(c) + 0u); +constant int _21 = (-c); +constant int _23 = (~c); +constant int d_tmp [[function_constant(4)]]; +constant int d = is_function_constant_defined(d_tmp) ? d_tmp : 4; +constant int _26 = (c + d); +constant int _28 = (c - d); +constant int _30 = (c * d); +constant int _32 = (c / d); +constant uint e_tmp [[function_constant(5)]]; +constant uint e = is_function_constant_defined(e_tmp) ? e_tmp : 5u; +constant uint f_tmp [[function_constant(6)]]; +constant uint f = is_function_constant_defined(f_tmp) ? f_tmp : 6u; +constant uint _36 = (e / f); +constant int _38 = (c % d); +constant uint _40 = (e % f); +constant int _42 = (c >> d); +constant uint _44 = (e >> f); +constant int _46 = (c << d); +constant int _48 = (c | d); +constant int _50 = (c ^ d); +constant int _52 = (c & d); +constant bool g_tmp [[function_constant(7)]]; +constant bool g = is_function_constant_defined(g_tmp) ? g_tmp : false; +constant bool h_tmp [[function_constant(8)]]; +constant bool h = is_function_constant_defined(h_tmp) ? h_tmp : true; +constant bool _58 = (g || h); +constant bool _60 = (g && h); +constant bool _62 = (!g); +constant bool _64 = (g == h); +constant bool _66 = (g != h); +constant bool _68 = (c == d); +constant bool _70 = (c != d); +constant bool _72 = (c < d); +constant bool _74 = (e < f); +constant bool _76 = (c > d); +constant bool _78 = (e > f); +constant bool _80 = (c <= d); +constant bool _82 = (e <= f); +constant bool _84 = (c >= d); +constant bool _86 = (e >= f); +constant int _92 = int(e + 0u); +constant bool _94 = (c != int(0u)); +constant bool _96 = (e != 0u); +constant int _100 = int(g); +constant uint _103 = uint(g); + +struct main0_out +{ + float4 FragColor [[color(0)]]; +}; + +fragment main0_out main0() +{ + main0_out out = {}; + float t0 = a; + float t1 = b; + uint c0 = _18; + int c1 = _21; + int c2 = _23; + int c3 = _26; + int c4 = _28; + int c5 = _30; + int c6 = _32; + uint c7 = _36; + int c8 = _38; + uint c9 = _40; + int c10 = _42; + uint c11 = _44; + int c12 = _46; + int c13 = _48; + int c14 = _50; + int c15 = _52; + bool c16 = _58; + bool c17 = _60; + bool c18 = _62; + bool c19 = _64; + bool c20 = _66; + bool c21 = _68; + bool c22 = _70; + bool c23 = _72; + bool c24 = _74; + bool c25 = _76; + bool c26 = _78; + bool c27 = _80; + bool c28 = _82; + bool c29 = _84; + bool c30 = _86; + int c31 = c8 + c3; + int c32 = _92; + bool c33 = _94; + bool c34 = _96; + int c35 = _100; + uint c36 = _103; + float c37 = float(g); + out.FragColor = float4(t0 + t1); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert new file mode 100644 index 0000000000..e36576b86f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert @@ -0,0 +1,19 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + const int gl_DeviceIndex = 0; + const uint gl_ViewIndex = 0; + out.gl_Position = float4(float(gl_DeviceIndex), float(int(gl_ViewIndex)), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert new file mode 100644 index 0000000000..cc4bcc4202 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert @@ -0,0 +1,18 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0() +{ + main0_out out = {}; + const int gl_DeviceIndex = 0; + out.gl_Position = float4(float(gl_DeviceIndex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert new file mode 100644 index 0000000000..8959afe821 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert @@ -0,0 +1,28 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], constant MVPs& _19 [[buffer(0)]]) +{ + main0_out out = {}; + const uint gl_ViewIndex = spvViewMask[0]; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert new file mode 100644 index 0000000000..20eff0a124 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert @@ -0,0 +1,31 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], constant MVPs& _19 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + uint gl_ViewIndex = spvViewMask[0] + (gl_InstanceIndex - gl_BaseInstance) % spvViewMask[1]; + gl_InstanceIndex = (gl_InstanceIndex - gl_BaseInstance) / spvViewMask[1] + gl_BaseInstance; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + out.gl_Layer = gl_ViewIndex - spvViewMask[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert new file mode 100644 index 0000000000..5152b6222e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct MVPs +{ + float4x4 MVP[2]; +}; + +struct main0_out +{ + float4 gl_Position [[position]]; + uint gl_Layer [[render_target_array_index]]; +}; + +struct main0_in +{ + float4 Position [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant MVPs& _19 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]]) +{ + main0_out out = {}; + const uint gl_ViewIndex = 0; + out.gl_Position = _19.MVP[int(gl_ViewIndex)] * in.Position; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..c9ef91b247 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,48 @@ +#include +#include + +using namespace metal; + +struct block +{ + short2 a; + ushort2 b; + char2 c; + uchar2 d; + half2 e; +}; + +struct storage +{ + short3 f; + ushort3 g; + char3 h; + uchar3 i; + half3 j; +}; + +struct main0_out +{ + short4 p [[user(locn0)]]; + ushort4 q [[user(locn1)]]; + half4 r [[user(locn2)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + short foo [[attribute(0)]]; + ushort bar [[attribute(1)]]; + half baz [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant block& _26 [[buffer(0)]], const device storage& _53 [[buffer(1)]]) +{ + main0_out out = {}; + out.p = short4((int4(int(in.foo)) + int4(int2(_26.a), int2(_26.c))) - int4(int3(_53.f) / int3(_53.h), 1)); + out.q = ushort4((uint4(uint(in.bar)) + uint4(uint2(_26.b), uint2(_26.d))) - uint4(uint3(_53.g) / uint3(_53.i), 1u)); + out.r = half4((float4(float(in.baz)) + float4(float2(_26.e), 0.0, 1.0)) - float4(float3(_53.j), 1.0)); + out.gl_Position = float4(0.0, 0.0, 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..86a0cea5bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,17 @@ +#include +#include + +using namespace metal; + +struct main0_out +{ + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(int(gl_VertexIndex) + int(gl_InstanceIndex)); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp new file mode 100644 index 0000000000..c27bef6a6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp @@ -0,0 +1,30 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int values[]; +} _4; + +void main() +{ + int _17 = 0; + for (;;) + { + if (_17 < 100) + { + int _24 = _4.values[_17]; + _4.values[_24] = _17; + int _26 = _24 + 1; + int _18 = _4.values[_26]; + _4.values[_17] = _18; + _17 = _18; + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp new file mode 100644 index 0000000000..0517ec4d8b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int values[]; +} _4; + +void main() +{ + int _17 = 0; + for (;;) + { + if (_17 < 100) + { + int _24 = _4.values[_17]; + _4.values[_24] = _17; + _17 = _4.values[_24 + 1]; + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp new file mode 100644 index 0000000000..e4dfdb87a8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp @@ -0,0 +1,24 @@ +#version 460 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer Output +{ + int myout; +} _5; + +int foo() +{ + return 12; +} + +void main() +{ + int _17 = foo(); + while (true) + { + _5.myout = _17; + return; + } + _5.myout = _17; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..d36f543108 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,25 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct T +{ + float c; +}; + +layout(binding = 0, std430) buffer SSBO1 +{ + T foo[]; +} _7; + +layout(binding = 1, std140) buffer SSBO2 +{ + T bar[]; +} _10; + +void main() +{ + T v = T(40.0); + _7.foo[10].c = v.c; + _10.bar[30].c = v.c; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp.vk new file mode 100644 index 0000000000..5f480728e4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp.vk @@ -0,0 +1,46 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + int s32; + uint u32; + int16_t s16; + uint16_t u16; + float f32; +} _4; + +void main() +{ + int _29 = _4.s32; + uint _30 = _4.u32; + int16_t _31 = _4.s16; + uint16_t _32 = _4.u16; + float _33 = _4.f32; + _4.s32 = int(_31); + _4.u32 = uint(_31); + _4.s32 = int(int16_t(_32)); + _4.u32 = uint(int16_t(_32)); + _4.u32 = uint(uint16_t(_31)); + _4.u32 = uint(_32); + _4.s16 = int16_t(_29); + _4.u16 = uint16_t(_29); + _4.s16 = int16_t(_30); + _4.u16 = uint16_t(_30); + _4.u16 = uint16_t(_29); + _4.u16 = uint16_t(_30); + _4.f32 = float(_31); + _4.f32 = float(int16_t(_32)); + _4.f32 = float(_29); + _4.f32 = float(int(_30)); + _4.f32 = float(uint16_t(_31)); + _4.f32 = float(_32); + _4.f32 = float(uint(_29)); + _4.f32 = float(_30); + _4.s16 = int16_t(_33); + _4.u16 = uint16_t(int16_t(_33)); + _4.u16 = uint16_t(_33); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..10a54fc8cf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + uint a; + uint b; +} _5; + +void main() +{ + uint _20 = atomicAdd(_5.b, 0u); + uint c = _20; + atomicExchange(_5.a, c); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..b51c6c58de --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + uint count; + uint data[]; +} _5; + +void main() +{ + uint _24 = atomicAdd(_5.count, 1u); + if (_24 < 1024u) + { + _5.data[_24] = gl_GlobalInvocationID.x; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/basic.spv16.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/basic.spv16.asm.comp new file mode 100644 index 0000000000..7c237d8abd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/basic.spv16.asm.comp @@ -0,0 +1,13 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float values[]; +} _3; + +void main() +{ + _3.values[gl_GlobalInvocationID.x] += 2.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp.vk new file mode 100644 index 0000000000..dfb8e318e6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp.vk @@ -0,0 +1,45 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; + +layout(buffer_reference) buffer uint8_tPointer +{ + uint8_t value; +}; + +layout(buffer_reference, buffer_reference_align = 4) buffer uintPointer +{ + uint value; +}; + +layout(buffer_reference, buffer_reference_align = 1) buffer uint8_t12_Pointer +{ + uint8_t value[12]; +}; + +layout(set = 0, binding = 0, std430) buffer _7_2 +{ + uint8_tPointer _m0; + uint8_t12_Pointer _m1; +} _2; + +uintPointer _23() +{ + uint8_t12_Pointer _26 = _2._m1; + uintPointer _29 = uintPointer(uint64_t(_26) + 16ul); + _29.value = 1u; + return _29; +} + +void main() +{ + uintPointer _31 = _23(); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp new file mode 100644 index 0000000000..66a70f1848 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp @@ -0,0 +1,24 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + f16vec2 a; + float b; + float c; + f16vec2 d; +} _4; + +void main() +{ + _4.b = uintBitsToFloat(packFloat2x16(_4.a)); + _4.d = unpackFloat2x16(floatBitsToUint(_4.c)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk new file mode 100644 index 0000000000..09eccf4b31 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp.vk @@ -0,0 +1,25 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#extension GL_EXT_shader_16bit_storage : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + f16vec2 a; + float b; + float c; + f16vec2 d; +} _4; + +void main() +{ + _4.b = uintBitsToFloat(packFloat2x16(_4.a)); + _4.d = unpackFloat2x16(floatBitsToUint(_4.c)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..f535ba7f49 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + ivec4 ints; + uvec4 uints; +} _3; + +void main() +{ + ivec4 _19 = _3.ints; + uvec4 _20 = _3.uints; + _3.ints = bitCount(_19); + _3.uints = uvec4(bitCount(_19)); + _3.ints = bitCount(_20); + _3.uints = uvec4(bitCount(_20)); + _3.ints = bitfieldReverse(_19); + _3.uints = bitfieldReverse(_20); + _3.ints = bitfieldExtract(_19, 1, int(11u)); + _3.uints = uvec4(bitfieldExtract(ivec4(_20), int(11u), 1)); + _3.ints = ivec4(bitfieldExtract(uvec4(_19), 1, int(11u))); + _3.uints = bitfieldExtract(_20, int(11u), 1); + _3.ints = bitfieldInsert(_19, _19.wzyx, 1, int(11u)); + _3.uints = bitfieldInsert(_20, _20.wzyx, int(11u), 1); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..31a6234abb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + uvec4 u; + ivec4 i; +} _4; + +void main() +{ + uvec4 _19 = _4.u; + ivec4 _20 = _4.i; + _4.u = uvec4(findLSB(_19)); + _4.i = findLSB(_19); + _4.u = uvec4(findLSB(_20)); + _4.i = findLSB(_20); + _4.u = uvec4(findMSB(_19)); + _4.i = findMSB(_19); + _4.u = uvec4(findMSB(uvec4(_20))); + _4.i = findMSB(uvec4(_20)); + _4.u = uvec4(findMSB(ivec4(_19))); + _4.i = findMSB(ivec4(_19)); + _4.u = uvec4(findMSB(_20)); + _4.i = findMSB(_20); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp.vk new file mode 100644 index 0000000000..d700d61353 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp.vk @@ -0,0 +1,15 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + uint v; +} ssbos[]; + +void main() +{ + uint _24 = gl_GlobalInvocationID.z; + uint _25 = atomicAdd(ssbos[nonuniformEXT(_24)].v, 1u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp.vk new file mode 100644 index 0000000000..f082267f93 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp.vk @@ -0,0 +1,37 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer SomeBuffer; +layout(buffer_reference, buffer_reference_align = 16, std430) buffer SomeBuffer +{ + vec4 v; + uint64_t a; + uvec2 b; +}; + +layout(push_constant, std430) uniform Registers +{ + uint64_t address; + uvec2 address2; +} registers; + +void main() +{ + SomeBuffer _44 = SomeBuffer(registers.address); + SomeBuffer _45 = SomeBuffer(registers.address); + SomeBuffer _46 = SomeBuffer(registers.address2); + _44.v = vec4(1.0, 2.0, 3.0, 4.0); + _45.v = vec4(1.0, 2.0, 3.0, 4.0); + _46.v = vec4(1.0, 2.0, 3.0, 4.0); + _44.a = uint64_t(_44); + _45.a = uint64_t(_45); + _46.b = uvec2(_46); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp.vk new file mode 100644 index 0000000000..12581cc3f8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp.vk @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Alias; +layout(buffer_reference) buffer _6; +layout(buffer_reference) buffer _7; +layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer Alias +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) restrict buffer _6 +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) coherent writeonly buffer _7 +{ + vec4 v[]; +}; + +layout(push_constant, std430) uniform Registers +{ + Alias ro; + _6 rw; + _7 wo; +} registers; + +void main() +{ + registers.rw.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; + registers.wo.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp.vk new file mode 100644 index 0000000000..06e620d2c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp.vk @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference, buffer_reference_align = 8) buffer uvec4Pointer +{ + uvec4 value; +}; + +layout(push_constant, std430) uniform Push +{ + uvec4Pointer ptr; +} _4; + +void main() +{ + _4.ptr.value = uvec4(1u, 2u, 3u, 4u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp.vk new file mode 100644 index 0000000000..44427de81e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp.vk @@ -0,0 +1,13 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer uvec4Pointer +{ + uvec4 value; +}; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp.vk new file mode 100644 index 0000000000..f77142a743 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp.vk @@ -0,0 +1,25 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference, buffer_reference_align = 4) buffer uintPointer +{ + uint value; +}; + +layout(push_constant, std430) uniform _4_12 +{ + uint64_t _m0; +} _12; + +void main() +{ + uintPointer _3 = uintPointer(_12._m0); + _3.value = 20u; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp.vk new file mode 100644 index 0000000000..6ba488be6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp.vk @@ -0,0 +1,25 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference, buffer_reference_align = 4) buffer uint0_Pointer +{ + uint value[]; +}; + +layout(push_constant, std430) uniform _6_14 +{ + uint64_t _m0; +} _14; + +void main() +{ + uint0_Pointer _5 = uint0_Pointer(_14._m0); + _5.value[10] = 20u; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..d8f1f19b12 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,15 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +float _15; + +layout(binding = 0, std430) buffer Block +{ + vec4 f; +} block; + +void main() +{ + block.f = vec4(0.100000001490116119384765625, 0.20000000298023223876953125, 0.300000011920928955078125, 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..1f43951a15 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in; + +const int indexable[4] = int[](0, 1, 2, 3); +const int indexable_1[4] = int[](4, 5, 6, 7); + +layout(binding = 0, std430) buffer SSBO +{ + int values[]; +} _6; + +void main() +{ + _6.values[gl_GlobalInvocationID.x] = indexable[gl_LocalInvocationID.x] + indexable_1[gl_LocalInvocationID.y]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp new file mode 100644 index 0000000000..28b2d1d0e9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp @@ -0,0 +1,45 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct B2 +{ + vec4 elem2; +}; + +struct C +{ + vec4 c; + B2 b2; + B2 b2_array[4]; +}; + +struct B1 +{ + vec4 elem1; +}; + +struct A +{ + vec4 a; + B1 b1; + B1 b1_array[4]; +}; + +layout(binding = 0, std430) buffer _8_3 +{ + A a_block; + C c_block; +} _3; + +void main() +{ + A _27; + _27.a = _3.c_block.c; + _27.b1.elem1 = _3.c_block.b2.elem2; + _27.b1_array[0].elem1 = _3.c_block.b2_array[0].elem2; + _27.b1_array[1].elem1 = _3.c_block.b2_array[1].elem2; + _27.b1_array[2].elem1 = _3.c_block.b2_array[2].elem2; + _27.b1_array[3].elem1 = _3.c_block.b2_array[3].elem2; + _3.a_block = _27; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..77ea03495f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,7 @@ +#version 450 +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp new file mode 100644 index 0000000000..83a9b83fa1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp @@ -0,0 +1,34 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _4_5 +{ + uint _m0[16]; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uint _m0[16]; +} _6; + +layout(binding = 2, std430) buffer _4_7 +{ + uint _m0[16]; +} _7; + +vec4 _88(vec4 _89) +{ + for (int _91 = 0; _91 < 16; _91++) + { + uint _163 = _6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + _5._m0[_91])))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + uint _225 = _6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + _163))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + _7._m0[_91] = _6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + (_6._m0[_91] + _225)))))))))))))); + } + return _89; +} + +void main() +{ + vec4 _87 = _88(vec4(uvec4(gl_GlobalInvocationID, 0u))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp new file mode 100644 index 0000000000..7755593f57 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp @@ -0,0 +1,18 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _8_9 +{ + float _m0[]; +} _9; + +layout(binding = 1, std430) buffer _8_10 +{ + float _m0[]; +} _10; + +void main() +{ + _10._m0[gl_GlobalInvocationID.x] = -_9._m0[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp new file mode 100644 index 0000000000..5a5f212faa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp @@ -0,0 +1,51 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer _2_9 +{ + uint _m0[2]; +} _9; + +layout(binding = 0, std430) buffer _4_8 +{ + uint _m0[3]; +} _8; + +layout(binding = 2, std430) buffer _6_10 +{ + uint _m0[11]; +} _10; + +void main() +{ + uint _34 = 0u; + uint _35 = 0u; + uint _36 = 0u; + _10._m0[_34] = 8u; + _34++; + for (;;) + { + _10._m0[_34] = 9u; + _34++; + uint _44 = _35; + _35 = _44 + 1u; + if (_8._m0[_44] == 1u) + { + _10._m0[_34] = 12u; + _34++; + _36++; + _10._m0[_34] = 13u; + _34++; + _10._m0[_34] = 11u; + _34++; + continue; + } + else + { + break; + } + } + _10._m0[_34] = 10u; + _34++; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp new file mode 100644 index 0000000000..73c7d36728 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp @@ -0,0 +1,411 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _4_12 +{ + uint _m0[1]; +} _12; + +layout(binding = 1, std430) buffer _4_13 +{ + uint _m0[1]; +} _13; + +layout(binding = 7, std430) buffer _4_19 +{ + uint _m0[1]; +} _19; + +layout(binding = 2, std430) buffer _6_14 +{ + uint _m0[2]; +} _14; + +layout(binding = 3, std430) buffer _6_15 +{ + uint _m0[2]; +} _15; + +layout(binding = 4, std430) buffer _6_16 +{ + uint _m0[2]; +} _16; + +layout(binding = 5, std430) buffer _6_17 +{ + uint _m0[2]; +} _17; + +layout(binding = 6, std430) buffer _6_18 +{ + uint _m0[2]; +} _18; + +layout(binding = 8, std430) buffer _8_20 +{ + uint _m0[3]; +} _20; + +layout(binding = 9, std430) buffer _10_21 +{ + uint _m0[37]; +} _21; + +void main() +{ + uint _70 = 0u; + uint _71 = 0u; + uint _72 = 0u; + uint _74 = 0u; + uint _75 = 0u; + uint _76 = 0u; + uint _77 = 0u; + uint _78 = 0u; + uint _79 = 0u; + uint _90 = ((gl_WorkGroupID.y * 1u) + (gl_WorkGroupID.z * 1u)) + gl_WorkGroupID.x; + uint _111 = (_90 * 2u) + (gl_LocalInvocationIndex * 2u); + _71 = (_90 * 1u) + (gl_LocalInvocationIndex * 1u); + _72 = (_90 * 1u) + (gl_LocalInvocationIndex * 1u); + _74 = (_90 * 2u) + (gl_LocalInvocationIndex * 2u); + _75 = (_90 * 2u) + (gl_LocalInvocationIndex * 2u); + _76 = (_90 * 2u) + (gl_LocalInvocationIndex * 2u); + _77 = (_90 * 2u) + (gl_LocalInvocationIndex * 2u); + _78 = (_90 * 1u) + (gl_LocalInvocationIndex * 1u); + _79 = (_90 * 3u) + (gl_LocalInvocationIndex * 3u); + _70 = (_90 * 37u) + (gl_LocalInvocationIndex * 37u); + _21._m0[_70] = 8u; + uint _123 = _70 + 1u; + _71++; + uint _136; + uint _233; + uint _234; + uint _241; + uint _242; + uint _73 = _111; + uint _129 = _123; + for (;;) + { + _21._m0[_129] = 9u; + _136 = _129 + 1u; + uint _141; + for (;;) + { + _21._m0[_136] = 12u; + _141 = _136 + 1u; + break; + } + uint _148; + uint _149; + uint _162; + uint _163; + for (;;) + { + _21._m0[_141] = 13u; + _148 = _141 + 1u; + _149 = _75; + _21._m0[_148] = 17u; + _75 = _149 + 1u; + uint _158; + if (_16._m0[_149] == 1u) + { + _158 = _148 + 1u; + _21._m0[_158] = 19u; + _162 = _158 + 1u; + _163 = _74; + break; + } + if (true) + { + _141 = 666u; + continue; + } + else + { + _162 = 666u; + _163 = 666u; + break; + } + } + _21._m0[_162] = 15u; + uint _165 = _162 + 1u; + _74 = _163 + 1u; + uint _174; + uint _178; + uint _179; + if (_15._m0[_163] == 1u) + { + _178 = _165; + _179 = _76; + _21._m0[_178] = 21u; + uint _181 = _178 + 1u; + uint _184 = _179 + 1u; + _76 = _184; + uint _186; + _186 = _181; + uint _191; + for (;;) + { + _21._m0[_186] = 23u; + uint _189 = _186 + 1u; + _191 = _189; + break; + } + uint _199; + uint _200; + uint _216; + uint _217; + uint _224; + uint _225; + for (;;) + { + _21._m0[_191] = 24u; + uint _195 = _191 + 1u; + uint _196 = _79; + _199 = _195; + _200 = _196; + _21._m0[_199] = 28u; + uint _202 = _199 + 1u; + uint _204 = _20._m0[_200]; + uint _205 = _200 + 1u; + _79 = _205; + uint _208; + uint _212; + bool _198_ladder_break = false; + switch (_204) + { + default: + { + _208 = _202; + _21._m0[_208] = 30u; + uint _210 = _208 + 1u; + uint _211 = _77; + _224 = _210; + _225 = _211; + _198_ladder_break = true; + break; + } + case 1u: + { + _212 = _202; + break; + } + } + if (_198_ladder_break) + { + break; + } + _21._m0[_212] = 29u; + uint _214 = _212 + 1u; + uint _215 = _78; + _216 = _214; + _217 = _215; + _21._m0[_216] = 27u; + uint _192 = _216 + 1u; + uint _220 = _19._m0[_217]; + uint _222 = _217 + 1u; + _78 = _222; + uint _223 = _77; + if (_220 == 1u) + { + _191 = _192; + continue; + } + else + { + _224 = _192; + _225 = _223; + break; + } + } + _21._m0[_224] = 26u; + uint _227 = _224 + 1u; + uint _229 = _18._m0[_225]; + bool _230 = _229 == 1u; + uint _231 = _225 + 1u; + _77 = _231; + uint _232 = _73; + if (_230) + { + _233 = _227; + _234 = _232; + _21._m0[_233] = 11u; + uint _130 = _233 + 1u; + uint _237 = _14._m0[_234]; + uint _239 = _234 + 1u; + _73 = _239; + if (_237 == 1u) + { + _129 = _130; + continue; + } + else + { + _241 = _130; + _242 = _72; + break; + } + } + else + { + } + } + else + { + _174 = _165; + _21._m0[_174] = 22u; + _178 = _174 + 1u; + _179 = _76; + _21._m0[_178] = 21u; + uint _181 = _178 + 1u; + uint _184 = _179 + 1u; + _76 = _184; + uint _186; + _186 = _181; + uint _191; + for (;;) + { + _21._m0[_186] = 23u; + uint _189 = _186 + 1u; + _191 = _189; + break; + } + uint _199; + uint _200; + uint _216; + uint _217; + uint _224; + uint _225; + for (;;) + { + _21._m0[_191] = 24u; + uint _195 = _191 + 1u; + uint _196 = _79; + _199 = _195; + _200 = _196; + _21._m0[_199] = 28u; + uint _202 = _199 + 1u; + uint _204 = _20._m0[_200]; + uint _205 = _200 + 1u; + _79 = _205; + uint _208; + uint _212; + bool _198_ladder_break = false; + switch (_204) + { + default: + { + _208 = _202; + _21._m0[_208] = 30u; + uint _210 = _208 + 1u; + uint _211 = _77; + _224 = _210; + _225 = _211; + _198_ladder_break = true; + break; + } + case 1u: + { + _212 = _202; + break; + } + } + if (_198_ladder_break) + { + break; + } + _21._m0[_212] = 29u; + uint _214 = _212 + 1u; + uint _215 = _78; + _216 = _214; + _217 = _215; + _21._m0[_216] = 27u; + uint _192 = _216 + 1u; + uint _220 = _19._m0[_217]; + uint _222 = _217 + 1u; + _78 = _222; + uint _223 = _77; + if (_220 == 1u) + { + _191 = _192; + continue; + } + else + { + _224 = _192; + _225 = _223; + break; + } + } + _21._m0[_224] = 26u; + uint _227 = _224 + 1u; + uint _229 = _18._m0[_225]; + bool _230 = _229 == 1u; + uint _231 = _225 + 1u; + _77 = _231; + uint _232 = _73; + if (_230) + { + _233 = _227; + _234 = _232; + _21._m0[_233] = 11u; + uint _130 = _233 + 1u; + uint _237 = _14._m0[_234]; + uint _239 = _234 + 1u; + _73 = _239; + if (_237 == 1u) + { + _129 = _130; + continue; + } + else + { + _241 = _130; + _242 = _72; + break; + } + } + else + { + } + } + _233 = 666u; + _234 = 666u; + _21._m0[_233] = 11u; + uint _130 = _233 + 1u; + uint _237 = _14._m0[_234]; + uint _239 = _234 + 1u; + _73 = _239; + if (_237 == 1u) + { + _129 = _130; + continue; + } + else + { + _241 = _130; + _242 = _72; + break; + } + } + _21._m0[_241] = 10u; + _72 = _242 + 1u; + uint _251; + uint _254; + switch (_13._m0[_242]) + { + case 1u: + { + _254 = 666u; + break; + } + default: + { + _251 = _241 + 1u; + _21._m0[_251] = 32u; + _254 = _251 + 1u; + break; + } + } + _21._m0[_254] = 31u; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..35edd4dd6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + ivec4 ints; + uvec4 uints; +} _4; + +void main() +{ + ivec4 _19 = _4.ints; + uvec4 _20 = _4.uints; + _4.ints = abs(_19); + _4.uints = uvec4(abs(_19)); + _4.ints = abs(ivec4(_20)); + _4.uints = uvec4(abs(ivec4(_20))); + _4.ints = sign(_19); + _4.uints = uvec4(sign(_19)); + _4.ints = sign(ivec4(_20)); + _4.uints = uvec4(sign(ivec4(_20))); + _4.ints = findMSB(ivec4(_20)); + _4.uints = uvec4(findMSB(ivec4(_20))); + _4.ints = findMSB(uvec4(_19)); + _4.uints = uvec4(findMSB(uvec4(_19))); + _4.ints = min(_19, _19); + _4.uints = uvec4(min(_19, ivec4(_20))); + _4.ints = min(ivec4(_20), ivec4(_20)); + _4.uints = uvec4(min(ivec4(_20), _19)); + _4.ints = ivec4(min(uvec4(_19), _20)); + _4.uints = min(uvec4(_19), _20); + _4.ints = ivec4(min(_20, uvec4(_19))); + _4.uints = min(_20, uvec4(_19)); + _4.ints = max(_19, _19); + _4.uints = uvec4(max(_19, _19)); + _4.ints = max(ivec4(_20), _19); + _4.uints = uvec4(max(ivec4(_20), _19)); + _4.ints = ivec4(max(uvec4(_19), _20)); + _4.uints = max(uvec4(_19), uvec4(_19)); + _4.ints = ivec4(max(_20, uvec4(_19))); + _4.uints = max(_20, uvec4(_19)); + _4.ints = clamp(ivec4(_20), ivec4(_20), ivec4(_20)); + _4.uints = uvec4(clamp(ivec4(_20), ivec4(_20), ivec4(_20))); + _4.ints = ivec4(clamp(uvec4(_19), uvec4(_19), uvec4(_19))); + _4.uints = clamp(uvec4(_19), uvec4(_19), uvec4(_19)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp new file mode 100644 index 0000000000..dc0956c345 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct _8 +{ + float _m0; + float _m1; +}; + +struct _15 +{ + float _m0; + int _m1; +}; + +layout(binding = 0, std430) buffer _3_4 +{ + float _m0; + int _m1; +} _4; + +void main() +{ + _8 _23; + _23._m0 = modf(20.0, _23._m1); + _15 _24; + _24._m0 = frexp(40.0, _24._m1); + _4._m0 = _23._m0; + _4._m0 = _23._m1; + _4._m0 = _24._m0; + _4._m1 = _24._m1; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp.vk new file mode 100644 index 0000000000..c6c1ea3e26 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp.vk @@ -0,0 +1,12 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, r32ui) uniform uimage2D uImage[]; + +void main() +{ + uint _26 = gl_GlobalInvocationID.z; + uint _31 = imageAtomicAdd(uImage[nonuniformEXT(_26)], ivec2(gl_GlobalInvocationID.xy), 1u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp new file mode 100644 index 0000000000..57587ebfa2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp @@ -0,0 +1,29 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 11u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 12u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 13u +#endif +const uint _4 = SPIRV_CROSS_CONSTANT_ID_3; +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 14u +#endif +const uint _5 = SPIRV_CROSS_CONSTANT_ID_4; + +layout(local_size_x = 3, local_size_y = SPIRV_CROSS_CONSTANT_ID_1, local_size_z = SPIRV_CROSS_CONSTANT_ID_2) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 values[]; +} _8; + +void main() +{ + _8.values[gl_GlobalInvocationID.x] += vec4(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp.vk new file mode 100644 index 0000000000..0073fbee0c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp.vk @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 3, local_size_y_id = 1, local_size_z_id = 2) in; + +layout(constant_id = 3) const uint _4 = 13u; +layout(constant_id = 4) const uint _5 = 14u; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + vec4 values[]; +} _8; + +void main() +{ + _8.values[gl_GlobalInvocationID.x] += vec4(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp new file mode 100644 index 0000000000..5c2a09d3d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp @@ -0,0 +1,31 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 11 +#endif +const int _10 = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 12 +#endif +const int _11 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 13 +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 14 +#endif +const uint _29 = (uint(int(gl_WorkGroupSize.x)) + 3u); +const uvec3 _30 = uvec3(_29, int(gl_WorkGroupSize.y), 2u); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_3, local_size_y = SPIRV_CROSS_CONSTANT_ID_4, local_size_z = 2) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 values[]; +} _8; + +void main() +{ + _8.values[gl_GlobalInvocationID.x] = ((((_8.values[gl_GlobalInvocationID.x] + vec4(2.0)) + vec3(_30).xyzz) * float(int(gl_WorkGroupSize.x))) * float(int(gl_WorkGroupSize.y))) * float(int(2u)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp.vk new file mode 100644 index 0000000000..b6a78bdf1c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp.vk @@ -0,0 +1,22 @@ +#version 450 +layout(local_size_x_id = 3, local_size_y_id = 4, local_size_z = 2) in; + +layout(constant_id = 1) const int _10 = 11; +layout(constant_id = 2) const int _11 = 12; +const uint _29 = (uint(int(gl_WorkGroupSize.x)) + 3u); +const uvec3 _30 = uvec3(_29, int(gl_WorkGroupSize.y), 2u); + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + vec4 values[]; +} _8; + +void main() +{ + vec3 _38 = vec3(_30); + float _41 = float(int(gl_WorkGroupSize.x)); + float _42 = float(int(gl_WorkGroupSize.y)); + float _43 = float(int(2u)); + _8.values[gl_GlobalInvocationID.x] = ((((_8.values[gl_GlobalInvocationID.x] + vec4(2.0)) + _38.xyzz) * _41) * _42) * _43; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp new file mode 100644 index 0000000000..c34852f79c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp @@ -0,0 +1,107 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 4, std430) buffer _2_12 +{ + uint _m0[1]; +} _12; + +layout(binding = 1, std430) buffer _2_9 +{ + uint _m0[1]; +} _9; + +layout(binding = 2, std430) buffer _2_10 +{ + uint _m0[1]; +} _10; + +layout(binding = 3, std430) buffer _2_11 +{ + uint _m0[1]; +} _11; + +layout(binding = 0, std430) buffer _4_8 +{ + uint _m0[2]; +} _8; + +layout(binding = 5, std430) buffer _6_13 +{ + uint _m0[11]; +} _13; + +void main() +{ + uint _43 = 0u; + uint _44 = 0u; + uint _45 = 0u; + uint _46 = 0u; + uint _47 = 0u; + _13._m0[0u] = 8u; + uint _50 = 0u + 1u; + uint _42 = _50; + for (;;) + { + _13._m0[_42] = 9u; + _42++; + uint _55 = _43; + _43 = _55 + 1u; + if (_8._m0[_55] == 1u) + { + _13._m0[_42] = 12u; + _42++; + return; + } + else + { + _13._m0[_42] = 13u; + _42++; + uint _70 = _44; + _44 = _70 + 1u; + if (_9._m0[_70] == 1u) + { + _13._m0[_42] = 11u; + _42++; + _13._m0[_42] = 14u; + _42++; + _45++; + do + { + _13._m0[_42] = 16u; + _42++; + break; + } while(false); + _13._m0[_42] = 15u; + _42++; + uint _94 = _46; + _46 = _94 + 1u; + if (_11._m0[_94] == 1u) + { + } + else + { + _13._m0[_42] = 19u; + _42++; + } + _13._m0[_42] = 17u; + _42++; + uint _108 = _47; + _47 = _108 + 1u; + if (_12._m0[_108] == 1u) + { + continue; + } + else + { + break; + } + } + else + { + break; + } + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp new file mode 100644 index 0000000000..08f3b44e0b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp @@ -0,0 +1,108 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 4, std430) buffer _2_12 +{ + uint _m0[1]; +} _12; + +layout(binding = 1, std430) buffer _2_9 +{ + uint _m0[1]; +} _9; + +layout(binding = 2, std430) buffer _2_10 +{ + uint _m0[1]; +} _10; + +layout(binding = 3, std430) buffer _2_11 +{ + uint _m0[1]; +} _11; + +layout(binding = 0, std430) buffer _4_8 +{ + uint _m0[2]; +} _8; + +layout(binding = 5, std430) buffer _6_13 +{ + uint _m0[11]; +} _13; + +void main() +{ + uint _43 = 0u; + uint _44 = 0u; + uint _45 = 0u; + uint _46 = 0u; + uint _47 = 0u; + uint _115; + _13._m0[_115] = 8u; + uint _50 = _115 + 1u; + uint _42 = _50; + for (;;) + { + _13._m0[_42] = 9u; + _42++; + uint _55 = _43; + _43 = _55 + 1u; + if (_8._m0[_55] == 1u) + { + _13._m0[_42] = 12u; + _42++; + return; + } + else + { + _13._m0[_42] = 13u; + _42++; + uint _70 = _44; + _44 = _70 + 1u; + if (_9._m0[_70] == 1u) + { + _13._m0[_42] = 11u; + _42++; + _13._m0[_42] = 14u; + _42++; + _45++; + do + { + _13._m0[_42] = 16u; + _42++; + break; + } while(false); + _13._m0[_42] = 15u; + _42++; + uint _94 = _46; + _46 = _94 + 1u; + if (_11._m0[_94] == 1u) + { + } + else + { + _13._m0[_42] = 19u; + _42++; + } + _13._m0[_42] = 17u; + _42++; + uint _108 = _47; + _47 = _108 + 1u; + if (_12._m0[_108] == 1u) + { + continue; + } + else + { + break; + } + } + else + { + break; + } + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp new file mode 100644 index 0000000000..ca8e58cfc7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp @@ -0,0 +1,12 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + uint i = 0u; + for (;;) + { + break; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp new file mode 100644 index 0000000000..7de95ae6b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp @@ -0,0 +1,52 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std140) uniform UBO +{ + int v; +} _6; + +void main() +{ + uint count = 0u; + for (int i = 0; i < 4; i++) + { + bool _31_ladder_break = false; + do + { + bool _33_ladder_break = false; + do + { + bool _35_ladder_break = false; + do + { + if (_6.v == 20) + { + _35_ladder_break = true; + _33_ladder_break = true; + _31_ladder_break = true; + break; + } + break; + } while(false); + if (_35_ladder_break) + { + break; + } + break; + } while(false); + if (_33_ladder_break) + { + break; + } + count++; + break; + } while(false); + if (_31_ladder_break) + { + break; + } + count++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp.vk new file mode 100644 index 0000000000..9b7de0622f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp.vk @@ -0,0 +1,55 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_KHR_shader_subgroup_ballot : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) restrict readonly buffer SSBO_Offsets +{ + uvec2 _m0[]; +} _7; + +layout(push_constant, std430) uniform RootConstants +{ + uint _m0; + uint _m1; + uint _m2; + uint _m3; + uint _m4; + uint _m5; + uint _m6; + uint _m7; +} registers; + +layout(set = 1, binding = 0) uniform samplerBuffer _8[]; +layout(set = 4, binding = 0, r32f) uniform imageBuffer _9[]; +layout(set = 4, binding = 0, r32ui) uniform uimageBuffer _10[]; + +void main() +{ + uint _61 = registers._m4 + 2u; + uint _64 = subgroupBroadcastFirst(_61); + uint _71 = subgroupBroadcastFirst(registers._m4); + uint _76 = registers._m1 + 1u; + uint _79 = subgroupBroadcastFirst(_76); + uint _88 = gl_GlobalInvocationID.x + 4u; + uint _99 = gl_GlobalInvocationID.x + 1024u; + imageStore(_9[registers._m4], int((_99 < _7._m0[_71].y) ? (_99 + _7._m0[_71].x) : 4294967295u), vec4(imageLoad(_9[registers._m4], int((_88 < _7._m0[_71].y) ? (_88 + _7._m0[_71].x) : 4294967295u)))); + uint _106 = gl_GlobalInvocationID.x + 2u; + uint _117 = gl_GlobalInvocationID.x + 2048u; + imageStore(_9[registers._m4], int((_117 < _7._m0[_71].y) ? (_117 + _7._m0[_71].x) : 4294967295u), vec4(texelFetch(_8[_76], int((_106 < _7._m0[_79].y) ? (_106 + _7._m0[_79].x) : 4294967295u)))); + uint _130 = imageAtomicAdd(_10[_61], int((gl_GlobalInvocationID.x < _7._m0[_64].y) ? (gl_GlobalInvocationID.x + _7._m0[_64].x) : 4294967295u), 40u); + uint _137 = imageAtomicCompSwap(_10[_61], int((gl_GlobalInvocationID.y < _7._m0[_64].y) ? (gl_GlobalInvocationID.y + _7._m0[_64].x) : 4294967295u), 40u, 50u); + imageStore(_9[registers._m4], int((0u < _7._m0[_71].y) ? (0u + _7._m0[_71].x) : 4294967295u), vec4(float(_7._m0[_71].y))); + imageStore(_9[registers._m4], int((1u < _7._m0[_71].y) ? (1u + _7._m0[_71].x) : 4294967295u), vec4(float(_7._m0[_79].y))); + uint _11 = registers._m4 + (gl_GlobalInvocationID.z + 0u); + imageStore(_9[nonuniformEXT(_11)], int((_99 < _7._m0[_11].y) ? (_99 + _7._m0[_11].x) : 4294967295u), vec4(imageLoad(_9[nonuniformEXT(_11)], int((_88 < _7._m0[_11].y) ? (_88 + _7._m0[_11].x) : 4294967295u)))); + uint _13 = registers._m1 + (gl_GlobalInvocationID.z + 0u); + imageStore(_9[nonuniformEXT(_11)], int((_117 < _7._m0[_11].y) ? (_117 + _7._m0[_11].x) : 4294967295u), vec4(texelFetch(_8[nonuniformEXT(_13)], int((_88 < _7._m0[_13].y) ? (_88 + _7._m0[_13].x) : 4294967295u)))); + uint _15 = registers._m4 + (gl_GlobalInvocationID.z + 0u); + uint _209 = imageAtomicAdd(_10[nonuniformEXT(_15)], int((gl_GlobalInvocationID.y < _7._m0[_15].y) ? (gl_GlobalInvocationID.y + _7._m0[_15].x) : 4294967295u), 40u); + uint _215 = imageAtomicCompSwap(_10[nonuniformEXT(_15)], int((gl_GlobalInvocationID.y < _7._m0[_15].y) ? (gl_GlobalInvocationID.y + _7._m0[_15].x) : 4294967295u), 40u, 70u); + imageStore(_9[registers._m4], int((2u < _7._m0[_71].y) ? (2u + _7._m0[_71].x) : 4294967295u), vec4(float(_7._m0[_11].y))); + imageStore(_9[registers._m4], int((3u < _7._m0[_71].y) ? (3u + _7._m0[_71].x) : 4294967295u), vec4(float(_7._m0[_13].y))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp new file mode 100644 index 0000000000..f8650b5e5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp @@ -0,0 +1,20 @@ +#version 450 +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 1, rgba32f) uniform writeonly image2D outImageTexture; + +void main() +{ + int _27_copy; + int _30; + _30 = 7; + for (int _27 = 7; _27 >= 0; _27_copy = _27, _27--, _30 = _27_copy) + { + if (5.0 > float(_27)) + { + break; + } + } + imageStore(outImageTexture, ivec2(gl_GlobalInvocationID.xy), vec4(float(_30 - 1), float(_30), 1.0, 1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp.vk new file mode 100644 index 0000000000..fa46c715ba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp.vk @@ -0,0 +1,28 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) readonly buffer Buf +{ + uvec2 vas[1024]; +} _3; + +layout(push_constant, std430) uniform Registers +{ + uint index; +} _4; + +rayQueryEXT rq; + +void main() +{ + uvec2 _41; + do + { + uvec2 va = _3.vas[_4.index]; + _41 = _3.vas[_4.index]; + } while (false); + rayQueryInitializeEXT(rq, accelerationStructureEXT(_41), 0u, 0u, vec3(0.0), 0.0, vec3(0.0), 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp.vk new file mode 100644 index 0000000000..ccbbc02ff4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp.vk @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_ray_query : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +float _16; +vec3 _17; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT RTAS; + +void main() +{ + rayQueryEXT _19; + rayQueryInitializeEXT(_19, RTAS, 2u, 255u, _17, _16, _17, _16); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp new file mode 100644 index 0000000000..e7b9dbf337 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp @@ -0,0 +1,44 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 0 +#endif +const int A = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1 +#endif +const int A_1 = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2 +#endif +const int A_2 = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +const int A_3 = SPIRV_CROSS_CONSTANT_ID_3; +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 4 +#endif +const int A_4 = SPIRV_CROSS_CONSTANT_ID_4; +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 5 +#endif +const int A_5 = SPIRV_CROSS_CONSTANT_ID_5; +const int A_6 = (A - A_1); +const int A_7 = (A_6 - A_2); +const int A_8 = (A_7 - A_3); +const int A_9 = (A_8 - A_4); +const int A_10 = (A_9 - A_5); +const int A_11 = (A_10 + A_5); + +layout(binding = 0, std430) buffer SSBO +{ + int values[]; +} _5; + +void main() +{ + _5.values[gl_GlobalInvocationID.x] = A_11; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp.vk new file mode 100644 index 0000000000..c31d0787d8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp.vk @@ -0,0 +1,26 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const int A = 0; +layout(constant_id = 1) const int A_1 = 1; +layout(constant_id = 2) const int A_2 = 2; +layout(constant_id = 3) const int A_3 = 3; +layout(constant_id = 4) const int A_4 = 4; +layout(constant_id = 5) const int A_5 = 5; +const int A_6 = (A - A_1); +const int A_7 = (A_6 - A_2); +const int A_8 = (A_7 - A_3); +const int A_9 = (A_8 - A_4); +const int A_10 = (A_9 - A_5); +const int A_11 = (A_10 + A_5); + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + int values[]; +} _5; + +void main() +{ + _5.values[gl_GlobalInvocationID.x] = A_11; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp new file mode 100644 index 0000000000..50ca0fbdbc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp @@ -0,0 +1,39 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +const int ConstantInt = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2u +#endif +const uint ConstantUint = SPIRV_CROSS_CONSTANT_ID_1; +const int64_t ConstantInt64_1 = int64_t(ConstantInt); +const int64_t ConstantInt64_2 = int64_t(int(ConstantUint)); +const uint64_t ConstantUint64_1 = uint64_t(ConstantInt); +const uint64_t ConstantUint64_2 = uint64_t(int(ConstantUint)); +const int64_t _20 = (ConstantInt64_1 + ConstantInt64_2); +const uint64_t _21 = (ConstantUint64_1 + ConstantUint64_2); +const int _22 = int(_20); +const uint _23 = uint(_21); + +layout(binding = 0, std430) buffer SSBO +{ + int s64; + uint u64; +} _4; + +void main() +{ + _4.s64 = _22; + _4.u64 = _23; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp new file mode 100644 index 0000000000..482cfd8a06 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp @@ -0,0 +1,28 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 3u +#endif + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_0, local_size_y = 2, local_size_z = SPIRV_CROSS_CONSTANT_ID_2) in; + +layout(binding = 0, std430) buffer _6_8 +{ + float _m0[]; +} _8; + +layout(binding = 1, std430) buffer _6_9 +{ + float _m0[]; +} _9; + +uvec3 _22 = gl_WorkGroupSize; + +void main() +{ + _8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp.vk new file mode 100644 index 0000000000..22834fa8e7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp.vk @@ -0,0 +1,36 @@ +#version 450 +#extension GL_KHR_shader_subgroup_ballot : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0) uniform usamplerBuffer _4; +layout(set = 0, binding = 0, r32ui) uniform writeonly uimageBuffer _5; + +uvec4 WaveMatch(uint _45) +{ + uvec4 _52; + for (;;) + { + bool _51 = _45 == subgroupBroadcastFirst(_45); + _52 = subgroupBallot(_51); + if (_51) + { + break; + } + else + { + continue; + } + } + return _52; +} + +void main() +{ + uvec4 _32 = WaveMatch(texelFetch(_4, int(gl_GlobalInvocationID.x)).x); + uint _37 = gl_GlobalInvocationID.x * 4u; + imageStore(_5, int(_37), uvec4(_32.x)); + imageStore(_5, int(_37 + 1u), uvec4(_32.y)); + imageStore(_5, int(_37 + 2u), uvec4(_32.z)); + imageStore(_5, int(_37 + 3u), uvec4(_32.w)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag new file mode 100644 index 0000000000..eb1cf0ca94 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag @@ -0,0 +1,118 @@ +#version 320 es +precision mediump float; +precision highp int; + +layout(binding = 1, std140) uniform buf1 +{ + highp vec2 resolution; +} _9; + +layout(binding = 0, std140) uniform buf0 +{ + highp vec2 injectionSwitch; +} _13; + +layout(location = 0) out highp vec4 _GLF_color; + +bool checkSwap(highp float a, highp float b) +{ + bool _153 = gl_FragCoord.y < (_9.resolution.y / 2.0); + highp float _160; + if (_153) + { + _160 = a; + } + else + { + highp float _159 = 0.0; + _160 = _159; + } + bool _147; + do + { + highp float _168; + if (_153) + { + _168 = b; + } + else + { + highp float _167 = 0.0; + _168 = _167; + } + if (_153) + { + _147 = _160 > _168; + } + if (true) + { + break; + } + else + { + break; + } + } while(false); + highp float _180; + if (_153) + { + highp float _179 = 0.0; + _180 = _179; + } + else + { + _180 = a; + } + highp float _186; + if (_153) + { + highp float _185 = 0.0; + _186 = _185; + } + else + { + _186 = b; + } + if (!_153) + { + _147 = _180 < _186; + } + return _147; +} + +void main() +{ + highp float data[10]; + for (int i = 0; i < 10; i++) + { + data[i] = float(10 - i) * _13.injectionSwitch.y; + } + for (int i_1 = 0; i_1 < 9; i_1++) + { + for (int j = 0; j < 10; j++) + { + if (j < (i_1 + 1)) + { + continue; + } + highp float param = data[i_1]; + highp float param_1 = data[j]; + bool doSwap = checkSwap(param, param_1); + if (doSwap) + { + highp float temp = data[i_1]; + data[i_1] = data[j]; + data[j] = temp; + } + } + } + if (gl_FragCoord.x < (_9.resolution.x / 2.0)) + { + _GLF_color = vec4(data[0] / 10.0, data[5] / 10.0, data[9] / 10.0, 1.0); + } + else + { + _GLF_color = vec4(data[5] / 10.0, data[9] / 10.0, data[0] / 10.0, 1.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..b2d8919aa9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,63 @@ +#version 450 + +struct anon_aa +{ + int foo; +}; + +struct anon_ab +{ + int foo; +}; + +struct anon_a +{ + anon_aa _aa; + anon_ab ab; +}; + +struct anon_ba +{ + int foo; +}; + +struct anon_bb +{ + int foo; +}; + +struct anon_b +{ + anon_ba _ba; + anon_bb bb; +}; + +struct anon_ca +{ + int foo; +}; + +struct anon_c +{ + anon_ca _ca; +}; + +struct anon_da +{ + int foo; +}; + +struct anon_d +{ + anon_da da; +}; + +struct anon_e +{ + int a; +}; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag new file mode 100644 index 0000000000..40f6ee714b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag @@ -0,0 +1,28 @@ +#version 450 + +layout(binding = 0, std140) uniform uBuffer +{ + vec4 color; +} x_12; + +layout(location = 0) out vec4 fragColor; +const vec4 _2_init = vec4(0.0); + +void main() +{ + fragColor = _2_init; + gl_SampleMask[0] = 0; + fragColor = x_12.color; + gl_SampleMask[0] = int(uint(6)); + gl_SampleMask[0] = int(uint(gl_SampleMask[0])); + uint _30_unrolled[1]; + for (int i = 0; i < int(1); i++) + { + _30_unrolled[i] = int(gl_SampleMask[i]); + } + for (int i = 0; i < int(1); i++) + { + gl_SampleMask[i] = int(_30_unrolled[i]); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag new file mode 100644 index 0000000000..a6f3e69441 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _17; + _17 = vec4(1.0); + FragColor = _17; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag new file mode 100644 index 0000000000..5fa822b39f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag @@ -0,0 +1,28 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct PSInput +{ + highp vec4 color; + highp vec2 uv; +}; + +uniform mediump sampler2D SPIRV_Cross_CombinedtexSamp; + +layout(location = 0) in highp vec4 in_var_COLOR; +layout(location = 1) in highp vec2 in_var_TEXCOORD0; +layout(location = 0) out highp vec4 out_var_SV_TARGET; + +highp vec4 src_PSMain(PSInput _input) +{ + vec4 a = _input.color * texture(SPIRV_Cross_CombinedtexSamp, _input.uv); + return a; +} + +void main() +{ + PSInput param_var_input = PSInput(in_var_COLOR, in_var_TEXCOORD0); + out_var_SV_TARGET = src_PSMain(param_var_input); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag new file mode 100644 index 0000000000..140a336deb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag @@ -0,0 +1,71 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif + +struct MyConsts +{ + uint opt; +}; + +uvec4 _37; + +layout(binding = 3, std140) uniform type_scene +{ + MyConsts myConsts; +} scene; + +uniform sampler2D SPIRV_Cross_CombinedtexTablemySampler[1]; + +layout(location = 1) out uint out_var_SV_TARGET1; + +void main() +{ + uint _42; + bool _47; + float _55; + do + { + _42 = _37.y & 16777215u; + _47 = scene.myConsts.opt != 0u; + SPIRV_CROSS_BRANCH + if (_47) + { + _55 = 1.0; + break; + } + else + { + _55 = textureLod(SPIRV_Cross_CombinedtexTablemySampler[_42], vec2(0.0), 0.0).x; + break; + } + break; // unreachable workaround + } while(false); + float _66; + do + { + SPIRV_CROSS_BRANCH + if (_47) + { + _66 = 1.0; + break; + } + else + { + _66 = textureLod(SPIRV_Cross_CombinedtexTablemySampler[_42], vec2(0.0), 0.0).x; + break; + } + break; // unreachable workaround + } while(false); + out_var_SV_TARGET1 = uint(cross(vec3(-1.0, -1.0, _55), vec3(1.0, 1.0, _66)).x); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag new file mode 100644 index 0000000000..f01a3282f1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag @@ -0,0 +1,27 @@ +#version 450 + +layout(binding = 0, std430) readonly buffer SSBO +{ + float values0[]; +} _5; + +layout(binding = 1, std430) readonly buffer SSBO1 +{ + float values1[]; +} _7; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + vec2 _27; + _27 = vec2(0.0); + vec2 _39; + vec2 _40; + vec2 _41; + for (int _30 = 0; _30 < 16; _39 = _27 * _27, _40 = _39, _40.x = _5.values0[_30], _41 = _40, _41.y = _7.values1[_30], _27 += _41, _30++) + { + } + FragColor = _27; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag new file mode 100644 index 0000000000..37b66f8c3d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag @@ -0,0 +1,29 @@ +#version 450 + +layout(binding = 0, std430) readonly buffer SSBO +{ + float values0[]; +} _5; + +layout(binding = 1, std430) readonly buffer SSBO1 +{ + float values1[]; +} _7; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + vec2 _27; + _27 = vec2(0.0); + vec2 _42; + for (int _30 = 0; _30 < 16; _27 += _42, _30++) + { + vec2 _40 = _27 * _27; + _40.x = _5.values0[_30]; + _42 = _40; + _42.y = _7.values1[_30]; + } + FragColor = _27; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..11c1f4ca3c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,73 @@ +#version 310 es +precision mediump float; +precision highp int; + +vec4 _32; + +layout(location = 0) in vec4 vInput; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _37 = vInput; + highp vec4 _38 = _37; + _38.x = 1.0; + _38.y = 2.0; + _38.z = 3.0; + _38.w = 4.0; + FragColor = _38; + vec4 _6 = _37; + _6.x = 1.0; + _6.y = 2.0; + _6.z = 3.0; + _6.w = 4.0; + FragColor = _6; + highp vec4 _42 = _37; + _42.x = 1.0; + vec4 _10 = _42; + _10.y = 2.0; + highp vec4 _43 = _10; + _43.z = 3.0; + vec4 _11 = _43; + _11.w = 4.0; + FragColor = _11; + highp vec4 _44 = _37; + _44.x = 1.0; + highp vec4 _45 = _44; + _45.y = 2.0; + vec4 mp_copy_45 = _45; + highp vec4 _46 = _45; + _46.z = 3.0; + highp vec4 _47 = _46; + _47.w = 4.0; + vec4 mp_copy_47 = _47; + FragColor = _47 + _44; + FragColor = mp_copy_47 + mp_copy_45; + highp vec4 _49; + _49.x = 1.0; + _49.y = 2.0; + _49.z = 3.0; + _49.w = 4.0; + FragColor = _49; + highp vec4 _53 = vec4(0.0); + _53.x = 1.0; + FragColor = _53; + highp vec4 _54[2] = vec4[](vec4(0.0), vec4(0.0)); + _54[1].z = 1.0; + _54[0].w = 2.0; + FragColor = _54[0]; + FragColor = _54[1]; + highp mat4 _58 = mat4(vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); + _58[1].z = 1.0; + _58[2].w = 2.0; + FragColor = _58[0]; + FragColor = _58[1]; + FragColor = _58[2]; + FragColor = _58[3]; + highp vec4 PHI; + PHI = _46; + highp vec4 _65 = PHI; + _65.w = 4.0; + FragColor = _65; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag.vk new file mode 100644 index 0000000000..adde5fcbf4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag.vk @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) flat in int vA; +layout(location = 0) out vec4 FragColor; + +vec4 foobar(int a) +{ + if (a < 0) + { + demote; + } + return vec4(10.0); +} + +void main() +{ + int param = vA; + vec4 _25 = foobar(param); + FragColor = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag new file mode 100644 index 0000000000..0fe71f64b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) flat in int vA; +layout(location = 0) out vec4 FragColor; + +vec4 foobar(int a) +{ + if (a < 0) + { + discard; + } + return vec4(10.0); +} + +void main() +{ + int param = vA; + vec4 _25 = foobar(param); + FragColor = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag new file mode 100644 index 0000000000..2024c302ef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag @@ -0,0 +1,37 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec4 _GLF_color; + +void main() +{ + for (;;) + { + bool _32; + for (;;) + { + if (gl_FragCoord.x != gl_FragCoord.x) + { + _32 = true; + break; + } + if (false) + { + continue; + } + else + { + _32 = false; + break; + } + } + if (_32) + { + break; + } + _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..67587763ad --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +void main() +{ + int j = 0; + int i = 0; + do + { + j = ((j + i) + 1) * j; + i++; + } while (!(i == 20)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag new file mode 100644 index 0000000000..b03d5a4d7b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag @@ -0,0 +1,67 @@ +#version 450 + +vec4 _32; + +layout(binding = 0, std140) uniform type_gCBuffarrayIndex +{ + uint gArrayIndex; +} gCBuffarrayIndex; + +uniform sampler2D SPIRV_Cross_Combinedg_textureArray0SPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_Combinedg_textureArray1SPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_Combinedg_textureArray2SPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_Combinedg_textureArray3SPIRV_Cross_DummySampler; + +layout(location = 0) out vec4 out_var_SV_TARGET; + +void main() +{ + vec4 _80; + do + { + vec4 _77; + bool _78; + switch (gCBuffarrayIndex.gArrayIndex) + { + case 0u: + { + _77 = texelFetch(SPIRV_Cross_Combinedg_textureArray0SPIRV_Cross_DummySampler, ivec3(int(gl_FragCoord.x), int(gl_FragCoord.y), 0).xy, 0); + _78 = true; + break; + } + case 1u: + { + _77 = texelFetch(SPIRV_Cross_Combinedg_textureArray1SPIRV_Cross_DummySampler, ivec3(int(gl_FragCoord.x), int(gl_FragCoord.y), 0).xy, 0); + _78 = true; + break; + } + case 2u: + { + _77 = texelFetch(SPIRV_Cross_Combinedg_textureArray2SPIRV_Cross_DummySampler, ivec3(int(gl_FragCoord.x), int(gl_FragCoord.y), 0).xy, 0); + _78 = true; + break; + } + case 3u: + { + _77 = texelFetch(SPIRV_Cross_Combinedg_textureArray3SPIRV_Cross_DummySampler, ivec3(int(gl_FragCoord.x), int(gl_FragCoord.y), 0).xy, 0); + _78 = true; + break; + } + default: + { + _77 = _32; + _78 = false; + break; + } + } + if (_78) + { + _80 = _77; + break; + } + _80 = vec4(0.0, 1.0, 0.0, 1.0); + break; + } while(false); + out_var_SV_TARGET = _80; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..0d3958b5b0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,31 @@ +#version 450 + +struct EmptyStructTest +{ + int empty_struct_member; +}; + +struct EmptyStruct2Test +{ + EmptyStructTest _m0; +}; + +float GetValue(EmptyStruct2Test self) +{ + return 0.0; +} + +float GetValue_1(EmptyStruct2Test self) +{ + return 0.0; +} + +void main() +{ + EmptyStructTest _25 = EmptyStructTest(0); + EmptyStruct2Test emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(EmptyStruct2Test(_25)); + value = GetValue_1(EmptyStruct2Test(EmptyStructTest(0))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag new file mode 100644 index 0000000000..16c7dc3630 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag @@ -0,0 +1,11 @@ +#version 450 + +void main() +{ + int _13; + for (int _12 = 0; !(_12 == 16); _12 = _13) + { + _13 = _12 + 1; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag new file mode 100644 index 0000000000..b4c0631852 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag @@ -0,0 +1,11 @@ +#version 450 + +void main() +{ + int _13; + for (int _12 = 0; _12 != 16; _12 = _13) + { + _13 = _12 + 1; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..16c7dc3630 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +void main() +{ + int _13; + for (int _12 = 0; !(_12 == 16); _12 = _13) + { + _13 = _12 + 1; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..8b8d0c8580 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,12 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombinedTexSPIRV_Cross_DummySampler; + +layout(location = 0) flat in uvec3 in_var_TEXCOORD0; +layout(location = 0) out vec4 out_var_SV_Target0; + +void main() +{ + out_var_SV_Target0 = texelFetch(SPIRV_Cross_CombinedTexSPIRV_Cross_DummySampler, ivec2(in_var_TEXCOORD0.xy), int(in_var_TEXCOORD0.z)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag new file mode 100644 index 0000000000..874bc6de13 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag @@ -0,0 +1,213 @@ +#version 450 + +struct VertexOutput +{ + vec4 HPosition; + vec4 Uv_EdgeDistance1; + vec4 UvStuds_EdgeDistance2; + vec4 Color; + vec4 LightPosition_Fog; + vec4 View_Depth; + vec4 Normal_SpecPower; + vec3 Tangent; + vec4 PosLightSpace_Reflectance; + float studIndex; +}; + +struct Surface +{ + vec3 albedo; + vec3 normal; + float specular; + float gloss; + float reflectance; + float opacity; +}; + +struct SurfaceInput +{ + vec4 Color; + vec2 Uv; + vec2 UvStuds; +}; + +struct Globals +{ + mat4 ViewProjection; + vec4 ViewRight; + vec4 ViewUp; + vec4 ViewDir; + vec3 CameraPosition; + vec3 AmbientColor; + vec3 Lamp0Color; + vec3 Lamp0Dir; + vec3 Lamp1Color; + vec4 FogParams; + vec3 FogColor; + vec4 LightBorder; + vec4 LightConfig0; + vec4 LightConfig1; + vec4 LightConfig2; + vec4 LightConfig3; + vec4 RefractionBias_FadeDistance_GlowFactor; + vec4 OutlineBrightness_ShadowInfo; + vec4 ShadowMatrix0; + vec4 ShadowMatrix1; + vec4 ShadowMatrix2; +}; + +struct Params +{ + vec4 LqmatFarTilingFactor; +}; + +VertexOutput _121; +SurfaceInput _122; +vec2 _123; +vec4 _124; +Surface _125; +vec4 _192; +vec4 _219; +vec4 _297; + +layout(binding = 0, std140) uniform CB0 +{ + Globals CB0; +} _19; + +uniform sampler2D SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler; +uniform sampler2D SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler; +uniform sampler2D SPIRV_Cross_CombinedNormalDetailMapTextureNormalDetailMapSampler; +uniform sampler2D SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler; +uniform sampler2D SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler; +uniform sampler3D SPIRV_Cross_CombinedLightMapTextureLightMapSampler; +uniform sampler2D SPIRV_Cross_CombinedShadowMapTextureShadowMapSampler; +uniform samplerCube SPIRV_Cross_CombinedEnvironmentMapTextureEnvironmentMapSampler; + +layout(location = 0) in vec4 IN_Uv_EdgeDistance1; +layout(location = 1) in vec4 IN_UvStuds_EdgeDistance2; +layout(location = 2) in vec4 IN_Color; +layout(location = 3) in vec4 IN_LightPosition_Fog; +layout(location = 4) in vec4 IN_View_Depth; +layout(location = 5) in vec4 IN_Normal_SpecPower; +layout(location = 6) in vec3 IN_Tangent; +layout(location = 7) in vec4 IN_PosLightSpace_Reflectance; +layout(location = 8) in float IN_studIndex; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + VertexOutput _128; + _128.HPosition = gl_FragCoord; + _128.Uv_EdgeDistance1 = IN_Uv_EdgeDistance1; + _128.UvStuds_EdgeDistance2 = IN_UvStuds_EdgeDistance2; + _128.Color = IN_Color; + _128.LightPosition_Fog = IN_LightPosition_Fog; + _128.View_Depth = IN_View_Depth; + _128.Normal_SpecPower = IN_Normal_SpecPower; + _128.Tangent = IN_Tangent; + _128.PosLightSpace_Reflectance = IN_PosLightSpace_Reflectance; + _128.studIndex = IN_studIndex; + SurfaceInput _147; + _147.Color = IN_Color; + _147.Uv = IN_Uv_EdgeDistance1.xy; + _147.UvStuds = IN_UvStuds_EdgeDistance2.xy; + _147.UvStuds.y = (fract(_147.UvStuds.y) + IN_studIndex) * 0.25; + float _160 = clamp(1.0 - (_128.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0); + float _163 = _128.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y; + float _165 = clamp(1.0 - _163, 0.0, 1.0); + vec2 _166 = IN_Uv_EdgeDistance1.xy * 1.0; + bool _173; + vec4 _193; + for (;;) + { + _173 = 0.0 == 0.0; + if (_173) + { + _193 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166); + break; + } + else + { + float _180 = 1.0 / (1.0 - 0.0); + _193 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((_160 * _180) - (0.0 * _180), 0.0, 1.0))); + break; + } + _193 = _192; + break; + } + vec4 _220; + for (;;) + { + if (_173) + { + _220 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166); + break; + } + else + { + float _207 = 1.0 / (1.0 - 0.0); + _220 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0))); + break; + } + _220 = _219; + break; + } + vec2 _223 = vec2(1.0); + vec2 _224 = (_220.wy * 2.0) - _223; + vec3 _232 = vec3(_224, sqrt(clamp(1.0 + dot(-_224, _224), 0.0, 1.0))); + vec4 _237 = texture(SPIRV_Cross_CombinedNormalDetailMapTextureNormalDetailMapSampler, _166 * 0.0); + vec2 _240 = (_237.wy * 2.0) - _223; + vec2 _252 = _232.xy + (vec3(_240, sqrt(clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0); + vec3 _253 = vec3(_252.x, _252.y, _232.z); + vec2 _255 = _253.xy * _165; + vec3 _256 = vec3(_255.x, _255.y, _253.z); + vec4 _268 = texture(SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler, _147.UvStuds); + vec3 _271 = ((IN_Color.xyz * (_193 * 1.0).xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (_268.x * 2.0); + vec4 _298; + for (;;) + { + if (0.75 == 0.0) + { + _298 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166); + break; + } + else + { + float _285 = 1.0 / (1.0 - 0.75); + _298 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0))); + break; + } + _298 = _297; + break; + } + vec2 _303 = mix(vec2(0.800000011920928955078125, 120.0), (_298.xy * vec2(2.0, 256.0)) + vec2(0.0, 0.00999999977648258209228515625), vec2(_165)); + Surface _304; + _304.albedo = _271; + _304.normal = _256; + float _306 = _303.x; + _304.specular = _306; + float _308 = _303.y; + _304.gloss = _308; + float _312 = (_298.xy.y * _165) * 0.0; + _304.reflectance = _312; + vec4 _318 = vec4(_271, _128.Color.w); + vec3 _329 = normalize(((IN_Tangent * _304.normal.x) + (cross(IN_Normal_SpecPower.xyz, IN_Tangent) * _304.normal.y)) + (IN_Normal_SpecPower.xyz * _304.normal.z)); + vec3 _332 = -_19.CB0.Lamp0Dir; + float _333 = dot(_329, _332); + float _357 = clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), vec3(1.0)), 0.0, 1.0); + vec4 _368 = mix(texture(SPIRV_Cross_CombinedLightMapTextureLightMapSampler, IN_LightPosition_Fog.xyz.yzx - (IN_LightPosition_Fog.xyz.yzx * _357)), _19.CB0.LightBorder, vec4(_357)); + vec2 _376 = texture(SPIRV_Cross_CombinedShadowMapTextureShadowMapSampler, IN_PosLightSpace_Reflectance.xyz.xy).xy; + float _392 = (1.0 - (((step(_376.x, IN_PosLightSpace_Reflectance.xyz.z) * clamp(9.0 - (20.0 * abs(IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w; + vec3 _403 = mix(_318.xyz, texture(SPIRV_Cross_CombinedEnvironmentMapTextureEnvironmentMapSampler, reflect(-IN_View_Depth.xyz, _329)).xyz, vec3(_312)); + vec3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * max(-_333, 0.0))) * _392)) + _368.xyz) * vec4(_403.x, _403.y, _403.z, _318.w).xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(clamp(dot(_329, normalize(_332 + normalize(IN_View_Depth.xyz))), 0.0, 1.0), _308))); + vec4 _423 = vec4(_422.x, _422.y, _422.z, _124.w); + _423.w = vec4(_403.x, _403.y, _403.z, _318.w).w; + vec2 _435 = min(IN_Uv_EdgeDistance1.wz, IN_UvStuds_EdgeDistance2.wz); + float _439 = min(_435.x, _435.y) / _163; + vec3 _445 = _423.xyz * clamp((clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0); + vec4 _446 = vec4(_445.x, _445.y, _445.z, _423.w); + vec3 _453 = mix(_19.CB0.FogColor, _446.xyz, vec3(clamp(_128.LightPosition_Fog.w, 0.0, 1.0))); + _entryPointOutput = vec4(_453.x, _453.y, _453.z, _446.w); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag new file mode 100644 index 0000000000..ed853d0125 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag @@ -0,0 +1,263 @@ +#version 320 es +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif +precision mediump float; +precision highp int; + +layout(binding = 0, std140) uniform buf0 +{ + highp vec2 resolution; +} _7; + +layout(location = 0) out highp vec4 _GLF_color; +int map[256]; +highp mat2x4 _60 = mat2x4(vec4(0.0), vec4(0.0)); + +void main() +{ + int _65 = 256 - 14; + int _68 = -_65; + highp vec2 pos = gl_FragCoord.xy / _7.resolution; + ivec2 ipos = ivec2(int(pos.x * 16.0), int(pos.y * 16.0)); + int i = 0; + for (; i < 256; i++) + { + map[i] = 0; + } + ivec2 p = ivec2(0); + int v = 0; + bool canwalk = true; + do + { + v++; + int directions = 0; + bool _98 = p.x > 0; + bool _111; + if (_98) + { + _111 = map[(p.x - 2) + (p.y * 16)] == 0; + } + else + { + _111 = _98; + } + if (_111) + { + directions++; + } + bool _118 = p.y > 0; + bool _131; + if (_118) + { + _131 = map[p.x + ((p.y - 2) * 16)] == 0; + } + else + { + _131 = _118; + } + if (_131) + { + directions++; + } + bool _138 = p.x < 14; + bool _151; + if (_138) + { + _151 = map[(p.x + 2) + (p.y * 16)] == 0; + } + else + { + _151 = _138; + } + if (_151) + { + directions++; + } + int _156 = 256 - _68; + bool _159 = p.y < 14; + bool _172; + if (_159) + { + _172 = map[p.x + ((p.y + 2) * 16)] == 0; + } + else + { + _172 = _159; + } + if (_172) + { + directions++; + } + if (directions == 0) + { + canwalk = false; + i = 0; + for (;;) + { + int _186 = i; + if (_186 < 8) + { + int j = 0; + _60 = mat2x4(vec4(0.0), vec4(0.0)); + if (false) + { + int _216 = i; + i = _216 + 1; + continue; + } + else + { + SPIRV_CROSS_UNROLL + for (; j < 8; j++) + { + if (map[(j * 2) + ((i * 2) * 16)] == 0) + { + p.x = j * 2; + p.y = i * 2; + canwalk = true; + } + } + int _216 = i; + i = _216 + 1; + continue; + } + } + else + { + break; + } + } + map[p.x + (p.y * 16)] = 1; + } + else + { + int d = v % directions; + v += directions; + bool _232 = d >= 0; + bool _238; + if (_232) + { + _238 = p.x > 0; + } + else + { + _238 = _232; + } + bool _251; + if (_238) + { + _251 = map[(p.x - 2) + (p.y * 16)] == 0; + } + else + { + _251 = _238; + } + if (_251) + { + d--; + map[p.x + (p.y * 16)] = 1; + map[(p.x - 1) + (p.y * 16)] = 1; + map[(p.x - 2) + (p.y * 16)] = 1; + p.x -= 2; + } + bool _284 = d >= 0; + bool _290; + if (_284) + { + _290 = p.y > 0; + } + else + { + _290 = _284; + } + bool _303; + if (_290) + { + _303 = map[p.x + ((p.y - 2) * 16)] == 0; + } + else + { + _303 = _290; + } + if (_303) + { + d--; + map[p.x + (p.y * 16)] = 1; + map[p.x + ((p.y - 1) * 16)] = 1; + map[p.x + ((p.y - 2) * 16)] = 1; + p.y -= 2; + } + bool _336 = d >= 0; + bool _342; + if (_336) + { + _342 = p.x < 14; + } + else + { + _342 = _336; + } + bool _355; + if (_342) + { + _355 = map[(p.x + 2) + (p.y * 16)] == 0; + } + else + { + _355 = _342; + } + if (_355) + { + d--; + map[p.x + (p.y * 16)] = 1; + map[(p.x + 1) + (p.y * 16)] = 1; + map[(p.x + 2) + (p.y * 16)] = 1; + p.x += 2; + } + bool _388 = d >= 0; + bool _394; + if (_388) + { + _394 = p.y < 14; + } + else + { + _394 = _388; + } + bool _407; + if (_394) + { + _407 = map[p.x + ((p.y + 2) * 16)] == 0; + } + else + { + _407 = _394; + } + if (_407) + { + d--; + map[p.x + (p.y * 16)] = 1; + map[p.x + ((p.y + 1) * 16)] = 1; + map[p.x + ((p.y + 2) * 16)] = 1; + p.y += 2; + } + } + if (map[(ipos.y * 16) + ipos.x] == 1) + { + _GLF_color = vec4(1.0); + return; + } + } while (canwalk); + _GLF_color = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag new file mode 100644 index 0000000000..6522c651c8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag @@ -0,0 +1,54 @@ +#version 310 es +precision mediump float; +precision highp int; + +const mat4 _34[4] = mat4[](mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)), mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)), mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0)), mat4(vec4(1.0), vec4(1.0), vec4(1.0), vec4(1.0))); + +layout(location = 0) out highp vec4 _GLF_color; + +void main() +{ + for (;;) + { + if (gl_FragCoord.x < 10.0) + { + _GLF_color = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + for (int _46 = 0; _46 < 4; _46++) + { + int _53; + _53 = 0; + bool _56; + for (;;) + { + _56 = _53 < 4; + if (_56) + { + if (distance(vec2(1.0), vec2(1.0) / vec2(_34[int(_56)][_46].w)) < 1.0) + { + _GLF_color = vec4(1.0); + int _54 = _53 + 1; + _53 = _54; + continue; + } + else + { + int _54 = _53 + 1; + _53 = _54; + continue; + } + int _54 = _53 + 1; + _53 = _54; + continue; + } + else + { + break; + } + } + } + break; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag new file mode 100644 index 0000000000..4ce9b25357 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec4 _GLF_color; + +void main() +{ + mediump uvec4 _4 = uvec4(bitCount(uvec4(1u))); + uvec4 hp_copy_4 = _4; + _GLF_color = ldexp(vec4(1.0), ivec4(hp_copy_4)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..55db70cf6f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 v0; + +void main() +{ + FragColor = vec4(1.0); + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) + { + FragColor += vec4(v0[(i + j) & 3]); + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag.vk new file mode 100644 index 0000000000..d2f964674f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag.vk @@ -0,0 +1,20 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(set = 0, binding = 0, std430) readonly buffer SSBO +{ + uint indices[]; +} _8; + +layout(set = 0, binding = 0) uniform sampler2D uSamplers[]; +layout(set = 1, binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = textureLod(uSamplers[nonuniformEXT(_8.indices[10])], vUV, 0.0); + FragColor += textureLod(uSampler, vUV, float(_8.indices[int(gl_FragCoord.y)])); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag.vk new file mode 100644 index 0000000000..289f576f6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag.vk @@ -0,0 +1,37 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(set = 0, binding = 2, std140) uniform UBO +{ + vec4 v[64]; +} ubos[]; + +layout(set = 0, binding = 3, std430) readonly buffer SSBO +{ + vec4 v[]; +} ssbos[]; + +layout(set = 0, binding = 0) uniform texture2D uSamplers[]; +layout(set = 0, binding = 1) uniform sampler uSamps[]; +layout(set = 0, binding = 4) uniform sampler2D uCombinedSamplers[]; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; +layout(location = 1) in vec2 vUV; + +void main() +{ + int i = vIndex; + int _59 = i + 10; + int _64 = i + 40; + FragColor = texture(nonuniformEXT(sampler2D(uSamplers[_59], uSamps[_64])), vUV); + int _71 = i + 10; + FragColor = texture(uCombinedSamplers[nonuniformEXT(_71)], vUV); + int _77 = i + 20; + int _80 = i + 40; + FragColor += ubos[nonuniformEXT(_77)].v[_80]; + int _87 = i + 50; + int _90 = i + 60; + FragColor += ssbos[nonuniformEXT(_87)].v[_90]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag.vk new file mode 100644 index 0000000000..2d98ec5fdf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag.vk @@ -0,0 +1,24 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(set = 0, binding = 3, std430) buffer SSBO +{ + uint counter; + vec4 v[]; +} ssbos[]; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + int i = vIndex; + int _42 = i + 60; + int _45 = i + 70; + ssbos[nonuniformEXT(_42)].v[_45] = vec4(20.0); + int _48 = i + 100; + uint _49 = atomicAdd(ssbos[nonuniformEXT(_48)].counter, 100u); + int _51 = i; + FragColor.z += float(int(uint(ssbos[nonuniformEXT(_51)].v.length()))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..1041f711f8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,8 @@ +#version 450 + +const float _3_init = 0.5; +void main() +{ + gl_FragDepth = _3_init; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag new file mode 100644 index 0000000000..745922871b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag @@ -0,0 +1,20 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSampled; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = vec4(0.0); + if (gl_FragCoord.x < 10.0) + { + FragColor += texelFetch(uSampled, ivec2(vUV), 0); + } + else + { + FragColor += texelFetch(uSampled, ivec2(vUV), 1); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag new file mode 100644 index 0000000000..22d72a6e48 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag @@ -0,0 +1,25 @@ +#version 450 + +struct Foo +{ + vec4 a; +}; + +struct Bar +{ + Foo foo; + Foo foo2; +}; + +layout(binding = 0, std140) uniform UBO +{ + Bar bar; +} _7; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = _7.bar.foo.a + _7.bar.foo2.a; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag.vk new file mode 100644 index 0000000000..ae9a8d6905 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag.vk @@ -0,0 +1,29 @@ +#version 450 + +layout(location = 0) in mediump float b; +layout(location = 0) out float FragColor; + +void main() +{ + float hp_copy_7; + mediump float _7; + int _22; + _22 = 0; + _7 = 0.0; + for (;;) + { + hp_copy_7 = _7; + int _23 = _22 + 1; + if (_23 < 4) + { + _22 = _23; + _7 = fma(_7, b, b); + } + else + { + break; + } + } + FragColor = hp_copy_7 * 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..59bac99454 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,30 @@ +#version 450 + +int uninit_int = 0; +ivec4 uninit_vector = ivec4(0); +mat4 uninit_matrix = mat4(vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); + +struct Foo +{ + int a; +}; + +Foo uninit_foo = Foo(0); + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + int _39 = 0; + if (vColor.x > 10.0) + { + _39 = 10; + } + else + { + _39 = 20; + } + FragColor = vColor; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag new file mode 100644 index 0000000000..7ba3fd5581 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag @@ -0,0 +1,51 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +} _7; + +layout(binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +} _9; + +void callee2() +{ + int _31 = int(gl_FragCoord.x); + _7.values1[_31]++; +} + +void callee() +{ + int _39 = int(gl_FragCoord.x); + _9.values0[_39]++; + callee2(); +} + +void spvMainInterlockedBody() +{ + callee(); +} + +void main() +{ + // Interlocks were used in a way not compatible with GLSL, this is very slow. + SPIRV_Cross_beginInvocationInterlock(); + spvMainInterlockedBody(); + SPIRV_Cross_endInvocationInterlock(); +} diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag new file mode 100644 index 0000000000..3575e02c8b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag @@ -0,0 +1,65 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +} _7; + +layout(binding = 2, std430) buffer _12_13 +{ + uint _m0[]; +} _13; + +layout(binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +} _9; + +void callee2() +{ + int _44 = int(gl_FragCoord.x); + _7.values1[_44]++; +} + +void callee() +{ + int _52 = int(gl_FragCoord.x); + _9.values0[_52]++; + callee2(); + if (true) + { + } +} + +void _35() +{ + _13._m0[int(gl_FragCoord.x)] = 4u; +} + +void spvMainInterlockedBody() +{ + callee(); + _35(); +} + +void main() +{ + // Interlocks were used in a way not compatible with GLSL, this is very slow. + SPIRV_Cross_beginInvocationInterlock(); + spvMainInterlockedBody(); + SPIRV_Cross_endInvocationInterlock(); +} diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag new file mode 100644 index 0000000000..806eedf9fb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag @@ -0,0 +1,61 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +} _7; + +layout(binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +} _9; + +void callee2() +{ + int _37 = int(gl_FragCoord.x); + _7.values1[_37]++; +} + +void callee() +{ + int _45 = int(gl_FragCoord.x); + _9.values0[_45]++; + callee2(); +} + +void _29() +{ +} + +void _31() +{ +} + +void spvMainInterlockedBody() +{ + callee(); + _29(); + _31(); +} + +void main() +{ + // Interlocks were used in a way not compatible with GLSL, this is very slow. + SPIRV_Cross_beginInvocationInterlock(); + spvMainInterlockedBody(); + SPIRV_Cross_endInvocationInterlock(); +} diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag new file mode 100644 index 0000000000..6078efae88 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + float a = vColor.x; + highp float b = vColor.y; + int i = 0; + float _14; + highp float hp_copy_14; + float _15; + highp float hp_copy_15; + for (; i < 4; i++, _14 = a, hp_copy_14 = _14, _15 = a * _14, hp_copy_15 = _15, b += (hp_copy_15 * hp_copy_14)) + { + FragColor += vec4(1.0); + } + FragColor += vec4(b); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag new file mode 100644 index 0000000000..58de92a45b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) in float vColor; +layout(location = 0) out float FragColor; + +void main() +{ + float b; + highp float hp_copy_b; + do + { + b = vColor * vColor; + hp_copy_b = b; + } while (false); + FragColor = hp_copy_b * hp_copy_b; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag new file mode 100644 index 0000000000..5aef013e52 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag @@ -0,0 +1,55 @@ +#version 320 es +precision mediump float; +precision highp int; + +layout(binding = 0, std140) uniform UBO +{ + float mediump_float; + highp float highp_float; +} ubo; + +layout(location = 0) out vec4 FragColor0; +layout(location = 1) out vec4 FragColor1; +layout(location = 2) out vec4 FragColor2; +layout(location = 3) out vec4 FragColor3; +layout(location = 0) in vec4 V4; + +void main() +{ + highp float hp_copy_phi_mp; + float mp_copy_phi_hp; + vec4 V4_value0 = V4; + highp vec4 hp_copy_V4_value0 = V4_value0; + float V1_value0 = V4.x; + highp float hp_copy_V1_value0 = V1_value0; + float V1_value2 = V4_value0.z; + highp float hp_copy_V1_value2 = V1_value2; + float ubo_mp0 = ubo.mediump_float; + highp float hp_copy_ubo_mp0 = ubo_mp0; + highp float ubo_hp0 = ubo.highp_float; + float mp_copy_ubo_hp0 = ubo_hp0; + highp vec4 _48 = hp_copy_V4_value0 - vec4(3.0); + vec4 mp_copy_48 = _48; + FragColor0 = V4_value0 + vec4(3.0); + FragColor1 = _48; + FragColor2 = mp_copy_48 * vec4(3.0); + float _21 = V1_value0 + 3.0; + float float_0_weird = 3.0 - mp_copy_ubo_hp0; + highp float hp_copy_float_0_weird = float_0_weird; + highp float _49 = hp_copy_V1_value0 - hp_copy_float_0_weird; + float mp_copy_49 = _49; + FragColor3 = vec4(_21, _49, mp_copy_49 * mp_copy_ubo_hp0, 3.0); + highp float _51 = hp_copy_V1_value2 - hp_copy_ubo_mp0; + float mp_copy_51 = _51; + FragColor3 = vec4(V4_value0.z + ubo_mp0, _51, mp_copy_51 * mp_copy_ubo_hp0, 3.0); + FragColor0 = sin(hp_copy_V4_value0); + FragColor1 = sin(V4_value0); + float phi_mp; + highp float phi_hp; + phi_mp = _21; + phi_hp = _49; + hp_copy_phi_mp = phi_mp; + mp_copy_phi_hp = phi_hp; + FragColor2 = vec4(phi_mp + phi_mp, hp_copy_phi_mp + hp_copy_phi_mp, mp_copy_phi_hp + mp_copy_phi_hp, phi_hp + phi_hp); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..52f0c61661 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out float FragColor; + +float _mat3(float a) +{ + return a + 1.0; +} + +float _RESERVED_IDENTIFIER_FIXUP_gl_Foo(int a) +{ + return float(a) + 1.0; +} + +void main() +{ + float param = 2.0; + int param_1 = 4; + FragColor = _mat3(param) + _RESERVED_IDENTIFIER_FIXUP_gl_Foo(param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag new file mode 100644 index 0000000000..5d75a44a33 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) out vec4 _RESERVED_IDENTIFIER_FIXUP_spvFoo; +layout(location = 1) out vec4 SPIRV_Cross_blah; +layout(location = 2) out vec4 _40Bar; +layout(location = 3) out vec4 _m40; +layout(location = 4) out vec4 _underscore_foo_bar_meep_; + +void main() +{ + _RESERVED_IDENTIFIER_FIXUP_spvFoo = vec4(0.0); + SPIRV_Cross_blah = vec4(1.0); + _40Bar = vec4(2.0); + _m40 = vec4(3.0); + _underscore_foo_bar_meep_ = vec4(4.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..d74286a153 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,19 @@ +#version 450 + +struct _15 +{ + float _m0; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = false ? vec4(1.0, 1.0, 0.0, 1.0) : vec4(0.0, 0.0, 0.0, 1.0); + FragColor = vec4(false); + FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(1.0, 1.0, 0.0, 1.0), bvec4(false, true, false, true)); + FragColor = vec4(bvec4(false, true, false, true)); + _15 _32 = false ? _15(0.0) : _15(1.0); + float _33[2] = true ? float[](0.0, 1.0) : float[](1.0, 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..edbce0ccaf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 v0; + +void main() +{ + FragColor = vec4(1.0); + for (int i = 0; i < 4; i++) + { + if (v0.x == 20.0) + { + FragColor += vec4(v0[i & 3]); + } + else + { + FragColor += vec4(v0[i & 1]); + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag new file mode 100644 index 0000000000..540978c434 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag @@ -0,0 +1,23 @@ +#version 450 +#extension GL_ARB_sparse_texture2 : require + +struct ResType +{ + uint _m0; + vec4 _m1; +}; + +layout(binding = 0) uniform sampler2D uSamp; + +layout(location = 0) in vec2 vUV; + +void main() +{ + uint _30; + vec4 _31; + _30 = sparseTextureARB(uSamp, vUV, _31); + ResType _26 = ResType(_30, _31); + vec4 texel = _26._m1; + bool ret = sparseTexelsResidentARB(int(_26._m0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag.vk new file mode 100644 index 0000000000..130cab7d1a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag.vk @@ -0,0 +1,24 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require + +layout(location = 0) flat in int index; +layout(location = 0) out uint FragColor; + +void main() +{ + uint _17 = uint(index); + FragColor = uint(subgroupMin(index)); + FragColor = uint(subgroupMax(int(_17))); + FragColor = subgroupMin(uint(index)); + FragColor = subgroupMax(_17); + FragColor = uint(subgroupInclusiveMax(index)); + FragColor = uint(subgroupInclusiveMin(int(_17))); + FragColor = subgroupExclusiveMax(uint(index)); + FragColor = subgroupExclusiveMin(_17); + FragColor = uint(subgroupClusteredMin(index, 4u)); + FragColor = uint(subgroupClusteredMax(int(_17), 4u)); + FragColor = subgroupClusteredMin(uint(index), 4u); + FragColor = subgroupClusteredMax(_17, 4u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag new file mode 100644 index 0000000000..8a918c035c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag @@ -0,0 +1,32 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +layout(location = 0) flat in uint INDEX; +layout(location = 0) out uvec4 SV_Target; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +void main() +{ + uvec4 _21 = subgroupBallot(INDEX < 100u); + SV_Target.x = _21.x; + SV_Target.y = _21.y; + SV_Target.z = _21.z; + SV_Target.w = _21.w; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag.vk new file mode 100644 index 0000000000..ed5933f312 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag.vk @@ -0,0 +1,15 @@ +#version 450 +#extension GL_KHR_shader_subgroup_ballot : require + +layout(location = 0) flat in uint INDEX; +layout(location = 0) out uvec4 SV_Target; + +void main() +{ + uvec4 _21 = subgroupBallot(INDEX < 100u); + SV_Target.x = _21.x; + SV_Target.y = _21.y; + SV_Target.z = _21.z; + SV_Target.w = _21.w; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..de8090e317 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,63 @@ +#version 450 + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + int i; + int j; + int _30; + int _31; + if (vIndex != 0 && vIndex != 1 && vIndex != 11 && vIndex != 2 && vIndex != 3 && vIndex != 4 && vIndex != 5) + { + _30 = 2; + } + if (vIndex == 1 || vIndex == 11) + { + _31 = 1; + } + switch (vIndex) + { + case 0: + { + _30 = 3; + } + default: + { + j = _30; + _31 = 0; + } + case 1: + case 11: + { + j = _31; + } + case 2: + { + break; + } + case 3: + { + if (vIndex > 3) + { + i = 0; + break; + } + else + { + break; + } + } + case 4: + { + } + case 5: + { + i = 0; + break; + } + } + FragColor = vec4(float(i)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..88f76cf1d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag @@ -0,0 +1,30 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + for (int i = 0; i < 4; i++) + { + switch (i) + { + case 0: + { + FragColor.x += 1.0; + break; + } + case 1: + { + FragColor.y += 3.0; + break; + } + default: + { + FragColor.z += 3.0; + break; + } + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag new file mode 100644 index 0000000000..3315180965 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag @@ -0,0 +1,88 @@ +#version 450 + +struct _4 +{ + uint _m0; + int _m1; +}; + +struct _5 +{ + int _m0; + int _m1; +}; + +_4 _16; +int _21; + +layout(location = 0) flat in int _2; +layout(location = 0) out int _3; + +void main() +{ + bool _25 = false; + do + { + _5 _26; + _26._m0 = 0; + _26._m1 = 10; + _4 _35; + _35 = _16; + int _39; + _4 _36; + bool _59; + int _38 = 0; + for (;;) + { + if (_26._m0 < _26._m1) + { + int _27 = _26._m0; + int _28 = _26._m0 + int(1u); + _26._m0 = _28; + _36 = _4(1u, _27); + } + else + { + _4 _48 = _35; + _48._m0 = 0u; + _36 = _48; + } + bool _45_ladder_break = false; + switch (int(_36._m0)) + { + case 0: + { + _3 = _38; + _25 = true; + _59 = true; + _45_ladder_break = true; + break; + } + default: + { + _59 = false; + _45_ladder_break = true; + break; + } + case 1: + { + break; + } + } + if (_45_ladder_break) + { + break; + } + _39 = _38 + _2; + _35 = _36; + _38 = _39; + continue; + } + if (_59) + { + break; + } + break; + } while(false); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag new file mode 100644 index 0000000000..c9ddbe6899 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; +precision highp int; + +vec2 _19; + +layout(location = 0) out highp vec4 _GLF_color; + +void main() +{ + highp vec2 _30; + do + { + if (gl_FragCoord.x != gl_FragCoord.x) + { + _30 = _19; + break; + } + highp vec2 _29; + _29.y = _19.y; + _30 = _29; + break; + } while(false); + _GLF_color = vec4(_30, 1.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag new file mode 100644 index 0000000000..0fe71f64b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) flat in int vA; +layout(location = 0) out vec4 FragColor; + +vec4 foobar(int a) +{ + if (a < 0) + { + discard; + } + return vec4(10.0); +} + +void main() +{ + int param = vA; + vec4 _25 = foobar(param); + FragColor = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag new file mode 100644 index 0000000000..d62ccb8386 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSamp; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 _28 = ivec2(gl_FragCoord.xy); + FragColor.x = texelFetch(uSamp, _28, int(0u)).x; + FragColor.y = texelFetch(uSamp, _28, int(1u)).x; + FragColor.z = texelFetch(uSamp, _28, int(2u)).x; + FragColor.w = texelFetch(uSamp, _28, int(3u)).x; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.asm.frag new file mode 100644 index 0000000000..61122bbd3a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.asm.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(location = 0) in vec4 A; +layout(location = 1) in vec4 B; +layout(location = 0) out vec4 FragColor; + +vec4 test_vector() +{ + bvec4 le = not(greaterThanEqual(A, B)); + bvec4 leq = not(greaterThan(A, B)); + bvec4 ge = not(lessThanEqual(A, B)); + bvec4 geq = not(lessThan(A, B)); + bvec4 eq = not(notEqual(A, B)); + bvec4 neq = notEqual(A, B); + neq = notEqual(A, B); + return ((((vec4(le) + vec4(leq)) + vec4(ge)) + vec4(geq)) + vec4(eq)) + vec4(neq); +} + +float test_scalar() +{ + bool le = !(A.x >= B.x); + bool leq = !(A.x > B.x); + bool ge = !(A.x <= B.x); + bool geq = !(A.x < B.x); + bool eq = !(A.x != B.x); + bool neq = A.x != B.x; + return ((((float(le) + float(leq)) + float(ge)) + float(geq)) + float(eq)) + float(neq); +} + +void main() +{ + FragColor = test_vector() + vec4(test_scalar()); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag new file mode 100644 index 0000000000..24db7c9f88 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(location = 0) in vec4 A; +layout(location = 1) in vec4 B; +layout(location = 0) out vec4 FragColor; + +vec4 test_vector() +{ + bvec4 le = lessThan(A, B); + bvec4 leq = lessThanEqual(A, B); + bvec4 ge = greaterThan(A, B); + bvec4 geq = greaterThanEqual(A, B); + bvec4 eq = equal(A, B); + bvec4 neq = notEqual(A, B); + neq = notEqual(A, B); + return ((((vec4(le) + vec4(leq)) + vec4(ge)) + vec4(geq)) + vec4(eq)) + vec4(neq); +} + +float test_scalar() +{ + bool le = A.x < B.x; + bool leq = A.x <= B.x; + bool ge = A.x > B.x; + bool geq = A.x >= B.x; + bool eq = A.x == B.x; + bool neq = A.x != B.x; + return ((((float(le) + float(leq)) + float(ge)) + float(geq)) + float(eq)) + float(neq); +} + +void main() +{ + FragColor = test_vector() + vec4(test_scalar()); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag new file mode 100644 index 0000000000..d4f3acae09 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag @@ -0,0 +1,27 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 0 +#endif +const int omap_r = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1 +#endif +const int omap_g = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2 +#endif +const int omap_b = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +const int omap_a = SPIRV_CROSS_CONSTANT_ID_3; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = vec4(vColor[omap_r], vColor[omap_g], vColor[omap_b], vColor[omap_a]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..b6d3bc8490 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,12 @@ +#version 450 + +vec4 undef; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vFloat; + +void main() +{ + FragColor = vec4(undef.x, vFloat.y, 0.0, vFloat.w) + vec4(vFloat.z, vFloat.y, 0.0, vFloat.w); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..0dd9869195 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +void main() +{ + int i = 0; + int j = 0; + while (!(i == 20)) + { + j = ((j + i) + 1) * j; + i++; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom b/third_party/spirv-cross/reference/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom new file mode 100644 index 0000000000..c768d5da86 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom @@ -0,0 +1,41 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +struct VertexOutput +{ + vec4 pos; +}; + +struct GeometryOutput +{ + vec4 pos; + uint layer; +}; + +void _main(VertexOutput _input[3], GeometryOutput stream) +{ + GeometryOutput _output; + _output.layer = 1u; + for (int v = 0; v < 3; v++) + { + _output.pos = _input[v].pos; + gl_Position = _output.pos; + gl_Layer = int(_output.layer); + EmitVertex(); + } + EndPrimitive(); +} + +void main() +{ + VertexOutput _input[3]; + _input[0].pos = gl_in[0].gl_Position; + _input[1].pos = gl_in[1].gl_Position; + _input[2].pos = gl_in[2].gl_Position; + VertexOutput param[3] = _input; + GeometryOutput param_1; + _main(param, param_1); + GeometryOutput stream = param_1; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp new file mode 100644 index 0000000000..bd2a3c2736 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp @@ -0,0 +1,89 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 1u +#endif + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_0, local_size_y = SPIRV_CROSS_CONSTANT_ID_1, local_size_z = SPIRV_CROSS_CONSTANT_ID_2) in; + +layout(binding = 0, std430) buffer _4_6 +{ + float _m0[]; +} _6; + +layout(binding = 1, std430) buffer _4_7 +{ + float _m0[]; +} _7; + +uvec3 _28 = gl_WorkGroupSize; + +void main() +{ + float _44_copy; + float _46; + uint _47; + float _63; + uint _65; + float _36 = _6._m0[0u]; + uint _39 = 0u; + float _44; + for (;;) + { + _44 = _36; + _46 = _6._m0[35u]; + _47 = 0u; + for (;;) + { + uint _48 = _47 + 1u; + float _45 = _6._m0[_48]; + _6._m0[_47] = ((_46 + _44) + _45) / 3.0; + if (!(_47 < 34u)) + { + break; + } + else + { + _44_copy = _44; + _44 = _45; + _46 = _44_copy; + _47 = _48; + } + } + _6._m0[35u] = (_36 + (_44 + _6._m0[35u])) / 3.0; + if (!(_39 < 5u)) + { + _63 = _6._m0[0u]; + _65 = 1u; + break; + } + else + { + _36 = _6._m0[0u]; + _39++; + continue; + } + } + float _64; + for (;;) + { + _64 = (_63 < _6._m0[_65]) ? _6._m0[_65] : _63; + if (!(_65 < 35u)) + { + break; + } + else + { + _63 = _64; + _65++; + } + } + _7._m0[gl_GlobalInvocationID.x] = _64; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..5040aa4696 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh.vk @@ -0,0 +1,44 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 8, triangles) out; + +struct _12 +{ + float _m0; +}; + +layout(location = 1) out vec4 B[24]; +layout(location = 3) perprimitiveEXT out vec4 C[8]; +shared float _9[64]; +taskPayloadSharedEXT _12 _11; + +void main() +{ + _9[gl_LocalInvocationIndex] = float(gl_LocalInvocationIndex); + barrier(); + SetMeshOutputsEXT(24u, 8u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.x = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.y = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.z = _9[gl_LocalInvocationIndex]; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.w = _9[gl_LocalInvocationIndex]; + float _63 = _11._m0 + _9[gl_LocalInvocationIndex ^ 1u]; + B[gl_LocalInvocationIndex].x = _63; + B[gl_LocalInvocationIndex].y = _63; + B[gl_LocalInvocationIndex].z = _63; + B[gl_LocalInvocationIndex].w = _63; + if (gl_LocalInvocationIndex < 8u) + { + uint _71 = gl_LocalInvocationIndex * 3u; + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(_71, _71 + 1u, _71 + 2u); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_LocalInvocationIndex & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_LocalInvocationIndex); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_LocalInvocationIndex); + uint _81 = gl_LocalInvocationIndex ^ 2u; + C[gl_LocalInvocationIndex].x = _9[_81]; + C[gl_LocalInvocationIndex].y = _9[_81]; + C[gl_LocalInvocationIndex].z = _9[_81]; + C[gl_LocalInvocationIndex].w = _9[_81]; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen.vk new file mode 100644 index 0000000000..a72a7cf48a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen.vk @@ -0,0 +1,19 @@ +#version 460 +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_nonuniform_qualifier : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as[]; +layout(location = 0) rayPayloadEXT float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + uint _62 = gl_LaunchIDEXT.x; + traceRayEXT(as[nonuniformEXT(_62)], 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task.vk new file mode 100644 index 0000000000..1d491e7014 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task.vk @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 4, local_size_y = 3, local_size_z = 2) in; + +struct Payload +{ + float v[3]; +}; + +shared float vs[24]; +taskPayloadSharedEXT Payload p; + +void main() +{ + vs[gl_LocalInvocationIndex] = 10.0; + barrier(); + if (gl_LocalInvocationIndex < 12u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 12u]; + } + barrier(); + if (gl_LocalInvocationIndex < 6u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 6u]; + } + barrier(); + if (gl_LocalInvocationIndex < 3u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 3u]; + } + barrier(); + p.v[gl_LocalInvocationIndex] = vs[gl_LocalInvocationIndex]; + EmitMeshTasksEXT(uint(int(vs[4])), uint(int(vs[6])), uint(int(vs[8]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..1b8e8cd329 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,28 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int vA; +layout(location = 1) flat in mediump int vB; + +void main() +{ + FragColor = vec4(0.0); + mediump int _10 = 0; + mediump int _15 = 0; + for (mediump int _16 = 0, _17 = 0; _16 < vA; _17 = _15, _16 += _10) + { + if ((vA + _16) == 20) + { + _15 = 50; + } + else + { + _15 = ((vB + _16) == 40) ? 60 : _17; + } + _10 = _15 + 10; + FragColor += vec4(1.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc new file mode 100644 index 0000000000..13e1d3294b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc @@ -0,0 +1,82 @@ +#version 450 +layout(vertices = 4) out; + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +} gl_out[4]; + +layout(location = 0) patch out vert +{ + float v0; + float v1; +} _5; + +layout(location = 2) patch out vert_patch +{ + float v2; + float v3; +} patches[2]; + +layout(location = 6) patch out float v2; +layout(location = 7) out float v3[4]; +layout(location = 8) out vert2 +{ + float v4; + float v5; +} verts[4]; + +const vec4 _3_0_init[4] = vec4[](vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); +const float _3_1_init[4] = float[](0.0, 0.0, 0.0, 0.0); +const float _3_2_init[4][1] = float[][](float[](0.0), float[](0.0), float[](0.0), float[](0.0)); +const float _3_3_init[4][1] = float[][](float[](0.0), float[](0.0), float[](0.0), float[](0.0)); +const float _6_0_init[2] = float[](0.0, 0.0); +const float _6_1_init[2] = float[](0.0, 0.0); +const float _7_init = 0.0; +const float _8_init[4] = float[](0.0, 0.0, 0.0, 0.0); +const float _9_0_init[4] = float[](0.0, 0.0, 0.0, 0.0); +const float _9_1_init[4] = float[](0.0, 0.0, 0.0, 0.0); + +void main() +{ + gl_out[gl_InvocationID].gl_Position = _3_0_init[gl_InvocationID]; + gl_out[gl_InvocationID].gl_PointSize = _3_1_init[gl_InvocationID]; + gl_out[gl_InvocationID].gl_ClipDistance = _3_2_init[gl_InvocationID]; + gl_out[gl_InvocationID].gl_CullDistance = _3_3_init[gl_InvocationID]; + if (gl_InvocationID == 0) + { + _5.v0 = 0.0; + } + if (gl_InvocationID == 0) + { + _5.v1 = 0.0; + } + if (gl_InvocationID == 0) + { + patches[0].v2 = _6_0_init[0]; + } + if (gl_InvocationID == 0) + { + patches[1].v2 = _6_0_init[1]; + } + if (gl_InvocationID == 0) + { + patches[0].v3 = _6_1_init[0]; + } + if (gl_InvocationID == 0) + { + patches[1].v3 = _6_1_init[1]; + } + if (gl_InvocationID == 0) + { + v2 = _7_init; + } + v3[gl_InvocationID] = _8_init[gl_InvocationID]; + verts[gl_InvocationID].v4 = _9_0_init[gl_InvocationID]; + verts[gl_InvocationID].v5 = _9_1_init[gl_InvocationID]; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc new file mode 100644 index 0000000000..3412f1cf5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc @@ -0,0 +1,73 @@ +#version 450 +layout(vertices = 3) out; + +layout(binding = 0, std140) uniform cb1_struct +{ + vec4 _m0[1]; +} cb0_0; + +layout(location = 0) in vec4 v0[]; +layout(location = 1) in vec4 v1[]; +layout(location = 2) in vec3 vicp0[]; +layout(location = 3) out vec3 vocp0[3]; +layout(location = 4) in vec4 vicp1[]; +layout(location = 5) out vec4 vocp1[3]; +vec4 opc[4]; +vec4 vicp[2][3]; +vec4 _48; +vec4 _49; +vec4 _50; +vec4 _56; + +void fork0_epilogue(vec4 _87, vec4 _88, vec4 _89) +{ + gl_TessLevelOuter[0u] = _87.x; + gl_TessLevelOuter[1u] = _88.x; + gl_TessLevelOuter[2u] = _89.x; +} + +void fork0(uint vForkInstanceId) +{ + vec4 r0; + r0.x = uintBitsToFloat(vForkInstanceId); + opc[floatBitsToInt(r0.x)].x = cb0_0._m0[0u].x; + _48 = opc[0u]; + _49 = opc[1u]; + _50 = opc[2u]; + fork0_epilogue(_48, _49, _50); +} + +void fork1_epilogue(vec4 _109) +{ + gl_TessLevelInner[0u] = _109.x; +} + +void fork1() +{ + opc[3u].x = cb0_0._m0[0u].x; + _56 = opc[3u]; + fork1_epilogue(_56); +} + +void main() +{ + vec4 _126_unrolled[3]; + for (int i = 0; i < int(3); i++) + { + _126_unrolled[i] = v0[i]; + } + vicp[0u] = _126_unrolled; + vec4 _127_unrolled[3]; + for (int i = 0; i < int(3); i++) + { + _127_unrolled[i] = v1[i]; + } + vicp[1u] = _127_unrolled; + vocp0[gl_InvocationID] = vicp0[gl_InvocationID]; + vocp1[gl_InvocationID] = vicp1[gl_InvocationID]; + fork0(0u); + fork0(1u); + fork0(2u); + fork1(); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc new file mode 100644 index 0000000000..8cb7a4e64c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -0,0 +1,79 @@ +#version 450 +layout(vertices = 3) out; + +struct VertexOutput +{ + vec4 pos; + vec2 uv; +}; + +struct HSOut +{ + vec4 pos; + vec2 uv; +}; + +struct HSConstantOut +{ + float EdgeTess[3]; + float InsideTess; +}; + +struct VertexOutput_1 +{ + vec2 uv; +}; + +struct HSOut_1 +{ + vec2 uv; +}; + +layout(location = 0) in VertexOutput_1 p[]; +layout(location = 0) out HSOut_1 _entryPointOutput[3]; + +HSOut _hs_main(VertexOutput p_1[3], uint i) +{ + HSOut _output; + _output.pos = p_1[i].pos; + _output.uv = p_1[i].uv; + return _output; +} + +HSConstantOut PatchHS(VertexOutput _patch[3]) +{ + HSConstantOut _output; + _output.EdgeTess[0] = (vec2(1.0) + _patch[0].uv).x; + _output.EdgeTess[1] = (vec2(1.0) + _patch[0].uv).x; + _output.EdgeTess[2] = (vec2(1.0) + _patch[0].uv).x; + _output.InsideTess = (vec2(1.0) + _patch[0].uv).x; + return _output; +} + +void main() +{ + VertexOutput p_1[3]; + p_1[0].pos = gl_in[0].gl_Position; + p_1[0].uv = p[0].uv; + p_1[1].pos = gl_in[1].gl_Position; + p_1[1].uv = p[1].uv; + p_1[2].pos = gl_in[2].gl_Position; + p_1[2].uv = p[2].uv; + uint i = gl_InvocationID; + VertexOutput param[3] = p_1; + uint param_1 = i; + HSOut flattenTemp = _hs_main(param, param_1); + gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; + _entryPointOutput[gl_InvocationID].uv = flattenTemp.uv; + barrier(); + if (int(gl_InvocationID) == 0) + { + VertexOutput param_2[3] = p_1; + HSConstantOut _patchConstantResult = PatchHS(param_2); + gl_TessLevelOuter[0] = _patchConstantResult.EdgeTess[0]; + gl_TessLevelOuter[1] = _patchConstantResult.EdgeTess[1]; + gl_TessLevelOuter[2] = _patchConstantResult.EdgeTess[2]; + gl_TessLevelInner[0] = _patchConstantResult.InsideTess; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc new file mode 100644 index 0000000000..ebd2d8aeac --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc @@ -0,0 +1,24 @@ +#version 450 +layout(vertices = 4) out; + +const float _5_init[2] = float[](0.0, 0.0); +const float _6_init[4] = float[](0.0, 0.0, 0.0, 0.0); +void main() +{ + if (gl_InvocationID == 0) + { + gl_TessLevelInner = _5_init; + } + if (gl_InvocationID == 0) + { + gl_TessLevelOuter = _6_init; + } + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 2.0; + gl_TessLevelOuter[0] = 3.0; + gl_TessLevelOuter[1] = 4.0; + gl_TessLevelOuter[2] = 5.0; + gl_TessLevelOuter[3] = 6.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..6060888d81 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,24 @@ +#version 450 + +struct Foo +{ + float c; + float d; +}; + +layout(location = 0) out Vert +{ + float a; + float b; +} _3; + +layout(location = 2) out Foo foo; +const Foo _4_init = Foo(0.0, 0.0); + +void main() +{ + _3.a = 0.0; + _3.b = 0.0; + foo = _4_init; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..b449f08057 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,14 @@ +#version 450 + +out float gl_ClipDistance[1]; +out float gl_CullDistance[1]; + +void main() +{ + gl_Position = vec4(0.0); + gl_PointSize = 0.0; + gl_ClipDistance = float[](0.0); + gl_CullDistance = float[](0.0); + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert new file mode 100644 index 0000000000..03271409b7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert @@ -0,0 +1,35 @@ +#version 450 + +struct Struct_vec4 +{ + vec4 m0; +}; + +layout(binding = 0, std140) uniform UBO +{ + Struct_vec4 m0; + Struct_vec4 m1; +} ubo_binding_0; + +layout(location = 0) out VertexOut +{ + Struct_vec4 m0; + Struct_vec4 m1; +} output_location_0; + +layout(location = 2) out Struct_vec4 output_location_2; +layout(location = 3) out Struct_vec4 output_location_3; + +void main() +{ + Struct_vec4 c; + c.m0 = ubo_binding_0.m0.m0; + Struct_vec4 b; + b.m0 = ubo_binding_0.m1.m0; + gl_Position = c.m0 + b.m0; + output_location_0.m0 = c; + output_location_0.m1 = b; + output_location_2 = c; + output_location_3 = b; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert new file mode 100644 index 0000000000..280399b44d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert @@ -0,0 +1,33 @@ +#version 100 + +struct Struct_vec4 +{ + vec4 m0; +}; + +struct UBO +{ + Struct_vec4 m0; + Struct_vec4 m1; +}; + +uniform UBO ubo_binding_0; + +varying vec4 output_location_0_m0_m0; +varying vec4 output_location_0_m1_m0; +varying vec4 output_location_2_m0; +varying vec4 output_location_3_m0; + +void main() +{ + Struct_vec4 c; + c.m0 = ubo_binding_0.m0.m0; + Struct_vec4 b; + b.m0 = ubo_binding_0.m1.m0; + gl_Position = c.m0 + b.m0; + output_location_0_m0_m0 = c.m0; + output_location_0_m1_m0 = b.m0; + output_location_2_m0 = c.m0; + output_location_3_m0 = b.m0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert new file mode 100644 index 0000000000..a1fe3e50ac --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert @@ -0,0 +1,7 @@ +#version 450 + +void main() +{ + gl_Position = (vec4(1.0, 2.0, 3.0, 4.0) + vec4(5.0, 6.0, 7.0, 8.0)) + (vec4(1.0, 2.0, 3.0, 4.0) + vec4(4.0, 3.0, 8.0, 2.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert.vk b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert.vk new file mode 100644 index 0000000000..b90912d1cc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert.vk @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_debug_printf : require + +void main() +{ + debugPrintfEXT("Foo %f %f", 1.0, 2.0); + vec4 _17 = vec4(0.0, 0.0, 0.0, 1.0); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..8f786d49e1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,13 @@ +#version 450 + +struct Test +{ + int empty_struct_member; +}; + +void main() +{ + Test _14 = Test(0); + Test t = _14; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert new file mode 100644 index 0000000000..aa45a5d48c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert @@ -0,0 +1,10 @@ +#version 310 es + +layout(location = 0) out float a; + +void main() +{ + a = 5.0; + a = a * 2.0 + 1.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/semantic-decoration.asm.vert b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/semantic-decoration.asm.vert new file mode 100644 index 0000000000..9af0e241eb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/asm/vert/semantic-decoration.asm.vert @@ -0,0 +1,25 @@ +#version 450 + +struct VOut +{ + vec4 p; + vec4 c; +}; + +layout(location = 0) out vec4 _entryPointOutput_c; + +VOut _main() +{ + VOut v; + v.p = vec4(1.0); + v.c = vec4(2.0); + return v; +} + +void main() +{ + VOut flattenTemp = _main(); + gl_Position = flattenTemp.p; + _entryPointOutput_c = flattenTemp.c; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp new file mode 100644 index 0000000000..85fdcdba7d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp @@ -0,0 +1,38 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + i16vec4 inputs[]; +} _25; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +} _39; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + f16vec2 a = int16BitsToFloat16(_25.inputs[ident].xy); + _39.outputs[ident].x = int(packFloat2x16(a + f16vec2(float16_t(1.0)))); + _39.outputs[ident].y = packInt2x16(_25.inputs[ident].zw); + _39.outputs[ident].z = int(packUint2x16(u16vec2(_25.inputs[ident].xy))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp new file mode 100644 index 0000000000..506d4e5578 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp @@ -0,0 +1,47 @@ +#version 450 +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer SSBO1 +{ + i16vec4 outputs[]; +} _21; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +} _29; + +layout(binding = 2, std140) uniform UBO +{ + f16vec4 const0; +} _40; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + int _33 = _29.inputs[ident].x; + i16vec2 _47 = unpackInt2x16(_33) + float16BitsToInt16(_40.const0.xy); + _21.outputs[ident].x = _47.x; + _21.outputs[ident].y = _47.y; + int _57 = _29.inputs[ident].y; + i16vec2 _67 = i16vec2(unpackUint2x16(uint(_57)) - float16BitsToUint16(_40.const0.zw)); + _21.outputs[ident].z = _67.x; + _21.outputs[ident].w = _67.y; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/bitfield.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..49bbddb0ab --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/bitfield.comp @@ -0,0 +1,19 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + int signed_value = 0; + uint unsigned_value = 0u; + int s = bitfieldExtract(signed_value, 5, 20); + uint u = bitfieldExtract(unsigned_value, 6, 21); + s = bitfieldInsert(s, 40, 5, 4); + u = bitfieldInsert(u, 60u, 5, 4); + u = bitfieldReverse(u); + s = bitfieldReverse(s); + int v0 = bitCount(u); + int v1 = bitCount(s); + int v2 = findMSB(u); + int v3 = findLSB(s); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/glsl.std450.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/glsl.std450.comp new file mode 100644 index 0000000000..d2628a9ab6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/glsl.std450.comp @@ -0,0 +1,112 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct ResType +{ + float _m0; + int _m1; +}; + +layout(binding = 0, std430) buffer SSBO +{ + float res; + int ires; + uint ures; + vec4 f32; + ivec4 s32; + uvec4 u32; + mat2 m2; + mat3 m3; + mat4 m4; +} _19; + +void main() +{ + _19.res = round(_19.f32.x); + _19.res = roundEven(_19.f32.x); + _19.res = trunc(_19.f32.x); + _19.res = abs(_19.f32.x); + _19.ires = abs(_19.s32.x); + _19.res = sign(_19.f32.x); + _19.ires = sign(_19.s32.x); + _19.res = floor(_19.f32.x); + _19.res = ceil(_19.f32.x); + _19.res = fract(_19.f32.x); + _19.res = radians(_19.f32.x); + _19.res = degrees(_19.f32.x); + _19.res = sin(_19.f32.x); + _19.res = cos(_19.f32.x); + _19.res = tan(_19.f32.x); + _19.res = asin(_19.f32.x); + _19.res = acos(_19.f32.x); + _19.res = atan(_19.f32.x); + _19.res = sinh(_19.f32.x); + _19.res = cosh(_19.f32.x); + _19.res = tanh(_19.f32.x); + _19.res = asinh(_19.f32.x); + _19.res = acosh(_19.f32.x); + _19.res = atanh(_19.f32.x); + _19.res = atan(_19.f32.x, _19.f32.y); + _19.res = pow(_19.f32.x, _19.f32.y); + _19.res = exp(_19.f32.x); + _19.res = log(_19.f32.x); + _19.res = exp2(_19.f32.x); + _19.res = log2(_19.f32.x); + _19.res = sqrt(_19.f32.x); + _19.res = inversesqrt(_19.f32.x); + _19.res = length(_19.f32.x); + _19.res = distance(_19.f32.x, _19.f32.y); + _19.res = normalize(_19.f32.x); + _19.res = faceforward(_19.f32.x, _19.f32.y, _19.f32.z); + _19.res = reflect(_19.f32.x, _19.f32.y); + _19.res = refract(_19.f32.x, _19.f32.y, _19.f32.z); + _19.res = length(_19.f32.xy); + _19.res = distance(_19.f32.xy, _19.f32.zw); + vec2 v2 = normalize(_19.f32.xy); + v2 = faceforward(_19.f32.xy, _19.f32.yz, _19.f32.zw); + v2 = reflect(_19.f32.xy, _19.f32.zw); + v2 = refract(_19.f32.xy, _19.f32.yz, _19.f32.w); + vec3 v3 = cross(_19.f32.xyz, _19.f32.yzw); + _19.res = determinant(_19.m2); + _19.res = determinant(_19.m3); + _19.res = determinant(_19.m4); + _19.m2 = inverse(_19.m2); + _19.m3 = inverse(_19.m3); + _19.m4 = inverse(_19.m4); + float tmp; + float _287 = modf(_19.f32.x, tmp); + _19.res = _287; + _19.res = min(_19.f32.x, _19.f32.y); + _19.ures = min(_19.u32.x, _19.u32.y); + _19.ires = min(_19.s32.x, _19.s32.y); + _19.res = max(_19.f32.x, _19.f32.y); + _19.ures = max(_19.u32.x, _19.u32.y); + _19.ires = max(_19.s32.x, _19.s32.y); + _19.res = clamp(_19.f32.x, _19.f32.y, _19.f32.z); + _19.ures = clamp(_19.u32.x, _19.u32.y, _19.u32.z); + _19.ires = clamp(_19.s32.x, _19.s32.y, _19.s32.z); + _19.res = mix(_19.f32.x, _19.f32.y, _19.f32.z); + _19.res = step(_19.f32.x, _19.f32.y); + _19.res = smoothstep(_19.f32.x, _19.f32.y, _19.f32.z); + _19.res = fma(_19.f32.x, _19.f32.y, _19.f32.z); + ResType _387; + _387._m0 = frexp(_19.f32.x, _387._m1); + int itmp = _387._m1; + _19.res = _387._m0; + _19.res = ldexp(_19.f32.x, itmp); + _19.ures = packSnorm4x8(_19.f32); + _19.ures = packUnorm4x8(_19.f32); + _19.ures = packSnorm2x16(_19.f32.xy); + _19.ures = packUnorm2x16(_19.f32.xy); + _19.ures = packHalf2x16(_19.f32.xy); + v2 = unpackSnorm2x16(_19.u32.x); + v2 = unpackUnorm2x16(_19.u32.x); + v2 = unpackHalf2x16(_19.u32.x); + vec4 v4 = unpackSnorm4x8(_19.u32.x); + v4 = unpackUnorm4x8(_19.u32.x); + _19.s32 = findLSB(_19.s32); + _19.s32 = findLSB(_19.u32); + _19.s32 = findMSB(_19.s32); + _19.s32 = findMSB(_19.u32); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..885dcb3baa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,22 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + float _abs; +}; + +layout(binding = 0, std430) buffer SSBO +{ + Foo foo; + Foo foo2; +} _7; + +void main() +{ + Foo f; + f._abs = _7.foo._abs; + int _abs = 10; + _7.foo2._abs = f._abs; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/image-load-formatted.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/image-load-formatted.comp new file mode 100644 index 0000000000..e11b8febfa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/image-load-formatted.comp @@ -0,0 +1,12 @@ +#version 450 +#extension GL_EXT_shader_image_load_formatted : require +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) uniform image2D img; + +void main() +{ + vec4 v = imageLoad(img, ivec2(gl_GlobalInvocationID.xy)); + imageStore(img, ivec2(gl_GlobalInvocationID.xy), v + vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/inout-struct.invalid.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/inout-struct.invalid.comp new file mode 100644 index 0000000000..640e25bb95 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/inout-struct.invalid.comp @@ -0,0 +1,65 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +layout(binding = 1, std430) readonly buffer SSBO2 +{ + vec4 data[]; +} indata; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + vec4 data[]; +} outdata; + +layout(binding = 2, std430) readonly buffer SSBO3 +{ + Foo foos[]; +} foobar; + +void baz(inout Foo foo) +{ + uint ident = gl_GlobalInvocationID.x; + foo.a = indata.data[(4u * ident) + 0u]; + foo.b = indata.data[(4u * ident) + 1u]; + foo.c = indata.data[(4u * ident) + 2u]; + foo.d = indata.data[(4u * ident) + 3u]; +} + +void meow(inout Foo foo) +{ + foo.a += vec4(10.0); + foo.b += vec4(20.0); + foo.c += vec4(30.0); + foo.d += vec4(40.0); +} + +vec4 bar(Foo foo) +{ + return ((foo.a + foo.b) + foo.c) + foo.d; +} + +void main() +{ + Foo param; + baz(param); + Foo foo = param; + Foo param_1 = foo; + meow(param_1); + foo = param_1; + Foo param_2 = foo; + Foo param_3; + param_3.a = foobar.foos[gl_GlobalInvocationID.x].a; + param_3.b = foobar.foos[gl_GlobalInvocationID.x].b; + param_3.c = foobar.foos[gl_GlobalInvocationID.x].c; + param_3.d = foobar.foos[gl_GlobalInvocationID.x].d; + outdata.data[gl_GlobalInvocationID.x] = bar(param_2) + bar(param_3); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/int16min-literal.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/int16min-literal.comp new file mode 100644 index 0000000000..f4bae2fec6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/int16min-literal.comp @@ -0,0 +1,36 @@ +#version 450 +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std140) uniform UBO +{ + float16_t b; +} _12; + +layout(binding = 1, std430) buffer SSBO +{ + float16_t a; +} _24; + +void main() +{ + int16_t v = float16BitsToInt16(_12.b); + v ^= (-32768s); + _24.a = int16BitsToFloat16(v); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/int64min-literal.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/int64min-literal.comp new file mode 100644 index 0000000000..63bd0fdaf2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/int64min-literal.comp @@ -0,0 +1,29 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std140) uniform UBO +{ + float b; +} _12; + +layout(binding = 1, std430) buffer SSBO +{ + float a; +} _32; + +void main() +{ + double b2 = double(_12.b); + int64_t v = doubleBitsToInt64(b2); + v ^= int64_t(0x8000000000000000ul); + double a2 = int64BitsToDouble(v); + _32.a = float(a2); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..5a4896f907 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/intmin-literal.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer SSBO +{ + float a; +} _9; + +layout(binding = 0, std140) uniform UBO +{ + float b; +} _14; + +void main() +{ + _9.a = intBitsToFloat(floatBitsToInt(_14.b) ^ int(0x80000000)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp new file mode 100644 index 0000000000..5b4cb886b4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp @@ -0,0 +1,22 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer STO +{ + uint data[]; +} ssbo; + +void main() +{ + while (true) + { + ssbo.data[0]++; + if (ssbo.data[2] != 0u) + { + ssbo.data[5]++; + continue; + } + break; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp new file mode 100644 index 0000000000..78ebc26c52 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int v[]; +} _23; + +void main() +{ + for (int i = 0; i < 4; i++) + { + _23.v[i] += 10; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp new file mode 100644 index 0000000000..8b6a032104 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int v[]; +} _64; + +void main() +{ + for (int i = 0; i < 4; i++) + { + _64.v[i] += 10; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/loop.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop.comp new file mode 100644 index 0000000000..2ba731cdc7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/loop.comp @@ -0,0 +1,82 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +} _24; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = _24.in_data[ident]; + int k = 0; + uint i = 0u; + if (idat.y == 20.0) + { + do + { + k *= 2; + i++; + } while (i < ident); + } + switch (k) + { + case 10: + { + for (;;) + { + i++; + if (i > 10u) + { + break; + } + continue; + } + break; + } + default: + { + for (;;) + { + i += 2u; + if (i > 20u) + { + break; + } + continue; + } + break; + } + } + while (k < 10) + { + idat *= 2.0; + k++; + } + for (uint i_1 = 0u; i_1 < 16u; i_1++, k++) + { + for (uint j = 0u; j < 30u; j++) + { + idat = _24.mvp * idat; + } + } + k = 0; + for (;;) + { + k++; + if (k > 10) + { + k += 2; + } + else + { + k += 3; + continue; + } + k += 10; + continue; + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/return.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/return.comp new file mode 100644 index 0000000000..4802be2244 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/return.comp @@ -0,0 +1,35 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _27; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + if (ident == 2u) + { + _27.out_data[ident] = vec4(20.0); + } + else + { + if (ident == 4u) + { + _27.out_data[ident] = vec4(10.0); + return; + } + } + int i = 0; + while (i < 20) + { + if (i == 10) + { + break; + } + return; + } + _27.out_data[ident] = vec4(10.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp new file mode 100644 index 0000000000..a14343ae12 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp @@ -0,0 +1,11 @@ +#version 450 +#extension GL_AMD_shader_ballot : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + float addInvocations = addInvocationsNonUniformAMD(0.0); + int minInvocations = minInvocationsNonUniformAMD(1); + uint maxInvocations = uint(maxInvocationsNonUniformAMD(4)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/specialization-constant-evaluation.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/specialization-constant-evaluation.comp new file mode 100644 index 0000000000..695835968a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/specialization-constant-evaluation.comp @@ -0,0 +1,321 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 1 +#endif +const int SONE = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 2 +#endif +const int STWO = SPIRV_CROSS_CONSTANT_ID_3; +const int _10 = (SONE + STWO); +const uint _13 = (uint(_10) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 1u +#endif +const uint UONE = SPIRV_CROSS_CONSTANT_ID_5; +const uint _15 = (_13 + UONE); +#ifndef SPIRV_CROSS_CONSTANT_ID_6 +#define SPIRV_CROSS_CONSTANT_ID_6 2u +#endif +const uint UTWO = SPIRV_CROSS_CONSTANT_ID_6; +const uint IADD = (_15 + UTWO); +const uint _19 = (IADD - 5u); +const uint _28 = (uint(SONE) + 0u); +const uint ISUB = (UTWO - _28); +const uint IMUL = (UTWO * UTWO); +const uint _37 = (IMUL - 3u); +const uint UDIV = (UTWO / UTWO); +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 -2 +#endif +const int SNEG_TWO = SPIRV_CROSS_CONSTANT_ID_4; +const int SDIV = (STWO / SNEG_TWO); +const int _52 = (SDIV + 2); +#ifndef SPIRV_CROSS_CONSTANT_ID_7 +#define SPIRV_CROSS_CONSTANT_ID_7 -3 +#endif +const int SNEG_THREE = SPIRV_CROSS_CONSTANT_ID_7; +const int SMOD = (STWO % SNEG_THREE); +const int _66 = (SMOD + 2); +const uint UMOD = (IADD % IMUL); +const uint _73 = (UMOD - 1u); +const uint LSHL = (IADD << ISUB); +const uint _81 = (LSHL - 11u); +const uint RSHL = (IADD >> ISUB); +const uint _89 = (RSHL - 2u); +const int _95 = int(IADD + 0u); +const int _96 = (-_95); +const int _97 = (-SDIV); +const int RSHA = (_96 >> _97); +const int _100 = (RSHA + 4); +const bool IEQ = (IADD == ISUB); +const int _109 = IEQ ? 2 : 1; +const bool INEQ = (IADD != ISUB); +const int _116 = INEQ ? 1 : 2; +const bool ULT = (IADD < ISUB); +const int _123 = ULT ? 2 : 1; +const bool ULE = (IADD <= ISUB); +const int _130 = ULE ? 2 : 1; +const bool UGT = (IADD > ISUB); +const int _137 = UGT ? 1 : 2; +const bool UGE = (IADD >= ISUB); +const int _144 = UGE ? 1 : 2; +const bool SLT = (SMOD < 1); +const int _151 = SLT ? 1 : 2; +const bool SLE = (SMOD <= 1); +const int _158 = SLE ? 1 : 2; +const bool SGT = (SMOD > 1); +const int _165 = SGT ? 2 : 1; +const bool SGE = (SMOD >= 1); +const int _172 = SGE ? 2 : 1; +const bool LOR = (IEQ || SLT); +const int _179 = LOR ? 1 : 2; +const bool LAND = (IEQ && SLT); +const int _186 = LAND ? 2 : 1; +const bool LNOT = (!LOR); +const int _193 = LNOT ? 2 : 1; +const uint AND = (IADD & IADD); +const uint _200 = (AND - 5u); +const uint OR = (IADD | ISUB); +const uint _208 = (OR - 6u); +const uint XOR = (IADD ^ IADD); +const uint _215 = (XOR + 1u); +const uint NOT = (~XOR); +const uint _223 = (NOT - 4294967294u); +const bool LEQ = (LAND == LNOT); +const int _230 = LEQ ? 1 : 2; +const bool LNEQ = (LAND != LNOT); +const int _237 = LNEQ ? 2 : 1; +const uint SEL = IEQ ? IADD : ISUB; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 true +#endif +const bool TRUE = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 false +#endif +const bool FALSE = SPIRV_CROSS_CONSTANT_ID_1; + +layout(binding = 0, std430) buffer SSBO_IAdd +{ + float val[_19]; + float dummy; +} IAdd; + +layout(binding = 1, std430) buffer SSBO_ISub +{ + float val[ISUB]; + float dummy; +} ISub; + +layout(binding = 2, std430) buffer SSBO_IMul +{ + float val[_37]; + float dummy; +} IMul; + +layout(binding = 3, std430) buffer SSBO_UDiv +{ + float val[UDIV]; + float dummy; +} UDiv; + +layout(binding = 4, std430) buffer SSBO_SDiv +{ + float val[_52]; + float dummy; +} SDiv; + +layout(binding = 5, std430) buffer SSBO_SRem +{ + float val[1]; + float dummy; +} SRem; + +layout(binding = 6, std430) buffer SSBO_SMod +{ + float val[_66]; + float dummy; +} SMod; + +layout(binding = 7, std430) buffer SSBO_UMod +{ + float val[_73]; + float dummy; +} UMod; + +layout(binding = 8, std430) buffer SSBO_LShl +{ + float val[_81]; + float dummy; +} LShl; + +layout(binding = 9, std430) buffer SSBO_RShl +{ + float val[_89]; + float dummy; +} RShl; + +layout(binding = 10, std430) buffer SSBO_RSha +{ + float val[_100]; + float dummy; +} RSha; + +layout(binding = 11, std430) buffer SSBO_IEq +{ + float val[_109]; + float dummy; +} IEq; + +layout(binding = 12, std430) buffer SSBO_INeq +{ + float val[_116]; + float dummy; +} INeq; + +layout(binding = 13, std430) buffer SSBO_Ult +{ + float val[_123]; + float dummy; +} Ult; + +layout(binding = 14, std430) buffer SSBO_Ule +{ + float val[_130]; + float dummy; +} Ule; + +layout(binding = 15, std430) buffer SSBO_Ugt +{ + float val[_137]; + float dummy; +} Ugt; + +layout(binding = 16, std430) buffer SSBO_Uge +{ + float val[_144]; + float dummy; +} Uge; + +layout(binding = 17, std430) buffer SSBO_Slt +{ + float val[_151]; + float dummy; +} Slt; + +layout(binding = 18, std430) buffer SSBO_Sle +{ + float val[_158]; + float dummy; +} Sle; + +layout(binding = 19, std430) buffer SSBO_Sgt +{ + float val[_165]; + float dummy; +} Sgt; + +layout(binding = 20, std430) buffer SSBO_Sge +{ + float val[_172]; + float dummy; +} Sge; + +layout(binding = 21, std430) buffer SSBO_Lor +{ + float val[_179]; + float dummy; +} Lor; + +layout(binding = 22, std430) buffer SSBO_Land +{ + float val[_186]; + float dummy; +} Land; + +layout(binding = 23, std430) buffer SSBO_Lnot +{ + float val[_193]; + float dummy; +} Lnot; + +layout(binding = 24, std430) buffer SSBO_And +{ + float val[_200]; + float dummy; +} And; + +layout(binding = 24, std430) buffer SSBO_Or +{ + float val[_208]; + float dummy; +} Or; + +layout(binding = 24, std430) buffer SSBO_Xor +{ + float val[_215]; + float dummy; +} Xor; + +layout(binding = 25, std430) buffer SSBO_Not +{ + float val[_223]; + float dummy; +} Not; + +layout(binding = 26, std430) buffer SSBO_Leq +{ + float val[_230]; + float dummy; +} Leq; + +layout(binding = 27, std430) buffer SSBO_Lneq +{ + float val[_237]; + float dummy; +} Lneq; + +layout(binding = 28, std430) buffer SSBO_Sel +{ + float val[SEL]; + float dummy; +} Sel; + +void main() +{ + IAdd.val[0] = 0.0; + ISub.val[0] = 0.0; + IMul.val[0] = 0.0; + UDiv.val[0] = 0.0; + SDiv.val[0] = 0.0; + SRem.val[0] = 0.0; + SMod.val[0] = 0.0; + UMod.val[0] = 0.0; + LShl.val[0] = 0.0; + RShl.val[0] = 0.0; + RSha.val[0] = 0.0; + IEq.val[0] = 0.0; + INeq.val[0] = 0.0; + Ult.val[0] = 0.0; + Ule.val[0] = 0.0; + Ugt.val[0] = 0.0; + Uge.val[0] = 0.0; + Slt.val[0] = 0.0; + Sle.val[0] = 0.0; + Sgt.val[0] = 0.0; + Sge.val[0] = 0.0; + Lor.val[0] = 0.0; + Land.val[0] = 0.0; + Lnot.val[0] = 0.0; + And.val[0] = 0.0; + Or.val[0] = 0.0; + Xor.val[0] = 0.0; + Not.val[0] = 0.0; + Leq.val[0] = 0.0; + Lneq.val[0] = 0.0; + Sel.val[0] = 0.0; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp.vk new file mode 100644 index 0000000000..a037b301ca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp.vk @@ -0,0 +1,105 @@ +#version 310 es +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + S4 m3s[8]; +}; + +layout(set = 0, binding = 1, scalar) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(set = 0, binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0]; + ssbo_430.content.m0s[0].b = ssbo_140.content.m0s[0].b; + ssbo_430.content.m1s[0].a = ssbo_140.content.m1s[0].a; + ssbo_430.content.m1s[0].b = ssbo_140.content.m1s[0].b; + ssbo_430.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0]; + ssbo_430.content.m2s[0].b = ssbo_140.content.m2s[0].b; + ssbo_430.content.m0.a[0] = ssbo_140.content.m0.a[0]; + ssbo_430.content.m0.b = ssbo_140.content.m0.b; + ssbo_430.content.m1.a = ssbo_140.content.m1.a; + ssbo_430.content.m1.b = ssbo_140.content.m1.b; + ssbo_430.content.m2.a[0] = ssbo_140.content.m2.a[0]; + ssbo_430.content.m2.b = ssbo_140.content.m2.b; + ssbo_430.content.m3.a = ssbo_140.content.m3.a; + ssbo_430.content.m3.b = ssbo_140.content.m3.b; + ssbo_430.content.m4 = ssbo_140.content.m4; + ssbo_430.content.m3s[0].c = ssbo_140.content.m3s[0].c; + ssbo_430.content.m3s[1].c = ssbo_140.content.m3s[1].c; + ssbo_430.content.m3s[2].c = ssbo_140.content.m3s[2].c; + ssbo_430.content.m3s[3].c = ssbo_140.content.m3s[3].c; + ssbo_430.content.m3s[4].c = ssbo_140.content.m3s[4].c; + ssbo_430.content.m3s[5].c = ssbo_140.content.m3s[5].c; + ssbo_430.content.m3s[6].c = ssbo_140.content.m3s[6].c; + ssbo_430.content.m3s[7].c = ssbo_140.content.m3s[7].c; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp.vk new file mode 100644 index 0000000000..f3fa6dd00c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp.vk @@ -0,0 +1,116 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + float FragColor; +} _9; + +void main() +{ + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + subgroupMemoryBarrier(); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + _9.FragColor = vec4(gl_SubgroupEqMask).x; + _9.FragColor = vec4(gl_SubgroupGeMask).x; + _9.FragColor = vec4(gl_SubgroupGtMask).x; + _9.FragColor = vec4(gl_SubgroupLeMask).x; + _9.FragColor = vec4(gl_SubgroupLtMask).x; + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + uint shuffled = subgroupShuffle(10u, 8u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + uint shuffled_up = subgroupShuffleUp(20u, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(true); + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20u)); + uvec4 uhi = subgroupMax(uvec4(20u)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + bvec4 anded_b = subgroupAnd(equal(ballot_value, uvec4(42u))); + bvec4 ored_b = subgroupOr(equal(ballot_value, uvec4(42u))); + bvec4 xored_b = subgroupXor(equal(ballot_value, uvec4(42u))); + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + lo = subgroupInclusiveMin(lo); + hi = subgroupInclusiveMax(hi); + slo = subgroupInclusiveMin(slo); + shi = subgroupInclusiveMax(shi); + ulo = subgroupInclusiveMin(ulo); + uhi = subgroupInclusiveMax(uhi); + anded = subgroupInclusiveAnd(anded); + ored = subgroupInclusiveOr(ored); + xored = subgroupInclusiveXor(ored); + added = subgroupExclusiveAdd(lo); + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + lo = subgroupExclusiveMin(lo); + hi = subgroupExclusiveMax(hi); + ulo = subgroupExclusiveMin(ulo); + uhi = subgroupExclusiveMax(uhi); + slo = subgroupExclusiveMin(slo); + shi = subgroupExclusiveMax(shi); + anded = subgroupExclusiveAnd(anded); + ored = subgroupExclusiveOr(ored); + xored = subgroupExclusiveXor(ored); + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 4u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 4u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 4u); + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp new file mode 100644 index 0000000000..9a8377d31d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp @@ -0,0 +1,892 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +} _16; + +layout(binding = 0, std430) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +} _31; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u) +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u) +#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u) +#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u) +#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u) +#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupSize gl_WarpSizeNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupSize gl_SubGroupSizeARB +#elif defined(GL_AMD_gcn_shader) +#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD) +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +bool subgroupElect() +{ + uvec4 activeMask = subgroupBallot(true); + uint firstLive = subgroupBallotFindLSB(activeMask); + return gl_SubgroupInvocationID == firstLive; +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +uint subgroupBallotBitCount(uvec4 value) +{ + ivec2 c = bitCount(value.xy); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupBallotBitExtract(uvec4 value, uint index) +{ +#ifdef GL_NV_shader_thread_group + uint shifted = value.x >> index; +#else + uint shifted = value[index >> 5u] >> (index & 0x1fu); +#endif + return (shifted & 1u) != 0u; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupAdd(float v) +{ + float reduction = 0.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : 0.0f; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : 0.0f; + } + } + return reduction; +} +vec2 subgroupAdd(vec2 v) +{ + vec2 reduction = vec2(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : vec2(0.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : vec2(0.0f); + } + } + return reduction; +} +vec3 subgroupAdd(vec3 v) +{ + vec3 reduction = vec3(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : vec3(0.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : vec3(0.0f); + } + } + return reduction; +} +vec4 subgroupAdd(vec4 v) +{ + vec4 reduction = vec4(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : vec4(0.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : vec4(0.0f); + } + } + return reduction; +} +double subgroupAdd(double v) +{ + double reduction = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : 0.0LF; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : 0.0LF; + } + } + return reduction; +} +dvec2 subgroupAdd(dvec2 v) +{ + dvec2 reduction = dvec2(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : dvec2(0.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : dvec2(0.0LF); + } + } + return reduction; +} +dvec3 subgroupAdd(dvec3 v) +{ + dvec3 reduction = dvec3(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : dvec3(0.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : dvec3(0.0LF); + } + } + return reduction; +} +dvec4 subgroupAdd(dvec4 v) +{ + dvec4 reduction = dvec4(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : dvec4(0.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : dvec4(0.0LF); + } + } + return reduction; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupExclusiveAdd(float v) +{ + float excl_scan = 0.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : 0.0f; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 0.0f; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : 0.0f; + } + } + return excl_scan; +} +vec2 subgroupExclusiveAdd(vec2 v) +{ + vec2 excl_scan = vec2(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : vec2(0.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec2(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : vec2(0.0f); + } + } + return excl_scan; +} +vec3 subgroupExclusiveAdd(vec3 v) +{ + vec3 excl_scan = vec3(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : vec3(0.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec3(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : vec3(0.0f); + } + } + return excl_scan; +} +vec4 subgroupExclusiveAdd(vec4 v) +{ + vec4 excl_scan = vec4(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : vec4(0.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec4(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : vec4(0.0f); + } + } + return excl_scan; +} +double subgroupExclusiveAdd(double v) +{ + double excl_scan = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : 0.0LF; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 0.0LF; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : 0.0LF; + } + } + return excl_scan; +} +dvec2 subgroupExclusiveAdd(dvec2 v) +{ + dvec2 excl_scan = dvec2(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : dvec2(0.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec2(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : dvec2(0.0LF); + } + } + return excl_scan; +} +dvec3 subgroupExclusiveAdd(dvec3 v) +{ + dvec3 excl_scan = dvec3(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : dvec3(0.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec3(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : dvec3(0.0LF); + } + } + return excl_scan; +} +dvec4 subgroupExclusiveAdd(dvec4 v) +{ + dvec4 excl_scan = dvec4(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : dvec4(0.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec4(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : dvec4(0.0LF); + } + } + return excl_scan; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupInclusiveAdd(float v) +{ + float incl_scan = 0.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : 0.0f; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : 0.0f; + } + } + return incl_scan; +} +vec2 subgroupInclusiveAdd(vec2 v) +{ + vec2 incl_scan = vec2(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : vec2(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : vec2(0.0f); + } + } + return incl_scan; +} +vec3 subgroupInclusiveAdd(vec3 v) +{ + vec3 incl_scan = vec3(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : vec3(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : vec3(0.0f); + } + } + return incl_scan; +} +vec4 subgroupInclusiveAdd(vec4 v) +{ + vec4 incl_scan = vec4(0.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : vec4(0.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : vec4(0.0f); + } + } + return incl_scan; +} +double subgroupInclusiveAdd(double v) +{ + double incl_scan = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : 0.0LF; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : 0.0LF; + } + } + return incl_scan; +} +dvec2 subgroupInclusiveAdd(dvec2 v) +{ + dvec2 incl_scan = dvec2(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : dvec2(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : dvec2(0.0LF); + } + } + return incl_scan; +} +dvec3 subgroupInclusiveAdd(dvec3 v) +{ + dvec3 incl_scan = dvec3(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : dvec3(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : dvec3(0.0LF); + } + } + return incl_scan; +} +dvec4 subgroupInclusiveAdd(dvec4 v) +{ + dvec4 incl_scan = dvec4(0.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : dvec4(0.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : dvec4(0.0LF); + } + } + return incl_scan; +} +#endif + +void main() +{ + _16.data_out_float = subgroupAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupExclusiveAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupExclusiveAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupExclusiveAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupExclusiveAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupExclusiveAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupExclusiveAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupExclusiveAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupExclusiveAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupInclusiveAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupInclusiveAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupInclusiveAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupInclusiveAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupInclusiveAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupInclusiveAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupInclusiveAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupInclusiveAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp.vk new file mode 100644 index 0000000000..db44631804 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp.vk @@ -0,0 +1,56 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +} _16; + +layout(set = 0, binding = 0, std430) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +} _31; + +void main() +{ + _16.data_out_float = subgroupAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupExclusiveAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupExclusiveAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupExclusiveAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupExclusiveAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupExclusiveAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupExclusiveAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupExclusiveAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupExclusiveAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupInclusiveAdd(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupInclusiveAdd(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupInclusiveAdd(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupInclusiveAdd(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupInclusiveAdd(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupInclusiveAdd(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupInclusiveAdd(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupInclusiveAdd(_31.data_in_dvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp new file mode 100644 index 0000000000..d9b117a191 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp @@ -0,0 +1,892 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +} _16; + +layout(binding = 0, std430) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +} _31; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u) +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u) +#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u) +#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u) +#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u) +#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupSize gl_WarpSizeNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupSize gl_SubGroupSizeARB +#elif defined(GL_AMD_gcn_shader) +#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD) +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +bool subgroupElect() +{ + uvec4 activeMask = subgroupBallot(true); + uint firstLive = subgroupBallotFindLSB(activeMask); + return gl_SubgroupInvocationID == firstLive; +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +uint subgroupBallotBitCount(uvec4 value) +{ + ivec2 c = bitCount(value.xy); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupBallotBitExtract(uvec4 value, uint index) +{ +#ifdef GL_NV_shader_thread_group + uint shifted = value.x >> index; +#else + uint shifted = value[index >> 5u] >> (index & 0x1fu); +#endif + return (shifted & 1u) != 0u; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupMul(float v) +{ + float reduction = 1.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : 1.0f; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : 1.0f; + } + } + return reduction; +} +vec2 subgroupMul(vec2 v) +{ + vec2 reduction = vec2(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : vec2(1.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : vec2(1.0f); + } + } + return reduction; +} +vec3 subgroupMul(vec3 v) +{ + vec3 reduction = vec3(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : vec3(1.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : vec3(1.0f); + } + } + return reduction; +} +vec4 subgroupMul(vec4 v) +{ + vec4 reduction = vec4(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : vec4(1.0f); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : vec4(1.0f); + } + } + return reduction; +} +double subgroupMul(double v) +{ + double reduction = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : 0.0LF; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : 0.0LF; + } + } + return reduction; +} +dvec2 subgroupMul(dvec2 v) +{ + dvec2 reduction = dvec2(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : dvec2(1.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : dvec2(1.0LF); + } + } + return reduction; +} +dvec3 subgroupMul(dvec3 v) +{ + dvec3 reduction = dvec3(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : dvec3(1.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : dvec3(1.0LF); + } + } + return reduction; +} +dvec4 subgroupMul(dvec4 v) +{ + dvec4 reduction = dvec4(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : dvec4(1.0LF); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : dvec4(1.0LF); + } + } + return reduction; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupExclusiveMul(float v) +{ + float excl_scan = 1.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : 1.0f; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 1.0f; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : 1.0f; + } + } + return excl_scan; +} +vec2 subgroupExclusiveMul(vec2 v) +{ + vec2 excl_scan = vec2(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : vec2(1.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec2(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : vec2(1.0f); + } + } + return excl_scan; +} +vec3 subgroupExclusiveMul(vec3 v) +{ + vec3 excl_scan = vec3(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : vec3(1.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec3(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : vec3(1.0f); + } + } + return excl_scan; +} +vec4 subgroupExclusiveMul(vec4 v) +{ + vec4 excl_scan = vec4(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : vec4(1.0f); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = vec4(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : vec4(1.0f); + } + } + return excl_scan; +} +double subgroupExclusiveMul(double v) +{ + double excl_scan = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : 0.0LF; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 0.0LF; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : 0.0LF; + } + } + return excl_scan; +} +dvec2 subgroupExclusiveMul(dvec2 v) +{ + dvec2 excl_scan = dvec2(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : dvec2(1.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec2(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : dvec2(1.0LF); + } + } + return excl_scan; +} +dvec3 subgroupExclusiveMul(dvec3 v) +{ + dvec3 excl_scan = dvec3(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : dvec3(1.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec3(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : dvec3(1.0LF); + } + } + return excl_scan; +} +dvec4 subgroupExclusiveMul(dvec4 v) +{ + dvec4 excl_scan = dvec4(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : dvec4(1.0LF); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = dvec4(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : dvec4(1.0LF); + } + } + return excl_scan; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +float subgroupInclusiveMul(float v) +{ + float incl_scan = 1.0f; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + float s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : 1.0f; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + float s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : 1.0f; + } + } + return incl_scan; +} +vec2 subgroupInclusiveMul(vec2 v) +{ + vec2 incl_scan = vec2(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : vec2(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : vec2(1.0f); + } + } + return incl_scan; +} +vec3 subgroupInclusiveMul(vec3 v) +{ + vec3 incl_scan = vec3(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : vec3(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : vec3(1.0f); + } + } + return incl_scan; +} +vec4 subgroupInclusiveMul(vec4 v) +{ + vec4 incl_scan = vec4(1.0f); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + vec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : vec4(1.0f); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + vec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : vec4(1.0f); + } + } + return incl_scan; +} +double subgroupInclusiveMul(double v) +{ + double incl_scan = 0.0LF; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + double s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : 0.0LF; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + double s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : 0.0LF; + } + } + return incl_scan; +} +dvec2 subgroupInclusiveMul(dvec2 v) +{ + dvec2 incl_scan = dvec2(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : dvec2(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : dvec2(1.0LF); + } + } + return incl_scan; +} +dvec3 subgroupInclusiveMul(dvec3 v) +{ + dvec3 incl_scan = dvec3(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : dvec3(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : dvec3(1.0LF); + } + } + return incl_scan; +} +dvec4 subgroupInclusiveMul(dvec4 v) +{ + dvec4 incl_scan = dvec4(1.0LF); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + dvec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : dvec4(1.0LF); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + dvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : dvec4(1.0LF); + } + } + return incl_scan; +} +#endif + +void main() +{ + _16.data_out_float = subgroupMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupExclusiveMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupExclusiveMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupExclusiveMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupExclusiveMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupExclusiveMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupExclusiveMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupExclusiveMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupExclusiveMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupInclusiveMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupInclusiveMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupInclusiveMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupInclusiveMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupInclusiveMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupInclusiveMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupInclusiveMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupInclusiveMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp.vk new file mode 100644 index 0000000000..42f41954fb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp.vk @@ -0,0 +1,56 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +} _16; + +layout(set = 0, binding = 0, std430) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +} _31; + +void main() +{ + _16.data_out_float = subgroupMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupExclusiveMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupExclusiveMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupExclusiveMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupExclusiveMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupExclusiveMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupExclusiveMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupExclusiveMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupExclusiveMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); + _16.data_out_float = subgroupInclusiveMul(_31.data_in_float[gl_LocalInvocationID.x]); + _16.data_out_vec2 = subgroupInclusiveMul(_31.data_in_vec2[gl_LocalInvocationID.x]); + _16.data_out_vec3 = subgroupInclusiveMul(_31.data_in_vec3[gl_LocalInvocationID.x]); + _16.data_out_vec4 = subgroupInclusiveMul(_31.data_in_vec4[gl_LocalInvocationID.x]); + _16.data_out_double = subgroupInclusiveMul(_31.data_in_double[gl_LocalInvocationID.x]); + _16.data_out_dvec2 = subgroupInclusiveMul(_31.data_in_dvec2[gl_LocalInvocationID.x]); + _16.data_out_dvec3 = subgroupInclusiveMul(_31.data_in_dvec3[gl_LocalInvocationID.x]); + _16.data_out_dvec4 = subgroupInclusiveMul(_31.data_in_dvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp new file mode 100644 index 0000000000..e95d86d90e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp @@ -0,0 +1,892 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +} _16; + +layout(binding = 0, std430) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +} _29; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u) +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u) +#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u) +#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u) +#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u) +#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupSize gl_WarpSizeNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupSize gl_SubGroupSizeARB +#elif defined(GL_AMD_gcn_shader) +#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD) +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +bool subgroupElect() +{ + uvec4 activeMask = subgroupBallot(true); + uint firstLive = subgroupBallotFindLSB(activeMask); + return gl_SubgroupInvocationID == firstLive; +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +uint subgroupBallotBitCount(uvec4 value) +{ + ivec2 c = bitCount(value.xy); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupBallotBitExtract(uvec4 value, uint index) +{ +#ifdef GL_NV_shader_thread_group + uint shifted = value.x >> index; +#else + uint shifted = value[index >> 5u] >> (index & 0x1fu); +#endif + return (shifted & 1u) != 0u; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupAdd(uint v) +{ + uint reduction = 0u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : 0u; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : 0u; + } + } + return reduction; +} +uvec2 subgroupAdd(uvec2 v) +{ + uvec2 reduction = uvec2(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : uvec2(0u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : uvec2(0u); + } + } + return reduction; +} +uvec3 subgroupAdd(uvec3 v) +{ + uvec3 reduction = uvec3(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : uvec3(0u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : uvec3(0u); + } + } + return reduction; +} +uvec4 subgroupAdd(uvec4 v) +{ + uvec4 reduction = uvec4(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : uvec4(0u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : uvec4(0u); + } + } + return reduction; +} +int subgroupAdd(int v) +{ + int reduction = 0; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : 0; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : 0; + } + } + return reduction; +} +ivec2 subgroupAdd(ivec2 v) +{ + ivec2 reduction = ivec2(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : ivec2(0); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : ivec2(0); + } + } + return reduction; +} +ivec3 subgroupAdd(ivec3 v) +{ + ivec3 reduction = ivec3(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : ivec3(0); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : ivec3(0); + } + } + return reduction; +} +ivec4 subgroupAdd(ivec4 v) +{ + ivec4 reduction = ivec4(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction += valid ? s : ivec4(0); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction += valid ? s : ivec4(0); + } + } + return reduction; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupExclusiveAdd(uint v) +{ + uint excl_scan = 0u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : 0u; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 0u; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : 0u; + } + } + return excl_scan; +} +uvec2 subgroupExclusiveAdd(uvec2 v) +{ + uvec2 excl_scan = uvec2(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : uvec2(0u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec2(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : uvec2(0u); + } + } + return excl_scan; +} +uvec3 subgroupExclusiveAdd(uvec3 v) +{ + uvec3 excl_scan = uvec3(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : uvec3(0u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec3(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : uvec3(0u); + } + } + return excl_scan; +} +uvec4 subgroupExclusiveAdd(uvec4 v) +{ + uvec4 excl_scan = uvec4(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : uvec4(0u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec4(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : uvec4(0u); + } + } + return excl_scan; +} +int subgroupExclusiveAdd(int v) +{ + int excl_scan = 0; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : 0; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 0; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : 0; + } + } + return excl_scan; +} +ivec2 subgroupExclusiveAdd(ivec2 v) +{ + ivec2 excl_scan = ivec2(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : ivec2(0); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec2(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : ivec2(0); + } + } + return excl_scan; +} +ivec3 subgroupExclusiveAdd(ivec3 v) +{ + ivec3 excl_scan = ivec3(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : ivec3(0); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec3(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : ivec3(0); + } + } + return excl_scan; +} +ivec4 subgroupExclusiveAdd(ivec4 v) +{ + ivec4 excl_scan = ivec4(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan += valid ? s : ivec4(0); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec4(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan += valid ? s : ivec4(0); + } + } + return excl_scan; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupInclusiveAdd(uint v) +{ + uint incl_scan = 0u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : 0u; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : 0u; + } + } + return incl_scan; +} +uvec2 subgroupInclusiveAdd(uvec2 v) +{ + uvec2 incl_scan = uvec2(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : uvec2(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : uvec2(0u); + } + } + return incl_scan; +} +uvec3 subgroupInclusiveAdd(uvec3 v) +{ + uvec3 incl_scan = uvec3(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : uvec3(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : uvec3(0u); + } + } + return incl_scan; +} +uvec4 subgroupInclusiveAdd(uvec4 v) +{ + uvec4 incl_scan = uvec4(0u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : uvec4(0u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : uvec4(0u); + } + } + return incl_scan; +} +int subgroupInclusiveAdd(int v) +{ + int incl_scan = 0; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : 0; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : 0; + } + } + return incl_scan; +} +ivec2 subgroupInclusiveAdd(ivec2 v) +{ + ivec2 incl_scan = ivec2(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : ivec2(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : ivec2(0); + } + } + return incl_scan; +} +ivec3 subgroupInclusiveAdd(ivec3 v) +{ + ivec3 incl_scan = ivec3(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : ivec3(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : ivec3(0); + } + } + return incl_scan; +} +ivec4 subgroupInclusiveAdd(ivec4 v) +{ + ivec4 incl_scan = ivec4(0); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan += valid ? s : ivec4(0); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan += valid ? s : ivec4(0); + } + } + return incl_scan; +} +#endif + +void main() +{ + _16.data_out_int = subgroupAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupExclusiveAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupExclusiveAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupExclusiveAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupExclusiveAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupExclusiveAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupExclusiveAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupExclusiveAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupExclusiveAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupInclusiveAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupInclusiveAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupInclusiveAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupInclusiveAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupInclusiveAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupInclusiveAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupInclusiveAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupInclusiveAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp.vk new file mode 100644 index 0000000000..2423e4d2ee --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp.vk @@ -0,0 +1,56 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +} _16; + +layout(set = 0, binding = 0, std430) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +} _29; + +void main() +{ + _16.data_out_int = subgroupAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupExclusiveAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupExclusiveAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupExclusiveAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupExclusiveAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupExclusiveAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupExclusiveAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupExclusiveAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupExclusiveAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupInclusiveAdd(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupInclusiveAdd(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupInclusiveAdd(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupInclusiveAdd(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupInclusiveAdd(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupInclusiveAdd(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupInclusiveAdd(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupInclusiveAdd(_29.data_in_uvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp new file mode 100644 index 0000000000..17e52c0205 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp @@ -0,0 +1,892 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#extension GL_KHR_shader_subgroup_arithmetic : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +} _16; + +layout(binding = 0, std430) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +} _29; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u) +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u) +#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u) +#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u) +#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u) +#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupSize gl_WarpSizeNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupSize gl_SubGroupSizeARB +#elif defined(GL_AMD_gcn_shader) +#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD) +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +bool subgroupElect() +{ + uvec4 activeMask = subgroupBallot(true); + uint firstLive = subgroupBallotFindLSB(activeMask); + return gl_SubgroupInvocationID == firstLive; +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +uint subgroupBallotBitCount(uvec4 value) +{ + ivec2 c = bitCount(value.xy); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupBallotBitExtract(uvec4 value, uint index) +{ +#ifdef GL_NV_shader_thread_group + uint shifted = value.x >> index; +#else + uint shifted = value[index >> 5u] >> (index & 0x1fu); +#endif + return (shifted & 1u) != 0u; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupMul(uint v) +{ + uint reduction = 1u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : 1u; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : 1u; + } + } + return reduction; +} +uvec2 subgroupMul(uvec2 v) +{ + uvec2 reduction = uvec2(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : uvec2(1u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : uvec2(1u); + } + } + return reduction; +} +uvec3 subgroupMul(uvec3 v) +{ + uvec3 reduction = uvec3(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : uvec3(1u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : uvec3(1u); + } + } + return reduction; +} +uvec4 subgroupMul(uvec4 v) +{ + uvec4 reduction = uvec4(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : uvec4(1u); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : uvec4(1u); + } + } + return reduction; +} +int subgroupMul(int v) +{ + int reduction = 1; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : 1; + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : 1; + } + } + return reduction; +} +ivec2 subgroupMul(ivec2 v) +{ + ivec2 reduction = ivec2(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : ivec2(1); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : ivec2(1); + } + } + return reduction; +} +ivec3 subgroupMul(ivec3 v) +{ + ivec3 reduction = ivec3(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : ivec3(1); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : ivec3(1); + } + } + return reduction; +} +ivec4 subgroupMul(ivec4 v) +{ + ivec4 reduction = ivec4(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + reduction = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleXorNV(reduction, i, gl_SubgroupSize, valid); + reduction *= valid ? s : ivec4(1); + } + } + else + { + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + reduction *= valid ? s : ivec4(1); + } + } + return reduction; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupExclusiveMul(uint v) +{ + uint excl_scan = 1u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : 1u; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 1u; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : 1u; + } + } + return excl_scan; +} +uvec2 subgroupExclusiveMul(uvec2 v) +{ + uvec2 excl_scan = uvec2(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : uvec2(1u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec2(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : uvec2(1u); + } + } + return excl_scan; +} +uvec3 subgroupExclusiveMul(uvec3 v) +{ + uvec3 excl_scan = uvec3(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : uvec3(1u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec3(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : uvec3(1u); + } + } + return excl_scan; +} +uvec4 subgroupExclusiveMul(uvec4 v) +{ + uvec4 excl_scan = uvec4(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : uvec4(1u); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = uvec4(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : uvec4(1u); + } + } + return excl_scan; +} +int subgroupExclusiveMul(int v) +{ + int excl_scan = 1; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : 1; + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = 1; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : 1; + } + } + return excl_scan; +} +ivec2 subgroupExclusiveMul(ivec2 v) +{ + ivec2 excl_scan = ivec2(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : ivec2(1); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec2(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : ivec2(1); + } + } + return excl_scan; +} +ivec3 subgroupExclusiveMul(ivec3 v) +{ + ivec3 excl_scan = ivec3(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : ivec3(1); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec3(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : ivec3(1); + } + } + return excl_scan; +} +ivec4 subgroupExclusiveMul(ivec4 v) +{ + ivec4 excl_scan = ivec4(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + excl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleUpNV(excl_scan, i, gl_SubgroupSize, valid); + excl_scan *= valid ? s : ivec4(1); + } + excl_scan = shuffleUpNV(excl_scan, 1u, gl_SubgroupSize); + if (subgroupElect()) + { + excl_scan = ivec4(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLtMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + excl_scan *= valid ? s : ivec4(1); + } + } + return excl_scan; +} +#endif + +#if defined(GL_KHR_shader_subgroup_arithmetic) +#elif defined(GL_NV_shader_thread_shuffle) +uint subgroupInclusiveMul(uint v) +{ + uint incl_scan = 1u; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uint s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : 1u; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uint s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : 1u; + } + } + return incl_scan; +} +uvec2 subgroupInclusiveMul(uvec2 v) +{ + uvec2 incl_scan = uvec2(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : uvec2(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : uvec2(1u); + } + } + return incl_scan; +} +uvec3 subgroupInclusiveMul(uvec3 v) +{ + uvec3 incl_scan = uvec3(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : uvec3(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : uvec3(1u); + } + } + return incl_scan; +} +uvec4 subgroupInclusiveMul(uvec4 v) +{ + uvec4 incl_scan = uvec4(1u); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + uvec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : uvec4(1u); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + uvec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : uvec4(1u); + } + } + return incl_scan; +} +int subgroupInclusiveMul(int v) +{ + int incl_scan = 1; + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + int s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : 1; + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + int s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : 1; + } + } + return incl_scan; +} +ivec2 subgroupInclusiveMul(ivec2 v) +{ + ivec2 incl_scan = ivec2(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec2 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : ivec2(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec2 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : ivec2(1); + } + } + return incl_scan; +} +ivec3 subgroupInclusiveMul(ivec3 v) +{ + ivec3 incl_scan = ivec3(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec3 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : ivec3(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec3 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : ivec3(1); + } + } + return incl_scan; +} +ivec4 subgroupInclusiveMul(ivec4 v) +{ + ivec4 incl_scan = ivec4(1); + uvec4 active_threads = subgroupBallot(true); + if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize) + { + uint total = gl_SubgroupSize / 2u; + incl_scan = v; + for (uint i = 1u; i <= total; i <<= 1u) + { + bool valid; + ivec4 s = shuffleUpNV(incl_scan, i, gl_SubgroupSize, valid); + incl_scan *= valid ? s : ivec4(1); + } + } + else + { + uint total = subgroupBallotBitCount(gl_SubgroupLeMask); + for (uint i = 0u; i < gl_SubgroupSize; ++i) + { + bool valid = subgroupBallotBitExtract(active_threads, i); + ivec4 s = shuffleNV(v, i, gl_SubgroupSize); + valid = valid && (i < total); + incl_scan *= valid ? s : ivec4(1); + } + } + return incl_scan; +} +#endif + +void main() +{ + _16.data_out_int = subgroupMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupExclusiveMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupExclusiveMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupExclusiveMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupExclusiveMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupExclusiveMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupExclusiveMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupExclusiveMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupExclusiveMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupInclusiveMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupInclusiveMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupInclusiveMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupInclusiveMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupInclusiveMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupInclusiveMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupInclusiveMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupInclusiveMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp.vk new file mode 100644 index 0000000000..706684dd9f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp.vk @@ -0,0 +1,56 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +} _16; + +layout(set = 0, binding = 0, std430) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +} _29; + +void main() +{ + _16.data_out_int = subgroupMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupExclusiveMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupExclusiveMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupExclusiveMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupExclusiveMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupExclusiveMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupExclusiveMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupExclusiveMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupExclusiveMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); + _16.data_out_int = subgroupInclusiveMul(_29.data_in_int[gl_LocalInvocationID.x]); + _16.data_out_ivec2 = subgroupInclusiveMul(_29.data_in_ivec2[gl_LocalInvocationID.x]); + _16.data_out_ivec3 = subgroupInclusiveMul(_29.data_in_ivec3[gl_LocalInvocationID.x]); + _16.data_out_ivec4 = subgroupInclusiveMul(_29.data_in_ivec4[gl_LocalInvocationID.x]); + _16.data_out_uint = subgroupInclusiveMul(_29.data_in_uint[gl_LocalInvocationID.x]); + _16.data_out_uvec2 = subgroupInclusiveMul(_29.data_in_uvec2[gl_LocalInvocationID.x]); + _16.data_out_uvec3 = subgroupInclusiveMul(_29.data_in_uvec3[gl_LocalInvocationID.x]); + _16.data_out_uvec4 = subgroupInclusiveMul(_29.data_in_uvec4[gl_LocalInvocationID.x]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp new file mode 100644 index 0000000000..00b3fa7e1f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp @@ -0,0 +1,401 @@ +#version 450 + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_NV_shader_thread_shuffle) +#extension GL_NV_shader_thread_shuffle : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif + +#if defined(GL_KHR_shader_subgroup_vote) +#extension GL_KHR_shader_subgroup_vote : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#elif defined(GL_NV_gpu_shader_5) +#extension GL_NV_gpu_shader_5 : require +#elif defined(GL_ARB_shader_group_vote) +#extension GL_ARB_shader_group_vote : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#elif defined(GL_AMD_gcn_shader) && (defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5)) +#extension GL_AMD_gpu_shader_int64 : enable +#extension GL_NV_gpu_shader5 : enable +#extension GL_AMD_gcn_shader : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#extension GL_KHR_shader_subgroup_basic : require +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#extension GL_KHR_shader_subgroup_ballot : require +#elif defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#elif defined(GL_ARB_shader_ballot) && defined(GL_ARB_shader_int64) +#extension GL_ARB_shader_int64 : enable +#extension GL_ARB_shader_ballot : require +#else +#error No extensions available to emulate requested subgroup feature. +#endif + +#if defined(GL_NV_shader_thread_group) +#extension GL_NV_shader_thread_group : require +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float FragColor; +} _9; + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u) +#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u) +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u) +#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u) +#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u) +#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u) +#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupSize gl_WarpSizeNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupSize gl_SubGroupSizeARB +#elif defined(GL_AMD_gcn_shader) +#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD) +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupInvocationID gl_ThreadInWarpNV +#elif defined(GL_ARB_shader_ballot) +#define gl_SubgroupInvocationID gl_SubGroupInvocationARB +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_SubgroupID gl_WarpIDNV +#endif + +#if defined(GL_KHR_shader_subgroup_basic) +#elif defined(GL_NV_shader_thread_group) +#define gl_NumSubgroups gl_WarpsPerSMNV +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_ARB_shader_ballot) +int subgroupBroadcastFirst(int value) { return readFirstInvocationARB(value); } +ivec2 subgroupBroadcastFirst(ivec2 value) { return readFirstInvocationARB(value); } +ivec3 subgroupBroadcastFirst(ivec3 value) { return readFirstInvocationARB(value); } +ivec4 subgroupBroadcastFirst(ivec4 value) { return readFirstInvocationARB(value); } +uint subgroupBroadcastFirst(uint value) { return readFirstInvocationARB(value); } +uvec2 subgroupBroadcastFirst(uvec2 value) { return readFirstInvocationARB(value); } +uvec3 subgroupBroadcastFirst(uvec3 value) { return readFirstInvocationARB(value); } +uvec4 subgroupBroadcastFirst(uvec4 value) { return readFirstInvocationARB(value); } +float subgroupBroadcastFirst(float value) { return readFirstInvocationARB(value); } +vec2 subgroupBroadcastFirst(vec2 value) { return readFirstInvocationARB(value); } +vec3 subgroupBroadcastFirst(vec3 value) { return readFirstInvocationARB(value); } +vec4 subgroupBroadcastFirst(vec4 value) { return readFirstInvocationARB(value); } +double subgroupBroadcastFirst(double value) { return readFirstInvocationARB(value); } +dvec2 subgroupBroadcastFirst(dvec2 value) { return readFirstInvocationARB(value); } +dvec3 subgroupBroadcastFirst(dvec3 value) { return readFirstInvocationARB(value); } +dvec4 subgroupBroadcastFirst(dvec4 value) { return readFirstInvocationARB(value); } +int subgroupBroadcast(int value, uint id) { return readInvocationARB(value, id); } +ivec2 subgroupBroadcast(ivec2 value, uint id) { return readInvocationARB(value, id); } +ivec3 subgroupBroadcast(ivec3 value, uint id) { return readInvocationARB(value, id); } +ivec4 subgroupBroadcast(ivec4 value, uint id) { return readInvocationARB(value, id); } +uint subgroupBroadcast(uint value, uint id) { return readInvocationARB(value, id); } +uvec2 subgroupBroadcast(uvec2 value, uint id) { return readInvocationARB(value, id); } +uvec3 subgroupBroadcast(uvec3 value, uint id) { return readInvocationARB(value, id); } +uvec4 subgroupBroadcast(uvec4 value, uint id) { return readInvocationARB(value, id); } +float subgroupBroadcast(float value, uint id) { return readInvocationARB(value, id); } +vec2 subgroupBroadcast(vec2 value, uint id) { return readInvocationARB(value, id); } +vec3 subgroupBroadcast(vec3 value, uint id) { return readInvocationARB(value, id); } +vec4 subgroupBroadcast(vec4 value, uint id) { return readInvocationARB(value, id); } +double subgroupBroadcast(double value, uint id) { return readInvocationARB(value, id); } +dvec2 subgroupBroadcast(dvec2 value, uint id) { return readInvocationARB(value, id); } +dvec3 subgroupBroadcast(dvec3 value, uint id) { return readInvocationARB(value, id); } +dvec4 subgroupBroadcast(dvec4 value, uint id) { return readInvocationARB(value, id); } +#elif defined(GL_NV_shader_thread_shuffle) +int subgroupBroadcastFirst(int value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +ivec2 subgroupBroadcastFirst(ivec2 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +ivec3 subgroupBroadcastFirst(ivec3 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +ivec4 subgroupBroadcastFirst(ivec4 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +uint subgroupBroadcastFirst(uint value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +uvec2 subgroupBroadcastFirst(uvec2 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +uvec3 subgroupBroadcastFirst(uvec3 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +uvec4 subgroupBroadcastFirst(uvec4 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +float subgroupBroadcastFirst(float value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +vec2 subgroupBroadcastFirst(vec2 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +vec3 subgroupBroadcastFirst(vec3 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +vec4 subgroupBroadcastFirst(vec4 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +double subgroupBroadcastFirst(double value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +dvec2 subgroupBroadcastFirst(dvec2 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +dvec3 subgroupBroadcastFirst(dvec3 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +dvec4 subgroupBroadcastFirst(dvec4 value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); } +int subgroupBroadcast(int value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +ivec2 subgroupBroadcast(ivec2 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +ivec3 subgroupBroadcast(ivec3 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +ivec4 subgroupBroadcast(ivec4 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +uint subgroupBroadcast(uint value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +uvec2 subgroupBroadcast(uvec2 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +uvec3 subgroupBroadcast(uvec3 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +uvec4 subgroupBroadcast(uvec4 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +float subgroupBroadcast(float value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +vec2 subgroupBroadcast(vec2 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +vec3 subgroupBroadcast(vec3 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +vec4 subgroupBroadcast(vec4 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +double subgroupBroadcast(double value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +dvec2 subgroupBroadcast(dvec2 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +dvec3 subgroupBroadcast(dvec3 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +dvec4 subgroupBroadcast(dvec4 value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); } +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uint subgroupBallotFindLSB(uvec4 value) { return findLSB(value.x); } +uint subgroupBallotFindMSB(uvec4 value) { return findMSB(value.x); } +#else +uint subgroupBallotFindLSB(uvec4 value) +{ + int firstLive = findLSB(value.x); + return uint(firstLive != -1 ? firstLive : (findLSB(value.y) + 32)); +} +uint subgroupBallotFindMSB(uvec4 value) +{ + int firstLive = findMSB(value.y); + return uint(firstLive != -1 ? (firstLive + 32) : findMSB(value.x)); +} +#endif + +#if defined(GL_KHR_shader_subgroup_vote) +#elif defined(GL_AMD_gcn_shader) +bool subgroupAll(bool value) { return ballotAMD(value) == ballotAMD(true); } +bool subgroupAny(bool value) { return ballotAMD(value) != 0ull; } +bool subgroupAllEqual(bool value) { uint64_t b = ballotAMD(value); return b == 0ull || b == ballotAMD(true); } +#elif defined(GL_NV_gpu_shader_5) +bool subgroupAll(bool value) { return allThreadsNV(value); } +bool subgroupAny(bool value) { return anyThreadNV(value); } +bool subgroupAllEqual(bool value) { return allThreadsEqualNV(value); } +#elif defined(GL_ARB_shader_group_vote) +bool subgroupAll(bool v) { return allInvocationsARB(v); } +bool subgroupAny(bool v) { return anyInvocationARB(v); } +bool subgroupAllEqual(bool v) { return allInvocationsEqualARB(v); } +#endif + +#ifndef GL_KHR_shader_subgroup_vote +#define _SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(type) bool subgroupAllEqual(type value) { return subgroupAllEqual(subgroupBroadcastFirst(value) == value); } +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(int) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(ivec2) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(ivec3) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(ivec4) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(uint) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(uvec2) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(uvec3) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(uvec4) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(float) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(vec2) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(vec3) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(vec4) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(double) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(dvec2) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(dvec3) +_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(dvec4) +#undef _SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND +#endif + +#if defined(GL_KHR_shader_subgroup_ballot) +#elif defined(GL_NV_shader_thread_group) +uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); } +#elif defined(GL_ARB_shader_ballot) +uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +bool subgroupElect() +{ + uvec4 activeMask = subgroupBallot(true); + uint firstLive = subgroupBallotFindLSB(activeMask); + return gl_SubgroupInvocationID == firstLive; +} +#endif + +#ifndef GL_KHR_shader_subgroup_basic +void subgroupBarrier() { memoryBarrierShared(); } +#endif + +#ifndef GL_KHR_shader_subgroup_basic +void subgroupMemoryBarrier() { groupMemoryBarrier(); } +void subgroupMemoryBarrierBuffer() { groupMemoryBarrier(); } +void subgroupMemoryBarrierShared() { memoryBarrierShared(); } +void subgroupMemoryBarrierImage() { groupMemoryBarrier(); } +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupInverseBallot(uvec4 value) +{ + return any(notEqual(value.xy & gl_SubgroupEqMask.xy, uvec2(0u))); +} +uint subgroupBallotInclusiveBitCount(uvec4 value) +{ + uvec2 v = value.xy & gl_SubgroupLeMask.xy; + ivec2 c = bitCount(v); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +uint subgroupBallotExclusiveBitCount(uvec4 value) +{ + uvec2 v = value.xy & gl_SubgroupLtMask.xy; + ivec2 c = bitCount(v); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +uint subgroupBallotBitCount(uvec4 value) +{ + ivec2 c = bitCount(value.xy); +#ifdef GL_NV_shader_thread_group + return uint(c.x); +#else + return uint(c.x + c.y); +#endif +} +#endif + +#ifndef GL_KHR_shader_subgroup_ballot +bool subgroupBallotBitExtract(uvec4 value, uint index) +{ +#ifdef GL_NV_shader_thread_group + uint shifted = value.x >> index; +#else + uint shifted = value[index >> 5u] >> (index & 0x1fu); +#endif + return (shifted & 1u) != 0u; +} +#endif + +void main() +{ + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + subgroupMemoryBarrier(); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + _9.FragColor = vec4(gl_SubgroupEqMask).x; + _9.FragColor = vec4(gl_SubgroupGeMask).x; + _9.FragColor = vec4(gl_SubgroupGtMask).x; + _9.FragColor = vec4(gl_SubgroupLeMask).x; + _9.FragColor = vec4(gl_SubgroupLtMask).x; + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal_bool = subgroupAllEqual(true); + bool has_equal_T = subgroupAllEqual(uvec3(5u)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp.vk b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp.vk new file mode 100644 index 0000000000..61aa2f7a56 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp.vk @@ -0,0 +1,45 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + float FragColor; +} _9; + +void main() +{ + _9.FragColor = float(gl_NumSubgroups); + _9.FragColor = float(gl_SubgroupID); + _9.FragColor = float(gl_SubgroupSize); + _9.FragColor = float(gl_SubgroupInvocationID); + subgroupMemoryBarrier(); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + _9.FragColor = vec4(gl_SubgroupEqMask).x; + _9.FragColor = vec4(gl_SubgroupGeMask).x; + _9.FragColor = vec4(gl_SubgroupGtMask).x; + _9.FragColor = vec4(gl_SubgroupLeMask).x; + _9.FragColor = vec4(gl_SubgroupLtMask).x; + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal_bool = subgroupAllEqual(true); + bool has_equal_T = subgroupAllEqual(uvec3(5u)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..92573ffdc8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,15 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer A +{ + vec3 a; + vec3 b; +} _14; + +void main() +{ + bvec3 c = lessThan(_14.b, vec3(1.0)); + _14.a = mix(vec3(1.0, 0.0, 0.0), vec3(0.0, 0.0, 1.0), c); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..dd227e89d6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer A +{ + mat3 a; + float b; +} _14; + +void main() +{ + bool c = _14.b < 1.0; + _14.a = c ? mat3(vec3(1.0), vec3(1.0), vec3(1.0)) : mat3(vec3(0.0), vec3(0.0), vec3(0.0)); + _14.a = c ? mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)) : mat3(vec3(0.0), vec3(0.0), vec3(0.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/16bit-constants.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/16bit-constants.invalid.frag new file mode 100644 index 0000000000..a5c0a6a17c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/16bit-constants.invalid.frag @@ -0,0 +1,29 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif + +layout(location = 0) out float16_t foo; +layout(location = 1) out int16_t bar; +layout(location = 2) out uint16_t baz; + +void main() +{ + foo = float16_t(1.0); + bar = 2s; + baz = 3us; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/fp16.invalid.desktop.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/fp16.invalid.desktop.frag new file mode 100644 index 0000000000..faf79b2b44 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/fp16.invalid.desktop.frag @@ -0,0 +1,159 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif + +struct ResType +{ + f16vec4 _m0; + ivec4 _m1; +}; + +layout(location = 3) in f16vec4 v4; +layout(location = 2) in f16vec3 v3; +layout(location = 0) in float16_t v1; +layout(location = 1) in f16vec2 v2; + +f16mat2 test_mat2(f16vec2 a, f16vec2 b, f16vec2 c, f16vec2 d) +{ + return f16mat2(f16vec2(a), f16vec2(b)) * f16mat2(f16vec2(c), f16vec2(d)); +} + +f16mat3 test_mat3(f16vec3 a, f16vec3 b, f16vec3 c, f16vec3 d, f16vec3 e, f16vec3 f) +{ + return f16mat3(f16vec3(a), f16vec3(b), f16vec3(c)) * f16mat3(f16vec3(d), f16vec3(e), f16vec3(f)); +} + +void test_constants() +{ + float16_t a = float16_t(1.0); + float16_t b = float16_t(1.5); + float16_t c = float16_t(-1.5); + float16_t d = float16_t(0.0 / 0.0); + float16_t e = float16_t(1.0 / 0.0); + float16_t f = float16_t(-1.0 / 0.0); + float16_t g = float16_t(1014.0); + float16_t h = float16_t(9.5367431640625e-07); +} + +float16_t test_result() +{ + return float16_t(1.0); +} + +void test_conversions() +{ + float16_t one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = one != float16_t(0.0); + float d = float(one); + double e = double(one); + float16_t a2 = float16_t(a); + float16_t b2 = float16_t(b); + float16_t c2 = float16_t(c); + float16_t d2 = float16_t(d); + float16_t e2 = float16_t(e); +} + +void test_builtins() +{ + f16vec4 res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = atan(v4, v3.xyzz); + res = atan(v4); + res = sinh(v4); + res = cosh(v4); + res = tanh(v4); + res = asinh(v4); + res = acosh(v4); + res = atanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = inversesqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + res = roundEven(v4); + res = ceil(v4); + res = fract(v4); + res = mod(v4, v4); + f16vec4 tmp; + f16vec4 _231 = modf(v4, tmp); + res = _231; + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = mix(v4, v4, v4); + res = mix(v4, v4, lessThan(v4, v4)); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + bvec4 btmp = isnan(v4); + btmp = isinf(v4); + res = fma(v4, v4, v4); + ResType _275; + _275._m0 = frexp(v4, _275._m1); + ivec4 itmp = _275._m1; + res = _275._m0; + res = ldexp(res, itmp); + uint pack0 = packFloat2x16(v4.xy); + uint pack1 = packFloat2x16(v4.zw); + res = f16vec4(unpackFloat2x16(pack0), unpackFloat2x16(pack1)); + float16_t t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + f16vec3 res3 = cross(v3, v3); + res = normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + btmp = lessThan(v4, v4); + btmp = lessThanEqual(v4, v4); + btmp = greaterThan(v4, v4); + btmp = greaterThanEqual(v4, v4); + btmp = equal(v4, v4); + btmp = notEqual(v4, v4); + res = dFdx(v4); + res = dFdy(v4); + res = dFdxFine(v4); + res = dFdyFine(v4); + res = dFdxCoarse(v4); + res = dFdyCoarse(v4); + res = fwidth(v4); + res = fwidthFine(v4); + res = fwidthCoarse(v4); +} + +void main() +{ + f16vec2 param = v2; + f16vec2 param_1 = v2; + f16vec2 param_2 = v3.xy; + f16vec2 param_3 = v3.xy; + f16mat2 m0 = test_mat2(param, param_1, param_2, param_3); + f16vec3 param_4 = v3; + f16vec3 param_5 = v3; + f16vec3 param_6 = v3; + f16vec3 param_7 = v4.xyz; + f16vec3 param_8 = v4.xyz; + f16vec3 param_9 = v4.yzw; + f16mat3 m1 = test_mat3(param_4, param_5, param_6, param_7, param_8, param_9); + test_constants(); + test_conversions(); + test_builtins(); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/frag-fully-covered.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/frag-fully-covered.frag new file mode 100644 index 0000000000..0f22a7de2a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/frag-fully-covered.frag @@ -0,0 +1,14 @@ +#version 450 +#extension GL_NV_conservative_raster_underestimation : require + +layout(location = 0) out vec4 FragColor; + +void main() +{ + if (!gl_FragFullyCoveredNV) + { + discard; + } + FragColor = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag.vk new file mode 100644 index 0000000000..4aaf397a0f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag.vk @@ -0,0 +1,11 @@ +#version 450 +#extension GL_AMD_shader_fragment_mask : require + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS t; + +void main() +{ + vec4 test2 = fragmentFetchAMD(t, 4u); + uint testi2 = fragmentMaskFetchAMD(t); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/fs.invalid.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/fs.invalid.frag new file mode 100644 index 0000000000..8548a8733f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/fs.invalid.frag @@ -0,0 +1,15 @@ +#version 450 +#extension GL_AMD_shader_explicit_vertex_parameter : require +#extension GL_AMD_shader_fragment_mask : require + +layout(binding = 0) uniform sampler2DMS texture1; + +layout(location = 0) __explicitInterpAMD in vec4 vary; + +void main() +{ + uint testi1 = fragmentMaskFetchAMD(texture1, ivec2(0)); + vec4 test1 = fragmentFetchAMD(texture1, ivec2(1), 2u); + vec4 pos = interpolateAtVertexAMD(vary, 0u); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/image-gather.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/image-gather.frag new file mode 100644 index 0000000000..1baccdfa53 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/image-gather.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSamp; +layout(binding = 1) uniform sampler2DShadow uSampShadow; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec3 vUV; + +void main() +{ + FragColor = textureGather(uSamp, vUV.xy); + FragColor += textureGather(uSamp, vUV.xy, 1); + FragColor += textureGather(uSampShadow, vUV.xy, vUV.z); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag new file mode 100644 index 0000000000..3a4e086643 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/modf-non-function-purity-analysis.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 1) out vec4 vo1; +layout(location = 0) out vec4 vo0; + +vec4 modf_inner() +{ + vec4 _16 = modf(v, vo1); + return _16; +} + +void main() +{ + vec4 _20 = modf_inner(); + vo0 = _20; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag new file mode 100644 index 0000000000..ef6bb526ab --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uTextures[2 * 3 * 1]; + +layout(location = 1) in vec2 vUV; +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int vIndex; + +void main() +{ + vec4 values3[2 * 3 * 1]; + for (int z = 0; z < 2; z++) + { + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 1; x++) + { + values3[z * 3 * 1 + y * 1 + x] = texture(uTextures[z * 3 * 1 + y * 1 + x], vUV); + } + } + } + FragColor = (values3[1 * 3 * 1 + 2 * 1 + 0] + values3[0 * 3 * 1 + 2 * 1 + 0]) + values3[(vIndex + 1) * 3 * 1 + 2 * 1 + vIndex]; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag.vk new file mode 100644 index 0000000000..ab58862ffd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag.vk @@ -0,0 +1,15 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(set = 0, binding = 0) uniform texture2D uTex[]; +layout(set = 1, binding = 0) uniform sampler Immut; + +layout(location = 0) out vec4 FragColor; +layout(location = 1) flat in int vIndex; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = texture(nonuniformEXT(sampler2D(uTex[vIndex], Immut)), vUV); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag new file mode 100644 index 0000000000..a4a962e163 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag @@ -0,0 +1,46 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +} _14; + +layout(binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +} _35; + +void callee2() +{ + int _25 = int(gl_FragCoord.x); + _14.values1[_25]++; +} + +void callee() +{ + int _38 = int(gl_FragCoord.x); + _35.values0[_38]++; + callee2(); +} + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + callee(); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag.vk new file mode 100644 index 0000000000..434cb3d3d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag.vk @@ -0,0 +1,24 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require + +layout(set = 0, binding = 0, std430) uniform UBO +{ + float a[1024]; + vec3 b[2]; +} _17; + +layout(set = 0, binding = 1, std430) uniform UBOEnhancedLayout +{ + layout(offset = 0) float c[1024]; + layout(offset = 4096) vec3 d[2]; + layout(offset = 10000) float e; +} _30; + +layout(location = 0) out float FragColor; +layout(location = 0) flat in int vIndex; + +void main() +{ + FragColor = (_17.a[vIndex] + _30.c[vIndex]) + _30.e; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag new file mode 100644 index 0000000000..df0daa79de --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag @@ -0,0 +1,46 @@ +#version 450 +#extension GL_ARB_sparse_texture2 : require +#extension GL_ARB_sparse_texture_clamp : require + +struct ResType +{ + int _m0; + vec4 _m1; +}; + +layout(binding = 0) uniform sampler2D uSamp; + +layout(location = 0) in vec2 vUV; + +void main() +{ + int _66; + vec4 _67; + _66 = sparseTextureClampARB(uSamp, vUV, 1.0, _67, 2.0); + ResType _25 = ResType(_66, _67); + vec4 texel = _25._m1; + int code = _25._m0; + texel = textureClampARB(uSamp, vUV, 1.0, 2.0); + int _68; + vec4 _69; + _68 = sparseTextureOffsetClampARB(uSamp, vUV, ivec2(1, 2), 1.0, _69, 2.0); + ResType _37 = ResType(_68, _69); + texel = _37._m1; + code = _37._m0; + texel = textureOffsetClampARB(uSamp, vUV, ivec2(1, 2), 1.0, 2.0); + int _70; + vec4 _71; + _70 = sparseTextureGradClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), 1.0, _71); + ResType _47 = ResType(_70, _71); + texel = _47._m1; + code = _47._m0; + texel = textureGradClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), 1.0); + int _72; + vec4 _73; + _72 = sparseTextureGradOffsetClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), ivec2(-1, -2), 1.0, _73); + ResType _58 = ResType(_72, _73); + texel = _58._m1; + code = _58._m0; + texel = textureGradOffsetClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), ivec2(-1, -2), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag new file mode 100644 index 0000000000..7faa226430 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag @@ -0,0 +1,105 @@ +#version 450 +#extension GL_ARB_sparse_texture2 : require +#extension GL_ARB_sparse_texture_clamp : require + +struct ResType +{ + int _m0; + vec4 _m1; +}; + +layout(binding = 0) uniform sampler2D uSamp; +layout(binding = 1) uniform sampler2DMS uSampMS; +layout(binding = 2, rgba8) uniform readonly image2D uImage; +layout(binding = 3, rgba8) uniform readonly image2DMS uImageMS; + +layout(location = 0) in vec2 vUV; + +void main() +{ + int _144; + vec4 _145; + _144 = sparseTextureARB(uSamp, vUV, _145); + ResType _24 = ResType(_144, _145); + vec4 texel = _24._m1; + bool ret = sparseTexelsResidentARB(_24._m0); + int _146; + vec4 _147; + _146 = sparseTextureARB(uSamp, vUV, _147, 1.10000002384185791015625); + ResType _31 = ResType(_146, _147); + texel = _31._m1; + ret = sparseTexelsResidentARB(_31._m0); + int _148; + vec4 _149; + _148 = sparseTextureLodARB(uSamp, vUV, 1.0, _149); + ResType _38 = ResType(_148, _149); + texel = _38._m1; + ret = sparseTexelsResidentARB(_38._m0); + int _150; + vec4 _151; + _150 = sparseTextureOffsetARB(uSamp, vUV, ivec2(1), _151); + ResType _47 = ResType(_150, _151); + texel = _47._m1; + ret = sparseTexelsResidentARB(_47._m0); + int _152; + vec4 _153; + _152 = sparseTextureOffsetARB(uSamp, vUV, ivec2(2), _153, 0.5); + ResType _56 = ResType(_152, _153); + texel = _56._m1; + ret = sparseTexelsResidentARB(_56._m0); + int _154; + vec4 _155; + _154 = sparseTexelFetchARB(uSamp, ivec2(vUV), 1, _155); + ResType _64 = ResType(_154, _155); + texel = _64._m1; + ret = sparseTexelsResidentARB(_64._m0); + int _156; + vec4 _157; + _156 = sparseTexelFetchARB(uSampMS, ivec2(vUV), 2, _157); + ResType _76 = ResType(_156, _157); + texel = _76._m1; + ret = sparseTexelsResidentARB(_76._m0); + int _158; + vec4 _159; + _158 = sparseTexelFetchOffsetARB(uSamp, ivec2(vUV), 1, ivec2(2, 3), _159); + ResType _86 = ResType(_158, _159); + texel = _86._m1; + ret = sparseTexelsResidentARB(_86._m0); + int _160; + vec4 _161; + _160 = sparseTextureLodOffsetARB(uSamp, vUV, 1.5, ivec2(2, 3), _161); + ResType _93 = ResType(_160, _161); + texel = _93._m1; + ret = sparseTexelsResidentARB(_93._m0); + int _162; + vec4 _163; + _162 = sparseTextureGradARB(uSamp, vUV, vec2(1.0), vec2(3.0), _163); + ResType _102 = ResType(_162, _163); + texel = _102._m1; + ret = sparseTexelsResidentARB(_102._m0); + int _164; + vec4 _165; + _164 = sparseTextureGradOffsetARB(uSamp, vUV, vec2(1.0), vec2(3.0), ivec2(-2, -3), _165); + ResType _111 = ResType(_164, _165); + texel = _111._m1; + ret = sparseTexelsResidentARB(_111._m0); + int _166; + vec4 _167; + _166 = sparseTextureClampARB(uSamp, vUV, 4.0, _167); + ResType _118 = ResType(_166, _167); + texel = _118._m1; + ret = sparseTexelsResidentARB(_118._m0); + int _168; + vec4 _169; + _168 = sparseImageLoadARB(uImage, ivec2(vUV), _169); + ResType _128 = ResType(_168, _169); + texel = _128._m1; + ret = sparseTexelsResidentARB(_128._m0); + int _170; + vec4 _171; + _170 = sparseImageLoadARB(uImageMS, ivec2(vUV), 1, _171); + ResType _138 = ResType(_170, _171); + texel = _138._m1; + ret = sparseTexelsResidentARB(_138._m0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag new file mode 100644 index 0000000000..00a146c4d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_EXT_shader_framebuffer_fetch : require +precision mediump float; +precision highp int; + +mediump vec4 uSubpass0; +mediump vec4 uSubpass1; + +layout(location = 0) inout vec3 FragColor; +layout(location = 1) inout vec4 FragColor2; + +void main() +{ + uSubpass0.xyz = FragColor; + uSubpass1 = FragColor2; + FragColor = uSubpass0.xyz + uSubpass1.xyz; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag new file mode 100644 index 0000000000..8600549859 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag @@ -0,0 +1,18 @@ +#version 310 es +#extension GL_EXT_shader_framebuffer_fetch_non_coherent : require +precision mediump float; +precision highp int; + +mediump vec4 uSubpass0; +mediump vec4 uSubpass1; + +layout(location = 0, noncoherent) inout vec3 FragColor; +layout(location = 1, noncoherent) inout vec4 FragColor2; + +void main() +{ + uSubpass0.xyz = FragColor; + uSubpass1 = FragColor2; + FragColor = uSubpass0.xyz + uSubpass1.xyz; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag new file mode 100644 index 0000000000..d1b7265121 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag @@ -0,0 +1,16 @@ +#version 100 +#extension GL_EXT_shader_framebuffer_fetch : require +#extension GL_EXT_draw_buffers : require +precision mediump float; +precision highp int; + +mediump vec4 uSubpass0; +mediump vec4 uSubpass1; + +void main() +{ + uSubpass0 = gl_LastFragData[0]; + uSubpass1 = gl_LastFragData[1]; + gl_FragData[0] = uSubpass0.xyz + uSubpass1.xyz; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag new file mode 100644 index 0000000000..c0a40571b0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag @@ -0,0 +1,16 @@ +#version 100 +#extension GL_EXT_shader_framebuffer_fetch_non_coherent : require +#extension GL_EXT_draw_buffers : require +precision mediump float; +precision highp int; + +mediump vec4 uSubpass0; +mediump vec4 uSubpass1; + +void main() +{ + uSubpass0 = gl_LastFragData[0]; + uSubpass1 = gl_LastFragData[1]; + gl_FragData[0] = uSubpass0.xyz + uSubpass1.xyz; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-offsets.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-offsets.frag new file mode 100644 index 0000000000..36409dd3c3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-offsets.frag @@ -0,0 +1,12 @@ +#version 460 + +layout(binding = 0) uniform sampler2D Image0; + +layout(location = 0) out vec4 outColor; +layout(location = 0) in vec2 inUv; + +void main() +{ + outColor = textureGatherOffsets(Image0, inUv, ivec2[](ivec2(0), ivec2(1, 0), ivec2(1), ivec2(0, 1))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..66dcb369cc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSamp; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = textureGather(uSamp, vUV, int(1u)); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.es.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.es.frag new file mode 100644 index 0000000000..71efb7bcc6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.es.frag @@ -0,0 +1,30 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform highp sampler2D uSamp; +layout(binding = 1) uniform highp sampler2DShadow uSampShadow; +layout(binding = 2) uniform highp sampler2DArray uSampArray; +layout(binding = 3) uniform highp sampler2DArrayShadow uSampArrayShadow; +layout(binding = 4, r32f) uniform highp image2D uImage; + +layout(location = 0) out highp vec4 FragColor; +layout(location = 0) in highp vec4 vUV; + +void main() +{ + FragColor = texture(uSamp, vec2(vUV.x, 0.0)); + FragColor += textureProj(uSamp, vec3(vUV.xy.x, 0.0, vUV.xy.y)); + FragColor += texelFetch(uSamp, ivec2(int(vUV.x), 0), 0); + FragColor += vec4(texture(uSampShadow, vec3(vUV.xyz.x, 0.0, vUV.xyz.z))); + highp vec4 _54 = vUV; + highp vec4 _57 = _54; + _57.y = _54.w; + FragColor += vec4(textureProj(uSampShadow, vec4(_57.x, 0.0, _54.z, _57.y))); + FragColor = texture(uSampArray, vec3(vUV.xy.x, 0.0, vUV.xy.y)); + FragColor += texelFetch(uSampArray, ivec3(ivec2(vUV.xy).x, 0, ivec2(vUV.xy).y), 0); + FragColor += vec4(texture(uSampArrayShadow, vec4(vUV.xyz.xy.x, 0.0, vUV.xyz.xy.y, vUV.xyz.z))); + FragColor += imageLoad(uImage, ivec2(int(vUV.x), 0)); + imageStore(uImage, ivec2(int(vUV.x), 0), FragColor); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.legacy.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.legacy.frag new file mode 100644 index 0000000000..e6a14ed30c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/texture1d-emulation.legacy.frag @@ -0,0 +1,21 @@ +#version 100 +#extension GL_EXT_shadow_samplers : require +precision mediump float; +precision highp int; + +uniform highp sampler2D uSamp; +uniform highp sampler2DShadow uSampShadow; + +varying highp vec4 vUV; + +void main() +{ + gl_FragData[0] = texture2D(uSamp, vec2(vUV.x, 0.0)); + gl_FragData[0] += texture2DProj(uSamp, vec3(vUV.xy.x, 0.0, vUV.xy.y)); + gl_FragData[0] += vec4(shadow2DEXT(uSampShadow, vec3(vUV.xyz.x, 0.0, vUV.xyz.z))); + highp vec4 _44 = vUV; + highp vec4 _47 = _44; + _47.y = _44.w; + gl_FragData[0] += vec4(shadow2DProjEXT(uSampShadow, vec4(_47.x, 0.0, _44.z, _47.y))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/reference/shaders-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..c902723508 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,28 @@ +#version 450 + +struct Foo +{ + int a; +}; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; +int uninit_int = 0; +ivec4 uninit_vector = ivec4(0); +mat4 uninit_matrix = mat4(vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); +Foo uninit_foo = Foo(0); + +void main() +{ + int uninit_function_int = 0; + if (vColor.x > 10.0) + { + uninit_function_int = 10; + } + else + { + uninit_function_int = 20; + } + FragColor = vColor; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag b/third_party/spirv-cross/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag new file mode 100644 index 0000000000..f46bc2fd88 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag @@ -0,0 +1,24 @@ +#version 100 +precision mediump float; +precision highp int; + +vec2 _19; + +void main() +{ + highp vec2 _30; + for (int spvDummy15 = 0; spvDummy15 < 1; spvDummy15++) + { + if (gl_FragCoord.x != gl_FragCoord.x) + { + _30 = _19; + break; + } + highp vec2 _29; + _29.y = _19.y; + _30 = _29; + break; + } + gl_FragData[0] = vec4(_30, 1.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task.vk b/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task.vk new file mode 100644 index 0000000000..98704e22de --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task.vk @@ -0,0 +1,42 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 4, local_size_y = 3, local_size_z = 2) in; + +struct Payload +{ + float v[3]; +}; + +shared float vs[24]; +taskPayloadSharedEXT Payload p; + +void main() +{ + vs[gl_LocalInvocationIndex] = 10.0; + barrier(); + if (gl_LocalInvocationIndex < 12u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 12u]; + } + barrier(); + if (gl_LocalInvocationIndex < 6u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 6u]; + } + barrier(); + if (gl_LocalInvocationIndex < 3u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 3u]; + } + barrier(); + p.v[gl_LocalInvocationIndex] = vs[gl_LocalInvocationIndex]; + if (vs[5] > 20.0) + { + EmitMeshTasksEXT(uint(int(vs[4])), uint(int(vs[6])), uint(int(vs[8]))); + } + else + { + EmitMeshTasksEXT(uint(int(vs[6])), 10u, 50u); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task.vk b/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task.vk new file mode 100644 index 0000000000..1d491e7014 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task.vk @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 4, local_size_y = 3, local_size_z = 2) in; + +struct Payload +{ + float v[3]; +}; + +shared float vs[24]; +taskPayloadSharedEXT Payload p; + +void main() +{ + vs[gl_LocalInvocationIndex] = 10.0; + barrier(); + if (gl_LocalInvocationIndex < 12u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 12u]; + } + barrier(); + if (gl_LocalInvocationIndex < 6u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 6u]; + } + barrier(); + if (gl_LocalInvocationIndex < 3u) + { + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 3u]; + } + barrier(); + p.v[gl_LocalInvocationIndex] = vs[gl_LocalInvocationIndex]; + EmitMeshTasksEXT(uint(int(vs[4])), uint(int(vs[6])), uint(int(vs[8]))); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vert/io-blocks.force-flattened-io.vert b/third_party/spirv-cross/reference/shaders-no-opt/vert/io-blocks.force-flattened-io.vert new file mode 100644 index 0000000000..604de8a2cc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vert/io-blocks.force-flattened-io.vert @@ -0,0 +1,25 @@ +#version 450 + +struct Foo +{ + vec4 bar[2]; + vec4 baz[2]; +}; + +out vec4 _14_foo_bar[2]; +out vec4 _14_foo_baz[2]; +out vec4 _14_foo2_bar[2]; +out vec4 _14_foo2_baz[2]; +out vec4 foo3_bar[2]; +out vec4 foo3_baz[2]; + +void main() +{ + _14_foo_bar[0] = vec4(1.0); + _14_foo_baz[1] = vec4(2.0); + _14_foo2_bar[0] = vec4(3.0); + _14_foo2_baz[1] = vec4(4.0); + foo3_bar[0] = vec4(5.0); + foo3_baz[1] = vec4(6.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/reference/shaders-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..45d4210819 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,27 @@ +#version 310 es + +layout(location = 0) in int Index1; +layout(location = 1) in int Index2; + +vec4 consume_constant_arrays2(vec4 positions[4], vec4 positions2[4]) +{ + vec4 indexable[4] = positions; + vec4 indexable_1[4] = positions2; + return indexable[Index1] + indexable_1[Index2]; +} + +vec4 consume_constant_arrays(vec4 positions[4], vec4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +void main() +{ + vec4 LUT2[4]; + LUT2[0] = vec4(10.0); + LUT2[1] = vec4(11.0); + LUT2[2] = vec4(12.0); + LUT2[3] = vec4(13.0); + gl_Position = consume_constant_arrays(vec4[](vec4(0.0), vec4(1.0), vec4(2.0), vec4(3.0)), LUT2); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag.vk new file mode 100644 index 0000000000..e5c67115ca --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag.vk @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_fragment_shading_rate : require + +layout(location = 0) out uint FragColor; + +void main() +{ + FragColor = uint(gl_ShadingRateEXT); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..2ae3b6b54f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag @@ -0,0 +1,131 @@ +#version 310 es +precision mediump float; +precision highp int; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 1.0 +#endif +const float a = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 2.0 +#endif +const float b = SPIRV_CROSS_CONSTANT_ID_2; +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 3 +#endif +const int c = SPIRV_CROSS_CONSTANT_ID_3; +const uint _18 = (uint(c) + 0u); +const int _21 = (-c); +const int _23 = (~c); +#ifndef SPIRV_CROSS_CONSTANT_ID_4 +#define SPIRV_CROSS_CONSTANT_ID_4 4 +#endif +const int d = SPIRV_CROSS_CONSTANT_ID_4; +const int _26 = (c + d); +const int _28 = (c - d); +const int _30 = (c * d); +const int _32 = (c / d); +#ifndef SPIRV_CROSS_CONSTANT_ID_5 +#define SPIRV_CROSS_CONSTANT_ID_5 5u +#endif +const uint e = SPIRV_CROSS_CONSTANT_ID_5; +#ifndef SPIRV_CROSS_CONSTANT_ID_6 +#define SPIRV_CROSS_CONSTANT_ID_6 6u +#endif +const uint f = SPIRV_CROSS_CONSTANT_ID_6; +const uint _36 = (e / f); +const int _38 = (c % d); +const uint _40 = (e % f); +const int _42 = (c >> d); +const uint _44 = (e >> f); +const int _46 = (c << d); +const int _48 = (c | d); +const int _50 = (c ^ d); +const int _52 = (c & d); +#ifndef SPIRV_CROSS_CONSTANT_ID_7 +#define SPIRV_CROSS_CONSTANT_ID_7 false +#endif +const bool g = SPIRV_CROSS_CONSTANT_ID_7; +#ifndef SPIRV_CROSS_CONSTANT_ID_8 +#define SPIRV_CROSS_CONSTANT_ID_8 true +#endif +const bool h = SPIRV_CROSS_CONSTANT_ID_8; +const bool _58 = (g || h); +const bool _60 = (g && h); +const bool _62 = (!g); +const bool _64 = (g == h); +const bool _66 = (g != h); +const bool _68 = (c == d); +const bool _70 = (c != d); +const bool _72 = (c < d); +const bool _74 = (e < f); +const bool _76 = (c > d); +const bool _78 = (e > f); +const bool _80 = (c <= d); +const bool _82 = (e <= f); +const bool _84 = (c >= d); +const bool _86 = (e >= f); +const int _92 = int(e + 0u); +const bool _94 = (c != int(0u)); +const bool _96 = (e != 0u); +const int _100 = int(g); +const uint _103 = uint(g); +const int _118 = (c + 3); +const int _127 = (c + 2); +const int _135 = (d + 2); + +struct Foo +{ + float elems[_135]; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float t0 = a; + float t1 = b; + mediump uint c0 = _18; + mediump int c1 = _21; + mediump int c2 = _23; + mediump int c3 = _26; + mediump int c4 = _28; + mediump int c5 = _30; + mediump int c6 = _32; + mediump uint c7 = _36; + mediump int c8 = _38; + mediump uint c9 = _40; + mediump int c10 = _42; + mediump uint c11 = _44; + mediump int c12 = _46; + mediump int c13 = _48; + mediump int c14 = _50; + mediump int c15 = _52; + bool c16 = _58; + bool c17 = _60; + bool c18 = _62; + bool c19 = _64; + bool c20 = _66; + bool c21 = _68; + bool c22 = _70; + bool c23 = _72; + bool c24 = _74; + bool c25 = _76; + bool c26 = _78; + bool c27 = _80; + bool c28 = _82; + bool c29 = _84; + bool c30 = _86; + mediump int c31 = c8 + c3; + mediump int c32 = _92; + bool c33 = _94; + bool c34 = _96; + mediump int c35 = _100; + mediump uint c36 = _103; + float c37 = float(g); + float vec0[_118][8]; + float vec1[_127]; + Foo foo; + FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[c]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag.vk new file mode 100644 index 0000000000..c5ae60b276 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag.vk @@ -0,0 +1,107 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +const uint _18 = (uint(c) + 0u); +const int _21 = (-c); +const int _23 = (~c); +layout(constant_id = 4) const int d = 4; +const int _26 = (c + d); +const int _28 = (c - d); +const int _30 = (c * d); +const int _32 = (c / d); +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +const uint _36 = (e / f); +const int _38 = (c % d); +const uint _40 = (e % f); +const int _42 = (c >> d); +const uint _44 = (e >> f); +const int _46 = (c << d); +const int _48 = (c | d); +const int _50 = (c ^ d); +const int _52 = (c & d); +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; +const bool _58 = (g || h); +const bool _60 = (g && h); +const bool _62 = (!g); +const bool _64 = (g == h); +const bool _66 = (g != h); +const bool _68 = (c == d); +const bool _70 = (c != d); +const bool _72 = (c < d); +const bool _74 = (e < f); +const bool _76 = (c > d); +const bool _78 = (e > f); +const bool _80 = (c <= d); +const bool _82 = (e <= f); +const bool _84 = (c >= d); +const bool _86 = (e >= f); +const int _92 = int(e + 0u); +const bool _94 = (c != int(0u)); +const bool _96 = (e != 0u); +const int _100 = int(g); +const uint _103 = uint(g); +const int _118 = (c + 3); +const int _127 = (c + 2); +const int _135 = (d + 2); + +struct Foo +{ + float elems[_135]; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float t0 = a; + float t1 = b; + mediump uint c0 = _18; + mediump int c1 = _21; + mediump int c2 = _23; + mediump int c3 = _26; + mediump int c4 = _28; + mediump int c5 = _30; + mediump int c6 = _32; + mediump uint c7 = _36; + mediump int c8 = _38; + mediump uint c9 = _40; + mediump int c10 = _42; + mediump uint c11 = _44; + mediump int c12 = _46; + mediump int c13 = _48; + mediump int c14 = _50; + mediump int c15 = _52; + bool c16 = _58; + bool c17 = _60; + bool c18 = _62; + bool c19 = _64; + bool c20 = _66; + bool c21 = _68; + bool c22 = _70; + bool c23 = _72; + bool c24 = _74; + bool c25 = _76; + bool c26 = _78; + bool c27 = _80; + bool c28 = _82; + bool c29 = _84; + bool c30 = _86; + mediump int c31 = c8 + c3; + mediump int c32 = _92; + bool c33 = _94; + bool c34 = _96; + mediump int c35 = _100; + mediump uint c36 = _103; + float c37 = float(g); + float vec0[_118][8]; + float vec1[_127]; + Foo foo; + FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[c]); +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag.vk new file mode 100644 index 0000000000..380b746591 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag.vk @@ -0,0 +1,16 @@ +#version 450 + +layout(set = 0, binding = 0, std140) uniform UBO +{ + layout(offset = 16) mat4 m; + layout(offset = 0) vec4 v; +} _13; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = (_13.m * vColor) + _13.v; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag.vk b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag.vk new file mode 100644 index 0000000000..73b0f9b097 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag.vk @@ -0,0 +1,16 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out float FragColor; + +void main() +{ + bool _12 = gl_HelperInvocation; + float _15 = float(_12); + FragColor = _15; + demote; + bool _16 = gl_HelperInvocation; + float _17 = float(_16); + FragColor = _17; +} + diff --git a/third_party/spirv-cross/reference/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert.vk b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert.vk new file mode 100644 index 0000000000..4736723322 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert.vk @@ -0,0 +1,9 @@ +#version 450 +#extension GL_EXT_fragment_shading_rate : require + +void main() +{ + gl_PrimitiveShadingRateEXT = 3; + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/aliased-entry-point-names.asm.multi.json b/third_party/spirv-cross/reference/shaders-reflection/asm/aliased-entry-point-names.asm.multi.json new file mode 100644 index 0000000000..666167af4a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/aliased-entry-point-names.asm.multi.json @@ -0,0 +1,55 @@ +{ + "entryPoints" : [ + { + "name" : "maim", + "mode" : "vert" + }, + { + "name" : "main", + "mode" : "vert" + }, + { + "name" : "maim", + "mode" : "frag" + }, + { + "name" : "main", + "mode" : "frag" + } + ], + "types" : { + "_8" : { + "name" : "_8", + "members" : [ + { + "name" : "_m0", + "type" : "vec4" + }, + { + "name" : "_m1", + "type" : "float" + }, + { + "name" : "_m2", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + }, + { + "name" : "_m3", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + } + ] + } + } +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp.json new file mode 100644 index 0000000000..b9224eccdb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp.json @@ -0,0 +1,71 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_3" : { + "name" : "Params", + "members" : [ + { + "name" : "x", + "type" : "float", + "offset" : 0 + }, + { + "name" : "y", + "type" : "_6", + "offset" : 16, + "physical_pointer" : true + } + ] + }, + "_4" : { + "name" : "IntBuf", + "members" : [ + { + "name" : "v", + "type" : "int", + "offset" : 0 + } + ] + }, + "_11" : { + "name" : "IntBuf", + "type" : "_4", + "physical_pointer" : true + }, + "_6" : { + "name" : "IntBuf", + "array" : [ + 3 + ], + "array_size_is_literal" : [ + true + ], + "type" : "_11", + "array_stride" : 16 + } + }, + "ubos" : [ + { + "type" : "_3", + "name" : "Params", + "block_size" : 24, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp.json new file mode 100644 index 0000000000..3b0c9868e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp.json @@ -0,0 +1,46 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_5" : { + "name" : "SSBO0", + "members" : [ + { + "name" : "a", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_5", + "name" : "SSBO0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp.json new file mode 100644 index 0000000000..80cf862227 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp.json @@ -0,0 +1,70 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "SSBO0", + "members" : [ + { + "name" : "a", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + }, + "_6" : { + "name" : "SSBO1", + "members" : [ + { + "name" : "b", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "SSBO0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + }, + { + "type" : "_6", + "name" : "SSBO1", + "block_size" : 0, + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp.json new file mode 100644 index 0000000000..b34f85bb5a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp.json @@ -0,0 +1,46 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "UAV0", + "members" : [ + { + "name" : "@data", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "UAV0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp.json new file mode 100644 index 0000000000..052e3ba814 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp.json @@ -0,0 +1,53 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "UAV0", + "members" : [ + { + "name" : "@data", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "UAV0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + }, + { + "type" : "_4", + "name" : "UAV1", + "block_size" : 0, + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp.json new file mode 100644 index 0000000000..3b0c9868e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp.json @@ -0,0 +1,46 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_5" : { + "name" : "SSBO0", + "members" : [ + { + "name" : "a", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_5", + "name" : "SSBO0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp.json new file mode 100644 index 0000000000..80cf862227 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp.json @@ -0,0 +1,70 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "SSBO0", + "members" : [ + { + "name" : "a", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + }, + "_6" : { + "name" : "SSBO1", + "members" : [ + { + "name" : "b", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "SSBO0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + }, + { + "type" : "_6", + "name" : "SSBO1", + "block_size" : 0, + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-1.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-1.asm.comp.json new file mode 100644 index 0000000000..b34f85bb5a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-1.asm.comp.json @@ -0,0 +1,46 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "UAV0", + "members" : [ + { + "name" : "@data", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "UAV0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-2.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-2.asm.comp.json new file mode 100644 index 0000000000..052e3ba814 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/asm/op-source-none-uav-2.asm.comp.json @@ -0,0 +1,53 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_4" : { + "name" : "UAV0", + "members" : [ + { + "name" : "@data", + "type" : "vec4", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_4", + "name" : "UAV0", + "block_size" : 0, + "set" : 0, + "binding" : 0 + }, + { + "type" : "_4", + "name" : "UAV1", + "block_size" : 0, + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/array-of-physical-pointer.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/array-of-physical-pointer.comp.json new file mode 100644 index 0000000000..a5da58c1a7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/array-of-physical-pointer.comp.json @@ -0,0 +1,66 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_11" : { + "name" : "Params", + "members" : [ + { + "name" : "x", + "type" : "float", + "offset" : 0 + }, + { + "name" : "y", + "type" : "_7", + "array" : [ + 3 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 16, + "array_stride" : 16 + } + ] + }, + "_13" : { + "name" : "IntBuf", + "members" : [ + { + "name" : "v", + "type" : "int", + "offset" : 0 + } + ] + }, + "_7" : { + "name" : "IntBuf", + "type" : "_13", + "physical_pointer" : true + } + }, + "ubos" : [ + { + "type" : "_11", + "name" : "Params", + "block_size" : 64, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/function-pointer.invalid.asm.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/function-pointer.invalid.asm.comp.json new file mode 100644 index 0000000000..bed59455f0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/function-pointer.invalid.asm.comp.json @@ -0,0 +1,18 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/out-of-order-block-offsets.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/out-of-order-block-offsets.comp.json new file mode 100644 index 0000000000..b697b453b1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/out-of-order-block-offsets.comp.json @@ -0,0 +1,44 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_7" : { + "name" : "SSBO", + "members" : [ + { + "name" : "foo", + "type" : "uint", + "offset" : 8 + }, + { + "name" : "bar", + "type" : "uint", + "offset" : 4 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_7", + "name" : "SSBO", + "block_size" : 12, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/physical-pointer.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/physical-pointer.comp.json new file mode 100644 index 0000000000..a397d0febc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/physical-pointer.comp.json @@ -0,0 +1,55 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_8" : { + "name" : "Params", + "members" : [ + { + "name" : "x", + "type" : "float", + "offset" : 0 + }, + { + "name" : "y", + "type" : "_10", + "offset" : 8, + "physical_pointer" : true + } + ] + }, + "_10" : { + "name" : "IntBuf", + "members" : [ + { + "name" : "v", + "type" : "int", + "offset" : 0 + } + ] + } + }, + "ubos" : [ + { + "type" : "_8", + "name" : "Params", + "block_size" : 16, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/struct-layout.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/struct-layout.comp.json new file mode 100644 index 0000000000..e9bf7eea90 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/struct-layout.comp.json @@ -0,0 +1,83 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_19" : { + "name" : "Foo", + "members" : [ + { + "name" : "m", + "type" : "mat4", + "offset" : 0, + "matrix_stride" : 16 + } + ] + }, + "_21" : { + "name" : "SSBO2", + "members" : [ + { + "name" : "out_data", + "type" : "_19", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 64 + } + ] + }, + "_28" : { + "name" : "SSBO", + "members" : [ + { + "name" : "in_data", + "type" : "_19", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 64 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_21", + "name" : "SSBO2", + "writeonly" : true, + "block_size" : 0, + "set" : 0, + "binding" : 1 + }, + { + "type" : "_28", + "name" : "SSBO", + "readonly" : true, + "block_size" : 0, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/struct-packing.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/struct-packing.comp.json new file mode 100644 index 0000000000..12285ae24e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/struct-packing.comp.json @@ -0,0 +1,590 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 1, + 1, + 1 + ], + "workgroup_size_is_spec_constant_id" : [ + false, + false, + false + ] + } + ], + "types" : { + "_11" : { + "name" : "S0", + "members" : [ + { + "name" : "a", + "type" : "vec2", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 8 + }, + { + "name" : "b", + "type" : "float", + "offset" : 8 + } + ] + }, + "_14" : { + "name" : "S1", + "members" : [ + { + "name" : "a", + "type" : "vec3", + "offset" : 0 + }, + { + "name" : "b", + "type" : "float", + "offset" : 12 + } + ] + }, + "_17" : { + "name" : "S2", + "members" : [ + { + "name" : "a", + "type" : "vec3", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + }, + { + "name" : "b", + "type" : "float", + "offset" : 16 + } + ] + }, + "_19" : { + "name" : "S3", + "members" : [ + { + "name" : "a", + "type" : "vec2", + "offset" : 0 + }, + { + "name" : "b", + "type" : "float", + "offset" : 8 + } + ] + }, + "_20" : { + "name" : "S4", + "members" : [ + { + "name" : "c", + "type" : "vec2", + "offset" : 0 + } + ] + }, + "_23" : { + "name" : "Content", + "members" : [ + { + "name" : "m0s", + "type" : "_11", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + }, + { + "name" : "m1s", + "type" : "_14", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 16, + "array_stride" : 16 + }, + { + "name" : "m2s", + "type" : "_17", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 32, + "array_stride" : 32 + }, + { + "name" : "m0", + "type" : "_11", + "offset" : 64 + }, + { + "name" : "m1", + "type" : "_14", + "offset" : 80 + }, + { + "name" : "m2", + "type" : "_17", + "offset" : 96 + }, + { + "name" : "m3", + "type" : "_19", + "offset" : 128 + }, + { + "name" : "m4", + "type" : "float", + "offset" : 144 + }, + { + "name" : "m3s", + "type" : "_20", + "array" : [ + 8 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 152, + "array_stride" : 8 + } + ] + }, + "_36" : { + "name" : "SSBO1", + "members" : [ + { + "name" : "content", + "type" : "_23", + "offset" : 0 + }, + { + "name" : "content1", + "type" : "_23", + "array" : [ + 2 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 224, + "array_stride" : 224 + }, + { + "name" : "content2", + "type" : "_23", + "offset" : 672 + }, + { + "name" : "m0", + "type" : "mat2", + "offset" : 896, + "matrix_stride" : 8 + }, + { + "name" : "m1", + "type" : "mat2", + "offset" : 912, + "matrix_stride" : 8 + }, + { + "name" : "m2", + "type" : "mat2x3", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 928, + "array_stride" : 32, + "matrix_stride" : 16 + }, + { + "name" : "m3", + "type" : "mat3x2", + "offset" : 1056, + "matrix_stride" : 8 + }, + { + "name" : "m4", + "type" : "mat2", + "offset" : 1080, + "matrix_stride" : 8, + "row_major" : true + }, + { + "name" : "m5", + "type" : "mat2", + "array" : [ + 9 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 1096, + "array_stride" : 16, + "matrix_stride" : 8, + "row_major" : true + }, + { + "name" : "m6", + "type" : "mat2x3", + "array" : [ + 2, + 4 + ], + "array_size_is_literal" : [ + true, + true + ], + "offset" : 1240, + "array_stride" : 48, + "matrix_stride" : 8, + "row_major" : true + }, + { + "name" : "m7", + "type" : "mat3x2", + "offset" : 1440, + "matrix_stride" : 16, + "row_major" : true + }, + { + "name" : "array", + "type" : "float", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 1472, + "array_stride" : 4 + } + ] + }, + "_42" : { + "name" : "S0", + "members" : [ + { + "name" : "a", + "type" : "vec2", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + }, + { + "name" : "b", + "type" : "float", + "offset" : 16 + } + ] + }, + "_44" : { + "name" : "S1", + "members" : [ + { + "name" : "a", + "type" : "vec3", + "offset" : 0 + }, + { + "name" : "b", + "type" : "float", + "offset" : 12 + } + ] + }, + "_47" : { + "name" : "S2", + "members" : [ + { + "name" : "a", + "type" : "vec3", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + }, + { + "name" : "b", + "type" : "float", + "offset" : 16 + } + ] + }, + "_49" : { + "name" : "S3", + "members" : [ + { + "name" : "a", + "type" : "vec2", + "offset" : 0 + }, + { + "name" : "b", + "type" : "float", + "offset" : 8 + } + ] + }, + "_50" : { + "name" : "S4", + "members" : [ + { + "name" : "c", + "type" : "vec2", + "offset" : 0 + } + ] + }, + "_52" : { + "name" : "Content", + "members" : [ + { + "name" : "m0s", + "type" : "_42", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 32 + }, + { + "name" : "m1s", + "type" : "_44", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 32, + "array_stride" : 16 + }, + { + "name" : "m2s", + "type" : "_47", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 48, + "array_stride" : 32 + }, + { + "name" : "m0", + "type" : "_42", + "offset" : 80 + }, + { + "name" : "m1", + "type" : "_44", + "offset" : 112 + }, + { + "name" : "m2", + "type" : "_47", + "offset" : 128 + }, + { + "name" : "m3", + "type" : "_49", + "offset" : 160 + }, + { + "name" : "m4", + "type" : "float", + "offset" : 176 + }, + { + "name" : "m3s", + "type" : "_50", + "array" : [ + 8 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 192, + "array_stride" : 16 + } + ] + }, + "_59" : { + "name" : "SSBO0", + "members" : [ + { + "name" : "content", + "type" : "_52", + "offset" : 0 + }, + { + "name" : "content1", + "type" : "_52", + "array" : [ + 2 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 320, + "array_stride" : 320 + }, + { + "name" : "content2", + "type" : "_52", + "offset" : 960 + }, + { + "name" : "m0", + "type" : "mat2", + "offset" : 1280, + "matrix_stride" : 16 + }, + { + "name" : "m1", + "type" : "mat2", + "offset" : 1312, + "matrix_stride" : 16 + }, + { + "name" : "m2", + "type" : "mat2x3", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 1344, + "array_stride" : 32, + "matrix_stride" : 16 + }, + { + "name" : "m3", + "type" : "mat3x2", + "offset" : 1472, + "matrix_stride" : 16 + }, + { + "name" : "m4", + "type" : "mat2", + "offset" : 1520, + "matrix_stride" : 16, + "row_major" : true + }, + { + "name" : "m5", + "type" : "mat2", + "array" : [ + 9 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 1552, + "array_stride" : 32, + "matrix_stride" : 16, + "row_major" : true + }, + { + "name" : "m6", + "type" : "mat2x3", + "array" : [ + 2, + 4 + ], + "array_size_is_literal" : [ + true, + true + ], + "offset" : 1840, + "array_stride" : 96, + "matrix_stride" : 16, + "row_major" : true + }, + { + "name" : "m7", + "type" : "mat3x2", + "offset" : 2224, + "matrix_stride" : 16, + "row_major" : true + }, + { + "name" : "array", + "type" : "float", + "array" : [ + 0 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 2256, + "array_stride" : 16 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_36", + "name" : "SSBO1", + "restrict" : true, + "block_size" : 1472, + "set" : 0, + "binding" : 1 + }, + { + "type" : "_59", + "name" : "SSBO0", + "restrict" : true, + "block_size" : 2256, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json b/third_party/spirv-cross/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json new file mode 100644 index 0000000000..c67d723003 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/comp/workgroup-size-spec-constant.comp.json @@ -0,0 +1,62 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "comp", + "workgroup_size" : [ + 10, + 40, + 60 + ], + "workgroup_size_is_spec_constant_id" : [ + true, + true, + true + ] + } + ], + "types" : { + "_8" : { + "name" : "SSBO", + "members" : [ + { + "name" : "v", + "type" : "vec4", + "offset" : 0 + } + ] + } + }, + "ssbos" : [ + { + "type" : "_8", + "name" : "SSBO", + "block_size" : 16, + "set" : 0, + "binding" : 0 + } + ], + "specialization_constants" : [ + { + "name" : "", + "id" : 10, + "type" : "uint", + "variable_id" : 18, + "default_value" : 1 + }, + { + "name" : "", + "id" : 40, + "type" : "uint", + "variable_id" : 19, + "default_value" : 1 + }, + { + "name" : "", + "id" : 60, + "type" : "uint", + "variable_id" : 20, + "default_value" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag.json new file mode 100644 index 0000000000..5b4d3c6f7b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag.json @@ -0,0 +1,37 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "outputs" : [ + { + "type" : "float", + "name" : "FragColor", + "location" : 0 + } + ], + "separate_images" : [ + { + "type" : "texture2D", + "name" : "uDepth", + "set" : 0, + "binding" : 2 + } + ], + "separate_samplers" : [ + { + "type" : "sampler", + "name" : "uSampler", + "set" : 0, + "binding" : 0 + }, + { + "type" : "sampler", + "name" : "uSampler1", + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler.vk.frag.json new file mode 100644 index 0000000000..8b6a184299 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/combined-texture-sampler.vk.frag.json @@ -0,0 +1,50 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "inputs" : [ + { + "type" : "vec2", + "name" : "vTex", + "location" : 0 + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ], + "separate_images" : [ + { + "type" : "texture2D", + "name" : "uTexture0", + "set" : 0, + "binding" : 2 + }, + { + "type" : "texture2D", + "name" : "uTexture1", + "set" : 0, + "binding" : 3 + } + ], + "separate_samplers" : [ + { + "type" : "sampler", + "name" : "uSampler0", + "set" : 0, + "binding" : 0 + }, + { + "type" : "sampler", + "name" : "uSampler1", + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/image-load-store-uint-coord.asm.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/image-load-store-uint-coord.asm.frag.json new file mode 100644 index 0000000000..c239527c84 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/image-load-store-uint-coord.asm.frag.json @@ -0,0 +1,47 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "@entryPointOutput", + "location" : 0 + } + ], + "textures" : [ + { + "type" : "sampler2D", + "name" : "ROIm", + "set" : 0, + "binding" : 1 + } + ], + "separate_images" : [ + { + "type" : "samplerBuffer", + "name" : "ROBuf", + "set" : 0, + "binding" : 0 + } + ], + "images" : [ + { + "type" : "image2D", + "name" : "RWIm", + "set" : 0, + "binding" : 1, + "format" : "rgba32f" + }, + { + "type" : "imageBuffer", + "name" : "RWBuf", + "set" : 0, + "binding" : 0, + "format" : "rgba32f" + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment-ms.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment-ms.vk.frag.json new file mode 100644 index 0000000000..5f381911ac --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment-ms.vk.frag.json @@ -0,0 +1,31 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "subpass_inputs" : [ + { + "type" : "subpassInputMS", + "name" : "uSubpass0", + "set" : 0, + "binding" : 0, + "input_attachment_index" : 0 + }, + { + "type" : "subpassInputMS", + "name" : "uSubpass1", + "set" : 0, + "binding" : 1, + "input_attachment_index" : 1 + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment.vk.frag.json new file mode 100644 index 0000000000..16ae6a4683 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/input-attachment.vk.frag.json @@ -0,0 +1,31 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "subpass_inputs" : [ + { + "type" : "subpassInput", + "name" : "uSubpass0", + "set" : 0, + "binding" : 0, + "input_attachment_index" : 0 + }, + { + "type" : "subpassInput", + "name" : "uSubpass1", + "set" : 0, + "binding" : 1, + "input_attachment_index" : 1 + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/push-constant.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/push-constant.vk.frag.json new file mode 100644 index 0000000000..f72a8fd654 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/push-constant.vk.frag.json @@ -0,0 +1,46 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "types" : { + "_13" : { + "name" : "PushConstants", + "members" : [ + { + "name" : "value0", + "type" : "vec4", + "offset" : 0 + }, + { + "name" : "value1", + "type" : "vec4", + "offset" : 16 + } + ] + } + }, + "inputs" : [ + { + "type" : "vec4", + "name" : "vColor", + "location" : 0 + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ], + "push_constants" : [ + { + "type" : "_13", + "name" : "push", + "push_constant" : true + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/separate-sampler-texture-array.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/separate-sampler-texture-array.vk.frag.json new file mode 100644 index 0000000000..e5f2f75624 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/separate-sampler-texture-array.vk.frag.json @@ -0,0 +1,85 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "inputs" : [ + { + "type" : "vec2", + "name" : "vTex", + "location" : 0 + }, + { + "type" : "vec3", + "name" : "vTex3", + "location" : 1 + } + ], + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ], + "separate_images" : [ + { + "type" : "texture2D", + "name" : "uTexture", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "set" : 0, + "binding" : 1 + }, + { + "type" : "texture2DArray", + "name" : "uTextureArray", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "set" : 0, + "binding" : 4 + }, + { + "type" : "textureCube", + "name" : "uTextureCube", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "set" : 0, + "binding" : 3 + }, + { + "type" : "texture3D", + "name" : "uTexture3D", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "set" : 0, + "binding" : 2 + } + ], + "separate_samplers" : [ + { + "type" : "sampler", + "name" : "uSampler", + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/frag/spec-constant.vk.frag.json b/third_party/spirv-cross/reference/shaders-reflection/frag/spec-constant.vk.frag.json new file mode 100644 index 0000000000..dd876dde96 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/frag/spec-constant.vk.frag.json @@ -0,0 +1,90 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "frag" + } + ], + "types" : { + "_137" : { + "name" : "Foo", + "members" : [ + { + "name" : "elems", + "type" : "float", + "array" : [ + 135 + ], + "array_size_is_literal" : [ + false + ] + } + ] + } + }, + "outputs" : [ + { + "type" : "vec4", + "name" : "FragColor", + "location" : 0 + } + ], + "specialization_constants" : [ + { + "name" : "a", + "id" : 1, + "type" : "float", + "variable_id" : 9, + "default_value" : 1.5 + }, + { + "name" : "b", + "id" : 2, + "type" : "float", + "variable_id" : 11, + "default_value" : 2.5 + }, + { + "name" : "c", + "id" : 3, + "type" : "int", + "variable_id" : 16, + "default_value" : 3 + }, + { + "name" : "d", + "id" : 4, + "type" : "int", + "variable_id" : 25, + "default_value" : 4 + }, + { + "name" : "e", + "id" : 5, + "type" : "uint", + "variable_id" : 34, + "default_value" : 5 + }, + { + "name" : "f", + "id" : 6, + "type" : "uint", + "variable_id" : 35, + "default_value" : 6 + }, + { + "name" : "g", + "id" : 7, + "type" : "bool", + "variable_id" : 56, + "default_value" : false + }, + { + "name" : "h", + "id" : 8, + "type" : "bool", + "variable_id" : 57, + "default_value" : true + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json b/third_party/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json new file mode 100644 index 0000000000..6574f7528c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/rgen/acceleration_structure.vk.rgen.json @@ -0,0 +1,16 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "rgen" + } + ], + "acceleration_structures" : [ + { + "type" : "accelerationStructureNV", + "name" : "as", + "set" : 0, + "binding" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/vert/array-size-reflection.vert.json b/third_party/spirv-cross/reference/shaders-reflection/vert/array-size-reflection.vert.json new file mode 100644 index 0000000000..87b6cb060f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/vert/array-size-reflection.vert.json @@ -0,0 +1,78 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "vert" + } + ], + "types" : { + "_11" : { + "name" : "gl_PerVertex", + "members" : [ + { + "name" : "gl_Position", + "type" : "vec4" + }, + { + "name" : "gl_PointSize", + "type" : "float" + }, + { + "name" : "gl_ClipDistance", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + }, + { + "name" : "gl_CullDistance", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + } + ] + }, + "_18" : { + "name" : "u_", + "members" : [ + { + "name" : "u_0", + "type" : "vec4", + "array" : [ + 16 + ], + "array_size_is_literal" : [ + false + ], + "offset" : 0, + "array_stride" : 16 + } + ] + } + }, + "ubos" : [ + { + "type" : "_18", + "name" : "u_", + "block_size" : 16, + "set" : 1, + "binding" : 0 + } + ], + "specialization_constants" : [ + { + "name" : "ARR_SIZE", + "id" : 0, + "type" : "int", + "variable_id" : 16, + "default_value" : 1 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/vert/read-from-row-major-array.vert.json b/third_party/spirv-cross/reference/shaders-reflection/vert/read-from-row-major-array.vert.json new file mode 100644 index 0000000000..cebd66bd9a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/vert/read-from-row-major-array.vert.json @@ -0,0 +1,67 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "vert" + } + ], + "types" : { + "_89" : { + "name" : "gl_PerVertex", + "members" : [ + { + "name" : "gl_Position", + "type" : "vec4" + }, + { + "name" : "gl_PointSize", + "type" : "float" + } + ] + }, + "_102" : { + "name" : "Block", + "members" : [ + { + "name" : "var", + "type" : "mat2x3", + "array" : [ + 4, + 3 + ], + "array_size_is_literal" : [ + true, + true + ], + "offset" : 0, + "array_stride" : 192, + "matrix_stride" : 16, + "row_major" : true + } + ] + } + }, + "inputs" : [ + { + "type" : "vec4", + "name" : "a_position", + "location" : 0 + } + ], + "outputs" : [ + { + "type" : "float", + "name" : "v_vtxResult", + "location" : 0 + } + ], + "ubos" : [ + { + "type" : "_102", + "name" : "Block", + "block_size" : 576, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/vert/stride-reflection.vert.json b/third_party/spirv-cross/reference/shaders-reflection/vert/stride-reflection.vert.json new file mode 100644 index 0000000000..1dd8f18957 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/vert/stride-reflection.vert.json @@ -0,0 +1,96 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "vert" + } + ], + "types" : { + "_11" : { + "name" : "gl_PerVertex", + "members" : [ + { + "name" : "gl_Position", + "type" : "vec4" + }, + { + "name" : "gl_PointSize", + "type" : "float" + }, + { + "name" : "gl_ClipDistance", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + }, + { + "name" : "gl_CullDistance", + "type" : "float", + "array" : [ + 1 + ], + "array_size_is_literal" : [ + true + ] + } + ] + }, + "_21" : { + "name" : "U", + "members" : [ + { + "name" : "v", + "type" : "vec4", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 0, + "array_stride" : 16 + }, + { + "name" : "c", + "type" : "mat4", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 64, + "array_stride" : 64, + "matrix_stride" : 16 + }, + { + "name" : "r", + "type" : "mat4", + "array" : [ + 4 + ], + "array_size_is_literal" : [ + true + ], + "offset" : 320, + "array_stride" : 64, + "matrix_stride" : 16, + "row_major" : true + } + ] + } + }, + "ubos" : [ + { + "type" : "_21", + "name" : "U", + "block_size" : 576, + "set" : 0, + "binding" : 0 + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-reflection/vert/texture_buffer.vert.json b/third_party/spirv-cross/reference/shaders-reflection/vert/texture_buffer.vert.json new file mode 100644 index 0000000000..a936863948 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-reflection/vert/texture_buffer.vert.json @@ -0,0 +1,41 @@ +{ + "entryPoints" : [ + { + "name" : "main", + "mode" : "vert" + } + ], + "types" : { + "_8" : { + "name" : "gl_PerVertex", + "members" : [ + { + "name" : "gl_Position", + "type" : "vec4" + }, + { + "name" : "gl_PointSize", + "type" : "float" + } + ] + } + }, + "textures" : [ + { + "type" : "samplerBuffer", + "name" : "uSamp", + "set" : 0, + "binding" : 4 + } + ], + "images" : [ + { + "type" : "imageBuffer", + "name" : "uSampo", + "readonly" : true, + "set" : 0, + "binding" : 5, + "format" : "rgba32f" + } + ] +} \ No newline at end of file diff --git a/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag new file mode 100644 index 0000000000..429bbf738e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag @@ -0,0 +1,361 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_MobileDirectionalLight +{ + float4 MobileDirectionalLight_DirectionalLightColor; + float4 MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition; + float4 MobileDirectionalLight_DirectionalLightShadowSize; + float4 MobileDirectionalLight_DirectionalLightDistanceFadeMAD; + float4 MobileDirectionalLight_DirectionalLightShadowDistances; + float4x4 MobileDirectionalLight_DirectionalLightScreenToShadow[4]; +}; + +struct type_Globals +{ + int NumDynamicPointLights; + float4 LightPositionAndInvRadius[4]; + float4 LightColorAndFalloffExponent[4]; + float4 MobileReflectionParams; +}; + +constant float3 _136 = {}; +constant float4 _137 = {}; +constant float _138 = {}; +constant float3 _139 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0)]]; + float4 in_var_TEXCOORD7 [[user(locn1)]]; + float4 in_var_TEXCOORD8 [[user(locn2)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileDirectionalLight& MobileDirectionalLight [[buffer(1)]], constant type_Globals& _Globals [[buffer(2)]], texture2d MobileDirectionalLight_DirectionalLightShadowTexture [[texture(0)]], texture2d Material_Texture2D_0 [[texture(1)]], texture2d Material_Texture2D_1 [[texture(2)]], texturecube ReflectionCubemap [[texture(3)]], sampler MobileDirectionalLight_DirectionalLightShadowSampler [[sampler(0)]], sampler Material_Texture2D_0Sampler [[sampler(1)]], sampler Material_Texture2D_1Sampler [[sampler(2)]], sampler ReflectionCubemapSampler [[sampler(3)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _177 = float4((((gl_FragCoord.xy - View.View_ViewRectMin.xy) * View.View_ViewSizeAndInvSize.zw) - float2(0.5)) * float2(2.0, -2.0), _138, 1.0) * float4(gl_FragCoord.w); + float3 _179 = in.in_var_TEXCOORD8.xyz - float3(View.View_PreViewTranslation); + float3 _181 = fast::normalize(-in.in_var_TEXCOORD8.xyz); + float4 _187 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (in.in_var_TEXCOORD0 * float2(10.0))); + float2 _190 = (_187.xy * float2(2.0)) - float2(1.0); + float3 _206 = fast::normalize(float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)) * (((float4(_190, sqrt(fast::clamp(1.0 - dot(_190, _190), 0.0, 1.0)), 1.0).xyz * float3(0.300000011920928955078125, 0.300000011920928955078125, 1.0)) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz)); + float _208 = dot(_206, _181); + float4 _217 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(20.0))); + float _219 = mix(0.4000000059604644775390625, 1.0, _217.x); + float4 _223 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(5.0))); + float _224 = _177.w; + float _228 = fast::min(fast::max((_224 - 24.0) * 0.000666666659526526927947998046875, 0.0), 1.0); + float _229 = _223.y; + float4 _233 = Material_Texture2D_1.sample(Material_Texture2D_1Sampler, (in.in_var_TEXCOORD0 * float2(0.5))); + float _235 = _233.y; + float _253 = fast::clamp((fast::min(fast::max(mix(0.0, 0.5, _235) + mix(mix(0.699999988079071044921875, 1.0, _229), 1.0, _228), 0.0), 1.0) * View.View_RoughnessOverrideParameter.y) + View.View_RoughnessOverrideParameter.x, 0.119999997317790985107421875, 1.0); + float2 _257 = (float2(_253) * float2(-1.0, -0.0274999998509883880615234375)) + float2(1.0, 0.0425000004470348358154296875); + float _258 = _257.x; + float3 _270 = (fast::clamp(float3(mix(_219, 1.0 - _219, mix(_229, 1.0, _228)) * (mix(0.2949999868869781494140625, 0.660000026226043701171875, mix(_235 + mix(_229, 0.0, _228), 0.5, 0.5)) * 0.5)), float3(0.0), float3(1.0)) * float3(View.View_DiffuseOverrideParameter.w)) + View.View_DiffuseOverrideParameter.xyz; + float3 _275 = float3(((fast::min(_258 * _258, exp2((-9.27999973297119140625) * fast::max(_208, 0.0))) * _258) + _257.y) * View.View_SpecularOverrideParameter.w) + View.View_SpecularOverrideParameter.xyz; + float _276 = _275.x; + float4 _303; + int _286 = 0; + for (;;) + { + if (_286 < 2) + { + if (_224 < MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowDistances[uint(_286)]) + { + _303 = MobileDirectionalLight.MobileDirectionalLight_DirectionalLightScreenToShadow[_286] * float4(_177.xy, _224, 1.0); + break; + } + _286++; + continue; + } + else + { + _303 = float4(0.0); + break; + } + } + float _423; + if (_303.z > 0.0) + { + float2 _311 = _303.xy * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.xy; + float2 _312 = fract(_311); + float2 _313 = floor(_311); + float3 _320; + _320.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _320.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _320.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, -0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + float3 _335 = float3(MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w); + float3 _337 = float3((fast::min(_303.z, 0.999989986419677734375) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.w) - 1.0); + float3 _339 = fast::clamp((_320 * _335) - _337, float3(0.0), float3(1.0)); + float3 _345; + _345.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _345.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _345.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5, 0.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + float3 _360 = fast::clamp((_345 * _335) - _337, float3(0.0), float3(1.0)); + float3 _366; + _366.x = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(-0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _366.y = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(0.5, 1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + _366.z = MobileDirectionalLight_DirectionalLightShadowTexture.sample(MobileDirectionalLight_DirectionalLightShadowSampler, ((_313 + float2(1.5)) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightShadowSize.zw), level(0.0)).x; + float3 _381 = fast::clamp((_366 * _335) - _337, float3(0.0), float3(1.0)); + float _383 = _312.x; + float _384 = 1.0 - _383; + float3 _399; + _399.x = ((_339.x * _384) + _339.y) + (_339.z * _383); + _399.y = ((_360.x * _384) + _360.y) + (_360.z * _383); + _399.z = ((_381.x * _384) + _381.y) + (_381.z * _383); + float _408 = _312.y; + float _420 = fast::clamp((_224 * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.x) + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDistanceFadeMAD.y, 0.0, 1.0); + _423 = mix(fast::clamp(0.25 * dot(_399, float3(1.0 - _408, 1.0, _408)), 0.0, 1.0), 1.0, _420 * _420); + } + else + { + _423 = 1.0; + } + float3 _429 = fast::normalize(_181 + MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz); + float _439 = (_253 * 0.25) + 0.25; + float3 _440 = cross(_206, _429); + float _442 = _253 * _253; + float _443 = fast::max(0.0, dot(_206, _429)) * _442; + float _446 = _442 / (dot(_440, _440) + (_443 * _443)); + bool _458 = float(_Globals.MobileReflectionParams.w > 0.0) != 0.0; + float4 _468 = ReflectionCubemap.sample(ReflectionCubemapSampler, ((-_181) + ((_206 * float3(_208)) * float3(2.0))), level(((_458 ? _Globals.MobileReflectionParams.w : View.View_ReflectionCubemapMaxMip) - 1.0) - (1.0 - (1.2000000476837158203125 * log2(_253))))); + float3 _481; + if (_458) + { + _481 = _468.xyz * View.View_SkyLightColor.xyz; + } + else + { + float3 _476 = _468.xyz * float3(_468.w * 16.0); + _481 = _476 * _476; + } + float3 _484 = float3(_276); + float3 _488; + _488 = ((float3(_423 * fast::max(0.0, dot(_206, MobileDirectionalLight.MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition.xyz))) * MobileDirectionalLight.MobileDirectionalLight_DirectionalLightColor.xyz) * (_270 + float3(_276 * (_439 * fast::min(_446 * _446, 65504.0))))) + ((_481 * float3(fast::clamp(1.0, 0.0, 1.0))) * _484); + float3 _507; + float _509; + float _511; + float _537; + int _491 = 0; + for (;;) + { + if (_491 < _Globals.NumDynamicPointLights) + { + float3 _501 = _Globals.LightPositionAndInvRadius[_491].xyz - _179; + float _502 = dot(_501, _501); + float3 _505 = _501 * float3(rsqrt(_502)); + _507 = fast::normalize(_181 + _505); + _509 = fast::max(0.0, dot(_206, _505)); + _511 = fast::max(0.0, dot(_206, _507)); + if (_Globals.LightColorAndFalloffExponent[_491].w == 0.0) + { + float _531 = _502 * (_Globals.LightPositionAndInvRadius[_491].w * _Globals.LightPositionAndInvRadius[_491].w); + float _534 = fast::clamp(1.0 - (_531 * _531), 0.0, 1.0); + _537 = (1.0 / (_502 + 1.0)) * (_534 * _534); + } + else + { + float3 _521 = _501 * float3(_Globals.LightPositionAndInvRadius[_491].w); + _537 = pow(1.0 - fast::clamp(dot(_521, _521), 0.0, 1.0), _Globals.LightColorAndFalloffExponent[_491].w); + } + float3 _544 = cross(_206, _507); + float _546 = _511 * _442; + float _549 = _442 / (dot(_544, _544) + (_546 * _546)); + _488 += fast::min(float3(65000.0), ((float3(_537 * _509) * _Globals.LightColorAndFalloffExponent[_491].xyz) * float3(0.3183098733425140380859375)) * (_270 + float3(_276 * (_439 * fast::min(_549 * _549, 65504.0))))); + _491++; + continue; + } + else + { + break; + } + } + float3 _567 = (mix(_488 + fast::max(float3(0.0), float3(0.0)), _270 + _484, float3(View.View_UnlitViewmodeMask)) * float3(in.in_var_TEXCOORD7.w)) + in.in_var_TEXCOORD7.xyz; + float4 _568 = float4(_567.x, _567.y, _567.z, _137.w); + _568.w = fast::min(in.in_var_TEXCOORD8.w, 65500.0); + out.out_var_SV_Target0 = _568; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag new file mode 100644 index 0000000000..bb6058c387 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag @@ -0,0 +1,353 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_PrimitiveDither +{ + float PrimitiveDither_LODFactor; +}; + +struct type_PrimitiveFade +{ + float2 PrimitiveFade_FadeTimeScaleBias; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[9]; + float4 Material_ScalarExpressions[3]; +}; + +constant float _98 = {}; +constant float _103 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; + float gl_FragDepth [[depth(less)]]; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD6 [[user(locn0)]]; + float4 in_var_TEXCOORD7 [[user(locn1)]]; + float4 in_var_TEXCOORD10_centroid [[user(locn2)]]; + float4 in_var_TEXCOORD11_centroid [[user(locn3)]]; + float4 in_var_TEXCOORD0_0 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d Material_Texture2D_0 [[texture(0)]], texture2d Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + spvUnsafeArray in_var_TEXCOORD0 = {}; + in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0; + float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy; + float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w); + float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0); + float3 _148 = _144.xyz / float3(_144.w); + float3 _149 = _148 - float3(View.View_PreViewTranslation); + float3 _151 = fast::normalize(-_148); + float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz); + float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0)); + float _171 = floor(_170); + float _172 = 1.0 / _170; + float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172); + float2 _175 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _176 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float _180_copy; + float2 _183; + _183 = float2(0.0); + float _188; + float _211; + float2 _212; + float _180 = 1.0; + int _185 = 0; + float _187 = 1.0; + float _189 = 1.0; + for (;;) + { + if (float(_185) < (_171 + 2.0)) + { + _188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(_175, _176)).y; + if (_180 < _188) + { + float _201 = _188 - _180; + float _203 = _201 / ((_189 - _187) + _201); + _211 = (_189 * _203) + (_180 * (1.0 - _203)); + _212 = _183 - (float2(_203) * _174); + break; + } + _180_copy = _180; + _180 -= _172; + _183 += _174; + _185++; + _187 = _188; + _189 = _180_copy; + continue; + } + else + { + _211 = _98; + _212 = _183; + break; + } + } + float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias)); + float2 _229 = _135 + float2(View.View_TemporalAAParams.x); + float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u); + float2 _238 = _135 * float2(0.015625); + float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias)); + float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias)); + float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x); + float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _276 = abs(_275); + float3 _279 = dfdx(_149); + float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _284 = abs(_283); + float3 _287 = dfdy(_149); + if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0) + { + if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875) + { + float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0); + if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0) + { + discard_fragment(); + } + } + } + if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0) + { + discard_fragment(); + } + float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875); + out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z); + out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag new file mode 100644 index 0000000000..bb6058c387 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag @@ -0,0 +1,353 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_PrimitiveDither +{ + float PrimitiveDither_LODFactor; +}; + +struct type_PrimitiveFade +{ + float2 PrimitiveFade_FadeTimeScaleBias; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[9]; + float4 Material_ScalarExpressions[3]; +}; + +constant float _98 = {}; +constant float _103 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; + float gl_FragDepth [[depth(less)]]; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD6 [[user(locn0)]]; + float4 in_var_TEXCOORD7 [[user(locn1)]]; + float4 in_var_TEXCOORD10_centroid [[user(locn2)]]; + float4 in_var_TEXCOORD11_centroid [[user(locn3)]]; + float4 in_var_TEXCOORD0_0 [[user(locn4)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d Material_Texture2D_0 [[texture(0)]], texture2d Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + spvUnsafeArray in_var_TEXCOORD0 = {}; + in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0; + float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy; + float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w); + float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0); + float3 _148 = _144.xyz / float3(_144.w); + float3 _149 = _148 - float3(View.View_PreViewTranslation); + float3 _151 = fast::normalize(-_148); + float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz); + float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0)); + float _171 = floor(_170); + float _172 = 1.0 / _170; + float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172); + float2 _175 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _176 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float _180_copy; + float2 _183; + _183 = float2(0.0); + float _188; + float _211; + float2 _212; + float _180 = 1.0; + int _185 = 0; + float _187 = 1.0; + float _189 = 1.0; + for (;;) + { + if (float(_185) < (_171 + 2.0)) + { + _188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(_175, _176)).y; + if (_180 < _188) + { + float _201 = _188 - _180; + float _203 = _201 / ((_189 - _187) + _201); + _211 = (_189 * _203) + (_180 * (1.0 - _203)); + _212 = _183 - (float2(_203) * _174); + break; + } + _180_copy = _180; + _180 -= _172; + _183 += _174; + _185++; + _187 = _188; + _189 = _180_copy; + continue; + } + else + { + _211 = _98; + _212 = _183; + break; + } + } + float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias)); + float2 _229 = _135 + float2(View.View_TemporalAAParams.x); + float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u); + float2 _238 = _135 * float2(0.015625); + float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias)); + float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias)); + float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x); + float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _276 = abs(_275); + float3 _279 = dfdx(_149); + float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)); + float2 _284 = abs(_283); + float3 _287 = dfdy(_149); + if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0) + { + if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875) + { + float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0); + if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0) + { + discard_fragment(); + } + } + } + if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0) + { + discard_fragment(); + } + float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875); + out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z); + out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese new file mode 100644 index 0000000000..9e45e37c78 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese @@ -0,0 +1,314 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; + float PrePadding_View_3048; + float PrePadding_View_3052; + float4x4 View_WorldToVirtualTexture; + float4 View_VirtualTextureParams; + float4 View_XRPassthroughCameraUVs[2]; +}; + +constant float4 _68 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; + float4 out_var_TEXCOORD0_0 [[user(locn2)]]; + float4 out_var_COLOR1 [[user(locn3)]]; + float4 out_var_COLOR2 [[user(locn4)]]; + float4 out_var_TEXCOORD6 [[user(locn5)]]; + float3 out_var_TEXCOORD7 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_COLOR1 [[attribute(0)]]; + float4 in_var_COLOR2 [[attribute(1)]]; + float4 in_var_TEXCOORD0_0 [[attribute(5)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(6)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(7)]]; + float3 in_var_TEXCOORD7 [[attribute(8)]]; + float4 in_var_VS_To_DS_Position [[attribute(9)]]; +}; + +struct main0_patchIn +{ + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray out_var_TEXCOORD0 = {}; + spvUnsafeArray _77 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _78 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray, 3> _79 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) }); + spvUnsafeArray _80 = spvUnsafeArray({ patchIn.gl_in[0].in_var_COLOR1, patchIn.gl_in[1].in_var_COLOR1, patchIn.gl_in[2].in_var_COLOR1 }); + spvUnsafeArray _81 = spvUnsafeArray({ patchIn.gl_in[0].in_var_COLOR2, patchIn.gl_in[1].in_var_COLOR2, patchIn.gl_in[2].in_var_COLOR2 }); + spvUnsafeArray _97 = spvUnsafeArray({ patchIn.gl_in[0].in_var_VS_To_DS_Position, patchIn.gl_in[1].in_var_VS_To_DS_Position, patchIn.gl_in[2].in_var_VS_To_DS_Position }); + spvUnsafeArray _98 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD7, patchIn.gl_in[1].in_var_TEXCOORD7, patchIn.gl_in[2].in_var_TEXCOORD7 }); + float4 _111 = float4(gl_TessCoord.x); + float4 _113 = float4(gl_TessCoord.y); + float4 _116 = float4(gl_TessCoord.z); + float4 _118 = ((_97[0] * _111) + (_97[1] * _113)) + (_97[2] * _116); + spvUnsafeArray _72 = _79[0]; + spvUnsafeArray _71 = _79[1]; + float3 _120 = float3(gl_TessCoord.x); + float3 _123 = float3(gl_TessCoord.y); + spvUnsafeArray _73; + for (int _133 = 0; _133 < 1; ) + { + _73[_133] = (_72[_133] * _111) + (_71[_133] * _113); + _133++; + continue; + } + spvUnsafeArray _75 = _73; + spvUnsafeArray _74 = _79[2]; + float3 _155 = float3(gl_TessCoord.z); + float3 _157 = ((_77[0].xyz * _120) + (_77[1].xyz * _123)).xyz + (_77[2].xyz * _155); + spvUnsafeArray _76; + for (int _164 = 0; _164 < 1; ) + { + _76[_164] = _75[_164] + (_74[_164] * _116); + _164++; + continue; + } + float4 _181 = float4(_118.x, _118.y, _118.z, _118.w); + out.out_var_TEXCOORD10_centroid = float4(_157.x, _157.y, _157.z, _68.w); + out.out_var_TEXCOORD11_centroid = ((_78[0] * _111) + (_78[1] * _113)) + (_78[2] * _116); + out_var_TEXCOORD0 = _76; + out.out_var_COLOR1 = ((_80[0] * _111) + (_80[1] * _113)) + (_80[2] * _116); + out.out_var_COLOR2 = ((_81[0] * _111) + (_81[1] * _113)) + (_81[2] * _116); + out.out_var_TEXCOORD6 = _181; + out.out_var_TEXCOORD7 = ((_98[0] * _120) + (_98[1] * _123)) + (_98[2] * _155); + out.gl_Position = View.View_TranslatedWorldToClip * _181; + out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert new file mode 100644 index 0000000000..b1298b7e68 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_Globals +{ + float4 ViewportSize; + float ScatteringScaling; + float CocRadiusToCircumscribedRadius; +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct main0_out +{ + float2 out_var_TEXCOORD0 [[user(locn0)]]; + float4 out_var_TEXCOORD1 [[user(locn1)]]; + float4 out_var_TEXCOORD2 [[user(locn2)]]; + float4 out_var_TEXCOORD3 [[user(locn3)]]; + float4 out_var_TEXCOORD4 [[user(locn4)]]; + float4 out_var_TEXCOORD5 [[user(locn5)]]; + float4 out_var_TEXCOORD6 [[user(locn6)]]; + float4 gl_Position [[position]]; +}; + +vertex main0_out main0(constant type_Globals& _Globals [[buffer(0)]], const device type_StructuredBuffer_v4float& ScatterDrawList [[buffer(1)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + uint _66 = gl_VertexIndex / 4u; + uint _68 = gl_VertexIndex - (_66 * 4u); + uint _70 = (16u * gl_InstanceIndex) + _66; + float _72; + _72 = 0.0; + spvUnsafeArray _61; + spvUnsafeArray _62; + spvUnsafeArray _63; + float _73; + uint _75 = 0u; + for (;;) + { + if (_75 < 4u) + { + uint _82 = ((5u * _70) + _75) + 1u; + _61[_75] = float4(ScatterDrawList._m0[_82].xyz, 0.0); + _62[_75] = ScatterDrawList._m0[_82].w; + if (_75 == 0u) + { + _73 = _62[_75]; + } + else + { + _73 = fast::max(_72, _62[_75]); + } + _63[_75].x = (-0.5) / _62[_75]; + _63[_75].y = (0.5 * _62[_75]) + 0.5; + _72 = _73; + _75++; + continue; + } + else + { + break; + } + } + float2 _144 = float2(_Globals.ScatteringScaling) * ScatterDrawList._m0[5u * _70].xy; + float2 _173 = (((float2((_72 * _Globals.CocRadiusToCircumscribedRadius) + 1.0) * ((float2(float(_68 % 2u), float(_68 / 2u)) * float2(2.0)) - float2(1.0))) + _144) + float2(0.5)) * _Globals.ViewportSize.zw; + out.out_var_TEXCOORD0 = _144; + out.out_var_TEXCOORD1 = float4(_61[0].xyz, _62[0]); + out.out_var_TEXCOORD2 = float4(_61[1].xyz, _62[1]); + out.out_var_TEXCOORD3 = float4(_61[2].xyz, _62[2]); + out.out_var_TEXCOORD4 = float4(_61[3].xyz, _62[3]); + out.out_var_TEXCOORD5 = float4(_63[0].x, _63[0].y, _63[1].x, _63[1].y); + out.out_var_TEXCOORD6 = float4(_63[2].x, _63[2].y, _63[3].x, _63[3].y); + out.gl_Position = float4((_173.x * 2.0) - 1.0, 1.0 - (_173.y * 2.0), 0.0, 1.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/depth-compare.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/depth-compare.asm.frag new file mode 100644 index 0000000000..0a6c98418e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/depth-compare.asm.frag @@ -0,0 +1,315 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4x4 ShadowViewProjectionMatrices[6]; + float InvShadowmapResolution; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float2 ProjectionDepthBiasParameters; + float4 PointLightDepthBiasAndProjParameters; +}; + +constant float4 _107 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d SceneTexturesStruct_SceneDepthTexture [[texture(0)]], texture2d SceneTexturesStruct_GBufferATexture [[texture(1)]], texture2d SceneTexturesStruct_GBufferBTexture [[texture(2)]], texture2d SceneTexturesStruct_GBufferDTexture [[texture(3)]], depthcube ShadowDepthCubeTexture [[texture(4)]], texture2d SSProfilesTexture [[texture(5)]], sampler SceneTexturesStruct_SceneDepthTextureSampler [[sampler(0)]], sampler SceneTexturesStruct_GBufferATextureSampler [[sampler(1)]], sampler SceneTexturesStruct_GBufferBTextureSampler [[sampler(2)]], sampler SceneTexturesStruct_GBufferDTextureSampler [[sampler(3)]], sampler ShadowDepthTextureSampler [[sampler(4)]], sampler ShadowDepthCubeTextureSampler [[sampler(5)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float2 _114 = gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw; + float4 _118 = SceneTexturesStruct_SceneDepthTexture.sample(SceneTexturesStruct_SceneDepthTextureSampler, _114, level(0.0)); + float _119 = _118.x; + float _133 = ((_119 * View.View_InvDeviceZToWorldZTransform.x) + View.View_InvDeviceZToWorldZTransform.y) + (1.0 / ((_119 * View.View_InvDeviceZToWorldZTransform.z) - View.View_InvDeviceZToWorldZTransform.w)); + float4 _147 = View.View_ScreenToWorld * float4(((_114 - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_133), _133, 1.0); + float3 _148 = _147.xyz; + float3 _152 = _Globals.LightPositionAndInvRadius.xyz - _148; + float _158 = length(_152); + bool _160 = (_158 * _Globals.LightPositionAndInvRadius.w) < 1.0; + float _207; + if (_160) + { + float3 _165 = abs(_152); + float _166 = _165.x; + float _167 = _165.y; + float _168 = _165.z; + float _170 = fast::max(_166, fast::max(_167, _168)); + int _189; + if (_170 == _166) + { + _189 = (_166 == _152.x) ? 0 : 1; + } + else + { + int _185; + if (_170 == _167) + { + _185 = (_167 == _152.y) ? 2 : 3; + } + else + { + _185 = (_168 == _152.z) ? 4 : 5; + } + _189 = _185; + } + float4 _196 = _Globals.ShadowViewProjectionMatrices[_189] * float4(_147.xyz, 1.0); + float _198 = _196.w; + _207 = ShadowDepthCubeTexture.sample_compare(ShadowDepthCubeTextureSampler, (_152 / float3(_158)), (_196.z / _198) + ((-_Globals.PointLightDepthBiasAndProjParameters.x) / _198), level(0.0)); + } + else + { + _207 = 1.0; + } + float _213 = fast::clamp(((_207 - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0); + float _218 = sqrt(mix(1.0, _213 * _213, _Globals.ShadowFadeFraction)); + float4 _219; + _219.z = _218; + float4 _220 = float4(float3(1.0).x, float3(1.0).y, _219.z, float3(1.0).z); + float3 _236 = fast::normalize((SceneTexturesStruct_GBufferATexture.sample(SceneTexturesStruct_GBufferATextureSampler, _114, level(0.0)).xyz * float3(2.0)) - float3(1.0)); + uint _240 = uint(round(SceneTexturesStruct_GBufferBTexture.sample(SceneTexturesStruct_GBufferBTextureSampler, _114, level(0.0)).w * 255.0)); + bool _248 = (_240 & 15u) == 5u; + float _448; + if (_248) + { + float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!(((_240 & 4294967280u) & 16u) != 0u))).x * 255.0) + 0.5)), 0).xy), 0); + float _263 = _260.y * 0.5; + float3 _266 = _148 - (_236 * float3(_263)); + float _274 = pow(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0); + float _445; + if (_160) + { + float3 _278 = _152 / float3(_158); + float3 _280 = fast::normalize(cross(_278, float3(0.0, 0.0, 1.0))); + float3 _284 = float3(_Globals.InvShadowmapResolution); + float3 _285 = _280 * _284; + float3 _286 = cross(_280, _278) * _284; + float3 _287 = abs(_278); + float _288 = _287.x; + float _289 = _287.y; + float _290 = _287.z; + float _292 = fast::max(_288, fast::max(_289, _290)); + int _311; + if (_292 == _288) + { + _311 = (_288 == _278.x) ? 0 : 1; + } + else + { + int _307; + if (_292 == _289) + { + _307 = (_289 == _278.y) ? 2 : 3; + } + else + { + _307 = (_290 == _278.z) ? 4 : 5; + } + _311 = _307; + } + float4 _318 = _Globals.ShadowViewProjectionMatrices[_311] * float4(_266, 1.0); + float _323 = _260.x * (10.0 / _Globals.LightPositionAndInvRadius.w); + float _329 = (1.0 / (((_318.z / _318.w) * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w; + float _342 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, (_278 + (_286 * float3(2.5))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323; + float _364 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(2.3776409626007080078125))) + (_286 * float3(0.77254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323; + float _387 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(1.46946299076080322265625))) + (_286 * float3(-2.0225429534912109375))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323; + float _410 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-1.46946299076080322265625))) + (_286 * float3(-2.02254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323; + float _433 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-2.3776409626007080078125))) + (_286 * float3(0.772543013095855712890625))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323; + _445 = (((((fast::clamp(abs((_342 > 0.0) ? (_342 + _263) : fast::max(0.0, (_342 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25) + (fast::clamp(abs((_364 > 0.0) ? (_364 + _263) : fast::max(0.0, (_364 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_387 > 0.0) ? (_387 + _263) : fast::max(0.0, (_387 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_410 > 0.0) ? (_410 + _263) : fast::max(0.0, (_410 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_433 > 0.0) ? (_433 + _263) : fast::max(0.0, (_433 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) * 0.20000000298023223876953125; + } + else + { + _445 = 1.0; + } + _448 = 1.0 - (_445 * 0.20000000298023223876953125); + } + else + { + _448 = 1.0; + } + _220.w = _248 ? sqrt(_448) : _218; + out.out_var_SV_Target0 = _220; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/global-constant-arrays.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/global-constant-arrays.asm.frag new file mode 100644 index 0000000000..88618a8512 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/global-constant-arrays.asm.frag @@ -0,0 +1,1346 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_Globals +{ + float4 MappingPolynomial; + float3 InverseGamma; + float4 ColorMatrixR_ColorCurveCd1; + float4 ColorMatrixG_ColorCurveCd3Cm3; + float4 ColorMatrixB_ColorCurveCm2; + float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3; + float4 ColorCurve_Ch1_Ch2; + float4 ColorShadow_Luma; + float4 ColorShadow_Tint1; + float4 ColorShadow_Tint2; + float FilmSlope; + float FilmToe; + float FilmShoulder; + float FilmBlackClip; + float FilmWhiteClip; + packed_float3 ColorScale; + float4 OverlayColor; + float WhiteTemp; + float WhiteTint; + float4 ColorSaturation; + float4 ColorContrast; + float4 ColorGamma; + float4 ColorGain; + float4 ColorOffset; + float4 ColorSaturationShadows; + float4 ColorContrastShadows; + float4 ColorGammaShadows; + float4 ColorGainShadows; + float4 ColorOffsetShadows; + float4 ColorSaturationMidtones; + float4 ColorContrastMidtones; + float4 ColorGammaMidtones; + float4 ColorGainMidtones; + float4 ColorOffsetMidtones; + float4 ColorSaturationHighlights; + float4 ColorContrastHighlights; + float4 ColorGammaHighlights; + float4 ColorGainHighlights; + float4 ColorOffsetHighlights; + float ColorCorrectionShadowsMax; + float ColorCorrectionHighlightsMin; + uint OutputDevice; + uint OutputGamut; + float BlueCorrection; + float ExpandGamut; +}; + +constant float3 _391 = {}; + +constant spvUnsafeArray _475 = spvUnsafeArray({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 }); +constant spvUnsafeArray _476 = spvUnsafeArray({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 }); +constant spvUnsafeArray _479 = spvUnsafeArray({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _480 = spvUnsafeArray({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 }); +constant spvUnsafeArray _482 = spvUnsafeArray({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _483 = spvUnsafeArray({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 }); + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + float3x3 _546 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875)); + float3x3 _547 = _546 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _548 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375)); + float3x3 _549 = _548 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)); + float3x3 _550 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _551 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)); + float3x3 _576; + for (;;) + { + if (_Globals.OutputGamut == 1u) + { + _576 = _548 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375)); + break; + } + else + { + if (_Globals.OutputGamut == 2u) + { + _576 = _548 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375)); + break; + } + else + { + if (_Globals.OutputGamut == 3u) + { + _576 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625)); + break; + } + else + { + if (_Globals.OutputGamut == 4u) + { + _576 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)); + break; + } + else + { + _576 = _549; + break; + } + } + } + } + } + float3 _577 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz; + float3 _599; + if (_Globals.OutputDevice >= 3u) + { + float3 _591 = pow(_577, float3(0.0126833133399486541748046875)); + _599 = pow(fast::max(float3(0.0), _591 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _591)), float3(6.277394771575927734375)) * float3(10000.0); + } + else + { + _599 = (exp2((_577 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875)); + } + float _602 = _Globals.WhiteTemp * 1.00055634975433349609375; + float _616 = (_602 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _602)) / _602)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _602)) / _602)); + float _633 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)); + float _644 = ((0.317398726940155029296875 + (4.25 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)); + float _649 = ((2.0 * _633) - (8.0 * _644)) + 4.0; + float2 _653 = float2((3.0 * _633) / _649, (2.0 * _644) / _649); + float2 _660 = fast::normalize(float2(_633, _644)); + float _665 = _633 + (((-_660.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125); + float _669 = _644 + ((_660.x * _Globals.WhiteTint) * 0.0500000007450580596923828125); + float _674 = ((2.0 * _665) - (8.0 * _669)) + 4.0; + float2 _680 = select(float2(_616, ((((-3.0) * _616) * _616) + (2.86999988555908203125 * _616)) - 0.2750000059604644775390625), _653, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _665) / _674, (2.0 * _669) / _674) - _653); + float _683 = fast::max(_680.y, 1.0000000133514319600180897396058e-10); + float3 _685; + _685.x = _680.x / _683; + _685.y = 1.0; + _685.z = ((1.0 - _680.x) - _680.y) / _683; + float _691 = fast::max(0.328999996185302734375, 1.0000000133514319600180897396058e-10); + float3 _693; + _693.x = 0.3127000033855438232421875 / _691; + _693.y = 1.0; + _693.z = 0.3582999706268310546875 / _691; + float3 _697 = _685 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _698 = _693 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _717 = (_599 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_698.x / _697.x, 0.0, 0.0), float3(0.0, _698.y / _697.y, 0.0), float3(0.0, 0.0, _698.z / _697.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _547; + float3 _745; + if (_Globals.ColorShadow_Tint2.w != 0.0) + { + float _724 = dot(_717, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float3 _727 = (_717 / float3(_724)) - float3(1.0); + _745 = mix(_717, _717 * (_549 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_727, _727))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _724) * _724)))); + } + else + { + _745 = _717; + } + float _746 = dot(_745, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float4 _751 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation; + float4 _756 = _Globals.ColorContrastShadows * _Globals.ColorContrast; + float4 _761 = _Globals.ColorGammaShadows * _Globals.ColorGamma; + float4 _766 = _Globals.ColorGainShadows * _Globals.ColorGain; + float4 _771 = _Globals.ColorOffsetShadows + _Globals.ColorOffset; + float3 _772 = float3(_746); + float _804 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _746); + float4 _808 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation; + float4 _811 = _Globals.ColorContrastHighlights * _Globals.ColorContrast; + float4 _814 = _Globals.ColorGammaHighlights * _Globals.ColorGamma; + float4 _817 = _Globals.ColorGainHighlights * _Globals.ColorGain; + float4 _820 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset; + float _852 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _746); + float4 _855 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation; + float4 _858 = _Globals.ColorContrastMidtones * _Globals.ColorContrast; + float4 _861 = _Globals.ColorGammaMidtones * _Globals.ColorGamma; + float4 _864 = _Globals.ColorGainMidtones * _Globals.ColorGain; + float4 _867 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset; + float3 _905 = ((((pow(pow(fast::max(float3(0.0), mix(_772, _745, _751.xyz * float3(_751.w))) * float3(5.5555553436279296875), _756.xyz * float3(_756.w)) * float3(0.180000007152557373046875), float3(1.0) / (_761.xyz * float3(_761.w))) * (_766.xyz * float3(_766.w))) + (_771.xyz + float3(_771.w))) * float3(1.0 - _804)) + (((pow(pow(fast::max(float3(0.0), mix(_772, _745, _855.xyz * float3(_855.w))) * float3(5.5555553436279296875), _858.xyz * float3(_858.w)) * float3(0.180000007152557373046875), float3(1.0) / (_861.xyz * float3(_861.w))) * (_864.xyz * float3(_864.w))) + (_867.xyz + float3(_867.w))) * float3(_804 - _852))) + (((pow(pow(fast::max(float3(0.0), mix(_772, _745, _808.xyz * float3(_808.w))) * float3(5.5555553436279296875), _811.xyz * float3(_811.w)) * float3(0.180000007152557373046875), float3(1.0) / (_814.xyz * float3(_814.w))) * (_817.xyz * float3(_817.w))) + (_820.xyz + float3(_820.w))) * float3(_852)); + float3 _906 = _905 * _549; + float3 _914 = float3(_Globals.BlueCorrection); + float3 _916 = mix(_905, _905 * ((_551 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _550), _914) * _551; + float _917 = _916.x; + float _918 = _916.y; + float _920 = _916.z; + float _923 = fast::max(fast::max(_917, _918), _920); + float _928 = (fast::max(_923, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_917, _918), _920), 1.0000000133514319600180897396058e-10)) / fast::max(_923, 0.00999999977648258209228515625); + float _941 = ((_920 + _918) + _917) + (1.75 * sqrt(((_920 * (_920 - _918)) + (_918 * (_918 - _917))) + (_917 * (_917 - _920)))); + float _942 = _941 * 0.3333333432674407958984375; + float _943 = _928 - 0.4000000059604644775390625; + float _948 = fast::max(1.0 - abs(_943 * 2.5), 0.0); + float _956 = (1.0 + (float(int(sign(_943 * 5.0))) * (1.0 - (_948 * _948)))) * 0.02500000037252902984619140625; + float _969; + if (_942 <= 0.053333334624767303466796875) + { + _969 = _956; + } + else + { + float _968; + if (_942 >= 0.1599999964237213134765625) + { + _968 = 0.0; + } + else + { + _968 = _956 * ((0.23999999463558197021484375 / _941) - 0.5); + } + _969 = _968; + } + float3 _972 = _916 * float3(1.0 + _969); + float _973 = _972.x; + float _974 = _972.y; + float _976 = _972.z; + float _990; + if ((_973 == _974) && (_974 == _976)) + { + _990 = 0.0; + } + else + { + _990 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_974 - _976), ((2.0 * _973) - _974) - _976); + } + float _995; + if (_990 < 0.0) + { + _995 = _990 + 360.0; + } + else + { + _995 = _990; + } + float _996 = fast::clamp(_995, 0.0, 360.0); + float _1001; + if (_996 > 180.0) + { + _1001 = _996 - 360.0; + } + else + { + _1001 = _996; + } + float _1005 = smoothstep(0.0, 1.0, 1.0 - abs(_1001 * 0.01481481455266475677490234375)); + _972.x = _973 + ((((_1005 * _1005) * _928) * (0.02999999932944774627685546875 - _973)) * 0.180000007152557373046875); + float3 _1014 = fast::max(float3(0.0), _972 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375))); + float _1023 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe; + float _1026 = 1.0 + _Globals.FilmWhiteClip; + float _1029 = _1026 - _Globals.FilmShoulder; + float _1056; + if (_Globals.FilmToe > 0.800000011920928955078125) + { + _1056 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0)); + } + else + { + float _1035 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1023; + _1056 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1035 / (2.0 - _1035))) * (_1023 / _Globals.FilmSlope)); + } + float _1061 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1056; + float _1063 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1061; + float _1065 = log(10.0); + float3 _1067 = log(mix(float3(dot(_1014, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1014, float3(0.959999978542327880859375))) / float3(_1065); + float3 _1071 = float3(_Globals.FilmSlope) * (_1067 + float3(_1061)); + float3 _1079 = float3(_1056); + float3 _1080 = _1067 - _1079; + float3 _1092 = float3(_1063); + float3 _1106 = fast::clamp(_1080 / float3(_1063 - _1056), float3(0.0), float3(1.0)); + float3 _1110 = select(_1106, float3(1.0) - _1106, bool3(_1063 < _1056)); + float3 _1115 = mix(select(_1071, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1023) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1023) * _1080))), _1067 < _1079), select(_1071, float3(_1026) - (float3(2.0 * _1029) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1029) * (_1067 - _1092)))), _1067 > _1092), ((float3(3.0) - (float3(2.0) * _1110)) * _1110) * _1110); + float3 _1119 = fast::max(float3(0.0), mix(float3(dot(_1115, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1115, float3(0.930000007152557373046875))); + float3 _1189; + if (_Globals.ColorShadow_Tint2.w == 0.0) + { + float3 _1131; + _1131.x = dot(_906, _Globals.ColorMatrixR_ColorCurveCd1.xyz); + _1131.y = dot(_906, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz); + _1131.z = dot(_906, _Globals.ColorMatrixB_ColorCurveCm2.xyz); + float3 _1157 = fast::max(float3(0.0), _1131 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_906, _Globals.ColorShadow_Luma.xyz) + 1.0))))); + float3 _1162 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1157); + float3 _1164 = fast::max(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz); + _1189 = ((((_1164 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1164 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1162 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1162 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375); + } + else + { + _1189 = fast::max(float3(0.0), mix(_1119, _1119 * ((_551 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _550), _914) * _549); + } + float3 _1218 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * (_1189 * _1189)) + (float3(_Globals.MappingPolynomial.y) * _1189)) + float3(_Globals.MappingPolynomial.z)) * float3(_Globals.ColorScale), _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y)); + float3 _3001; + if (_Globals.OutputDevice == 0u) + { + float _2961 = _1218.x; + float _2973; + for (;;) + { + if (_2961 < 0.00313066993840038776397705078125) + { + _2973 = _2961 * 12.9200000762939453125; + break; + } + _2973 = (pow(_2961, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _2974 = _1218.y; + float _2986; + for (;;) + { + if (_2974 < 0.00313066993840038776397705078125) + { + _2986 = _2974 * 12.9200000762939453125; + break; + } + _2986 = (pow(_2974, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _2987 = _1218.z; + float _2999; + for (;;) + { + if (_2987 < 0.00313066993840038776397705078125) + { + _2999 = _2987 * 12.9200000762939453125; + break; + } + _2999 = (pow(_2987, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + _3001 = float3(_2973, _2986, _2999); + } + else + { + float3 _2960; + if (_Globals.OutputDevice == 1u) + { + float3 _2953 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1218 * _547) * _576); + _2960 = fast::min(_2953 * float3(4.5), (pow(fast::max(_2953, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375)); + } + else + { + float3 _2950; + if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u)) + { + float3 _2100 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _2101 = _2100.x; + float _2102 = _2100.y; + float _2104 = _2100.z; + float _2107 = fast::max(fast::max(_2101, _2102), _2104); + float _2112 = (fast::max(_2107, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2101, _2102), _2104), 1.0000000133514319600180897396058e-10)) / fast::max(_2107, 0.00999999977648258209228515625); + float _2125 = ((_2104 + _2102) + _2101) + (1.75 * sqrt(((_2104 * (_2104 - _2102)) + (_2102 * (_2102 - _2101))) + (_2101 * (_2101 - _2104)))); + float _2126 = _2125 * 0.3333333432674407958984375; + float _2127 = _2112 - 0.4000000059604644775390625; + float _2132 = fast::max(1.0 - abs(_2127 * 2.5), 0.0); + float _2140 = (1.0 + (float(int(sign(_2127 * 5.0))) * (1.0 - (_2132 * _2132)))) * 0.02500000037252902984619140625; + float _2153; + if (_2126 <= 0.053333334624767303466796875) + { + _2153 = _2140; + } + else + { + float _2152; + if (_2126 >= 0.1599999964237213134765625) + { + _2152 = 0.0; + } + else + { + _2152 = _2140 * ((0.23999999463558197021484375 / _2125) - 0.5); + } + _2153 = _2152; + } + float3 _2156 = _2100 * float3(1.0 + _2153); + float _2157 = _2156.x; + float _2158 = _2156.y; + float _2160 = _2156.z; + float _2174; + if ((_2157 == _2158) && (_2158 == _2160)) + { + _2174 = 0.0; + } + else + { + _2174 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_2158 - _2160), ((2.0 * _2157) - _2158) - _2160); + } + float _2179; + if (_2174 < 0.0) + { + _2179 = _2174 + 360.0; + } + else + { + _2179 = _2174; + } + float _2180 = fast::clamp(_2179, 0.0, 360.0); + float _2185; + if (_2180 > 180.0) + { + _2185 = _2180 - 360.0; + } + else + { + _2185 = _2180; + } + float _2235; + if ((_2185 > (-67.5)) && (_2185 < 67.5)) + { + float _2192 = (_2185 - (-67.5)) * 0.0296296291053295135498046875; + int _2193 = int(_2192); + float _2195 = _2192 - float(_2193); + float _2196 = _2195 * _2195; + float _2197 = _2196 * _2195; + float _2234; + if (_2193 == 3) + { + _2234 = (((_2197 * (-0.16666667163372039794921875)) + (_2196 * 0.5)) + (_2195 * (-0.5))) + 0.16666667163372039794921875; + } + else + { + float _2227; + if (_2193 == 2) + { + _2227 = ((_2197 * 0.5) + (_2196 * (-1.0))) + 0.666666686534881591796875; + } + else + { + float _2222; + if (_2193 == 1) + { + _2222 = (((_2197 * (-0.5)) + (_2196 * 0.5)) + (_2195 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2215; + if (_2193 == 0) + { + _2215 = _2197 * 0.16666667163372039794921875; + } + else + { + _2215 = 0.0; + } + _2222 = _2215; + } + _2227 = _2222; + } + _2234 = _2227; + } + _2235 = _2234; + } + else + { + _2235 = 0.0; + } + _2156.x = _2157 + ((((_2235 * 1.5) * _2112) * (0.02999999932944774627685546875 - _2157)) * 0.180000007152557373046875); + float3 _2245 = fast::clamp(fast::clamp(_2156, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _2248 = mix(float3(dot(_2245, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2245, float3(0.959999978542327880859375)); + float _2249 = _2248.x; + float _2253 = 0.17999999225139617919921875 * exp2(18.0); + float _2255 = exp2(-14.0); + float _2258 = log((_2249 <= 0.0) ? _2255 : _2249) / _1065; + float _2260 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065; + float _2327; + if (_2258 <= _2260) + { + _2327 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2267 = log(0.180000007152557373046875) / _1065; + float _2324; + if ((_2258 > _2260) && (_2258 < _2267)) + { + float _2307 = (3.0 * (_2258 - _2260)) / (_2267 - _2260); + int _2308 = int(_2307); + float _2310 = _2307 - float(_2308); + _2324 = dot(float3(_2310 * _2310, _2310, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2308], _475[_2308 + 1], _475[_2308 + 2])); + } + else + { + float _2275 = log(_2253) / _1065; + float _2303; + if ((_2258 >= _2267) && (_2258 < _2275)) + { + float _2286 = (3.0 * (_2258 - _2267)) / (_2275 - _2267); + int _2287 = int(_2286); + float _2289 = _2286 - float(_2287); + _2303 = dot(float3(_2289 * _2289, _2289, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2287], _476[_2287 + 1], _476[_2287 + 2])); + } + else + { + _2303 = log(10000.0) / _1065; + } + _2324 = _2303; + } + _2327 = _2324; + } + float3 _2329; + _2329.x = pow(10.0, _2327); + float _2330 = _2248.y; + float _2334 = log((_2330 <= 0.0) ? _2255 : _2330) / _1065; + float _2401; + if (_2334 <= _2260) + { + _2401 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2341 = log(0.180000007152557373046875) / _1065; + float _2398; + if ((_2334 > _2260) && (_2334 < _2341)) + { + float _2381 = (3.0 * (_2334 - _2260)) / (_2341 - _2260); + int _2382 = int(_2381); + float _2384 = _2381 - float(_2382); + _2398 = dot(float3(_2384 * _2384, _2384, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2382], _475[_2382 + 1], _475[_2382 + 2])); + } + else + { + float _2349 = log(_2253) / _1065; + float _2377; + if ((_2334 >= _2341) && (_2334 < _2349)) + { + float _2360 = (3.0 * (_2334 - _2341)) / (_2349 - _2341); + int _2361 = int(_2360); + float _2363 = _2360 - float(_2361); + _2377 = dot(float3(_2363 * _2363, _2363, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2361], _476[_2361 + 1], _476[_2361 + 2])); + } + else + { + _2377 = log(10000.0) / _1065; + } + _2398 = _2377; + } + _2401 = _2398; + } + _2329.y = pow(10.0, _2401); + float _2404 = _2248.z; + float _2408 = log((_2404 <= 0.0) ? _2255 : _2404) / _1065; + float _2475; + if (_2408 <= _2260) + { + _2475 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2415 = log(0.180000007152557373046875) / _1065; + float _2472; + if ((_2408 > _2260) && (_2408 < _2415)) + { + float _2455 = (3.0 * (_2408 - _2260)) / (_2415 - _2260); + int _2456 = int(_2455); + float _2458 = _2455 - float(_2456); + _2472 = dot(float3(_2458 * _2458, _2458, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2456], _475[_2456 + 1], _475[_2456 + 2])); + } + else + { + float _2423 = log(_2253) / _1065; + float _2451; + if ((_2408 >= _2415) && (_2408 < _2423)) + { + float _2434 = (3.0 * (_2408 - _2415)) / (_2423 - _2415); + int _2435 = int(_2434); + float _2437 = _2434 - float(_2435); + _2451 = dot(float3(_2437 * _2437, _2437, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2435], _476[_2435 + 1], _476[_2435 + 2])); + } + else + { + _2451 = log(10000.0) / _1065; + } + _2472 = _2451; + } + _2475 = _2472; + } + _2329.z = pow(10.0, _2475); + float3 _2479 = (_2329 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _2481 = 0.17999999225139617919921875 * pow(2.0, -12.0); + float _2485 = log((_2481 <= 0.0) ? _2255 : _2481) / _1065; + float _2552; + if (_2485 <= _2260) + { + _2552 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2492 = log(0.180000007152557373046875) / _1065; + float _2549; + if ((_2485 > _2260) && (_2485 < _2492)) + { + float _2532 = (3.0 * (_2485 - _2260)) / (_2492 - _2260); + int _2533 = int(_2532); + float _2535 = _2532 - float(_2533); + _2549 = dot(float3(_2535 * _2535, _2535, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2533], _475[_2533 + 1], _475[_2533 + 2])); + } + else + { + float _2500 = log(_2253) / _1065; + float _2528; + if ((_2485 >= _2492) && (_2485 < _2500)) + { + float _2511 = (3.0 * (_2485 - _2492)) / (_2500 - _2492); + int _2512 = int(_2511); + float _2514 = _2511 - float(_2512); + _2528 = dot(float3(_2514 * _2514, _2514, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2512], _476[_2512 + 1], _476[_2512 + 2])); + } + else + { + _2528 = log(10000.0) / _1065; + } + _2549 = _2528; + } + _2552 = _2549; + } + float _2555 = log(0.180000007152557373046875) / _1065; + float _2611; + if (_2555 <= _2260) + { + _2611 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2608; + if ((_2555 > _2260) && (_2555 < _2555)) + { + _2608 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[3], _475[4], _475[5])).z; + } + else + { + float _2568 = log(_2253) / _1065; + float _2596; + if ((_2555 >= _2555) && (_2555 < _2568)) + { + float _2579 = (3.0 * (_2555 - _2555)) / (_2568 - _2555); + int _2580 = int(_2579); + float _2582 = _2579 - float(_2580); + _2596 = dot(float3(_2582 * _2582, _2582, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2580], _476[_2580 + 1], _476[_2580 + 2])); + } + else + { + _2596 = log(10000.0) / _1065; + } + _2608 = _2596; + } + _2611 = _2608; + } + float _2612 = pow(10.0, _2611); + float _2614 = 0.17999999225139617919921875 * pow(2.0, 10.0); + float _2618 = log((_2614 <= 0.0) ? _2255 : _2614) / _1065; + float _2683; + if (_2618 <= _2260) + { + _2683 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _2680; + if ((_2618 > _2260) && (_2618 < _2555)) + { + float _2663 = (3.0 * (_2618 - _2260)) / (_2555 - _2260); + int _2664 = int(_2663); + float _2666 = _2663 - float(_2664); + _2680 = dot(float3(_2666 * _2666, _2666, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2664], _475[_2664 + 1], _475[_2664 + 2])); + } + else + { + float _2631 = log(_2253) / _1065; + float _2659; + if ((_2618 >= _2555) && (_2618 < _2631)) + { + float _2642 = (3.0 * (_2618 - _2555)) / (_2631 - _2555); + int _2643 = int(_2642); + float _2645 = _2642 - float(_2643); + _2659 = dot(float3(_2645 * _2645, _2645, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2643], _476[_2643 + 1], _476[_2643 + 2])); + } + else + { + _2659 = log(10000.0) / _1065; + } + _2680 = _2659; + } + _2683 = _2680; + } + float _2684 = pow(10.0, _2683); + float _2685 = _2479.x; + float _2689 = log((_2685 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2685) / _1065; + float _2690 = log(pow(10.0, _2552)); + float _2691 = _2690 / _1065; + float _2768; + if (_2689 <= _2691) + { + _2768 = (_2689 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065)); + } + else + { + float _2698 = log(_2612) / _1065; + float _2760; + if ((_2689 > _2691) && (_2689 < _2698)) + { + float _2743 = (7.0 * (_2689 - _2691)) / (_2698 - _2691); + int _2744 = int(_2743); + float _2746 = _2743 - float(_2744); + _2760 = dot(float3(_2746 * _2746, _2746, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2744], _479[_2744 + 1], _479[_2744 + 2])); + } + else + { + float _2705 = log(_2684); + float _2706 = _2705 / _1065; + float _2739; + if ((_2689 >= _2698) && (_2689 < _2706)) + { + float _2722 = (7.0 * (_2689 - _2698)) / (_2706 - _2698); + int _2723 = int(_2722); + float _2725 = _2722 - float(_2723); + _2739 = dot(float3(_2725 * _2725, _2725, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2723], _480[_2723 + 1], _480[_2723 + 2])); + } + else + { + _2739 = (_2689 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2705) / _1065)); + } + _2760 = _2739; + } + _2768 = _2760; + } + float3 _2770; + _2770.x = pow(10.0, _2768); + float _2771 = _2479.y; + float _2775 = log((_2771 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2771) / _1065; + float _2852; + if (_2775 <= _2691) + { + _2852 = (_2775 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065)); + } + else + { + float _2782 = log(_2612) / _1065; + float _2844; + if ((_2775 > _2691) && (_2775 < _2782)) + { + float _2827 = (7.0 * (_2775 - _2691)) / (_2782 - _2691); + int _2828 = int(_2827); + float _2830 = _2827 - float(_2828); + _2844 = dot(float3(_2830 * _2830, _2830, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2828], _479[_2828 + 1], _479[_2828 + 2])); + } + else + { + float _2789 = log(_2684); + float _2790 = _2789 / _1065; + float _2823; + if ((_2775 >= _2782) && (_2775 < _2790)) + { + float _2806 = (7.0 * (_2775 - _2782)) / (_2790 - _2782); + int _2807 = int(_2806); + float _2809 = _2806 - float(_2807); + _2823 = dot(float3(_2809 * _2809, _2809, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2807], _480[_2807 + 1], _480[_2807 + 2])); + } + else + { + _2823 = (_2775 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2789) / _1065)); + } + _2844 = _2823; + } + _2852 = _2844; + } + _2770.y = pow(10.0, _2852); + float _2855 = _2479.z; + float _2859 = log((_2855 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2855) / _1065; + float _2936; + if (_2859 <= _2691) + { + _2936 = (_2859 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065)); + } + else + { + float _2866 = log(_2612) / _1065; + float _2928; + if ((_2859 > _2691) && (_2859 < _2866)) + { + float _2911 = (7.0 * (_2859 - _2691)) / (_2866 - _2691); + int _2912 = int(_2911); + float _2914 = _2911 - float(_2912); + _2928 = dot(float3(_2914 * _2914, _2914, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2912], _479[_2912 + 1], _479[_2912 + 2])); + } + else + { + float _2873 = log(_2684); + float _2874 = _2873 / _1065; + float _2907; + if ((_2859 >= _2866) && (_2859 < _2874)) + { + float _2890 = (7.0 * (_2859 - _2866)) / (_2874 - _2866); + int _2891 = int(_2890); + float _2893 = _2890 - float(_2891); + _2907 = dot(float3(_2893 * _2893, _2893, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2891], _480[_2891 + 1], _480[_2891 + 2])); + } + else + { + _2907 = (_2859 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2873) / _1065)); + } + _2928 = _2907; + } + _2936 = _2928; + } + _2770.z = pow(10.0, _2936); + float3 _2942 = pow(((_2770 - float3(3.5073844628641381859779357910156e-05)) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2950 = pow((float3(0.8359375) + (float3(18.8515625) * _2942)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2942))), float3(78.84375)); + } + else + { + float3 _2097; + if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u)) + { + float3 _1263 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _1264 = _1263.x; + float _1265 = _1263.y; + float _1267 = _1263.z; + float _1270 = fast::max(fast::max(_1264, _1265), _1267); + float _1275 = (fast::max(_1270, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1264, _1265), _1267), 1.0000000133514319600180897396058e-10)) / fast::max(_1270, 0.00999999977648258209228515625); + float _1288 = ((_1267 + _1265) + _1264) + (1.75 * sqrt(((_1267 * (_1267 - _1265)) + (_1265 * (_1265 - _1264))) + (_1264 * (_1264 - _1267)))); + float _1289 = _1288 * 0.3333333432674407958984375; + float _1290 = _1275 - 0.4000000059604644775390625; + float _1295 = fast::max(1.0 - abs(_1290 * 2.5), 0.0); + float _1303 = (1.0 + (float(int(sign(_1290 * 5.0))) * (1.0 - (_1295 * _1295)))) * 0.02500000037252902984619140625; + float _1316; + if (_1289 <= 0.053333334624767303466796875) + { + _1316 = _1303; + } + else + { + float _1315; + if (_1289 >= 0.1599999964237213134765625) + { + _1315 = 0.0; + } + else + { + _1315 = _1303 * ((0.23999999463558197021484375 / _1288) - 0.5); + } + _1316 = _1315; + } + float3 _1319 = _1263 * float3(1.0 + _1316); + float _1320 = _1319.x; + float _1321 = _1319.y; + float _1323 = _1319.z; + float _1337; + if ((_1320 == _1321) && (_1321 == _1323)) + { + _1337 = 0.0; + } + else + { + _1337 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_1321 - _1323), ((2.0 * _1320) - _1321) - _1323); + } + float _1342; + if (_1337 < 0.0) + { + _1342 = _1337 + 360.0; + } + else + { + _1342 = _1337; + } + float _1343 = fast::clamp(_1342, 0.0, 360.0); + float _1348; + if (_1343 > 180.0) + { + _1348 = _1343 - 360.0; + } + else + { + _1348 = _1343; + } + float _1398; + if ((_1348 > (-67.5)) && (_1348 < 67.5)) + { + float _1355 = (_1348 - (-67.5)) * 0.0296296291053295135498046875; + int _1356 = int(_1355); + float _1358 = _1355 - float(_1356); + float _1359 = _1358 * _1358; + float _1360 = _1359 * _1358; + float _1397; + if (_1356 == 3) + { + _1397 = (((_1360 * (-0.16666667163372039794921875)) + (_1359 * 0.5)) + (_1358 * (-0.5))) + 0.16666667163372039794921875; + } + else + { + float _1390; + if (_1356 == 2) + { + _1390 = ((_1360 * 0.5) + (_1359 * (-1.0))) + 0.666666686534881591796875; + } + else + { + float _1385; + if (_1356 == 1) + { + _1385 = (((_1360 * (-0.5)) + (_1359 * 0.5)) + (_1358 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1378; + if (_1356 == 0) + { + _1378 = _1360 * 0.16666667163372039794921875; + } + else + { + _1378 = 0.0; + } + _1385 = _1378; + } + _1390 = _1385; + } + _1397 = _1390; + } + _1398 = _1397; + } + else + { + _1398 = 0.0; + } + _1319.x = _1320 + ((((_1398 * 1.5) * _1275) * (0.02999999932944774627685546875 - _1320)) * 0.180000007152557373046875); + float3 _1408 = fast::clamp(fast::clamp(_1319, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _1411 = mix(float3(dot(_1408, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1408, float3(0.959999978542327880859375)); + float _1412 = _1411.x; + float _1416 = 0.17999999225139617919921875 * exp2(18.0); + float _1418 = exp2(-14.0); + float _1421 = log((_1412 <= 0.0) ? _1418 : _1412) / _1065; + float _1423 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065; + float _1490; + if (_1421 <= _1423) + { + _1490 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1430 = log(0.180000007152557373046875) / _1065; + float _1487; + if ((_1421 > _1423) && (_1421 < _1430)) + { + float _1470 = (3.0 * (_1421 - _1423)) / (_1430 - _1423); + int _1471 = int(_1470); + float _1473 = _1470 - float(_1471); + _1487 = dot(float3(_1473 * _1473, _1473, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1471], _475[_1471 + 1], _475[_1471 + 2])); + } + else + { + float _1438 = log(_1416) / _1065; + float _1466; + if ((_1421 >= _1430) && (_1421 < _1438)) + { + float _1449 = (3.0 * (_1421 - _1430)) / (_1438 - _1430); + int _1450 = int(_1449); + float _1452 = _1449 - float(_1450); + _1466 = dot(float3(_1452 * _1452, _1452, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1450], _476[_1450 + 1], _476[_1450 + 2])); + } + else + { + _1466 = log(10000.0) / _1065; + } + _1487 = _1466; + } + _1490 = _1487; + } + float3 _1492; + _1492.x = pow(10.0, _1490); + float _1493 = _1411.y; + float _1497 = log((_1493 <= 0.0) ? _1418 : _1493) / _1065; + float _1564; + if (_1497 <= _1423) + { + _1564 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1504 = log(0.180000007152557373046875) / _1065; + float _1561; + if ((_1497 > _1423) && (_1497 < _1504)) + { + float _1544 = (3.0 * (_1497 - _1423)) / (_1504 - _1423); + int _1545 = int(_1544); + float _1547 = _1544 - float(_1545); + _1561 = dot(float3(_1547 * _1547, _1547, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1545], _475[_1545 + 1], _475[_1545 + 2])); + } + else + { + float _1512 = log(_1416) / _1065; + float _1540; + if ((_1497 >= _1504) && (_1497 < _1512)) + { + float _1523 = (3.0 * (_1497 - _1504)) / (_1512 - _1504); + int _1524 = int(_1523); + float _1526 = _1523 - float(_1524); + _1540 = dot(float3(_1526 * _1526, _1526, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1524], _476[_1524 + 1], _476[_1524 + 2])); + } + else + { + _1540 = log(10000.0) / _1065; + } + _1561 = _1540; + } + _1564 = _1561; + } + _1492.y = pow(10.0, _1564); + float _1567 = _1411.z; + float _1571 = log((_1567 <= 0.0) ? _1418 : _1567) / _1065; + float _1638; + if (_1571 <= _1423) + { + _1638 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1578 = log(0.180000007152557373046875) / _1065; + float _1635; + if ((_1571 > _1423) && (_1571 < _1578)) + { + float _1618 = (3.0 * (_1571 - _1423)) / (_1578 - _1423); + int _1619 = int(_1618); + float _1621 = _1618 - float(_1619); + _1635 = dot(float3(_1621 * _1621, _1621, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1619], _475[_1619 + 1], _475[_1619 + 2])); + } + else + { + float _1586 = log(_1416) / _1065; + float _1614; + if ((_1571 >= _1578) && (_1571 < _1586)) + { + float _1597 = (3.0 * (_1571 - _1578)) / (_1586 - _1578); + int _1598 = int(_1597); + float _1600 = _1597 - float(_1598); + _1614 = dot(float3(_1600 * _1600, _1600, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1598], _476[_1598 + 1], _476[_1598 + 2])); + } + else + { + _1614 = log(10000.0) / _1065; + } + _1635 = _1614; + } + _1638 = _1635; + } + _1492.z = pow(10.0, _1638); + float3 _1642 = (_1492 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _1644 = 0.17999999225139617919921875 * pow(2.0, -12.0); + float _1648 = log((_1644 <= 0.0) ? _1418 : _1644) / _1065; + float _1715; + if (_1648 <= _1423) + { + _1715 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1655 = log(0.180000007152557373046875) / _1065; + float _1712; + if ((_1648 > _1423) && (_1648 < _1655)) + { + float _1695 = (3.0 * (_1648 - _1423)) / (_1655 - _1423); + int _1696 = int(_1695); + float _1698 = _1695 - float(_1696); + _1712 = dot(float3(_1698 * _1698, _1698, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1696], _475[_1696 + 1], _475[_1696 + 2])); + } + else + { + float _1663 = log(_1416) / _1065; + float _1691; + if ((_1648 >= _1655) && (_1648 < _1663)) + { + float _1674 = (3.0 * (_1648 - _1655)) / (_1663 - _1655); + int _1675 = int(_1674); + float _1677 = _1674 - float(_1675); + _1691 = dot(float3(_1677 * _1677, _1677, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1675], _476[_1675 + 1], _476[_1675 + 2])); + } + else + { + _1691 = log(10000.0) / _1065; + } + _1712 = _1691; + } + _1715 = _1712; + } + float _1718 = log(0.180000007152557373046875) / _1065; + float _1774; + if (_1718 <= _1423) + { + _1774 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1771; + if ((_1718 > _1423) && (_1718 < _1718)) + { + _1771 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[3], _475[4], _475[5])).z; + } + else + { + float _1731 = log(_1416) / _1065; + float _1759; + if ((_1718 >= _1718) && (_1718 < _1731)) + { + float _1742 = (3.0 * (_1718 - _1718)) / (_1731 - _1718); + int _1743 = int(_1742); + float _1745 = _1742 - float(_1743); + _1759 = dot(float3(_1745 * _1745, _1745, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1743], _476[_1743 + 1], _476[_1743 + 2])); + } + else + { + _1759 = log(10000.0) / _1065; + } + _1771 = _1759; + } + _1774 = _1771; + } + float _1775 = pow(10.0, _1774); + float _1777 = 0.17999999225139617919921875 * pow(2.0, 11.0); + float _1781 = log((_1777 <= 0.0) ? _1418 : _1777) / _1065; + float _1846; + if (_1781 <= _1423) + { + _1846 = log(9.9999997473787516355514526367188e-05) / _1065; + } + else + { + float _1843; + if ((_1781 > _1423) && (_1781 < _1718)) + { + float _1826 = (3.0 * (_1781 - _1423)) / (_1718 - _1423); + int _1827 = int(_1826); + float _1829 = _1826 - float(_1827); + _1843 = dot(float3(_1829 * _1829, _1829, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1827], _475[_1827 + 1], _475[_1827 + 2])); + } + else + { + float _1794 = log(_1416) / _1065; + float _1822; + if ((_1781 >= _1718) && (_1781 < _1794)) + { + float _1805 = (3.0 * (_1781 - _1718)) / (_1794 - _1718); + int _1806 = int(_1805); + float _1808 = _1805 - float(_1806); + _1822 = dot(float3(_1808 * _1808, _1808, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1806], _476[_1806 + 1], _476[_1806 + 2])); + } + else + { + _1822 = log(10000.0) / _1065; + } + _1843 = _1822; + } + _1846 = _1843; + } + float _1847 = pow(10.0, _1846); + float _1848 = _1642.x; + float _1852 = log((_1848 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1848) / _1065; + float _1854 = log(pow(10.0, _1715)) / _1065; + float _1926; + if (_1852 <= _1854) + { + _1926 = log(0.004999999888241291046142578125) / _1065; + } + else + { + float _1861 = log(_1775) / _1065; + float _1923; + if ((_1852 > _1854) && (_1852 < _1861)) + { + float _1906 = (7.0 * (_1852 - _1854)) / (_1861 - _1854); + int _1907 = int(_1906); + float _1909 = _1906 - float(_1907); + _1923 = dot(float3(_1909 * _1909, _1909, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1907], _482[_1907 + 1], _482[_1907 + 2])); + } + else + { + float _1868 = log(_1847); + float _1869 = _1868 / _1065; + float _1902; + if ((_1852 >= _1861) && (_1852 < _1869)) + { + float _1885 = (7.0 * (_1852 - _1861)) / (_1869 - _1861); + int _1886 = int(_1885); + float _1888 = _1885 - float(_1886); + _1902 = dot(float3(_1888 * _1888, _1888, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1886], _483[_1886 + 1], _483[_1886 + 2])); + } + else + { + _1902 = (_1852 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1868) / _1065)); + } + _1923 = _1902; + } + _1926 = _1923; + } + float3 _1928; + _1928.x = pow(10.0, _1926); + float _1929 = _1642.y; + float _1933 = log((_1929 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1929) / _1065; + float _2005; + if (_1933 <= _1854) + { + _2005 = log(0.004999999888241291046142578125) / _1065; + } + else + { + float _1940 = log(_1775) / _1065; + float _2002; + if ((_1933 > _1854) && (_1933 < _1940)) + { + float _1985 = (7.0 * (_1933 - _1854)) / (_1940 - _1854); + int _1986 = int(_1985); + float _1988 = _1985 - float(_1986); + _2002 = dot(float3(_1988 * _1988, _1988, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1986], _482[_1986 + 1], _482[_1986 + 2])); + } + else + { + float _1947 = log(_1847); + float _1948 = _1947 / _1065; + float _1981; + if ((_1933 >= _1940) && (_1933 < _1948)) + { + float _1964 = (7.0 * (_1933 - _1940)) / (_1948 - _1940); + int _1965 = int(_1964); + float _1967 = _1964 - float(_1965); + _1981 = dot(float3(_1967 * _1967, _1967, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1965], _483[_1965 + 1], _483[_1965 + 2])); + } + else + { + _1981 = (_1933 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1947) / _1065)); + } + _2002 = _1981; + } + _2005 = _2002; + } + _1928.y = pow(10.0, _2005); + float _2008 = _1642.z; + float _2012 = log((_2008 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2008) / _1065; + float _2084; + if (_2012 <= _1854) + { + _2084 = log(0.004999999888241291046142578125) / _1065; + } + else + { + float _2019 = log(_1775) / _1065; + float _2081; + if ((_2012 > _1854) && (_2012 < _2019)) + { + float _2064 = (7.0 * (_2012 - _1854)) / (_2019 - _1854); + int _2065 = int(_2064); + float _2067 = _2064 - float(_2065); + _2081 = dot(float3(_2067 * _2067, _2067, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_2065], _482[_2065 + 1], _482[_2065 + 2])); + } + else + { + float _2026 = log(_1847); + float _2027 = _2026 / _1065; + float _2060; + if ((_2012 >= _2019) && (_2012 < _2027)) + { + float _2043 = (7.0 * (_2012 - _2019)) / (_2027 - _2019); + int _2044 = int(_2043); + float _2046 = _2043 - float(_2044); + _2060 = dot(float3(_2046 * _2046, _2046, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_2044], _483[_2044 + 1], _483[_2044 + 2])); + } + else + { + _2060 = (_2012 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _2026) / _1065)); + } + _2081 = _2060; + } + _2084 = _2081; + } + _1928.z = pow(10.0, _2084); + float3 _2089 = pow((_1928 * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2097 = pow((float3(0.8359375) + (float3(18.8515625) * _2089)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2089))), float3(78.84375)); + } + else + { + float3 _1260; + if (_Globals.OutputDevice == 7u) + { + float3 _1252 = pow(((_906 * _547) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _1260 = pow((float3(0.8359375) + (float3(18.8515625) * _1252)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1252))), float3(78.84375)); + } + else + { + _1260 = pow((_1218 * _547) * _576, float3(_Globals.InverseGamma.z)); + } + _2097 = _1260; + } + _2950 = _2097; + } + _2960 = _2950; + } + _3001 = _2960; + } + float3 _3002 = _3001 * float3(0.95238101482391357421875); + float4 _3003 = float4(_3002.x, _3002.y, _3002.z, float4(0.0).w); + _3003.w = 0.0; + out.out_var_SV_Target0 = _3003; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag new file mode 100644 index 0000000000..f405fbb68e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag @@ -0,0 +1,1392 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_Globals +{ + float4 MappingPolynomial; + float3 InverseGamma; + float4 ColorMatrixR_ColorCurveCd1; + float4 ColorMatrixG_ColorCurveCd3Cm3; + float4 ColorMatrixB_ColorCurveCm2; + float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3; + float4 ColorCurve_Ch1_Ch2; + float4 ColorShadow_Luma; + float4 ColorShadow_Tint1; + float4 ColorShadow_Tint2; + float FilmSlope; + float FilmToe; + float FilmShoulder; + float FilmBlackClip; + float FilmWhiteClip; + float4 LUTWeights[5]; + float3 ColorScale; + float4 OverlayColor; + float WhiteTemp; + float WhiteTint; + float4 ColorSaturation; + float4 ColorContrast; + float4 ColorGamma; + float4 ColorGain; + float4 ColorOffset; + float4 ColorSaturationShadows; + float4 ColorContrastShadows; + float4 ColorGammaShadows; + float4 ColorGainShadows; + float4 ColorOffsetShadows; + float4 ColorSaturationMidtones; + float4 ColorContrastMidtones; + float4 ColorGammaMidtones; + float4 ColorGainMidtones; + float4 ColorOffsetMidtones; + float4 ColorSaturationHighlights; + float4 ColorContrastHighlights; + float4 ColorGammaHighlights; + float4 ColorGainHighlights; + float4 ColorOffsetHighlights; + float ColorCorrectionShadowsMax; + float ColorCorrectionHighlightsMin; + uint OutputDevice; + uint OutputGamut; + float BlueCorrection; + float ExpandGamut; +}; + +constant float3 _523 = {}; +constant float3 _525 = {}; + +constant spvUnsafeArray _499 = spvUnsafeArray({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 }); +constant spvUnsafeArray _500 = spvUnsafeArray({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 }); +constant spvUnsafeArray _503 = spvUnsafeArray({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _504 = spvUnsafeArray({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 }); +constant spvUnsafeArray _506 = spvUnsafeArray({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 }); +constant spvUnsafeArray _507 = spvUnsafeArray({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 }); + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], texture2d Texture1 [[texture(0)]], sampler Texture1Sampler [[sampler(0)]], uint gl_Layer [[render_target_array_index]]) +{ + main0_out out = {}; + float3x3 _572 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875)); + float3x3 _573 = _572 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _574 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375)); + float3x3 _575 = _574 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)); + float3x3 _576 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)); + float3x3 _577 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)); + float3x3 _602; + for (;;) + { + if (_Globals.OutputGamut == 1u) + { + _602 = _574 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375)); + break; + } + else + { + if (_Globals.OutputGamut == 2u) + { + _602 = _574 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375)); + break; + } + else + { + if (_Globals.OutputGamut == 3u) + { + _602 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625)); + break; + } + else + { + if (_Globals.OutputGamut == 4u) + { + _602 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0)); + break; + } + else + { + _602 = _575; + break; + } + } + } + } + } + float3 _603 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz; + float3 _625; + if (_Globals.OutputDevice >= 3u) + { + float3 _617 = pow(_603, float3(0.0126833133399486541748046875)); + _625 = pow(fast::max(float3(0.0), _617 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _617)), float3(6.277394771575927734375)) * float3(10000.0); + } + else + { + _625 = (exp2((_603 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875)); + } + float _628 = _Globals.WhiteTemp * 1.00055634975433349609375; + float _642 = (_628 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _628)) / _628)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _628)) / _628)); + float _659 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)); + float _670 = ((0.317398726940155029296875 + (4.25 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)); + float _675 = ((2.0 * _659) - (8.0 * _670)) + 4.0; + float2 _679 = float2((3.0 * _659) / _675, (2.0 * _670) / _675); + float2 _686 = fast::normalize(float2(_659, _670)); + float _691 = _659 + (((-_686.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125); + float _695 = _670 + ((_686.x * _Globals.WhiteTint) * 0.0500000007450580596923828125); + float _700 = ((2.0 * _691) - (8.0 * _695)) + 4.0; + float2 _706 = select(float2(_642, ((((-3.0) * _642) * _642) + (2.86999988555908203125 * _642)) - 0.2750000059604644775390625), _679, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _691) / _700, (2.0 * _695) / _700) - _679); + float _709 = fast::max(_706.y, 1.0000000133514319600180897396058e-10); + float3 _711; + _711.x = _706.x / _709; + _711.y = 1.0; + _711.z = ((1.0 - _706.x) - _706.y) / _709; + float _717 = fast::max(0.328999996185302734375, 1.0000000133514319600180897396058e-10); + float3 _719; + _719.x = 0.3127000033855438232421875 / _717; + _719.y = 1.0; + _719.z = 0.3582999706268310546875 / _717; + float3 _723 = _711 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _724 = _719 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)); + float3 _743 = (_625 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_724.x / _723.x, 0.0, 0.0), float3(0.0, _724.y / _723.y, 0.0), float3(0.0, 0.0, _724.z / _723.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _573; + float3 _771; + if (_Globals.ColorShadow_Tint2.w != 0.0) + { + float _750 = dot(_743, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float3 _753 = (_743 / float3(_750)) - float3(1.0); + _771 = mix(_743, _743 * (_575 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_753, _753))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _750) * _750)))); + } + else + { + _771 = _743; + } + float _772 = dot(_771, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625)); + float4 _777 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation; + float4 _782 = _Globals.ColorContrastShadows * _Globals.ColorContrast; + float4 _787 = _Globals.ColorGammaShadows * _Globals.ColorGamma; + float4 _792 = _Globals.ColorGainShadows * _Globals.ColorGain; + float4 _797 = _Globals.ColorOffsetShadows + _Globals.ColorOffset; + float3 _798 = float3(_772); + float _830 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _772); + float4 _834 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation; + float4 _837 = _Globals.ColorContrastHighlights * _Globals.ColorContrast; + float4 _840 = _Globals.ColorGammaHighlights * _Globals.ColorGamma; + float4 _843 = _Globals.ColorGainHighlights * _Globals.ColorGain; + float4 _846 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset; + float _878 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _772); + float4 _881 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation; + float4 _884 = _Globals.ColorContrastMidtones * _Globals.ColorContrast; + float4 _887 = _Globals.ColorGammaMidtones * _Globals.ColorGamma; + float4 _890 = _Globals.ColorGainMidtones * _Globals.ColorGain; + float4 _893 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset; + float3 _931 = ((((pow(pow(fast::max(float3(0.0), mix(_798, _771, _777.xyz * float3(_777.w))) * float3(5.5555553436279296875), _782.xyz * float3(_782.w)) * float3(0.180000007152557373046875), float3(1.0) / (_787.xyz * float3(_787.w))) * (_792.xyz * float3(_792.w))) + (_797.xyz + float3(_797.w))) * float3(1.0 - _830)) + (((pow(pow(fast::max(float3(0.0), mix(_798, _771, _881.xyz * float3(_881.w))) * float3(5.5555553436279296875), _884.xyz * float3(_884.w)) * float3(0.180000007152557373046875), float3(1.0) / (_887.xyz * float3(_887.w))) * (_890.xyz * float3(_890.w))) + (_893.xyz + float3(_893.w))) * float3(_830 - _878))) + (((pow(pow(fast::max(float3(0.0), mix(_798, _771, _834.xyz * float3(_834.w))) * float3(5.5555553436279296875), _837.xyz * float3(_837.w)) * float3(0.180000007152557373046875), float3(1.0) / (_840.xyz * float3(_840.w))) * (_843.xyz * float3(_843.w))) + (_846.xyz + float3(_846.w))) * float3(_878)); + float3 _932 = _931 * _575; + float3 _940 = float3(_Globals.BlueCorrection); + float3 _942 = mix(_931, _931 * ((_577 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _576), _940) * _577; + float _943 = _942.x; + float _944 = _942.y; + float _946 = _942.z; + float _949 = fast::max(fast::max(_943, _944), _946); + float _954 = (fast::max(_949, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_943, _944), _946), 1.0000000133514319600180897396058e-10)) / fast::max(_949, 0.00999999977648258209228515625); + float _967 = ((_946 + _944) + _943) + (1.75 * sqrt(((_946 * (_946 - _944)) + (_944 * (_944 - _943))) + (_943 * (_943 - _946)))); + float _968 = _967 * 0.3333333432674407958984375; + float _969 = _954 - 0.4000000059604644775390625; + float _974 = fast::max(1.0 - abs(_969 * 2.5), 0.0); + float _982 = (1.0 + (float(int(sign(_969 * 5.0))) * (1.0 - (_974 * _974)))) * 0.02500000037252902984619140625; + float _995; + if (_968 <= 0.053333334624767303466796875) + { + _995 = _982; + } + else + { + float _994; + if (_968 >= 0.1599999964237213134765625) + { + _994 = 0.0; + } + else + { + _994 = _982 * ((0.23999999463558197021484375 / _967) - 0.5); + } + _995 = _994; + } + float3 _998 = _942 * float3(1.0 + _995); + float _999 = _998.x; + float _1000 = _998.y; + float _1002 = _998.z; + float _1016; + if ((_999 == _1000) && (_1000 == _1002)) + { + _1016 = 0.0; + } + else + { + _1016 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_1000 - _1002), ((2.0 * _999) - _1000) - _1002); + } + float _1021; + if (_1016 < 0.0) + { + _1021 = _1016 + 360.0; + } + else + { + _1021 = _1016; + } + float _1022 = fast::clamp(_1021, 0.0, 360.0); + float _1027; + if (_1022 > 180.0) + { + _1027 = _1022 - 360.0; + } + else + { + _1027 = _1022; + } + float _1031 = smoothstep(0.0, 1.0, 1.0 - abs(_1027 * 0.01481481455266475677490234375)); + _998.x = _999 + ((((_1031 * _1031) * _954) * (0.02999999932944774627685546875 - _999)) * 0.180000007152557373046875); + float3 _1040 = fast::max(float3(0.0), _998 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375))); + float _1049 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe; + float _1052 = 1.0 + _Globals.FilmWhiteClip; + float _1055 = _1052 - _Globals.FilmShoulder; + float _1082; + if (_Globals.FilmToe > 0.800000011920928955078125) + { + _1082 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0)); + } + else + { + float _1061 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1049; + _1082 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1061 / (2.0 - _1061))) * (_1049 / _Globals.FilmSlope)); + } + float _1087 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1082; + float _1089 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1087; + float _1091 = log(10.0); + float3 _1093 = log(mix(float3(dot(_1040, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1040, float3(0.959999978542327880859375))) / float3(_1091); + float3 _1097 = float3(_Globals.FilmSlope) * (_1093 + float3(_1087)); + float3 _1105 = float3(_1082); + float3 _1106 = _1093 - _1105; + float3 _1118 = float3(_1089); + float3 _1132 = fast::clamp(_1106 / float3(_1089 - _1082), float3(0.0), float3(1.0)); + float3 _1136 = select(_1132, float3(1.0) - _1132, bool3(_1089 < _1082)); + float3 _1141 = mix(select(_1097, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1049) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1049) * _1106))), _1093 < _1105), select(_1097, float3(_1052) - (float3(2.0 * _1055) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1055) * (_1093 - _1118)))), _1093 > _1118), ((float3(3.0) - (float3(2.0) * _1136)) * _1136) * _1136); + float3 _1145 = fast::max(float3(0.0), mix(float3(dot(_1141, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1141, float3(0.930000007152557373046875))); + float3 _1215; + if (_Globals.ColorShadow_Tint2.w == 0.0) + { + float3 _1157; + _1157.x = dot(_932, _Globals.ColorMatrixR_ColorCurveCd1.xyz); + _1157.y = dot(_932, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz); + _1157.z = dot(_932, _Globals.ColorMatrixB_ColorCurveCm2.xyz); + float3 _1183 = fast::max(float3(0.0), _1157 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_932, _Globals.ColorShadow_Luma.xyz) + 1.0))))); + float3 _1188 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1183); + float3 _1190 = fast::max(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz); + _1215 = ((((_1190 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1190 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1188 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1188 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375); + } + else + { + _1215 = fast::max(float3(0.0), mix(_1145, _1145 * ((_577 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _576), _940) * _575); + } + float3 _1216 = fast::clamp(_1215, float3(0.0), float3(1.0)); + float _1217 = _1216.x; + float _1229; + for (;;) + { + if (_1217 < 0.00313066993840038776397705078125) + { + _1229 = _1217 * 12.9200000762939453125; + break; + } + _1229 = (pow(_1217, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _1230 = _1216.y; + float _1242; + for (;;) + { + if (_1230 < 0.00313066993840038776397705078125) + { + _1242 = _1230 * 12.9200000762939453125; + break; + } + _1242 = (pow(_1230, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _1243 = _1216.z; + float _1255; + for (;;) + { + if (_1243 < 0.00313066993840038776397705078125) + { + _1255 = _1243 * 12.9200000762939453125; + break; + } + _1255 = (pow(_1243, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float3 _1256 = float3(_1229, _1242, _1255); + float3 _1258 = (_1256 * float3(0.9375)) + float3(0.03125); + float _1270 = (_1258.z * 16.0) - 0.5; + float _1271 = floor(_1270); + float _1275 = (_1258.x + _1271) * 0.0625; + float _1276 = _1258.y; + float4 _1279 = Texture1.sample(Texture1Sampler, float2(_1275, _1276)); + float4 _1283 = Texture1.sample(Texture1Sampler, float2(_1275 + 0.0625, _1276)); + float3 _1289 = fast::max(float3(6.1035199905745685100555419921875e-05), (float3(_Globals.LUTWeights[0].x) * _1256) + (float3(_Globals.LUTWeights[1].x) * mix(_1279, _1283, float4(_1270 - _1271)).xyz)); + float3 _1295 = select(_1289 * float3(0.077399380505084991455078125), pow((_1289 * float3(0.94786727428436279296875)) + float3(0.0521326996386051177978515625), float3(2.400000095367431640625)), _1289 > float3(0.040449999272823333740234375)); + float3 _1324 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * (_1295 * _1295)) + (float3(_Globals.MappingPolynomial.y) * _1295)) + float3(_Globals.MappingPolynomial.z)) * _Globals.ColorScale, _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y)); + float3 _3103; + if (_Globals.OutputDevice == 0u) + { + float _3075; + for (;;) + { + if (_1324.x < 0.00313066993840038776397705078125) + { + _3075 = _1324.x * 12.9200000762939453125; + break; + } + _3075 = (pow(_1324.x, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _3088; + for (;;) + { + if (_1324.y < 0.00313066993840038776397705078125) + { + _3088 = _1324.y * 12.9200000762939453125; + break; + } + _3088 = (pow(_1324.y, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + float _3101; + for (;;) + { + if (_1324.z < 0.00313066993840038776397705078125) + { + _3101 = _1324.z * 12.9200000762939453125; + break; + } + _3101 = (pow(_1324.z, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875; + break; + } + _3103 = float3(_3075, _3088, _3101); + } + else + { + float3 _3062; + if (_Globals.OutputDevice == 1u) + { + float3 _3055 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1324 * _573) * _602); + _3062 = fast::min(_3055 * float3(4.5), (pow(fast::max(_3055, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375)); + } + else + { + float3 _3052; + if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u)) + { + float3 _2204 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _2205 = _2204.x; + float _2206 = _2204.y; + float _2208 = _2204.z; + float _2211 = fast::max(fast::max(_2205, _2206), _2208); + float _2216 = (fast::max(_2211, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2205, _2206), _2208), 1.0000000133514319600180897396058e-10)) / fast::max(_2211, 0.00999999977648258209228515625); + float _2229 = ((_2208 + _2206) + _2205) + (1.75 * sqrt(((_2208 * (_2208 - _2206)) + (_2206 * (_2206 - _2205))) + (_2205 * (_2205 - _2208)))); + float _2230 = _2229 * 0.3333333432674407958984375; + float _2231 = _2216 - 0.4000000059604644775390625; + float _2236 = fast::max(1.0 - abs(_2231 * 2.5), 0.0); + float _2244 = (1.0 + (float(int(sign(_2231 * 5.0))) * (1.0 - (_2236 * _2236)))) * 0.02500000037252902984619140625; + float _2257; + if (_2230 <= 0.053333334624767303466796875) + { + _2257 = _2244; + } + else + { + float _2256; + if (_2230 >= 0.1599999964237213134765625) + { + _2256 = 0.0; + } + else + { + _2256 = _2244 * ((0.23999999463558197021484375 / _2229) - 0.5); + } + _2257 = _2256; + } + float3 _2260 = _2204 * float3(1.0 + _2257); + float _2261 = _2260.x; + float _2262 = _2260.y; + float _2264 = _2260.z; + float _2278; + if ((_2261 == _2262) && (_2262 == _2264)) + { + _2278 = 0.0; + } + else + { + _2278 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_2262 - _2264), ((2.0 * _2261) - _2262) - _2264); + } + float _2283; + if (_2278 < 0.0) + { + _2283 = _2278 + 360.0; + } + else + { + _2283 = _2278; + } + float _2284 = fast::clamp(_2283, 0.0, 360.0); + float _2289; + if (_2284 > 180.0) + { + _2289 = _2284 - 360.0; + } + else + { + _2289 = _2284; + } + float _2339; + if ((_2289 > (-67.5)) && (_2289 < 67.5)) + { + float _2296 = (_2289 - (-67.5)) * 0.0296296291053295135498046875; + int _2297 = int(_2296); + float _2299 = _2296 - float(_2297); + float _2300 = _2299 * _2299; + float _2301 = _2300 * _2299; + float _2338; + if (_2297 == 3) + { + _2338 = (((_2301 * (-0.16666667163372039794921875)) + (_2300 * 0.5)) + (_2299 * (-0.5))) + 0.16666667163372039794921875; + } + else + { + float _2331; + if (_2297 == 2) + { + _2331 = ((_2301 * 0.5) + (_2300 * (-1.0))) + 0.666666686534881591796875; + } + else + { + float _2326; + if (_2297 == 1) + { + _2326 = (((_2301 * (-0.5)) + (_2300 * 0.5)) + (_2299 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _2319; + if (_2297 == 0) + { + _2319 = _2301 * 0.16666667163372039794921875; + } + else + { + _2319 = 0.0; + } + _2326 = _2319; + } + _2331 = _2326; + } + _2338 = _2331; + } + _2339 = _2338; + } + else + { + _2339 = 0.0; + } + _2260.x = _2261 + ((((_2339 * 1.5) * _2216) * (0.02999999932944774627685546875 - _2261)) * 0.180000007152557373046875); + float3 _2349 = fast::clamp(fast::clamp(_2260, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _2352 = mix(float3(dot(_2349, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2349, float3(0.959999978542327880859375)); + float _2353 = _2352.x; + float _2357 = 0.17999999225139617919921875 * exp2(18.0); + float _2359 = exp2(-14.0); + float _2362 = log((_2353 <= 0.0) ? _2359 : _2353) / _1091; + float _2364 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091; + float _2431; + if (_2362 <= _2364) + { + _2431 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2371 = log(0.180000007152557373046875) / _1091; + float _2428; + if ((_2362 > _2364) && (_2362 < _2371)) + { + float _2411 = (3.0 * (_2362 - _2364)) / (_2371 - _2364); + int _2412 = int(_2411); + float _2414 = _2411 - float(_2412); + _2428 = dot(float3(_2414 * _2414, _2414, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2412], _499[_2412 + 1], _499[_2412 + 2])); + } + else + { + float _2379 = log(_2357) / _1091; + float _2407; + if ((_2362 >= _2371) && (_2362 < _2379)) + { + float _2390 = (3.0 * (_2362 - _2371)) / (_2379 - _2371); + int _2391 = int(_2390); + float _2393 = _2390 - float(_2391); + _2407 = dot(float3(_2393 * _2393, _2393, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2391], _500[_2391 + 1], _500[_2391 + 2])); + } + else + { + _2407 = log(10000.0) / _1091; + } + _2428 = _2407; + } + _2431 = _2428; + } + float3 _2433; + _2433.x = pow(10.0, _2431); + float _2434 = _2352.y; + float _2438 = log((_2434 <= 0.0) ? _2359 : _2434) / _1091; + float _2505; + if (_2438 <= _2364) + { + _2505 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2445 = log(0.180000007152557373046875) / _1091; + float _2502; + if ((_2438 > _2364) && (_2438 < _2445)) + { + float _2485 = (3.0 * (_2438 - _2364)) / (_2445 - _2364); + int _2486 = int(_2485); + float _2488 = _2485 - float(_2486); + _2502 = dot(float3(_2488 * _2488, _2488, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2486], _499[_2486 + 1], _499[_2486 + 2])); + } + else + { + float _2453 = log(_2357) / _1091; + float _2481; + if ((_2438 >= _2445) && (_2438 < _2453)) + { + float _2464 = (3.0 * (_2438 - _2445)) / (_2453 - _2445); + int _2465 = int(_2464); + float _2467 = _2464 - float(_2465); + _2481 = dot(float3(_2467 * _2467, _2467, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2465], _500[_2465 + 1], _500[_2465 + 2])); + } + else + { + _2481 = log(10000.0) / _1091; + } + _2502 = _2481; + } + _2505 = _2502; + } + _2433.y = pow(10.0, _2505); + float _2508 = _2352.z; + float _2512 = log((_2508 <= 0.0) ? _2359 : _2508) / _1091; + float _2579; + if (_2512 <= _2364) + { + _2579 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2519 = log(0.180000007152557373046875) / _1091; + float _2576; + if ((_2512 > _2364) && (_2512 < _2519)) + { + float _2559 = (3.0 * (_2512 - _2364)) / (_2519 - _2364); + int _2560 = int(_2559); + float _2562 = _2559 - float(_2560); + _2576 = dot(float3(_2562 * _2562, _2562, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2560], _499[_2560 + 1], _499[_2560 + 2])); + } + else + { + float _2527 = log(_2357) / _1091; + float _2555; + if ((_2512 >= _2519) && (_2512 < _2527)) + { + float _2538 = (3.0 * (_2512 - _2519)) / (_2527 - _2519); + int _2539 = int(_2538); + float _2541 = _2538 - float(_2539); + _2555 = dot(float3(_2541 * _2541, _2541, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2539], _500[_2539 + 1], _500[_2539 + 2])); + } + else + { + _2555 = log(10000.0) / _1091; + } + _2576 = _2555; + } + _2579 = _2576; + } + _2433.z = pow(10.0, _2579); + float3 _2583 = (_2433 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _2585 = 0.17999999225139617919921875 * pow(2.0, -12.0); + float _2589 = log((_2585 <= 0.0) ? _2359 : _2585) / _1091; + float _2656; + if (_2589 <= _2364) + { + _2656 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2596 = log(0.180000007152557373046875) / _1091; + float _2653; + if ((_2589 > _2364) && (_2589 < _2596)) + { + float _2636 = (3.0 * (_2589 - _2364)) / (_2596 - _2364); + int _2637 = int(_2636); + float _2639 = _2636 - float(_2637); + _2653 = dot(float3(_2639 * _2639, _2639, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2637], _499[_2637 + 1], _499[_2637 + 2])); + } + else + { + float _2604 = log(_2357) / _1091; + float _2632; + if ((_2589 >= _2596) && (_2589 < _2604)) + { + float _2615 = (3.0 * (_2589 - _2596)) / (_2604 - _2596); + int _2616 = int(_2615); + float _2618 = _2615 - float(_2616); + _2632 = dot(float3(_2618 * _2618, _2618, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2616], _500[_2616 + 1], _500[_2616 + 2])); + } + else + { + _2632 = log(10000.0) / _1091; + } + _2653 = _2632; + } + _2656 = _2653; + } + float _2659 = log(0.180000007152557373046875) / _1091; + float _2713; + if (_2659 <= _2364) + { + _2713 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2710; + if ((_2659 > _2364) && (_2659 < _2659)) + { + _2710 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[3], _499[4], _499[5])).z; + } + else + { + float _2672 = log(_2357) / _1091; + float _2700; + if ((_2659 >= _2659) && (_2659 < _2672)) + { + float _2683 = (3.0 * (_2659 - _2659)) / (_2672 - _2659); + int _2684 = int(_2683); + float _2686 = _2683 - float(_2684); + _2700 = dot(float3(_2686 * _2686, _2686, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2684], _500[_2684 + 1], _500[_2684 + 2])); + } + else + { + _2700 = log(10000.0) / _1091; + } + _2710 = _2700; + } + _2713 = _2710; + } + float _2714 = pow(10.0, _2713); + float _2716 = 0.17999999225139617919921875 * pow(2.0, 10.0); + float _2720 = log((_2716 <= 0.0) ? _2359 : _2716) / _1091; + float _2785; + if (_2720 <= _2364) + { + _2785 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _2782; + if ((_2720 > _2364) && (_2720 < _2659)) + { + float _2765 = (3.0 * (_2720 - _2364)) / (_2659 - _2364); + int _2766 = int(_2765); + float _2768 = _2765 - float(_2766); + _2782 = dot(float3(_2768 * _2768, _2768, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2766], _499[_2766 + 1], _499[_2766 + 2])); + } + else + { + float _2733 = log(_2357) / _1091; + float _2761; + if ((_2720 >= _2659) && (_2720 < _2733)) + { + float _2744 = (3.0 * (_2720 - _2659)) / (_2733 - _2659); + int _2745 = int(_2744); + float _2747 = _2744 - float(_2745); + _2761 = dot(float3(_2747 * _2747, _2747, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2745], _500[_2745 + 1], _500[_2745 + 2])); + } + else + { + _2761 = log(10000.0) / _1091; + } + _2782 = _2761; + } + _2785 = _2782; + } + float _2786 = pow(10.0, _2785); + float _2787 = _2583.x; + float _2791 = log((_2787 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2787) / _1091; + float _2792 = log(pow(10.0, _2656)); + float _2793 = _2792 / _1091; + float _2870; + if (_2791 <= _2793) + { + _2870 = (_2791 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091)); + } + else + { + float _2800 = log(_2714) / _1091; + float _2862; + if ((_2791 > _2793) && (_2791 < _2800)) + { + float _2845 = (7.0 * (_2791 - _2793)) / (_2800 - _2793); + int _2846 = int(_2845); + float _2848 = _2845 - float(_2846); + _2862 = dot(float3(_2848 * _2848, _2848, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2846], _503[_2846 + 1], _503[_2846 + 2])); + } + else + { + float _2807 = log(_2786); + float _2808 = _2807 / _1091; + float _2841; + if ((_2791 >= _2800) && (_2791 < _2808)) + { + float _2824 = (7.0 * (_2791 - _2800)) / (_2808 - _2800); + int _2825 = int(_2824); + float _2827 = _2824 - float(_2825); + _2841 = dot(float3(_2827 * _2827, _2827, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2825], _504[_2825 + 1], _504[_2825 + 2])); + } + else + { + _2841 = (_2791 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2807) / _1091)); + } + _2862 = _2841; + } + _2870 = _2862; + } + float3 _2872; + _2872.x = pow(10.0, _2870); + float _2873 = _2583.y; + float _2877 = log((_2873 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2873) / _1091; + float _2954; + if (_2877 <= _2793) + { + _2954 = (_2877 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091)); + } + else + { + float _2884 = log(_2714) / _1091; + float _2946; + if ((_2877 > _2793) && (_2877 < _2884)) + { + float _2929 = (7.0 * (_2877 - _2793)) / (_2884 - _2793); + int _2930 = int(_2929); + float _2932 = _2929 - float(_2930); + _2946 = dot(float3(_2932 * _2932, _2932, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2930], _503[_2930 + 1], _503[_2930 + 2])); + } + else + { + float _2891 = log(_2786); + float _2892 = _2891 / _1091; + float _2925; + if ((_2877 >= _2884) && (_2877 < _2892)) + { + float _2908 = (7.0 * (_2877 - _2884)) / (_2892 - _2884); + int _2909 = int(_2908); + float _2911 = _2908 - float(_2909); + _2925 = dot(float3(_2911 * _2911, _2911, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2909], _504[_2909 + 1], _504[_2909 + 2])); + } + else + { + _2925 = (_2877 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2891) / _1091)); + } + _2946 = _2925; + } + _2954 = _2946; + } + _2872.y = pow(10.0, _2954); + float _2957 = _2583.z; + float _2961 = log((_2957 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2957) / _1091; + float _3038; + if (_2961 <= _2793) + { + _3038 = (_2961 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091)); + } + else + { + float _2968 = log(_2714) / _1091; + float _3030; + if ((_2961 > _2793) && (_2961 < _2968)) + { + float _3013 = (7.0 * (_2961 - _2793)) / (_2968 - _2793); + int _3014 = int(_3013); + float _3016 = _3013 - float(_3014); + _3030 = dot(float3(_3016 * _3016, _3016, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_3014], _503[_3014 + 1], _503[_3014 + 2])); + } + else + { + float _2975 = log(_2786); + float _2976 = _2975 / _1091; + float _3009; + if ((_2961 >= _2968) && (_2961 < _2976)) + { + float _2992 = (7.0 * (_2961 - _2968)) / (_2976 - _2968); + int _2993 = int(_2992); + float _2995 = _2992 - float(_2993); + _3009 = dot(float3(_2995 * _2995, _2995, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2993], _504[_2993 + 1], _504[_2993 + 2])); + } + else + { + _3009 = (_2961 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2975) / _1091)); + } + _3030 = _3009; + } + _3038 = _3030; + } + _2872.z = pow(10.0, _3038); + float3 _3044 = pow(((_2872 - float3(3.5073844628641381859779357910156e-05)) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _3052 = pow((float3(0.8359375) + (float3(18.8515625) * _3044)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _3044))), float3(78.84375)); + } + else + { + float3 _2201; + if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u)) + { + float3 _1369 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625))); + float _1370 = _1369.x; + float _1371 = _1369.y; + float _1373 = _1369.z; + float _1376 = fast::max(fast::max(_1370, _1371), _1373); + float _1381 = (fast::max(_1376, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1370, _1371), _1373), 1.0000000133514319600180897396058e-10)) / fast::max(_1376, 0.00999999977648258209228515625); + float _1394 = ((_1373 + _1371) + _1370) + (1.75 * sqrt(((_1373 * (_1373 - _1371)) + (_1371 * (_1371 - _1370))) + (_1370 * (_1370 - _1373)))); + float _1395 = _1394 * 0.3333333432674407958984375; + float _1396 = _1381 - 0.4000000059604644775390625; + float _1401 = fast::max(1.0 - abs(_1396 * 2.5), 0.0); + float _1409 = (1.0 + (float(int(sign(_1396 * 5.0))) * (1.0 - (_1401 * _1401)))) * 0.02500000037252902984619140625; + float _1422; + if (_1395 <= 0.053333334624767303466796875) + { + _1422 = _1409; + } + else + { + float _1421; + if (_1395 >= 0.1599999964237213134765625) + { + _1421 = 0.0; + } + else + { + _1421 = _1409 * ((0.23999999463558197021484375 / _1394) - 0.5); + } + _1422 = _1421; + } + float3 _1425 = _1369 * float3(1.0 + _1422); + float _1426 = _1425.x; + float _1427 = _1425.y; + float _1429 = _1425.z; + float _1443; + if ((_1426 == _1427) && (_1427 == _1429)) + { + _1443 = 0.0; + } + else + { + _1443 = 57.2957763671875 * precise::atan2(sqrt(3.0) * (_1427 - _1429), ((2.0 * _1426) - _1427) - _1429); + } + float _1448; + if (_1443 < 0.0) + { + _1448 = _1443 + 360.0; + } + else + { + _1448 = _1443; + } + float _1449 = fast::clamp(_1448, 0.0, 360.0); + float _1454; + if (_1449 > 180.0) + { + _1454 = _1449 - 360.0; + } + else + { + _1454 = _1449; + } + float _1504; + if ((_1454 > (-67.5)) && (_1454 < 67.5)) + { + float _1461 = (_1454 - (-67.5)) * 0.0296296291053295135498046875; + int _1462 = int(_1461); + float _1464 = _1461 - float(_1462); + float _1465 = _1464 * _1464; + float _1466 = _1465 * _1464; + float _1503; + if (_1462 == 3) + { + _1503 = (((_1466 * (-0.16666667163372039794921875)) + (_1465 * 0.5)) + (_1464 * (-0.5))) + 0.16666667163372039794921875; + } + else + { + float _1496; + if (_1462 == 2) + { + _1496 = ((_1466 * 0.5) + (_1465 * (-1.0))) + 0.666666686534881591796875; + } + else + { + float _1491; + if (_1462 == 1) + { + _1491 = (((_1466 * (-0.5)) + (_1465 * 0.5)) + (_1464 * 0.5)) + 0.16666667163372039794921875; + } + else + { + float _1484; + if (_1462 == 0) + { + _1484 = _1466 * 0.16666667163372039794921875; + } + else + { + _1484 = 0.0; + } + _1491 = _1484; + } + _1496 = _1491; + } + _1503 = _1496; + } + _1504 = _1503; + } + else + { + _1504 = 0.0; + } + _1425.x = _1426 + ((((_1504 * 1.5) * _1381) * (0.02999999932944774627685546875 - _1426)) * 0.180000007152557373046875); + float3 _1514 = fast::clamp(fast::clamp(_1425, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0)); + float3 _1517 = mix(float3(dot(_1514, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1514, float3(0.959999978542327880859375)); + float _1518 = _1517.x; + float _1522 = 0.17999999225139617919921875 * exp2(18.0); + float _1524 = exp2(-14.0); + float _1527 = log((_1518 <= 0.0) ? _1524 : _1518) / _1091; + float _1529 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091; + float _1596; + if (_1527 <= _1529) + { + _1596 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1536 = log(0.180000007152557373046875) / _1091; + float _1593; + if ((_1527 > _1529) && (_1527 < _1536)) + { + float _1576 = (3.0 * (_1527 - _1529)) / (_1536 - _1529); + int _1577 = int(_1576); + float _1579 = _1576 - float(_1577); + _1593 = dot(float3(_1579 * _1579, _1579, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1577], _499[_1577 + 1], _499[_1577 + 2])); + } + else + { + float _1544 = log(_1522) / _1091; + float _1572; + if ((_1527 >= _1536) && (_1527 < _1544)) + { + float _1555 = (3.0 * (_1527 - _1536)) / (_1544 - _1536); + int _1556 = int(_1555); + float _1558 = _1555 - float(_1556); + _1572 = dot(float3(_1558 * _1558, _1558, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1556], _500[_1556 + 1], _500[_1556 + 2])); + } + else + { + _1572 = log(10000.0) / _1091; + } + _1593 = _1572; + } + _1596 = _1593; + } + float3 _1598; + _1598.x = pow(10.0, _1596); + float _1599 = _1517.y; + float _1603 = log((_1599 <= 0.0) ? _1524 : _1599) / _1091; + float _1670; + if (_1603 <= _1529) + { + _1670 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1610 = log(0.180000007152557373046875) / _1091; + float _1667; + if ((_1603 > _1529) && (_1603 < _1610)) + { + float _1650 = (3.0 * (_1603 - _1529)) / (_1610 - _1529); + int _1651 = int(_1650); + float _1653 = _1650 - float(_1651); + _1667 = dot(float3(_1653 * _1653, _1653, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1651], _499[_1651 + 1], _499[_1651 + 2])); + } + else + { + float _1618 = log(_1522) / _1091; + float _1646; + if ((_1603 >= _1610) && (_1603 < _1618)) + { + float _1629 = (3.0 * (_1603 - _1610)) / (_1618 - _1610); + int _1630 = int(_1629); + float _1632 = _1629 - float(_1630); + _1646 = dot(float3(_1632 * _1632, _1632, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1630], _500[_1630 + 1], _500[_1630 + 2])); + } + else + { + _1646 = log(10000.0) / _1091; + } + _1667 = _1646; + } + _1670 = _1667; + } + _1598.y = pow(10.0, _1670); + float _1673 = _1517.z; + float _1677 = log((_1673 <= 0.0) ? _1524 : _1673) / _1091; + float _1744; + if (_1677 <= _1529) + { + _1744 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1684 = log(0.180000007152557373046875) / _1091; + float _1741; + if ((_1677 > _1529) && (_1677 < _1684)) + { + float _1724 = (3.0 * (_1677 - _1529)) / (_1684 - _1529); + int _1725 = int(_1724); + float _1727 = _1724 - float(_1725); + _1741 = dot(float3(_1727 * _1727, _1727, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1725], _499[_1725 + 1], _499[_1725 + 2])); + } + else + { + float _1692 = log(_1522) / _1091; + float _1720; + if ((_1677 >= _1684) && (_1677 < _1692)) + { + float _1703 = (3.0 * (_1677 - _1684)) / (_1692 - _1684); + int _1704 = int(_1703); + float _1706 = _1703 - float(_1704); + _1720 = dot(float3(_1706 * _1706, _1706, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1704], _500[_1704 + 1], _500[_1704 + 2])); + } + else + { + _1720 = log(10000.0) / _1091; + } + _1741 = _1720; + } + _1744 = _1741; + } + _1598.z = pow(10.0, _1744); + float3 _1748 = (_1598 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)); + float _1750 = 0.17999999225139617919921875 * pow(2.0, -12.0); + float _1754 = log((_1750 <= 0.0) ? _1524 : _1750) / _1091; + float _1821; + if (_1754 <= _1529) + { + _1821 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1761 = log(0.180000007152557373046875) / _1091; + float _1818; + if ((_1754 > _1529) && (_1754 < _1761)) + { + float _1801 = (3.0 * (_1754 - _1529)) / (_1761 - _1529); + int _1802 = int(_1801); + float _1804 = _1801 - float(_1802); + _1818 = dot(float3(_1804 * _1804, _1804, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1802], _499[_1802 + 1], _499[_1802 + 2])); + } + else + { + float _1769 = log(_1522) / _1091; + float _1797; + if ((_1754 >= _1761) && (_1754 < _1769)) + { + float _1780 = (3.0 * (_1754 - _1761)) / (_1769 - _1761); + int _1781 = int(_1780); + float _1783 = _1780 - float(_1781); + _1797 = dot(float3(_1783 * _1783, _1783, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1781], _500[_1781 + 1], _500[_1781 + 2])); + } + else + { + _1797 = log(10000.0) / _1091; + } + _1818 = _1797; + } + _1821 = _1818; + } + float _1824 = log(0.180000007152557373046875) / _1091; + float _1878; + if (_1824 <= _1529) + { + _1878 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1875; + if ((_1824 > _1529) && (_1824 < _1824)) + { + _1875 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[3], _499[4], _499[5])).z; + } + else + { + float _1837 = log(_1522) / _1091; + float _1865; + if ((_1824 >= _1824) && (_1824 < _1837)) + { + float _1848 = (3.0 * (_1824 - _1824)) / (_1837 - _1824); + int _1849 = int(_1848); + float _1851 = _1848 - float(_1849); + _1865 = dot(float3(_1851 * _1851, _1851, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1849], _500[_1849 + 1], _500[_1849 + 2])); + } + else + { + _1865 = log(10000.0) / _1091; + } + _1875 = _1865; + } + _1878 = _1875; + } + float _1879 = pow(10.0, _1878); + float _1881 = 0.17999999225139617919921875 * pow(2.0, 11.0); + float _1885 = log((_1881 <= 0.0) ? _1524 : _1881) / _1091; + float _1950; + if (_1885 <= _1529) + { + _1950 = log(9.9999997473787516355514526367188e-05) / _1091; + } + else + { + float _1947; + if ((_1885 > _1529) && (_1885 < _1824)) + { + float _1930 = (3.0 * (_1885 - _1529)) / (_1824 - _1529); + int _1931 = int(_1930); + float _1933 = _1930 - float(_1931); + _1947 = dot(float3(_1933 * _1933, _1933, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1931], _499[_1931 + 1], _499[_1931 + 2])); + } + else + { + float _1898 = log(_1522) / _1091; + float _1926; + if ((_1885 >= _1824) && (_1885 < _1898)) + { + float _1909 = (3.0 * (_1885 - _1824)) / (_1898 - _1824); + int _1910 = int(_1909); + float _1912 = _1909 - float(_1910); + _1926 = dot(float3(_1912 * _1912, _1912, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1910], _500[_1910 + 1], _500[_1910 + 2])); + } + else + { + _1926 = log(10000.0) / _1091; + } + _1947 = _1926; + } + _1950 = _1947; + } + float _1951 = pow(10.0, _1950); + float _1952 = _1748.x; + float _1956 = log((_1952 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1952) / _1091; + float _1958 = log(pow(10.0, _1821)) / _1091; + float _2030; + if (_1956 <= _1958) + { + _2030 = log(0.004999999888241291046142578125) / _1091; + } + else + { + float _1965 = log(_1879) / _1091; + float _2027; + if ((_1956 > _1958) && (_1956 < _1965)) + { + float _2010 = (7.0 * (_1956 - _1958)) / (_1965 - _1958); + int _2011 = int(_2010); + float _2013 = _2010 - float(_2011); + _2027 = dot(float3(_2013 * _2013, _2013, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2011], _506[_2011 + 1], _506[_2011 + 2])); + } + else + { + float _1972 = log(_1951); + float _1973 = _1972 / _1091; + float _2006; + if ((_1956 >= _1965) && (_1956 < _1973)) + { + float _1989 = (7.0 * (_1956 - _1965)) / (_1973 - _1965); + int _1990 = int(_1989); + float _1992 = _1989 - float(_1990); + _2006 = dot(float3(_1992 * _1992, _1992, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_1990], _507[_1990 + 1], _507[_1990 + 2])); + } + else + { + _2006 = (_1956 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _1972) / _1091)); + } + _2027 = _2006; + } + _2030 = _2027; + } + float3 _2032; + _2032.x = pow(10.0, _2030); + float _2033 = _1748.y; + float _2037 = log((_2033 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2033) / _1091; + float _2109; + if (_2037 <= _1958) + { + _2109 = log(0.004999999888241291046142578125) / _1091; + } + else + { + float _2044 = log(_1879) / _1091; + float _2106; + if ((_2037 > _1958) && (_2037 < _2044)) + { + float _2089 = (7.0 * (_2037 - _1958)) / (_2044 - _1958); + int _2090 = int(_2089); + float _2092 = _2089 - float(_2090); + _2106 = dot(float3(_2092 * _2092, _2092, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2090], _506[_2090 + 1], _506[_2090 + 2])); + } + else + { + float _2051 = log(_1951); + float _2052 = _2051 / _1091; + float _2085; + if ((_2037 >= _2044) && (_2037 < _2052)) + { + float _2068 = (7.0 * (_2037 - _2044)) / (_2052 - _2044); + int _2069 = int(_2068); + float _2071 = _2068 - float(_2069); + _2085 = dot(float3(_2071 * _2071, _2071, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2069], _507[_2069 + 1], _507[_2069 + 2])); + } + else + { + _2085 = (_2037 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2051) / _1091)); + } + _2106 = _2085; + } + _2109 = _2106; + } + _2032.y = pow(10.0, _2109); + float _2112 = _1748.z; + float _2116 = log((_2112 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2112) / _1091; + float _2188; + if (_2116 <= _1958) + { + _2188 = log(0.004999999888241291046142578125) / _1091; + } + else + { + float _2123 = log(_1879) / _1091; + float _2185; + if ((_2116 > _1958) && (_2116 < _2123)) + { + float _2168 = (7.0 * (_2116 - _1958)) / (_2123 - _1958); + int _2169 = int(_2168); + float _2171 = _2168 - float(_2169); + _2185 = dot(float3(_2171 * _2171, _2171, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2169], _506[_2169 + 1], _506[_2169 + 2])); + } + else + { + float _2130 = log(_1951); + float _2131 = _2130 / _1091; + float _2164; + if ((_2116 >= _2123) && (_2116 < _2131)) + { + float _2147 = (7.0 * (_2116 - _2123)) / (_2131 - _2123); + int _2148 = int(_2147); + float _2150 = _2147 - float(_2148); + _2164 = dot(float3(_2150 * _2150, _2150, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2148], _507[_2148 + 1], _507[_2148 + 2])); + } + else + { + _2164 = (_2116 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2130) / _1091)); + } + _2185 = _2164; + } + _2188 = _2185; + } + _2032.z = pow(10.0, _2188); + float3 _2193 = pow((_2032 * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _2201 = pow((float3(0.8359375) + (float3(18.8515625) * _2193)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2193))), float3(78.84375)); + } + else + { + float3 _1366; + if (_Globals.OutputDevice == 7u) + { + float3 _1358 = pow(((_932 * _573) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125)); + _1366 = pow((float3(0.8359375) + (float3(18.8515625) * _1358)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1358))), float3(78.84375)); + } + else + { + _1366 = pow((_1324 * _573) * _602, float3(_Globals.InverseGamma.z)); + } + _2201 = _1366; + } + _3052 = _2201; + } + _3062 = _3052; + } + _3103 = _3062; + } + float3 _3104 = _3103 * float3(0.95238101482391357421875); + float4 _3105 = float4(_3104.x, _3104.y, _3104.z, float4(0.0).w); + _3105.w = 0.0; + out.out_var_SV_Target0 = _3105; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag new file mode 100644 index 0000000000..72a9c58a63 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag @@ -0,0 +1,503 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_TranslucentBasePass +{ + uint TranslucentBasePass_Shared_Forward_NumLocalLights; + uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures; + uint TranslucentBasePass_Shared_Forward_HasDirectionalLight; + uint TranslucentBasePass_Shared_Forward_NumGridCells; + packed_int3 TranslucentBasePass_Shared_Forward_CulledGridSize; + uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell; + uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift; + uint PrePadding_TranslucentBasePass_Shared_Forward_36; + uint PrePadding_TranslucentBasePass_Shared_Forward_40; + uint PrePadding_TranslucentBasePass_Shared_Forward_44; + packed_float3 TranslucentBasePass_Shared_Forward_LightGridZParams; + float PrePadding_TranslucentBasePass_Shared_Forward_60; + packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection; + float PrePadding_TranslucentBasePass_Shared_Forward_76; + packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor; + float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity; + uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask; + uint PrePadding_TranslucentBasePass_Shared_Forward_100; + float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD; + uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades; + uint PrePadding_TranslucentBasePass_Shared_Forward_116; + uint PrePadding_TranslucentBasePass_Shared_Forward_120; + uint PrePadding_TranslucentBasePass_Shared_Forward_124; + float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths; + float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4]; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4]; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize; + float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias; + uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing; + uint PrePadding_TranslucentBasePass_Shared_Forward_488; + uint PrePadding_TranslucentBasePass_Shared_Forward_492; + float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize; + float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_576; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_580; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_584; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_588; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_592; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_596; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_600; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_604; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_608; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_612; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_616; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_620; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_624; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_628; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_632; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_636; + uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights; + uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures; + uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight; + uint TranslucentBasePass_Shared_ForwardISR_NumGridCells; + packed_int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize; + uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell; + uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684; + packed_float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_700; + packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection; + float PrePadding_TranslucentBasePass_Shared_ForwardISR_716; + packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor; + float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity; + uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740; + float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD; + uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764; + float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths; + float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4]; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4]; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize; + float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias; + uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1128; + uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1132; + float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize; + float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow; + float PrePadding_TranslucentBasePass_Shared_Reflection_1216; + float PrePadding_TranslucentBasePass_Shared_Reflection_1220; + float PrePadding_TranslucentBasePass_Shared_Reflection_1224; + float PrePadding_TranslucentBasePass_Shared_Reflection_1228; + float PrePadding_TranslucentBasePass_Shared_Reflection_1232; + float PrePadding_TranslucentBasePass_Shared_Reflection_1236; + float PrePadding_TranslucentBasePass_Shared_Reflection_1240; + float PrePadding_TranslucentBasePass_Shared_Reflection_1244; + float PrePadding_TranslucentBasePass_Shared_Reflection_1248; + float PrePadding_TranslucentBasePass_Shared_Reflection_1252; + float PrePadding_TranslucentBasePass_Shared_Reflection_1256; + float PrePadding_TranslucentBasePass_Shared_Reflection_1260; + float PrePadding_TranslucentBasePass_Shared_Reflection_1264; + float PrePadding_TranslucentBasePass_Shared_Reflection_1268; + float PrePadding_TranslucentBasePass_Shared_Reflection_1272; + float PrePadding_TranslucentBasePass_Shared_Reflection_1276; + float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters; + float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356; + float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis; + float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix; + packed_float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1484; + float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1496; + float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500; + float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2]; + float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2]; + float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound; + uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo; + float PrePadding_TranslucentBasePass_Shared_Fog_1676; + float PrePadding_TranslucentBasePass_Shared_Fog_1680; + float PrePadding_TranslucentBasePass_Shared_Fog_1684; + float PrePadding_TranslucentBasePass_Shared_Fog_1688; + float PrePadding_TranslucentBasePass_Shared_Fog_1692; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter; + float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3; + float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection; + float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor; + float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation; + float PrePadding_TranslucentBasePass_Shared_Fog_1800; + float PrePadding_TranslucentBasePass_Shared_Fog_1804; + packed_float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters; + float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog; + float PrePadding_TranslucentBasePass_1824; + float PrePadding_TranslucentBasePass_1828; + float PrePadding_TranslucentBasePass_1832; + float PrePadding_TranslucentBasePass_1836; + float PrePadding_TranslucentBasePass_1840; + float PrePadding_TranslucentBasePass_1844; + float PrePadding_TranslucentBasePass_1848; + float PrePadding_TranslucentBasePass_1852; + float PrePadding_TranslucentBasePass_1856; + float PrePadding_TranslucentBasePass_1860; + float PrePadding_TranslucentBasePass_1864; + float PrePadding_TranslucentBasePass_1868; + float PrePadding_TranslucentBasePass_1872; + float PrePadding_TranslucentBasePass_1876; + float PrePadding_TranslucentBasePass_1880; + float PrePadding_TranslucentBasePass_1884; + float PrePadding_TranslucentBasePass_1888; + float PrePadding_TranslucentBasePass_1892; + float PrePadding_TranslucentBasePass_1896; + float PrePadding_TranslucentBasePass_1900; + float PrePadding_TranslucentBasePass_1904; + float PrePadding_TranslucentBasePass_1908; + float PrePadding_TranslucentBasePass_1912; + float PrePadding_TranslucentBasePass_1916; + float PrePadding_TranslucentBasePass_1920; + float PrePadding_TranslucentBasePass_1924; + float PrePadding_TranslucentBasePass_1928; + float PrePadding_TranslucentBasePass_1932; + float PrePadding_TranslucentBasePass_1936; + float PrePadding_TranslucentBasePass_1940; + float PrePadding_TranslucentBasePass_1944; + float PrePadding_TranslucentBasePass_1948; + float PrePadding_TranslucentBasePass_1952; + float PrePadding_TranslucentBasePass_1956; + float PrePadding_TranslucentBasePass_1960; + float PrePadding_TranslucentBasePass_1964; + float PrePadding_TranslucentBasePass_1968; + float PrePadding_TranslucentBasePass_1972; + float PrePadding_TranslucentBasePass_1976; + float PrePadding_TranslucentBasePass_1980; + float PrePadding_TranslucentBasePass_1984; + float PrePadding_TranslucentBasePass_1988; + float PrePadding_TranslucentBasePass_1992; + float PrePadding_TranslucentBasePass_1996; + float PrePadding_TranslucentBasePass_2000; + float PrePadding_TranslucentBasePass_2004; + float PrePadding_TranslucentBasePass_2008; + float PrePadding_TranslucentBasePass_2012; + float PrePadding_TranslucentBasePass_2016; + float PrePadding_TranslucentBasePass_2020; + float PrePadding_TranslucentBasePass_2024; + float PrePadding_TranslucentBasePass_2028; + float PrePadding_TranslucentBasePass_2032; + float PrePadding_TranslucentBasePass_2036; + float PrePadding_TranslucentBasePass_2040; + float PrePadding_TranslucentBasePass_2044; + float PrePadding_TranslucentBasePass_2048; + float PrePadding_TranslucentBasePass_2052; + float PrePadding_TranslucentBasePass_2056; + float PrePadding_TranslucentBasePass_2060; + float PrePadding_TranslucentBasePass_2064; + float PrePadding_TranslucentBasePass_2068; + float PrePadding_TranslucentBasePass_2072; + float PrePadding_TranslucentBasePass_2076; + float PrePadding_TranslucentBasePass_2080; + float PrePadding_TranslucentBasePass_2084; + float PrePadding_TranslucentBasePass_2088; + float PrePadding_TranslucentBasePass_2092; + float PrePadding_TranslucentBasePass_2096; + float PrePadding_TranslucentBasePass_2100; + float PrePadding_TranslucentBasePass_2104; + float PrePadding_TranslucentBasePass_2108; + float PrePadding_TranslucentBasePass_2112; + float PrePadding_TranslucentBasePass_2116; + float PrePadding_TranslucentBasePass_2120; + float PrePadding_TranslucentBasePass_2124; + float PrePadding_TranslucentBasePass_2128; + float PrePadding_TranslucentBasePass_2132; + float PrePadding_TranslucentBasePass_2136; + float PrePadding_TranslucentBasePass_2140; + float4 TranslucentBasePass_HZBUvFactorAndInvFactor; + float4 TranslucentBasePass_PrevScreenPositionScaleBias; + float TranslucentBasePass_PrevSceneColorPreExposureInv; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[2]; + float4 Material_ScalarExpressions[1]; +}; + +constant float _108 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; + uint gl_SampleMask [[sample_mask]]; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 in_var_TEXCOORD11_centroid [[user(locn1)]]; + uint in_var_PRIMITIVE_ID [[user(locn2)]]; + float4 in_var_TEXCOORD7 [[user(locn3)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], constant type_TranslucentBasePass& TranslucentBasePass [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture3d TranslucentBasePass_Shared_Fog_IntegratedLightScattering [[texture(0)]], sampler View_SharedBilinearClampedSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleMaskIn [[sample_mask]]) +{ + main0_out out = {}; + float4 _137 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0); + float3 _142 = (_137.xyz / float3(_137.w)) - float3(View.View_PreViewTranslation); + bool _165 = TranslucentBasePass.TranslucentBasePass_Shared_Fog_ApplyVolumetricFog > 0.0; + float4 _215; + if (_165) + { + float4 _172 = View.View_WorldToClip * float4(_142, 1.0); + float _173 = _172.w; + float4 _202; + if (_165) + { + _202 = TranslucentBasePass_Shared_Fog_IntegratedLightScattering.sample(View_SharedBilinearClampedSampler, float3(((_172.xy / float2(_173)).xy * float2(0.5, -0.5)) + float2(0.5), (log2((_173 * View.View_VolumetricFogGridZParams[0]) + View.View_VolumetricFogGridZParams[1]) * View.View_VolumetricFogGridZParams[2]) * View.View_VolumetricFogInvGridSize[2]), level(0.0)); + } + else + { + _202 = float4(0.0, 0.0, 0.0, 1.0); + } + _215 = float4(_202.xyz + (in.in_var_TEXCOORD7.xyz * float3(_202.w)), _202.w * in.in_var_TEXCOORD7.w); + } + else + { + _215 = in.in_var_TEXCOORD7; + } + float3 _216 = fast::max(Material.Material_VectorExpressions[1].xyz * float3(((1.0 + dot(float3(-1.0, -1.5, 3.0) / float3(sqrt(12.25)), fast::normalize(float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz) * fast::normalize((float3(0.0, 0.0, 1.0) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz)))) * 0.5) + 0.20000000298023223876953125), float3(0.0)); + float3 _246; + if (View.View_OutOfBoundsMask > 0.0) + { + uint _222 = in.in_var_PRIMITIVE_ID * 26u; + float3 _245; + if (any(abs(_142 - View_PrimitiveSceneData._m0[_222 + 5u].xyz) > (View_PrimitiveSceneData._m0[_222 + 19u].xyz + float3(1.0)))) + { + _245 = mix(float3(1.0, 1.0, 0.0), float3(0.0, 1.0, 1.0), float3(float3(fract(dot(_142, float3(0.57700002193450927734375)) * 0.00200000009499490261077880859375)) > float3(0.5))); + } + else + { + _245 = _216; + } + _246 = _245; + } + else + { + _246 = _216; + } + float4 _255 = float4((_246 * float3(_215.w)) + _215.xyz, _108); + _255.w = 1.0; + float4 _268; + uint _269; + if (View.View_NumSceneColorMSAASamples > 1) + { + _268 = _255 * float4(float(View.View_NumSceneColorMSAASamples) * 0.25); + _269 = gl_SampleMaskIn & 15u; + } + else + { + _268 = _255; + _269 = gl_SampleMaskIn; + } + out.out_var_SV_Target0 = _268; + out.gl_SampleMask = _269; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..d7a1993dc3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _128 = float4(_127.x, _127.y, _127.z, _58.w); + _128.w = 0.0; + out.out_var_SV_Target0 = _128; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..d7a1993dc3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,213 @@ +#include +#include + +using namespace metal; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Globals +{ + float3 SoftTransitionScale; + float4 ShadowBufferSize; + float ShadowFadeFraction; + float ShadowSharpen; + float4 LightPositionAndInvRadius; + float4x4 ScreenToShadowMatrix; + float2 ProjectionDepthBiasParameters; + float4 ModulatedShadowColor; + float4 ShadowTileOffsetAndSize; +}; + +constant float4 _58 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData [[color(0)]], texture2d ShadowDepthTexture [[texture(0)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + float4 _67 = _RESERVED_IDENTIFIER_FIXUP_gl_LastFragData; + float _68 = _67.w; + float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0); + float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0); + float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction))); + float4 _128 = float4(_127.x, _127.y, _127.z, _58.w); + _128.w = 0.0; + out.out_var_SV_Target0 = _128; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag new file mode 100644 index 0000000000..575c9ddb5e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag @@ -0,0 +1,130 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct spvDescriptorSetBuffer0 +{ + const device type_StructuredBuffer_v4float* CulledObjectBoxBounds [[id(0)]]; + constant type_Globals* _Globals [[id(1)]]; + texture2d RWShadowTileNumCulledObjects [[id(2)]]; + device atomic_uint* RWShadowTileNumCulledObjects_atomic [[id(3)]]; +}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], constant spvDescriptorSetBuffer0& spvDescriptorSet0 [[buffer(0)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float(((*spvDescriptorSet0._Globals).ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2((*spvDescriptorSet0._Globals).ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xy > _96.xy) && all((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz < _101)) + { + float3 _121 = float3(0.5) * ((*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103].xyz + (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_107].xyz); + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - _121; + float3 _170 = float3(dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 2u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 3u].xyz), dot(_166, (*spvDescriptorSet0.CulledObjectBoxBounds)._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&spvDescriptorSet0.RWShadowTileNumCulledObjects_atomic[(_78 * (*spvDescriptorSet0._Globals).ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.frag new file mode 100644 index 0000000000..0918dfbfef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.frag @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(0)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _101)) + { + float3 _121 = float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz); + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - _121; + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag new file mode 100644 index 0000000000..0918dfbfef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag @@ -0,0 +1,122 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wunused-variable" + +#include +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +struct type_Globals +{ + uint2 ShadowTileListGroupSize; +}; + +constant float3 _70 = {}; + +struct main0_out +{ + float4 out_var_SV_Target0 [[color(0)]]; +}; + +struct main0_in +{ + uint in_var_TEXCOORD0 [[user(locn0)]]; +}; + +fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d RWShadowTileNumCulledObjects [[texture(0)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]]) +{ + main0_out out = {}; + uint2 _77 = uint2(gl_FragCoord.xy); + uint _78 = _77.y; + uint _83 = _77.x; + float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78)); + float2 _93 = float2(_Globals.ShadowTileListGroupSize); + float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0); + float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0); + float3 _101 = float3(_100.x, _100.y, _70.z); + _101.z = 1.0; + uint _103 = in.in_var_TEXCOORD0 * 5u; + uint _107 = _103 + 1u; + if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _101)) + { + float3 _121 = float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz); + float _122 = _96.x; + float _123 = _96.y; + spvUnsafeArray _73; + _73[0] = float3(_122, _123, -1000.0); + float _126 = _100.x; + _73[1] = float3(_126, _123, -1000.0); + float _129 = _100.y; + _73[2] = float3(_122, _129, -1000.0); + _73[3] = float3(_126, _129, -1000.0); + _73[4] = float3(_122, _123, 1.0); + _73[5] = float3(_126, _123, 1.0); + _73[6] = float3(_122, _129, 1.0); + _73[7] = float3(_126, _129, 1.0); + float3 _155; + float3 _158; + _155 = float3(-500000.0); + _158 = float3(500000.0); + for (int _160 = 0; _160 < 8; ) + { + float3 _166 = _73[_160] - _121; + float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz)); + _155 = fast::max(_155, _170); + _158 = fast::min(_158, _170); + _160++; + continue; + } + if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0))) + { + uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed); + } + } + out.out_var_SV_Target0 = float4(0.0); + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc new file mode 100644 index 0000000000..84540d3592 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -0,0 +1,395 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; + float4 Color; + spvUnsafeArray TexCoords; + float4 LightMapCoordinate; + uint PrimitiveId; + uint LightmapDataIndex; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FSharedBasePassInterpolants +{ +}; +struct FBasePassInterpolantsVSToDS +{ + FSharedBasePassInterpolants _m0; +}; + +struct FBasePassVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + FBasePassInterpolantsVSToDS BasePassInterpolants; + float4 Position; +}; + +struct FPNTessellationHSToDS +{ + FBasePassVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_StructuredBuffer_v4float +{ + float4 _m0[1]; +}; + +constant float4 _142 = {}; + +struct main0_out +{ + float4 out_var_COLOR0; + uint out_var_LIGHTMAP_ID; + float3 out_var_PN_DisplacementScales; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + uint out_var_PRIMITIVE_ID; + spvUnsafeArray out_var_TEXCOORD0; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_TEXCOORD4; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_COLOR0 [[attribute(2)]]; + float4 in_var_TEXCOORD0_0 [[attribute(3)]]; + float4 in_var_TEXCOORD4 [[attribute(4)]]; + uint in_var_PRIMITIVE_ID [[attribute(5)]]; + uint in_var_LIGHTMAP_ID [[attribute(6)]]; + float4 in_var_VS_To_DS_Position [[attribute(7)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _144 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _145 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _146 = spvUnsafeArray({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 }); + spvUnsafeArray, 12> _147 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0 }) }); + spvUnsafeArray _148 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD4, gl_in[1].in_var_TEXCOORD4, gl_in[2].in_var_TEXCOORD4, gl_in[3].in_var_TEXCOORD4, gl_in[4].in_var_TEXCOORD4, gl_in[5].in_var_TEXCOORD4, gl_in[6].in_var_TEXCOORD4, gl_in[7].in_var_TEXCOORD4, gl_in[8].in_var_TEXCOORD4, gl_in[9].in_var_TEXCOORD4, gl_in[10].in_var_TEXCOORD4, gl_in[11].in_var_TEXCOORD4 }); + spvUnsafeArray _149 = spvUnsafeArray({ gl_in[0].in_var_PRIMITIVE_ID, gl_in[1].in_var_PRIMITIVE_ID, gl_in[2].in_var_PRIMITIVE_ID, gl_in[3].in_var_PRIMITIVE_ID, gl_in[4].in_var_PRIMITIVE_ID, gl_in[5].in_var_PRIMITIVE_ID, gl_in[6].in_var_PRIMITIVE_ID, gl_in[7].in_var_PRIMITIVE_ID, gl_in[8].in_var_PRIMITIVE_ID, gl_in[9].in_var_PRIMITIVE_ID, gl_in[10].in_var_PRIMITIVE_ID, gl_in[11].in_var_PRIMITIVE_ID }); + spvUnsafeArray _150 = spvUnsafeArray({ gl_in[0].in_var_LIGHTMAP_ID, gl_in[1].in_var_LIGHTMAP_ID, gl_in[2].in_var_LIGHTMAP_ID, gl_in[3].in_var_LIGHTMAP_ID, gl_in[4].in_var_LIGHTMAP_ID, gl_in[5].in_var_LIGHTMAP_ID, gl_in[6].in_var_LIGHTMAP_ID, gl_in[7].in_var_LIGHTMAP_ID, gl_in[8].in_var_LIGHTMAP_ID, gl_in[9].in_var_LIGHTMAP_ID, gl_in[10].in_var_LIGHTMAP_ID, gl_in[11].in_var_LIGHTMAP_ID }); + spvUnsafeArray _259 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _284 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[0], _145[0], _146[0], _147[0], _148[0], _149[0], _150[0] } }, FBasePassInterpolantsVSToDS{ { } }, _259[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[1], _145[1], _146[1], _147[1], _148[1], _149[1], _150[1] } }, FBasePassInterpolantsVSToDS{ { } }, _259[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[2], _145[2], _146[2], _147[2], _148[2], _149[2], _150[2] } }, FBasePassInterpolantsVSToDS{ { } }, _259[2] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[3], _145[3], _146[3], _147[3], _148[3], _149[3], _150[3] } }, FBasePassInterpolantsVSToDS{ { } }, _259[3] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[4], _145[4], _146[4], _147[4], _148[4], _149[4], _150[4] } }, FBasePassInterpolantsVSToDS{ { } }, _259[4] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[5], _145[5], _146[5], _147[5], _148[5], _149[5], _150[5] } }, FBasePassInterpolantsVSToDS{ { } }, _259[5] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[6], _145[6], _146[6], _147[6], _148[6], _149[6], _150[6] } }, FBasePassInterpolantsVSToDS{ { } }, _259[6] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[7], _145[7], _146[7], _147[7], _148[7], _149[7], _150[7] } }, FBasePassInterpolantsVSToDS{ { } }, _259[7] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[8], _145[8], _146[8], _147[8], _148[8], _149[8], _150[8] } }, FBasePassInterpolantsVSToDS{ { } }, _259[8] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[9], _145[9], _146[9], _147[9], _148[9], _149[9], _150[9] } }, FBasePassInterpolantsVSToDS{ { } }, _259[9] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[10], _145[10], _146[10], _147[10], _148[10], _149[10], _150[10] } }, FBasePassInterpolantsVSToDS{ { } }, _259[10] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[11], _145[11], _146[11], _147[11], _148[11], _149[11], _150[11] } }, FBasePassInterpolantsVSToDS{ { } }, _259[11] } }); + spvUnsafeArray param_var_I = _284; + float4 _301 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _310 = View_PrimitiveSceneData._m0[(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId * 26u) + 22u].xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _313 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _314 = 2u * gl_InvocationID; + uint _315 = 3u + _314; + uint _316 = _314 + 4u; + float4 _328 = float4(param_var_I[_313].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _336 = float4(param_var_I[_315].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _344 = float4(param_var_I[_316].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _392 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_313].Position) - (float4(dot(param_var_I[_313].Position - param_var_I[gl_InvocationID].Position, _301)) * _301)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_315].Position) + param_var_I[_316].Position) - (float4(dot(param_var_I[_316].Position - param_var_I[_315].Position, _336)) * _336)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_313].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_313].Position, _328)) * _328)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_316].Position) + param_var_I[_315].Position) - (float4(dot(param_var_I[_315].Position - param_var_I[_316].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color; + gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords; + gl_out[gl_InvocationID].out_var_TEXCOORD4 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightMapCoordinate; + gl_out[gl_InvocationID].out_var_PRIMITIVE_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId; + gl_out[gl_InvocationID].out_var_LIGHTMAP_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightmapDataIndex; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_PN_POSITION = _392; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _310; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _392, _310, 1.0, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _450 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _463; + _463.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _463.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _463.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _463.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _589; + for (;;) + { + float4 _489 = View.View_ViewToClip * float4(0.0); + float4 _494 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _495 = _494.xyz; + float3 _496 = _489.xyz; + float _498 = _494.w; + float _499 = _489.w; + float4 _516 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _517 = _516.xyz; + float _519 = _516.w; + float4 _537 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _538 = _537.xyz; + float _540 = _537.w; + if (any((((int3((_495 - _496) < float3(_498 + _499)) + (int3(2) * int3((_495 + _496) > float3((-_498) - _499)))) | (int3((_517 - _496) < float3(_519 + _499)) + (int3(2) * int3((_517 + _496) > float3((-_519) - _499))))) | (int3((_538 - _496) < float3(_540 + _499)) + (int3(2) * int3((_538 + _496) > float3((-_540) - _499))))) != int3(3))) + { + _589 = float4(0.0); + break; + } + float3 _558 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _559 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _560 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _563 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _566 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _569 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _573 = sqrt(dot(_559, _559) / dot(_566, _566)); + float _577 = sqrt(dot(_560, _560) / dot(_569, _569)); + float _581 = sqrt(dot(_558, _558) / dot(_563, _563)); + float4 _582 = float4(_573, _577, _581, 1.0); + _582.w = 0.333000004291534423828125 * ((_573 + _577) + _581); + _589 = float4(View.View_AdaptiveTessellationFactor) * _582; + break; + } + float4 _591 = fast::clamp(_463 * _589, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_591.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_591.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_591.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_591.w); + patchOut.out_var_PN_POSITION9 = _450 + ((_450 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc new file mode 100644 index 0000000000..3bfbb69cde --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc @@ -0,0 +1,463 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FHitProxyVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + float4 Position; + uint VertexID; +}; + +struct FHullShaderConstantDominantVertexData +{ + float2 UV; + float4 Normal; + float3 Tangent; +}; + +struct FHullShaderConstantDominantEdgeData +{ + float2 UV0; + float2 UV1; + float4 Normal0; + float4 Normal1; + float3 Tangent0; + float3 Tangent1; +}; + +struct FPNTessellationHSToDS +{ + FHitProxyVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; + FHullShaderConstantDominantVertexData DominantVertex; + FHullShaderConstantDominantEdgeData DominantEdge; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +constant float4 _140 = {}; + +struct main0_out +{ + float3 out_var_PN_DisplacementScales; + float2 out_var_PN_DominantEdge; + float2 out_var_PN_DominantEdge1; + float4 out_var_PN_DominantEdge2; + float4 out_var_PN_DominantEdge3; + float3 out_var_PN_DominantEdge4; + float3 out_var_PN_DominantEdge5; + float2 out_var_PN_DominantVertex; + float4 out_var_PN_DominantVertex1; + float3 out_var_PN_DominantVertex2; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; + uint out_var_VS_To_DS_VertexID; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_VS_To_DS_Position [[attribute(2)]]; + uint in_var_VS_To_DS_VertexID [[attribute(3)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _142 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _143 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _192 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _193 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID }); + spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } }); + spvUnsafeArray param_var_I = _230; + float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _255 = 2u * gl_InvocationID; + uint _256 = 3u + _255; + uint _257 = _255 + 4u; + uint _264 = (_254 < 2u) ? (_254 + 1u) : 0u; + uint _265 = 2u * _254; + uint _266 = 3u + _265; + uint _267 = _265 + 4u; + float4 _279 = float4(param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _315; + float4 _316; + float4 _317; + float4 _318; + if ((param_var_I[_266].VertexID < param_var_I[_254].VertexID) || ((param_var_I[_266].VertexID == param_var_I[_254].VertexID) && (param_var_I[_267].VertexID < param_var_I[_264].VertexID))) + { + _315 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _316 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + _317 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _318 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + } + else + { + _315 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _316 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + _317 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + _318 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + } + float4 _324 = float4(_318.xyz, 0.0); + float4 _328 = float4(_316.xyz, 0.0); + float4 _336 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _344 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _352 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _402 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _336)) * _336)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _352)) * _352)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_VS_To_DS_VertexID = param_var_I[gl_InvocationID].VertexID; + gl_out[gl_InvocationID].out_var_PN_POSITION = _402; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_DominantVertex = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantVertex1 = _279; + gl_out[gl_InvocationID].out_var_PN_DominantVertex2 = param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz; + gl_out[gl_InvocationID].out_var_PN_DominantEdge = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantEdge1 = float2(0.0); + gl_out[gl_InvocationID].out_var_PN_DominantEdge2 = _324; + gl_out[gl_InvocationID].out_var_PN_DominantEdge3 = _328; + gl_out[gl_InvocationID].out_var_PN_DominantEdge4 = _317.xyz; + gl_out[gl_InvocationID].out_var_PN_DominantEdge5 = _315.xyz; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _402, _251, 1.0, 1.0, FHullShaderConstantDominantVertexData{ float2(0.0), _279, param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz }, FHullShaderConstantDominantEdgeData{ float2(0.0), float2(0.0), _324, _328, _317.xyz, _315.xyz } }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _461 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _474; + _474.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _474.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _474.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _474.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _600; + for (;;) + { + float4 _500 = View.View_ViewToClip * float4(0.0); + float4 _505 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _506 = _505.xyz; + float3 _507 = _500.xyz; + float _509 = _505.w; + float _510 = _500.w; + float4 _527 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _528 = _527.xyz; + float _530 = _527.w; + float4 _548 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _549 = _548.xyz; + float _551 = _548.w; + if (any((((int3((_506 - _507) < float3(_509 + _510)) + (int3(2) * int3((_506 + _507) > float3((-_509) - _510)))) | (int3((_528 - _507) < float3(_530 + _510)) + (int3(2) * int3((_528 + _507) > float3((-_530) - _510))))) | (int3((_549 - _507) < float3(_551 + _510)) + (int3(2) * int3((_549 + _507) > float3((-_551) - _510))))) != int3(3))) + { + _600 = float4(0.0); + break; + } + float3 _569 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _570 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _571 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _574 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _577 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _580 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _584 = sqrt(dot(_570, _570) / dot(_577, _577)); + float _588 = sqrt(dot(_571, _571) / dot(_580, _580)); + float _592 = sqrt(dot(_569, _569) / dot(_574, _574)); + float4 _593 = float4(_584, _588, _592, 1.0); + _593.w = 0.333000004291534423828125 * ((_584 + _588) + _592); + _600 = float4(View.View_AdaptiveTessellationFactor) * _593; + break; + } + float4 _602 = fast::clamp(_474 * _600, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_602.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_602.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_602.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_602.w); + patchOut.out_var_PN_POSITION9 = _461 + ((_461 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc new file mode 100644 index 0000000000..23859bc5bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc @@ -0,0 +1,407 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; + float4 Color; + spvUnsafeArray TexCoords; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FHitProxyVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + float4 Position; +}; + +struct FPNTessellationHSToDS +{ + FHitProxyVSToDS PassSpecificData; + spvUnsafeArray WorldPosition; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +constant float4 _127 = {}; + +struct main0_out +{ + float4 out_var_COLOR0; + float3 out_var_PN_DisplacementScales; + spvUnsafeArray out_var_PN_POSITION; + float out_var_PN_TessellationMultiplier; + float out_var_PN_WorldDisplacementMultiplier; + spvUnsafeArray out_var_TEXCOORD0; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_patchOut +{ + float4 out_var_PN_POSITION9; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_COLOR0 [[attribute(2)]]; + float2 in_var_TEXCOORD0_0 [[attribute(3)]]; + float2 in_var_TEXCOORD0_1 [[attribute(4)]]; + float4 in_var_VS_To_DS_Position [[attribute(5)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _129 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _130 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _131 = spvUnsafeArray({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 }); + spvUnsafeArray, 12> _132 = spvUnsafeArray, 12>({ spvUnsafeArray({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) }); + spvUnsafeArray _205 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position }); + spvUnsafeArray _230 = spvUnsafeArray({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } }); + spvUnsafeArray param_var_I = _230; + float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u; + uint _255 = 2u * gl_InvocationID; + uint _256 = 3u + _255; + uint _257 = _255 + 4u; + float4 _269 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _277 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + float4 _285 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0); + spvUnsafeArray _333 = spvUnsafeArray({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _277)) * _277)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _269)) * _269)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _285)) * _285)) * float4(0.3333333432674407958984375))) * float4(0.5) }); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color; + gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_PN_POSITION = _333; + gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251; + gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0; + gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _333, _251, 1.0, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _385 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875); + float4 _398; + _398.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _398.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _398.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _398.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _524; + for (;;) + { + float4 _424 = View.View_ViewToClip * float4(0.0); + float4 _429 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0); + float3 _430 = _429.xyz; + float3 _431 = _424.xyz; + float _433 = _429.w; + float _434 = _424.w; + float4 _451 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0); + float3 _452 = _451.xyz; + float _454 = _451.w; + float4 _472 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0); + float3 _473 = _472.xyz; + float _475 = _472.w; + if (any((((int3((_430 - _431) < float3(_433 + _434)) + (int3(2) * int3((_430 + _431) > float3((-_433) - _434)))) | (int3((_452 - _431) < float3(_454 + _434)) + (int3(2) * int3((_452 + _431) > float3((-_454) - _434))))) | (int3((_473 - _431) < float3(_475 + _434)) + (int3(2) * int3((_473 + _431) > float3((-_475) - _434))))) != int3(3))) + { + _524 = float4(0.0); + break; + } + float3 _493 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz; + float3 _494 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz; + float3 _495 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz; + float3 _498 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _501 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float3 _504 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin); + float _508 = sqrt(dot(_494, _494) / dot(_501, _501)); + float _512 = sqrt(dot(_495, _495) / dot(_504, _504)); + float _516 = sqrt(dot(_493, _493) / dot(_498, _498)); + float4 _517 = float4(_508, _512, _516, 1.0); + _517.w = 0.333000004291534423828125 * ((_508 + _512) + _516); + _524 = float4(View.View_AdaptiveTessellationFactor) * _517; + break; + } + float4 _526 = fast::clamp(_398 * _524, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_526.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_526.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_526.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_526.w); + patchOut.out_var_PN_POSITION9 = _385 + ((_385 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc new file mode 100644 index 0000000000..cab75e39bd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc @@ -0,0 +1,174 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct FVertexFactoryInterpolantsVSToPS +{ + float4 TangentToWorld0; + float4 TangentToWorld2; +}; + +struct FVertexFactoryInterpolantsVSToDS +{ + FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS; +}; + +struct FSharedBasePassInterpolants +{ +}; +struct FBasePassInterpolantsVSToDS +{ + FSharedBasePassInterpolants _m0; +}; + +struct FBasePassVSToDS +{ + FVertexFactoryInterpolantsVSToDS FactoryInterpolants; + FBasePassInterpolantsVSToDS BasePassInterpolants; + float4 Position; +}; + +struct FFlatTessellationHSToDS +{ + FBasePassVSToDS PassSpecificData; + float3 DisplacementScale; + float TessellationMultiplier; + float WorldDisplacementMultiplier; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_DrawsVelocity; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + uint Primitive_LightingChannelMask; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightmapDataIndex; + packed_float3 Primitive_PreSkinnedLocalBounds; + int Primitive_SingleCaptureIndex; + uint Primitive_OutputVelocity; + uint PrePadding_Primitive_420; + uint PrePadding_Primitive_424; + uint PrePadding_Primitive_428; + float4 Primitive_CustomPrimitiveData[4]; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[3]; + float4 Material_ScalarExpressions[1]; +}; + +constant float4 _88 = {}; + +struct main0_out +{ + float3 out_var_Flat_DisplacementScales; + float out_var_Flat_TessellationMultiplier; + float out_var_Flat_WorldDisplacementMultiplier; + float4 out_var_TEXCOORD10_centroid; + float4 out_var_TEXCOORD11_centroid; + float4 out_var_VS_To_DS_Position; +}; + +struct main0_in +{ + float4 in_var_TEXCOORD10_centroid [[attribute(0)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(1)]]; + float4 in_var_VS_To_DS_Position [[attribute(2)]]; +}; + +kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [[buffer(0)]], constant type_Material& Material [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) +{ + threadgroup FFlatTessellationHSToDS temp_var_hullMainRetVal[3]; + device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3]; + if (gl_InvocationID < spvIndirectParams[0]) + gl_in[gl_InvocationID] = in; + threadgroup_barrier(mem_flags::mem_threadgroup); + if (gl_InvocationID >= 3) + return; + spvUnsafeArray _90 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _91 = spvUnsafeArray({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _104 = spvUnsafeArray({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position }); + spvUnsafeArray _111 = spvUnsafeArray({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } }); + spvUnsafeArray param_var_I = _111; + float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz); + gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0; + gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2; + gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position; + gl_out[gl_InvocationID].out_var_Flat_DisplacementScales = _128; + gl_out[gl_InvocationID].out_var_Flat_TessellationMultiplier = Material.Material_ScalarExpressions[0].x; + gl_out[gl_InvocationID].out_var_Flat_WorldDisplacementMultiplier = 1.0; + temp_var_hullMainRetVal[gl_InvocationID] = FFlatTessellationHSToDS{ param_var_I[gl_InvocationID], _128, Material.Material_ScalarExpressions[0].x, 1.0 }; + threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); + if (gl_InvocationID == 0u) + { + float4 _154; + _154.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier); + _154.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier); + _154.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier); + _154.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier); + float4 _173 = fast::clamp(_154, float4(1.0), float4(15.0)); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_173.x); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_173.y); + spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_173.z); + spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_173.w); + } +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese new file mode 100644 index 0000000000..612100604d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese @@ -0,0 +1,419 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_ShadowDepthPass +{ + float PrePadding_ShadowDepthPass_LPV_0; + float PrePadding_ShadowDepthPass_LPV_4; + float PrePadding_ShadowDepthPass_LPV_8; + float PrePadding_ShadowDepthPass_LPV_12; + float PrePadding_ShadowDepthPass_LPV_16; + float PrePadding_ShadowDepthPass_LPV_20; + float PrePadding_ShadowDepthPass_LPV_24; + float PrePadding_ShadowDepthPass_LPV_28; + float PrePadding_ShadowDepthPass_LPV_32; + float PrePadding_ShadowDepthPass_LPV_36; + float PrePadding_ShadowDepthPass_LPV_40; + float PrePadding_ShadowDepthPass_LPV_44; + float PrePadding_ShadowDepthPass_LPV_48; + float PrePadding_ShadowDepthPass_LPV_52; + float PrePadding_ShadowDepthPass_LPV_56; + float PrePadding_ShadowDepthPass_LPV_60; + float PrePadding_ShadowDepthPass_LPV_64; + float PrePadding_ShadowDepthPass_LPV_68; + float PrePadding_ShadowDepthPass_LPV_72; + float PrePadding_ShadowDepthPass_LPV_76; + float PrePadding_ShadowDepthPass_LPV_80; + float PrePadding_ShadowDepthPass_LPV_84; + float PrePadding_ShadowDepthPass_LPV_88; + float PrePadding_ShadowDepthPass_LPV_92; + float PrePadding_ShadowDepthPass_LPV_96; + float PrePadding_ShadowDepthPass_LPV_100; + float PrePadding_ShadowDepthPass_LPV_104; + float PrePadding_ShadowDepthPass_LPV_108; + float PrePadding_ShadowDepthPass_LPV_112; + float PrePadding_ShadowDepthPass_LPV_116; + float PrePadding_ShadowDepthPass_LPV_120; + float PrePadding_ShadowDepthPass_LPV_124; + float PrePadding_ShadowDepthPass_LPV_128; + float PrePadding_ShadowDepthPass_LPV_132; + float PrePadding_ShadowDepthPass_LPV_136; + float PrePadding_ShadowDepthPass_LPV_140; + float PrePadding_ShadowDepthPass_LPV_144; + float PrePadding_ShadowDepthPass_LPV_148; + float PrePadding_ShadowDepthPass_LPV_152; + float PrePadding_ShadowDepthPass_LPV_156; + float PrePadding_ShadowDepthPass_LPV_160; + float PrePadding_ShadowDepthPass_LPV_164; + float PrePadding_ShadowDepthPass_LPV_168; + float PrePadding_ShadowDepthPass_LPV_172; + float PrePadding_ShadowDepthPass_LPV_176; + float PrePadding_ShadowDepthPass_LPV_180; + float PrePadding_ShadowDepthPass_LPV_184; + float PrePadding_ShadowDepthPass_LPV_188; + float PrePadding_ShadowDepthPass_LPV_192; + float PrePadding_ShadowDepthPass_LPV_196; + float PrePadding_ShadowDepthPass_LPV_200; + float PrePadding_ShadowDepthPass_LPV_204; + float PrePadding_ShadowDepthPass_LPV_208; + float PrePadding_ShadowDepthPass_LPV_212; + float PrePadding_ShadowDepthPass_LPV_216; + float PrePadding_ShadowDepthPass_LPV_220; + float PrePadding_ShadowDepthPass_LPV_224; + float PrePadding_ShadowDepthPass_LPV_228; + float PrePadding_ShadowDepthPass_LPV_232; + float PrePadding_ShadowDepthPass_LPV_236; + float PrePadding_ShadowDepthPass_LPV_240; + float PrePadding_ShadowDepthPass_LPV_244; + float PrePadding_ShadowDepthPass_LPV_248; + float PrePadding_ShadowDepthPass_LPV_252; + float PrePadding_ShadowDepthPass_LPV_256; + float PrePadding_ShadowDepthPass_LPV_260; + float PrePadding_ShadowDepthPass_LPV_264; + float PrePadding_ShadowDepthPass_LPV_268; + float4x4 ShadowDepthPass_LPV_mRsmToWorld; + float4 ShadowDepthPass_LPV_mLightColour; + float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection; + float4 ShadowDepthPass_LPV_mEyePos; + packed_int3 ShadowDepthPass_LPV_mOldGridOffset; + int PrePadding_ShadowDepthPass_LPV_396; + packed_int3 ShadowDepthPass_LPV_mLpvGridOffset; + float ShadowDepthPass_LPV_ClearMultiplier; + float ShadowDepthPass_LPV_LpvScale; + float ShadowDepthPass_LPV_OneOverLpvScale; + float ShadowDepthPass_LPV_DirectionalOcclusionIntensity; + float ShadowDepthPass_LPV_DirectionalOcclusionRadius; + float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier; + float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier; + float ShadowDepthPass_LPV_SecondaryOcclusionStrength; + float ShadowDepthPass_LPV_SecondaryBounceStrength; + float ShadowDepthPass_LPV_VplInjectionBias; + float ShadowDepthPass_LPV_GeometryVolumeInjectionBias; + float ShadowDepthPass_LPV_EmissiveInjectionMultiplier; + int ShadowDepthPass_LPV_PropagationIndex; + float4x4 ShadowDepthPass_ProjectionMatrix; + float4x4 ShadowDepthPass_ViewMatrix; + float4 ShadowDepthPass_ShadowParams; + float ShadowDepthPass_bClampToNearPlane; + float PrePadding_ShadowDepthPass_612; + float PrePadding_ShadowDepthPass_616; + float PrePadding_ShadowDepthPass_620; + float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6]; + float4x4 ShadowDepthPass_ShadowViewMatrices[6]; +}; + +constant float4 _113 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; + float4 out_var_COLOR0 [[user(locn2)]]; + float4 out_var_TEXCOORD0_0 [[user(locn3)]]; + uint out_var_PRIMITIVE_ID [[user(locn4)]]; + float out_var_TEXCOORD6 [[user(locn5)]]; + float out_var_TEXCOORD8 [[user(locn6)]]; + float3 out_var_TEXCOORD7 [[user(locn7)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_COLOR0 [[attribute(0)]]; + float4 in_var_PN_POSITION_0 [[attribute(2)]]; + float4 in_var_PN_POSITION_1 [[attribute(3)]]; + float4 in_var_PN_POSITION_2 [[attribute(4)]]; + float in_var_PN_WorldDisplacementMultiplier [[attribute(7)]]; + uint in_var_PRIMITIVE_ID [[attribute(8)]]; + float4 in_var_TEXCOORD0_0 [[attribute(9)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(10)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(11)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(5)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(1)]], texture2d Material_Texture2D_3 [[texture(0)]], sampler Material_Texture2D_3Sampler [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray out_var_TEXCOORD0 = {}; + spvUnsafeArray _117 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _118 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray _119 = spvUnsafeArray({ patchIn.gl_in[0].in_var_COLOR0, patchIn.gl_in[1].in_var_COLOR0, patchIn.gl_in[2].in_var_COLOR0 }); + spvUnsafeArray, 3> _120 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) }); + spvUnsafeArray, 3> _135 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + spvUnsafeArray _136 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier }); + float _157 = gl_TessCoord.x * gl_TessCoord.x; + float _158 = gl_TessCoord.y * gl_TessCoord.y; + float _159 = gl_TessCoord.z * gl_TessCoord.z; + float4 _165 = float4(gl_TessCoord.x); + float4 _169 = float4(gl_TessCoord.y); + float4 _174 = float4(gl_TessCoord.z); + float4 _177 = float4(_157 * 3.0); + float4 _181 = float4(_158 * 3.0); + float4 _188 = float4(_159 * 3.0); + float4 _202 = ((((((((((_135[0][0] * float4(_157)) * _165) + ((_135[1][0] * float4(_158)) * _169)) + ((_135[2][0] * float4(_159)) * _174)) + ((_135[0][1] * _177) * _169)) + ((_135[0][2] * _181) * _165)) + ((_135[1][1] * _181) * _174)) + ((_135[1][2] * _188) * _169)) + ((_135[2][1] * _188) * _165)) + ((_135[2][2] * _177) * _174)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _174) * _165) * _169); + float3 _226 = ((_117[0].xyz * float3(gl_TessCoord.x)) + (_117[1].xyz * float3(gl_TessCoord.y))).xyz + (_117[2].xyz * float3(gl_TessCoord.z)); + float4 _229 = ((_118[0] * _165) + (_118[1] * _169)) + (_118[2] * _174); + float4 _231 = ((_119[0] * _165) + (_119[1] * _169)) + (_119[2] * _174); + float4 _233 = ((_120[0][0] * _165) + (_120[1][0] * _169)) + (_120[2][0] * _174); + spvUnsafeArray _234 = spvUnsafeArray({ _233 }); + float3 _236 = _229.xyz; + float3 _264 = _202.xyz + (((float3((Material_Texture2D_3.sample(Material_Texture2D_3Sampler, (float2(View.View_GameTime * 0.20000000298023223876953125, View.View_GameTime * (-0.699999988079071044921875)) + (_233.zw * float2(1.0, 2.0))), level(-1.0)).x * 10.0) * (1.0 - _231.x)) * _236) * float3(0.5)) * float3(((_136[0] * gl_TessCoord.x) + (_136[1] * gl_TessCoord.y)) + (_136[2] * gl_TessCoord.z))); + float4x4 _116 = ShadowDepthPass.ShadowDepthPass_ViewMatrix; + float4 _270 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_264.x, _264.y, _264.z, _202.w); + float4 _281; + if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_270.z < 0.0)) + { + float4 _279 = _270; + _279.z = 9.9999999747524270787835121154785e-07; + _279.w = 1.0; + _281 = _279; + } + else + { + _281 = _270; + } + float _290 = abs(dot(float3(_116[0u].z, _116[1u].z, _116[2u].z), _236)); + out.out_var_TEXCOORD10_centroid = float4(_226.x, _226.y, _226.z, _113.w); + out.out_var_TEXCOORD11_centroid = _229; + out.out_var_COLOR0 = _231; + out_var_TEXCOORD0 = _234; + out.out_var_PRIMITIVE_ID = patchIn.gl_in[0u].in_var_PRIMITIVE_ID; + out.out_var_TEXCOORD6 = _281.z; + out.out_var_TEXCOORD8 = (ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_290) > 0.0) ? (sqrt(fast::clamp(1.0 - (_290 * _290), 0.0, 1.0)) / _290) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x; + out.out_var_TEXCOORD7 = _264.xyz; + out.gl_Position = _281; + out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese new file mode 100644 index 0000000000..f1b74aacbb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese @@ -0,0 +1,416 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_ClipToWorld; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_908; + packed_float3 View_ViewUp; + float PrePadding_View_924; + packed_float3 View_ViewRight; + float PrePadding_View_940; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_956; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_972; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_1020; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_1036; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_1052; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1068; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1724; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1740; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1756; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2076; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2148; + float PrePadding_View_2152; + float PrePadding_View_2156; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2228; + float PrePadding_View_2232; + float PrePadding_View_2236; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2268; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2412; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + float View_AtmosphericFogSunDiscHalfApexAngleRadian; + float PrePadding_View_2492; + float4 View_AtmosphericFogSunDiscLuminance; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + uint PrePadding_View_2520; + uint PrePadding_View_2524; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2584; + float PrePadding_View_2588; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2744; + float PrePadding_View_2748; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float PrePadding_View_2908; + int2 View_CursorPosition; + float View_bCheckerboardSubsurfaceProfileRendering; + float PrePadding_View_2924; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2940; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2956; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2972; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2988; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_3004; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; + float PrePadding_View_3048; + float PrePadding_View_3052; + float4x4 View_WorldToVirtualTexture; + float4 View_VirtualTextureParams; + float4 View_XRPassthroughCameraUVs[2]; +}; + +struct type_Material +{ + float4 Material_VectorExpressions[5]; + float4 Material_ScalarExpressions[2]; +}; + +constant float4 _118 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD6 [[user(locn0)]]; + float4 out_var_TEXCOORD7 [[user(locn1)]]; + float4 out_var_TEXCOORD10_centroid [[user(locn2)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn3)]]; + float4 gl_Position [[position]]; + float gl_ClipDistance [[clip_distance]] [1]; + float gl_ClipDistance_0 [[user(clip0)]]; +}; + +struct main0_in +{ + float4 in_var_PN_DominantEdge2 [[attribute(3)]]; + float4 in_var_PN_DominantEdge3 [[attribute(4)]]; + float3 in_var_PN_DominantEdge4 [[attribute(5)]]; + float3 in_var_PN_DominantEdge5 [[attribute(6)]]; + float4 in_var_PN_DominantVertex1 [[attribute(8)]]; + float3 in_var_PN_DominantVertex2 [[attribute(9)]]; + float4 in_var_PN_POSITION_0 [[attribute(10)]]; + float4 in_var_PN_POSITION_1 [[attribute(11)]]; + float4 in_var_PN_POSITION_2 [[attribute(12)]]; + float in_var_PN_WorldDisplacementMultiplier [[attribute(15)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(16)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(17)]]; + float4 in_var_TEXCOORD6 [[attribute(18)]]; + float4 in_var_TEXCOORD8 [[attribute(19)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(13)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Material& Material [[buffer(1)]], texture3d View_GlobalDistanceFieldTexture0 [[texture(0)]], texture3d View_GlobalDistanceFieldTexture1 [[texture(1)]], texture3d View_GlobalDistanceFieldTexture2 [[texture(2)]], texture3d View_GlobalDistanceFieldTexture3 [[texture(3)]], sampler View_GlobalDistanceFieldSampler0 [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray _120 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD6, patchIn.gl_in[1].in_var_TEXCOORD6, patchIn.gl_in[2].in_var_TEXCOORD6 }); + spvUnsafeArray _121 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD8, patchIn.gl_in[1].in_var_TEXCOORD8, patchIn.gl_in[2].in_var_TEXCOORD8 }); + spvUnsafeArray _128 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _129 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray, 3> _136 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + spvUnsafeArray _137 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier }); + spvUnsafeArray _138 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantVertex1, patchIn.gl_in[1].in_var_PN_DominantVertex1, patchIn.gl_in[2].in_var_PN_DominantVertex1 }); + spvUnsafeArray _139 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantVertex2, patchIn.gl_in[1].in_var_PN_DominantVertex2, patchIn.gl_in[2].in_var_PN_DominantVertex2 }); + spvUnsafeArray _146 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge2, patchIn.gl_in[1].in_var_PN_DominantEdge2, patchIn.gl_in[2].in_var_PN_DominantEdge2 }); + spvUnsafeArray _147 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge3, patchIn.gl_in[1].in_var_PN_DominantEdge3, patchIn.gl_in[2].in_var_PN_DominantEdge3 }); + spvUnsafeArray _148 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge4, patchIn.gl_in[1].in_var_PN_DominantEdge4, patchIn.gl_in[2].in_var_PN_DominantEdge4 }); + spvUnsafeArray _149 = spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_DominantEdge5, patchIn.gl_in[1].in_var_PN_DominantEdge5, patchIn.gl_in[2].in_var_PN_DominantEdge5 }); + float _190 = gl_TessCoord.x * gl_TessCoord.x; + float _191 = gl_TessCoord.y * gl_TessCoord.y; + float _192 = gl_TessCoord.z * gl_TessCoord.z; + float4 _198 = float4(gl_TessCoord.x); + float4 _202 = float4(gl_TessCoord.y); + float4 _207 = float4(gl_TessCoord.z); + float4 _210 = float4(_190 * 3.0); + float4 _214 = float4(_191 * 3.0); + float4 _221 = float4(_192 * 3.0); + float4 _235 = ((((((((((_136[0][0] * float4(_190)) * _198) + ((_136[1][0] * float4(_191)) * _202)) + ((_136[2][0] * float4(_192)) * _207)) + ((_136[0][1] * _210) * _202)) + ((_136[0][2] * _214) * _198)) + ((_136[1][1] * _214) * _207)) + ((_136[1][2] * _221) * _202)) + ((_136[2][1] * _221) * _198)) + ((_136[2][2] * _210) * _207)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _207) * _198) * _202); + float3 _237 = float3(gl_TessCoord.x); + float3 _240 = float3(gl_TessCoord.y); + float3 _254 = float3(gl_TessCoord.z); + float3 _256 = ((_128[0].xyz * _237) + (_128[1].xyz * _240)).xyz + (_128[2].xyz * _254); + float4 _259 = ((_129[0] * _198) + (_129[1] * _202)) + (_129[2] * _207); + float3 _264 = _235.xyz; + float3 _265 = _256.xyz; + float3 _266 = _259.xyz; + float3 _272 = _264 + float3(View.View_WorldCameraOrigin); + float _279 = float(int(gl_TessCoord.x == 0.0)); + float _282 = float(int(gl_TessCoord.y == 0.0)); + float _285 = float(int(gl_TessCoord.z == 0.0)); + float _286 = _279 + _282; + float _287 = _286 + _285; + float4 _387; + float3 _388; + if (float(int(_287 == 2.0)) == 1.0) + { + float _363 = float(int((_282 + _285) == 2.0)); + float _367 = float(int((_285 + _279) == 2.0)); + float _370 = float(int(_286 == 2.0)); + _387 = ((float4(_363) * _138[0]) + (float4(_367) * _138[1])) + (float4(_370) * _138[2]); + _388 = ((float3(_363) * _139[0]) + (float3(_367) * _139[1])) + (float3(_370) * _139[2]); + } + else + { + float4 _358; + float3 _359; + if (float(int(_287 == 1.0)) != 0.0) + { + float4 _304 = float4(_279); + float4 _306 = float4(_282); + float4 _309 = float4(_285); + float4 _311 = ((_304 * _146[0]) + (_306 * _146[1])) + (_309 * _146[2]); + float4 _316 = ((_304 * _147[0]) + (_306 * _147[1])) + (_309 * _147[2]); + float3 _331 = float3(_279); + float3 _333 = float3(_282); + float3 _336 = float3(_285); + float3 _338 = ((_331 * _148[0]) + (_333 * _148[1])) + (_336 * _148[2]); + float3 _343 = ((_331 * _149[0]) + (_333 * _149[1])) + (_336 * _149[2]); + _358 = ((_304 * ((_202 * _311) + (_207 * _316))) + (_306 * ((_207 * _311) + (_198 * _316)))) + (_309 * ((_198 * _311) + (_202 * _316))); + _359 = ((_331 * ((_240 * _338) + (_254 * _343))) + (_333 * ((_254 * _338) + (_237 * _343)))) + (_336 * ((_237 * _338) + (_240 * _343))); + } + else + { + _358 = float4(_259.xyz, 0.0); + _359 = _265; + } + _387 = _358; + _388 = _359; + } + float3x3 _398; + if (float(int(_287 == 0.0)) == 0.0) + { + _398 = float3x3(_388, cross(_387.xyz, _388) * float3(_387.w), _387.xyz); + } + else + { + _398 = float3x3(_265, cross(_266, _265) * float3(_259.w), _266); + } + float3 _411 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[0].xyz) + View.View_GlobalVolumeCenterAndExtent[0].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[0].xyz + View.View_GlobalVolumeCenterAndExtent[0].www) - _272, float3(0.0))); + float _547; + if (fast::min(_411.x, fast::min(_411.y, _411.z)) > (View.View_GlobalVolumeCenterAndExtent[0].w * View.View_GlobalVolumeTexelSize)) + { + _547 = View_GlobalDistanceFieldTexture0.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[0u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[0u].xyz), level(0.0)).x; + } + else + { + float3 _436 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[1].xyz) + View.View_GlobalVolumeCenterAndExtent[1].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[1].xyz + View.View_GlobalVolumeCenterAndExtent[1].www) - _272, float3(0.0))); + float _535; + if (fast::min(_436.x, fast::min(_436.y, _436.z)) > (View.View_GlobalVolumeCenterAndExtent[1].w * View.View_GlobalVolumeTexelSize)) + { + _535 = View_GlobalDistanceFieldTexture1.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[1u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[1u].xyz), level(0.0)).x; + } + else + { + float3 _459 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[2].xyz) + View.View_GlobalVolumeCenterAndExtent[2].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[2].xyz + View.View_GlobalVolumeCenterAndExtent[2].www) - _272, float3(0.0))); + float3 _475 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[3].xyz) + View.View_GlobalVolumeCenterAndExtent[3].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[3].xyz + View.View_GlobalVolumeCenterAndExtent[3].www) - _272, float3(0.0))); + float _480 = fast::min(_475.x, fast::min(_475.y, _475.z)); + float _523; + if (fast::min(_459.x, fast::min(_459.y, _459.z)) > (View.View_GlobalVolumeCenterAndExtent[2].w * View.View_GlobalVolumeTexelSize)) + { + _523 = View_GlobalDistanceFieldTexture2.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[2u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[2u].xyz), level(0.0)).x; + } + else + { + float _511; + if (_480 > (View.View_GlobalVolumeCenterAndExtent[3].w * View.View_GlobalVolumeTexelSize)) + { + _511 = mix(View.View_MaxGlobalDistance, View_GlobalDistanceFieldTexture3.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[3u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[3u].xyz), level(0.0)).x, fast::clamp((_480 * 10.0) * View.View_GlobalVolumeWorldToUVAddAndMul[3].w, 0.0, 1.0)); + } + else + { + _511 = View.View_MaxGlobalDistance; + } + _523 = _511; + } + _535 = _523; + } + _547 = _535; + } + float3 _565 = _264 + ((_398[2] * float3(fast::min(_547 + Material.Material_ScalarExpressions[0].z, 0.0) * Material.Material_ScalarExpressions[0].w)) * float3(((_137[0] * gl_TessCoord.x) + (_137[1] * gl_TessCoord.y)) + (_137[2] * gl_TessCoord.z))); + float4 _574 = View.View_TranslatedWorldToClip * float4(_565.x, _565.y, _565.z, _235.w); + _574.z = _574.z + (0.001000000047497451305389404296875 * _574.w); + out.gl_Position = _574; + out.out_var_TEXCOORD6 = ((_120[0] * _198) + (_120[1] * _202)) + (_120[2] * _207); + out.out_var_TEXCOORD7 = ((_121[0] * _198) + (_121[1] * _202)) + (_121[2] * _207); + out.out_var_TEXCOORD10_centroid = float4(_256.x, _256.y, _256.z, _118.w); + out.out_var_TEXCOORD11_centroid = _259; + out.gl_ClipDistance[0u] = dot(View.View_GlobalClippingPlane, float4(_565.xyz - float3(View.View_PreViewTranslation), 1.0)); + out.gl_ClipDistance_0 = out.gl_ClipDistance[0]; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese new file mode 100644 index 0000000000..26b2e4b0ff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese @@ -0,0 +1,216 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_ShadowDepthPass +{ + float PrePadding_ShadowDepthPass_LPV_0; + float PrePadding_ShadowDepthPass_LPV_4; + float PrePadding_ShadowDepthPass_LPV_8; + float PrePadding_ShadowDepthPass_LPV_12; + float PrePadding_ShadowDepthPass_LPV_16; + float PrePadding_ShadowDepthPass_LPV_20; + float PrePadding_ShadowDepthPass_LPV_24; + float PrePadding_ShadowDepthPass_LPV_28; + float PrePadding_ShadowDepthPass_LPV_32; + float PrePadding_ShadowDepthPass_LPV_36; + float PrePadding_ShadowDepthPass_LPV_40; + float PrePadding_ShadowDepthPass_LPV_44; + float PrePadding_ShadowDepthPass_LPV_48; + float PrePadding_ShadowDepthPass_LPV_52; + float PrePadding_ShadowDepthPass_LPV_56; + float PrePadding_ShadowDepthPass_LPV_60; + float PrePadding_ShadowDepthPass_LPV_64; + float PrePadding_ShadowDepthPass_LPV_68; + float PrePadding_ShadowDepthPass_LPV_72; + float PrePadding_ShadowDepthPass_LPV_76; + float PrePadding_ShadowDepthPass_LPV_80; + float PrePadding_ShadowDepthPass_LPV_84; + float PrePadding_ShadowDepthPass_LPV_88; + float PrePadding_ShadowDepthPass_LPV_92; + float PrePadding_ShadowDepthPass_LPV_96; + float PrePadding_ShadowDepthPass_LPV_100; + float PrePadding_ShadowDepthPass_LPV_104; + float PrePadding_ShadowDepthPass_LPV_108; + float PrePadding_ShadowDepthPass_LPV_112; + float PrePadding_ShadowDepthPass_LPV_116; + float PrePadding_ShadowDepthPass_LPV_120; + float PrePadding_ShadowDepthPass_LPV_124; + float PrePadding_ShadowDepthPass_LPV_128; + float PrePadding_ShadowDepthPass_LPV_132; + float PrePadding_ShadowDepthPass_LPV_136; + float PrePadding_ShadowDepthPass_LPV_140; + float PrePadding_ShadowDepthPass_LPV_144; + float PrePadding_ShadowDepthPass_LPV_148; + float PrePadding_ShadowDepthPass_LPV_152; + float PrePadding_ShadowDepthPass_LPV_156; + float PrePadding_ShadowDepthPass_LPV_160; + float PrePadding_ShadowDepthPass_LPV_164; + float PrePadding_ShadowDepthPass_LPV_168; + float PrePadding_ShadowDepthPass_LPV_172; + float PrePadding_ShadowDepthPass_LPV_176; + float PrePadding_ShadowDepthPass_LPV_180; + float PrePadding_ShadowDepthPass_LPV_184; + float PrePadding_ShadowDepthPass_LPV_188; + float PrePadding_ShadowDepthPass_LPV_192; + float PrePadding_ShadowDepthPass_LPV_196; + float PrePadding_ShadowDepthPass_LPV_200; + float PrePadding_ShadowDepthPass_LPV_204; + float PrePadding_ShadowDepthPass_LPV_208; + float PrePadding_ShadowDepthPass_LPV_212; + float PrePadding_ShadowDepthPass_LPV_216; + float PrePadding_ShadowDepthPass_LPV_220; + float PrePadding_ShadowDepthPass_LPV_224; + float PrePadding_ShadowDepthPass_LPV_228; + float PrePadding_ShadowDepthPass_LPV_232; + float PrePadding_ShadowDepthPass_LPV_236; + float PrePadding_ShadowDepthPass_LPV_240; + float PrePadding_ShadowDepthPass_LPV_244; + float PrePadding_ShadowDepthPass_LPV_248; + float PrePadding_ShadowDepthPass_LPV_252; + float PrePadding_ShadowDepthPass_LPV_256; + float PrePadding_ShadowDepthPass_LPV_260; + float PrePadding_ShadowDepthPass_LPV_264; + float PrePadding_ShadowDepthPass_LPV_268; + float4x4 ShadowDepthPass_LPV_mRsmToWorld; + float4 ShadowDepthPass_LPV_mLightColour; + float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection; + float4 ShadowDepthPass_LPV_mEyePos; + packed_int3 ShadowDepthPass_LPV_mOldGridOffset; + int PrePadding_ShadowDepthPass_LPV_396; + packed_int3 ShadowDepthPass_LPV_mLpvGridOffset; + float ShadowDepthPass_LPV_ClearMultiplier; + float ShadowDepthPass_LPV_LpvScale; + float ShadowDepthPass_LPV_OneOverLpvScale; + float ShadowDepthPass_LPV_DirectionalOcclusionIntensity; + float ShadowDepthPass_LPV_DirectionalOcclusionRadius; + float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier; + float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier; + float ShadowDepthPass_LPV_SecondaryOcclusionStrength; + float ShadowDepthPass_LPV_SecondaryBounceStrength; + float ShadowDepthPass_LPV_VplInjectionBias; + float ShadowDepthPass_LPV_GeometryVolumeInjectionBias; + float ShadowDepthPass_LPV_EmissiveInjectionMultiplier; + int ShadowDepthPass_LPV_PropagationIndex; + float4x4 ShadowDepthPass_ProjectionMatrix; + float4x4 ShadowDepthPass_ViewMatrix; + float4 ShadowDepthPass_ShadowParams; + float ShadowDepthPass_bClampToNearPlane; + float PrePadding_ShadowDepthPass_612; + float PrePadding_ShadowDepthPass_616; + float PrePadding_ShadowDepthPass_620; + float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6]; + float4x4 ShadowDepthPass_ShadowViewMatrices[6]; +}; + +constant float4 _90 = {}; + +struct main0_out +{ + float4 out_var_TEXCOORD10_centroid [[user(locn0)]]; + float4 out_var_TEXCOORD11_centroid [[user(locn1)]]; + float out_var_TEXCOORD6 [[user(locn2)]]; + float3 out_var_TEXCOORD7 [[user(locn3)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_PN_POSITION_0 [[attribute(10)]]; + float4 in_var_PN_POSITION_1 [[attribute(11)]]; + float4 in_var_PN_POSITION_2 [[attribute(12)]]; + float4 in_var_TEXCOORD10_centroid [[attribute(16)]]; + float4 in_var_TEXCOORD11_centroid [[attribute(17)]]; +}; + +struct main0_patchIn +{ + float4 in_var_PN_POSITION9 [[attribute(13)]]; + patch_control_point gl_in; +}; + +[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]]) +{ + main0_out out = {}; + spvUnsafeArray _93 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid }); + spvUnsafeArray _94 = spvUnsafeArray({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid }); + spvUnsafeArray, 3> _101 = spvUnsafeArray, 3>({ spvUnsafeArray({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) }); + float _119 = gl_TessCoord.x * gl_TessCoord.x; + float _120 = gl_TessCoord.y * gl_TessCoord.y; + float _121 = gl_TessCoord.z * gl_TessCoord.z; + float4 _127 = float4(gl_TessCoord.x); + float4 _131 = float4(gl_TessCoord.y); + float4 _136 = float4(gl_TessCoord.z); + float4 _139 = float4(_119 * 3.0); + float4 _143 = float4(_120 * 3.0); + float4 _150 = float4(_121 * 3.0); + float4 _164 = ((((((((((_101[0][0] * float4(_119)) * _127) + ((_101[1][0] * float4(_120)) * _131)) + ((_101[2][0] * float4(_121)) * _136)) + ((_101[0][1] * _139) * _131)) + ((_101[0][2] * _143) * _127)) + ((_101[1][1] * _143) * _136)) + ((_101[1][2] * _150) * _131)) + ((_101[2][1] * _150) * _127)) + ((_101[2][2] * _139) * _136)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _136) * _127) * _131); + float3 _179 = ((_93[0].xyz * float3(gl_TessCoord.x)) + (_93[1].xyz * float3(gl_TessCoord.y))).xyz + (_93[2].xyz * float3(gl_TessCoord.z)); + float4 _182 = ((_94[0] * _127) + (_94[1] * _131)) + (_94[2] * _136); + float4x4 _92 = ShadowDepthPass.ShadowDepthPass_ViewMatrix; + float4 _189 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_164.x, _164.y, _164.z, _164.w); + float4 _200; + if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_189.z < 0.0)) + { + float4 _198 = _189; + _198.z = 9.9999999747524270787835121154785e-07; + _198.w = 1.0; + _200 = _198; + } + else + { + _200 = _189; + } + float _209 = abs(dot(float3(_92[0u].z, _92[1u].z, _92[2u].z), _182.xyz)); + float4 _234 = _200; + _234.z = ((_200.z * ShadowDepthPass.ShadowDepthPass_ShadowParams.w) + ((ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_209) > 0.0) ? (sqrt(fast::clamp(1.0 - (_209 * _209), 0.0, 1.0)) / _209) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x)) * _200.w; + out.out_var_TEXCOORD10_centroid = float4(_179.x, _179.y, _179.z, _90.w); + out.out_var_TEXCOORD11_centroid = _182; + out.out_var_TEXCOORD6 = 0.0; + out.out_var_TEXCOORD7 = _164.xyz; + out.gl_Position = _234; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/vert/array-missing-copies.asm.vert b/third_party/spirv-cross/reference/shaders-ue4/asm/vert/array-missing-copies.asm.vert new file mode 100644 index 0000000000..67097c5771 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/vert/array-missing-copies.asm.vert @@ -0,0 +1,467 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wmissing-braces" + +#include +#include + +using namespace metal; + +template +struct spvUnsafeArray +{ + T elements[Num ? Num : 1]; + + thread T& operator [] (size_t pos) thread + { + return elements[pos]; + } + constexpr const thread T& operator [] (size_t pos) const thread + { + return elements[pos]; + } + + device T& operator [] (size_t pos) device + { + return elements[pos]; + } + constexpr const device T& operator [] (size_t pos) const device + { + return elements[pos]; + } + + constexpr const constant T& operator [] (size_t pos) const constant + { + return elements[pos]; + } + + threadgroup T& operator [] (size_t pos) threadgroup + { + return elements[pos]; + } + constexpr const threadgroup T& operator [] (size_t pos) const threadgroup + { + return elements[pos]; + } +}; + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_MobileBasePass +{ + float4 MobileBasePass_Fog_ExponentialFogParameters; + float4 MobileBasePass_Fog_ExponentialFogParameters2; + float4 MobileBasePass_Fog_ExponentialFogColorParameter; + float4 MobileBasePass_Fog_ExponentialFogParameters3; + float4 MobileBasePass_Fog_InscatteringLightDirection; + float4 MobileBasePass_Fog_DirectionalInscatteringColor; + float2 MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation; + float PrePadding_MobileBasePass_Fog_104; + float PrePadding_MobileBasePass_Fog_108; + packed_float3 MobileBasePass_Fog_FogInscatteringTextureParameters; + float MobileBasePass_Fog_ApplyVolumetricFog; + float PrePadding_MobileBasePass_PlanarReflection_128; + float PrePadding_MobileBasePass_PlanarReflection_132; + float PrePadding_MobileBasePass_PlanarReflection_136; + float PrePadding_MobileBasePass_PlanarReflection_140; + float PrePadding_MobileBasePass_PlanarReflection_144; + float PrePadding_MobileBasePass_PlanarReflection_148; + float PrePadding_MobileBasePass_PlanarReflection_152; + float PrePadding_MobileBasePass_PlanarReflection_156; + float4 MobileBasePass_PlanarReflection_ReflectionPlane; + float4 MobileBasePass_PlanarReflection_PlanarReflectionOrigin; + float4 MobileBasePass_PlanarReflection_PlanarReflectionXAxis; + float4 MobileBasePass_PlanarReflection_PlanarReflectionYAxis; + float3x4 MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix; + packed_float3 MobileBasePass_PlanarReflection_PlanarReflectionParameters; + float PrePadding_MobileBasePass_PlanarReflection_284; + float2 MobileBasePass_PlanarReflection_PlanarReflectionParameters2; + float PrePadding_MobileBasePass_PlanarReflection_296; + float PrePadding_MobileBasePass_PlanarReflection_300; + float4x4 MobileBasePass_PlanarReflection_ProjectionWithExtraFOV[2]; + float4 MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2]; + float2 MobileBasePass_PlanarReflection_PlanarReflectionScreenBound; + uint MobileBasePass_PlanarReflection_bIsStereo; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_UseEditorDepthTest; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + float PrePadding_Primitive_380; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightingChannelMask; + uint Primitive_LightmapDataIndex; + int Primitive_SingleCaptureIndex; +}; + +struct type_LandscapeParameters +{ + float4 LandscapeParameters_HeightmapUVScaleBias; + float4 LandscapeParameters_WeightmapUVScaleBias; + float4 LandscapeParameters_LandscapeLightmapScaleBias; + float4 LandscapeParameters_SubsectionSizeVertsLayerUVPan; + float4 LandscapeParameters_SubsectionOffsetParams; + float4 LandscapeParameters_LightmapSubsectionOffsetParams; + float4x4 LandscapeParameters_LocalToWorldNoScaling; +}; + +struct type_Globals +{ + float4 LodBias; + float4 LodValues; + float4 SectionLods; + float4 NeighborSectionLod[4]; +}; + +struct main0_out +{ + float2 out_var_TEXCOORD0 [[user(locn0)]]; + float2 out_var_TEXCOORD1 [[user(locn1)]]; + float4 out_var_TEXCOORD2 [[user(locn2)]]; + float4 out_var_TEXCOORD3 [[user(locn3)]]; + float4 out_var_TEXCOORD8 [[user(locn4)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 in_var_ATTRIBUTE0 [[attribute(0)]]; + float4 in_var_ATTRIBUTE1_0 [[attribute(1)]]; + float4 in_var_ATTRIBUTE1_1 [[attribute(2)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileBasePass& MobileBasePass [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_LandscapeParameters& LandscapeParameters [[buffer(3)]], constant type_Globals& _Globals [[buffer(4)]]) +{ + main0_out out = {}; + spvUnsafeArray in_var_ATTRIBUTE1 = {}; + in_var_ATTRIBUTE1[0] = in.in_var_ATTRIBUTE1_0; + in_var_ATTRIBUTE1[1] = in.in_var_ATTRIBUTE1_1; + spvUnsafeArray _97; + for (int _107 = 0; _107 < 1; ) + { + _97[_107] = float4(0.0); + _107++; + continue; + } + float4 _115 = in.in_var_ATTRIBUTE0 * float4(255.0); + float2 _116 = _115.zw; + float2 _119 = fract(_116 * float2(0.5)) * float2(2.0); + float2 _121 = (_116 - _119) * float2(0.0039215688593685626983642578125); + float2 _122 = _115.xy; + float2 _126 = _122 * float2(_Globals.LodValues.w); + float _127 = _126.y; + float _128 = _126.x; + float4 _132 = float4(_127, _128, 1.0 - _128, 1.0 - _127) * float4(2.0); + float4 _186; + if (_119.y > 0.5) + { + float4 _161; + if (_119.x > 0.5) + { + _161 = (_132 * float4(_Globals.SectionLods.w)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[3]); + } + else + { + _161 = (_132 * float4(_Globals.SectionLods.z)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[2]); + } + _186 = _161; + } + else + { + float4 _185; + if (_119.x > 0.5) + { + _185 = (_132 * float4(_Globals.SectionLods.y)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[1]); + } + else + { + _185 = (_132 * float4(_Globals.SectionLods.x)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[0]); + } + _186 = _185; + } + float _206; + if ((_128 + _127) > 1.0) + { + float _198; + if (_128 < _127) + { + _198 = _186.w; + } + else + { + _198 = _186.z; + } + _206 = _198; + } + else + { + float _205; + if (_128 < _127) + { + _205 = _186.y; + } + else + { + _205 = _186.x; + } + _206 = _205; + } + float _207 = floor(_206); + float _220 = _121.x; + float3 _235 = select(select(select(select(select(float3(0.03125, _121.yy), float3(0.0625, _220, _121.y), bool3(_207 < 5.0)), float3(0.125, in_var_ATTRIBUTE1[1].w, _220), bool3(_207 < 4.0)), float3(0.25, in_var_ATTRIBUTE1[1].zw), bool3(_207 < 3.0)), float3(0.5, in_var_ATTRIBUTE1[1].yz), bool3(_207 < 2.0)), float3(1.0, in_var_ATTRIBUTE1[1].xy), bool3(_207 < 1.0)); + float _236 = _235.x; + float _245 = (((in_var_ATTRIBUTE1[0].x * 65280.0) + (in_var_ATTRIBUTE1[0].y * 255.0)) - 32768.0) * 0.0078125; + float _252 = (((in_var_ATTRIBUTE1[0].z * 65280.0) + (in_var_ATTRIBUTE1[0].w * 255.0)) - 32768.0) * 0.0078125; + float2 _257 = floor(_122 * float2(_236)); + float2 _271 = float2((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * _236) - 1.0, fast::max((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * 0.5) * _236, 2.0) - 1.0) * float2(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.y); + float3 _287 = mix(float3(_257 / float2(_271.x), mix(_245, _252, _235.y)), float3(floor(_257 * float2(0.5)) / float2(_271.y), mix(_245, _252, _235.z)), float3(_206 - _207)); + float2 _288 = _119.xy; + float2 _292 = _288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww; + float3 _296 = _287 + float3(_292, 0.0); + float4 _322 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _296.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _296.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _296.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0); + float2 _323 = _287.xy; + float4 _338 = float4(_322.x, _322.y, _322.z, _322.w); + float4 _339 = View.View_TranslatedWorldToClip * _338; + float3 _341 = _322.xyz - float3(View.View_TranslatedWorldCameraOrigin); + float _345 = dot(_341, _341); + float _346 = rsqrt(_345); + float _347 = _345 * _346; + float _354 = _341.z; + float _357 = fast::max(0.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.w); + float _393; + float _394; + float _395; + float _396; + if (_357 > 0.0) + { + float _361 = _357 * _346; + float _362 = _361 * _354; + float _365 = View.View_WorldCameraOrigin[2] + _362; + _393 = (1.0 - _361) * _347; + _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.z * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.w))); + _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.x * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.y))); + _396 = _354 - _362; + } + else + { + _393 = _347; + _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.x; + _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.x; + _396 = _354; + } + float _400 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * _396); + float _405 = log(2.0); + float _407 = 0.5 * (_405 * _405); + float _417 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * _396); + float _428 = (_395 * ((abs(_400) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_400)) / _400) : (_405 - (_407 * _400)))) + (_394 * ((abs(_417) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_417)) / _417) : (_405 - (_407 * _417)))); + float3 _459; + if (MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w >= 0.0) + { + _459 = (MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.xyz * float3(pow(fast::clamp(dot(_341 * float3(_346), MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.xyz), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.w))) * float3(1.0 - fast::clamp(exp2(-(_428 * fast::max(_393 - MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w, 0.0))), 0.0, 1.0)); + } + else + { + _459 = float3(0.0); + } + bool _468 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w > 0.0) && (_347 > MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w); + float _471 = _468 ? 1.0 : fast::max(fast::clamp(exp2(-(_428 * _393)), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.w); + float3 _475 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.xyz * float3(1.0 - _471)) + select(_459, float3(0.0), bool3(_468)); + _97[0] = float4(_475, _471); + float4 _482 = _338; + _482.w = _339.w; + out.out_var_TEXCOORD0 = ((_323 + LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.zw) + _292).xy; + out.out_var_TEXCOORD1 = ((_323 * LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.xy) + LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.zw) + (_288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.zz); + out.out_var_TEXCOORD2 = float4(float4(0.0).x, float4(0.0).y, _97[0].x, _97[0].y); + out.out_var_TEXCOORD3 = float4(float4(0.0).x, float4(0.0).y, _97[0].z, _97[0].w); + out.out_var_TEXCOORD8 = _482; + out.gl_Position = _339; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders-ue4/asm/vert/texture-buffer.asm.vert b/third_party/spirv-cross/reference/shaders-ue4/asm/vert/texture-buffer.asm.vert new file mode 100644 index 0000000000..5398fec390 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders-ue4/asm/vert/texture-buffer.asm.vert @@ -0,0 +1,387 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +// Returns 2D texture coords corresponding to 1D texel buffer coords +static inline __attribute__((always_inline)) +uint2 spvTexelBufferCoord(uint tc) +{ + return uint2(tc % 4096, tc / 4096); +} + +struct type_View +{ + float4x4 View_TranslatedWorldToClip; + float4x4 View_WorldToClip; + float4x4 View_TranslatedWorldToView; + float4x4 View_ViewToTranslatedWorld; + float4x4 View_TranslatedWorldToCameraView; + float4x4 View_CameraViewToTranslatedWorld; + float4x4 View_ViewToClip; + float4x4 View_ViewToClipNoAA; + float4x4 View_ClipToView; + float4x4 View_ClipToTranslatedWorld; + float4x4 View_SVPositionToTranslatedWorld; + float4x4 View_ScreenToWorld; + float4x4 View_ScreenToTranslatedWorld; + packed_float3 View_ViewForward; + float PrePadding_View_844; + packed_float3 View_ViewUp; + float PrePadding_View_860; + packed_float3 View_ViewRight; + float PrePadding_View_876; + packed_float3 View_HMDViewNoRollUp; + float PrePadding_View_892; + packed_float3 View_HMDViewNoRollRight; + float PrePadding_View_908; + float4 View_InvDeviceZToWorldZTransform; + float4 View_ScreenPositionScaleBias; + packed_float3 View_WorldCameraOrigin; + float PrePadding_View_956; + packed_float3 View_TranslatedWorldCameraOrigin; + float PrePadding_View_972; + packed_float3 View_WorldViewOrigin; + float PrePadding_View_988; + packed_float3 View_PreViewTranslation; + float PrePadding_View_1004; + float4x4 View_PrevProjection; + float4x4 View_PrevViewProj; + float4x4 View_PrevViewRotationProj; + float4x4 View_PrevViewToClip; + float4x4 View_PrevClipToView; + float4x4 View_PrevTranslatedWorldToClip; + float4x4 View_PrevTranslatedWorldToView; + float4x4 View_PrevViewToTranslatedWorld; + float4x4 View_PrevTranslatedWorldToCameraView; + float4x4 View_PrevCameraViewToTranslatedWorld; + packed_float3 View_PrevWorldCameraOrigin; + float PrePadding_View_1660; + packed_float3 View_PrevWorldViewOrigin; + float PrePadding_View_1676; + packed_float3 View_PrevPreViewTranslation; + float PrePadding_View_1692; + float4x4 View_PrevInvViewProj; + float4x4 View_PrevScreenToTranslatedWorld; + float4x4 View_ClipToPrevClip; + float4 View_TemporalAAJitter; + float4 View_GlobalClippingPlane; + float2 View_FieldOfViewWideAngles; + float2 View_PrevFieldOfViewWideAngles; + float4 View_ViewRectMin; + float4 View_ViewSizeAndInvSize; + float4 View_BufferSizeAndInvSize; + float4 View_BufferBilinearUVMinMax; + int View_NumSceneColorMSAASamples; + float View_PreExposure; + float View_OneOverPreExposure; + float PrePadding_View_2012; + float4 View_DiffuseOverrideParameter; + float4 View_SpecularOverrideParameter; + float4 View_NormalOverrideParameter; + float2 View_RoughnessOverrideParameter; + float View_PrevFrameGameTime; + float View_PrevFrameRealTime; + float View_OutOfBoundsMask; + float PrePadding_View_2084; + float PrePadding_View_2088; + float PrePadding_View_2092; + packed_float3 View_WorldCameraMovementSinceLastFrame; + float View_CullingSign; + float View_NearPlane; + float View_AdaptiveTessellationFactor; + float View_GameTime; + float View_RealTime; + float View_DeltaTime; + float View_MaterialTextureMipBias; + float View_MaterialTextureDerivativeMultiply; + uint View_Random; + uint View_FrameNumber; + uint View_StateFrameIndexMod8; + uint View_StateFrameIndex; + float View_CameraCut; + float View_UnlitViewmodeMask; + float PrePadding_View_2164; + float PrePadding_View_2168; + float PrePadding_View_2172; + float4 View_DirectionalLightColor; + packed_float3 View_DirectionalLightDirection; + float PrePadding_View_2204; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; + float4 View_TemporalAAParams; + float4 View_CircleDOFParams; + float View_DepthOfFieldSensorWidth; + float View_DepthOfFieldFocalDistance; + float View_DepthOfFieldScale; + float View_DepthOfFieldFocalLength; + float View_DepthOfFieldFocalRegion; + float View_DepthOfFieldNearTransitionRegion; + float View_DepthOfFieldFarTransitionRegion; + float View_MotionBlurNormalizedToPixel; + float View_bSubsurfacePostprocessEnabled; + float View_GeneralPurposeTweak; + float View_DemosaicVposOffset; + float PrePadding_View_2348; + packed_float3 View_IndirectLightingColorScale; + float View_HDR32bppEncodingMode; + packed_float3 View_AtmosphericFogSunDirection; + float View_AtmosphericFogSunPower; + float View_AtmosphericFogPower; + float View_AtmosphericFogDensityScale; + float View_AtmosphericFogDensityOffset; + float View_AtmosphericFogGroundOffset; + float View_AtmosphericFogDistanceScale; + float View_AtmosphericFogAltitudeScale; + float View_AtmosphericFogHeightScaleRayleigh; + float View_AtmosphericFogStartDistance; + float View_AtmosphericFogDistanceOffset; + float View_AtmosphericFogSunDiscScale; + uint View_AtmosphericFogRenderMask; + uint View_AtmosphericFogInscatterAltitudeSampleNum; + float4 View_AtmosphericFogSunColor; + packed_float3 View_NormalCurvatureToRoughnessScaleBias; + float View_RenderingReflectionCaptureMask; + float4 View_AmbientCubemapTint; + float View_AmbientCubemapIntensity; + float View_SkyLightParameters; + float PrePadding_View_2488; + float PrePadding_View_2492; + float4 View_SkyLightColor; + float4 View_SkyIrradianceEnvironmentMap[7]; + float View_MobilePreviewMode; + float View_HMDEyePaddingOffset; + float View_ReflectionCubemapMaxMip; + float View_ShowDecalsMask; + uint View_DistanceFieldAOSpecularOcclusionMode; + float View_IndirectCapsuleSelfShadowingIntensity; + float PrePadding_View_2648; + float PrePadding_View_2652; + packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; + int View_StereoPassIndex; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; + float View_GlobalVolumeDimension; + float View_GlobalVolumeTexelSize; + float View_MaxGlobalDistance; + float View_bCheckerboardSubsurfaceProfileRendering; + packed_float3 View_VolumetricFogInvGridSize; + float PrePadding_View_2828; + packed_float3 View_VolumetricFogGridZParams; + float PrePadding_View_2844; + float2 View_VolumetricFogSVPosToVolumeUV; + float View_VolumetricFogMaxDistance; + float PrePadding_View_2860; + packed_float3 View_VolumetricLightmapWorldToUVScale; + float PrePadding_View_2876; + packed_float3 View_VolumetricLightmapWorldToUVAdd; + float PrePadding_View_2892; + packed_float3 View_VolumetricLightmapIndirectionTextureSize; + float View_VolumetricLightmapBrickSize; + packed_float3 View_VolumetricLightmapBrickTexelSize; + float View_StereoIPD; + float View_IndirectLightingCacheShowFlag; + float View_EyeToPixelSpreadAngle; +}; + +struct type_Primitive +{ + float4x4 Primitive_LocalToWorld; + float4 Primitive_InvNonUniformScaleAndDeterminantSign; + float4 Primitive_ObjectWorldPositionAndRadius; + float4x4 Primitive_WorldToLocal; + float4x4 Primitive_PreviousLocalToWorld; + float4x4 Primitive_PreviousWorldToLocal; + packed_float3 Primitive_ActorWorldPosition; + float Primitive_UseSingleSampleShadowFromStationaryLights; + packed_float3 Primitive_ObjectBounds; + float Primitive_LpvBiasMultiplier; + float Primitive_DecalReceiverMask; + float Primitive_PerObjectGBufferData; + float Primitive_UseVolumetricLightmapShadowFromStationaryLights; + float Primitive_UseEditorDepthTest; + float4 Primitive_ObjectOrientation; + float4 Primitive_NonUniformScale; + packed_float3 Primitive_LocalObjectBoundsMin; + float PrePadding_Primitive_380; + packed_float3 Primitive_LocalObjectBoundsMax; + uint Primitive_LightingChannelMask; + uint Primitive_LightmapDataIndex; + int Primitive_SingleCaptureIndex; +}; + +struct type_MobileShadowDepthPass +{ + float PrePadding_MobileShadowDepthPass_0; + float PrePadding_MobileShadowDepthPass_4; + float PrePadding_MobileShadowDepthPass_8; + float PrePadding_MobileShadowDepthPass_12; + float PrePadding_MobileShadowDepthPass_16; + float PrePadding_MobileShadowDepthPass_20; + float PrePadding_MobileShadowDepthPass_24; + float PrePadding_MobileShadowDepthPass_28; + float PrePadding_MobileShadowDepthPass_32; + float PrePadding_MobileShadowDepthPass_36; + float PrePadding_MobileShadowDepthPass_40; + float PrePadding_MobileShadowDepthPass_44; + float PrePadding_MobileShadowDepthPass_48; + float PrePadding_MobileShadowDepthPass_52; + float PrePadding_MobileShadowDepthPass_56; + float PrePadding_MobileShadowDepthPass_60; + float PrePadding_MobileShadowDepthPass_64; + float PrePadding_MobileShadowDepthPass_68; + float PrePadding_MobileShadowDepthPass_72; + float PrePadding_MobileShadowDepthPass_76; + float4x4 MobileShadowDepthPass_ProjectionMatrix; + float2 MobileShadowDepthPass_ShadowParams; + float MobileShadowDepthPass_bClampToNearPlane; + float PrePadding_MobileShadowDepthPass_156; + float4x4 MobileShadowDepthPass_ShadowViewProjectionMatrices[6]; +}; + +struct type_EmitterDynamicUniforms +{ + float2 EmitterDynamicUniforms_LocalToWorldScale; + float EmitterDynamicUniforms_EmitterInstRandom; + float PrePadding_EmitterDynamicUniforms_12; + float4 EmitterDynamicUniforms_AxisLockRight; + float4 EmitterDynamicUniforms_AxisLockUp; + float4 EmitterDynamicUniforms_DynamicColor; + float4 EmitterDynamicUniforms_MacroUVParameters; +}; + +struct type_EmitterUniforms +{ + float4 EmitterUniforms_ColorCurve; + float4 EmitterUniforms_ColorScale; + float4 EmitterUniforms_ColorBias; + float4 EmitterUniforms_MiscCurve; + float4 EmitterUniforms_MiscScale; + float4 EmitterUniforms_MiscBias; + float4 EmitterUniforms_SizeBySpeed; + float4 EmitterUniforms_SubImageSize; + float4 EmitterUniforms_TangentSelector; + packed_float3 EmitterUniforms_CameraFacingBlend; + float EmitterUniforms_RemoveHMDRoll; + float EmitterUniforms_RotationRateScale; + float EmitterUniforms_RotationBias; + float EmitterUniforms_CameraMotionBlurAmount; + float PrePadding_EmitterUniforms_172; + float2 EmitterUniforms_PivotOffset; +}; + +struct type_Globals +{ + uint ParticleIndicesOffset; +}; + +struct main0_out +{ + float out_var_TEXCOORD6 [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float2 in_var_ATTRIBUTE0 [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], constant type_MobileShadowDepthPass& MobileShadowDepthPass [[buffer(2)]], constant type_EmitterDynamicUniforms& EmitterDynamicUniforms [[buffer(3)]], constant type_EmitterUniforms& EmitterUniforms [[buffer(4)]], constant type_Globals& _Globals [[buffer(5)]], texture2d ParticleIndices [[texture(0)]], texture2d PositionTexture [[texture(1)]], texture2d VelocityTexture [[texture(2)]], texture2d AttributesTexture [[texture(3)]], texture2d CurveTexture [[texture(4)]], sampler PositionTextureSampler [[sampler(0)]], sampler VelocityTextureSampler [[sampler(1)]], sampler AttributesTextureSampler [[sampler(2)]], sampler CurveTextureSampler [[sampler(3)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) +{ + main0_out out = {}; + float2 _133 = ParticleIndices.read(spvTexelBufferCoord((_Globals.ParticleIndicesOffset + ((gl_InstanceIndex * 16u) + (gl_VertexIndex / 4u))))).xy; + float4 _137 = PositionTexture.sample(PositionTextureSampler, _133, level(0.0)); + float4 _145 = AttributesTexture.sample(AttributesTextureSampler, _133, level(0.0)); + float _146 = _137.w; + float3 _158 = float3x3(Primitive.Primitive_LocalToWorld[0].xyz, Primitive.Primitive_LocalToWorld[1].xyz, Primitive.Primitive_LocalToWorld[2].xyz) * VelocityTexture.sample(VelocityTextureSampler, _133, level(0.0)).xyz; + float3 _160 = fast::normalize(_158 + float3(0.0, 0.0, 9.9999997473787516355514526367188e-05)); + float2 _204 = ((((_145.xy + float2((_145.x < 0.5) ? 0.0 : (-0.5), (_145.y < 0.5) ? 0.0 : (-0.5))) * float2(2.0)) * (((CurveTexture.sample(CurveTextureSampler, (EmitterUniforms.EmitterUniforms_MiscCurve.xy + (EmitterUniforms.EmitterUniforms_MiscCurve.zw * float2(_146))), level(0.0)) * EmitterUniforms.EmitterUniforms_MiscScale) + EmitterUniforms.EmitterUniforms_MiscBias).xy * EmitterDynamicUniforms.EmitterDynamicUniforms_LocalToWorldScale)) * fast::min(fast::max(EmitterUniforms.EmitterUniforms_SizeBySpeed.xy * float2(length(_158)), float2(1.0)), EmitterUniforms.EmitterUniforms_SizeBySpeed.zw)) * float2(step(_146, 1.0)); + float3 _239 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _137.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _137.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _137.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0).xyz; + float3 _242 = float3(EmitterUniforms.EmitterUniforms_RemoveHMDRoll); + float3 _251 = mix(mix(float3(View.View_ViewRight), float3(View.View_HMDViewNoRollRight), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.w)); + float3 _259 = mix(-mix(float3(View.View_ViewUp), float3(View.View_HMDViewNoRollUp), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.w)); + float3 _260 = float3(View.View_TranslatedWorldCameraOrigin) - _239; + float _261 = dot(_260, _260); + float3 _265 = _260 / float3(sqrt(fast::max(_261, 0.00999999977648258209228515625))); + float3 _335; + float3 _336; + if (EmitterUniforms.EmitterUniforms_CameraFacingBlend[0] > 0.0) + { + float3 _279 = cross(_265, float3(0.0, 0.0, 1.0)); + float3 _284 = _279 / float3(sqrt(fast::max(dot(_279, _279), 0.00999999977648258209228515625))); + float3 _286 = float3(fast::clamp((_261 * EmitterUniforms.EmitterUniforms_CameraFacingBlend[1]) - EmitterUniforms.EmitterUniforms_CameraFacingBlend[2], 0.0, 1.0)); + _335 = fast::normalize(mix(_251, _284, _286)); + _336 = fast::normalize(mix(_259, cross(_265, _284), _286)); + } + else + { + float3 _333; + float3 _334; + if (EmitterUniforms.EmitterUniforms_TangentSelector.y > 0.0) + { + float3 _297 = cross(_265, _160); + _333 = _297 / float3(sqrt(fast::max(dot(_297, _297), 0.00999999977648258209228515625))); + _334 = -_160; + } + else + { + float3 _331; + float3 _332; + if (EmitterUniforms.EmitterUniforms_TangentSelector.z > 0.0) + { + float3 _310 = cross(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, _265); + _331 = EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz; + _332 = -(_310 / float3(sqrt(fast::max(dot(_310, _310), 0.00999999977648258209228515625)))); + } + else + { + float3 _329; + float3 _330; + if (EmitterUniforms.EmitterUniforms_TangentSelector.w > 0.0) + { + float3 _322 = cross(_265, float3(0.0, 0.0, 1.0)); + float3 _327 = _322 / float3(sqrt(fast::max(dot(_322, _322), 0.00999999977648258209228515625))); + _329 = _327; + _330 = cross(_265, _327); + } + else + { + _329 = _251; + _330 = _259; + } + _331 = _329; + _332 = _330; + } + _333 = _331; + _334 = _332; + } + _335 = _333; + _336 = _334; + } + float _339 = ((_145.z + ((_145.w * EmitterUniforms.EmitterUniforms_RotationRateScale) * _146)) * 6.283185482025146484375) + EmitterUniforms.EmitterUniforms_RotationBias; + float3 _342 = float3(sin(_339)); + float3 _344 = float3(cos(_339)); + float3 _367 = _239 + ((float3(_204.x * (in.in_var_ATTRIBUTE0.x + EmitterUniforms.EmitterUniforms_PivotOffset.x)) * ((_342 * _336) + (_344 * _335))) + (float3(_204.y * (in.in_var_ATTRIBUTE0.y + EmitterUniforms.EmitterUniforms_PivotOffset.y)) * ((_344 * _336) - (_342 * _335)))); + float4 _371 = float4(_367, 1.0); + float4 _375 = MobileShadowDepthPass.MobileShadowDepthPass_ProjectionMatrix * float4(_371.x, _371.y, _371.z, _371.w); + float4 _386; + if ((MobileShadowDepthPass.MobileShadowDepthPass_bClampToNearPlane > 0.0) && (_375.z < 0.0)) + { + float4 _384 = _375; + _384.z = 9.9999999747524270787835121154785e-07; + _384.w = 1.0; + _386 = _384; + } + else + { + _386 = _375; + } + float4 _396 = _386; + _396.z = ((_386.z * MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.y) + MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.x) * _386.w; + out.out_var_TEXCOORD6 = 0.0; + out.gl_Position = _396; + return out; +} + diff --git a/third_party/spirv-cross/reference/shaders/amd/gcn_shader.comp b/third_party/spirv-cross/reference/shaders/amd/gcn_shader.comp new file mode 100644 index 0000000000..380fb9dfa7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/amd/gcn_shader.comp @@ -0,0 +1,18 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_AMD_gcn_shader : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + float cubeFace = cubeFaceIndexAMD(vec3(0.0)); + vec2 cubeFaceCoord = cubeFaceCoordAMD(vec3(1.0)); + uint64_t time = timeAMD(); +} + diff --git a/third_party/spirv-cross/reference/shaders/amd/shader_ballot.comp b/third_party/spirv-cross/reference/shaders/amd/shader_ballot.comp new file mode 100644 index 0000000000..04d363457a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/amd/shader_ballot.comp @@ -0,0 +1,38 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_ARB_shader_ballot : require +#extension GL_AMD_shader_ballot : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer inputData +{ + float inputDataArray[]; +} _12; + +layout(binding = 1, std430) buffer outputData +{ + float outputDataArray[]; +} _74; + +void main() +{ + float thisLaneData = _12.inputDataArray[gl_LocalInvocationID.x]; + bool laneActive = thisLaneData > 0.0; + uint thisLaneOutputSlot = mbcntAMD(packUint2x32(uvec2(uvec4(unpackUint2x32(ballotARB(laneActive)), 0u, 0u).xy))); + int firstInvocation = readFirstInvocationARB(1); + int invocation = readInvocationARB(1, 0u); + vec3 swizzleInvocations = swizzleInvocationsAMD(vec3(0.0, 2.0, 1.0), uvec4(3u)); + vec3 swizzelInvocationsMasked = swizzleInvocationsMaskedAMD(vec3(0.0, 2.0, 1.0), uvec3(2u)); + vec3 writeInvocation = writeInvocationAMD(swizzleInvocations, swizzelInvocationsMasked, 0u); + if (laneActive) + { + _74.outputDataArray[thisLaneOutputSlot] = thisLaneData; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/amd/shader_group_vote.comp b/third_party/spirv-cross/reference/shaders/amd/shader_group_vote.comp new file mode 100644 index 0000000000..007d9f9841 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/amd/shader_group_vote.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_ARB_shader_group_vote : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer inputData +{ + float inputDataArray[]; +} _12; + +void main() +{ + float thisLaneData = _12.inputDataArray[gl_LocalInvocationID.x]; + bool laneActive = thisLaneData > 0.0; + bool allInvocations = allInvocationsARB(laneActive); + bool anyInvocations = anyInvocationARB(laneActive); + bool allInvocationsEqual = allInvocationsEqualARB(laneActive); +} + diff --git a/third_party/spirv-cross/reference/shaders/amd/shader_trinary_minmax.comp b/third_party/spirv-cross/reference/shaders/amd/shader_trinary_minmax.comp new file mode 100644 index 0000000000..ece39b7106 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/amd/shader_trinary_minmax.comp @@ -0,0 +1,11 @@ +#version 450 +#extension GL_AMD_shader_trinary_minmax : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +void main() +{ + int t11 = min3(0, 3, 2); + int t12 = max3(0, 3, 2); + int t13 = mid3(0, 3, 2); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..5ece8257da --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer u0_counters +{ + uint c; +} u0_counter; + +layout(binding = 0, r32ui) uniform writeonly uimageBuffer u0; + +void main() +{ + uint _29 = atomicAdd(u0_counter.c, uint(-1)); + vec4 r0; + r0.x = uintBitsToFloat(_29); + imageStore(u0, int((uint(floatBitsToInt(r0.x)) * 1u) + (uint(0) >> 2u)), uvec4(uint(int(gl_GlobalInvocationID.x)))); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..2a8f711823 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer u0_counters +{ + uint c; +} u0_counter; + +layout(binding = 0, r32ui) uniform writeonly uimageBuffer u0; + +void main() +{ + uint _29 = atomicAdd(u0_counter.c, 1u); + vec4 r0; + r0.x = uintBitsToFloat(_29); + imageStore(u0, int((uint(floatBitsToInt(r0.x)) * 1u) + (uint(0) >> 2u)), uvec4(uint(int(gl_GlobalInvocationID.x)))); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..bed2dffccb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) restrict buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + _6._m0 = _5._m1 + uvec4(_5._m0); + _6._m0 = uvec4(_5._m0) + _5._m1; + _6._m0 = _5._m1 + _5._m1; + _6._m0 = uvec4(_5._m0 + _5._m0); + _6._m1 = ivec4(_5._m1 + _5._m1); + _6._m1 = _5._m0 + _5._m0; + _6._m1 = ivec4(_5._m1) + _5._m0; + _6._m1 = _5._m0 + ivec4(_5._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..8d59fcc856 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) restrict buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + _6._m0 = uvec4(lessThan(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(lessThanEqual(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(lessThan(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(lessThanEqual(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(greaterThan(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(greaterThanEqual(ivec4(_5._m1), _5._m0)); + _6._m0 = uvec4(greaterThan(_5._m1, uvec4(_5._m0))); + _6._m0 = uvec4(greaterThanEqual(_5._m1, uvec4(_5._m0))); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iequal.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iequal.asm.comp new file mode 100644 index 0000000000..8a552dba06 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_iequal.asm.comp @@ -0,0 +1,33 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _30 = _5._m0; + uvec4 _31 = _5._m1; + bvec4 _34 = equal(ivec4(_31), _30); + bvec4 _35 = equal(_30, ivec4(_31)); + bvec4 _36 = equal(_31, _31); + bvec4 _37 = equal(_30, _30); + _6._m0 = uvec4(_34); + _6._m0 = uvec4(_35); + _6._m0 = uvec4(_36); + _6._m0 = uvec4(_37); + _6._m1 = ivec4(_34); + _6._m1 = ivec4(_35); + _6._m1 = ivec4(_36); + _6._m1 = ivec4(_37); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..283b444cce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = uvec4(ivec4(_23) >> _22); + _6._m0 = uvec4(_22 >> ivec4(_23)); + _6._m0 = uvec4(ivec4(_23) >> ivec4(_23)); + _6._m0 = uvec4(_22 >> _22); + _6._m1 = ivec4(_23) >> ivec4(_23); + _6._m1 = _22 >> _22; + _6._m1 = ivec4(_23) >> _22; + _6._m1 = _22 >> ivec4(_23); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..e28c481d21 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = uvec4(ivec4(_23) / _22); + _6._m0 = uvec4(_22 / ivec4(_23)); + _6._m0 = uvec4(ivec4(_23) / ivec4(_23)); + _6._m0 = uvec4(_22 / _22); + _6._m1 = ivec4(_23) / ivec4(_23); + _6._m1 = _22 / _22; + _6._m1 = ivec4(_23) / _22; + _6._m1 = _22 / ivec4(_23); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..78efaf3852 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_5 +{ + ivec4 _m0; + uvec4 _m1; +} _5; + +layout(binding = 1, std430) buffer _4_6 +{ + uvec4 _m0; + ivec4 _m1; +} _6; + +void main() +{ + ivec4 _22 = _5._m0; + uvec4 _23 = _5._m1; + _6._m0 = _23 >> uvec4(_22); + _6._m0 = uvec4(_22) >> _23; + _6._m0 = _23 >> _23; + _6._m0 = uvec4(_22) >> uvec4(_22); + _6._m1 = ivec4(_23 >> _23); + _6._m1 = ivec4(uvec4(_22) >> uvec4(_22)); + _6._m1 = ivec4(_23 >> uvec4(_22)); + _6._m1 = ivec4(uvec4(_22) >> _23); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..86ba0a3b9f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,37 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct A +{ + int a; + int b; +}; + +layout(binding = 1, std430) buffer C1 +{ + A Data[]; +} C1_1; + +layout(binding = 2, std140) uniform C2 +{ + A Data[1024]; +} C2_1; + +layout(binding = 0, std430) buffer B +{ + A Data[]; +} C3; + +layout(binding = 3, std140) uniform B +{ + A Data[1024]; +} C4; + +void main() +{ + C1_1.Data[gl_GlobalInvocationID.x].a = C2_1.Data[gl_GlobalInvocationID.x].a; + C1_1.Data[gl_GlobalInvocationID.x].b = C2_1.Data[gl_GlobalInvocationID.x].b; + C3.Data[gl_GlobalInvocationID.x].a = C4.Data[gl_GlobalInvocationID.x].a; + C3.Data[gl_GlobalInvocationID.x].b = C4.Data[gl_GlobalInvocationID.x].b; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/builtin-compute-bitcast.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/builtin-compute-bitcast.asm.comp new file mode 100644 index 0000000000..abb8a7976c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/builtin-compute-bitcast.asm.comp @@ -0,0 +1,13 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer BUF +{ + int values[]; +} _6; + +void main() +{ + _6.values[int(gl_WorkGroupID.y)] = int(gl_GlobalInvocationID.z); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..a1e0a08225 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,58 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer bar +{ + vec4 _data[]; +} bar_1; + +layout(binding = 1, std430) buffer foo +{ + vec4 _data[]; +} foo_1; + +void _main() +{ + SPIRV_CROSS_UNROLL + for (int i = 0; i < 16; i++) + { + bar_1._data[i] = foo_1._data[i]; + } + SPIRV_CROSS_LOOP + for (int i_1 = 0; i_1 < 16; i_1++) + { + bar_1._data[15 - i_1] = foo_1._data[i_1]; + } + float v = bar_1._data[10].x; + float w = foo_1._data[10].x; + SPIRV_CROSS_BRANCH + if (v > 10.0) + { + foo_1._data[20] = vec4(5.0); + } + float value = 20.0; + SPIRV_CROSS_FLATTEN + if (w > 40.0) + { + value = 20.0; + } + foo_1._data[20] = vec4(value); +} + +void main() +{ + _main(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/decoration-group.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/decoration-group.asm.comp new file mode 100644 index 0000000000..28ad4d41fd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/decoration-group.asm.comp @@ -0,0 +1,38 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 5, std430) buffer _6_15 +{ + float _m0[]; +} _15; + +layout(binding = 0, std430) buffer _7_16 +{ + float _m0[]; +} _16; + +layout(binding = 1, std430) buffer _8_17 +{ + float _m0[]; +} _17; + +layout(binding = 2, std430) restrict readonly buffer _9_18 +{ + float _m0[]; +} _18; + +layout(binding = 3, std430) restrict readonly buffer _10_19 +{ + float _m0[]; +} _19; + +layout(binding = 4, std430) restrict readonly buffer _11_20 +{ + float _m0[]; +} _20; + +void main() +{ + _15._m0[gl_GlobalInvocationID.x] = (((_16._m0[gl_GlobalInvocationID.x] + _17._m0[gl_GlobalInvocationID.x]) + _18._m0[gl_GlobalInvocationID.x]) + _19._m0[gl_GlobalInvocationID.x]) + _20._m0[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..20db16f5fb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) readonly buffer ssbo +{ + uint _data[]; +} ssbo_1; + +void Load(uint size) +{ + int byteAddrTemp = int(size >> uint(2)); + uvec4 data = uvec4(ssbo_1._data[byteAddrTemp], ssbo_1._data[byteAddrTemp + 1], ssbo_1._data[byteAddrTemp + 2], ssbo_1._data[byteAddrTemp + 3]); +} + +void _main(uvec3 id) +{ + uint param = 4u; + Load(param); +} + +void main() +{ + uvec3 id = gl_GlobalInvocationID; + uvec3 param = id; + _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp new file mode 100644 index 0000000000..e80f52404c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/hlsl-functionality.asm.comp @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer Buf +{ + vec4 _data[]; +} Buf_1; + +layout(binding = 1, std430) buffer Buf_count +{ + int _count; +} Buf_count_1; + +void _main() +{ + int _29 = atomicAdd(Buf_count_1._count, 1); + Buf_1._data[_29] = vec4(1.0); +} + +void main() +{ + _main(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/logical.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/logical.asm.comp new file mode 100644 index 0000000000..9ae25f78a9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/logical.asm.comp @@ -0,0 +1,56 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + float a; + vec2 b; + vec3 c; + vec4 d; +} s0; + +layout(binding = 1, std430) buffer SSBO1 +{ + float a; + vec2 b; + vec3 c; + vec4 d; +} s1; + +bool and(bool a, bool b) +{ + return !((a && b) || b); +} + +bvec2 and(bvec2 a, bvec2 b) +{ + bvec2 _98 = bvec2(a.x && b.x, a.y && b.y); + return not(bvec2(_98.x || b.x, _98.y || b.y)); +} + +bvec3 and(bvec3 a, bvec3 b) +{ + return bvec3(a.x && b.x, a.y && b.y, a.z && b.z); +} + +bvec4 and(bvec4 a, bvec4 b) +{ + return bvec4(a.x && b.x, a.y && b.y, a.z && b.z, a.w && b.w); +} + +void main() +{ + bool param = isinf(s0.a); + bool param_1 = isnan(s1.a); + bool b0 = and(param, param_1); + bvec2 param_2 = isinf(s0.b); + bvec2 param_3 = isnan(s1.b); + bvec2 b1 = and(param_2, param_3); + bvec3 param_4 = isinf(s0.c); + bvec3 param_5 = isnan(s1.c); + bvec3 b2 = and(param_4, param_5); + bvec4 param_6 = isinf(s0.d); + bvec4 param_7 = isnan(s1.d); + bvec4 b3 = and(param_6, param_7); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..6418464f19 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) restrict buffer _6_8 +{ + ivec4 _m0; + uvec4 _m1; +} _8; + +layout(binding = 1, std430) restrict buffer _7_9 +{ + uvec4 _m0; + ivec4 _m1; +} _9; + +void main() +{ + _9._m0 = _8._m1 + uvec4(_8._m0); + _9._m0 = uvec4(_8._m0) + _8._m1; + _9._m0 = _8._m1 + _8._m1; + _9._m0 = uvec4(_8._m0 + _8._m0); + _9._m1 = ivec4(_8._m1 + _8._m1); + _9._m1 = _8._m0 + _8._m0; + _9._m1 = ivec4(_8._m1) + _8._m0; + _9._m1 = _8._m0 + ivec4(_8._m1); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..54c452c5de --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,44 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a1; + vec2 a2; + vec3 a3; + vec4 a4; + float b1; + vec2 b2; + vec3 b3; + vec4 b4; + float c1; + vec2 c2; + vec3 c3; + vec4 c4; +} _4; + +void main() +{ + _4.a1 = isnan(_4.c1) ? _4.b1 : (isnan(_4.b1) ? _4.c1 : min(_4.b1, _4.c1)); + _4.a2 = mix(mix(min(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + _4.a3 = mix(mix(min(_4.b3, _4.c3), _4.c3, isnan(_4.b3)), _4.b3, isnan(_4.c3)); + _4.a4 = mix(mix(min(_4.b4, _4.c4), _4.c4, isnan(_4.b4)), _4.b4, isnan(_4.c4)); + _4.a1 = isnan(_4.c1) ? _4.b1 : (isnan(_4.b1) ? _4.c1 : max(_4.b1, _4.c1)); + _4.a2 = mix(mix(max(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + _4.a3 = mix(mix(max(_4.b3, _4.c3), _4.c3, isnan(_4.b3)), _4.b3, isnan(_4.c3)); + _4.a4 = mix(mix(max(_4.b4, _4.c4), _4.c4, isnan(_4.b4)), _4.b4, isnan(_4.c4)); + float _179 = isnan(_4.b1) ? _4.a1 : (isnan(_4.a1) ? _4.b1 : max(_4.a1, _4.b1)); + _4.a1 = isnan(_4.c1) ? _179 : (isnan(_179) ? _4.c1 : min(_179, _4.c1)); + vec2 _190 = mix(mix(max(_4.a2, _4.b2), _4.b2, isnan(_4.a2)), _4.a2, isnan(_4.b2)); + _4.a2 = mix(mix(min(_190, _4.c2), _4.c2, isnan(_190)), _190, isnan(_4.c2)); + vec3 _201 = mix(mix(max(_4.a3, _4.b3), _4.b3, isnan(_4.a3)), _4.a3, isnan(_4.b3)); + _4.a3 = mix(mix(min(_201, _4.c3), _4.c3, isnan(_201)), _201, isnan(_4.c3)); + vec4 _212 = mix(mix(max(_4.a4, _4.b4), _4.b4, isnan(_4.a4)), _4.a4, isnan(_4.b4)); + _4.a4 = mix(mix(min(_212, _4.c4), _4.c4, isnan(_212)), _212, isnan(_4.c4)); + float _223; + for (int i = 0; i < 2; i++, _223 = isnan(_4.b2.x) ? _4.a1 : (isnan(_4.a1) ? _4.b2.x : max(_4.a1, _4.b2.x)), _4.a1 = isnan(_4.b2.y) ? _223 : (isnan(_223) ? _4.b2.y : min(_223, _4.b2.y))) + { + _4.a2 = mix(mix(min(_4.b2, _4.c2), _4.c2, isnan(_4.b2)), _4.b2, isnan(_4.c2)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..449a87d0dd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,39 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a1; + vec2 a2; + vec3 a3; + vec4 a4; + float b1; + vec2 b2; + vec3 b3; + vec4 b4; + float c1; + vec2 c2; + vec3 c3; + vec4 c4; +} _4; + +void main() +{ + _4.a1 = min(_4.b1, _4.c1); + _4.a2 = min(_4.b2, _4.c2); + _4.a3 = min(_4.b3, _4.c3); + _4.a4 = min(_4.b4, _4.c4); + _4.a1 = max(_4.b1, _4.c1); + _4.a2 = max(_4.b2, _4.c2); + _4.a3 = max(_4.b3, _4.c3); + _4.a4 = max(_4.b4, _4.c4); + _4.a1 = clamp(_4.a1, _4.b1, _4.c1); + _4.a2 = clamp(_4.a2, _4.b2, _4.c2); + _4.a3 = clamp(_4.a3, _4.b3, _4.c3); + _4.a4 = clamp(_4.a4, _4.b4, _4.c4); + for (int i = 0; i < 2; i++, _4.a1 = clamp(_4.a1, _4.b2.x, _4.b2.y)) + { + _4.a2 = min(_4.b2, _4.c2); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/op-phi-swap.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/op-phi-swap.asm.comp new file mode 100644 index 0000000000..f8c51c0455 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/op-phi-swap.asm.comp @@ -0,0 +1,40 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _3_4 +{ + float _m0[]; +} _4; + +layout(binding = 1, std430) buffer _3_5 +{ + float _m0[]; +} _5; + +void main() +{ + float _26 = 8.5; + bool _34; + float _35; + float _35_copy; + float _36; + _34 = true; + _35 = _4._m0[gl_GlobalInvocationID.x]; + _36 = _26; + for (;;) + { + if (_34) + { + _34 = false; + _35_copy = _35; + _35 = _36; + _36 = _35_copy; + } + else + { + break; + } + } + _5._m0[gl_GlobalInvocationID.x] = _35 - _36; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/quantize.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..c089213800 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/quantize.asm.comp @@ -0,0 +1,19 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + float scalar; + vec2 vec2_val; + vec3 vec3_val; + vec4 vec4_val; +} _4; + +void main() +{ + _4.scalar = unpackHalf2x16(packHalf2x16(vec2(_4.scalar))).x; + _4.vec2_val = unpackHalf2x16(packHalf2x16(_4.vec2_val)); + _4.vec3_val = vec3(unpackHalf2x16(packHalf2x16(_4.vec3_val.xy)), unpackHalf2x16(packHalf2x16(_4.vec3_val.zz)).x); + _4.vec4_val = vec4(unpackHalf2x16(packHalf2x16(_4.vec4_val.xy)), unpackHalf2x16(packHalf2x16(_4.vec4_val.zw))); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/recompile-block-naming.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/recompile-block-naming.asm.comp new file mode 100644 index 0000000000..aeb1ed1633 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/recompile-block-naming.asm.comp @@ -0,0 +1,36 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer MyFirstBuffer +{ + uint _data[]; +} MyFirstBuffer_1; + +layout(binding = 0, std430) buffer MySecondBuffer +{ + uint _data[]; +} MySecondBuffer_1; + +layout(binding = 0, std430) buffer MyThirdBuffer +{ + uint _data[]; +} MyThirdBuffer_1; + +void _main() +{ + int byteAddrTemp = 0 >> 2; + uvec4 a = uvec4(MyFirstBuffer_1._data[byteAddrTemp], MyFirstBuffer_1._data[byteAddrTemp + 1], MyFirstBuffer_1._data[byteAddrTemp + 2], MyFirstBuffer_1._data[byteAddrTemp + 3]); + int byteAddrTemp_1 = 4 >> 2; + uvec4 b = uvec4(MySecondBuffer_1._data[byteAddrTemp_1], MySecondBuffer_1._data[byteAddrTemp_1 + 1], MySecondBuffer_1._data[byteAddrTemp_1 + 2], MySecondBuffer_1._data[byteAddrTemp_1 + 3]); + int byteAddrTemp_2 = 0 >> 2; + MyThirdBuffer_1._data[byteAddrTemp_2] = (a + b).x; + MyThirdBuffer_1._data[byteAddrTemp_2 + 1] = (a + b).y; + MyThirdBuffer_1._data[byteAddrTemp_2 + 2] = (a + b).z; + MyThirdBuffer_1._data[byteAddrTemp_2 + 3] = (a + b).w; +} + +void main() +{ + _main(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..8016ebaf9f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,21 @@ +#version 310 es + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 9u +#endif +#ifndef SPIRV_CROSS_CONSTANT_ID_12 +#define SPIRV_CROSS_CONSTANT_ID_12 4u +#endif + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = SPIRV_CROSS_CONSTANT_ID_12) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; +} _4; + +void main() +{ + _4.a += 1.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/switch-break-ladder.asm.invalid.comp b/third_party/spirv-cross/reference/shaders/asm/comp/switch-break-ladder.asm.invalid.comp new file mode 100644 index 0000000000..f326869cef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/switch-break-ladder.asm.invalid.comp @@ -0,0 +1,64 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer BUF +{ + int a; + int b; + int d; +} o; + +void main() +{ + int c = o.a; + int a; + for (;;) + { + bool _22_ladder_break = false; + switch (c) + { + case 5: + { + for (;;) + { + bool _30_ladder_break = false; + switch (o.d) + { + case 10: + case 20: + { + c += c; + _30_ladder_break = true; + break; + } + default: + { + continue; + } + } + if (_30_ladder_break) + { + break; + } + } + break; + } + case 1: + case 2: + case 3: + { + a = c; + _22_ladder_break = true; + break; + } + } + if (_22_ladder_break) + { + break; + } + c++; + continue; + } + o.b = a; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/reference/shaders/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..dae558dc84 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct _20 +{ + int _m0; + int _m1; +}; + +int _28; + +layout(binding = 1, std430) buffer _5_6 +{ + int _m0[10]; +} _6; + +layout(binding = 0, std430) buffer _7_8 +{ + int _m0[10]; +} _8; + +int _39(int _41, _20 _42) +{ + return _41 + _42._m1; +} + +void main() +{ + int _32 = _8._m0[gl_GlobalInvocationID.x]; + _20 _33 = _20(_28, 200); + _6._m0[gl_GlobalInvocationID.x] = _39(_32, _33); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag new file mode 100644 index 0000000000..b5e59f88bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombineduTexuSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = texture(SPIRV_Cross_CombineduTexuSampler, vUV); + FragColor += textureOffset(SPIRV_Cross_CombineduTexuSampler, vUV, ivec2(1)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk new file mode 100644 index 0000000000..bce9808950 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(set = 0, binding = 1) uniform texture2D uTex; +layout(set = 0, binding = 0) uniform sampler uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + FragColor = texture(sampler2D(uTex, uSampler), vUV); + FragColor += textureOffset(sampler2D(uTex, uSampler), vUV, ivec2(1)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/complex-name-workarounds.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/complex-name-workarounds.asm.frag new file mode 100644 index 0000000000..7b120719e6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/complex-name-workarounds.asm.frag @@ -0,0 +1,28 @@ +#version 450 + +layout(location = 0) in vec4 _; +layout(location = 1) in vec4 a; +layout(location = 0) out vec4 b; + +vec4 fu_nc_(vec4 a_) +{ + return a_; +} + +vec4 fu_nc_1(vec4 _0_1) +{ + return _0_1; +} + +void main() +{ + vec4 b_1 = _; + vec4 _0_1 = (_ + a) + fu_nc_(b_1); + vec4 b_3 = a; + vec4 b_2 = (_ - a) + fu_nc_1(b_3); + b = _0_1; + b = b_2; + b = _0_1; + b = b_2; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag new file mode 100644 index 0000000000..c64818d2bf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct SwizzleTest +{ + float a; + float b; +}; + +layout(location = 0) in vec2 foo; +layout(location = 0) out float FooOut; + +void main() +{ + SwizzleTest _22 = SwizzleTest(foo.x, foo.y); + FooOut = _22.a + _22.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..57d4536c9b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/default-member-names.asm.frag @@ -0,0 +1,32 @@ +#version 450 + +struct _9 +{ + float _m0; +}; + +struct _10 +{ + float _m0; + float _m1; + float _m2; + float _m3; + float _m4; + float _m5; + float _m6; + float _m7; + float _m8; + float _m9; + float _m10; + float _m11; + _9 _m12; +}; + +layout(location = 0) out vec4 _3; + +void main() +{ + _10 _21; + _3 = vec4(_21._m0, _21._m1, _21._m2, _21._m3); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/do-while-statement-fallback.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/do-while-statement-fallback.asm.frag new file mode 100644 index 0000000000..0e6947a395 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/do-while-statement-fallback.asm.frag @@ -0,0 +1,58 @@ +#version 450 + +layout(location = 0) out float FragColor; + +void main() +{ + float foo = 1.0; + for (;;) + { + foo = 2.0; + if (false) + { + continue; + } + else + { + break; + } + } + for (;;) + { + foo = 3.0; + if (false) + { + continue; + } + else + { + break; + } + } + for (;;) + { + foo = 4.0; + if (false) + { + continue; + } + else + { + break; + } + } + for (;;) + { + foo = 5.0; + if (false) + { + continue; + } + else + { + break; + } + } + FragColor = foo; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..7c9d39338e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/empty-struct.asm.frag @@ -0,0 +1,25 @@ +#version 450 + +struct EmptyStructTest +{ + int empty_struct_member; +}; + +float GetValue(EmptyStructTest self) +{ + return 0.0; +} + +float GetValue_1(EmptyStructTest self) +{ + return 0.0; +} + +void main() +{ + EmptyStructTest _23 = EmptyStructTest(0); + EmptyStructTest emptyStruct; + float value = GetValue(emptyStruct); + value = GetValue_1(_23); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..3101142944 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + float _19; + _19 = 0.0; + float _20; + int _23; + for (int _22 = 0; _22 < 16; _19 = _20, _22 = _23) + { + _20 = _19 + 1.0; + _23 = _22 + 1; + } + FragColor = vec4(_19); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/frem.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..1095ab04f2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/frem.asm.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + FragColor = vA - vB * trunc(vA / vB); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..676f986801 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,39 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; + +vec4 foo(vec4 foo_1) +{ + return foo_1 + vec4(1.0); +} + +vec4 foo(vec3 foo_1) +{ + return foo_1.xyzz + vec4(1.0); +} + +vec4 foo_1(vec4 foo_2) +{ + return foo_2 + vec4(2.0); +} + +vec4 foo(vec2 foo_2) +{ + return foo_2.xyxy + vec4(2.0); +} + +void main() +{ + highp vec4 foo_3 = vec4(1.0); + vec4 foo_2 = foo(foo_3); + highp vec3 foo_5 = vec3(1.0); + vec4 foo_4 = foo(foo_5); + highp vec4 foo_7 = vec4(1.0); + vec4 foo_6 = foo_1(foo_7); + highp vec2 foo_9 = vec2(1.0); + vec4 foo_8 = foo(foo_9); + FragColor = ((foo_2 + foo_4) + foo_6) + foo_8; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag new file mode 100644 index 0000000000..ec89d44eef --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag @@ -0,0 +1,17 @@ +#version 450 + +uniform samplerCubeShadow SPIRV_Cross_CombinedpointLightShadowMapshadowSamplerPCF; + +layout(location = 0) out float _entryPointOutput; + +float _main() +{ + vec4 _33 = vec4(0.100000001490116119384765625, 0.100000001490116119384765625, 0.100000001490116119384765625, 0.5); + return textureGrad(SPIRV_Cross_CombinedpointLightShadowMapshadowSamplerPCF, vec4(_33.xyz, _33.w), vec3(0.0), vec3(0.0)); +} + +void main() +{ + _entryPointOutput = _main(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag new file mode 100644 index 0000000000..63856ddd46 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag @@ -0,0 +1,27 @@ +#version 450 + +uniform sampler2DArrayShadow SPIRV_Cross_CombinedShadowMapShadowSamplerPCF; + +layout(location = 0) in vec2 texCoords; +layout(location = 1) in float cascadeIndex; +layout(location = 2) in float fragDepth; +layout(location = 0) out vec4 _entryPointOutput; + +vec4 _main(vec2 texCoords_1, float cascadeIndex_1, float fragDepth_1) +{ + vec4 _60 = vec4(vec3(texCoords_1, cascadeIndex_1), fragDepth_1); + float c = textureGrad(SPIRV_Cross_CombinedShadowMapShadowSamplerPCF, vec4(_60.xyz, _60.w), vec2(0.0), vec2(0.0)); + return vec4(c, c, c, c); +} + +void main() +{ + vec2 texCoords_1 = texCoords; + float cascadeIndex_1 = cascadeIndex; + float fragDepth_1 = fragDepth; + vec2 param = texCoords_1; + float param_1 = cascadeIndex_1; + float param_2 = fragDepth_1; + _entryPointOutput = _main(param, param_1, param_2); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..ab2749b4df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out ivec2 Size; + +void main() +{ + Size = textureSize(uTexture, 0) + textureSize(uTexture, 1); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag new file mode 100644 index 0000000000..60bb78aa5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag @@ -0,0 +1,38 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombinedparamSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedparamSampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSampler; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 sample_fetch(ivec3 UV, sampler2D SPIRV_Cross_CombinedtexSPIRV_Cross_DummySampler) +{ + return texelFetch(SPIRV_Cross_CombinedtexSPIRV_Cross_DummySampler, UV.xy, UV.z); +} + +vec4 sample_sampler(vec2 UV, sampler2D SPIRV_Cross_CombinedtexSampler) +{ + return texture(SPIRV_Cross_CombinedtexSampler, UV); +} + +vec4 _main(vec4 xIn) +{ + ivec3 coord = ivec3(int(xIn.x * 1280.0), int(xIn.y * 720.0), 0); + ivec3 param = coord; + vec4 value = sample_fetch(param, SPIRV_Cross_CombinedparamSPIRV_Cross_DummySampler); + value += texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, coord.xy, coord.z); + vec2 param_1 = xIn.xy; + value += sample_sampler(param_1, SPIRV_Cross_CombinedparamSampler); + value += texture(SPIRV_Cross_CombinedSampledImageSampler, xIn.xy); + return value; +} + +void main() +{ + vec4 xIn = gl_FragCoord; + vec4 param = xIn; + _entryPointOutput = _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk new file mode 100644 index 0000000000..2dab664075 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag.vk @@ -0,0 +1,37 @@ +#version 450 +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 0) uniform sampler Sampler; +layout(set = 0, binding = 0) uniform texture2D SampledImage; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 sample_fetch(texture2D tex, ivec3 UV) +{ + return texelFetch(tex, UV.xy, UV.z); +} + +vec4 sample_sampler(texture2D tex, vec2 UV) +{ + return texture(sampler2D(tex, Sampler), UV); +} + +vec4 _main(vec4 xIn) +{ + ivec3 coord = ivec3(int(xIn.x * 1280.0), int(xIn.y * 720.0), 0); + ivec3 param = coord; + vec4 value = sample_fetch(SampledImage, param); + value += texelFetch(SampledImage, coord.xy, coord.z); + vec2 param_1 = xIn.xy; + value += sample_sampler(SampledImage, param_1); + value += texture(sampler2D(SampledImage, Sampler), xIn.xy); + return value; +} + +void main() +{ + vec4 xIn = gl_FragCoord; + vec4 param = xIn; + _entryPointOutput = _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag new file mode 100644 index 0000000000..60bb78aa5c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag @@ -0,0 +1,38 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombinedparamSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler; +uniform sampler2D SPIRV_Cross_CombinedparamSampler; +uniform sampler2D SPIRV_Cross_CombinedSampledImageSampler; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 sample_fetch(ivec3 UV, sampler2D SPIRV_Cross_CombinedtexSPIRV_Cross_DummySampler) +{ + return texelFetch(SPIRV_Cross_CombinedtexSPIRV_Cross_DummySampler, UV.xy, UV.z); +} + +vec4 sample_sampler(vec2 UV, sampler2D SPIRV_Cross_CombinedtexSampler) +{ + return texture(SPIRV_Cross_CombinedtexSampler, UV); +} + +vec4 _main(vec4 xIn) +{ + ivec3 coord = ivec3(int(xIn.x * 1280.0), int(xIn.y * 720.0), 0); + ivec3 param = coord; + vec4 value = sample_fetch(param, SPIRV_Cross_CombinedparamSPIRV_Cross_DummySampler); + value += texelFetch(SPIRV_Cross_CombinedSampledImageSPIRV_Cross_DummySampler, coord.xy, coord.z); + vec2 param_1 = xIn.xy; + value += sample_sampler(param_1, SPIRV_Cross_CombinedparamSampler); + value += texture(SPIRV_Cross_CombinedSampledImageSampler, xIn.xy); + return value; +} + +void main() +{ + vec4 xIn = gl_FragCoord; + vec4 param = xIn; + _entryPointOutput = _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk new file mode 100644 index 0000000000..e4d9fc4543 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag.vk @@ -0,0 +1,37 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler Sampler; +layout(set = 0, binding = 0) uniform texture2D SampledImage; +layout(set = 0, binding = 0) uniform sampler SPIRV_Cross_DummySampler; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 sample_fetch(texture2D tex, ivec3 UV) +{ + return texelFetch(sampler2D(tex, SPIRV_Cross_DummySampler), UV.xy, UV.z); +} + +vec4 sample_sampler(texture2D tex, vec2 UV) +{ + return texture(sampler2D(tex, Sampler), UV); +} + +vec4 _main(vec4 xIn) +{ + ivec3 coord = ivec3(int(xIn.x * 1280.0), int(xIn.y * 720.0), 0); + ivec3 param = coord; + vec4 value = sample_fetch(SampledImage, param); + value += texelFetch(sampler2D(SampledImage, SPIRV_Cross_DummySampler), coord.xy, coord.z); + vec2 param_1 = xIn.xy; + value += sample_sampler(SampledImage, param_1); + value += texture(sampler2D(SampledImage, Sampler), xIn.xy); + return value; +} + +void main() +{ + vec4 xIn = gl_FragCoord; + vec4 param = xIn; + _entryPointOutput = _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag new file mode 100644 index 0000000000..2040dd1afb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler; +uniform sampler2DMS SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler; + +void main() +{ + ivec2 b = textureSize(SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler, 0); + ivec2 c = textureSize(SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler); + int l1 = textureQueryLevels(SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler); + int s0 = textureSamples(SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk new file mode 100644 index 0000000000..828d2a8727 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(set = 0, binding = 0) uniform texture2D uSampler2D; +layout(set = 0, binding = 0) uniform texture2DMS uSampler2DMS; +layout(set = 0, binding = 0) uniform sampler SPIRV_Cross_DummySampler; + +void main() +{ + ivec2 b = textureSize(sampler2D(uSampler2D, SPIRV_Cross_DummySampler), 0); + ivec2 c = textureSize(sampler2DMS(uSampler2DMS, SPIRV_Cross_DummySampler)); + int l1 = textureQueryLevels(sampler2D(uSampler2D, SPIRV_Cross_DummySampler)); + int s0 = textureSamples(sampler2DMS(uSampler2DMS, SPIRV_Cross_DummySampler)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag new file mode 100644 index 0000000000..2040dd1afb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler; +uniform sampler2DMS SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler; + +void main() +{ + ivec2 b = textureSize(SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler, 0); + ivec2 c = textureSize(SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler); + int l1 = textureQueryLevels(SPIRV_Cross_CombineduSampler2DSPIRV_Cross_DummySampler); + int s0 = textureSamples(SPIRV_Cross_CombineduSampler2DMSSPIRV_Cross_DummySampler); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk new file mode 100644 index 0000000000..021d3a60d5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/image-query-no-sampler.vk.asm.frag.vk @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 0) uniform texture2D uSampler2D; +layout(set = 0, binding = 0) uniform texture2DMS uSampler2DMS; + +void main() +{ + ivec2 b = textureSize(uSampler2D, 0); + ivec2 c = textureSize(uSampler2DMS); + int l1 = textureQueryLevels(uSampler2D); + int s0 = textureSamples(uSampler2DMS); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..6bc1be0d0f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,39 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uImage; + +layout(location = 0) in vec4 v0; +layout(location = 0) out vec4 FragColor; + +void main() +{ + int i = 0; + float phi; + vec4 _36; + phi = 1.0; + _36 = vec4(1.0, 2.0, 1.0, 2.0); + for (;;) + { + FragColor = _36; + if (i < 4) + { + if (v0[i] > 0.0) + { + vec2 _48 = vec2(phi); + i++; + phi += 2.0; + _36 = textureLod(uImage, _48, 0.0); + continue; + } + else + { + break; + } + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant-double.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant-double.asm.frag new file mode 100644 index 0000000000..e53b282f87 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant-double.asm.frag @@ -0,0 +1,17 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif + +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in double vTmp; + +void main() +{ + FragColor = vec3(dvec3(uint64BitsToDouble(0x7ff0000000000000ul /* inf */), uint64BitsToDouble(0xfff0000000000000ul /* -inf */), uint64BitsToDouble(0x7ff8000000000000ul /* nan */)) + dvec3(vTmp)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..b5e0c6e968 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec3 FragColor; + +void main() +{ + FragColor = vec3(uintBitsToFloat(0x7f800000u /* inf */), uintBitsToFloat(0xff800000u /* -inf */), uintBitsToFloat(0x7fc00000u /* nan */)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/invalidation.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/invalidation.asm.frag new file mode 100644 index 0000000000..db1181804c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/invalidation.asm.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in float v0; +layout(location = 1) in float v1; +layout(location = 0) out float FragColor; + +void main() +{ + float a = v0; + float b = v1; + float _17 = a; + a = v1; + FragColor = (_17 + b) * b; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..35aa9f8c4b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,71 @@ +#version 450 +#extension GL_GOOGLE_cpp_style_line_directive : require + +layout(location = 0) out float FragColor; +layout(location = 0) in float vColor; + +#line 6 "test.frag" +void func() +{ +#line 8 "test.frag" + FragColor = 1.0; +#line 9 "test.frag" + FragColor = 2.0; +#line 10 "test.frag" + if (vColor < 0.0) + { +#line 12 "test.frag" + FragColor = 3.0; + } + else + { +#line 16 "test.frag" + FragColor = 4.0; + } +#line 19 "test.frag" + for (int i = 0; float(i) < (40.0 + vColor); i += (int(vColor) + 5)) + { +#line 21 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 22 "test.frag" + FragColor += 0.300000011920928955078125; + } +#line 25 "test.frag" + switch (int(vColor)) + { + case 0: + { +#line 28 "test.frag" + FragColor += 0.20000000298023223876953125; +#line 29 "test.frag" + break; + } + case 1: + { +#line 32 "test.frag" + FragColor += 0.4000000059604644775390625; +#line 33 "test.frag" + break; + } + default: + { +#line 36 "test.frag" + FragColor += 0.800000011920928955078125; +#line 37 "test.frag" + break; + } + } + do + { +#line 42 "test.frag" + FragColor += (10.0 + vColor); + } while (FragColor < 100.0); +} + +#line 46 "test.frag" +void main() +{ +#line 48 "test.frag" + func(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..95dcd9ceb7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/locations-components.asm.frag @@ -0,0 +1,25 @@ +#version 450 + +layout(location = 1) in vec2 _2; +layout(location = 1, component = 2) in float _3; +layout(location = 2) flat in float _4; +layout(location = 2, component = 1) flat in uint _5; +layout(location = 2, component = 2) flat in uint _6; +layout(location = 0) out vec4 o0; +vec4 v1; +vec4 v2; + +void main() +{ + v1 = vec4(_2.x, _2.y, v1.z, v1.w); + v1.z = _3; + v2.x = _4; + v2.y = uintBitsToFloat(_5); + v2.z = uintBitsToFloat(_6); + vec4 r0; + r0.x = intBitsToFloat(floatBitsToInt(v2.y) + floatBitsToInt(v2.z)); + o0.y = float(floatBitsToUint(r0.x)); + o0.x = v1.y + v2.x; + o0 = vec4(o0.x, o0.y, v1.z, v1.x); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag new file mode 100644 index 0000000000..3ee68e321d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag @@ -0,0 +1,63 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif + +layout(binding = 0, std140) uniform Foo +{ + layout(row_major) mat4 lightVP[64]; + uint shadowCascadesNum; + int test; +} _11; + +layout(location = 0) in vec3 fragWorld; +layout(location = 0) out int _entryPointOutput; + +mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; } + +mat4 GetClip2TexMatrix() +{ + if (_11.test == 0) + { + return mat4(vec4(0.5, 0.0, 0.0, 0.0), vec4(0.0, 0.5, 0.0, 0.0), vec4(0.0, 0.0, 0.5, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); + } + return mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0)); +} + +int GetCascade(vec3 fragWorldPosition) +{ + SPIRV_CROSS_UNROLL + for (uint cascadeIndex = 0u; cascadeIndex < _11.shadowCascadesNum; cascadeIndex++) + { + mat4 worldToShadowMap = GetClip2TexMatrix() * spvWorkaroundRowMajor(_11.lightVP[cascadeIndex]); + vec4 fragShadowMapPos = worldToShadowMap * vec4(fragWorldPosition, 1.0); + if ((((fragShadowMapPos.z >= 0.0) && (fragShadowMapPos.z <= 1.0)) && (max(fragShadowMapPos.x, fragShadowMapPos.y) <= 1.0)) && (min(fragShadowMapPos.x, fragShadowMapPos.y) >= 0.0)) + { + return int(cascadeIndex); + } + } + return -1; +} + +int _main(vec3 fragWorld_1) +{ + vec3 param = fragWorld_1; + return GetCascade(param); +} + +void main() +{ + vec3 fragWorld_1 = fragWorld; + vec3 param = fragWorld_1; + _entryPointOutput = _main(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..8a3b664bc4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,45 @@ +#version 450 + +struct Params +{ + vec4 TextureSize; + vec4 Params1; + vec4 Params2; + vec4 Params3; + vec4 Params4; + vec4 Bloom; +}; + +layout(binding = 1, std140) uniform CB1 +{ + Params CB1; +} _8; + +uniform sampler2D SPIRV_Cross_CombinedmapTexturemapSampler; + +layout(location = 0) in vec2 IN_uv; +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec2 _45 = vec2(0.0, _8.CB1.TextureSize.w); + vec4 _49 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv); + float _50 = _49.y; + float _53 = clamp((_50 * 80.0) * 0.0007999999797903001308441162109375, 7.999999797903001308441162109375e-05, 0.008000000379979610443115234375); + float _55; + float _58; + _55 = 0.0; + _58 = 0.0; + for (int _60 = -3; _60 <= 3; ) + { + float _64 = float(_60); + vec4 _72 = texture(SPIRV_Cross_CombinedmapTexturemapSampler, IN_uv + (_45 * _64)); + float _78 = exp(((-_64) * _64) * 0.2222220003604888916015625) * float(abs(_72.y - _50) < _53); + _55 += (_72.x * _78); + _58 += _78; + _60++; + continue; + } + _entryPointOutput = vec4(_55 / _58, _50, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..c08bc2c781 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,40 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _46[16] = float[](1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0); +const vec4 _76[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + +layout(location = 0) out float FragColor; +layout(location = 0) flat in mediump int index; + +void main() +{ + vec4 foobar[4] = _76; + vec4 baz[4] = _76; + FragColor = _46[index]; + if (index < 10) + { + FragColor += _46[index ^ 1]; + } + else + { + FragColor += _46[index & 1]; + } + if (index > 30) + { + FragColor += _76[index & 3].y; + } + else + { + FragColor += _76[index & 1].x; + } + if (index > 30) + { + foobar[1].z = 20.0; + } + FragColor += foobar[index & 3].z; + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[index & 3].z; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/multi-for-loop-init.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/multi-for-loop-init.asm.frag new file mode 100644 index 0000000000..b5f30a2471 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/multi-for-loop-init.asm.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int counter; + +void main() +{ + FragColor = vec4(0.0); + mediump int i = 0; + mediump uint j = 1u; + for (; (i < 10) && (int(j) < int(20u)); i += counter, j += uint(counter)) + { + FragColor += vec4(float(i)); + FragColor += vec4(float(j)); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..f293c1802a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct D +{ + vec4 a; + float b; +}; + +const vec4 _14[4] = vec4[](vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0)); + +layout(location = 0) out float FragColor; + +void main() +{ + float a = 0.0; + vec4 b = vec4(0.0); + mat2x3 c = mat2x3(vec3(0.0), vec3(0.0)); + D d = D(vec4(0.0), 0.0); + FragColor = a; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag new file mode 100644 index 0000000000..d62b63a0e0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(binding = 0, std140) uniform UBO +{ + int uCount; + int uJ; + int uK; +} _5; + +layout(location = 0) out float FragColor; + +void main() +{ + int _23; + int _23_copy; + int _24; + _23 = _5.uK; + _24 = _5.uJ; + for (int _26 = 0; _26 < _5.uCount; _23_copy = _23, _23 = _24, _24 = _23_copy, _26++) + { + } + FragColor = float(_24 - _23) * float(_5.uJ * _5.uK); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag new file mode 100644 index 0000000000..eddb3829b7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag @@ -0,0 +1,15 @@ +#version 320 es +precision mediump float; +precision highp int; + +const uint _15 = 3u; + +void main() +{ + vec3 v = vec3(0.0); + if (false) + { + v[0] = 99.0; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access.asm.frag new file mode 100644 index 0000000000..080283d412 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/out-of-bounds-access.asm.frag @@ -0,0 +1,14 @@ +#version 320 es +precision mediump float; +precision highp int; + +void main() +{ + vec3 v = vec3(0.0); + if (false) + { + v.x = 99.0; + v.x = 88.0; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/pack-and-unpack-uint2.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/pack-and-unpack-uint2.asm.frag new file mode 100644 index 0000000000..039c2b598d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/pack-and-unpack-uint2.asm.frag @@ -0,0 +1,18 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif + +layout(location = 0) out vec4 FragColor; + +void main() +{ + uint64_t _packed = packUint2x32(uvec2(18u, 52u)); + uvec2 unpacked = unpackUint2x32(_packed); + FragColor = vec4(float(unpacked.x), float(unpacked.y), 1.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..35ba2e1535 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,21 @@ +#version 450 + +struct Registers +{ + float foo; +}; + +uniform Registers registers; + +layout(location = 0) out float FragColor; + +float add_value(float v, float w) +{ + return v + w; +} + +void main() +{ + FragColor = add_value(10.0, registers.foo); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..786ac74de5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,9 @@ +#version 450 + +void main() +{ + for (int _22 = 35; _22 >= 0; _22--) + { + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..d6489ed027 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +uniform sampler2D SPIRV_Cross_Combinedg_Textureg_Sampler; +uniform sampler2DShadow SPIRV_Cross_Combinedg_Textureg_CompareSampler; + +layout(location = 0) in vec2 in_var_TEXCOORD0; +layout(location = 0) out float out_var_SV_Target; + +void main() +{ + out_var_SV_Target = texture(SPIRV_Cross_Combinedg_Textureg_Sampler, in_var_TEXCOORD0).x + textureLod(SPIRV_Cross_Combinedg_Textureg_CompareSampler, vec3(in_var_TEXCOORD0, 0.5), 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag new file mode 100644 index 0000000000..3dc1839d6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag @@ -0,0 +1,28 @@ +#version 450 + +struct Registers +{ + int index; +}; + +uniform Registers registers; + +uniform sampler2D SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[4]; + +layout(location = 0) out vec4 FragColor; + +vec4 sample_from_func(sampler2D SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler_1[4]) +{ + return texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler_1[registers.index], ivec2(4), 0); +} + +vec4 sample_one_from_func(sampler2D SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler_1) +{ + return texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler_1, ivec2(4), 0); +} + +void main() +{ + FragColor = (texelFetch(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[registers.index], ivec2(10), 0) + sample_from_func(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler)) + sample_one_from_func(SPIRV_Cross_CombineduSamplerSPIRV_Cross_DummySampler[registers.index]); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag new file mode 100644 index 0000000000..1ebf8fb96b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag @@ -0,0 +1,20 @@ +#version 450 + +layout(binding = 0, rgba32f) uniform writeonly imageBuffer RWTex; +layout(binding = 1) uniform samplerBuffer Tex; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 _main() +{ + vec4 storeTemp = vec4(1.0, 2.0, 3.0, 4.0); + imageStore(RWTex, 20, storeTemp); + return texelFetch(Tex, 10); +} + +void main() +{ + vec4 _28 = _main(); + _entryPointOutput = _28; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..9c45d8542a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,26 @@ +#version 460 + +struct myType +{ + float data; +}; + +const myType _21[5] = myType[](myType(0.0), myType(1.0), myType(0.0), myType(1.0), myType(0.0)); + +layout(location = 0) out vec4 o_color; + +void main() +{ + vec2 uv = gl_FragCoord.xy; + int index = int(mod(uv.x, 4.0)); + myType elt = _21[index]; + if (elt.data > 0.0) + { + o_color = vec4(0.0, 1.0, 0.0, 1.0); + } + else + { + o_color = vec4(1.0, 0.0, 0.0, 1.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/srem.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..05a3d7554f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/srem.asm.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in ivec4 vA; +layout(location = 1) flat in ivec4 vB; + +void main() +{ + FragColor = vec4(vA - vB * (vA / vB)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..a5faaefb30 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) out vec4 FragColors[2]; +layout(location = 2) out vec4 FragColor; +const vec4 _3_init[2] = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0)); +const vec4 _4_init = vec4(5.0); + +void main() +{ + FragColors = _3_init; + FragColor = _4_init; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag new file mode 100644 index 0000000000..7930ca3b4a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foo +{ + float var1; + float var2; +}; + +Foo _22; + +layout(binding = 0) uniform mediump sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(uSampler, vec2(_22.var1, _22.var2)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/switch-label-shared-block.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/switch-label-shared-block.asm.frag new file mode 100644 index 0000000000..748f96c8b0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/switch-label-shared-block.asm.frag @@ -0,0 +1,32 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) flat in mediump int vIndex; +layout(location = 0) out float FragColor; + +void main() +{ + highp float _19; + switch (vIndex) + { + case 0: + case 2: + { + _19 = 1.0; + break; + } + default: + { + _19 = 3.0; + break; + } + case 8: + { + _19 = 8.0; + break; + } + } + FragColor = _19; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/switch-preserve-sign-extension.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/switch-preserve-sign-extension.asm.frag new file mode 100644 index 0000000000..08921e1e92 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/switch-preserve-sign-extension.asm.frag @@ -0,0 +1,27 @@ +#version 330 +#ifdef GL_ARB_shading_language_420pack +#extension GL_ARB_shading_language_420pack : require +#endif + +void main() +{ + int sw = 42; + int result = 0; + switch (sw) + { + case -42: + { + result = 42; + } + case 420: + { + result = 420; + } + case -1234: + { + result = 420; + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/temporary-name-alias.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/temporary-name-alias.asm.frag new file mode 100644 index 0000000000..927c0434a8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/temporary-name-alias.asm.frag @@ -0,0 +1,10 @@ +#version 450 + +void main() +{ + float constituent = float(0); + mat3 _mat3 = mat3(vec3(constituent), vec3(constituent), vec3(constituent)); + float constituent_1 = float(1); + _mat3 = mat3(vec3(constituent_1), vec3(constituent_1), vec3(constituent_1)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/temporary-phi-hoisting.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/temporary-phi-hoisting.asm.frag new file mode 100644 index 0000000000..4cee76cca4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/temporary-phi-hoisting.asm.frag @@ -0,0 +1,26 @@ +#version 450 + +struct MyStruct +{ + vec4 color; +}; + +layout(binding = 0, std140) uniform MyStruct_CB +{ + MyStruct g_MyStruct[4]; +} _6; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec3 _28; + _28 = vec3(0.0); + vec3 _29; + for (int _31 = 0; _31 < 4; _28 = _29, _31++) + { + _29 = _28 + _6.g_MyStruct[_31].color.xyz; + } + _entryPointOutput = vec4(_28, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..6193de0da9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetch(uTexture, ivec2(gl_FragCoord.xy), 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag b/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag new file mode 100644 index 0000000000..e0feb49327 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag @@ -0,0 +1,19 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif + +layout(binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out f16vec4 FragColor; +layout(location = 0) in f16vec2 UV; + +void main() +{ + FragColor = f16vec4(texture(uTexture, UV)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk new file mode 100644 index 0000000000..e13e4254ea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag.vk @@ -0,0 +1,20 @@ +#version 450 +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif +#extension GL_EXT_shader_16bit_storage : require + +layout(set = 0, binding = 0) uniform sampler2D uTexture; + +layout(location = 0) out f16vec4 FragColor; +layout(location = 0) in f16vec2 UV; + +void main() +{ + FragColor = f16vec4(texture(uTexture, UV)); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..a3b1290de6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,29 @@ +#version 450 + +vec4 _38; +vec4 _47; + +layout(location = 0) out vec4 _entryPointOutput; + +void main() +{ + vec4 _27; + do + { + vec2 _26 = vec2(0.0); + if (_26.x != 0.0) + { + _27 = vec4(1.0, 0.0, 0.0, 1.0); + break; + } + else + { + _27 = vec4(1.0, 1.0, 0.0, 1.0); + break; + } + _27 = _38; + break; + } while (false); + _entryPointOutput = _27; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag b/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag new file mode 100644 index 0000000000..7729d30c09 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag @@ -0,0 +1,23 @@ +#version 450 + +layout(binding = 0) uniform sampler2DShadow uShadow; +uniform sampler2DShadow SPIRV_Cross_CombineduTextureuSampler; + +layout(location = 0) in vec3 vUV; +layout(location = 0) out float FragColor; + +float sample_combined() +{ + return texture(uShadow, vec3(vUV.xy, vUV.z)); +} + +float sample_separate() +{ + return texture(SPIRV_Cross_CombineduTextureuSampler, vec3(vUV.xy, vUV.z)); +} + +void main() +{ + FragColor = sample_combined() + sample_separate(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk b/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk new file mode 100644 index 0000000000..711fa27763 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/unknown-depth-state.asm.vk.frag.vk @@ -0,0 +1,24 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2DShadow uShadow; +layout(set = 0, binding = 1) uniform texture2D uTexture; +layout(set = 0, binding = 2) uniform samplerShadow uSampler; + +layout(location = 0) in vec3 vUV; +layout(location = 0) out float FragColor; + +float sample_combined() +{ + return texture(uShadow, vec3(vUV.xy, vUV.z)); +} + +float sample_separate() +{ + return texture(sampler2DShadow(uTexture, uSampler), vec3(vUV.xy, vUV.z)); +} + +void main() +{ + FragColor = sample_combined() + sample_separate(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..beb8708e16 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/unreachable.asm.frag @@ -0,0 +1,28 @@ +#version 450 + +vec4 _21; + +layout(location = 0) flat in int counter; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 _24; + _24 = _21; + vec4 _33; + for (;;) + { + if (counter == 10) + { + _33 = vec4(10.0); + break; + } + else + { + _33 = vec4(30.0); + break; + } + } + FragColor = _33; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/reference/shaders/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..97c9a2eb9c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,326 @@ +#version 450 +#if defined(GL_EXT_control_flow_attributes) +#extension GL_EXT_control_flow_attributes : require +#define SPIRV_CROSS_FLATTEN [[flatten]] +#define SPIRV_CROSS_BRANCH [[dont_flatten]] +#define SPIRV_CROSS_UNROLL [[unroll]] +#define SPIRV_CROSS_LOOP [[dont_unroll]] +#else +#define SPIRV_CROSS_FLATTEN +#define SPIRV_CROSS_BRANCH +#define SPIRV_CROSS_UNROLL +#define SPIRV_CROSS_LOOP +#endif + +struct _28 +{ + vec4 _m0; +}; + +_28 _74; + +layout(binding = 0, std140) uniform _6_7 +{ + vec4 _m0; + float _m1; + vec4 _m2; +} _7; + +layout(binding = 2, std140) uniform _10_11 +{ + vec3 _m0; + vec3 _m1; + float _m2; + vec3 _m3; + float _m4; + vec3 _m5; + float _m6; + vec3 _m7; + float _m8; + vec3 _m9; + float _m10; + vec3 _m11; + float _m12; + vec2 _m13; + vec2 _m14; + vec3 _m15; + float _m16; + float _m17; + float _m18; + float _m19; + float _m20; + vec4 _m21; + vec4 _m22; + layout(row_major) mat4 _m23; + vec4 _m24; +} _11; + +layout(binding = 1, std140) uniform _18_19 +{ + layout(row_major) mat4 _m0; + layout(row_major) mat4 _m1; + layout(row_major) mat4 _m2; + layout(row_major) mat4 _m3; + vec4 _m4; + vec4 _m5; + float _m6; + float _m7; + float _m8; + float _m9; + vec3 _m10; + float _m11; + vec3 _m12; + float _m13; + vec3 _m14; + float _m15; + vec3 _m16; + float _m17; + float _m18; + float _m19; + vec2 _m20; + vec2 _m21; + vec2 _m22; + vec4 _m23; + vec2 _m24; + vec2 _m25; + vec2 _m26; + vec3 _m27; + float _m28; + float _m29; + float _m30; + float _m31; + float _m32; + vec2 _m33; + float _m34; + float _m35; + vec3 _m36; + layout(row_major) mat4 _m37[2]; + vec4 _m38[2]; +} _19; + +uniform sampler2D SPIRV_Cross_Combined; +uniform sampler2D SPIRV_Cross_Combined_1; +uniform sampler2D SPIRV_Cross_Combined_2; + +layout(location = 0) out vec4 _5; + +void main() +{ + _28 _77; + _77._m0 = vec4(0.0); + vec2 _82 = gl_FragCoord.xy * _19._m23.xy; + vec4 _88 = _7._m2 * _7._m0.xyxy; + vec2 _97 = clamp(_82 + (vec3(0.0, -2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _109 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _97, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _113 = textureLod(SPIRV_Cross_Combined_1, _97, 0.0); + vec3 _129; + SPIRV_CROSS_BRANCH + if (_113.y > 0.0) + { + _129 = _109 + (textureLod(SPIRV_Cross_Combined_2, _97, 0.0).xyz * clamp(_113.y * _113.z, 0.0, 1.0)); + } + else + { + _129 = _109; + } + vec3 _133 = vec4(0.0).xyz + (_129 * 0.5); + vec4 _134 = vec4(_133.x, _133.y, _133.z, vec4(0.0).w); + _77._m0 = _134; + vec2 _144 = clamp(_82 + (vec3(-1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _156 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _144, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _160 = textureLod(SPIRV_Cross_Combined_1, _144, 0.0); + vec3 _176; + SPIRV_CROSS_BRANCH + if (_160.y > 0.0) + { + _176 = _156 + (textureLod(SPIRV_Cross_Combined_2, _144, 0.0).xyz * clamp(_160.y * _160.z, 0.0, 1.0)); + } + else + { + _176 = _156; + } + vec3 _180 = _134.xyz + (_176 * 0.5); + vec4 _181 = vec4(_180.x, _180.y, _180.z, _134.w); + _77._m0 = _181; + vec2 _191 = clamp(_82 + (vec3(0.0, -1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _203 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _191, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _207 = textureLod(SPIRV_Cross_Combined_1, _191, 0.0); + vec3 _223; + SPIRV_CROSS_BRANCH + if (_207.y > 0.0) + { + _223 = _203 + (textureLod(SPIRV_Cross_Combined_2, _191, 0.0).xyz * clamp(_207.y * _207.z, 0.0, 1.0)); + } + else + { + _223 = _203; + } + vec3 _227 = _181.xyz + (_223 * 0.75); + vec4 _228 = vec4(_227.x, _227.y, _227.z, _181.w); + _77._m0 = _228; + vec2 _238 = clamp(_82 + (vec3(1.0, -1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _250 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _238, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _254 = textureLod(SPIRV_Cross_Combined_1, _238, 0.0); + vec3 _270; + SPIRV_CROSS_BRANCH + if (_254.y > 0.0) + { + _270 = _250 + (textureLod(SPIRV_Cross_Combined_2, _238, 0.0).xyz * clamp(_254.y * _254.z, 0.0, 1.0)); + } + else + { + _270 = _250; + } + vec3 _274 = _228.xyz + (_270 * 0.5); + vec4 _275 = vec4(_274.x, _274.y, _274.z, _228.w); + _77._m0 = _275; + vec2 _285 = clamp(_82 + (vec3(-2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _297 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _285, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _301 = textureLod(SPIRV_Cross_Combined_1, _285, 0.0); + vec3 _317; + SPIRV_CROSS_BRANCH + if (_301.y > 0.0) + { + _317 = _297 + (textureLod(SPIRV_Cross_Combined_2, _285, 0.0).xyz * clamp(_301.y * _301.z, 0.0, 1.0)); + } + else + { + _317 = _297; + } + vec3 _321 = _275.xyz + (_317 * 0.5); + vec4 _322 = vec4(_321.x, _321.y, _321.z, _275.w); + _77._m0 = _322; + vec2 _332 = clamp(_82 + (vec3(-1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _344 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _332, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _348 = textureLod(SPIRV_Cross_Combined_1, _332, 0.0); + vec3 _364; + SPIRV_CROSS_BRANCH + if (_348.y > 0.0) + { + _364 = _344 + (textureLod(SPIRV_Cross_Combined_2, _332, 0.0).xyz * clamp(_348.y * _348.z, 0.0, 1.0)); + } + else + { + _364 = _344; + } + vec3 _368 = _322.xyz + (_364 * 0.75); + vec4 _369 = vec4(_368.x, _368.y, _368.z, _322.w); + _77._m0 = _369; + vec2 _379 = clamp(_82 + (vec3(0.0, 0.0, 1.0).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _391 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _379, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _395 = textureLod(SPIRV_Cross_Combined_1, _379, 0.0); + vec3 _411; + SPIRV_CROSS_BRANCH + if (_395.y > 0.0) + { + _411 = _391 + (textureLod(SPIRV_Cross_Combined_2, _379, 0.0).xyz * clamp(_395.y * _395.z, 0.0, 1.0)); + } + else + { + _411 = _391; + } + vec3 _415 = _369.xyz + (_411 * 1.0); + vec4 _416 = vec4(_415.x, _415.y, _415.z, _369.w); + _77._m0 = _416; + vec2 _426 = clamp(_82 + (vec3(1.0, 0.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _438 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _426, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _442 = textureLod(SPIRV_Cross_Combined_1, _426, 0.0); + vec3 _458; + SPIRV_CROSS_BRANCH + if (_442.y > 0.0) + { + _458 = _438 + (textureLod(SPIRV_Cross_Combined_2, _426, 0.0).xyz * clamp(_442.y * _442.z, 0.0, 1.0)); + } + else + { + _458 = _438; + } + vec3 _462 = _416.xyz + (_458 * 0.75); + vec4 _463 = vec4(_462.x, _462.y, _462.z, _416.w); + _77._m0 = _463; + vec2 _473 = clamp(_82 + (vec3(2.0, 0.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _485 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _473, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _489 = textureLod(SPIRV_Cross_Combined_1, _473, 0.0); + vec3 _505; + SPIRV_CROSS_BRANCH + if (_489.y > 0.0) + { + _505 = _485 + (textureLod(SPIRV_Cross_Combined_2, _473, 0.0).xyz * clamp(_489.y * _489.z, 0.0, 1.0)); + } + else + { + _505 = _485; + } + vec3 _509 = _463.xyz + (_505 * 0.5); + vec4 _510 = vec4(_509.x, _509.y, _509.z, _463.w); + _77._m0 = _510; + vec2 _520 = clamp(_82 + (vec3(-1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _532 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _520, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _536 = textureLod(SPIRV_Cross_Combined_1, _520, 0.0); + vec3 _552; + SPIRV_CROSS_BRANCH + if (_536.y > 0.0) + { + _552 = _532 + (textureLod(SPIRV_Cross_Combined_2, _520, 0.0).xyz * clamp(_536.y * _536.z, 0.0, 1.0)); + } + else + { + _552 = _532; + } + vec3 _556 = _510.xyz + (_552 * 0.5); + vec4 _557 = vec4(_556.x, _556.y, _556.z, _510.w); + _77._m0 = _557; + vec2 _567 = clamp(_82 + (vec3(0.0, 1.0, 0.75).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _579 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _567, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _583 = textureLod(SPIRV_Cross_Combined_1, _567, 0.0); + vec3 _599; + SPIRV_CROSS_BRANCH + if (_583.y > 0.0) + { + _599 = _579 + (textureLod(SPIRV_Cross_Combined_2, _567, 0.0).xyz * clamp(_583.y * _583.z, 0.0, 1.0)); + } + else + { + _599 = _579; + } + vec3 _603 = _557.xyz + (_599 * 0.75); + vec4 _604 = vec4(_603.x, _603.y, _603.z, _557.w); + _77._m0 = _604; + vec2 _614 = clamp(_82 + (vec3(1.0, 1.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _626 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _614, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _630 = textureLod(SPIRV_Cross_Combined_1, _614, 0.0); + vec3 _646; + SPIRV_CROSS_BRANCH + if (_630.y > 0.0) + { + _646 = _626 + (textureLod(SPIRV_Cross_Combined_2, _614, 0.0).xyz * clamp(_630.y * _630.z, 0.0, 1.0)); + } + else + { + _646 = _626; + } + vec3 _650 = _604.xyz + (_646 * 0.5); + vec4 _651 = vec4(_650.x, _650.y, _650.z, _604.w); + _77._m0 = _651; + vec2 _661 = clamp(_82 + (vec3(0.0, 2.0, 0.5).xy * _7._m0.xy), _88.xy, _88.zw); + vec3 _673 = _11._m5 * clamp(textureLod(SPIRV_Cross_Combined, _661, 0.0).w * _7._m1, 0.0, 1.0); + vec4 _677 = textureLod(SPIRV_Cross_Combined_1, _661, 0.0); + vec3 _693; + SPIRV_CROSS_BRANCH + if (_677.y > 0.0) + { + _693 = _673 + (textureLod(SPIRV_Cross_Combined_2, _661, 0.0).xyz * clamp(_677.y * _677.z, 0.0, 1.0)); + } + else + { + _693 = _673; + } + vec3 _697 = _651.xyz + (_693 * 0.5); + vec4 _698 = vec4(_697.x, _697.y, _697.z, _651.w); + _77._m0 = _698; + vec3 _702 = _698.xyz / vec3(((((((((((((0.0 + 0.5) + 0.5) + 0.75) + 0.5) + 0.5) + 0.75) + 1.0) + 0.75) + 0.5) + 0.5) + 0.75) + 0.5) + 0.5); + _77._m0 = vec4(_702.x, _702.y, _702.z, _698.w); + _77._m0.w = 1.0; + _5 = _77._m0; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/geom/block-name-namespace.asm.geom b/third_party/spirv-cross/reference/shaders/asm/geom/block-name-namespace.asm.geom new file mode 100644 index 0000000000..417cf34210 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/geom/block-name-namespace.asm.geom @@ -0,0 +1,33 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 4, triangle_strip) out; + +layout(binding = 0, std140) uniform VertexInput +{ + vec4 a; +} VertexInput_1; + +layout(binding = 0, std430) buffer VertexInput +{ + vec4 b; +} VertexInput_2; + +layout(location = 0) out VertexInput +{ + vec4 vColor; +} VertexInput_3; + +layout(location = 0) in VertexInput +{ + vec4 vColor; +} vin[3]; + + +void main() +{ + vec4 VertexInput_4 = vec4(1.0); + gl_Position = (VertexInput_4 + VertexInput_1.a) + VertexInput_2.b; + VertexInput_3.vColor = vin[0].vColor; + EmitVertex(); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/geom/inout-split-access-chain-handle.asm.geom b/third_party/spirv-cross/reference/shaders/asm/geom/inout-split-access-chain-handle.asm.geom new file mode 100644 index 0000000000..71082099e7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/geom/inout-split-access-chain-handle.asm.geom @@ -0,0 +1,23 @@ +#version 440 +layout(triangles) in; +layout(max_vertices = 5, triangle_strip) out; + +struct Data +{ + vec4 ApiPerspectivePosition; +}; + +void Copy(inout Data inputStream[3]) +{ + inputStream[0].ApiPerspectivePosition = gl_in[0].gl_Position; +} + +void main() +{ + Data inputStream[3]; + Data param[3] = inputStream; + Copy(param); + inputStream = param; + gl_Position = inputStream[0].ApiPerspectivePosition; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/geom/split-access-chain-input.asm.geom b/third_party/spirv-cross/reference/shaders/asm/geom/split-access-chain-input.asm.geom new file mode 100644 index 0000000000..511d87fcbe --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/geom/split-access-chain-input.asm.geom @@ -0,0 +1,9 @@ +#version 440 +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/geom/unroll-glposition-load.asm.geom b/third_party/spirv-cross/reference/shaders/asm/geom/unroll-glposition-load.asm.geom new file mode 100644 index 0000000000..39bc097d89 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/geom/unroll-glposition-load.asm.geom @@ -0,0 +1,35 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +struct SceneOut +{ + vec4 pos; +}; + +void _main(vec4 positions[3], SceneOut OUT) +{ + SceneOut o; + for (int i = 0; i < 3; i++) + { + o.pos = positions[i]; + gl_Position = o.pos; + EmitVertex(); + } + EndPrimitive(); +} + +void main() +{ + vec4 _35_unrolled[3]; + for (int i = 0; i < int(3); i++) + { + _35_unrolled[i] = gl_in[i].gl_Position; + } + vec4 positions[3] = _35_unrolled; + vec4 param[3] = positions; + SceneOut param_1; + _main(param, param_1); + SceneOut OUT = param_1; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/tese/unroll-input-array-load.asm.tese b/third_party/spirv-cross/reference/shaders/asm/tese/unroll-input-array-load.asm.tese new file mode 100644 index 0000000000..34970b82eb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/tese/unroll-input-array-load.asm.tese @@ -0,0 +1,48 @@ +#version 450 +layout(quads) in; + +struct HS_INPUT +{ + vec4 foo; + vec4 bar; +}; + +struct ControlPoint +{ + vec4 baz; +}; + +struct DS_OUTPUT +{ + vec4 pos; +}; + +layout(location = 0) patch in vec4 input_foo; +layout(location = 1) patch in vec4 input_bar; +layout(location = 2) in ControlPoint CPData[]; + +DS_OUTPUT _main(HS_INPUT _input, vec2 uv, ControlPoint CPData_1[4]) +{ + DS_OUTPUT o; + o.pos = (((_input.foo + _input.bar) + uv.xyxy) + CPData_1[0].baz) + CPData_1[3].baz; + return o; +} + +void main() +{ + HS_INPUT _input; + _input.foo = input_foo; + _input.bar = input_bar; + vec2 uv = vec2(gl_TessCoord.xy); + ControlPoint _54_unrolled[4]; + for (int i = 0; i < int(4); i++) + { + _54_unrolled[i] = CPData[i]; + } + ControlPoint CPData_1[4] = _54_unrolled; + HS_INPUT param = _input; + vec2 param_1 = uv; + ControlPoint param_2[4] = CPData_1; + gl_Position = _main(param, param_1, param_2).pos; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/empty-io.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/empty-io.asm.vert new file mode 100644 index 0000000000..91e65d6d7a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/empty-io.asm.vert @@ -0,0 +1,35 @@ +#version 450 + +struct VSInput +{ + vec4 position; +}; + +struct VSOutput +{ + vec4 position; +}; + +struct VSOutput_1 +{ + int empty_struct_member; +}; + +layout(location = 0) in vec4 position; +layout(location = 0) out VSOutput_1 _entryPointOutput; + +VSOutput _main(VSInput _input) +{ + VSOutput _out; + _out.position = _input.position; + return _out; +} + +void main() +{ + VSInput _input; + _input.position = position; + VSInput param = _input; + gl_Position = _main(param).position; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..40eef2d09d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,52 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct V2F +{ + vec4 Position; + vec4 Color; +}; + +struct InstanceData +{ + mat4 MATRIX_MVP; + vec4 Color; +}; + +layout(binding = 0, std430) readonly buffer gInstanceData +{ + layout(row_major) InstanceData _data[]; +} gInstanceData_1; + +layout(location = 0) in vec3 PosL; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) out vec4 _entryPointOutput_Color; + +V2F _VS(vec3 PosL_1, uint instanceID) +{ + InstanceData instData; + instData.MATRIX_MVP = gInstanceData_1._data[instanceID].MATRIX_MVP; + instData.Color = gInstanceData_1._data[instanceID].Color; + V2F v2f; + v2f.Position = instData.MATRIX_MVP * vec4(PosL_1, 1.0); + v2f.Color = instData.Color; + return v2f; +} + +void main() +{ + vec3 PosL_1 = PosL; + uint instanceID = uint((gl_InstanceID + SPIRV_Cross_BaseInstance)); + vec3 param = PosL_1; + uint param_1 = instanceID; + V2F flattenTemp = _VS(param, param_1); + gl_Position = flattenTemp.Position; + _entryPointOutput_Color = flattenTemp.Color; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/global-builtin.sso.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/global-builtin.sso.asm.vert new file mode 100644 index 0000000000..7578827019 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/global-builtin.sso.asm.vert @@ -0,0 +1,35 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +struct VSOut +{ + float a; + vec4 pos; +}; + +struct VSOut_1 +{ + float a; +}; + +layout(location = 0) out VSOut_1 _entryPointOutput; + +VSOut _main() +{ + VSOut vout; + vout.a = 40.0; + vout.pos = vec4(1.0); + return vout; +} + +void main() +{ + VSOut flattenTemp = _main(); + _entryPointOutput.a = flattenTemp.a; + gl_Position = flattenTemp.pos; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.asm.vert new file mode 100644 index 0000000000..9b2f05a8bd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.asm.vert @@ -0,0 +1,9 @@ +#version 450 + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.sso.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.sso.asm.vert new file mode 100644 index 0000000000..eb88694196 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/invariant-block.sso.asm.vert @@ -0,0 +1,17 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/invariant.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/invariant.asm.vert new file mode 100644 index 0000000000..c4c6ad6ba2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/invariant.asm.vert @@ -0,0 +1,15 @@ +#version 450 + +invariant gl_Position; + +vec4 _main() +{ + return vec4(1.0); +} + +void main() +{ + vec4 _14 = _main(); + gl_Position = _14; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/invariant.sso.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/invariant.sso.asm.vert new file mode 100644 index 0000000000..c486be1840 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/invariant.sso.asm.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +invariant gl_Position; + +vec4 _main() +{ + return vec4(1.0); +} + +void main() +{ + vec4 _14 = _main(); + gl_Position = _14; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert new file mode 100644 index 0000000000..daf0071ae7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -0,0 +1,35 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_201 +#define SPIRV_CROSS_CONSTANT_ID_201 -10 +#endif +const int _7 = SPIRV_CROSS_CONSTANT_ID_201; +const int _20 = (_7 + 2); +#ifndef SPIRV_CROSS_CONSTANT_ID_202 +#define SPIRV_CROSS_CONSTANT_ID_202 100u +#endif +const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; +const uint _25 = (_8 % 5u); +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; +#ifndef SPIRV_CROSS_CONSTANT_ID_200 +#define SPIRV_CROSS_CONSTANT_ID_200 3.141590118408203125 +#endif +const float _9 = SPIRV_CROSS_CONSTANT_ID_200; + +layout(location = 0) flat out int _4; + +void main() +{ + vec4 pos = vec4(0.0); + pos.y += float(_20); + pos.z += float(_25); + pos += vec4(_32); + vec2 _58 = pos.xy + vec2(_34); + pos = vec4(_58.x, _58.y, pos.z, pos.w); + gl_Position = pos; + _4 = _35; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk b/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk new file mode 100644 index 0000000000..4cddf82138 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk @@ -0,0 +1,30 @@ +#version 450 + +layout(constant_id = 201) const int _7 = -10; +const int _20 = (_7 + 2); +layout(constant_id = 202) const uint _8 = 100u; +const uint _25 = (_8 % 5u); +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; +layout(constant_id = 200) const float _9 = 3.141590118408203125; + +layout(location = 0) flat out int _4; + +void main() +{ + vec4 pos = vec4(0.0); + float _42 = float(_20); + pos.y += _42; + float _47 = float(_25); + pos.z += _47; + vec4 _52 = vec4(_32); + pos += _52; + vec2 _55 = vec2(_34); + vec2 _58 = pos.xy + _55; + pos = vec4(_58.x, _58.y, pos.z, pos.w); + gl_Position = pos; + _4 = _35; +} + diff --git a/third_party/spirv-cross/reference/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/reference/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..d79c08f8a3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,25 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif + +vec4 _main(uint vid, uint iid) +{ + return vec4(float(vid + iid)); +} + +void main() +{ + uint vid = uint(gl_VertexID); + uint iid = uint((gl_InstanceID + SPIRV_Cross_BaseInstance)); + uint param = vid; + uint param_1 = iid; + gl_Position = _main(param, param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/atomic.comp b/third_party/spirv-cross/reference/shaders/comp/atomic.comp new file mode 100644 index 0000000000..89b1351c0c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/atomic.comp @@ -0,0 +1,49 @@ +#version 310 es +#extension GL_OES_shader_image_atomic : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 2, std430) buffer SSBO +{ + uint u32; + int i32; +} ssbo; + +layout(binding = 0, r32ui) uniform highp uimage2D uImage; +layout(binding = 1, r32i) uniform highp iimage2D iImage; + +void main() +{ + uint _19 = imageAtomicAdd(uImage, ivec2(1, 5), 1u); + uint _27 = imageAtomicAdd(uImage, ivec2(1, 5), 1u); + imageStore(iImage, ivec2(1, 6), ivec4(int(_27))); + uint _32 = imageAtomicOr(uImage, ivec2(1, 5), 1u); + uint _34 = imageAtomicXor(uImage, ivec2(1, 5), 1u); + uint _36 = imageAtomicAnd(uImage, ivec2(1, 5), 1u); + uint _38 = imageAtomicMin(uImage, ivec2(1, 5), 1u); + uint _40 = imageAtomicMax(uImage, ivec2(1, 5), 1u); + uint _44 = imageAtomicCompSwap(uImage, ivec2(1, 5), 10u, 2u); + int _47 = imageAtomicAdd(iImage, ivec2(1, 6), 1); + int _49 = imageAtomicOr(iImage, ivec2(1, 6), 1); + int _51 = imageAtomicXor(iImage, ivec2(1, 6), 1); + int _53 = imageAtomicAnd(iImage, ivec2(1, 6), 1); + int _55 = imageAtomicMin(iImage, ivec2(1, 6), 1); + int _57 = imageAtomicMax(iImage, ivec2(1, 6), 1); + int _61 = imageAtomicCompSwap(iImage, ivec2(1, 5), 10, 2); + uint _68 = atomicAdd(ssbo.u32, 1u); + uint _70 = atomicOr(ssbo.u32, 1u); + uint _72 = atomicXor(ssbo.u32, 1u); + uint _74 = atomicAnd(ssbo.u32, 1u); + uint _76 = atomicMin(ssbo.u32, 1u); + uint _78 = atomicMax(ssbo.u32, 1u); + uint _80 = atomicExchange(ssbo.u32, 1u); + uint _82 = atomicCompSwap(ssbo.u32, 10u, 2u); + int _85 = atomicAdd(ssbo.i32, 1); + int _87 = atomicOr(ssbo.i32, 1); + int _89 = atomicXor(ssbo.i32, 1); + int _91 = atomicAnd(ssbo.i32, 1); + int _93 = atomicMin(ssbo.i32, 1); + int _95 = atomicMax(ssbo.i32, 1); + int _97 = atomicExchange(ssbo.i32, 1); + int _99 = atomicCompSwap(ssbo.i32, 10, 2); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/bake_gradient.comp b/third_party/spirv-cross/reference/shaders/comp/bake_gradient.comp new file mode 100644 index 0000000000..49fa953244 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/bake_gradient.comp @@ -0,0 +1,39 @@ +#version 310 es +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 4, std140) uniform UBO +{ + vec4 uInvSize; + vec4 uScale; +} _46; + +layout(binding = 0) uniform mediump sampler2D uHeight; +layout(binding = 1) uniform mediump sampler2D uDisplacement; +layout(binding = 2, rgba16f) uniform writeonly mediump image2D iHeightDisplacement; +layout(binding = 3, rgba16f) uniform writeonly mediump image2D iGradJacobian; + +mediump float jacobian(mediump vec2 dDdx, mediump vec2 dDdy) +{ + return ((1.0 + dDdx.x) * (1.0 + dDdy.y)) - (dDdx.y * dDdy.x); +} + +void main() +{ + vec4 uv = (vec2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5); + float h = textureLod(uHeight, uv.xy, 0.0).x; + float x0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(-1, 0)).x; + float x1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(1, 0)).x; + float y0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, -1)).x; + float y1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, 1)).x; + vec2 grad = (_46.uScale.xy * 0.5) * vec2(x1 - x0, y1 - y0); + vec2 displacement = textureLod(uDisplacement, uv.zw, 0.0).xy * 1.2000000476837158203125; + vec2 dDdx = (textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(1, 0)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(-1, 0)).xy) * 0.60000002384185791015625; + vec2 dDdy = (textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, 1)).xy - textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, -1)).xy) * 0.60000002384185791015625; + mediump vec2 param = dDdx * _46.uScale.z; + mediump vec2 param_1 = dDdy * _46.uScale.z; + float j = jacobian(param, param_1); + displacement = vec2(0.0); + imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(h, displacement, 0.0)); + imageStore(iGradJacobian, ivec2(gl_GlobalInvocationID.xy), vec4(grad, j, 0.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/barriers.comp b/third_party/spirv-cross/reference/shaders/comp/barriers.comp new file mode 100644 index 0000000000..1102c91e28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/barriers.comp @@ -0,0 +1,77 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +void barrier_shared() +{ + memoryBarrierShared(); +} + +void full_barrier() +{ + memoryBarrier(); +} + +void image_barrier() +{ + memoryBarrierImage(); +} + +void buffer_barrier() +{ + memoryBarrierBuffer(); +} + +void group_barrier() +{ + groupMemoryBarrier(); +} + +void barrier_shared_exec() +{ + barrier(); +} + +void full_barrier_exec() +{ + memoryBarrier(); + barrier(); +} + +void image_barrier_exec() +{ + memoryBarrierImage(); + barrier(); +} + +void buffer_barrier_exec() +{ + memoryBarrierBuffer(); + barrier(); +} + +void group_barrier_exec() +{ + groupMemoryBarrier(); + barrier(); +} + +void exec_barrier() +{ + barrier(); +} + +void main() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + exec_barrier(); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/basic.comp b/third_party/spirv-cross/reference/shaders/comp/basic.comp new file mode 100644 index 0000000000..1485089951 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/basic.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _45; + +layout(binding = 2, std430) buffer SSBO3 +{ + uint counter; +} _48; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idata = _23.in_data[ident]; + if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875) + { + uint _52 = atomicAdd(_48.counter, 1u); + _45.out_data[_52] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/casts.comp b/third_party/spirv-cross/reference/shaders/comp/casts.comp new file mode 100644 index 0000000000..b98890a4dd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/casts.comp @@ -0,0 +1,19 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +} _21; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +} _27; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + _21.outputs[ident] = ivec4(notEqual((_27.inputs[ident] & ivec4(3)), ivec4(uvec4(0u)))); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/reference/shaders/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..72bde44a90 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/cfg-preserve-parameter.comp @@ -0,0 +1,74 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +void out_test_0(int cond, out int i) +{ + if (cond == 0) + { + i = 40; + } + else + { + i = 60; + } +} + +void out_test_1(int cond, out int i) +{ + switch (cond) + { + case 40: + { + i = 40; + break; + } + default: + { + i = 70; + break; + } + } +} + +void inout_test_0(int cond, inout int i) +{ + if (cond == 0) + { + i = 40; + } +} + +void inout_test_1(int cond, inout int i) +{ + switch (cond) + { + case 40: + { + i = 40; + break; + } + } +} + +void main() +{ + int cond = 40; + int i = 50; + int param = cond; + int param_1 = i; + out_test_0(param, param_1); + i = param_1; + int param_2 = cond; + int param_3 = i; + out_test_1(param_2, param_3); + i = param_3; + int param_4 = cond; + int param_5 = i; + inout_test_0(param_4, param_5); + i = param_5; + int param_6 = cond; + int param_7 = i; + inout_test_1(param_6, param_7); + i = param_7; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/cfg.comp b/third_party/spirv-cross/reference/shaders/comp/cfg.comp new file mode 100644 index 0000000000..77ad312cda --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/cfg.comp @@ -0,0 +1,81 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float data; +} _11; + +void test() +{ + if (_11.data != 0.0) + { + float tmp = 10.0; + _11.data = tmp; + } + else + { + float tmp_1 = 15.0; + _11.data = tmp_1; + } + if (_11.data != 0.0) + { + float e; + if (_11.data != 5.0) + { + if (_11.data != 6.0) + { + e = 10.0; + } + } + else + { + e = 20.0; + } + } + switch (int(_11.data)) + { + case 0: + { + float tmp_2 = 20.0; + _11.data = tmp_2; + break; + } + case 1: + { + float tmp_3 = 30.0; + _11.data = tmp_3; + break; + } + } + float f; + switch (int(_11.data)) + { + case 0: + { + f = 30.0; + break; + } + case 1: + { + f = 40.0; + break; + } + } + float h; + for (int i = 0; i < 20; i++, h += 10.0) + { + } + _11.data = h; + float m; + do + { + } while (m != 20.0); + _11.data = m; +} + +void main() +{ + test(); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/coherent-block.comp b/third_party/spirv-cross/reference/shaders/comp/coherent-block.comp new file mode 100644 index 0000000000..bfab6bbea8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/coherent-block.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) coherent restrict writeonly buffer SSBO +{ + vec4 value; +} _10; + +void main() +{ + _10.value = vec4(20.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/coherent-image.comp b/third_party/spirv-cross/reference/shaders/comp/coherent-image.comp new file mode 100644 index 0000000000..b3992f242e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/coherent-image.comp @@ -0,0 +1,15 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) coherent restrict writeonly buffer SSBO +{ + ivec4 value; +} _10; + +layout(binding = 3, r32i) uniform coherent restrict readonly mediump iimage2D uImage; + +void main() +{ + _10.value = imageLoad(uImage, ivec2(10)); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/composite-array-initialization.comp b/third_party/spirv-cross/reference/shaders/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..847a152009 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/composite-array-initialization.comp @@ -0,0 +1,38 @@ +#version 310 es +layout(local_size_x = 2, local_size_y = 1, local_size_z = 1) in; + +struct Data +{ + float a; + float b; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 4.0 +#endif +const float X = SPIRV_CROSS_CONSTANT_ID_0; + +layout(binding = 0, std430) buffer SSBO +{ + Data outdata[]; +} _53; + +Data data[2]; +Data data2[2]; + +Data combine(Data a, Data b) +{ + return Data(a.a + b.a, a.b + b.b); +} + +void main() +{ + data = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); + data2 = Data[](Data(X, 2.0), Data(3.0, 5.0)); + Data param = data[gl_LocalInvocationID.x]; + Data param_1 = data2[gl_LocalInvocationID.x]; + Data _73 = combine(param, param_1); + _53.outdata[gl_WorkGroupID.x].a = _73.a; + _53.outdata[gl_WorkGroupID.x].b = _73.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/composite-construct.comp b/third_party/spirv-cross/reference/shaders/comp/composite-construct.comp new file mode 100644 index 0000000000..b397550725 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/composite-construct.comp @@ -0,0 +1,40 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +const vec4 _66[2] = vec4[](vec4(10.0), vec4(30.0)); + +struct Composite +{ + vec4 a[2]; + vec4 b[2]; +}; + +const float _94[2][3] = float[][](float[](1.0, 1.0, 1.0), float[](2.0, 2.0, 2.0)); + +layout(binding = 0, std430) buffer SSBO0 +{ + vec4 as[]; +} _41; + +layout(binding = 1, std430) buffer SSBO1 +{ + vec4 bs[]; +} _55; + +vec4 summe(vec4 values[3][2]) +{ + return ((values[0][0] + values[2][1]) + values[0][1]) + values[1][0]; +} + +void main() +{ + vec4 values[2] = vec4[](_41.as[gl_GlobalInvocationID.x], _55.bs[gl_GlobalInvocationID.x]); + vec4 copy_values[2] = _66; + vec4 copy_values2[2] = values; + vec4 param[3][2] = vec4[][](values, copy_values, copy_values2); + _41.as[gl_GlobalInvocationID.x] = summe(param); + Composite c = Composite(values, copy_values); + float b = 10.0; + float values_scalar[4] = float[](b, b, b, b); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/culling.comp b/third_party/spirv-cross/reference/shaders/comp/culling.comp new file mode 100644 index 0000000000..fd83bfcb5b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/culling.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + float in_data[]; +} _22; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + float out_data[]; +} _38; + +layout(binding = 2, std430) buffer SSBO3 +{ + uint count; +} _41; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = _22.in_data[ident]; + if (idata > 12.0) + { + uint _45 = atomicAdd(_41.count, 1u); + _38.out_data[_45] = idata; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/defer-parens.comp b/third_party/spirv-cross/reference/shaders/comp/defer-parens.comp new file mode 100644 index 0000000000..cf98529316 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/defer-parens.comp @@ -0,0 +1,21 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data; + int index; +} _13; + +void main() +{ + vec4 d = _13.data; + _13.data = vec4(d.x, d.yz + vec2(10.0), d.w); + _13.data = (d + d) + d; + _13.data = (d.yz + vec2(10.0)).xxyy; + float t = (d.yz + vec2(10.0)).y; + _13.data = vec4(t); + t = (d.zw + vec2(10.0))[_13.index]; + _13.data = vec4(t); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/dowhile.comp b/third_party/spirv-cross/reference/shaders/comp/dowhile.comp new file mode 100644 index 0000000000..e717961abd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/dowhile.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +} _28; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _52; + +int i; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + i = 0; + vec4 idat = _28.in_data[ident]; + do + { + idat = _28.mvp * idat; + i++; + } while (i < 16); + _52.out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/generate_height.comp b/third_party/spirv-cross/reference/shaders/comp/generate_height.comp new file mode 100644 index 0000000000..e482bf0ca5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/generate_height.comp @@ -0,0 +1,95 @@ +#version 310 es +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer Distribution +{ + vec2 distribution[]; +} _137; + +layout(binding = 2, std140) uniform UBO +{ + vec4 uModTime; +} _166; + +layout(binding = 1, std430) writeonly buffer HeightmapFFT +{ + uint heights[]; +} _225; + +uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel) +{ + uint _86; + if (sel.x) + { + _86 = b.x; + } + else + { + _86 = a.x; + } + uint _97; + if (sel.y) + { + _97 = b.y; + } + else + { + _97 = a.y; + } + return uvec2(_86, _97); +} + +vec2 alias(vec2 i, vec2 N) +{ + return mix(i, i - N, greaterThan(i, N * 0.5)); +} + +vec2 cmul(vec2 a, vec2 b) +{ + vec2 r3 = a.yx; + vec2 r1 = b.xx; + vec2 R0 = a * r1; + vec2 r2 = b.yy; + vec2 R1 = r2 * r3; + return R0 + vec2(-R1.x, R1.y); +} + +uint pack2(vec2 v) +{ + return packHalf2x16(v); +} + +void generate_heightmap() +{ + uvec2 N = uvec2(64u, 1u) * gl_NumWorkGroups.xy; + uvec2 i = gl_GlobalInvocationID.xy; + uvec2 param = N - i; + uvec2 param_1 = uvec2(0u); + bvec2 param_2 = equal(i, uvec2(0u)); + uvec2 wi = workaround_mix(param, param_1, param_2); + vec2 a = _137.distribution[(i.y * N.x) + i.x]; + vec2 b = _137.distribution[(wi.y * N.x) + wi.x]; + vec2 param_3 = vec2(i); + vec2 param_4 = vec2(N); + vec2 k = _166.uModTime.xy * alias(param_3, param_4); + float k_len = length(k); + float w = sqrt(9.81000041961669921875 * k_len) * _166.uModTime.z; + float cw = cos(w); + float sw = sin(w); + vec2 param_5 = a; + vec2 param_6 = vec2(cw, sw); + a = cmul(param_5, param_6); + vec2 param_7 = b; + vec2 param_8 = vec2(cw, sw); + b = cmul(param_7, param_8); + b = vec2(b.x, -b.y); + vec2 res = a + b; + vec2 param_9 = res; + _225.heights[(i.y * N.x) + i.x] = pack2(param_9); +} + +void main() +{ + generate_heightmap(); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/image.comp b/third_party/spirv-cross/reference/shaders/comp/image.comp new file mode 100644 index 0000000000..b2bf0d65bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/image.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, rgba8) uniform readonly mediump image2D uImageIn; +layout(binding = 1, rgba8) uniform writeonly mediump image2D uImageOut; + +void main() +{ + vec4 v = imageLoad(uImageIn, ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn)); + imageStore(uImageOut, ivec2(gl_GlobalInvocationID.xy), v); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/insert.comp b/third_party/spirv-cross/reference/shaders/comp/insert.comp new file mode 100644 index 0000000000..cbe1e27f45 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/insert.comp @@ -0,0 +1,19 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + vec4 out_data[]; +} _27; + +void main() +{ + vec4 v; + v.x = 10.0; + v.y = 30.0; + v.z = 70.0; + v.w = 90.0; + _27.out_data[gl_GlobalInvocationID.x] = v; + _27.out_data[gl_GlobalInvocationID.x].y = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/mat3.comp b/third_party/spirv-cross/reference/shaders/comp/mat3.comp new file mode 100644 index 0000000000..2b050f5d01 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/mat3.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + mat3 out_data[]; +} _22; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + _22.out_data[ident] = mat3(vec3(10.0), vec3(20.0), vec3(40.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/mod.comp b/third_party/spirv-cross/reference/shaders/comp/mod.comp new file mode 100644 index 0000000000..4be0c5f7f4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/mod.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _33; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 v = mod(_23.in_data[ident], _33.out_data[ident]); + _33.out_data[ident] = v; + uvec4 vu = floatBitsToUint(_23.in_data[ident]) % floatBitsToUint(_33.out_data[ident]); + _33.out_data[ident] = uintBitsToFloat(vu); + ivec4 vi = floatBitsToInt(_23.in_data[ident]) % floatBitsToInt(_33.out_data[ident]); + _33.out_data[ident] = intBitsToFloat(vi); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/modf.comp b/third_party/spirv-cross/reference/shaders/comp/modf.comp new file mode 100644 index 0000000000..c92149bf94 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/modf.comp @@ -0,0 +1,22 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 in_data[]; +} _23; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _35; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 i; + vec4 _31 = modf(_23.in_data[ident], i); + vec4 v = _31; + _35.out_data[ident] = v; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/outer-product.comp b/third_party/spirv-cross/reference/shaders/comp/outer-product.comp new file mode 100644 index 0000000000..d31dad3b2c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/outer-product.comp @@ -0,0 +1,36 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + mat2 m22; + mat2x3 m23; + mat2x4 m24; + mat3x2 m32; + mat3 m33; + mat3x4 m34; + mat4x2 m42; + mat4x3 m43; + mat4 m44; +} _21; + +layout(binding = 1, std430) readonly buffer ReadSSBO +{ + vec2 v2; + vec3 v3; + vec4 v4; +} _26; + +void main() +{ + _21.m22 = outerProduct(_26.v2, _26.v2); + _21.m23 = outerProduct(_26.v3, _26.v2); + _21.m24 = outerProduct(_26.v4, _26.v2); + _21.m32 = outerProduct(_26.v2, _26.v3); + _21.m33 = outerProduct(_26.v3, _26.v3); + _21.m34 = outerProduct(_26.v4, _26.v3); + _21.m42 = outerProduct(_26.v2, _26.v4); + _21.m43 = outerProduct(_26.v3, _26.v4); + _21.m44 = outerProduct(_26.v4, _26.v4); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/read-write-only.comp b/third_party/spirv-cross/reference/shaders/comp/read-write-only.comp new file mode 100644 index 0000000000..06227ee2c6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/read-write-only.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 2, std430) restrict writeonly buffer SSBO2 +{ + vec4 data4; + vec4 data5; +} _10; + +layout(binding = 0, std430) readonly buffer SSBO0 +{ + vec4 data0; + vec4 data1; +} _15; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + vec4 data2; + vec4 data3; +} _21; + +void main() +{ + _10.data4 = _15.data0 + _21.data2; + _10.data5 = _15.data1 + _21.data3; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/rmw-matrix.comp b/third_party/spirv-cross/reference/shaders/comp/rmw-matrix.comp new file mode 100644 index 0000000000..5c4ac94bc7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/rmw-matrix.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; + vec4 b; + mat4 c; + float a1; + vec4 b1; + mat4 c1; +} _11; + +void main() +{ + _11.a *= _11.a1; + _11.b *= _11.b1; + _11.c = _11.c * _11.c1; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/rmw-opt.comp b/third_party/spirv-cross/reference/shaders/comp/rmw-opt.comp new file mode 100644 index 0000000000..e3fba7810d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/rmw-opt.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + int a; +} _9; + +void main() +{ + _9.a += 10; + _9.a -= 10; + _9.a *= 10; + _9.a /= 10; + _9.a = _9.a << 2; + _9.a = _9.a >> 3; + _9.a &= 40; + _9.a ^= 10; + _9.a %= 40; + _9.a |= 1; + bool c = false; + bool d = true; + c = c && d; + d = d || c; + _9.a = int(c && d); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/reference/shaders/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..c28face28a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,19 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float a; + float b; + float c; + float d; + float e; +} _9; + +void main() +{ + _9.c = distance(_9.a, _9.b); + _9.d = length(_9.a); + _9.e = normalize(_9.a); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/shared.comp b/third_party/spirv-cross/reference/shaders/comp/shared.comp new file mode 100644 index 0000000000..545ef22e61 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/shared.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + float in_data[]; +} _22; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + float out_data[]; +} _44; + +shared float sShared[4]; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = _22.in_data[ident]; + sShared[gl_LocalInvocationIndex] = idata; + barrier(); + _44.out_data[ident] = sShared[(4u - gl_LocalInvocationIndex) - 1u]; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/ssbo-array-length.comp b/third_party/spirv-cross/reference/shaders/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..ddc666e9b9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/ssbo-array-length.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +} _11; + +void main() +{ + _11.size = uint(int(uint(_11.v.length()))); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/ssbo-array.comp b/third_party/spirv-cross/reference/shaders/comp/ssbo-array.comp new file mode 100644 index 0000000000..e773bd093c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/ssbo-array.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data[]; +} ssbos[2]; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + ssbos[1].data[ident] = ssbos[0].data[ident]; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/struct-layout.comp b/third_party/spirv-cross/reference/shaders/comp/struct-layout.comp new file mode 100644 index 0000000000..4feea8be54 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/struct-layout.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + mat4 m; +}; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + Foo out_data[]; +} _23; + +layout(binding = 0, std430) readonly buffer SSBO +{ + Foo in_data[]; +} _30; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + _23.out_data[ident].m = _30.in_data[ident].m * _30.in_data[ident].m; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/struct-packing.comp b/third_party/spirv-cross/reference/shaders/comp/struct-packing.comp new file mode 100644 index 0000000000..f4b58342d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/struct-packing.comp @@ -0,0 +1,104 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + S4 m3s[8]; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + mat2 m0; + mat2 m1; + mat2x3 m2[4]; + mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0]; + ssbo_430.content.m0s[0].b = ssbo_140.content.m0s[0].b; + ssbo_430.content.m1s[0].a = ssbo_140.content.m1s[0].a; + ssbo_430.content.m1s[0].b = ssbo_140.content.m1s[0].b; + ssbo_430.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0]; + ssbo_430.content.m2s[0].b = ssbo_140.content.m2s[0].b; + ssbo_430.content.m0.a[0] = ssbo_140.content.m0.a[0]; + ssbo_430.content.m0.b = ssbo_140.content.m0.b; + ssbo_430.content.m1.a = ssbo_140.content.m1.a; + ssbo_430.content.m1.b = ssbo_140.content.m1.b; + ssbo_430.content.m2.a[0] = ssbo_140.content.m2.a[0]; + ssbo_430.content.m2.b = ssbo_140.content.m2.b; + ssbo_430.content.m3.a = ssbo_140.content.m3.a; + ssbo_430.content.m3.b = ssbo_140.content.m3.b; + ssbo_430.content.m4 = ssbo_140.content.m4; + ssbo_430.content.m3s[0].c = ssbo_140.content.m3s[0].c; + ssbo_430.content.m3s[1].c = ssbo_140.content.m3s[1].c; + ssbo_430.content.m3s[2].c = ssbo_140.content.m3s[2].c; + ssbo_430.content.m3s[3].c = ssbo_140.content.m3s[3].c; + ssbo_430.content.m3s[4].c = ssbo_140.content.m3s[4].c; + ssbo_430.content.m3s[5].c = ssbo_140.content.m3s[5].c; + ssbo_430.content.m3s[6].c = ssbo_140.content.m3s[6].c; + ssbo_430.content.m3s[7].c = ssbo_140.content.m3s[7].c; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/torture-loop.comp b/third_party/spirv-cross/reference/shaders/comp/torture-loop.comp new file mode 100644 index 0000000000..645af5c374 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/torture-loop.comp @@ -0,0 +1,49 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +} _24; + +layout(binding = 1, std430) writeonly buffer SSBO2 +{ + vec4 out_data[]; +} _89; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = _24.in_data[ident]; + int k = 0; + for (;;) + { + int _39 = k; + int _40 = _39 + 1; + k = _40; + if (_40 < 10) + { + idat *= 2.0; + k++; + continue; + } + else + { + break; + } + } + for (uint i = 0u; i < 16u; i++, k++) + { + for (uint j = 0u; j < 30u; j++) + { + idat = _24.mvp * idat; + } + } + do + { + k++; + } while (k > 10); + _89.out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/type-alias.comp b/third_party/spirv-cross/reference/shaders/comp/type-alias.comp new file mode 100644 index 0000000000..51f3792e1a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/type-alias.comp @@ -0,0 +1,49 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct S0 +{ + vec4 a; +}; + +struct S1 +{ + vec4 a; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + S0 s0s[]; +} _36; + +layout(binding = 1, std430) buffer SSBO1 +{ + S1 s1s[]; +} _55; + +layout(binding = 2, std430) buffer SSBO2 +{ + vec4 outputs[]; +} _66; + +vec4 overload(S0 s0) +{ + return s0.a; +} + +vec4 overload(S1 s1) +{ + return s1.a; +} + +void main() +{ + S0 s0; + s0.a = _36.s0s[gl_GlobalInvocationID.x].a; + S1 s1; + s1.a = _55.s1s[gl_GlobalInvocationID.x].a; + S0 param = s0; + S1 param_1 = s1; + _66.outputs[gl_GlobalInvocationID.x] = overload(param) + overload(param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders/comp/udiv.comp b/third_party/spirv-cross/reference/shaders/comp/udiv.comp new file mode 100644 index 0000000000..0c1f926ad0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/comp/udiv.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO2 +{ + uint outputs[]; +} _10; + +layout(binding = 0, std430) buffer SSBO +{ + uint inputs[]; +} _23; + +void main() +{ + _10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/comp/enhanced-layouts.comp b/third_party/spirv-cross/reference/shaders/desktop-only/comp/enhanced-layouts.comp new file mode 100644 index 0000000000..ba37ca237b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/comp/enhanced-layouts.comp @@ -0,0 +1,40 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct Foo +{ + int a; + int b; + int c; +}; + +layout(binding = 1, std140) buffer SSBO1 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo1; + +layout(binding = 2, std430) buffer SSBO2 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo2; + +layout(binding = 0, std140) uniform UBO +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ubo; + +void main() +{ + ssbo1.a = ssbo2.a; + ssbo1.b = ubo.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/reference/shaders/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..9c55c74db4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,159 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct ResType +{ + uint _m0; + uint _m1; +}; + +struct ResType_1 +{ + uvec2 _m0; + uvec2 _m1; +}; + +struct ResType_2 +{ + uvec3 _m0; + uvec3 _m1; +}; + +struct ResType_3 +{ + uvec4 _m0; + uvec4 _m1; +}; + +struct ResType_4 +{ + int _m0; + int _m1; +}; + +struct ResType_5 +{ + ivec2 _m0; + ivec2 _m1; +}; + +struct ResType_6 +{ + ivec3 _m0; + ivec3 _m1; +}; + +struct ResType_7 +{ + ivec4 _m0; + ivec4 _m1; +}; + +layout(binding = 0, std430) buffer SSBOUint +{ + uint a; + uint b; + uint c; + uint d; + uvec2 a2; + uvec2 b2; + uvec2 c2; + uvec2 d2; + uvec3 a3; + uvec3 b3; + uvec3 c3; + uvec3 d3; + uvec4 a4; + uvec4 b4; + uvec4 c4; + uvec4 d4; +} u; + +layout(binding = 1, std430) buffer SSBOInt +{ + int a; + int b; + int c; + int d; + ivec2 a2; + ivec2 b2; + ivec2 c2; + ivec2 d2; + ivec3 a3; + ivec3 b3; + ivec3 c3; + ivec3 d3; + ivec4 a4; + ivec4 b4; + ivec4 c4; + ivec4 d4; +} i; + +void main() +{ + ResType _25; + _25._m0 = uaddCarry(u.a, u.b, _25._m1); + u.d = _25._m1; + u.c = _25._m0; + ResType_1 _40; + _40._m0 = uaddCarry(u.a2, u.b2, _40._m1); + u.d2 = _40._m1; + u.c2 = _40._m0; + ResType_2 _55; + _55._m0 = uaddCarry(u.a3, u.b3, _55._m1); + u.d3 = _55._m1; + u.c3 = _55._m0; + ResType_3 _70; + _70._m0 = uaddCarry(u.a4, u.b4, _70._m1); + u.d4 = _70._m1; + u.c4 = _70._m0; + ResType _79; + _79._m0 = usubBorrow(u.a, u.b, _79._m1); + u.d = _79._m1; + u.c = _79._m0; + ResType_1 _88; + _88._m0 = usubBorrow(u.a2, u.b2, _88._m1); + u.d2 = _88._m1; + u.c2 = _88._m0; + ResType_2 _97; + _97._m0 = usubBorrow(u.a3, u.b3, _97._m1); + u.d3 = _97._m1; + u.c3 = _97._m0; + ResType_3 _106; + _106._m0 = usubBorrow(u.a4, u.b4, _106._m1); + u.d4 = _106._m1; + u.c4 = _106._m0; + ResType _116; + umulExtended(u.a, u.b, _116._m1, _116._m0); + u.d = _116._m0; + u.c = _116._m1; + ResType_1 _125; + umulExtended(u.a2, u.b2, _125._m1, _125._m0); + u.d2 = _125._m0; + u.c2 = _125._m1; + ResType_2 _134; + umulExtended(u.a3, u.b3, _134._m1, _134._m0); + u.d3 = _134._m0; + u.c3 = _134._m1; + ResType_3 _143; + umulExtended(u.a4, u.b4, _143._m1, _143._m0); + u.d4 = _143._m0; + u.c4 = _143._m1; + ResType_4 _160; + imulExtended(i.a, i.b, _160._m1, _160._m0); + i.d = _160._m0; + i.c = _160._m1; + ResType_5 _171; + imulExtended(i.a2, i.b2, _171._m1, _171._m0); + i.d2 = _171._m0; + i.c2 = _171._m1; + ResType_6 _182; + imulExtended(i.a3, i.b3, _182._m1, _182._m0); + i.d3 = _182._m0; + i.c3 = _182._m1; + ResType_7 _193; + imulExtended(i.a4, i.b4, _193._m1, _193._m0); + i.d4 = _193._m0; + i.c4 = _193._m1; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/comp/fp64.desktop.comp b/third_party/spirv-cross/reference/shaders/desktop-only/comp/fp64.desktop.comp new file mode 100644 index 0000000000..c9e5e84962 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/comp/fp64.desktop.comp @@ -0,0 +1,83 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct M0 +{ + double v; + dvec2 b[2]; + dmat2x3 c; + dmat3x2 d; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + dvec4 a; + M0 m0; + dmat4 b; +} ssbo_0; + +layout(binding = 1, std430) buffer SSBO1 +{ + dmat4 a; + dvec4 b; + M0 m0; +} ssbo_1; + +layout(binding = 2, std430) buffer SSBO2 +{ + double a[4]; + dvec2 b[4]; +} ssbo_2; + +layout(binding = 3, std140) buffer SSBO3 +{ + double a[4]; + dvec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += dvec4(10.0lf, 20.0lf, 30.0lf, 40.0lf); + ssbo_0.a += dvec4(20.0lf); + dvec4 a = ssbo_0.a; + dmat4 amat = ssbo_0.b; + ssbo_0.a = abs(a); + ssbo_0.a = sign(a); + ssbo_0.a = floor(a); + ssbo_0.a = trunc(a); + ssbo_0.a = round(a); + ssbo_0.a = roundEven(a); + ssbo_0.a = ceil(a); + ssbo_0.a = fract(a); + ssbo_0.a = mod(a, dvec4(20.0lf)); + ssbo_0.a = mod(a, a); + ssbo_0.a = min(a, a); + ssbo_0.a = max(a, a); + ssbo_0.a = clamp(a, a, a); + ssbo_0.a = mix(a, a, a); + ssbo_0.a = step(a, a); + ssbo_0.a = smoothstep(a, a, a); + bvec4 b = isnan(a); + bvec4 c = isinf(a); + double f = packDouble2x32(uvec2(10u, 40u)); + uvec2 g = unpackDouble2x32(f); + double d = length(a); + d = distance(a, a); + d = dot(a, a); + dvec3 e = cross(a.xyz, a.yzw); + a = faceforward(a, a, a); + a = reflect(a, a); + dmat4 l = dmat4(amat[0] * amat[0], amat[1] * amat[1], amat[2] * amat[2], amat[3] * amat[3]); + l = outerProduct(a, a); + l = transpose(l); + double m = determinant(l); + l = inverse(l); + bvec4 k = lessThan(a, a); + k = lessThanEqual(a, a); + k = greaterThan(a, a); + k = greaterThanEqual(a, a); + ssbo_1.b.x += 1.0lf; + ssbo_2.b[0].x += 1.0lf; + ssbo_3.b[0].x += 1.0lf; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp b/third_party/spirv-cross/reference/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp new file mode 100644 index 0000000000..7a0797578b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, rgba32f) uniform readonly writeonly image2D uImg00; +layout(binding = 1, rgba16f) uniform readonly writeonly image2D uImg01; +layout(binding = 2, rg32f) uniform readonly writeonly image2D uImg02; +layout(binding = 3, rg16f) uniform readonly writeonly image2D uImg03; +layout(binding = 4, r11f_g11f_b10f) uniform readonly writeonly image2D uImg04; +layout(binding = 5, r32f) uniform readonly writeonly image2D uImg05; +layout(binding = 6, r16f) uniform readonly writeonly image2D uImg06; +layout(binding = 7, rgba16) uniform readonly writeonly image2D uImg07; +layout(binding = 8, rgb10_a2) uniform readonly writeonly image2D uImg08; +layout(binding = 9, rgba8) uniform readonly writeonly image2D uImg09; +layout(binding = 10, rg16) uniform readonly writeonly image2D uImg10; +layout(binding = 11, rg8) uniform readonly writeonly image2D uImg11; +layout(binding = 12, r16) uniform readonly writeonly image2D uImg12; +layout(binding = 13, r8) uniform readonly writeonly image2D uImg13; +layout(binding = 14, rgba16_snorm) uniform readonly writeonly image2D uImg14; +layout(binding = 15, rgba8_snorm) uniform readonly writeonly image2D uImg15; +layout(binding = 16, rg16_snorm) uniform readonly writeonly image2D uImg16; +layout(binding = 17, rg8_snorm) uniform readonly writeonly image2D uImg17; +layout(binding = 18, r16_snorm) uniform readonly writeonly image2D uImg18; +layout(binding = 19, r8_snorm) uniform readonly writeonly image2D uImg19; +layout(binding = 20, rgba32i) uniform readonly writeonly iimage2D uImage20; +layout(binding = 21, rgba16i) uniform readonly writeonly iimage2D uImage21; +layout(binding = 22, rgba8i) uniform readonly writeonly iimage2D uImage22; +layout(binding = 23, rg32i) uniform readonly writeonly iimage2D uImage23; +layout(binding = 24, rg16i) uniform readonly writeonly iimage2D uImage24; +layout(binding = 25, rg8i) uniform readonly writeonly iimage2D uImage25; +layout(binding = 26, r32i) uniform readonly writeonly iimage2D uImage26; +layout(binding = 27, r16i) uniform readonly writeonly iimage2D uImage27; +layout(binding = 28, r8i) uniform readonly writeonly iimage2D uImage28; +layout(binding = 29, rgba32ui) uniform readonly writeonly uimage2D uImage29; +layout(binding = 30, rgba16ui) uniform readonly writeonly uimage2D uImage30; +layout(binding = 31, rgb10_a2ui) uniform readonly writeonly uimage2D uImage31; +layout(binding = 32, rgba8ui) uniform readonly writeonly uimage2D uImage32; +layout(binding = 33, rg32ui) uniform readonly writeonly uimage2D uImage33; +layout(binding = 34, rg16ui) uniform readonly writeonly uimage2D uImage34; +layout(binding = 35, rg8ui) uniform readonly writeonly uimage2D uImage35; +layout(binding = 36, r32ui) uniform readonly writeonly uimage2D uImage36; +layout(binding = 37, r16ui) uniform readonly writeonly uimage2D uImage37; +layout(binding = 38, r8ui) uniform readonly writeonly uimage2D uImage38; + +void main() +{ +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/comp/int64.desktop.comp b/third_party/spirv-cross/reference/shaders/desktop-only/comp/int64.desktop.comp new file mode 100644 index 0000000000..28afc2fbd7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/comp/int64.desktop.comp @@ -0,0 +1,58 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +struct M0 +{ + int64_t v; + i64vec2 b[2]; + uint64_t c; + uint64_t d[5]; +}; + +layout(binding = 0, std430) buffer SSBO0 +{ + i64vec4 a; + M0 m0; +} ssbo_0; + +layout(binding = 1, std430) buffer SSBO1 +{ + u64vec4 b; + M0 m0; +} ssbo_1; + +layout(binding = 2, std430) buffer SSBO2 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_2; + +layout(binding = 3, std140) buffer SSBO3 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += i64vec4(10l, 20l, 30l, 40l); + ssbo_1.b += u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul); + ssbo_0.a += i64vec4(20l); + ssbo_0.a = abs(ssbo_0.a + i64vec4(ssbo_1.b)); + ssbo_0.a += i64vec4(1l); + ssbo_1.b += u64vec4(i64vec4(1l)); + ssbo_0.a -= i64vec4(1l); + ssbo_1.b -= u64vec4(i64vec4(1l)); + ssbo_1.b = doubleBitsToUint64(int64BitsToDouble(ssbo_0.a)); + ssbo_0.a = doubleBitsToInt64(uint64BitsToDouble(ssbo_1.b)); + ssbo_2.a[0] += 1l; + ssbo_3.a[0] += 2l; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/clip-cull-distance.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/clip-cull-distance.desktop.frag new file mode 100644 index 0000000000..3cc3205509 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/clip-cull-distance.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +in float gl_ClipDistance[4]; +in float gl_CullDistance[3]; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = gl_ClipDistance[0] + gl_CullDistance[0]; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..391b4de1c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,37 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vInput; + +void main() +{ + FragColor = vInput; + vec4 t = texture(uSampler, vInput.xy); + vec4 d0 = dFdx(vInput); + vec4 d1 = dFdy(vInput); + vec4 d2 = fwidth(vInput); + vec4 d3 = dFdxCoarse(vInput); + vec4 d4 = dFdyCoarse(vInput); + vec4 d5 = fwidthCoarse(vInput); + vec4 d6 = dFdxFine(vInput); + vec4 d7 = dFdyFine(vInput); + vec4 d8 = fwidthFine(vInput); + vec2 lod = textureQueryLod(uSampler, vInput.zw); + if (vInput.y > 10.0) + { + FragColor += t; + FragColor += d0; + FragColor += d1; + FragColor += d2; + FragColor += d3; + FragColor += d4; + FragColor += d5; + FragColor += d6; + FragColor += d7; + FragColor += d8; + FragColor += lod.xyxy; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-greater-than.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-greater-than.desktop.frag new file mode 100644 index 0000000000..8b7c296447 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-greater-than.desktop.frag @@ -0,0 +1,9 @@ +#version 450 +layout(depth_greater) out float gl_FragDepth; +layout(early_fragment_tests) in; + +void main() +{ + gl_FragDepth = 0.5; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-less-than.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-less-than.desktop.frag new file mode 100644 index 0000000000..44752eb8fb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/depth-less-than.desktop.frag @@ -0,0 +1,9 @@ +#version 450 +layout(depth_less) out float gl_FragDepth; +layout(early_fragment_tests) in; + +void main() +{ + gl_FragDepth = 0.5; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/dual-source-blending.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/dual-source-blending.desktop.frag new file mode 100644 index 0000000000..3d946b04a5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/dual-source-blending.desktop.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0, index = 0) out vec4 FragColor0; +layout(location = 0, index = 1) out vec4 FragColor1; + +void main() +{ + FragColor0 = vec4(1.0); + FragColor1 = vec4(2.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag new file mode 100644 index 0000000000..70843a8563 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(binding = 0, std430) buffer Foobar +{ + vec4 _data[]; +} Foobar_1; + +layout(binding = 1, std430) buffer Foobaz +{ + vec4 _data[]; +} Foobaz_1; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 _main() +{ + return Foobar_1._data[0] + Foobaz_1._data[0]; +} + +void main() +{ + _entryPointOutput = _main(); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..24644be170 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(binding = 0, rgba8) uniform image2DMS uImage; +layout(binding = 1, rgba8) uniform image2DMSArray uImageArray; + +void main() +{ + vec4 a = imageLoad(uImage, ivec2(1, 2), 2); + vec4 b = imageLoad(uImageArray, ivec3(1, 2, 4), 3); + imageStore(uImage, ivec2(2, 3), 1, a); + imageStore(uImageArray, ivec3(2, 3, 7), 1, b); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-query.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-query.desktop.frag new file mode 100644 index 0000000000..6f36d5db3b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-query.desktop.frag @@ -0,0 +1,53 @@ +#version 450 + +layout(binding = 0) uniform sampler1D uSampler1D; +layout(binding = 1) uniform sampler2D uSampler2D; +layout(binding = 2) uniform sampler2DArray uSampler2DArray; +layout(binding = 3) uniform sampler3D uSampler3D; +layout(binding = 4) uniform samplerCube uSamplerCube; +layout(binding = 5) uniform samplerCubeArray uSamplerCubeArray; +layout(binding = 6) uniform samplerBuffer uSamplerBuffer; +layout(binding = 7) uniform sampler2DMS uSamplerMS; +layout(binding = 8) uniform sampler2DMSArray uSamplerMSArray; +layout(binding = 9, r32f) uniform readonly writeonly image1D uImage1D; +layout(binding = 10, r32f) uniform readonly writeonly image2D uImage2D; +layout(binding = 11, r32f) uniform readonly writeonly image2DArray uImage2DArray; +layout(binding = 12, r32f) uniform readonly writeonly image3D uImage3D; +layout(binding = 13, r32f) uniform readonly writeonly imageCube uImageCube; +layout(binding = 14, r32f) uniform readonly writeonly imageCubeArray uImageCubeArray; +layout(binding = 15, r32f) uniform readonly writeonly imageBuffer uImageBuffer; +layout(binding = 16, r32f) uniform readonly writeonly image2DMS uImageMS; +layout(binding = 17, r32f) uniform readonly writeonly image2DMSArray uImageMSArray; + +void main() +{ + int a = textureSize(uSampler1D, 0); + ivec2 b = textureSize(uSampler2D, 0); + ivec3 c = textureSize(uSampler2DArray, 0); + ivec3 d = textureSize(uSampler3D, 0); + ivec2 e = textureSize(uSamplerCube, 0); + ivec3 f = textureSize(uSamplerCubeArray, 0); + int g = textureSize(uSamplerBuffer); + ivec2 h = textureSize(uSamplerMS); + ivec3 i = textureSize(uSamplerMSArray); + int l0 = textureQueryLevels(uSampler1D); + int l1 = textureQueryLevels(uSampler2D); + int l2 = textureQueryLevels(uSampler2DArray); + int l3 = textureQueryLevels(uSampler3D); + int l4 = textureQueryLevels(uSamplerCube); + int l5 = textureQueryLevels(uSamplerCubeArray); + a = imageSize(uImage1D); + b = imageSize(uImage2D); + c = imageSize(uImage2DArray); + d = imageSize(uImage3D); + e = imageSize(uImageCube); + f = imageSize(uImageCubeArray); + g = imageSize(uImageBuffer); + h = imageSize(uImageMS); + i = imageSize(uImageMSArray); + int s0 = textureSamples(uSamplerMS); + int s1 = textureSamples(uSamplerMSArray); + int s2 = imageSamples(uImageMS); + int s3 = imageSamples(uImageMSArray); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.frag new file mode 100644 index 0000000000..5bb060398e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0, r32f) uniform readonly writeonly image2D uImage1; +layout(binding = 1, r32f) uniform readonly writeonly image2D uImage2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2))); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag new file mode 100644 index 0000000000..1d9062064a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0, r32f) uniform image2D uImage1; +layout(binding = 1, r32f) uniform image2D uImage2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(vec2(imageSize(uImage1)), vec2(imageSize(uImage2))); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/in-block-qualifiers.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/in-block-qualifiers.frag new file mode 100644 index 0000000000..d4622801df --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/in-block-qualifiers.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in VertexData +{ + flat float f; + centroid vec4 g; + flat int h; + float i; +} vin; + +layout(location = 4) flat in float f; +layout(location = 5) centroid in vec4 g; +layout(location = 6) flat in int h; +layout(location = 7) sample in float i; + +void main() +{ + FragColor = ((((((vec4(vin.f) + vin.g) + vec4(float(vin.h))) + vec4(vin.i)) + vec4(f)) + g) + vec4(float(h))) + vec4(i); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/layout-component.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/layout-component.desktop.frag new file mode 100644 index 0000000000..13f17feeed --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/layout-component.desktop.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec2 FragColor; +layout(location = 0, component = 0) in vec2 v0; +layout(location = 0, component = 2) in float v1; +in Vertex +{ + layout(location = 1, component = 2) float v3; +} _20; + + +void main() +{ + FragColor = (v0 + vec2(v1)) + vec2(_20.v3); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..4a80cbf81f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(textureQueryLevels(uSampler))); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-lod.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..f43543b8c0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/query-lod.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTexCoord; + +void main() +{ + FragColor = textureQueryLod(uSampler, vTexCoord).xyxy; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..4c30ed1529 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSampler; +layout(binding = 1) uniform sampler2DMSArray uSamplerArray; +layout(binding = 2, rgba8) uniform readonly writeonly image2DMS uImage; +layout(binding = 3, rgba8) uniform readonly writeonly image2DMSArray uImageArray; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(((textureSamples(uSampler) + textureSamples(uSamplerArray)) + imageSamples(uImage)) + imageSamples(uImageArray))); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/stencil-export.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/stencil-export.desktop.frag new file mode 100644 index 0000000000..65082a8b2d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/stencil-export.desktop.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_ARB_shader_stencil_export : require + +layout(location = 0) out vec4 MRT0; +layout(location = 1) out vec4 MRT1; + +void main() +{ + MRT0 = vec4(1.0); + MRT1 = vec4(1.0, 0.0, 1.0, 1.0); + gl_FragStencilRefARB = 100; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag b/third_party/spirv-cross/reference/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag new file mode 100644 index 0000000000..60c45908fa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag @@ -0,0 +1,28 @@ +#version 450 + +layout(binding = 0) uniform sampler1DShadow uShadow1D; +layout(binding = 1) uniform sampler2DShadow uShadow2D; +layout(binding = 2) uniform sampler1D uSampler1D; +layout(binding = 3) uniform sampler2D uSampler2D; +layout(binding = 4) uniform sampler3D uSampler3D; + +layout(location = 0) out float FragColor; +layout(location = 1) in vec4 vClip4; +layout(location = 2) in vec2 vClip2; +layout(location = 0) in vec3 vClip3; + +void main() +{ + vec4 _17 = vClip4; + vec4 _20 = _17; + _20.y = _17.w; + FragColor = textureProj(uShadow1D, vec4(_20.x, 0.0, _17.z, _20.y)); + vec4 _27 = vClip4; + vec4 _30 = _27; + _30.z = _27.w; + FragColor = textureProj(uShadow2D, vec4(_30.xy, _27.z, _30.z)); + FragColor = textureProj(uSampler1D, vClip2).x; + FragColor = textureProj(uSampler2D, vClip3).x; + FragColor = textureProj(uSampler3D, vClip4).x; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/geom/basic.desktop.sso.geom b/third_party/spirv-cross/reference/shaders/desktop-only/geom/basic.desktop.sso.geom new file mode 100644 index 0000000000..f1afee69ec --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/geom/basic.desktop.sso.geom @@ -0,0 +1,35 @@ +#version 450 +layout(invocations = 4, triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal + vec3(float(gl_InvocationID)); + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + vec3(4.0 * float(gl_InvocationID)); + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + vec3(2.0 * float(gl_InvocationID)); + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/geom/viewport-index.desktop.geom b/third_party/spirv-cross/reference/shaders/desktop-only/geom/viewport-index.desktop.geom new file mode 100644 index 0000000000..773aeb8bfd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/geom/viewport-index.desktop.geom @@ -0,0 +1,9 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 4, triangle_strip) out; + +void main() +{ + gl_ViewportIndex = 1; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/reference/shaders/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..c51699db6d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,27 @@ +#version 450 +layout(vertices = 1) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +} gl_out[1]; + +layout(location = 0) patch out vec3 vFoo; + +void main() +{ + gl_TessLevelInner[0] = 8.8999996185302734375; + gl_TessLevelInner[1] = 6.900000095367431640625; + gl_TessLevelOuter[0] = 8.8999996185302734375; + gl_TessLevelOuter[1] = 6.900000095367431640625; + gl_TessLevelOuter[2] = 3.900000095367431640625; + gl_TessLevelOuter[3] = 4.900000095367431640625; + vFoo = vec3(1.0); + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/reference/shaders/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..c9bacd464e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,18 @@ +#version 450 +layout(triangles, cw, fractional_even_spacing) in; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = ((gl_in[0].gl_Position * gl_TessCoord.x) + (gl_in[1].gl_Position * gl_TessCoord.y)) + (gl_in[2].gl_Position * gl_TessCoord.z); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..2f880398e0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,22 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(binding = 0, std140) uniform UBO +{ + mat4 uMVP; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.uMVP * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert new file mode 100644 index 0000000000..a7c5d761c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[4]; + float gl_CullDistance[3]; +}; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..2f3d49f55d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,15 @@ +#version 450 + +out float gl_ClipDistance[4]; +out float gl_CullDistance[3]; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/out-block-qualifiers.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/out-block-qualifiers.vert new file mode 100644 index 0000000000..7c731684bc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/out-block-qualifiers.vert @@ -0,0 +1,27 @@ +#version 450 + +layout(location = 0) out VertexData +{ + flat float f; + centroid vec4 g; + flat int h; + float i; +} vout; + +layout(location = 4) flat out float f; +layout(location = 5) centroid out vec4 g; +layout(location = 6) flat out int h; +layout(location = 7) out float i; + +void main() +{ + vout.f = 10.0; + vout.g = vec4(20.0); + vout.h = 20; + vout.i = 30.0; + f = 10.0; + g = vec4(20.0); + h = 20; + i = 30.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert new file mode 100644 index 0000000000..2b3c5ce051 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert @@ -0,0 +1,24 @@ +#version 450 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseVertex gl_BaseVertexARB +#else +uniform int SPIRV_Cross_BaseVertex; +#endif +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +#ifndef GL_ARB_shader_draw_parameters +#error GL_ARB_shader_draw_parameters is not supported. +#endif + +void main() +{ + gl_Position = vec4(float(SPIRV_Cross_BaseVertex), float(SPIRV_Cross_BaseInstance), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk new file mode 100644 index 0000000000..6121dd8f15 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert.vk @@ -0,0 +1,8 @@ +#version 450 +#extension GL_ARB_shader_draw_parameters : require + +void main() +{ + gl_Position = vec4(float(gl_BaseVertexARB), float(gl_BaseInstanceARB), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert new file mode 100644 index 0000000000..bc16d0431a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert @@ -0,0 +1,24 @@ +#version 460 +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseVertex gl_BaseVertexARB +#else +uniform int SPIRV_Cross_BaseVertex; +#endif +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +#ifndef GL_ARB_shader_draw_parameters +#error GL_ARB_shader_draw_parameters is not supported. +#endif + +void main() +{ + gl_Position = vec4(float(SPIRV_Cross_BaseVertex), float(SPIRV_Cross_BaseInstance), float(gl_DrawIDARB), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk new file mode 100644 index 0000000000..b6948fbc4a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert.vk @@ -0,0 +1,7 @@ +#version 460 + +void main() +{ + gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), float(gl_DrawID), 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/array.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/array.flatten.vert new file mode 100644 index 0000000000..5afde34c55 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/array.flatten.vert @@ -0,0 +1,12 @@ +#version 310 es + +uniform vec4 UBO[56]; +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec4 a4 = UBO[23]; + vec4 offset = (UBO[50] + UBO[45]) + vec4(UBO[54].x); + gl_Position = ((mat4(UBO[40], UBO[41], UBO[42], UBO[43]) * aVertex) + UBO[55]) + offset; +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/basic.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/basic.flatten.vert new file mode 100644 index 0000000000..f7eb758f2a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/basic.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +uniform vec4 UBO[4]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/copy.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/copy.flatten.vert new file mode 100644 index 0000000000..4703d938d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/copy.flatten.vert @@ -0,0 +1,30 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + Light light; + for (int i = 0; i < 4; i++) + { + Light _52 = Light(UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]); + light.Position = _52.Position; + light.Radius = _52.Radius; + light.Color = _52.Color; + vec3 L = aVertex.xyz - light.Position; + vColor += ((UBO[i * 2 + 5] * clamp(1.0 - (length(L) / light.Radius), 0.0, 1.0)) * dot(aNormal, normalize(L))); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/dynamic.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..8be397ea3f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/dynamic.flatten.vert @@ -0,0 +1,25 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + for (int i = 0; i < 4; i++) + { + vec3 L = aVertex.xyz - UBO[i * 2 + 4].xyz; + vColor += ((UBO[i * 2 + 5] * clamp(1.0 - (length(L) / UBO[i * 2 + 4].w), 0.0, 1.0)) * dot(aNormal, normalize(L))); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/reference/shaders/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..ee79bf5b8a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform vec4 UBO[4]; +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in vec3 vNormal; + +void main() +{ + mat4 _19 = mat4(UBO[0], UBO[1], UBO[2], UBO[3]); + FragColor = mat3(_19[0].xyz, _19[1].xyz, _19[2].xyz) * vNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..f6d0fa486d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/matrixindex.flatten.vert @@ -0,0 +1,19 @@ +#version 310 es + +uniform vec4 UBO[14]; +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; + +void main() +{ + gl_Position = vec4(0.0); + oA = UBO[1]; + oB = vec4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y); + oC = UBO[9]; + oD = vec4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x); + oE = vec4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/multiindex.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..3850bf6c70 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/multiindex.flatten.vert @@ -0,0 +1,10 @@ +#version 310 es + +uniform vec4 UBO[15]; +layout(location = 0) in ivec2 aIndex; + +void main() +{ + gl_Position = UBO[aIndex.x * 5 + aIndex.y * 1 + 0]; +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/push-constant.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..216c1f9d1b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/push-constant.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +uniform vec4 PushMe[6]; +layout(location = 1) in vec4 Pos; +layout(location = 0) out vec2 vRot; +layout(location = 0) in vec2 Rot; + +void main() +{ + gl_Position = mat4(PushMe[0], PushMe[1], PushMe[2], PushMe[3]) * Pos; + vRot = (mat2(PushMe[4].xy, PushMe[4].zw) * Rot) + vec2(PushMe[5].z); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..721c4905c0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/rowmajor.flatten.vert @@ -0,0 +1,11 @@ +#version 310 es + +uniform vec4 UBO[12]; +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec2 v = mat4x2(UBO[8].xy, UBO[9].xy, UBO[10].xy, UBO[11].xy) * aVertex; + gl_Position = (mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex) + (aVertex * mat4(UBO[4], UBO[5], UBO[6], UBO[7])); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/struct.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/struct.flatten.vert new file mode 100644 index 0000000000..3468d52929 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/struct.flatten.vert @@ -0,0 +1,22 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + vec4 Color; +}; + +uniform vec4 UBO[6]; +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec4 vColor; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex; + vColor = vec4(0.0); + vec3 L = aVertex.xyz - UBO[4].xyz; + vColor += ((UBO[5] * clamp(1.0 - (length(L) / UBO[4].w), 0.0, 1.0)) * dot(aNormal, normalize(L))); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..37438498d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,26 @@ +#version 310 es + +struct Foo +{ + mat3x4 MVP0; + mat3x4 MVP1; +}; + +uniform vec4 UBO[8]; +layout(location = 0) in vec4 v0; +layout(location = 1) in vec4 v1; +layout(location = 0) out vec3 V0; +layout(location = 1) out vec3 V1; + +void main() +{ + Foo _20 = Foo(transpose(mat4x3(UBO[0].xyz, UBO[1].xyz, UBO[2].xyz, UBO[3].xyz)), transpose(mat4x3(UBO[4].xyz, UBO[5].xyz, UBO[6].xyz, UBO[7].xyz))); + Foo f; + f.MVP0 = _20.MVP0; + f.MVP1 = _20.MVP1; + vec3 a = v0 * f.MVP0; + vec3 b = v1 * f.MVP1; + V0 = a; + V1 = b; +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/swizzle.flatten.vert b/third_party/spirv-cross/reference/shaders/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..92afb475e6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/swizzle.flatten.vert @@ -0,0 +1,21 @@ +#version 310 es + +uniform vec4 UBO[8]; +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; +layout(location = 5) out vec4 oF; + +void main() +{ + gl_Position = vec4(0.0); + oA = UBO[0]; + oB = vec4(UBO[1].xy, UBO[1].zw); + oC = vec4(UBO[2].x, UBO[3].xyz); + oD = vec4(UBO[4].xyz, UBO[4].w); + oE = vec4(UBO[5].x, UBO[5].y, UBO[5].z, UBO[5].w); + oF = vec4(UBO[6].x, UBO[6].zw, UBO[7].x); +} + diff --git a/third_party/spirv-cross/reference/shaders/flatten/types.flatten.frag b/third_party/spirv-cross/reference/shaders/flatten/types.flatten.frag new file mode 100644 index 0000000000..a74327d97b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/flatten/types.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump ivec4 UBO1[2]; +uniform mediump uvec4 UBO2[2]; +uniform vec4 UBO0[2]; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ((((vec4(UBO1[0]) + vec4(UBO1[1])) + vec4(UBO2[0])) + vec4(UBO2[1])) + UBO0[0]) + UBO0[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/reference/shaders/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..baf2302519 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _17[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); + +layout(location = 0) out vec4 FragColor; + +void main() +{ + for (mediump int i = 0; i < 4; i++, FragColor += vec4(_17[i])) + { + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/avoid-expression-lowering-to-loop.frag b/third_party/spirv-cross/reference/shaders/frag/avoid-expression-lowering-to-loop.frag new file mode 100644 index 0000000000..6313d896e2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/avoid-expression-lowering-to-loop.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 1, std140) uniform Count +{ + float count; +} _44; + +layout(binding = 0) uniform mediump sampler2D tex; + +layout(location = 0) in highp vec4 vertex; +layout(location = 0) out vec4 fragColor; + +void main() +{ + highp float size = 1.0 / float(textureSize(tex, 0).x); + float r = 0.0; + float d = dFdx(vertex.x); + for (float i = 0.0; i < _44.count; i += 1.0) + { + r += (size * d); + } + fragColor = vec4(r); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/barycentric-khr.frag b/third_party/spirv-cross/reference/shaders/frag/barycentric-khr.frag new file mode 100644 index 0000000000..71a44c3857 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/barycentric-khr.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_EXT_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexEXT in vec2 vUV[3]; +layout(location = 3) pervertexEXT in vec2 vUV2[3]; + +void main() +{ + value = ((vUV[0] * gl_BaryCoordEXT.x) + (vUV[1] * gl_BaryCoordEXT.y)) + (vUV[2] * gl_BaryCoordEXT.z); + value += (((vUV2[0] * gl_BaryCoordNoPerspEXT.x) + (vUV2[1] * gl_BaryCoordNoPerspEXT.y)) + (vUV2[2] * gl_BaryCoordNoPerspEXT.z)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/barycentric-nv.frag b/third_party/spirv-cross/reference/shaders/frag/barycentric-nv.frag new file mode 100644 index 0000000000..b3b57e2f88 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/barycentric-nv.frag @@ -0,0 +1,13 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexNV in vec2 vUV[3]; +layout(location = 1) pervertexNV in vec2 vUV2[3]; + +void main() +{ + value = ((vUV[0] * gl_BaryCoordNV.x) + (vUV[1] * gl_BaryCoordNV.y)) + (vUV[2] * gl_BaryCoordNV.z); + value += (((vUV2[0] * gl_BaryCoordNoPerspNV.x) + (vUV2[1] * gl_BaryCoordNoPerspNV.y)) + (vUV2[2] * gl_BaryCoordNoPerspNV.z)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/basic.frag b/third_party/spirv-cross/reference/shaders/frag/basic.frag new file mode 100644 index 0000000000..2a4e440421 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/basic.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/reference/shaders/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..738ee6e441 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0, std430) buffer UBO +{ + vec4 results[1024]; +} _34; + +layout(binding = 1) uniform highp isampler2D Buf; + +layout(location = 0) flat in mediump int vIn; +layout(location = 1) flat in mediump int vIn2; +layout(location = 0) out vec4 FragColor; + +void main() +{ + mediump ivec4 coords = texelFetch(Buf, ivec2(gl_FragCoord.xy), 0); + vec4 foo = _34.results[coords.x % 16]; + mediump int c = vIn * vIn; + mediump int d = vIn2 * vIn2; + FragColor = (foo + foo) + _34.results[c + d]; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/reference/shaders/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..e4384f559e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D Texture; + +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; + +void main() +{ + float f = texture(Texture, vTexCoord).x; + FragColor = vec4(f * f); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/constant-array.frag b/third_party/spirv-cross/reference/shaders/frag/constant-array.frag new file mode 100644 index 0000000000..fac956039b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/constant-array.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Foobar +{ + float a; + float b; +}; + +const vec4 _37[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0)); +const vec4 _55[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0))); +const Foobar _75[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int index; + +vec4 resolve(Foobar f) +{ + return vec4(f.a + f.b); +} + +void main() +{ + Foobar param = Foobar(10.0, 20.0); + Foobar param_1 = _75[index]; + FragColor = ((_37[index] + _55[index][index + 1]) + resolve(param)) + resolve(param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/constant-composites.frag b/third_party/spirv-cross/reference/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..7813b98db2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/constant-composites.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _16[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; + +const Foo _28[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int line; + +void main() +{ + FragColor = vec4(_16[line]); + FragColor += vec4(_28[line].a * _28[1 - line].a); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/false-loop-init.frag b/third_party/spirv-cross/reference/shaders/frag/false-loop-init.frag new file mode 100644 index 0000000000..b0ed5577d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/false-loop-init.frag @@ -0,0 +1,25 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 result; +layout(location = 0) in vec4 accum; + +void main() +{ + result = vec4(0.0); + mediump uint j; + for (mediump int i = 0; i < 4; i += int(j)) + { + if (accum.y > 10.0) + { + j = 40u; + } + else + { + j = 30u; + } + result += accum; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/flush_params.frag b/third_party/spirv-cross/reference/shaders/frag/flush_params.frag new file mode 100644 index 0000000000..b4b36ff90d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/flush_params.frag @@ -0,0 +1,30 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Structy +{ + vec4 c; +}; + +layout(location = 0) out vec4 FragColor; + +void foo2(inout Structy f) +{ + f.c = vec4(10.0); +} + +Structy foo() +{ + Structy param; + foo2(param); + Structy f = param; + return f; +} + +void main() +{ + Structy s = foo(); + FragColor = s.c; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/reference/shaders/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..638d89be6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(0.0); + int i = 0; + int _36; + for (;;) + { + if (i < 3) + { + int a = i; + FragColor[a] += float(i); + if (false) + { + _36 = 1; + } + else + { + int _41 = i; + i = _41 + 1; + _36 = _41; + } + continue; + } + else + { + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/for-loop-init.frag b/third_party/spirv-cross/reference/shaders/frag/for-loop-init.frag new file mode 100644 index 0000000000..7c22e5c785 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/for-loop-init.frag @@ -0,0 +1,52 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out mediump int FragColor; + +void main() +{ + FragColor = 16; + for (mediump int i = 0; i < 25; i++) + { + FragColor += 10; + } + for (mediump int i_1 = 1, j = 4; i_1 < 30; i_1++, j += 4) + { + FragColor += 11; + } + mediump int k = 0; + for (; k < 20; k++) + { + FragColor += 12; + } + k += 3; + FragColor += k; + mediump int l; + if (k == 40) + { + l = 0; + for (; l < 40; l++) + { + FragColor += 13; + } + return; + } + else + { + l = k; + FragColor += l; + } + mediump ivec2 i_2 = ivec2(0); + for (; i_2.x < 10; i_2.x += 4) + { + FragColor += i_2.y; + } + mediump int o = k; + for (mediump int m = k; m < 40; m++) + { + FragColor += m; + } + FragColor += o; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/frexp-modf.frag b/third_party/spirv-cross/reference/shaders/frag/frexp-modf.frag new file mode 100644 index 0000000000..e495bb3169 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/frexp-modf.frag @@ -0,0 +1,43 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct ResType +{ + highp float _m0; + int _m1; +}; + +struct ResType_1 +{ + highp vec2 _m0; + ivec2 _m1; +}; + +layout(location = 0) in float v0; +layout(location = 1) in vec2 v1; +layout(location = 0) out float FragColor; + +void main() +{ + ResType _16; + _16._m0 = frexp(v0, _16._m1); + mediump int e0 = _16._m1; + float f0 = _16._m0; + ResType _22; + _22._m0 = frexp(v0 + 1.0, _22._m1); + e0 = _22._m1; + f0 = _22._m0; + ResType_1 _35; + _35._m0 = frexp(v1, _35._m1); + mediump ivec2 e1 = _35._m1; + vec2 f1 = _35._m0; + float r0; + float _41 = modf(v0, r0); + float m0 = _41; + vec2 r1; + vec2 _45 = modf(v1, r1); + vec2 m1 = _45; + FragColor = ((((f0 + f1.x) + f1.y) + m0) + m1.x) + m1.y; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/front-facing.frag b/third_party/spirv-cross/reference/shaders/frag/front-facing.frag new file mode 100644 index 0000000000..cc9aecc8ba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/front-facing.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + if (gl_FrontFacing) + { + FragColor = vA; + } + else + { + FragColor = vB; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/gather-dref.frag b/third_party/spirv-cross/reference/shaders/frag/gather-dref.frag new file mode 100644 index 0000000000..5416f79cb5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/gather-dref.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DShadow uT; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec3 vUV; + +void main() +{ + FragColor = textureGather(uT, vUV.xy, vUV.z); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/ground.frag b/third_party/spirv-cross/reference/shaders/frag/ground.frag new file mode 100644 index 0000000000..c36bb317b6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/ground.frag @@ -0,0 +1,62 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 4, std140) uniform GlobalPSData +{ + vec4 g_CamPos; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_ResolutionParams; + vec4 g_TimeParams; + vec4 g_FogColor_Distance; +} _101; + +layout(binding = 2) uniform mediump sampler2D TexNormalmap; + +layout(location = 3) out vec4 LightingOut; +layout(location = 2) out vec4 NormalOut; +layout(location = 1) out vec4 SpecularOut; +layout(location = 0) out vec4 AlbedoOut; +layout(location = 0) in vec2 TexCoord; +layout(location = 1) in vec3 EyeVec; + +float saturate(float x) +{ + return clamp(x, 0.0, 1.0); +} + +void Resolve(vec3 Albedo, vec3 Normal, float Roughness, float Metallic) +{ + LightingOut = vec4(0.0); + NormalOut = vec4((Normal * 0.5) + vec3(0.5), 0.0); + SpecularOut = vec4(Roughness, Metallic, 0.0, 0.0); + AlbedoOut = vec4(Albedo, 1.0); +} + +void main() +{ + vec3 Normal = (texture(TexNormalmap, TexCoord).xyz * 2.0) - vec3(1.0); + Normal = normalize(Normal); + float param = length(EyeVec) / 1000.0; + vec2 scatter_uv; + scatter_uv.x = saturate(param); + vec3 nEye = normalize(EyeVec); + scatter_uv.y = 0.0; + vec3 Color = vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625); + vec3 grass = vec3(0.100000001490116119384765625, 0.300000011920928955078125, 0.100000001490116119384765625); + vec3 dirt = vec3(0.100000001490116119384765625); + vec3 snow = vec3(0.800000011920928955078125); + float grass_snow = smoothstep(0.0, 0.1500000059604644775390625, (_101.g_CamPos.y + EyeVec.y) / 200.0); + vec3 base = mix(grass, snow, vec3(grass_snow)); + float edge = smoothstep(0.699999988079071044921875, 0.75, Normal.y); + Color = mix(dirt, base, vec3(edge)); + Color *= Color; + float Roughness = 1.0 - (edge * grass_snow); + vec3 param_1 = Color; + vec3 param_2 = Normal; + float param_3 = Roughness; + float param_4 = 0.0; + Resolve(param_1, param_2, param_3, param_4); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/helper-invocation.frag b/third_party/spirv-cross/reference/shaders/frag/helper-invocation.frag new file mode 100644 index 0000000000..e888ad84d8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/helper-invocation.frag @@ -0,0 +1,28 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uSampler; + +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +vec4 foo() +{ + vec4 color; + if (!gl_HelperInvocation) + { + color = textureLod(uSampler, vUV, 0.0); + } + else + { + color = vec4(1.0); + } + return color; +} + +void main() +{ + FragColor = foo(); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag b/third_party/spirv-cross/reference/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag new file mode 100644 index 0000000000..cd4f7d4d28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag @@ -0,0 +1,31 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int vA; +layout(location = 1) flat in mediump int vB; + +void main() +{ + FragColor = vec4(0.0); + mediump int k = 0; + mediump int j; + for (mediump int i = 0; i < vA; i += j) + { + if ((vA + i) == 20) + { + k = 50; + } + else + { + if ((vB + i) == 40) + { + k = 60; + } + } + j = k + 10; + FragColor += vec4(1.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/image-load-store-uint-coord.asm.frag b/third_party/spirv-cross/reference/shaders/frag/image-load-store-uint-coord.asm.frag new file mode 100644 index 0000000000..414dd956af --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/image-load-store-uint-coord.asm.frag @@ -0,0 +1,26 @@ +#version 450 + +layout(binding = 1, rgba32f) uniform image2D RWIm; +layout(binding = 0, rgba32f) uniform writeonly imageBuffer RWBuf; +layout(binding = 1) uniform sampler2D ROIm; +layout(binding = 0) uniform samplerBuffer ROBuf; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 _main() +{ + vec4 storeTemp = vec4(10.0, 0.5, 8.0, 2.0); + imageStore(RWIm, ivec2(uvec2(10u)), storeTemp); + vec4 v = imageLoad(RWIm, ivec2(uvec2(30u))); + imageStore(RWBuf, int(80u), v); + v += texelFetch(ROIm, ivec2(uvec2(50u, 60u)), 0); + v += texelFetch(ROBuf, int(80u)); + return v; +} + +void main() +{ + vec4 _45 = _main(); + _entryPointOutput = _45; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/inside-loop-dominated-variable-preservation.frag b/third_party/spirv-cross/reference/shaders/frag/inside-loop-dominated-variable-preservation.frag new file mode 100644 index 0000000000..2947b19fba --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/inside-loop-dominated-variable-preservation.frag @@ -0,0 +1,30 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bool written = false; + float v; + for (mediump int j = 0; j < 10; j++) + { + for (mediump int i = 0; i < 4; i++) + { + float w = 0.0; + if (written) + { + w += v; + } + else + { + v = 20.0; + } + v += float(i); + written = true; + } + } + FragColor = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/loop-dominator-and-switch-default.frag b/third_party/spirv-cross/reference/shaders/frag/loop-dominator-and-switch-default.frag new file mode 100644 index 0000000000..df968f1a29 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/loop-dominator-and-switch-default.frag @@ -0,0 +1,50 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 fragColor; + +void main() +{ + vec4 f4; + mediump int c = int(f4.x); + for (mediump int j = 0; j < c; j++) + { + switch (c) + { + case 0: + { + f4.y = 0.0; + break; + } + case 1: + { + f4.y = 1.0; + break; + } + default: + { + mediump int i = 0; + for (;;) + { + mediump int _48 = i; + mediump int _50 = _48 + 1; + i = _50; + if (_48 < c) + { + f4.y += 0.5; + continue; + } + else + { + break; + } + } + continue; + } + } + f4.y += 0.5; + } + fragColor = f4; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/lut-promotion.frag b/third_party/spirv-cross/reference/shaders/frag/lut-promotion.frag new file mode 100644 index 0000000000..019393f9f3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/lut-promotion.frag @@ -0,0 +1,40 @@ +#version 310 es +precision mediump float; +precision highp int; + +const float _16[16] = float[](1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0); +const vec4 _60[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + +layout(location = 0) out float FragColor; +layout(location = 0) flat in mediump int index; + +void main() +{ + FragColor = _16[index]; + if (index < 10) + { + FragColor += _16[index ^ 1]; + } + else + { + FragColor += _16[index & 1]; + } + if (index > 30) + { + FragColor += _60[index & 3].y; + } + else + { + FragColor += _60[index & 1].x; + } + vec4 foobar[4] = _60; + if (index > 30) + { + foobar[1].z = 20.0; + } + FragColor += foobar[index & 3].z; + vec4 baz[4] = _60; + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[index & 3].z; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/mix.frag b/third_party/spirv-cross/reference/shaders/frag/mix.frag new file mode 100644 index 0000000000..2b288dff02 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/mix.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn0; +layout(location = 1) in vec4 vIn1; +layout(location = 2) in float vIn2; +layout(location = 3) in float vIn3; + +void main() +{ + bvec4 l = bvec4(false, true, false, false); + FragColor = mix(vIn0, vIn1, l); + bool f = true; + FragColor = vec4(f ? vIn3 : vIn2); + FragColor = mix(vIn1, vIn0, bvec4(f)); + FragColor = vec4(f ? vIn2 : vIn3); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/modf-pointer-function-analysis.frag b/third_party/spirv-cross/reference/shaders/frag/modf-pointer-function-analysis.frag new file mode 100644 index 0000000000..2ca0050bad --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/modf-pointer-function-analysis.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +vec4 modf_inner(out vec4 tmp) +{ + vec4 _20 = modf(v, tmp); + return _20; +} + +float modf_inner_partial(inout vec4 tmp) +{ + float _30 = modf(v.x, tmp.x); + return _30; +} + +void main() +{ + vec4 param; + vec4 _37 = modf_inner(param); + vec4 tmp = param; + vo0 = _37; + vo1 = tmp; + vec4 param_1 = tmp; + float _43 = modf_inner_partial(param_1); + tmp = param_1; + vo0.x += _43; + vo1.x += tmp.x; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/partial-write-preserve.frag b/third_party/spirv-cross/reference/shaders/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..87e689aff2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/partial-write-preserve.frag @@ -0,0 +1,109 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct B +{ + float a; + float b; +}; + +layout(binding = 0, std140) uniform UBO +{ + mediump int some_value; +} _51; + +void partial_inout(inout vec4 x) +{ + x.x = 10.0; +} + +void complete_inout(out vec4 x) +{ + x = vec4(50.0); +} + +void branchy_inout(inout vec4 v) +{ + v.y = 20.0; + if (_51.some_value == 20) + { + v = vec4(50.0); + } +} + +void branchy_inout_2(out vec4 v) +{ + if (_51.some_value == 20) + { + v = vec4(50.0); + } + else + { + v = vec4(70.0); + } + v.y = 20.0; +} + +void partial_inout(inout B b) +{ + b.b = 40.0; +} + +void complete_inout(out B b) +{ + b = B(100.0, 200.0); +} + +void branchy_inout(inout B b) +{ + b.b = 20.0; + if (_51.some_value == 20) + { + b = B(10.0, 40.0); + } +} + +void branchy_inout_2(out B b) +{ + if (_51.some_value == 20) + { + b = B(10.0, 40.0); + } + else + { + b = B(70.0, 70.0); + } + b.b = 20.0; +} + +void main() +{ + vec4 a = vec4(10.0); + vec4 param = a; + partial_inout(param); + a = param; + vec4 param_1; + complete_inout(param_1); + a = param_1; + vec4 param_2 = a; + branchy_inout(param_2); + a = param_2; + vec4 param_3; + branchy_inout_2(param_3); + a = param_3; + B b = B(10.0, 20.0); + B param_4 = b; + partial_inout(param_4); + b = param_4; + B param_5; + complete_inout(param_5); + b = param_5; + B param_6 = b; + branchy_inout(param_6); + b = param_6; + B param_7; + branchy_inout_2(param_7); + b = param_7; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-ordered.frag b/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-ordered.frag new file mode 100644 index 0000000000..915b56511f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-ordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-unordered.frag b/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-unordered.frag new file mode 100644 index 0000000000..13962daf19 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/pixel-interlock-unordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(pixel_interlock_unordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/pls.frag b/third_party/spirv-cross/reference/shaders/frag/pls.frag new file mode 100644 index 0000000000..1cafdbd365 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/pls.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 PLSOut0; +layout(location = 0) in vec4 PLSIn0; +layout(location = 1) out vec4 PLSOut1; +layout(location = 1) in vec4 PLSIn1; +layout(location = 2) out vec4 PLSOut2; +layout(location = 2) in vec4 PLSIn2; +layout(location = 3) out vec4 PLSOut3; +layout(location = 3) in vec4 PLSIn3; + +void main() +{ + PLSOut0 = PLSIn0 * 2.0; + PLSOut1 = PLSIn1 * 6.0; + PLSOut2 = PLSIn2 * 7.0; + PLSOut3 = PLSIn3 * 4.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag b/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 0000000000..d086560e5d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage.frag b/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage.frag new file mode 100644 index 0000000000..caca9c03cb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/post-depth-coverage.frag @@ -0,0 +1,15 @@ +#version 450 +#if defined(GL_ARB_post_depth_coverge) +#extension GL_ARB_post_depth_coverage : require +#else +#extension GL_EXT_post_depth_coverage : require +#endif +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/round-even.frag b/third_party/spirv-cross/reference/shaders/frag/round-even.frag new file mode 100644 index 0000000000..ab6f37adc1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/round-even.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; + +void main() +{ + FragColor = roundEven(vA); + FragColor *= roundEven(vB); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/round.frag b/third_party/spirv-cross/reference/shaders/frag/round.frag new file mode 100644 index 0000000000..0f1fc0db0f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/round.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; + +void main() +{ + FragColor = round(vA); + FragColor *= round(vB); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sample-interlock-ordered.frag b/third_party/spirv-cross/reference/shaders/frag/sample-interlock-ordered.frag new file mode 100644 index 0000000000..9d5f90e4aa --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sample-interlock-ordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(sample_interlock_ordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _47 = atomicAnd(_30.bar, uint(gl_SampleMaskIn[0])); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sample-interlock-unordered.frag b/third_party/spirv-cross/reference/shaders/frag/sample-interlock-unordered.frag new file mode 100644 index 0000000000..441198814e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sample-interlock-unordered.frag @@ -0,0 +1,35 @@ +#version 450 +#ifdef GL_ARB_fragment_shader_interlock +#extension GL_ARB_fragment_shader_interlock : enable +#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB() +#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB() +#elif defined(GL_INTEL_fragment_shader_ordering) +#extension GL_INTEL_fragment_shader_ordering : enable +#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL() +#define SPIRV_Cross_endInvocationInterlock() +#endif +#if defined(GL_ARB_fragment_shader_interlock) +layout(sample_interlock_unordered) in; +#elif !defined(GL_INTEL_fragment_shader_ordering) +#error Fragment Shader Interlock/Ordering extension missing! +#endif + +layout(binding = 2, std430) coherent buffer Buffer +{ + int foo; + uint bar; +} _30; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; + +void main() +{ + SPIRV_Cross_beginInvocationInterlock(); + imageStore(img, ivec2(0), vec4(1.0, 0.0, 0.0, 1.0)); + uint _27 = imageAtomicAdd(img2, ivec2(0), 1u); + _30.foo += 42; + uint _41 = atomicAnd(_30.bar, 255u); + SPIRV_Cross_endInvocationInterlock(); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sample-parameter.frag b/third_party/spirv-cross/reference/shaders/frag/sample-parameter.frag new file mode 100644 index 0000000000..3c130e68d4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sample-parameter.frag @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + FragColor = (gl_SamplePosition + vec2(float(gl_SampleMaskIn[0]))) + vec2(float(gl_SampleID)); + gl_SampleMask[0] = 1; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sampler-ms.frag b/third_party/spirv-cross/reference/shaders/frag/sampler-ms.frag new file mode 100644 index 0000000000..dbab3fb819 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sampler-ms.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DMS uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + FragColor = ((texelFetch(uSampler, coord, 0) + texelFetch(uSampler, coord, 1)) + texelFetch(uSampler, coord, 2)) + texelFetch(uSampler, coord, 3); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sampler-proj.frag b/third_party/spirv-cross/reference/shaders/frag/sampler-proj.frag new file mode 100644 index 0000000000..865dec6c8b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sampler-proj.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vTex; + +void main() +{ + highp vec4 _19 = vTex; + _19.z = vTex.w; + FragColor = textureProj(uTex, _19.xyz); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/sampler.frag b/third_party/spirv-cross/reference/shaders/frag/sampler.frag new file mode 100644 index 0000000000..d62f0afeff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/sampler.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTex; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; + +vec4 sample_texture(mediump sampler2D tex, vec2 uv) +{ + return texture(tex, uv); +} + +void main() +{ + vec2 param = vTex; + FragColor = vColor * sample_texture(uTex, param); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/reference/shaders/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..94d671b5a9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/scalar-refract-reflect.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vRefract; + +void main() +{ + FragColor = refract(vRefract.x, vRefract.y, vRefract.z); + FragColor += reflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/selection-block-dominator.frag b/third_party/spirv-cross/reference/shaders/frag/selection-block-dominator.frag new file mode 100644 index 0000000000..a0242a00b5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/selection-block-dominator.frag @@ -0,0 +1,20 @@ +#version 450 + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + int v; + if (vIndex != 1) + { + FragColor = vec4(1.0); + return; + } + else + { + v = 10; + } + FragColor = vec4(float(v)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/shader-clock.frag b/third_party/spirv-cross/reference/shaders/frag/shader-clock.frag new file mode 100644 index 0000000000..15123d3fb9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/shader-clock.frag @@ -0,0 +1,23 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_shader_realtime_clock : require +#extension GL_ARB_shader_clock : require + +void main() +{ + uvec2 _11 = clockRealtime2x32EXT(); + uvec2 a = _11; + uint64_t _15 = clockRealtimeEXT(); + uint64_t b = _15; + uvec2 _18 = clock2x32ARB(); + uvec2 c = _18; + uint64_t _20 = clockARB(); + uint64_t d = _20; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/struct-type-unrelated-alias.frag b/third_party/spirv-cross/reference/shaders/frag/struct-type-unrelated-alias.frag new file mode 100644 index 0000000000..f38d18ff28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/struct-type-unrelated-alias.frag @@ -0,0 +1,18 @@ +#version 450 + +struct T +{ + float a; +}; + +layout(location = 0) out float FragColor; + +void main() +{ + T foo; + foo.a = 10.0; + T bar; + bar.a = 20.0; + FragColor = foo.a + bar.a; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/switch-unreachable-break.frag b/third_party/spirv-cross/reference/shaders/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..d8396d69a9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/switch-unreachable-break.frag @@ -0,0 +1,36 @@ +#version 450 + +layout(binding = 0, std140) uniform UBO +{ + int cond; + int cond2; +} _13; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bool frog = false; + switch (_13.cond) + { + case 1: + { + if (_13.cond2 < 50) + { + break; + } + else + { + discard; + } + break; // unreachable workaround + } + default: + { + frog = true; + break; + } + } + FragColor = mix(vec4(20.0), vec4(10.0), bvec4(frog)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/switch-unsigned-case.frag b/third_party/spirv-cross/reference/shaders/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..4177f9e99a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/switch-unsigned-case.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0, std140) uniform Buff +{ + mediump uint TestVal; +} _15; + +layout(location = 0) out vec4 fsout_Color; + +void main() +{ + fsout_Color = vec4(1.0); + switch (_15.TestVal) + { + case 0u: + { + fsout_Color = vec4(0.100000001490116119384765625); + break; + } + case 1u: + { + fsout_Color = vec4(0.20000000298023223876953125); + break; + } + } +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/swizzle.frag b/third_party/spirv-cross/reference/shaders/frag/swizzle.frag new file mode 100644 index 0000000000..a229e5b0d5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/swizzle.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D samp; + +layout(location = 0) out vec4 FragColor; +layout(location = 2) in vec2 vUV; +layout(location = 1) in vec3 vNormal; + +void main() +{ + FragColor = vec4(texture(samp, vUV).xyz, 1.0); + FragColor = vec4(texture(samp, vUV).xz, 1.0, 4.0); + FragColor = vec4(texture(samp, vUV).xx, texture(samp, vUV + vec2(0.100000001490116119384765625)).yy); + FragColor = vec4(vNormal, 1.0); + FragColor = vec4(vNormal + vec3(1.7999999523162841796875), 1.0); + FragColor = vec4(vUV, vUV + vec2(1.7999999523162841796875)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..658468aa41 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uTexture; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/ubo-load-row-major-workaround.frag b/third_party/spirv-cross/reference/shaders/frag/ubo-load-row-major-workaround.frag new file mode 100644 index 0000000000..13049b456b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/ubo-load-row-major-workaround.frag @@ -0,0 +1,48 @@ +#version 450 + +struct RowMajor +{ + mat4 B; +}; + +struct NestedRowMajor +{ + RowMajor rm; +}; + +layout(binding = 2, std140) uniform UBO3 +{ + layout(row_major) NestedRowMajor rm2; +} _17; + +layout(binding = 1, std140) uniform UBO2 +{ + layout(row_major) RowMajor rm; +} _35; + +layout(binding = 0, std140) uniform UBO +{ + layout(row_major) mat4 A; + mat4 C; +} _42; + +layout(binding = 3, std140) uniform UBONoWorkaround +{ + mat4 D; +} _56; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 Clip; + +NestedRowMajor spvWorkaroundRowMajor(NestedRowMajor wrap) { return wrap; } +mat4 spvWorkaroundRowMajor(mat4 wrap) { return wrap; } + +void main() +{ + NestedRowMajor rm2_loaded; + rm2_loaded.rm.B = spvWorkaroundRowMajor(_17.rm2).rm.B; + FragColor = (((rm2_loaded.rm.B * spvWorkaroundRowMajor(_35.rm.B)) * spvWorkaroundRowMajor(_42.A)) * spvWorkaroundRowMajor(_42.C)) * Clip; + FragColor += (_56.D * Clip); + FragColor += (_42.A[1] * Clip); +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/ubo_layout.frag b/third_party/spirv-cross/reference/shaders/frag/ubo_layout.frag new file mode 100644 index 0000000000..bc0b01c065 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/ubo_layout.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct Str +{ + mat4 foo; +}; + +layout(binding = 0, std140) uniform UBO1 +{ + layout(row_major) Str foo; +} ubo1; + +layout(binding = 1, std140) uniform UBO2 +{ + Str foo; +} ubo0; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ubo1.foo.foo[0] + ubo0.foo.foo[0]; +} + diff --git a/third_party/spirv-cross/reference/shaders/frag/unary-enclose.frag b/third_party/spirv-cross/reference/shaders/frag/unary-enclose.frag new file mode 100644 index 0000000000..3006e86cb5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/frag/unary-enclose.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn; +layout(location = 1) flat in mediump ivec4 vIn1; + +void main() +{ + FragColor = -(-vIn); + mediump ivec4 a = ~(~vIn1); + bool b = false; + b = !(!b); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/basic.geom b/third_party/spirv-cross/reference/shaders/geom/basic.geom new file mode 100644 index 0000000000..296ce5792c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/basic.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(invocations = 4, triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal + vec3(float(gl_InvocationID)); + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + vec3(4.0 * float(gl_InvocationID)); + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + vec3(2.0 * float(gl_InvocationID)); + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/geometry-passthrough.geom b/third_party/spirv-cross/reference/shaders/geom/geometry-passthrough.geom new file mode 100644 index 0000000000..d0d8806ad2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/geometry-passthrough.geom @@ -0,0 +1,27 @@ +#version 450 +#extension GL_NV_geometry_shader_passthrough : require +layout(triangles) in; + +layout(passthrough) in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +layout(passthrough, location = 0) in VertexBlock +{ + int a; + int b; +} v1[3]; + +layout(location = 2) in VertexBlock2 +{ + int a; + layout(passthrough) int b; +} v2[3]; + + +void main() +{ + gl_Layer = (gl_InvocationID + v1[0].a) + v2[1].b; +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/lines-adjacency.geom b/third_party/spirv-cross/reference/shaders/geom/lines-adjacency.geom new file mode 100644 index 0000000000..46a21e9fb0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/lines-adjacency.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(lines_adjacency) in; +layout(max_vertices = 3, line_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[4]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/lines.geom b/third_party/spirv-cross/reference/shaders/geom/lines.geom new file mode 100644 index 0000000000..c5aaa53d35 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/lines.geom @@ -0,0 +1,23 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(lines) in; +layout(max_vertices = 2, line_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[2]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/multi-stream.geom b/third_party/spirv-cross/reference/shaders/geom/multi-stream.geom new file mode 100644 index 0000000000..548164d780 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/multi-stream.geom @@ -0,0 +1,14 @@ +#version 450 +layout(triangles) in; +layout(max_vertices = 2, points) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + EmitStreamVertex(0); + EndStreamPrimitive(0); + gl_Position = gl_in[0].gl_Position + vec4(2.0); + EmitStreamVertex(1); + EndStreamPrimitive(1); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/points.geom b/third_party/spirv-cross/reference/shaders/geom/points.geom new file mode 100644 index 0000000000..4d59137c3a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/points.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(points) in; +layout(max_vertices = 3, points) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[1]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/single-invocation.geom b/third_party/spirv-cross/reference/shaders/geom/single-invocation.geom new file mode 100644 index 0000000000..fdccacc04f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/single-invocation.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/transform-feedback-streams.geom b/third_party/spirv-cross/reference/shaders/geom/transform-feedback-streams.geom new file mode 100644 index 0000000000..4d238b4adf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/transform-feedback-streams.geom @@ -0,0 +1,26 @@ +#version 450 +layout(points) in; +layout(max_vertices = 2, points) out; + +layout(xfb_buffer = 1, xfb_stride = 20, stream = 1) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(location = 0, xfb_buffer = 2, xfb_stride = 32, xfb_offset = 16, stream = 1) out vec4 vFoo; +layout(xfb_buffer = 3, xfb_stride = 16, stream = 2) out VertOut +{ + layout(location = 1, xfb_offset = 0) vec4 vBar; +} _23; + + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + EmitStreamVertex(1); + _23.vBar = vec4(5.0); + EmitStreamVertex(2); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/triangles-adjacency.geom b/third_party/spirv-cross/reference/shaders/geom/triangles-adjacency.geom new file mode 100644 index 0000000000..e9e6857a1f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/triangles-adjacency.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles_adjacency) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[6]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/geom/triangles.geom b/third_party/spirv-cross/reference/shaders/geom/triangles.geom new file mode 100644 index 0000000000..fdccacc04f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/geom/triangles.geom @@ -0,0 +1,26 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require +layout(triangles) in; +layout(max_vertices = 3, triangle_strip) out; + +layout(location = 0) out vec3 vNormal; +layout(location = 0) in VertexData +{ + vec3 normal; +} vin[3]; + + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + EndPrimitive(); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.frag new file mode 100644 index 0000000000..6e8dbf1a9c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.frag @@ -0,0 +1,12 @@ +#version 100 +#extension GL_EXT_shader_texture_lod : require +precision mediump float; +precision highp int; + +uniform mediump sampler2D tex; + +void main() +{ + gl_FragData[0] = texture2DLodEXT(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.vert new file mode 100644 index 0000000000..b73faa47ab --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/explicit-lod.legacy.vert @@ -0,0 +1,11 @@ +#version 100 + +uniform mediump sampler2D tex; + +varying mediump vec4 FragColor; + +void main() +{ + FragColor = texture2DLod(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 3.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/fma.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/fma.legacy.frag new file mode 100644 index 0000000000..61e850454e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/fma.legacy.frag @@ -0,0 +1,14 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp vec4 vA; +varying highp vec4 vB; +varying highp vec4 vC; + +void main() +{ + gl_FragData[0] = vA * vB + vC; + gl_FragData[0] = (vA * vB + vC) * (vB * vC + vA); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/hyperbolic.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/hyperbolic.legacy.frag new file mode 100644 index 0000000000..f4d99fe98d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/hyperbolic.legacy.frag @@ -0,0 +1,52 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec3 vector; + +void main() +{ + gl_FragData[0] = vec4(1.0); + gl_FragData[0].w *= ((exp(scalar) - exp(-scalar)) * 0.5); + gl_FragData[0].w *= ((exp(scalar) + exp(-scalar)) * 0.5); + highp float _125 = exp(scalar); + highp float _126 = exp(-scalar); + gl_FragData[0].w *= ((_125 - _126) / (_125 + _126)); + gl_FragData[0].w *= log(scalar + sqrt(scalar * scalar + 1.0)); + gl_FragData[0].w *= log(scalar + sqrt(scalar * scalar - 1.0)); + gl_FragData[0].w *= (log((1.0 + scalar) / (1.0 - scalar)) * 0.5); + highp vec4 _58 = gl_FragData[0]; + highp vec3 _60 = _58.xyz * ((exp(vector) - exp(-vector)) * 0.5); + gl_FragData[0].x = _60.x; + gl_FragData[0].y = _60.y; + gl_FragData[0].z = _60.z; + highp vec4 _72 = gl_FragData[0]; + highp vec3 _74 = _72.xyz * ((exp(vector) + exp(-vector)) * 0.5); + gl_FragData[0].x = _74.x; + gl_FragData[0].y = _74.y; + gl_FragData[0].z = _74.z; + highp vec3 _127 = exp(vector); + highp vec3 _128 = exp(-vector); + highp vec4 _83 = gl_FragData[0]; + highp vec3 _85 = _83.xyz * ((_127 - _128) / (_127 + _128)); + gl_FragData[0].x = _85.x; + gl_FragData[0].y = _85.y; + gl_FragData[0].z = _85.z; + highp vec4 _94 = gl_FragData[0]; + highp vec3 _96 = _94.xyz * log(vector + sqrt(vector * vector + 1.0)); + gl_FragData[0].x = _96.x; + gl_FragData[0].y = _96.y; + gl_FragData[0].z = _96.z; + highp vec4 _105 = gl_FragData[0]; + highp vec3 _107 = _105.xyz * log(vector + sqrt(vector * vector - 1.0)); + gl_FragData[0].x = _107.x; + gl_FragData[0].y = _107.y; + gl_FragData[0].z = _107.z; + highp vec4 _116 = gl_FragData[0]; + highp vec3 _118 = _116.xyz * (log((1.0 + vector) / (1.0 - vector)) * 0.5); + gl_FragData[0].x = _118.x; + gl_FragData[0].y = _118.y; + gl_FragData[0].z = _118.z; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/io-blocks.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/io-blocks.legacy.frag new file mode 100644 index 0000000000..d5a60d53e9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/io-blocks.legacy.frag @@ -0,0 +1,12 @@ +#version 100 +precision mediump float; +precision highp int; + +varying vec4 vin_color; +varying highp vec3 vin_normal; + +void main() +{ + gl_FragData[0] = vin_color + vin_normal.xyzz; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/isnan-isinf.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/isnan-isinf.legacy.frag new file mode 100644 index 0000000000..d19e4bec72 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/isnan-isinf.legacy.frag @@ -0,0 +1,28 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec4 vector; + +void main() +{ + gl_FragData[0] = vec4(0.0); + if (scalar != scalar) + { + gl_FragData[0].x = 1.0; + } + if (scalar != 0.0 && 2.0 * scalar == scalar) + { + gl_FragData[0].y = 1.0; + } + if (any(notEqual(vector, vector))) + { + gl_FragData[0].z = 1.0; + } + if (any(bvec4(vector.x != 0.0 && 2.0 * vector.x == vector.x, vector.y != 0.0 && 2.0 * vector.y == vector.y, vector.z != 0.0 && 2.0 * vector.z == vector.z, vector.w != 0.0 && 2.0 * vector.w == vector.w))) + { + gl_FragData[0].w = 1.0; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/modf.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/modf.legacy.frag new file mode 100644 index 0000000000..ece29a3b3c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/modf.legacy.frag @@ -0,0 +1,22 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float scalar; +varying highp vec2 vector; + +void main() +{ + highp float sipart; + sipart = float(int(scalar)); + highp float sfpart = scalar - sipart; + highp vec2 _20 = vec2(sipart, sfpart); + gl_FragData[0].x = _20.x; + gl_FragData[0].y = _20.y; + highp vec2 vipart; + vipart = vec2(ivec2(vector)); + highp vec2 vfpart = vector - vipart; + gl_FragData[0].z = vfpart.x; + gl_FragData[0].w = vfpart.y; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag new file mode 100644 index 0000000000..1c811d3089 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag @@ -0,0 +1,39 @@ +#version 100 +precision mediump float; +precision highp int; + +struct Foo +{ + highp vec4 a; + highp vec4 b; +}; + +struct Bar +{ + highp vec4 a; + highp vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +varying highp vec4 baz_foo_a; +varying highp vec4 baz_foo_b; +varying highp vec4 baz_bar_a; +varying highp vec4 baz_bar_b; +varying highp vec4 _33_a_a; +varying highp vec4 _33_a_b; +varying highp vec4 _33_b_a; +varying highp vec4 _33_b_b; + +void main() +{ + Baz bazzy = Baz(Foo(baz_foo_a, baz_foo_b), Bar(baz_bar_a, baz_bar_b)); + Foo bazzy_foo = Foo(baz_foo_a, baz_foo_b); + Bar bazzy_bar = Bar(baz_bar_a, baz_bar_b); + gl_FragData[0] = (((_33_a_a + _33_b_b) + bazzy.foo.b) + bazzy_foo.a) + bazzy_bar.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/round.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/round.legacy.frag new file mode 100644 index 0000000000..9033bc3c56 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/round.legacy.frag @@ -0,0 +1,13 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp vec4 vA; +varying highp float vB; + +void main() +{ + gl_FragData[0] = floor(vA + vec4(0.5)); + gl_FragData[0] *= floor(vB + float(0.5)); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/struct-varying.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/struct-varying.legacy.frag new file mode 100644 index 0000000000..81b95dd816 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/struct-varying.legacy.frag @@ -0,0 +1,22 @@ +#version 100 +precision mediump float; +precision highp int; + +struct Inputs +{ + highp vec4 a; + highp vec2 b; +}; + +varying highp vec4 vin_a; +varying highp vec2 vin_b; + +void main() +{ + Inputs v0 = Inputs(vin_a, vin_b); + Inputs v1 = Inputs(vin_a, vin_b); + highp vec4 a = vin_a; + highp vec4 b = vin_b.xxyy; + gl_FragData[0] = ((((v0.a + v0.b.xxyy) + v1.a) + v1.b.yyxx) + a) + b; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/fragment/switch.legacy.frag b/third_party/spirv-cross/reference/shaders/legacy/fragment/switch.legacy.frag new file mode 100644 index 0000000000..9155d1cdbc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/fragment/switch.legacy.frag @@ -0,0 +1,78 @@ +#version 100 +precision mediump float; +precision highp int; + +varying highp float vIndexF; + +void main() +{ + int vIndex = int(vIndexF); + highp vec4 v = vec4(0.0); + for (int spvDummy21 = 0; spvDummy21 < 1; spvDummy21++) + { + if (vIndex == 2) + { + v = vec4(0.0, 2.0, 3.0, 4.0); + break; + } + else if ((vIndex == 4) || (vIndex == 5)) + { + v = vec4(1.0, 2.0, 3.0, 4.0); + break; + } + else if ((vIndex == 8) || (vIndex == 9)) + { + v = vec4(40.0, 20.0, 30.0, 40.0); + break; + } + else if (vIndex == 10) + { + v = vec4(10.0); + highp vec4 _43 = v; + highp vec4 _44 = vec4(1.0); + highp vec4 _45 = _43 + _44; + v = _45; + highp vec4 _46 = v; + highp vec4 _47 = vec4(2.0); + highp vec4 _48 = _46 + _47; + v = _48; + break; + } + else if (vIndex == 11) + { + highp vec4 _43 = v; + highp vec4 _44 = vec4(1.0); + highp vec4 _45 = _43 + _44; + v = _45; + highp vec4 _46 = v; + highp vec4 _47 = vec4(2.0); + highp vec4 _48 = _46 + _47; + v = _48; + break; + } + else if (vIndex == 12) + { + highp vec4 _46 = v; + highp vec4 _47 = vec4(2.0); + highp vec4 _48 = _46 + _47; + v = _48; + break; + } + else + { + v = vec4(10.0, 20.0, 30.0, 40.0); + break; + } + } + highp vec4 w = vec4(20.0); + for (int spvDummy165 = 0; spvDummy165 < 1; spvDummy165++) + { + if ((vIndex == 10) || (vIndex == 20)) + { + w = vec4(40.0); + break; + } + } + gl_FragData[0] = v + w; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/implicit-lod.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/implicit-lod.legacy.vert new file mode 100644 index 0000000000..2d2050498e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/implicit-lod.legacy.vert @@ -0,0 +1,9 @@ +#version 100 + +uniform mediump sampler2D tex; + +void main() +{ + gl_Position = texture2DLod(tex, vec2(0.4000000059604644775390625, 0.60000002384185791015625), 0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/int-attribute.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/int-attribute.legacy.vert new file mode 100644 index 0000000000..cc41c3fad2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/int-attribute.legacy.vert @@ -0,0 +1,13 @@ +#version 100 + +attribute vec4 attr_int4; +attribute float attr_int1; + +void main() +{ + gl_Position.x = float(int(attr_int4[int(attr_int1)])); + gl_Position.y = 0.0; + gl_Position.z = 0.0; + gl_Position.w = 0.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/inverse.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/inverse.legacy.vert new file mode 100644 index 0000000000..5c76e77fcf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/inverse.legacy.vert @@ -0,0 +1,85 @@ +#version 100 + +struct Buffer +{ + mat2 m2; + mat3 m3; + mat4 m4; + mediump mat2 m2r; + mediump mat3 m3r; + mediump mat4 m4r; +}; + +uniform Buffer _17; + +varying vec3 dets; +varying mat2 o2; +varying mat3 o3; +varying mat4 o4; +varying mat2 o2r; +varying mat3 o3r; +varying mat4 o4r; + +highp float spvDeterminant(highp mat2 m) +{ + return m[0][0] * m[1][1] - m[0][1] * m[1][0]; +} + +highp float spvDeterminant(highp mat3 m) +{ + return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0])); +} + +highp float spvDeterminant(highp mat4 m) +{ + return dot(m[0], vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2])); +} + +highp mat2 spvInverse(highp mat2 m) +{ + return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) * (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1])); +} + +highp mat3 spvInverse(highp mat3 m) +{ + highp vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]); + return mat3(t[0], m[0][2] * m[2][1] - m[0][1] * m[2][2], m[0][1] * m[1][2] - m[0][2] * m[1][1], t[1], m[0][0] * m[2][2] - m[0][2] * m[2][0], m[0][2] * m[1][0] - m[0][0] * m[1][2], t[2], m[0][1] * m[2][0] - m[0][0] * m[2][1], m[0][0] * m[1][1] - m[0][1] * m[1][0]) * (1.0 / dot(m[0], t)); +} + +highp mat4 spvInverse(highp mat4 m) +{ + highp vec4 t = vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]); + return mat4(t[0], m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], t[1], m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], t[2], m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], t[3], m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) * (1.0 / dot(m[0], t)); +} + +mediump mat2 spvInverseMP(mediump mat2 m) +{ + return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) * (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1])); +} + +mediump mat3 spvInverseMP(mediump mat3 m) +{ + mediump vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]); + return mat3(t[0], m[0][2] * m[2][1] - m[0][1] * m[2][2], m[0][1] * m[1][2] - m[0][2] * m[1][1], t[1], m[0][0] * m[2][2] - m[0][2] * m[2][0], m[0][2] * m[1][0] - m[0][0] * m[1][2], t[2], m[0][1] * m[2][0] - m[0][0] * m[2][1], m[0][0] * m[1][1] - m[0][1] * m[1][0]) * (1.0 / dot(m[0], t)); +} + +mediump mat4 spvInverseMP(mediump mat4 m) +{ + mediump vec4 t = vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]); + return mat4(t[0], m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], t[1], m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], t[2], m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], t[3], m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) * (1.0 / dot(m[0], t)); +} + +void main() +{ + dets.x = spvDeterminant(_17.m2); + dets.y = spvDeterminant(_17.m3); + dets.z = spvDeterminant(_17.m4); + o2 = spvInverse(_17.m2); + o3 = spvInverse(_17.m3); + o4 = spvInverse(_17.m4); + o2r = spvInverseMP(_17.m2r); + o3r = spvInverseMP(_17.m3r); + o4r = spvInverseMP(_17.m4r); + gl_Position = vec4(0.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/io-block.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/io-block.legacy.vert new file mode 100644 index 0000000000..3c518dc79e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/io-block.legacy.vert @@ -0,0 +1,13 @@ +#version 100 + +attribute vec4 Position; +varying vec4 vout_color; +varying vec3 vout_normal; + +void main() +{ + gl_Position = Position; + vout_color = vec4(1.0); + vout_normal = vec3(0.5); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/outer-product.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/outer-product.legacy.vert new file mode 100644 index 0000000000..39a642931a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/outer-product.legacy.vert @@ -0,0 +1,19 @@ +#version 100 + +varying mat2 m22; +attribute vec2 v2a; +attribute vec2 v2b; +varying mat3 m33; +attribute vec3 v3a; +attribute vec3 v3b; +varying mat4 m44; +attribute vec4 v4a; +attribute vec4 v4b; + +void main() +{ + m22 = mat2(v2a * v2b.x, v2a * v2b.y); + m33 = mat3(v3a * v3b.x, v3a * v3b.y, v3a * v3b.z); + m44 = mat4(v4a * v4b.x, v4a * v4b.y, v4a * v4b.z, v4a * v4b.w); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert new file mode 100644 index 0000000000..fa1d643bc4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert @@ -0,0 +1,18 @@ +#version 100 + +struct Foo +{ + float a[4]; +}; + +varying float foo_a[4]; + +void main() +{ + gl_Position = vec4(1.0); + for (int i = 0; i < 4; i++) + { + foo_a[i] = float(i + 2); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert new file mode 100644 index 0000000000..cf807c41f7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert @@ -0,0 +1,49 @@ +#version 100 + +struct Foo +{ + vec4 a; + vec4 b; +}; + +struct Bar +{ + vec4 a; + vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +varying vec4 _12_a_a; +varying vec4 _12_a_b; +varying vec4 _12_b_a; +varying vec4 _12_b_b; +varying vec4 baz_foo_a; +varying vec4 baz_foo_b; +varying vec4 baz_bar_a; +varying vec4 baz_bar_b; + +void main() +{ + _12_a_a = vec4(10.0); + _12_a_b = vec4(20.0); + _12_b_a = vec4(30.0); + _12_b_b = vec4(40.0); + _12_a_a = Foo(vec4(50.0), vec4(60.0)).a; + _12_a_b = Foo(vec4(50.0), vec4(60.0)).b; + _12_b_a = Bar(vec4(50.0), vec4(60.0)).a; + _12_b_b = Bar(vec4(50.0), vec4(60.0)).b; + baz_foo_a = Foo(vec4(100.0), vec4(200.0)).a; + baz_foo_b = Foo(vec4(100.0), vec4(200.0)).b; + baz_bar_a = Bar(vec4(300.0), vec4(400.0)).a; + baz_bar_b = Bar(vec4(300.0), vec4(400.0)).b; + baz_foo_a = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).foo.a; + baz_foo_b = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).foo.b; + baz_bar_a = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).bar.a; + baz_bar_b = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))).bar.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/struct-varying.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-varying.legacy.vert new file mode 100644 index 0000000000..fcdeb55bb6 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/struct-varying.legacy.vert @@ -0,0 +1,26 @@ +#version 100 + +struct Output +{ + vec4 a; + vec2 b; +}; + +varying vec4 vout_a; +varying vec2 vout_b; + +void main() +{ + Output s = Output(vec4(0.5), vec2(0.25)); + vout_a = s.a; + vout_b = s.b; + vout_a = s.a; + vout_b = s.b; + Output tmp = Output(vout_a, vout_b); + vout_a = tmp.a; + vout_b = tmp.b; + vout_a.x = 1.0; + vout_b.y = 1.0; + float c = vout_a.x; +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/switch-nested.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/switch-nested.legacy.vert new file mode 100644 index 0000000000..3ec027b447 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/switch-nested.legacy.vert @@ -0,0 +1,41 @@ +#version 100 + +struct UBO +{ + int func_arg; + int inner_func_arg; +}; + +uniform UBO _34; + +vec4 test_inner_func(bool b) +{ + if (b) + { + return vec4(1.0); + } + else + { + return vec4(0.0); + } +} + +vec4 test_func(bool b) +{ + if (b) + { + bool param = _34.inner_func_arg != 0; + return test_inner_func(param); + } + else + { + return vec4(0.0); + } +} + +void main() +{ + bool param = _34.func_arg != 0; + gl_Position = test_func(param); +} + diff --git a/third_party/spirv-cross/reference/shaders/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/reference/shaders/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..e0a35c2ec3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/legacy/vert/transpose.legacy.vert @@ -0,0 +1,60 @@ +#version 100 + +struct Buffer +{ + mat4 MVPRowMajor; + mat4 MVPColMajor; + mat4 M; + mediump mat4 MRelaxed; +}; + +uniform Buffer _13; + +attribute vec4 Position; +varying mat4 OutputMat1; +varying mat4 OutputMat2; +varying mat4 OutputMat3; +varying mat4 OutputMat4; +varying mat4 OutputMat5; +varying mat4 OutputMat6; +varying mediump mat4 OutputMat7; +varying mediump mat4 OutputMat8; + +highp mat4 spvWorkaroundRowMajor(highp mat4 wrap) { return wrap; } +mediump mat4 spvWorkaroundRowMajorMP(mediump mat4 wrap) { return wrap; } + +highp mat4 spvTranspose(highp mat4 m) +{ + return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]); +} + +mediump mat4 spvTransposeMP(mediump mat4 m) +{ + return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]); +} + +void main() +{ + vec4 c0 = spvWorkaroundRowMajor(_13.M) * (Position * _13.MVPRowMajor); + vec4 c1 = spvWorkaroundRowMajor(_13.M) * (spvWorkaroundRowMajor(_13.MVPColMajor) * Position); + vec4 c2 = spvWorkaroundRowMajor(_13.M) * (_13.MVPRowMajor * Position); + vec4 c3 = spvWorkaroundRowMajor(_13.M) * (Position * spvWorkaroundRowMajor(_13.MVPColMajor)); + vec4 c4 = _13.MVPRowMajor * Position; + vec4 c5 = Position * spvWorkaroundRowMajor(_13.MVPColMajor); + vec4 c6 = Position * _13.MVPRowMajor; + vec4 c7 = spvWorkaroundRowMajor(_13.MVPColMajor) * Position; + vec4 c8 = Position * (_13.MVPRowMajor * 2.0); + vec4 c9 = Position * (spvWorkaroundRowMajor(_13.MVPColMajor) * 2.0); + vec4 c10 = (_13.MVPRowMajor * 2.0) * Position; + vec4 c11 = (spvWorkaroundRowMajor(_13.MVPColMajor) * 2.0) * Position; + OutputMat1 = spvTranspose(_13.MVPRowMajor); + OutputMat2 = spvWorkaroundRowMajor(_13.MVPColMajor); + OutputMat3 = _13.MVPRowMajor; + OutputMat4 = spvTranspose(spvWorkaroundRowMajor(_13.MVPColMajor)); + OutputMat5 = spvTranspose(spvWorkaroundRowMajor(_13.M)); + OutputMat6 = spvTransposeMP(spvWorkaroundRowMajor(_13.MRelaxed)); + OutputMat7 = spvTranspose(spvWorkaroundRowMajor(_13.M)); + OutputMat8 = spvTransposeMP(spvWorkaroundRowMajor(_13.MRelaxed)); + gl_Position = ((((((((((c0 + c1) + c2) + c3) + c4) + c5) + c6) + c7) + c8) + c9) + c10) + c11; +} + diff --git a/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..20597b986e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, lines) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(vec3(gl_GlobalInvocationID), 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(vec3(gl_GlobalInvocationID), 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uvec2(0u, 1u) + uvec2(gl_LocalInvocationIndex); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..ecb8285df2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, points) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(vec3(gl_GlobalInvocationID), 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(vec3(gl_GlobalInvocationID), 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitivePointIndicesEXT[gl_LocalInvocationIndex] = gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk new file mode 100644 index 0000000000..e10459d7b9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh.vk @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +#extension GL_EXT_fragment_shading_rate : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(max_vertices = 24, max_primitives = 22, triangles) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +layout(location = 0) out vec4 vOut[24]; +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[24]; + +layout(location = 1) perprimitiveEXT out vec4 vPrim[22]; +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[22]; + +taskPayloadSharedEXT TaskPayload payload; +shared float shared_float[16]; + +void main() +{ + SetMeshOutputsEXT(24u, 22u); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(vec3(gl_GlobalInvocationID), 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(vec3(gl_GlobalInvocationID), 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22u) + { + vPrim[gl_LocalInvocationIndex] = vec4(vec3(gl_WorkGroupID), 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0u, 1u, 2u) + uvec3(gl_LocalInvocationIndex); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = (gl_GlobalInvocationID.x & 1u) != 0u; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} + diff --git a/third_party/spirv-cross/reference/shaders/tesc/basic.tesc b/third_party/spirv-cross/reference/shaders/tesc/basic.tesc new file mode 100644 index 0000000000..6019151adb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tesc/basic.tesc @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(vertices = 1) out; + +layout(location = 0) patch out vec3 vFoo; + +void main() +{ + gl_TessLevelInner[0] = 8.8999996185302734375; + gl_TessLevelInner[1] = 6.900000095367431640625; + gl_TessLevelOuter[0] = 8.8999996185302734375; + gl_TessLevelOuter[1] = 6.900000095367431640625; + gl_TessLevelOuter[2] = 3.900000095367431640625; + gl_TessLevelOuter[3] = 4.900000095367431640625; + vFoo = vec3(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tesc/water_tess.tesc b/third_party/spirv-cross/reference/shaders/tesc/water_tess.tesc new file mode 100644 index 0000000000..6f499380b7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tesc/water_tess.tesc @@ -0,0 +1,116 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(vertices = 1) out; + +layout(binding = 0, std140) uniform UBO +{ + vec4 uScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uMaxTessLevel; + float uDistanceMod; + vec4 uFrustum[6]; +} _41; + +layout(location = 1) patch out vec2 vOutPatchPosBase; +layout(location = 2) patch out vec4 vPatchLods; +layout(location = 0) in vec2 vPatchPosBase[]; + +bool frustum_cull(vec2 p0) +{ + vec2 min_xz = (p0 - vec2(10.0)) * _41.uScale.xy; + vec2 max_xz = ((p0 + _41.uPatchSize) + vec2(10.0)) * _41.uScale.xy; + vec3 bb_min = vec3(min_xz.x, -10.0, min_xz.y); + vec3 bb_max = vec3(max_xz.x, 10.0, max_xz.y); + vec3 center = (bb_min + bb_max) * 0.5; + float radius = 0.5 * length(bb_max - bb_min); + vec3 f0 = vec3(dot(_41.uFrustum[0], vec4(center, 1.0)), dot(_41.uFrustum[1], vec4(center, 1.0)), dot(_41.uFrustum[2], vec4(center, 1.0))); + vec3 f1 = vec3(dot(_41.uFrustum[3], vec4(center, 1.0)), dot(_41.uFrustum[4], vec4(center, 1.0)), dot(_41.uFrustum[5], vec4(center, 1.0))); + bool _205 = any(lessThanEqual(f0, vec3(-radius))); + bool _215; + if (!_205) + { + _215 = any(lessThanEqual(f1, vec3(-radius))); + } + else + { + _215 = _205; + } + return !_215; +} + +float lod_factor(vec2 pos_) +{ + vec2 pos = pos_ * _41.uScale.xy; + vec3 dist_to_cam = _41.uCamPos - vec3(pos.x, 0.0, pos.y); + float level = log2((length(dist_to_cam) + 9.9999997473787516355514526367188e-05) * _41.uDistanceMod); + return clamp(level, 0.0, _41.uMaxTessLevel.x); +} + +vec4 tess_level(vec4 lod) +{ + return exp2(-lod) * _41.uMaxTessLevel.y; +} + +float tess_level(float lod) +{ + return _41.uMaxTessLevel.y * exp2(-lod); +} + +void compute_tess_levels(vec2 p0) +{ + vOutPatchPosBase = p0; + vec2 param = p0 + (vec2(-0.5) * _41.uPatchSize); + float l00 = lod_factor(param); + vec2 param_1 = p0 + (vec2(0.5, -0.5) * _41.uPatchSize); + float l10 = lod_factor(param_1); + vec2 param_2 = p0 + (vec2(1.5, -0.5) * _41.uPatchSize); + float l20 = lod_factor(param_2); + vec2 param_3 = p0 + (vec2(-0.5, 0.5) * _41.uPatchSize); + float l01 = lod_factor(param_3); + vec2 param_4 = p0 + (vec2(0.5) * _41.uPatchSize); + float l11 = lod_factor(param_4); + vec2 param_5 = p0 + (vec2(1.5, 0.5) * _41.uPatchSize); + float l21 = lod_factor(param_5); + vec2 param_6 = p0 + (vec2(-0.5, 1.5) * _41.uPatchSize); + float l02 = lod_factor(param_6); + vec2 param_7 = p0 + (vec2(0.5, 1.5) * _41.uPatchSize); + float l12 = lod_factor(param_7); + vec2 param_8 = p0 + (vec2(1.5) * _41.uPatchSize); + float l22 = lod_factor(param_8); + vec4 lods = vec4(dot(vec4(l01, l11, l02, l12), vec4(0.25)), dot(vec4(l00, l10, l01, l11), vec4(0.25)), dot(vec4(l10, l20, l11, l21), vec4(0.25)), dot(vec4(l11, l21, l12, l22), vec4(0.25))); + vPatchLods = lods; + vec4 outer_lods = min(lods, lods.yzwx); + vec4 param_9 = outer_lods; + vec4 levels = tess_level(param_9); + gl_TessLevelOuter[0] = levels.x; + gl_TessLevelOuter[1] = levels.y; + gl_TessLevelOuter[2] = levels.z; + gl_TessLevelOuter[3] = levels.w; + float min_lod = min(min(lods.x, lods.y), min(lods.z, lods.w)); + float param_10 = min(min_lod, l11); + float inner = tess_level(param_10); + gl_TessLevelInner[0] = inner; + gl_TessLevelInner[1] = inner; +} + +void main() +{ + vec2 p0 = vPatchPosBase[0]; + vec2 param = p0; + if (!frustum_cull(param)) + { + gl_TessLevelOuter[0] = -1.0; + gl_TessLevelOuter[1] = -1.0; + gl_TessLevelOuter[2] = -1.0; + gl_TessLevelOuter[3] = -1.0; + gl_TessLevelInner[0] = -1.0; + gl_TessLevelInner[1] = -1.0; + } + else + { + vec2 param_1 = p0; + compute_tess_levels(param_1); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/ccw.tese b/third_party/spirv-cross/reference/shaders/tese/ccw.tese new file mode 100644 index 0000000000..a2a4508ac0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/ccw.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, ccw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/cw.tese b/third_party/spirv-cross/reference/shaders/tese/cw.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/cw.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/equal.tese b/third_party/spirv-cross/reference/shaders/tese/equal.tese new file mode 100644 index 0000000000..6d30518a30 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/equal.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, equal_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/fractional_even.tese b/third_party/spirv-cross/reference/shaders/tese/fractional_even.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/fractional_even.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/fractional_odd.tese b/third_party/spirv-cross/reference/shaders/tese/fractional_odd.tese new file mode 100644 index 0000000000..608c19aba7 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/fractional_odd.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_odd_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/input-array.tese b/third_party/spirv-cross/reference/shaders/tese/input-array.tese new file mode 100644 index 0000000000..8a1aaf9fdb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/input-array.tese @@ -0,0 +1,11 @@ +#version 450 +layout(quads, ccw, fractional_odd_spacing) in; + +layout(location = 0) in vec4 Floats[]; +layout(location = 2) in vec4 Floats2[]; + +void main() +{ + gl_Position = (Floats[0] * gl_TessCoord.x) + (Floats2[1] * gl_TessCoord.y); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/line.tese b/third_party/spirv-cross/reference/shaders/tese/line.tese new file mode 100644 index 0000000000..8b6ad8da20 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/line.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(isolines, point_mode, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/load-array-of-array.tese b/third_party/spirv-cross/reference/shaders/tese/load-array-of-array.tese new file mode 100644 index 0000000000..7fab08ef66 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/load-array-of-array.tese @@ -0,0 +1,16 @@ +#version 450 +layout(quads, ccw, equal_spacing) in; + +layout(location = 0) in vec4 vTexCoord[][1]; + +void main() +{ + vec4 _17_unrolled[32][1]; + for (int i = 0; i < int(32); i++) + { + _17_unrolled[i] = vTexCoord[i]; + } + vec4 tmp[32][1] = _17_unrolled; + gl_Position = (tmp[0][0] + tmp[2][0]) + tmp[3][0]; +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/patch-input-array.tese b/third_party/spirv-cross/reference/shaders/tese/patch-input-array.tese new file mode 100644 index 0000000000..413d8b391f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/patch-input-array.tese @@ -0,0 +1,10 @@ +#version 450 +layout(quads, ccw, equal_spacing) in; + +layout(location = 0) patch in float P[4]; + +void main() +{ + gl_Position = vec4(P[0], P[1], P[2], P[3]); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/triangle.tese b/third_party/spirv-cross/reference/shaders/tese/triangle.tese new file mode 100644 index 0000000000..95781493d8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/triangle.tese @@ -0,0 +1,9 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(triangles, cw, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/tese/water_tess.tese b/third_party/spirv-cross/reference/shaders/tese/water_tess.tese new file mode 100644 index 0000000000..a0cf42d513 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/tese/water_tess.tese @@ -0,0 +1,61 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +layout(quads, cw, fractional_even_spacing) in; + +layout(binding = 1, std140) uniform UBO +{ + mat4 uMVP; + vec4 uScale; + vec2 uInvScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uInvHeightmapSize; +} _31; + +layout(binding = 0) uniform mediump sampler2D uHeightmapDisplacement; + +layout(location = 0) patch in vec2 vOutPatchPosBase; +layout(location = 1) patch in vec4 vPatchLods; +layout(location = 1) out vec4 vGradNormalTex; +layout(location = 0) out vec3 vWorld; + +vec2 lerp_vertex(vec2 tess_coord) +{ + return vOutPatchPosBase + (tess_coord * _31.uPatchSize); +} + +mediump vec2 lod_factor(vec2 tess_coord) +{ + mediump vec2 x = mix(vPatchLods.yx, vPatchLods.zw, vec2(tess_coord.x)); + mediump float level = mix(x.x, x.y, tess_coord.y); + mediump float floor_level = floor(level); + mediump float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod) +{ + return mix(textureLod(uHeightmapDisplacement, uv + (off * 0.5), lod.x).xyz, textureLod(uHeightmapDisplacement, uv + (off * 1.0), lod.x + 1.0).xyz, vec3(lod.y)); +} + +void main() +{ + vec2 tess_coord = gl_TessCoord.xy; + vec2 param = tess_coord; + vec2 pos = lerp_vertex(param); + vec2 param_1 = tess_coord; + mediump vec2 lod = lod_factor(param_1); + vec2 tex = pos * _31.uInvHeightmapSize; + pos *= _31.uScale.xy; + mediump float delta_mod = exp2(lod.x); + vec2 off = _31.uInvHeightmapSize * delta_mod; + vGradNormalTex = vec4(tex + (_31.uInvHeightmapSize * 0.5), tex * _31.uScale.zw); + vec2 param_2 = tex; + vec2 param_3 = off; + mediump vec2 param_4 = lod; + vec3 height_displacement = sample_height_displacement(param_2, param_3, param_4); + pos += height_displacement.yz; + vWorld = vec3(pos.x, height_displacement.x, pos.y); + gl_Position = _31.uMVP * vec4(vWorld, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/basic.vert b/third_party/spirv-cross/reference/shaders/vert/basic.vert new file mode 100644 index 0000000000..8f251cbedc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/basic.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 uMVP; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.uMVP * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/ground.vert b/third_party/spirv-cross/reference/shaders/vert/ground.vert new file mode 100644 index 0000000000..73923c447f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/ground.vert @@ -0,0 +1,116 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(binding = 0, std140) uniform PerPatch +{ + PatchData Patches[256]; +} _53; + +layout(binding = 2, std140) uniform GlobalGround +{ + vec4 GroundScale; + vec4 GroundPosition; + vec4 InvGroundSize_PatchScale; +} _156; + +layout(binding = 0, std140) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +} _236; + +layout(binding = 1) uniform mediump sampler2D TexLOD; +layout(binding = 0) uniform mediump sampler2D TexHeightmap; + +layout(location = 1) in vec4 LODWeights; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) in vec2 Position; +layout(location = 1) out vec3 EyeVec; +layout(location = 0) out vec2 TexCoord; + +vec2 warp_position() +{ + float vlod = dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs); + vlod = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : vlod; + float floor_lod = floor(vlod); + float fract_lod = vlod - floor_lod; + uint ufloor_lod = uint(floor_lod); + uvec2 uPosition = uvec2(Position); + uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - uvec2(1u); + uint _110; + if (uPosition.x < 32u) + { + _110 = mask.x; + } + else + { + _110 = 0u; + } + uint _120; + if (uPosition.y < 32u) + { + _120 = mask.y; + } + else + { + _120 = 0u; + } + uvec2 rounding = uvec2(_110, _120); + vec4 lower_upper_snapped = vec4((uPosition + rounding).xyxy & (~mask).xxyy); + return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, vec2(fract_lod)); +} + +vec2 lod_factor(vec2 uv) +{ + float level = textureLod(TexLOD, uv, 0.0).x * 7.96875; + float floor_level = floor(level); + float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +void main() +{ + vec2 PatchPos = _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _156.InvGroundSize_PatchScale.zw; + vec2 WarpedPos = warp_position(); + vec2 VertexPos = PatchPos + WarpedPos; + vec2 NormalizedPos = VertexPos * _156.InvGroundSize_PatchScale.xy; + vec2 param = NormalizedPos; + vec2 lod = lod_factor(param); + vec2 Offset = _156.InvGroundSize_PatchScale.xy * exp2(lod.x); + float Elevation = mix(textureLod(TexHeightmap, NormalizedPos + (Offset * 0.5), lod.x).x, textureLod(TexHeightmap, NormalizedPos + (Offset * 1.0), lod.x + 1.0).x, lod.y); + vec3 WorldPos = vec3(NormalizedPos.x, Elevation, NormalizedPos.y); + WorldPos *= _156.GroundScale.xyz; + WorldPos += _156.GroundPosition.xyz; + EyeVec = WorldPos - _236.g_CamPos.xyz; + TexCoord = NormalizedPos + (_156.InvGroundSize_PatchScale.xy * 0.5); + gl_Position = (((_236.g_ViewProj_Row0 * WorldPos.x) + (_236.g_ViewProj_Row1 * WorldPos.y)) + (_236.g_ViewProj_Row2 * WorldPos.z)) + _236.g_ViewProj_Row3; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/invariant.vert b/third_party/spirv-cross/reference/shaders/vert/invariant.vert new file mode 100644 index 0000000000..648ea2947c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/invariant.vert @@ -0,0 +1,19 @@ +#version 310 es + +invariant gl_Position; + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; +layout(location = 2) in vec4 vInput2; +layout(location = 0) invariant out vec4 vColor; + +void main() +{ + vec4 _20 = vInput1 * vInput2; + vec4 _21 = vInput0 + _20; + gl_Position = _21; + vec4 _27 = vInput0 - vInput1; + vec4 _29 = _27 * vInput2; + vColor = _29; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/no-contraction.vert b/third_party/spirv-cross/reference/shaders/vert/no-contraction.vert new file mode 100644 index 0000000000..83e392c6cc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/no-contraction.vert @@ -0,0 +1,24 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; + +void main() +{ + precise vec4 _15 = vA * vB; + vec4 mul = _15; + precise vec4 _19 = vA + vB; + vec4 add = _19; + precise vec4 _23 = vA - vB; + vec4 sub = _23; + precise vec4 _27 = vA * vB; + precise vec4 _30 = _27 + vC; + vec4 mad = _30; + precise vec4 _34 = mul + add; + precise vec4 _36 = _34 + sub; + precise vec4 _38 = _36 + mad; + vec4 summed = _38; + gl_Position = summed; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/ocean.vert b/third_party/spirv-cross/reference/shaders/vert/ocean.vert new file mode 100644 index 0000000000..60fa80ebdb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/ocean.vert @@ -0,0 +1,140 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(binding = 0, std140) uniform Offsets +{ + PatchData Patches[256]; +} _53; + +layout(binding = 4, std140) uniform GlobalOcean +{ + vec4 OceanScale; + vec4 OceanPosition; + vec4 InvOceanSize_PatchScale; + vec4 NormalTexCoordScale; +} _180; + +layout(binding = 0, std140) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +} _273; + +layout(binding = 1) uniform mediump sampler2D TexLOD; +layout(binding = 0) uniform mediump sampler2D TexDisplacement; + +layout(location = 1) in vec4 LODWeights; +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif +layout(location = 0) in vec4 Position; +layout(location = 0) out vec3 EyeVec; +layout(location = 1) out vec4 TexCoord; + +vec2 warp_position() +{ + float vlod = dot(LODWeights, _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].LODs); + vlod = all(equal(LODWeights, vec4(0.0))) ? _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.w : vlod; + float floor_lod = floor(vlod); + float fract_lod = vlod - floor_lod; + uint ufloor_lod = uint(floor_lod); + uvec4 uPosition = uvec4(Position); + uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - uvec2(1u); + uint _111; + if (uPosition.x < 32u) + { + _111 = mask.x; + } + else + { + _111 = 0u; + } + uvec4 rounding; + rounding.x = _111; + uint _122; + if (uPosition.y < 32u) + { + _122 = mask.x; + } + else + { + _122 = 0u; + } + rounding.y = _122; + uint _133; + if (uPosition.x < 32u) + { + _133 = mask.y; + } + else + { + _133 = 0u; + } + rounding.z = _133; + uint _145; + if (uPosition.y < 32u) + { + _145 = mask.y; + } + else + { + _145 = 0u; + } + rounding.w = _145; + vec4 lower_upper_snapped = vec4((uPosition.xyxy + rounding) & (~mask).xxyy); + return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, vec2(fract_lod)); +} + +vec2 lod_factor(vec2 uv) +{ + float level = textureLod(TexLOD, uv, 0.0).x * 7.96875; + float floor_level = floor(level); + float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +void main() +{ + vec2 PatchPos = _53.Patches[(gl_InstanceID + SPIRV_Cross_BaseInstance)].Position.xz * _180.InvOceanSize_PatchScale.zw; + vec2 WarpedPos = warp_position(); + vec2 VertexPos = PatchPos + WarpedPos; + vec2 NormalizedPos = VertexPos * _180.InvOceanSize_PatchScale.xy; + vec2 NormalizedTex = NormalizedPos * _180.NormalTexCoordScale.zw; + vec2 param = NormalizedPos; + vec2 lod = lod_factor(param); + vec2 Offset = (_180.InvOceanSize_PatchScale.xy * exp2(lod.x)) * _180.NormalTexCoordScale.zw; + vec3 Displacement = mix(textureLod(TexDisplacement, NormalizedTex + (Offset * 0.5), lod.x).yxz, textureLod(TexDisplacement, NormalizedTex + (Offset * 1.0), lod.x + 1.0).yxz, vec3(lod.y)); + vec3 WorldPos = vec3(NormalizedPos.x, 0.0, NormalizedPos.y) + Displacement; + WorldPos *= _180.OceanScale.xyz; + WorldPos += _180.OceanPosition.xyz; + EyeVec = WorldPos - _273.g_CamPos.xyz; + TexCoord = vec4(NormalizedTex, NormalizedTex * _180.NormalTexCoordScale.xy) + ((_180.InvOceanSize_PatchScale.xyxy * 0.5) * _180.NormalTexCoordScale.zwzw); + gl_Position = (((_273.g_ViewProj_Row0 * WorldPos.x) + (_273.g_ViewProj_Row1 * WorldPos.y)) + (_273.g_ViewProj_Row2 * WorldPos.z)) + _273.g_ViewProj_Row3; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/read-from-row-major-array.vert b/third_party/spirv-cross/reference/shaders/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..8b5ec96738 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/read-from-row-major-array.vert @@ -0,0 +1,48 @@ +#version 310 es + +layout(binding = 0, std140) uniform Block +{ + layout(row_major) mat2x3 var[3][4]; +} _104; + +layout(location = 0) in vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +highp mat2x3 spvWorkaroundRowMajor(highp mat2x3 wrap) { return wrap; } +mediump mat2x3 spvWorkaroundRowMajorMP(mediump mat2x3 wrap) { return wrap; } + +mediump float compare_float(float a, float b) +{ + return float(abs(a - b) < 0.0500000007450580596923828125); +} + +mediump float compare_vec3(vec3 a, vec3 b) +{ + float param = a.x; + float param_1 = b.x; + float param_2 = a.y; + float param_3 = b.y; + float param_4 = a.z; + float param_5 = b.z; + return (compare_float(param, param_1) * compare_float(param_2, param_3)) * compare_float(param_4, param_5); +} + +mediump float compare_mat2x3(mat2x3 a, mat2x3 b) +{ + vec3 param = a[0]; + vec3 param_1 = b[0]; + vec3 param_2 = a[1]; + vec3 param_3 = b[1]; + return compare_vec3(param, param_1) * compare_vec3(param_2, param_3); +} + +void main() +{ + gl_Position = a_position; + mediump float result = 1.0; + mat2x3 param = spvWorkaroundRowMajor(_104.var[0][0]); + mat2x3 param_1 = mat2x3(vec3(2.0, 6.0, -6.0), vec3(0.0, 5.0, 5.0)); + result *= compare_mat2x3(param, param_1); + v_vtxResult = result; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/return-array.vert b/third_party/spirv-cross/reference/shaders/vert/return-array.vert new file mode 100644 index 0000000000..20bb440ece --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/return-array.vert @@ -0,0 +1,23 @@ +#version 310 es + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; + +vec4[2] test() +{ + return vec4[](vec4(10.0), vec4(20.0)); +} + +vec4[2] test2() +{ + vec4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +void main() +{ + gl_Position = test()[0] + test2()[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/row-major-workaround.vert b/third_party/spirv-cross/reference/shaders/vert/row-major-workaround.vert new file mode 100644 index 0000000000..4fe6885d10 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/row-major-workaround.vert @@ -0,0 +1,30 @@ +#version 310 es + +layout(binding = 0, std140) uniform Buffer +{ + layout(row_major) mat4 HP; + layout(row_major) mediump mat4 MP; +} _21; + +layout(binding = 1, std140) uniform Buffer2 +{ + layout(row_major) mediump mat4 MP2; +} _39; + +layout(location = 0) out vec4 H; +layout(location = 0) in vec4 Hin; +layout(location = 1) out mediump vec4 M; +layout(location = 1) in mediump vec4 Min; +layout(location = 2) out mediump vec4 M2; + +highp mat4 spvWorkaroundRowMajor(highp mat4 wrap) { return wrap; } +mediump mat4 spvWorkaroundRowMajorMP(mediump mat4 wrap) { return wrap; } + +void main() +{ + gl_Position = vec4(1.0); + H = spvWorkaroundRowMajor(_21.HP) * Hin; + M = spvWorkaroundRowMajor(_21.MP) * Min; + M2 = spvWorkaroundRowMajorMP(_39.MP2) * Min; +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/texture_buffer.vert b/third_party/spirv-cross/reference/shaders/vert/texture_buffer.vert new file mode 100644 index 0000000000..217804dfce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/texture_buffer.vert @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_EXT_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(binding = 5, rgba32f) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/transform-feedback-decorations.vert b/third_party/spirv-cross/reference/shaders/vert/transform-feedback-decorations.vert new file mode 100644 index 0000000000..23e7cf3c19 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/transform-feedback-decorations.vert @@ -0,0 +1,22 @@ +#version 450 + +layout(xfb_buffer = 1, xfb_stride = 20) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(location = 0, xfb_buffer = 2, xfb_stride = 32, xfb_offset = 16) out vec4 vFoo; +layout(xfb_buffer = 3, xfb_stride = 16) out VertOut +{ + layout(location = 1, xfb_offset = 0) vec4 vBar; +} _22; + + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + _22.vBar = vec4(5.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vert/ubo.vert b/third_party/spirv-cross/reference/shaders/vert/ubo.vert new file mode 100644 index 0000000000..4e7236b290 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vert/ubo.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 mvp; +} _16; + +layout(location = 0) in vec4 aVertex; +layout(location = 0) out vec3 vNormal; +layout(location = 1) in vec3 aNormal; + +void main() +{ + gl_Position = _16.mvp * aVertex; + vNormal = aNormal; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk new file mode 100644 index 0000000000..771d049644 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp.vk @@ -0,0 +1,25 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Block; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer Block +{ + float v; +}; + +layout(set = 0, binding = 0, std140) uniform UBO +{ + Block blocks[4]; +} ubo; + +void main() +{ + Block blocks[4]; + blocks[0] = ubo.blocks[0]; + blocks[1] = ubo.blocks[1]; + blocks[2] = ubo.blocks[2]; + blocks[3] = ubo.blocks[3]; + blocks[gl_WorkGroupID.x].v = 20.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk new file mode 100644 index 0000000000..f5907d3e2c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp.vk @@ -0,0 +1,28 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Bar; +layout(buffer_reference) buffer Foo; +layout(buffer_reference, buffer_reference_align = 8, std430) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(buffer_reference, std430) buffer Foo +{ + uint v; +}; + +layout(push_constant, std430) uniform Push +{ + Bar bar; +} _13; + +void main() +{ + uint _24 = atomicAdd(_13.bar.b, 1u); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk new file mode 100644 index 0000000000..9cd3d3e5bb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp.vk @@ -0,0 +1,29 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Bar; +layout(buffer_reference) buffer Foo; +layout(buffer_reference, buffer_reference_align = 8, std430) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(buffer_reference, std430) buffer Foo +{ + uint v; +}; + +layout(push_constant, std430) uniform Push +{ + Bar bar; +} _15; + +void main() +{ + uint v = _15.bar.b; + uint _31 = atomicAdd(_15.bar.a, v); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk new file mode 100644 index 0000000000..20a4f1b423 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp.vk @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + uvec2 ptr; + PtrInt ptrint; +} _13; + +void main() +{ + _13.ptr = uvec2(_13.ptrint); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk new file mode 100644 index 0000000000..5cf6e2df36 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp.vk @@ -0,0 +1,21 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 16, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + uvec2 ptr; +} _10; + +void main() +{ + PtrInt(_10.ptr).value = 10; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk new file mode 100644 index 0000000000..8923d21d78 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp.vk @@ -0,0 +1,26 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer PtrUint; +layout(buffer_reference) buffer PtrInt; +layout(buffer_reference, buffer_reference_align = 4, std430) buffer PtrUint +{ + uint value; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0, std430) buffer Buf +{ + PtrUint ptr; +} _11; + +void main() +{ + PtrInt(_11.ptr).value = 10; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk new file mode 100644 index 0000000000..b7e88062a0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp.vk @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer RO; +layout(buffer_reference) buffer RW; +layout(buffer_reference) buffer WO; +layout(buffer_reference, buffer_reference_align = 16, std430) readonly buffer RO +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) restrict buffer RW +{ + vec4 v[]; +}; + +layout(buffer_reference, buffer_reference_align = 16, std430) coherent writeonly buffer WO +{ + vec4 v[]; +}; + +layout(push_constant, std430) uniform Registers +{ + RO ro; + RW rw; + WO wo; +} registers; + +void main() +{ + registers.rw.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; + registers.wo.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk new file mode 100644 index 0000000000..241483ede4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp.vk @@ -0,0 +1,60 @@ +#version 450 +#if defined(GL_ARB_gpu_shader_int64) +#extension GL_ARB_gpu_shader_int64 : require +#else +#error No extension available for 64-bit integers. +#endif +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer Node; +layout(buffer_reference, buffer_reference_align = 16, std430) buffer Node +{ + layout(offset = 0) int value; + layout(offset = 16) Node next; + layout(offset = 32) Node prev; +}; + +layout(set = 0, binding = 0, std430) restrict buffer LinkedList +{ + Node head1; + Node head2; +} _50; + +void copy_node(restrict Node dst, restrict Node a, restrict Node b) +{ + dst.value = a.value + b.value; +} + +void overwrite_node(out restrict Node dst, restrict Node src) +{ + dst = src; +} + +void main() +{ + Node _45; + if (gl_WorkGroupID.x < 4u) + { + _45 = _50.head1; + } + else + { + _45 = _50.head2; + } + restrict Node n = _45; + Node param = n.next; + Node param_1 = _50.head1; + Node param_2 = _50.head2; + copy_node(param, param_1, param_2); + Node param_4 = _50.head1; + Node param_3; + overwrite_node(param_3, param_4); + n = param_3; + int v = _50.head2.value; + n.value = 20; + n.value = v * 10; + uint64_t uptr = uint64_t(_50.head2.next); + Node unode = Node(uptr); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk new file mode 100644 index 0000000000..db022309be --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp.vk @@ -0,0 +1,23 @@ +#version 450 +#extension GL_EXT_shader_atomic_float : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer SSBO +{ + float v; +} _18; + +layout(set = 0, binding = 0, r32f) uniform image2D uImage; + +shared float shared_v; + +void main() +{ + float _15 = atomicAdd(shared_v, 2.0); + float value = _15; + float _24 = atomicAdd(_18.v, value); + float _39 = imageAtomicAdd(uImage, ivec2(gl_GlobalInvocationID.xy), value); + float _45 = imageAtomicExchange(uImage, ivec2(gl_GlobalInvocationID.xy), value); + value = _45; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk new file mode 100644 index 0000000000..fbe5e3d964 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp.vk @@ -0,0 +1,72 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_flags_primitive_culling : require +#extension GL_EXT_ray_tracing : require +layout(primitive_culling); +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std140) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; + float thit; + uvec2 bda; +} _19; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +rayQueryEXT q; +rayQueryEXT q2[2]; + +void main() +{ + rayQueryInitializeEXT(q, AS, _19.ray_flags, _19.cull_mask, _19.origin, _19.tmin, _19.dir, _19.tmax); + rayQueryInitializeEXT(q2[1], accelerationStructureEXT(_19.bda), _19.ray_flags, _19.cull_mask, _19.origin, _19.tmin, _19.dir, _19.tmax); + bool _67 = rayQueryProceedEXT(q); + bool res = _67; + rayQueryTerminateEXT(q2[0]); + rayQueryGenerateIntersectionEXT(q, _19.thit); + rayQueryConfirmIntersectionEXT(q2[1]); + float _75 = rayQueryGetRayTMinEXT(q); + float fval = _75; + uint _79 = rayQueryGetRayFlagsEXT(q2[0]); + uint type = _79; + vec3 _82 = rayQueryGetWorldRayDirectionEXT(q); + vec3 fvals = _82; + vec3 _83 = rayQueryGetWorldRayOriginEXT(q); + fvals = _83; + uint _86 = rayQueryGetIntersectionTypeEXT(q2[1], bool(1)); + type = _86; + bool _88 = rayQueryGetIntersectionCandidateAABBOpaqueEXT(q2[1]); + res = _88; + float _91 = rayQueryGetIntersectionTEXT(q2[1], bool(0)); + fval = _91; + int _94 = rayQueryGetIntersectionInstanceCustomIndexEXT(q, bool(1)); + int ival = _94; + int _96 = rayQueryGetIntersectionInstanceIdEXT(q2[0], bool(0)); + ival = _96; + uint _97 = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(q, bool(1)); + type = _97; + int _99 = rayQueryGetIntersectionGeometryIndexEXT(q2[1], bool(0)); + ival = _99; + int _100 = rayQueryGetIntersectionPrimitiveIndexEXT(q, bool(1)); + ival = _100; + vec2 _103 = rayQueryGetIntersectionBarycentricsEXT(q2[0], bool(0)); + fvals.x = _103.x; + fvals.y = _103.y; + bool _110 = rayQueryGetIntersectionFrontFaceEXT(q, bool(1)); + res = _110; + vec3 _111 = rayQueryGetIntersectionObjectRayDirectionEXT(q, bool(0)); + fvals = _111; + vec3 _113 = rayQueryGetIntersectionObjectRayOriginEXT(q2[0], bool(1)); + fvals = _113; + mat4x3 _117 = rayQueryGetIntersectionObjectToWorldEXT(q, bool(0)); + mat4x3 matrices = _117; + mat4x3 _119 = rayQueryGetIntersectionWorldToObjectEXT(q2[1], bool(1)); + matrices = _119; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp new file mode 100644 index 0000000000..7c4c7ed6f4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 100 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 200 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +#ifndef SPIRV_CROSS_CONSTANT_ID_2 +#define SPIRV_CROSS_CONSTANT_ID_2 300 +#endif +const int c = SPIRV_CROSS_CONSTANT_ID_2; +const int d = (c + 50); +#ifndef SPIRV_CROSS_CONSTANT_ID_3 +#define SPIRV_CROSS_CONSTANT_ID_3 400 +#endif +const int e = SPIRV_CROSS_CONSTANT_ID_3; + +layout(binding = 0, std430) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +} _22; + +void main() +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk new file mode 100644 index 0000000000..b7571b7abc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp.vk @@ -0,0 +1,35 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(constant_id = 2) const int c = 300; +const int d = (c + 50); +layout(constant_id = 3) const int e = 400; + +layout(set = 1, binding = 0, std430) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +} _22; + +void main() +{ + _22.w[gl_GlobalInvocationID.x] += (_22.v[gl_GlobalInvocationID.x] + e); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 0000000000..888f4b1640 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,34 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk new file mode 100644 index 0000000000..bdf72dff4e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20, local_size_z = 1) in; + +layout(constant_id = 1) const int b = 2; +layout(constant_id = 0) const int a = 1; +const uint _21 = (uint(a) + 0u); +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(set = 1, binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag new file mode 100644 index 0000000000..716e283baf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag @@ -0,0 +1,31 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2DShadow SPIRV_Cross_CombineduDepthuSampler; +uniform mediump sampler2D SPIRV_Cross_CombineduDepthuSampler1; + +layout(location = 0) out float FragColor; + +float samp2(mediump sampler2DShadow SPIRV_Cross_Combinedts) +{ + return texture(SPIRV_Cross_Combinedts, vec3(vec3(1.0).xy, 1.0)); +} + +float samp3(mediump sampler2D SPIRV_Cross_Combinedts) +{ + return texture(SPIRV_Cross_Combinedts, vec2(1.0)).x; +} + +float samp(mediump sampler2DShadow SPIRV_Cross_Combinedts, mediump sampler2D SPIRV_Cross_Combinedts1) +{ + float r0 = samp2(SPIRV_Cross_Combinedts); + float r1 = samp3(SPIRV_Cross_Combinedts1); + return r0 + r1; +} + +void main() +{ + FragColor = samp(SPIRV_Cross_CombineduDepthuSampler, SPIRV_Cross_CombineduDepthuSampler1); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk new file mode 100644 index 0000000000..5ba3bdf35c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag.vk @@ -0,0 +1,32 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 2) uniform mediump texture2D uDepth; +layout(set = 0, binding = 0) uniform mediump samplerShadow uSampler; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; + +layout(location = 0) out float FragColor; + +float samp2(mediump texture2D t, mediump samplerShadow s) +{ + return texture(sampler2DShadow(t, s), vec3(vec3(1.0).xy, 1.0)); +} + +float samp3(mediump texture2D t, mediump sampler s) +{ + return texture(sampler2D(t, s), vec2(1.0)).x; +} + +float samp(mediump texture2D t, mediump samplerShadow s, mediump sampler s1) +{ + float r0 = samp2(t, s); + float r1 = samp3(t, s1); + return r0 + r1; +} + +void main() +{ + FragColor = samp(uDepth, uSampler, uSampler1); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag new file mode 100644 index 0000000000..5b9c0ddadf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag @@ -0,0 +1,48 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler0; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler1; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture1uSampler0; +uniform mediump sampler2D SPIRV_Cross_CombineduTexture0uSampler1; + +layout(location = 0) in vec2 vTex; +layout(location = 0) out vec4 FragColor; + +vec4 sample_dual(mediump sampler2D SPIRV_Cross_Combinedtexsamp) +{ + return texture(SPIRV_Cross_Combinedtexsamp, vTex); +} + +vec4 sample_duals() +{ + vec4 a = sample_dual(SPIRV_Cross_CombineduTexture0uSampler0); + vec4 b = sample_dual(SPIRV_Cross_CombineduTexture1uSampler1); + return a + b; +} + +vec4 sample_global_tex(mediump sampler2D SPIRV_Cross_CombineduTexture0samp, mediump sampler2D SPIRV_Cross_CombineduTexture1samp) +{ + vec4 a = texture(SPIRV_Cross_CombineduTexture0samp, vTex); + vec4 b = sample_dual(SPIRV_Cross_CombineduTexture1samp); + return a + b; +} + +vec4 sample_global_sampler(mediump sampler2D SPIRV_Cross_CombinedtexuSampler0, mediump sampler2D SPIRV_Cross_CombinedtexuSampler1) +{ + vec4 a = texture(SPIRV_Cross_CombinedtexuSampler0, vTex); + vec4 b = sample_dual(SPIRV_Cross_CombinedtexuSampler1); + return a + b; +} + +void main() +{ + vec4 c0 = sample_duals(); + vec4 c1 = sample_global_tex(SPIRV_Cross_CombineduTexture0uSampler0, SPIRV_Cross_CombineduTexture1uSampler0); + vec4 c2 = sample_global_tex(SPIRV_Cross_CombineduTexture0uSampler1, SPIRV_Cross_CombineduTexture1uSampler1); + vec4 c3 = sample_global_sampler(SPIRV_Cross_CombineduTexture0uSampler0, SPIRV_Cross_CombineduTexture0uSampler1); + vec4 c4 = sample_global_sampler(SPIRV_Cross_CombineduTexture1uSampler0, SPIRV_Cross_CombineduTexture1uSampler1); + FragColor = (((c0 + c1) + c2) + c3) + c4; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk new file mode 100644 index 0000000000..ae8df4c925 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/combined-texture-sampler.vk.frag.vk @@ -0,0 +1,48 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 2) uniform mediump texture2D uTexture0; +layout(set = 0, binding = 3) uniform mediump texture2D uTexture1; +layout(set = 0, binding = 0) uniform mediump sampler uSampler0; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; + +layout(location = 0) in vec2 vTex; +layout(location = 0) out vec4 FragColor; + +vec4 sample_dual(mediump sampler samp, mediump texture2D tex) +{ + return texture(sampler2D(tex, samp), vTex); +} + +vec4 sample_duals() +{ + vec4 a = sample_dual(uSampler0, uTexture0); + vec4 b = sample_dual(uSampler1, uTexture1); + return a + b; +} + +vec4 sample_global_tex(mediump sampler samp) +{ + vec4 a = texture(sampler2D(uTexture0, samp), vTex); + vec4 b = sample_dual(samp, uTexture1); + return a + b; +} + +vec4 sample_global_sampler(mediump texture2D tex) +{ + vec4 a = texture(sampler2D(tex, uSampler0), vTex); + vec4 b = sample_dual(uSampler1, tex); + return a + b; +} + +void main() +{ + vec4 c0 = sample_duals(); + vec4 c1 = sample_global_tex(uSampler0); + vec4 c2 = sample_global_tex(uSampler1); + vec4 c3 = sample_global_sampler(uTexture0); + vec4 c4 = sample_global_sampler(uTexture1); + FragColor = (((c0 + c1) + c2) + c3) + c4; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk new file mode 100644 index 0000000000..153164920f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag.vk @@ -0,0 +1,15 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bool _15 = helperInvocationEXT(); + demote; + if (!_15) + { + FragColor = vec4(1.0, 0.0, 0.0, 1.0); + } +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk new file mode 100644 index 0000000000..302f835402 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag.vk @@ -0,0 +1,10 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + demote; + bool _9 = helperInvocationEXT(); + bool helper = _9; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag new file mode 100644 index 0000000000..8f7508ee8e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 F; +layout(location = 1) flat in ivec4 I; +layout(location = 2) flat in uvec4 U; + +void main() +{ + FragColor = (F + vec4(I)) + vec4(U); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag.vk new file mode 100644 index 0000000000..4c0506b110 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/desktop-mediump.vk.frag.vk @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out mediump vec4 FragColor; +layout(location = 0) in mediump vec4 F; +layout(location = 1) flat in mediump ivec4 I; +layout(location = 2) flat in mediump uvec4 U; + +void main() +{ + FragColor = (F + vec4(I)) + vec4(U); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag new file mode 100644 index 0000000000..ea460c1fae --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSubpass0; +layout(binding = 1) uniform sampler2DMS uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = (texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 1) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 2)) + texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), gl_SampleID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk new file mode 100644 index 0000000000..462df22a19 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment-ms.vk.frag.vk @@ -0,0 +1,12 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = (subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2)) + subpassLoad(uSubpass0, gl_SampleID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag new file mode 100644 index 0000000000..8d216b2c49 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2D uSubpass0; +layout(binding = 1) uniform mediump sampler2D uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texelFetch(uSubpass0, ivec2(gl_FragCoord.xy), 0) + texelFetch(uSubpass1, ivec2(gl_FragCoord.xy), 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag.vk new file mode 100644 index 0000000000..c8b5d9a70d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/input-attachment.vk.frag.vk @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0) + subpassLoad(uSubpass1); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk new file mode 100644 index 0000000000..9a7862a463 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag.vk @@ -0,0 +1,74 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 2, std140) uniform UBO +{ + vec4 v[64]; +} ubos[]; + +layout(set = 0, binding = 3, std430) buffer SSBO +{ + uint counter; + vec4 v[]; +} ssbos[]; + +layout(set = 0, binding = 0) uniform texture2D uSamplers[]; +layout(set = 0, binding = 1) uniform sampler uSamps[]; +layout(set = 0, binding = 4) uniform sampler2D uCombinedSamplers[]; +layout(set = 0, binding = 0) uniform texture2DMS uSamplersMS[]; +layout(set = 0, binding = 5, r32f) uniform image2D uImages[]; +layout(set = 0, binding = 5, r32ui) uniform uimage2D uImagesU32[]; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out vec4 FragColor; +layout(location = 1) in vec2 vUV; + +void main() +{ + int i = vIndex; + FragColor = texture(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + int _49 = i + 10; + FragColor = texture(uCombinedSamplers[nonuniformEXT(_49)], vUV); + int _65 = i + 20; + int _69 = i + 40; + FragColor += ubos[nonuniformEXT(_65)].v[_69]; + int _83 = i + 50; + int _88 = i + 60; + FragColor += ssbos[nonuniformEXT(_83)].v[_88]; + int _96 = i + 60; + int _100 = i + 70; + ssbos[nonuniformEXT(_96)].v[_100] = vec4(20.0); + int _106 = i + 10; + FragColor = texelFetch(uSamplers[nonuniformEXT(_106)], ivec2(vUV), 0); + int _116 = i + 100; + uint _122 = atomicAdd(ssbos[_116].counter, 100u); + vec2 queried = textureQueryLod(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + int _139 = i + 10; + queried += textureQueryLod(uCombinedSamplers[nonuniformEXT(_139)], vUV); + vec4 _147 = FragColor; + vec2 _149 = _147.xy + queried; + FragColor.x = _149.x; + FragColor.y = _149.y; + int _157 = i + 20; + FragColor.x += float(textureQueryLevels(uSamplers[nonuniformEXT(_157)])); + int _172 = i + 20; + FragColor.y += float(textureSamples(uSamplersMS[nonuniformEXT(_172)])); + int _184 = i + 20; + vec4 _189 = FragColor; + vec2 _191 = _189.xy + vec2(textureSize(uSamplers[nonuniformEXT(_184)], 0)); + FragColor.x = _191.x; + FragColor.y = _191.y; + int _202 = i + 50; + FragColor += imageLoad(uImages[nonuniformEXT(_202)], ivec2(vUV)); + int _213 = i + 20; + vec4 _218 = FragColor; + vec2 _220 = _218.xy + vec2(imageSize(uImages[nonuniformEXT(_213)])); + FragColor.x = _220.x; + FragColor.y = _220.y; + int _227 = i + 60; + imageStore(uImages[nonuniformEXT(_227)], ivec2(vUV), vec4(50.0)); + int _240 = i + 70; + uint _248 = imageAtomicAdd(uImagesU32[nonuniformEXT(_240)], ivec2(vUV), 40u); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag new file mode 100644 index 0000000000..21618f8885 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(std140) uniform UBO +{ + float ubo[4]; +} _14; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = _14.ubo[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk new file mode 100644 index 0000000000..8ca4f23ac4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(push_constant, std140) uniform UBO +{ + float ubo[4]; +} _14; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = _14.ubo[1]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..c04a7ca488 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct PushConstants +{ + vec4 value0; + vec4 value1; +}; + +uniform PushConstants push; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = (vColor + push.value0) + push.value1; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag.vk new file mode 100644 index 0000000000..6cec90f19e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/push-constant.vk.frag.vk @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(push_constant, std430) uniform PushConstants +{ + vec4 value0; + vec4 value1; +} push; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = (vColor + push.value0) + push.value1; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag new file mode 100644 index 0000000000..575c4187eb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag @@ -0,0 +1,22 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSamp; +uniform sampler2D SPIRV_Cross_CombineduTuS; + +layout(location = 0) out vec4 FragColor; + +vec4 samp(sampler2D uSamp_1) +{ + return texture(uSamp_1, vec2(0.5)); +} + +vec4 samp_1(sampler2D SPIRV_Cross_CombinedTS) +{ + return texture(SPIRV_Cross_CombinedTS, vec2(0.5)); +} + +void main() +{ + FragColor = samp(uSamp) + samp_1(SPIRV_Cross_CombineduTuS); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk new file mode 100644 index 0000000000..222b659e40 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag.vk @@ -0,0 +1,23 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(set = 0, binding = 1) uniform texture2D uT; +layout(set = 0, binding = 2) uniform sampler uS; + +layout(location = 0) out vec4 FragColor; + +vec4 samp(sampler2D uSamp_1) +{ + return texture(uSamp_1, vec2(0.5)); +} + +vec4 samp(texture2D T, sampler S) +{ + return texture(sampler2D(T, S), vec2(0.5)); +} + +void main() +{ + FragColor = samp(uSamp) + samp(uT, uS); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag new file mode 100644 index 0000000000..8ca3085a10 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTextureuSampler[4]; +uniform mediump sampler2DArray SPIRV_Cross_CombineduTextureArrayuSampler[4]; +uniform mediump samplerCube SPIRV_Cross_CombineduTextureCubeuSampler[4]; +uniform mediump sampler3D SPIRV_Cross_CombineduTexture3DuSampler[4]; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +vec4 sample_func(vec2 uv, mediump sampler2D SPIRV_Cross_CombineduTexturesamp[4]) +{ + return texture(SPIRV_Cross_CombineduTexturesamp[2], uv); +} + +vec4 sample_func_dual(vec2 uv, mediump sampler2D SPIRV_Cross_Combinedtexsamp) +{ + return texture(SPIRV_Cross_Combinedtexsamp, uv); +} + +vec4 sample_func_dual_array(vec2 uv, mediump sampler2D SPIRV_Cross_Combinedtexsamp[4]) +{ + return texture(SPIRV_Cross_Combinedtexsamp[1], uv); +} + +void main() +{ + vec2 off = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[1], 0)); + vec2 off2 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[2], 1)); + vec2 param = (vTex + off) + off2; + vec4 c0 = sample_func(param, SPIRV_Cross_CombineduTextureuSampler); + vec2 param_1 = (vTex + off) + off2; + vec4 c1 = sample_func_dual(param_1, SPIRV_Cross_CombineduTextureuSampler[1]); + vec2 param_2 = (vTex + off) + off2; + vec4 c2 = sample_func_dual_array(param_2, SPIRV_Cross_CombineduTextureuSampler); + vec4 c3 = texture(SPIRV_Cross_CombineduTextureArrayuSampler[3], vTex3); + vec4 c4 = texture(SPIRV_Cross_CombineduTextureCubeuSampler[1], vTex3); + vec4 c5 = texture(SPIRV_Cross_CombineduTexture3DuSampler[2], vTex3); + FragColor = ((((c0 + c1) + c2) + c3) + c4) + c5; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk new file mode 100644 index 0000000000..0afa489c58 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag.vk @@ -0,0 +1,45 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 1) uniform mediump texture2D uTexture[4]; +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray[4]; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube[4]; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D[4]; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +vec4 sample_func(mediump sampler samp, vec2 uv) +{ + return texture(sampler2D(uTexture[2], samp), uv); +} + +vec4 sample_func_dual(mediump sampler samp, mediump texture2D tex, vec2 uv) +{ + return texture(sampler2D(tex, samp), uv); +} + +vec4 sample_func_dual_array(mediump sampler samp, mediump texture2D tex[4], vec2 uv) +{ + return texture(sampler2D(tex[1], samp), uv); +} + +void main() +{ + vec2 off = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[1], uSampler), 0)); + vec2 off2 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[2], uSampler), 1)); + vec2 param = (vTex + off) + off2; + vec4 c0 = sample_func(uSampler, param); + vec2 param_1 = (vTex + off) + off2; + vec4 c1 = sample_func_dual(uSampler, uTexture[1], param_1); + vec2 param_2 = (vTex + off) + off2; + vec4 c2 = sample_func_dual_array(uSampler, uTexture, param_2); + vec4 c3 = texture(sampler2DArray(uTextureArray[3], uSampler), vTex3); + vec4 c4 = texture(samplerCube(uTextureCube[1], uSampler), vTex3); + vec4 c5 = texture(sampler3D(uTexture3D[2], uSampler), vTex3); + FragColor = ((((c0 + c1) + c2) + c3) + c4) + c5; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag new file mode 100644 index 0000000000..c2530d5d8e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag @@ -0,0 +1,37 @@ +#version 310 es +precision mediump float; +precision highp int; + +uniform mediump sampler2D SPIRV_Cross_CombineduTextureuSampler; +uniform mediump sampler2DArray SPIRV_Cross_CombineduTextureArrayuSampler; +uniform mediump samplerCube SPIRV_Cross_CombineduTextureCubeuSampler; +uniform mediump sampler3D SPIRV_Cross_CombineduTexture3DuSampler; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +vec4 sample_func(vec2 uv, mediump sampler2D SPIRV_Cross_CombineduTexturesamp) +{ + return texture(SPIRV_Cross_CombineduTexturesamp, uv); +} + +vec4 sample_func_dual(vec2 uv, mediump sampler2D SPIRV_Cross_Combinedtexsamp) +{ + return texture(SPIRV_Cross_Combinedtexsamp, uv); +} + +void main() +{ + vec2 off = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 0)); + vec2 off2 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler, 1)); + vec2 param = (vTex + off) + off2; + vec4 c0 = sample_func(param, SPIRV_Cross_CombineduTextureuSampler); + vec2 param_1 = (vTex + off) + off2; + vec4 c1 = sample_func_dual(param_1, SPIRV_Cross_CombineduTextureuSampler); + vec4 c2 = texture(SPIRV_Cross_CombineduTextureArrayuSampler, vTex3); + vec4 c3 = texture(SPIRV_Cross_CombineduTextureCubeuSampler, vTex3); + vec4 c4 = texture(SPIRV_Cross_CombineduTexture3DuSampler, vTex3); + FragColor = (((c0 + c1) + c2) + c3) + c4; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk new file mode 100644 index 0000000000..105379d770 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/separate-sampler-texture.vk.frag.vk @@ -0,0 +1,38 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(set = 0, binding = 1) uniform mediump texture2D uTexture; +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D; + +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; +layout(location = 0) out vec4 FragColor; + +vec4 sample_func(mediump sampler samp, vec2 uv) +{ + return texture(sampler2D(uTexture, samp), uv); +} + +vec4 sample_func_dual(mediump sampler samp, mediump texture2D tex, vec2 uv) +{ + return texture(sampler2D(tex, samp), uv); +} + +void main() +{ + vec2 off = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 0)); + vec2 off2 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture, uSampler), 1)); + vec2 param = (vTex + off) + off2; + vec4 c0 = sample_func(uSampler, param); + vec2 param_1 = (vTex + off) + off2; + vec4 c1 = sample_func_dual(uSampler, uTexture, param_1); + vec4 c2 = texture(sampler2DArray(uTextureArray, uSampler), vTex3); + vec4 c3 = texture(samplerCube(uTextureCube, uSampler), vTex3); + vec4 c4 = texture(sampler3D(uTexture3D, uSampler), vTex3); + FragColor = (((c0 + c1) + c2) + c3) + c4; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk new file mode 100644 index 0000000000..634a37aa3a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag.vk @@ -0,0 +1,88 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require + +layout(set = 0, binding = 1, std430) buffer SSBO +{ + int8_t i8[16]; + uint8_t u8[16]; +} ssbo; + +layout(set = 0, binding = 0, std140) uniform UBO +{ + int8_t i8; + uint8_t u8; +} ubo; + +layout(push_constant, std430) uniform Push +{ + int8_t i8; + uint8_t u8; +} registers; + +layout(location = 0) flat in ivec4 vColor; +layout(location = 0) out ivec4 FragColorInt; +layout(location = 1) out uvec4 FragColorUint; + +void packing_int8() +{ + int16_t i16 = 10s; + int i32 = 20; + i8vec2 i8_2 = unpack8(i16); + i8vec4 i8_4 = unpack8(i32); + i16 = pack16(i8_2); + i32 = pack32(i8_4); + ssbo.i8[0] = i8_4.x; + ssbo.i8[1] = i8_4.y; + ssbo.i8[2] = i8_4.z; + ssbo.i8[3] = i8_4.w; +} + +void packing_uint8() +{ + uint16_t u16 = 10us; + uint u32 = 20u; + u8vec2 u8_2 = unpack8(u16); + u8vec4 u8_4 = unpack8(u32); + u16 = pack16(u8_2); + u32 = pack32(u8_4); + ssbo.u8[0] = u8_4.x; + ssbo.u8[1] = u8_4.y; + ssbo.u8[2] = u8_4.z; + ssbo.u8[3] = u8_4.w; +} + +void compute_int8() +{ + i8vec4 tmp = i8vec4(vColor); + tmp += i8vec4(registers.i8); + tmp += i8vec4(int8_t(-40)); + tmp += i8vec4(-50); + tmp += i8vec4(int8_t(10), int8_t(20), int8_t(30), int8_t(40)); + tmp += i8vec4(ssbo.i8[4]); + tmp += i8vec4(ubo.i8); + FragColorInt = ivec4(tmp); +} + +void compute_uint8() +{ + u8vec4 tmp = u8vec4(i8vec4(vColor)); + tmp += u8vec4(registers.u8); + tmp += u8vec4(uint8_t(216)); + tmp += u8vec4(206); + tmp += u8vec4(uint8_t(10), uint8_t(20), uint8_t(30), uint8_t(40)); + tmp += u8vec4(ssbo.u8[4]); + tmp += u8vec4(ubo.u8); + FragColorUint = uvec4(tmp); +} + +void main() +{ + packing_int8(); + packing_uint8(); + compute_int8(); + compute_uint8(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag new file mode 100644 index 0000000000..19ea6ae064 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag @@ -0,0 +1,22 @@ +#version 310 es +precision mediump float; +precision highp int; + +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 2 +#endif +const int Value = SPIRV_CROSS_CONSTANT_ID_10; + +layout(binding = 0, std140) uniform SpecConstArray +{ + vec4 samples[Value]; +} _15; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int Index; + +void main() +{ + FragColor = _15.samples[Index]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk new file mode 100644 index 0000000000..133761a83d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-block-size.vk.frag.vk @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(constant_id = 10) const int Value = 2; + +layout(set = 0, binding = 0, std140) uniform SpecConstArray +{ + vec4 samples[Value]; +} _15; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in mediump int Index; + +void main() +{ + FragColor = _15.samples[Index]; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag new file mode 100644 index 0000000000..081206f1cb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag @@ -0,0 +1,16 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 10u +#endif +const uint s = SPIRV_CROSS_CONSTANT_ID_0; +const bool _13 = (s > 20u); +const uint f = _13 ? 30u : 50u; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(f); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk new file mode 100644 index 0000000000..04c4062a6c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/frag/spec-constant-ternary.vk.frag.vk @@ -0,0 +1,14 @@ +#version 450 + +layout(constant_id = 0) const uint s = 10u; +const bool _13 = (s > 20u); +const uint f = _13 ? 30u : 50u; + +layout(location = 0) out float FragColor; + +void main() +{ + float _17 = float(f); + FragColor = _17; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..4cb6bf8d8f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit.vk @@ -0,0 +1,22 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void in_func() +{ + if (payload > 0.0) + { + ignoreIntersectionEXT; + } + else + { + terminateRayEXT; + } +} + +void main() +{ + in_func(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk new file mode 100644 index 0000000000..cee09bc0ea --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rahit/terminators.nocompat.vk.rahit.vk @@ -0,0 +1,22 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void in_func() +{ + if (payload > 0.0) + { + ignoreIntersectionNV(); + } + else + { + terminateRayNV(); + } +} + +void main() +{ + in_func(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk b/third_party/spirv-cross/reference/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk new file mode 100644 index 0000000000..5adfac164f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) callableDataInEXT float c; + +void main() +{ + executeCallableEXT(10u, 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..b6c1876d31 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..614a04d95e --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit.vk @@ -0,0 +1,24 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo2 hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..56e8ff4aa3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,29 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo2 hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e747bb29d0 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit.vk @@ -0,0 +1,29 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +struct Foo2 +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo2 hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..eeccd3bb09 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..908d96344f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit.vk @@ -0,0 +1,11 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec2 payload; +hitAttributeNV vec2 hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a51e6b088f --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..133bdfc1d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo +{ + float a; + float b; +}; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo hit; + +void main() +{ + payload = hit; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e4e0103ddb --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..64f79a8dce --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_HitKindNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e94e3323c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..9004a00c40 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_HitTNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a013baa11d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..d17ab8ce76 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e28af5d252 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexEXT); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..531a1fc284 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_InstanceCustomIndexNV); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..0413e0d234 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..ff551db7c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..237d4790e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..01afa0e067 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..5739ac09ff --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a49e17a173 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..7922e1efbf --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..fc2c5ed0c2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldNV * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e896816ec3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,20 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a3ddd56b17 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/payloads.nocompat.vk.rchit.vk @@ -0,0 +1,20 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInNV Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..667c015e8d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..d3b0ef1942 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = uint(gl_PrimitiveID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..e94e3323c9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..769c96ad6b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTmaxNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..04b8954950 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..2709899a13 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTminNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..05af948b37 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..103fd66b80 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..68ba2bafa5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..4acf03e064 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..a5c6766e05 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..70241f2362 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginNV; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..309ca4c6f1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk new file mode 100644 index 0000000000..0b93e38acd --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldToObjectNV * vec4(payload, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk new file mode 100644 index 0000000000..d131b0aa80 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(push_constant, std430) uniform Registers +{ + uvec2 ptr; +} _19; + +layout(location = 0) rayPayloadEXT vec4 payload; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(accelerationStructureEXT(_19.ptr), 1u, 255u, 0u, 0u, 0u, origin, 0.0, direction, 100.0, 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk new file mode 100644 index 0000000000..8bb3d0070b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT vec4 payload; +layout(location = 1) callableDataEXT float blend; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 1u, 255u, 0u, 0u, 0u, origin, 0.0, direction, 100.0, 0); + executeCallableEXT(0u, 1); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..d8c5796736 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; +layout(location = 0) rayPayloadNV vec4 payload; +layout(location = 0) callableDataNV float blend; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, 1u, 255u, 0u, 0u, 0u, origin, 0.0, direction, 100.0, 0); + executeCallableNV(0u, 0); + imageStore(image, ivec2(gl_LaunchIDNV.xy), payload + vec4(blend)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..1614c49626 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..f907e6fd60 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDNV.xy), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..240e93daa4 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..08992c6319 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeNV.xy) - ivec2(1), vec4(1.0)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..7885f4f3d3 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,47 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT Payload payload2; +layout(location = 1) rayPayloadEXT float payload1; +layout(location = 2) rayPayloadEXT Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + result += vec4(payload2.a); + result += vec4(payload2.b); + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + vec4 result = vec4(payload1); + vec4 _62 = trace_in_function(); + result += _62; + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), result); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..5d6b24c601 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/payloads.nocompat.vk.rgen.vk @@ -0,0 +1,47 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Payload +{ + float a; + float b; +}; + +struct Block +{ + float a; + float b; + Payload c; + Payload d; +}; + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 1) rayPayloadNV Payload payload2; +layout(location = 0) rayPayloadNV float payload1; +layout(location = 2) rayPayloadNV Block _71; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + result += vec4(payload2.a); + result += vec4(payload2.b); + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + vec4 result = vec4(payload1); + vec4 _62 = trace_in_function(); + result += _62; + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += vec4(((((_71.a + _71.b) + _71.c.a) + _71.c.b) + _71.d.a) + _71.d.b); + imageStore(image, ivec2(gl_LaunchIDNV.xy), result); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..71e04d670b --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,21 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + vec2 param = vec2(gl_LaunchIDEXT.xy); + vec2 param_1 = vec2(gl_LaunchSizeEXT.xy); + float _64 = pure_call(param, param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..55e301ab29 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen.vk @@ -0,0 +1,21 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + vec2 param = vec2(gl_LaunchIDNV.xy); + vec2 param_1 = vec2(gl_LaunchSizeNV.xy); + float _62 = pure_call(param, param_1); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..67deac226d --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..9c9e4849b5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; +layout(set = 0, binding = 0, rgba8) uniform writeonly image2D image; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDNV.xy), col); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..3056e8ad28 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk b/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk new file mode 100644 index 0000000000..058ccf9a64 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen.vk @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(shaderRecordNV, std430) buffer sbt +{ + vec3 direction; + float tmax; +} _20; + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, _20.direction, _20.tmax, 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk b/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk new file mode 100644 index 0000000000..761609a812 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void in_func() +{ + bool _13 = reportIntersectionEXT(0.5, 10u); +} + +void main() +{ + in_func(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk b/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk new file mode 100644 index 0000000000..c99b78495a --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rint/report-intersection.nocompat.vk.rint.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void in_func() +{ + bool _13 = reportIntersectionNV(0.5, 10u); +} + +void main() +{ + in_func(); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..c055a26814 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..ec3072a0e2 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss.vk @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 0.0; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk new file mode 100644 index 0000000000..696c998c27 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss.vk @@ -0,0 +1,13 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadInEXT float p; + +void main() +{ + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk b/third_party/spirv-cross/reference/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk new file mode 100644 index 0000000000..9cadcdb6dc --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/device-group.nocompat.vk.vert.vk @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_device_group : require + +void main() +{ + gl_Position = vec4(float(gl_DeviceIndex)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk b/third_party/spirv-cross/reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk new file mode 100644 index 0000000000..90055473d9 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk @@ -0,0 +1,15 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(set = 0, binding = 0, std140) uniform MVPs +{ + mat4 MVP[2]; +} _19; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = _19.MVP[gl_ViewIndex] * Position; +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..2c4beb71e5 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,69 @@ +#version 450 +#if defined(GL_EXT_shader_explicit_arithmetic_types_int16) +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#elif defined(GL_AMD_gpu_shader_int16) +#extension GL_AMD_gpu_shader_int16 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int16. +#endif +#if defined(GL_EXT_shader_explicit_arithmetic_types_int8) +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for Int8. +#endif +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_NV_gpu_shader5) +#extension GL_NV_gpu_shader5 : require +#else +#error No extension available for FP16. +#endif + +layout(binding = 0, std140) uniform block +{ + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +} _26; + +layout(binding = 1, std430) readonly buffer storage +{ + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +} _53; + +struct pushconst +{ + i16vec4 k; + u16vec4 l; + i8vec4 m; + u8vec4 n; + f16vec4 o; +}; + +uniform pushconst _76; + +layout(location = 0) out i16vec4 p; +layout(location = 0, component = 0) in int16_t foo; +layout(location = 1) out u16vec4 q; +layout(location = 0, component = 1) in uint16_t bar; +layout(location = 2) out f16vec4 r; +layout(location = 1) in float16_t baz; + +void main() +{ + p = i16vec4((((ivec4(int(foo)) + ivec4(ivec2(_26.a), ivec2(_26.c))) - ivec4(ivec3(_53.f) / ivec3(_53.h), 1)) + ivec4(_76.k)) + ivec4(_76.m)); + q = u16vec4((((uvec4(uint(bar)) + uvec4(uvec2(_26.b), uvec2(_26.d))) - uvec4(uvec3(_53.g) / uvec3(_53.i), 1u)) + uvec4(_76.l)) + uvec4(_76.n)); + r = f16vec4(((vec4(float(baz)) + vec4(vec2(_26.e), 0.0, 1.0)) - vec4(vec3(_53.j), 1.0)) + vec4(_76.o)); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert.vk b/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert.vk new file mode 100644 index 0000000000..caec60a2c1 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/small-storage.vk.vert.vk @@ -0,0 +1,55 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_16bit_storage : require +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_8bit_storage : require +#if defined(GL_AMD_gpu_shader_half_float) +#extension GL_AMD_gpu_shader_half_float : require +#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16) +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require +#else +#error No extension available for FP16. +#endif + +layout(set = 0, binding = 0, std140) uniform block +{ + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +} _26; + +layout(set = 0, binding = 1, std430) readonly buffer storage +{ + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +} _53; + +layout(push_constant, std430) uniform pushconst +{ + i16vec4 k; + u16vec4 l; + i8vec4 m; + u8vec4 n; + f16vec4 o; +} _76; + +layout(location = 0) out i16vec4 p; +layout(location = 0, component = 0) in int16_t foo; +layout(location = 1) out u16vec4 q; +layout(location = 0, component = 1) in uint16_t bar; +layout(location = 2) out f16vec4 r; +layout(location = 1) in float16_t baz; + +void main() +{ + p = i16vec4((((ivec4(int(foo)) + ivec4(ivec2(_26.a), ivec2(_26.c))) - ivec4(ivec3(_53.f) / ivec3(_53.h), 1)) + ivec4(_76.k)) + ivec4(_76.m)); + q = u16vec4((((uvec4(uint(bar)) + uvec4(uvec2(_26.b), uvec2(_26.d))) - uvec4(uvec3(_53.g) / uvec3(_53.i), 1u)) + uvec4(_76.l)) + uvec4(_76.n)); + r = f16vec4(((vec4(float(baz)) + vec4(vec2(_26.e), 0.0, 1.0)) - vec4(vec3(_53.j), 1.0)) + vec4(_76.o)); + gl_Position = vec4(0.0, 0.0, 0.0, 1.0); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..d939aa625c --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,16 @@ +#version 310 es +#ifdef GL_ARB_shader_draw_parameters +#extension GL_ARB_shader_draw_parameters : enable +#endif + +#ifdef GL_ARB_shader_draw_parameters +#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB +#else +uniform int SPIRV_Cross_BaseInstance; +#endif + +void main() +{ + gl_Position = vec4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexID + (gl_InstanceID + SPIRV_Cross_BaseInstance)); +} + diff --git a/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk b/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk new file mode 100644 index 0000000000..8c4930d7a8 --- /dev/null +++ b/third_party/spirv-cross/reference/shaders/vulkan/vert/vulkan-vertex.vk.vert.vk @@ -0,0 +1,7 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexIndex + gl_InstanceIndex); +} + diff --git a/third_party/spirv-cross/samples/cpp/Makefile b/third_party/spirv-cross/samples/cpp/Makefile new file mode 100644 index 0000000000..e5b66d4b88 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/Makefile @@ -0,0 +1,31 @@ +# Copyright 2016-2021 The Khronos Group Inc. +# SPDX-License-Identifier: Apache-2.0 + +SOURCES := $(wildcard *.comp) +SPIRV := $(SOURCES:.comp=.spv) +CPP_INTERFACE := $(SOURCES:.comp=.spv.cpp) +CPP_DRIVER := $(SOURCES:.comp=.cpp) +EXECUTABLES := $(SOURCES:.comp=.shader) +OBJECTS := $(CPP_DRIVER:.cpp=.o) $(CPP_INTERFACE:.cpp=.o) + +CXXFLAGS += -std=c++11 -I../../include -I. +LDFLAGS += -pthread -lm + +all: $(EXECUTABLES) + +%.spv: %.comp + glslangValidator -V -o $@ $< + +%.spv.cpp: %.spv + ../../spirv-cross --cpp --output $@ $< + +%.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) + +%.shader: %.o %.spv.o + $(CXX) -o $@ $^ $(LDFLAGS) + +clean: + $(RM) -f $(EXECUTABLES) $(SPIRV) $(CPP_INTERFACE) $(OBJECTS) + +.PHONY: clean diff --git a/third_party/spirv-cross/samples/cpp/atomics.comp b/third_party/spirv-cross/samples/cpp/atomics.comp new file mode 100644 index 0000000000..f315124743 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/atomics.comp @@ -0,0 +1,32 @@ +// Copyright 2016-2021 The Khronos Group Inc. +// SPDX-License-Identifier: Apache-2.0 + +#version 310 es +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0, std430) readonly buffer SSBO0 +{ + float inputs[]; +}; + +layout(set = 0, binding = 1, std430) writeonly buffer SSBO1 +{ + float outputs[]; +}; + +layout(set = 0, binding = 2, std430) buffer SSBO2 +{ + uint counter; +}; + +void main() +{ + // Builds a tightly packed list of all values less than 10.0. + // The output order is random. + float value = inputs[gl_GlobalInvocationID.x]; + if (value < 10.0) + { + uint output_index = atomicAdd(counter, 1u); + outputs[output_index] = value; + } +} diff --git a/third_party/spirv-cross/samples/cpp/atomics.cpp b/third_party/spirv-cross/samples/cpp/atomics.cpp new file mode 100644 index 0000000000..36d8fc15c0 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/atomics.cpp @@ -0,0 +1,91 @@ +/* + * Copyright 2015-2017 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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_cross/external_interface.h" +#include + +#ifndef GLM_SWIZZLE +#define GLM_SWIZZLE +#endif + +#ifndef GLM_FORCE_RADIANS +#define GLM_FORCE_RADIANS +#endif + +#include +using namespace glm; + +int main() +{ + // First, we get the C interface to the shader. + // This can be loaded from a dynamic library, or as here, + // linked in as a static library. + auto *iface = spirv_cross_get_interface(); + + // Create an instance of the shader interface. + auto *shader = iface->construct(); + +// Build some input data for our compute shader. +#define NUM_WORKGROUPS 4 + float a[64 * NUM_WORKGROUPS]; + float b[64 * NUM_WORKGROUPS] = {}; + uint32_t counter = 0; + + for (int i = 0; i < 64 * NUM_WORKGROUPS; i++) + { + a[i] = i * 0.46f; + } + + void *aptr = a; + void *bptr = b; + void *cptr = &counter; + + // Bind resources to the shader. + // For resources like samplers and buffers, we provide a list of pointers, + // since UBOs, SSBOs and samplers can be arrays, and can point to different types, + // which is especially true for samplers. + spirv_cross_set_resource(shader, 0, 0, &aptr, sizeof(aptr)); + spirv_cross_set_resource(shader, 0, 1, &bptr, sizeof(bptr)); + spirv_cross_set_resource(shader, 0, 2, &cptr, sizeof(cptr)); + + // We also have to set builtins. + // The relevant builtins will depend on the shader, + // but for compute, there are few builtins, which are gl_NumWorkGroups and gl_WorkGroupID. + // LocalInvocationID and GlobalInvocationID are inferred when executing the invocation. + uvec3 num_workgroups(NUM_WORKGROUPS, 1, 1); + uvec3 work_group_id(0, 0, 0); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_NUM_WORK_GROUPS, &num_workgroups, sizeof(num_workgroups)); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_WORK_GROUP_ID, &work_group_id, sizeof(work_group_id)); + + // Execute 4 work groups. + for (unsigned i = 0; i < NUM_WORKGROUPS; i++) + { + work_group_id.x = i; + iface->invoke(shader); + } + + // Call destructor. + iface->destruct(shader); + + // Verify our output. + // TODO: Implement a test framework that asserts results computed. + fprintf(stderr, "Counter = %u\n", counter); + for (unsigned i = 0; i < counter; i++) + { + fprintf(stderr, "[%3u] = %.1f\n", i, b[i]); + } +} diff --git a/third_party/spirv-cross/samples/cpp/multiply.comp b/third_party/spirv-cross/samples/cpp/multiply.comp new file mode 100644 index 0000000000..678415aed6 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/multiply.comp @@ -0,0 +1,25 @@ +// Copyright 2016-2021 The Khronos Group Inc. +// SPDX-License-Identifier: Apache-2.0 + +#version 310 es +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0, std430) readonly buffer SSBO0 +{ + vec4 a[]; +}; + +layout(set = 0, binding = 1, std430) readonly buffer SSBO1 +{ + vec4 b[]; +}; + +layout(set = 0, binding = 2, std430) buffer SSBO2 +{ + vec4 c[]; +}; + +void main() +{ + c[gl_GlobalInvocationID.x] = a[gl_GlobalInvocationID.x] * b[gl_GlobalInvocationID.x]; +} diff --git a/third_party/spirv-cross/samples/cpp/multiply.cpp b/third_party/spirv-cross/samples/cpp/multiply.cpp new file mode 100644 index 0000000000..4ff6184319 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/multiply.cpp @@ -0,0 +1,92 @@ +/* + * Copyright 2015-2017 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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_cross/external_interface.h" +#include + +#ifndef GLM_SWIZZLE +#define GLM_SWIZZLE +#endif + +#ifndef GLM_FORCE_RADIANS +#define GLM_FORCE_RADIANS +#endif + +#include +using namespace glm; + +int main() +{ + // First, we get the C interface to the shader. + // This can be loaded from a dynamic library, or as here, + // linked in as a static library. + auto *iface = spirv_cross_get_interface(); + + // Create an instance of the shader interface. + auto *shader = iface->construct(); + +// Build some input data for our compute shader. +#define NUM_WORKGROUPS 4 + vec4 a[64 * NUM_WORKGROUPS]; + vec4 b[64 * NUM_WORKGROUPS]; + vec4 c[64 * NUM_WORKGROUPS] = {}; + + for (int i = 0; i < 64 * NUM_WORKGROUPS; i++) + { + a[i] = vec4(100 + i, 101 + i, 102 + i, 103 + i); + b[i] = vec4(100 - i, 99 - i, 98 - i, 97 - i); + } + + void *aptr = a; + void *bptr = b; + void *cptr = c; + + // Bind resources to the shader. + // For resources like samplers and buffers, we provide a list of pointers, + // since UBOs, SSBOs and samplers can be arrays, and can point to different types, + // which is especially true for samplers. + spirv_cross_set_resource(shader, 0, 0, &aptr, sizeof(aptr)); + spirv_cross_set_resource(shader, 0, 1, &bptr, sizeof(bptr)); + spirv_cross_set_resource(shader, 0, 2, &cptr, sizeof(cptr)); + + // We also have to set builtins. + // The relevant builtins will depend on the shader, + // but for compute, there are few builtins, which are gl_NumWorkGroups and gl_WorkGroupID. + // LocalInvocationID and GlobalInvocationID are inferred when executing the invocation. + uvec3 num_workgroups(NUM_WORKGROUPS, 1, 1); + uvec3 work_group_id(0, 0, 0); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_NUM_WORK_GROUPS, &num_workgroups, sizeof(num_workgroups)); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_WORK_GROUP_ID, &work_group_id, sizeof(work_group_id)); + + // Execute 4 work groups. + for (unsigned i = 0; i < NUM_WORKGROUPS; i++) + { + work_group_id.x = i; + iface->invoke(shader); + } + + // Call destructor. + iface->destruct(shader); + + // Verify our output. + // TODO: Implement a test framework that asserts results computed. + for (unsigned i = 0; i < 64 * NUM_WORKGROUPS; i++) + { + fprintf(stderr, "(%.1f, %.1f, %.1f, %.1f) * (%.1f, %.1f, %.1f, %.1f) => (%.1f, %.1f, %.1f, %.1f)\n", a[i].x, + a[i].y, a[i].z, a[i].w, b[i].x, b[i].y, b[i].z, b[i].w, c[i].x, c[i].y, c[i].z, c[i].w); + } +} diff --git a/third_party/spirv-cross/samples/cpp/shared.comp b/third_party/spirv-cross/samples/cpp/shared.comp new file mode 100644 index 0000000000..a9d55d2c5c --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/shared.comp @@ -0,0 +1,39 @@ +// Copyright 2016-2021 The Khronos Group Inc. +// SPDX-License-Identifier: Apache-2.0 + +#version 310 es +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0, std430) readonly buffer SSBO0 +{ + float inputs[]; +}; + +layout(set = 0, binding = 1, std430) writeonly buffer SSBO1 +{ + float outputs[]; +}; + +shared float tmp[gl_WorkGroupSize.x]; + +void main() +{ + uint local = gl_LocalInvocationIndex; + uint work_group = gl_WorkGroupID.x; + + // Does a trivial parallel reduction through shared memory. + tmp[local] = inputs[work_group * gl_WorkGroupSize.x * 2u + local] + inputs[work_group * gl_WorkGroupSize.x * 2u + local + gl_WorkGroupSize.x]; + memoryBarrierShared(); + barrier(); + + for (uint limit = 32u; limit > 1u; limit >>= 1u) + { + if (local < limit) + tmp[local] = tmp[local] + tmp[local + limit]; + memoryBarrierShared(); + barrier(); + } + + if (local == 0u) + outputs[work_group] = tmp[0] + tmp[1]; +} diff --git a/third_party/spirv-cross/samples/cpp/shared.cpp b/third_party/spirv-cross/samples/cpp/shared.cpp new file mode 100644 index 0000000000..b997704bf8 --- /dev/null +++ b/third_party/spirv-cross/samples/cpp/shared.cpp @@ -0,0 +1,90 @@ +/* + * Copyright 2015-2017 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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_cross/external_interface.h" +#include + +#ifndef GLM_SWIZZLE +#define GLM_SWIZZLE +#endif + +#ifndef GLM_FORCE_RADIANS +#define GLM_FORCE_RADIANS +#endif + +#include +using namespace glm; + +int main() +{ + // First, we get the C interface to the shader. + // This can be loaded from a dynamic library, or as here, + // linked in as a static library. + auto *iface = spirv_cross_get_interface(); + + // Create an instance of the shader interface. + auto *shader = iface->construct(); + +// Build some input data for our compute shader. +#define NUM_WORKGROUPS 4 + float a[128 * NUM_WORKGROUPS]; + float b[NUM_WORKGROUPS] = {}; + + for (int i = 0; i < 128 * NUM_WORKGROUPS; i++) + { + a[i] = float(i); + } + + void *aptr = a; + void *bptr = b; + + // Bind resources to the shader. + // For resources like samplers and buffers, we provide a list of pointers, + // since UBOs, SSBOs and samplers can be arrays, and can point to different types, + // which is especially true for samplers. + spirv_cross_set_resource(shader, 0, 0, &aptr, sizeof(aptr)); + spirv_cross_set_resource(shader, 0, 1, &bptr, sizeof(bptr)); + + // We also have to set builtins. + // The relevant builtins will depend on the shader, + // but for compute, there are few builtins, which are gl_NumWorkGroups and gl_WorkGroupID. + // LocalInvocationID and GlobalInvocationID are inferred when executing the invocation. + uvec3 num_workgroups(NUM_WORKGROUPS, 1, 1); + uvec3 work_group_id(0, 0, 0); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_NUM_WORK_GROUPS, &num_workgroups, sizeof(num_workgroups)); + spirv_cross_set_builtin(shader, SPIRV_CROSS_BUILTIN_WORK_GROUP_ID, &work_group_id, sizeof(work_group_id)); + + // Execute 4 work groups. + for (unsigned i = 0; i < NUM_WORKGROUPS; i++) + { + work_group_id.x = i; + iface->invoke(shader); + } + + // Call destructor. + iface->destruct(shader); + + // Verify our output. + // TODO: Implement a test framework that asserts results computed. + for (unsigned i = 0; i < NUM_WORKGROUPS; i++) + { + float expected_sum = 0.0f; + for (unsigned j = i * 128; j < (i + 1) * 128; j++) + expected_sum += a[j]; + fprintf(stderr, "Sum in workgroup #%u = %.1f, expected %.1f\n", i, b[i], expected_sum); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp new file mode 100644 index 0000000000..3371e3af21 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/access-chain-load-store-composite.asm.comp @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 437 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Baz "Baz" + OpMemberName %Baz 0 "c" + OpName %Bar "Bar" + OpMemberName %Bar 0 "d" + OpMemberName %Bar 1 "baz" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpMemberName %Foo 2 "c" + OpName %Baz_0 "Baz" + OpMemberName %Baz_0 0 "c" + OpName %Bar_0 "Bar" + OpMemberName %Bar_0 0 "d" + OpMemberName %Bar_0 1 "baz" + OpName %Foo_0 "Foo" + OpMemberName %Foo_0 0 "a" + OpMemberName %Foo_0 1 "b" + OpMemberName %Foo_0 2 "c" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "foo" + OpMemberName %SSBO 1 "foo2" + OpName %_ "" + OpDecorate %_arr_float_uint_4_0 ArrayStride 4 + OpDecorate %_arr__arr_float_uint_4_0_uint_2 ArrayStride 16 + OpMemberDecorate %Baz_0 0 Offset 0 + OpDecorate %_arr_Baz_0_uint_2 ArrayStride 4 + OpMemberDecorate %Bar_0 0 Offset 0 + OpMemberDecorate %Bar_0 1 Offset 32 + OpDecorate %_arr_Bar_0_uint_5 ArrayStride 40 + OpMemberDecorate %Foo_0 0 RowMajor + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Foo_0 0 MatrixStride 8 + OpMemberDecorate %Foo_0 1 Offset 16 + OpMemberDecorate %Foo_0 2 Offset 24 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 224 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %uint_2 = OpConstant %uint 2 +%_arr__arr_float_uint_4_uint_2 = OpTypeArray %_arr_float_uint_4 %uint_2 + %Baz = OpTypeStruct %float +%_arr_Baz_uint_2 = OpTypeArray %Baz %uint_2 + %Bar = OpTypeStruct %_arr__arr_float_uint_4_uint_2 %_arr_Baz_uint_2 + %uint_5 = OpConstant %uint 5 +%_arr_Bar_uint_5 = OpTypeArray %Bar %uint_5 + %Foo = OpTypeStruct %mat2v2float %v2float %_arr_Bar_uint_5 +%_ptr_Function_Foo = OpTypePointer Function %Foo +%_arr_float_uint_4_0 = OpTypeArray %float %uint_4 +%_arr__arr_float_uint_4_0_uint_2 = OpTypeArray %_arr_float_uint_4_0 %uint_2 + %Baz_0 = OpTypeStruct %float +%_arr_Baz_0_uint_2 = OpTypeArray %Baz_0 %uint_2 + %Bar_0 = OpTypeStruct %_arr__arr_float_uint_4_0_uint_2 %_arr_Baz_0_uint_2 +%_arr_Bar_0_uint_5 = OpTypeArray %Bar_0 %uint_5 + %Foo_0 = OpTypeStruct %mat2v2float %v2float %_arr_Bar_0_uint_5 + %SSBO = OpTypeStruct %Foo_0 %Foo_0 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %int_2 = OpConstant %int 2 +%_ptr_Function__arr_Bar_uint_5 = OpTypePointer Function %_arr_Bar_uint_5 +%_ptr_Function_Bar = OpTypePointer Function %Bar +%_ptr_Function__arr__arr_float_uint_4_uint_2 = OpTypePointer Function %_arr__arr_float_uint_4_uint_2 +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 +%_ptr_Function_float = OpTypePointer Function %float + %int_3 = OpConstant %int 3 +%_ptr_Function__arr_Baz_uint_2 = OpTypePointer Function %_arr_Baz_uint_2 +%_ptr_Function_Baz = OpTypePointer Function %Baz + %int_4 = OpConstant %int 4 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_5 = OpConstant %float 5 +%_ptr_Uniform_mat2v2float = OpTypePointer Uniform %mat2v2float +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform__arr_Bar_0_uint_5 = OpTypePointer Uniform %_arr_Bar_0_uint_5 +%_ptr_Uniform_Bar_0 = OpTypePointer Uniform %Bar_0 +%_ptr_Uniform__arr__arr_float_uint_4_0_uint_2 = OpTypePointer Uniform %_arr__arr_float_uint_4_0_uint_2 +%_ptr_Uniform__arr_float_uint_4_0 = OpTypePointer Uniform %_arr_float_uint_4_0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform__arr_Baz_0_uint_2 = OpTypePointer Uniform %_arr_Baz_0_uint_2 +%_ptr_Uniform_Baz_0 = OpTypePointer Uniform %Baz_0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr_load = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_0 + %ptr_store = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_1 + %loaded = OpLoad %Foo_0 %ptr_load + OpStore %ptr_store %loaded + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..87aee2db54 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %T "T" + OpMemberName %T 0 "a" + OpName %v "v" + OpName %T_0 "T" + OpMemberName %T_0 0 "b" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "foo" + OpName %_ "" + OpName %T_1 "T" + OpMemberName %T_1 0 "c" + OpName %SSBO2 "SSBO2" + OpMemberName %SSBO2 0 "bar" + OpName %__0 "" + OpMemberDecorate %T_0 0 Offset 0 + OpDecorate %_runtimearr_T_0 ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %T_1 0 Offset 0 + OpDecorate %_runtimearr_T_1 ArrayStride 16 + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %T = OpTypeStruct %float +%_ptr_Function_T = OpTypePointer Function %T + %float_40 = OpConstant %float 40 + %11 = OpConstantComposite %T %float_40 + %T_0 = OpTypeStruct %float +%_runtimearr_T_0 = OpTypeRuntimeArray %T_0 + %SSBO1 = OpTypeStruct %_runtimearr_T_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_T_0 = OpTypePointer Uniform %T_0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %T_1 = OpTypeStruct %float +%_runtimearr_T_1 = OpTypeRuntimeArray %T_1 + %SSBO2 = OpTypeStruct %_runtimearr_T_1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %__0 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int_30 = OpConstant %int 30 +%_ptr_Uniform_T_1 = OpTypePointer Uniform %T_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_T Function + OpStore %v %11 + %20 = OpLoad %T %v + %22 = OpAccessChain %_ptr_Uniform_T_0 %_ %int_0 %int_10 + %23 = OpCompositeExtract %float %20 0 + %25 = OpAccessChain %_ptr_Uniform_float %22 %int_0 + OpStore %25 %23 + %32 = OpLoad %T %v + %34 = OpAccessChain %_ptr_Uniform_T_1 %__0 %int_0 %int_30 + %35 = OpCompositeExtract %float %32 0 + %36 = OpAccessChain %_ptr_Uniform_float %34 %int_0 + OpStore %36 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..3f2d141a1f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %c "c" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %SSBO = OpTypeStruct %uint %uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_0 = OpConstant %int 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_uint Function + %15 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %16 = OpAtomicLoad %uint %15 %int_1 %int_0 + OpStore %c %16 + %18 = OpLoad %uint %c + %19 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + OpAtomicStore %19 %int_1 %int_0 %18 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..a323841596 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "count" + OpMemberName %SSBO 1 "data" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO = OpTypeStruct %uint %_runtimearr_uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_1024 = OpConstant %uint 1024 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %19 = OpAtomicIAdd %uint %16 %uint_1 %uint_0 %uint_1 + %23 = OpULessThan %bool %19 %uint_1024 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %19 + OpStore %34 %33 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..435fa32221 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..e3b785cd52 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "u" + OpMemberName %SSBO 1 "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %uvec4 %ivec4 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uvec4 = OpTypePointer Uniform %uvec4 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_ivec4 = OpTypePointer Uniform %ivec4 + %main = OpFunction %void None %3 + %5 = OpLabel + %uptr = OpAccessChain %_ptr_Uniform_uvec4 %_ %int_0 + %iptr = OpAccessChain %_ptr_Uniform_ivec4 %_ %int_1 + %uvalue = OpLoad %uvec4 %uptr + %ivalue = OpLoad %ivec4 %iptr + + %lsb_uint_to_uint = OpExtInst %uvec4 %1 FindILsb %uvalue + %lsb_uint_to_int = OpExtInst %ivec4 %1 FindILsb %uvalue + %lsb_int_to_uint = OpExtInst %uvec4 %1 FindILsb %ivalue + %lsb_int_to_int = OpExtInst %ivec4 %1 FindILsb %ivalue + + %umsb_uint_to_uint = OpExtInst %uvec4 %1 FindUMsb %uvalue + %umsb_uint_to_int = OpExtInst %ivec4 %1 FindUMsb %uvalue + %umsb_int_to_uint = OpExtInst %uvec4 %1 FindUMsb %ivalue + %umsb_int_to_int = OpExtInst %ivec4 %1 FindUMsb %ivalue + + %smsb_uint_to_uint = OpExtInst %uvec4 %1 FindSMsb %uvalue + %smsb_uint_to_int = OpExtInst %ivec4 %1 FindSMsb %uvalue + %smsb_int_to_uint = OpExtInst %uvec4 %1 FindSMsb %ivalue + %smsb_int_to_int = OpExtInst %ivec4 %1 FindSMsb %ivalue + + OpStore %uptr %lsb_uint_to_uint + OpStore %iptr %lsb_uint_to_int + OpStore %uptr %lsb_int_to_uint + OpStore %iptr %lsb_int_to_int + + OpStore %uptr %umsb_uint_to_uint + OpStore %iptr %umsb_uint_to_int + OpStore %uptr %umsb_int_to_uint + OpStore %iptr %umsb_int_to_int + + OpStore %uptr %smsb_uint_to_uint + OpStore %iptr %smsb_uint_to_int + OpStore %uptr %smsb_int_to_uint + OpStore %iptr %smsb_int_to_int + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp new file mode 100644 index 0000000000..132f38bf72 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/buffer-atomic-nonuniform.asm.sm51.nonuniformresource.comp @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageBufferArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbos "ssbos" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %22 NonUniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %SSBO = OpTypeStruct %uint +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %17 = OpLoad %uint %16 + %18 = OpCopyObject %uint %17 + %22 = OpAccessChain %_ptr_Uniform_uint %ssbos %18 %int_0 + %25 = OpAtomicIAdd %uint %22 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..8997d0aaf9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Block "Block" + OpMemberName %Block 0 "f" + OpName %block "block" + OpMemberDecorate %Block 0 Offset 0 + OpDecorate %Block BufferBlock + OpDecorate %block DescriptorSet 0 + OpDecorate %block Binding 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Block = OpTypeStruct %v4float +%_ptr_Uniform_Block = OpTypePointer Uniform %Block + %block = OpVariable %_ptr_Uniform_Block Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %15 = OpUndef %float + %16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %6 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0 + OpStore %19 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..e1dcb0ef8e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %gl_LocalInvocationID + OpExecutionMode %main LocalSize 4 4 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %25 "indexable" + OpName %38 "indexable" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %25 = OpConstantComposite %_arr_int_uint_4 %int_0 %int_1 %int_2 %int_3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %38 = OpConstantComposite %_arr_int_uint_4 %int_4 %int_5 %int_6 %int_7 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function +%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_4 Function + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %28 = OpLoad %uint %27 + OpStore %indexable %25 + %32 = OpAccessChain %_ptr_Function_int %indexable %28 + %33 = OpLoad %int %32 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %41 = OpLoad %uint %40 + OpStore %indexable_0 %38 + %43 = OpAccessChain %_ptr_Function_int %indexable_0 %41 + %44 = OpLoad %int %43 + %45 = OpIAdd %int %33 %44 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %47 %45 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..73f3ceee1a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + ;OpEntryPoint GLCompute %main "main" %Samp %ubo %ssbo %v %w + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Samp "Samp" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %ubo "ubo" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbo "ssbo" + OpName %v "v" + OpName %w "w" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %Samp DescriptorSet 0 + OpDecorate %Samp Binding 0 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubo DescriptorSet 0 + OpDecorate %ubo Binding 1 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %float = OpTypeFloat 32 + %12 = OpTypeImage %float 2D 0 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %Samp = OpVariable %_ptr_UniformConstant_13 UniformConstant + %UBO = OpTypeStruct %float +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %SSBO = OpTypeStruct %float +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer +%_ptr_Private_float = OpTypePointer Private %float + %v = OpVariable %_ptr_Private_float Private +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %w = OpVariable %_ptr_Workgroup_float Workgroup + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..7da9f95b9e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints + %int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints + %uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints + %uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints + + %int_to_int_ssign = OpExtInst %v4int %1 SSign %ints + %int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints + %uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints + %uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints + + %int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints + %int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints + %uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints + %uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints + + %int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints + %int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints + %uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints + %uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints + + %int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints + %int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints + %uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints + %uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints + + %int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints + %int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints + %uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints + %uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints + + %int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints + %int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints + %uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints + %uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints + + %int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints + %int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints + %uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints + %uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints + + OpStore %ints_ptr %int_to_int_sabs + OpStore %uints_ptr %int_to_uint_sabs + OpStore %ints_ptr %uint_to_int_sabs + OpStore %uints_ptr %uint_to_uint_sabs + + OpStore %ints_ptr %int_to_int_ssign + OpStore %uints_ptr %int_to_uint_ssign + OpStore %ints_ptr %uint_to_int_ssign + OpStore %uints_ptr %uint_to_uint_ssign + + OpStore %ints_ptr %int_to_int_smsb + OpStore %uints_ptr %int_to_uint_smsb + OpStore %ints_ptr %uint_to_int_umsb + OpStore %uints_ptr %uint_to_uint_umsb + + OpStore %ints_ptr %int_to_int_smin + OpStore %uints_ptr %int_to_uint_smin + OpStore %ints_ptr %uint_to_int_smin + OpStore %uints_ptr %uint_to_uint_smin + + OpStore %ints_ptr %int_to_int_umin + OpStore %uints_ptr %int_to_uint_umin + OpStore %ints_ptr %uint_to_int_umin + OpStore %uints_ptr %uint_to_uint_umin + + OpStore %ints_ptr %int_to_int_smax + OpStore %uints_ptr %int_to_uint_smax + OpStore %ints_ptr %uint_to_int_smax + OpStore %uints_ptr %uint_to_uint_smax + + OpStore %ints_ptr %int_to_int_umax + OpStore %uints_ptr %int_to_uint_umax + OpStore %ints_ptr %uint_to_int_umax + OpStore %uints_ptr %uint_to_uint_umax + + OpStore %ints_ptr %int_to_int_sclamp + OpStore %uints_ptr %int_to_uint_sclamp + OpStore %ints_ptr %uint_to_int_uclamp + OpStore %uints_ptr %uint_to_uint_uclamp + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp new file mode 100644 index 0000000000..30db11d45b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.fxconly.asm.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %ResTypeMod = OpTypeStruct %float %float +%_ptr_Function_ResTypeMod = OpTypePointer Function %ResTypeMod + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_20 = OpConstant %float 20 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%ResTypeFrexp = OpTypeStruct %float %int +%_ptr_Function_ResTypeFrexp = OpTypePointer Function %ResTypeFrexp + %float_40 = OpConstant %float 40 +%_ptr_Function_int = OpTypePointer Function %int + %SSBO = OpTypeStruct %float %int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %3 + %5 = OpLabel + %modres = OpExtInst %ResTypeMod %1 ModfStruct %float_20 + %frexpres = OpExtInst %ResTypeFrexp %1 FrexpStruct %float_40 + + %modres_f = OpCompositeExtract %float %modres 0 + %modres_i = OpCompositeExtract %float %modres 1 + %frexpres_f = OpCompositeExtract %float %frexpres 0 + %frexpres_i = OpCompositeExtract %int %frexpres 1 + + %float_ptr = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %int_ptr = OpAccessChain %_ptr_Uniform_int %_ %int_1 + + OpStore %float_ptr %modres_f + OpStore %float_ptr %modres_i + OpStore %float_ptr %frexpres_f + OpStore %int_ptr %frexpres_i + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp new file mode 100644 index 0000000000..5dad9dd5ed --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/image-atomic-nonuniform.asm.sm51.nonuniformresource.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageImageArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %uImage "uImage" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %uImage DescriptorSet 0 + OpDecorate %uImage Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %30 NonUniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %7 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_runtimearr_7 = OpTypeRuntimeArray %7 +%_ptr_UniformConstant__runtimearr_7 = OpTypePointer UniformConstant %_runtimearr_7 + %uImage = OpVariable %_ptr_UniformConstant__runtimearr_7 UniformConstant + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %v2uint = OpTypeVector %uint 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Image_uint = OpTypePointer Image %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %17 = OpLoad %uint %16 + %18 = OpCopyObject %uint %17 + %20 = OpAccessChain %_ptr_UniformConstant_7 %uImage %18 + %22 = OpLoad %v3uint %gl_GlobalInvocationID + %23 = OpVectorShuffle %v2uint %22 %22 0 1 + %26 = OpBitcast %v2int %23 + %30 = OpImageTexelPointer %_ptr_Image_uint %20 %26 %uint_0 + %31 = OpAtomicIAdd %uint %30 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp new file mode 100644 index 0000000000..2eaef4bdbe --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id-override.asm.comp @@ -0,0 +1,60 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + %spec_1 = OpSpecConstant %uint 11 + %spec_2 = OpSpecConstant %uint 12 + %spec_3 = OpSpecConstant %uint 13 + %spec_4 = OpSpecConstant %uint 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %uint_3 %spec_1 %spec_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp new file mode 100644 index 0000000000..3031f4bb8a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/local-size-id.asm.comp @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + ; Test that we can declare the spec constant as signed. + ; Needs implicit bitcast since WorkGroupSize is uint. + %spec_1 = OpSpecConstant %int 11 + %spec_2 = OpSpecConstant %int 12 + %spec_3 = OpSpecConstant %int 13 + %spec_4 = OpSpecConstant %int 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + ; Test that we can build spec constant composites out of local size id values. + ; Needs special case handling. + %spec_3_op = OpSpecConstantOp %uint IAdd %spec_3 %uint_3 +%WorkGroupSize = OpSpecConstantComposite %v3uint %spec_3_op %spec_4 %uint_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %wg_f = OpConvertUToF %v3float %WorkGroupSize + %wg_f4 = OpVectorShuffle %v4float %wg_f %wg_f 0 1 2 2 + ; Test that we can use the spec constants directly which needs to translate to gl_WorkGroupSize.elem. + ; Needs special case handling. + %res = OpFAdd %v4float %27 %wg_f4 + %f0 = OpConvertSToF %float %spec_3 + %f1 = OpConvertSToF %float %spec_4 + %f2 = OpConvertSToF %float %uint_2 + %res1 = OpVectorTimesScalar %v4float %res %f0 + %res2 = OpVectorTimesScalar %v4float %res1 %f1 + %res3 = OpVectorTimesScalar %v4float %res2 %f2 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %res3 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp new file mode 100644 index 0000000000..e820da5fc4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/num-workgroups.spv14.asm.comp @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %gl_NumWorkGroups %__0 + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %_ "" + OpName %gl_NumWorkGroups "gl_NumWorkGroups" + OpName %UBO "UBO" + OpMemberName %UBO 0 "w" + OpName %__0 "" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %SSBO = OpTypeStruct %v3uint +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input + %UBO = OpTypeStruct %v3uint +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %__0 = OpVariable %_ptr_Uniform_UBO Uniform +%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint +%_ptr_StorageBuffer_v3uint = OpTypePointer StorageBuffer %v3uint + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %v3uint %gl_NumWorkGroups + %20 = OpAccessChain %_ptr_Uniform_v3uint %__0 %int_0 + %21 = OpLoad %v3uint %20 + %22 = OpIAdd %v3uint %15 %21 + %24 = OpAccessChain %_ptr_StorageBuffer_v3uint %_ %int_0 + OpStore %24 %22 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp new file mode 100644 index 0000000000..b4e622bace --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %A "A" + OpName %B "A" + OpName %C "A" + OpName %D "A" + OpName %E "A" + OpName %F "A" + OpName %G "A" + OpName %H "A" + OpName %I "A" + OpName %J "A" + OpName %K "A" + OpName %L "A" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %A SpecId 0 + OpDecorate %B SpecId 1 + OpDecorate %C SpecId 2 + OpDecorate %D SpecId 3 + OpDecorate %E SpecId 4 + OpDecorate %F SpecId 5 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %A = OpSpecConstant %int 0 + %B = OpSpecConstant %int 1 + %C = OpSpecConstant %int 2 + %D = OpSpecConstant %int 3 + %E = OpSpecConstant %int 4 + %F = OpSpecConstant %int 5 + %G = OpSpecConstantOp %int ISub %A %B + %H = OpSpecConstantOp %int ISub %G %C + %I = OpSpecConstantOp %int ISub %H %D + %J = OpSpecConstantOp %int ISub %I %E + %K = OpSpecConstantOp %int ISub %J %F + %L = OpSpecConstantOp %int IAdd %K %F +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %32 %L + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp new file mode 100644 index 0000000000..188e3fec36 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/specialization-constant-workgroup.nofxc.asm.comp @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 20 1 + OpSource ESSL 310 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %19 SpecId 10 + OpDecorate %21 SpecId 12 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %19 = OpSpecConstant %uint 9 + %uint_20 = OpConstant %uint 20 + %21 = OpSpecConstant %uint 4 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %19 %uint_20 %21 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %15 = OpLoad %float %14 + %16 = OpFAdd %float %15 %float_1 + %17 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %17 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp new file mode 100644 index 0000000000..db9a8490df --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/comp/storage-buffer-basic.nofxc.asm.comp @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Codeplay; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + ;OpCapability VariablePointers + OpExtension "SPV_KHR_storage_buffer_storage_class" + ;OpExtension "SPV_KHR_variable_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "main" %gl_WorkGroupID + OpSource OpenCL_C 120 + OpDecorate %15 SpecId 0 + ;OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + %float = OpTypeFloat 32 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_4 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %uint_0 = OpConstant %uint 0 +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpSpecConstant %uint 1 + %16 = OpConstant %uint 2 + %17 = OpSpecConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %20 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %22 = OpFunction %void None %8 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %25 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %25 + %29 = OpLoad %float %28 + %30 = OpFAdd %float %27 %29 + OpStore %28 %30 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..6782b12473 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_ + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpMemberName %AA 0 "foo" + OpMemberName %AB 0 "foo" + OpMemberName %A 0 "_aa" + OpMemberName %A 1 "ab" + OpMemberName %BA 0 "foo" + OpMemberName %BB 0 "foo" + OpMemberName %B 0 "_ba" + OpMemberName %B 1 "bb" + OpName %VertexData "VertexData" + OpMemberName %VertexData 0 "_a" + OpMemberName %VertexData 1 "b" + OpName %_ "" + OpMemberName %CA 0 "foo" + OpMemberName %C 0 "_ca" + OpMemberName %DA 0 "foo" + OpMemberName %D 0 "da" + OpName %UBO "UBO" + OpMemberName %UBO 0 "_c" + OpMemberName %UBO 1 "d" + OpName %__0 "" + OpMemberName %E 0 "a" + OpName %SSBO "SSBO" + ;OpMemberName %SSBO 0 "e" Test that we don't try to assign bogus aliases. + OpMemberName %SSBO 1 "_e" + OpMemberName %SSBO 2 "f" + OpName %__1 "" + OpDecorate %VertexData Block + OpDecorate %_ Location 0 + OpMemberDecorate %CA 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %DA 0 Offset 0 + OpMemberDecorate %D 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %E 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpDecorate %SSBO BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %AA = OpTypeStruct %int + %AB = OpTypeStruct %int + %A = OpTypeStruct %AA %AB + %BA = OpTypeStruct %int + %BB = OpTypeStruct %int + %B = OpTypeStruct %BA %BB + %VertexData = OpTypeStruct %A %B +%_ptr_Input_VertexData = OpTypePointer Input %VertexData + %_ = OpVariable %_ptr_Input_VertexData Input + %CA = OpTypeStruct %int + %C = OpTypeStruct %CA + %DA = OpTypeStruct %int + %D = OpTypeStruct %DA + %UBO = OpTypeStruct %C %D +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %__0 = OpVariable %_ptr_Uniform_UBO Uniform + %E = OpTypeStruct %int + %SSBO = OpTypeStruct %E %E %E +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %__1 = OpVariable %_ptr_Uniform_SSBO Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..9408e69ac0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vInput %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %vInput "vInput" + OpName %FragColor "FragColor" + OpName %phi "PHI" + OpDecorate %vInput RelaxedPrecision + OpDecorate %vInput Location 0 + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %b0 RelaxedPrecision + OpDecorate %b1 RelaxedPrecision + OpDecorate %b2 RelaxedPrecision + OpDecorate %b3 RelaxedPrecision + OpDecorate %c1 RelaxedPrecision + OpDecorate %c3 RelaxedPrecision + OpDecorate %d4_mp RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vInput = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %float_3 = OpConstant %float 3 + %uint_2 = OpConstant %uint 2 + %float_4 = OpConstant %float 4 + %uint_3 = OpConstant %uint 3 + %v4float_arr2 = OpTypeArray %v4float %uint_2 + %v44float = OpTypeMatrix %v4float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v4undef = OpUndef %v4float + %v4const = OpConstantNull %v4float + %v4arrconst = OpConstantNull %v4float_arr2 + %v44const = OpConstantNull %v44float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + + %loaded0 = OpLoad %v4float %vInput + + ; Basic case (highp). + %a0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %a1 = OpCompositeInsert %v4float %float_2 %a0 1 + %a2 = OpCompositeInsert %v4float %float_3 %a1 2 + %a3 = OpCompositeInsert %v4float %float_4 %a2 3 + OpStore %FragColor %a3 + + ; Basic case (mediump). + %b0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %b1 = OpCompositeInsert %v4float %float_2 %b0 1 + %b2 = OpCompositeInsert %v4float %float_3 %b1 2 + %b3 = OpCompositeInsert %v4float %float_4 %b2 3 + OpStore %FragColor %b3 + + ; Mix relaxed precision. + %c0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %c1 = OpCompositeInsert %v4float %float_2 %c0 1 + %c2 = OpCompositeInsert %v4float %float_3 %c1 2 + %c3 = OpCompositeInsert %v4float %float_4 %c2 3 + OpStore %FragColor %c3 + + ; SSA use after insert + %d0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %d1 = OpCompositeInsert %v4float %float_2 %d0 1 + %d2 = OpCompositeInsert %v4float %float_3 %d1 2 + %d3 = OpCompositeInsert %v4float %float_4 %d2 3 + %d4 = OpFAdd %v4float %d3 %d0 + OpStore %FragColor %d4 + %d4_mp = OpFAdd %v4float %d3 %d1 + OpStore %FragColor %d4_mp + + ; Verify Insert behavior on Undef. + %e0 = OpCompositeInsert %v4float %float_1 %v4undef 0 + %e1 = OpCompositeInsert %v4float %float_2 %e0 1 + %e2 = OpCompositeInsert %v4float %float_3 %e1 2 + %e3 = OpCompositeInsert %v4float %float_4 %e2 3 + OpStore %FragColor %e3 + + ; Verify Insert behavior on Constant. + %f0 = OpCompositeInsert %v4float %float_1 %v4const 0 + OpStore %FragColor %f0 + + ; Verify Insert behavior on Array. + %g0 = OpCompositeInsert %v4float_arr2 %float_1 %v4arrconst 1 2 + %g1 = OpCompositeInsert %v4float_arr2 %float_2 %g0 0 3 + %g2 = OpCompositeExtract %v4float %g1 0 + OpStore %FragColor %g2 + %g3 = OpCompositeExtract %v4float %g1 1 + OpStore %FragColor %g3 + + ; Verify Insert behavior on Matrix. + %h0 = OpCompositeInsert %v44float %float_1 %v44const 1 2 + %h1 = OpCompositeInsert %v44float %float_2 %h0 2 3 + %h2 = OpCompositeExtract %v4float %h1 0 + OpStore %FragColor %h2 + %h3 = OpCompositeExtract %v4float %h1 1 + OpStore %FragColor %h3 + %h4 = OpCompositeExtract %v4float %h1 2 + OpStore %FragColor %h4 + %h5 = OpCompositeExtract %v4float %h1 3 + OpStore %FragColor %h5 + + ; Verify that we cannot RMW PHI variables. + OpBranch %next + %next = OpLabel + %phi = OpPhi %v4float %d2 %5 + %i0 = OpCompositeInsert %v4float %float_4 %phi 3 + OpStore %FragColor %i0 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..a9650ddbb6 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %EmptyStruct2Test "EmptyStruct2Test" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%EmptyStruct2Test = OpTypeStruct %EmptyStructTest +%_ptr_Function_EmptyStruct2Test = OpTypePointer Function %EmptyStruct2Test + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStruct2Test + %6 = OpTypeFunction %float %EmptyStruct2Test + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStruct2Test + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %value4 = OpConstantNull %EmptyStruct2Test + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStruct2Test + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStruct2Test + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStruct2Test Function + %18 = OpVariable %_ptr_Function_EmptyStruct2Test Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %value3 = OpCompositeConstruct %EmptyStruct2Test %value2 + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value3 + %24 = OpFunctionCall %float %GetValue2 %value4 + OpStore %value %22 + OpStore %value %23 + OpStore %value %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..ca8022d4bb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %Tex "Tex" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %main "main" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %Tex DescriptorSet 0 + OpDecorate %Tex Binding 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %16 = OpTypeFunction %void + %Tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v3uint Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpLoad %v3uint %in_var_TEXCOORD0 + %21 = OpCompositeExtract %uint %20 2 + %27 = OpLoad %type_2d_image %Tex + %28 = OpImageFetch %v4float %27 %20 Lod %21 + OpStore %out_var_SV_Target0 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag new file mode 100644 index 0000000000..72f6d9d86e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-bracket-handling-2.nonuniformresource.sm51.asm.frag @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability SampledImageArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamplers "uSamplers" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "indices" + OpName %_ "" + OpName %vUV "vUV" + OpName %uSampler "uSampler" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uSamplers DescriptorSet 0 + OpDecorate %uSamplers Binding 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 2 + OpDecorate %_ Binding 0 + OpDecorate %26 NonUniform + OpDecorate %28 NonUniform + OpDecorate %29 NonUniform + OpDecorate %vUV Location 0 + OpDecorate %uSampler DescriptorSet 1 + OpDecorate %uSampler Binding 1 + OpDecorate %38 NonUniform + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_runtimearr_11 = OpTypeRuntimeArray %11 +%_ptr_UniformConstant__runtimearr_11 = OpTypePointer UniformConstant %_runtimearr_11 + %uSamplers = OpVariable %_ptr_UniformConstant__runtimearr_11 UniformConstant + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %float_0 = OpConstant %float 0 + %uSampler = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_10 + %26 = OpLoad %uint %24 + %28 = OpAccessChain %_ptr_UniformConstant_11 %uSamplers %26 + %29 = OpLoad %11 %28 + %33 = OpLoad %v2float %vUV + %35 = OpImageSampleExplicitLod %v4float %29 %33 Lod %float_0 + OpStore %FragColor %35 + %37 = OpLoad %11 %uSampler + %38 = OpCopyObject %11 %37 + %39 = OpLoad %v2float %vUV + %44 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %46 = OpConvertFToS %int %45 + %47 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %46 + %48 = OpLoad %uint %47 + %49 = OpConvertUToF %float %48 + %50 = OpImageSampleExplicitLod %v4float %38 %39 Lod %49 + %51 = OpLoad %v4float %FragColor + %52 = OpFAdd %v4float %51 %50 + OpStore %FragColor %52 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag new file mode 100644 index 0000000000..5aa68849b1 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-qualifier-propagation.nonuniformresource.sm51.asm.frag @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniformEXT + OpCapability RuntimeDescriptorArrayEXT + OpCapability UniformBufferArrayNonUniformIndexingEXT + OpCapability SampledImageArrayNonUniformIndexingEXT + OpCapability StorageBufferArrayNonUniformIndexingEXT + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %i "i" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpName %uSamplers "uSamplers" + OpName %uSamps "uSamps" + OpName %vUV "vUV" + OpName %uCombinedSamplers "uCombinedSamplers" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %ubos "ubos" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbos "ssbos" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %FragColor Location 0 + OpDecorate %uSamplers DescriptorSet 0 + OpDecorate %uSamplers Binding 0 + + OpDecorate %sampled_image NonUniformEXT + OpDecorate %combined_sampler NonUniformEXT + OpDecorate %ubo_ptr_copy NonUniformEXT + OpDecorate %ssbo_ptr_copy NonUniformEXT + + OpDecorate %uSamps DescriptorSet 1 + OpDecorate %uSamps Binding 0 + OpDecorate %vUV Location 1 + OpDecorate %uCombinedSamplers DescriptorSet 0 + OpDecorate %uCombinedSamplers Binding 4 + OpDecorate %_arr_v4float_uint_64 ArrayStride 16 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubos DescriptorSet 2 + OpDecorate %ubos Binding 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 3 + OpDecorate %ssbos Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %16 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_runtimearr_16 = OpTypeRuntimeArray %16 +%_ptr_UniformConstant__runtimearr_16 = OpTypePointer UniformConstant %_runtimearr_16 + %uSamplers = OpVariable %_ptr_UniformConstant__runtimearr_16 UniformConstant + %int_10 = OpConstant %int 10 +%_ptr_UniformConstant_16 = OpTypePointer UniformConstant %16 + %27 = OpTypeSampler +%_runtimearr_27 = OpTypeRuntimeArray %27 +%_ptr_UniformConstant__runtimearr_27 = OpTypePointer UniformConstant %_runtimearr_27 + %uSamps = OpVariable %_ptr_UniformConstant__runtimearr_27 UniformConstant + %int_40 = OpConstant %int 40 +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 + %38 = OpTypeSampledImage %16 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input +%_runtimearr_38 = OpTypeRuntimeArray %38 +%_ptr_UniformConstant__runtimearr_38 = OpTypePointer UniformConstant %_runtimearr_38 +%uCombinedSamplers = OpVariable %_ptr_UniformConstant__runtimearr_38 UniformConstant +%_ptr_UniformConstant_38 = OpTypePointer UniformConstant %38 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 + %UBO = OpTypeStruct %_arr_v4float_uint_64 +%_runtimearr_UBO = OpTypeRuntimeArray %UBO +%_ptr_Uniform__runtimearr_UBO = OpTypePointer Uniform %_runtimearr_UBO + %ubos = OpVariable %_ptr_Uniform__runtimearr_UBO Uniform + %int_20 = OpConstant %int 20 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %int_50 = OpConstant %int 50 + %int_60 = OpConstant %int 60 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %11 = OpLoad %int %vIndex + OpStore %i %11 + %20 = OpLoad %int %i + %22 = OpIAdd %int %20 %int_10 + %23 = OpCopyObject %int %22 + %25 = OpAccessChain %_ptr_UniformConstant_16 %uSamplers %23 + %26 = OpLoad %16 %25 + %31 = OpLoad %int %i + %33 = OpIAdd %int %31 %int_40 + %34 = OpCopyObject %int %33 + %36 = OpAccessChain %_ptr_UniformConstant_27 %uSamps %34 + %37 = OpLoad %27 %36 + %sampled_image = OpSampledImage %38 %26 %37 + %43 = OpLoad %v2float %vUV + %44 = OpImageSampleImplicitLod %v4float %sampled_image %43 + OpStore %FragColor %44 + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_10 + %50 = OpCopyObject %int %49 + %52 = OpAccessChain %_ptr_UniformConstant_38 %uCombinedSamplers %50 + %combined_sampler = OpLoad %38 %52 + %54 = OpLoad %v2float %vUV + %55 = OpImageSampleImplicitLod %v4float %combined_sampler %54 + OpStore %FragColor %55 + %63 = OpLoad %int %i + %65 = OpIAdd %int %63 %int_20 + %66 = OpCopyObject %int %65 + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_40 + %70 = OpCopyObject %int %69 + %ubo_ptr = OpAccessChain %_ptr_Uniform_v4float %ubos %66 %int_0 %70 + %ubo_ptr_copy = OpCopyObject %_ptr_Uniform_v4float %ubo_ptr + %73 = OpLoad %v4float %ubo_ptr_copy + %74 = OpLoad %v4float %FragColor + %75 = OpFAdd %v4float %74 %73 + OpStore %FragColor %75 + %81 = OpLoad %int %i + %83 = OpIAdd %int %81 %int_50 + %84 = OpCopyObject %int %83 + %85 = OpLoad %int %i + %87 = OpIAdd %int %85 %int_60 + %88 = OpCopyObject %int %87 + %ssbo_ptr = OpAccessChain %_ptr_Uniform_v4float %ssbos %84 %int_0 %88 + %ssbo_ptr_copy = OpCopyObject %_ptr_Uniform_v4float %ssbo_ptr + %90 = OpLoad %v4float %ssbo_ptr_copy + %91 = OpLoad %v4float %FragColor + %92 = OpFAdd %v4float %91 %90 + OpStore %FragColor %92 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag new file mode 100644 index 0000000000..c5428a8bb9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/nonuniform-ssbo.sm51.nonuniformresource.asm.frag @@ -0,0 +1,99 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageBufferArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpSourceExtension "GL_EXT_samplerless_texture_functions" + OpName %main "main" + OpName %i "i" + OpName %vIndex "vIndex" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "counter" + OpMemberName %SSBO 1 "v" + OpName %ssbos "ssbos" + OpName %FragColor "FragColor" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 3 + OpDecorate %32 NonUniform + OpDecorate %39 NonUniform + OpDecorate %49 NonUniform + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %uint %_runtimearr_v4float +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %int_60 = OpConstant %int 60 + %int_1 = OpConstant %int 1 + %int_70 = OpConstant %int 70 + %float_20 = OpConstant %float 20 + %30 = OpConstantComposite %v4float %float_20 %float_20 %float_20 %float_20 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_100 = OpConstant %uint 100 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %uint_2 = OpConstant %uint 2 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %11 = OpLoad %int %vIndex + OpStore %i %11 + %20 = OpLoad %int %i + %22 = OpIAdd %int %20 %int_60 + %23 = OpCopyObject %int %22 + %25 = OpLoad %int %i + %27 = OpIAdd %int %25 %int_70 + %28 = OpCopyObject %int %27 + %32 = OpAccessChain %_ptr_Uniform_v4float %ssbos %23 %int_1 %28 + OpStore %32 %30 + %33 = OpLoad %int %i + %35 = OpIAdd %int %33 %int_100 + %36 = OpCopyObject %int %35 + %39 = OpAccessChain %_ptr_Uniform_uint %ssbos %36 %int_0 + %43 = OpAtomicIAdd %uint %39 %uint_1 %uint_0 %uint_100 + %46 = OpLoad %int %i + %47 = OpCopyObject %int %46 + %49 = OpAccessChain %_ptr_Uniform_SSBO %ssbos %47 + %50 = OpArrayLength %uint %49 1 + %51 = OpBitcast %int %50 + %52 = OpConvertSToF %float %51 + %55 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + %56 = OpLoad %float %55 + %57 = OpFAdd %float %56 %52 + %58 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %58 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..17aab1d8f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..3696660d36 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vColor %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vColor "vColor" + OpName %uninit_function_int "uninit_function_int" + OpName %FragColor "FragColor" + OpName %uninit_int "uninit_int" + OpName %uninit_vector "uninit_vector" + OpName %uninit_matrix "uninit_matrix" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpName %uninit_foo "uninit_foo" + OpDecorate %vColor Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vColor = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_10 = OpConstant %float 10 + %bool = OpTypeBool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_20 = OpConstant %int 20 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_int = OpTypePointer Private %int + %uninit_int = OpUndef %int + %v4int = OpTypeVector %int 4 +%_ptr_Private_v4int = OpTypePointer Private %v4int +%uninit_vector = OpUndef %v4int +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float +%uninit_matrix = OpUndef %mat4v4float + %Foo = OpTypeStruct %int +%_ptr_Private_Foo = OpTypePointer Private %Foo + %uninit_foo = OpUndef %Foo + %main = OpFunction %void None %3 + %5 = OpLabel +%uninit_function_int = OpVariable %_ptr_Function_int Function + %13 = OpAccessChain %_ptr_Input_float %vColor %uint_0 + %14 = OpLoad %float %13 + %17 = OpFOrdGreaterThan %bool %14 %float_10 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %24 + %18 = OpLabel + OpBranch %19 + %24 = OpLabel + OpBranch %19 + %19 = OpLabel + %27 = OpPhi %int %int_10 %18 %int_20 %24 + %28 = OpLoad %v4float %vColor + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..ebd8d6bab7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-callstack.sm51.fxconly.asm.frag @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + OpReturn + OpFunctionEnd + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + OpBeginInvocationInterlockEXT + %43 = OpFunctionCall %void %callee2_ + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..69b8f91120 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-control-flow.sm51.fxconly.asm.frag @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %ssbo2 DescriptorSet 0 + OpDecorate %ssbo2 Binding 2 + + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint + %SSBO2 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %ssbo2 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_4 = OpConstant %uint 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %callee3_res = OpFunctionCall %void %callee3_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %calle3_block = OpLabel + %frag_coord_x_ptr = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %frag_coord_x = OpLoad %float %frag_coord_x_ptr + %frag_coord_int = OpConvertFToS %int %frag_coord_x + %ssbo_ptr = OpAccessChain %_ptr_Uniform_uint %ssbo2 %int_0 %frag_coord_int + OpStore %ssbo_ptr %uint_4 + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + + OpSelectionMerge %merged_block None + OpBranchConditional %true %dummy_block %merged_block + %dummy_block = OpLabel + OpBeginInvocationInterlockEXT + OpEndInvocationInterlockEXT + OpBranch %merged_block + + %merged_block = OpLabel + OpReturn + + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag new file mode 100644 index 0000000000..7c0fe9a2b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/pixel-interlock-split-functions.sm51.fxconly.asm.frag @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %call3res = OpFunctionCall %void %callee3_ + %call4res = OpFunctionCall %void %callee4_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %begin3 = OpLabel + OpBeginInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee4_ = OpFunction %void None %3 + %begin4 = OpLabel + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..a5a16f2873 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %ACOS_f1_ "mat3" + OpName %a "a" + OpName %ACOS_i1_ "gl_Foo" + OpName %a_0 "a" + OpName %FragColor "FragColor" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %float %_ptr_Function_int + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_2 = OpConstant %float 2 + %int_4 = OpConstant %int 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %param %float_2 + %32 = OpFunctionCall %float %ACOS_f1_ %param + OpStore %param_0 %int_4 + %35 = OpFunctionCall %float %ACOS_i1_ %param_0 + %36 = OpFAdd %float %32 %35 + OpStore %FragColor %36 + OpReturn + OpFunctionEnd + %ACOS_f1_ = OpFunction %float None %8 + %a = OpFunctionParameter %_ptr_Function_float + %11 = OpLabel + %18 = OpLoad %float %a + %20 = OpFAdd %float %18 %float_1 + OpReturnValue %20 + OpFunctionEnd + %ACOS_i1_ = OpFunction %float None %14 + %a_0 = OpFunctionParameter %_ptr_Function_int + %17 = OpLabel + %23 = OpLoad %int %a_0 + %24 = OpConvertSToF %float %23 + %25 = OpFAdd %float %24 %float_1 + OpReturnValue %25 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..07450ee80b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %s = OpTypeStruct %float + %arr = OpTypeArray %float %uint_2 +%_ptr_Function_s = OpTypePointer Function %s +%_ptr_Function_arr = OpTypePointer Function %arr + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %s0 = OpConstantComposite %s %float_0 + %s1 = OpConstantComposite %s %float_1 + %v4bool = OpTypeVector %bool 4 + %b4 = OpConstantComposite %v4bool %false %true %false %true + %arr1 = OpConstantComposite %arr %float_0 %float_1 + %arr2 = OpConstantComposite %arr %float_1 %float_0 + %main = OpFunction %void None %3 + %5 = OpLabel + %ss = OpVariable %_ptr_Function_s Function + %arrvar = OpVariable %_ptr_Function_arr Function + ; Not trivial + %21 = OpSelect %v4float %false %17 %18 + OpStore %FragColor %21 + ; Trivial + %22 = OpSelect %v4float %false %19 %20 + OpStore %FragColor %22 + ; Vector not trivial + %23 = OpSelect %v4float %b4 %17 %18 + OpStore %FragColor %23 + ; Vector trivial + %24 = OpSelect %v4float %b4 %19 %20 + OpStore %FragColor %24 + ; Struct selection + %sout = OpSelect %s %false %s0 %s1 + OpStore %ss %sout + ; Array selection + %arrout = OpSelect %arr %true %arr1 %arr2 + OpStore %arrvar %arrout + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag new file mode 100644 index 0000000000..421e466093 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/struct-packing-last-element-array-matrix-rule.invalid.asm.frag @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %Foo "Foo" + OpMemberName %Foo 0 "m" + OpMemberName %Foo 1 "v" + OpName %FooUBO "FooUBO" + OpMemberName %FooUBO 0 "foo" + OpName %_ "" + OpName %Bar "Bar" + OpMemberName %Bar 0 "m" + OpMemberName %Bar 1 "v" + OpName %BarUBO "BarUBO" + OpMemberName %BarUBO 0 "bar" + OpName %__0 "" + OpDecorate %FragColor Location 0 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 48 + OpMemberDecorate %Foo 0 ColMajor + OpMemberDecorate %Foo 0 Offset 0 + OpMemberDecorate %Foo 0 MatrixStride 16 + OpMemberDecorate %Foo 1 Offset 92 + OpMemberDecorate %FooUBO 0 Offset 0 + OpDecorate %FooUBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %Bar 0 ColMajor + OpMemberDecorate %Bar 0 Offset 0 + OpMemberDecorate %Bar 0 MatrixStride 16 + OpMemberDecorate %Bar 1 Offset 44 + OpMemberDecorate %BarUBO 0 Offset 0 + OpDecorate %BarUBO Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %Foo = OpTypeStruct %_arr_mat3v3float_uint_2 %float + %FooUBO = OpTypeStruct %Foo +%_ptr_Uniform_FooUBO = OpTypePointer Uniform %FooUBO + %_ = OpVariable %_ptr_Uniform_FooUBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Bar = OpTypeStruct %mat3v3float %float + %BarUBO = OpTypeStruct %Bar +%_ptr_Uniform_BarUBO = OpTypePointer Uniform %BarUBO + %__0 = OpVariable %_ptr_Uniform_BarUBO Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1 + %24 = OpLoad %float %23 + %29 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpFAdd %float %24 %30 + %32 = OpCompositeConstruct %v4float %31 %31 %31 %31 + OpStore %FragColor %32 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag new file mode 100644 index 0000000000..a9b34893c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/subgroup-arithmetic-cast.invalid.nofxc.sm60.asm.frag @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpCapability GroupNonUniform + OpCapability GroupNonUniformArithmetic + OpCapability GroupNonUniformClustered + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %index %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_KHR_shader_subgroup_arithmetic" + OpSourceExtension "GL_KHR_shader_subgroup_basic" + OpSourceExtension "GL_KHR_shader_subgroup_clustered" + OpName %main "main" + OpName %index "index" + OpName %FragColor "FragColor" + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Output_uint = OpTypePointer Output %uint + %FragColor = OpVariable %_ptr_Output_uint Output + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpLoad %int %index + %u = OpBitcast %uint %i + %res0 = OpGroupNonUniformSMin %uint %uint_3 Reduce %i + %res1 = OpGroupNonUniformSMax %uint %uint_3 Reduce %u + %res2 = OpGroupNonUniformUMin %uint %uint_3 Reduce %i + %res3 = OpGroupNonUniformUMax %uint %uint_3 Reduce %u + ;%res4 = OpGroupNonUniformSMax %uint %uint_3 InclusiveScan %i + ;%res5 = OpGroupNonUniformSMin %uint %uint_3 InclusiveScan %u + ;%res6 = OpGroupNonUniformUMax %uint %uint_3 ExclusiveScan %i + ;%res7 = OpGroupNonUniformUMin %uint %uint_3 ExclusiveScan %u + ;%res8 = OpGroupNonUniformSMin %uint %uint_3 ClusteredReduce %i %uint_4 + ;%res9 = OpGroupNonUniformSMax %uint %uint_3 ClusteredReduce %u %uint_4 + ;%res10 = OpGroupNonUniformUMin %uint %uint_3 ClusteredReduce %i %uint_4 + ;%res11 = OpGroupNonUniformUMax %uint %uint_3 ClusteredReduce %u %uint_4 + OpStore %FragColor %res0 + OpStore %FragColor %res1 + OpStore %FragColor %res2 + OpStore %FragColor %res3 + ;OpStore %FragColor %res4 + ;OpStore %FragColor %res5 + ;OpStore %FragColor %res6 + ;OpStore %FragColor %res7 + ;OpStore %FragColor %res8 + ;OpStore %FragColor %res9 + ;OpStore %FragColor %res10 + ;OpStore %FragColor %res11 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..6556c3c8c4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %j "j" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %header = OpLabel + %i = OpVariable %_ptr_Function_int Function %int_0 + %j = OpVariable %_ptr_Function_int Function + %9 = OpLoad %int %vIndex + OpSelectionMerge %switch_merge None + OpSwitch %9 %default_case 100 %default_case 0 %case_0 1 %case_1 11 %case_1 2 %case_2 3 %case_3 4 %case_4 5 %case_5 + + %case_0 = OpLabel + OpBranch %default_case + + %default_case = OpLabel + %default_case_phi = OpPhi %int %int_2 %header %int_3 %case_0 + ; Test what happens when a case block dominates access to a variable. + OpStore %j %default_case_phi + OpBranch %case_1 + + %case_1 = OpLabel + ; Test phi nodes between case labels. + %case_1_phi = OpPhi %int %int_0 %default_case %int_1 %header + OpStore %j %case_1_phi + OpBranch %case_2 + + %case_2 = OpLabel + OpBranch %switch_merge + + %case_3 = OpLabel + ; Conditionally branch to another case block. This is really dumb, but it is apparently legal. + %case_3_cond = OpSGreaterThan %bool %9 %int_3 + OpBranchConditional %case_3_cond %case_4 %switch_merge + + %case_4 = OpLabel + ; When emitted from case 3, we should *not* see fallthrough behavior. + OpBranch %case_5 + + %case_5 = OpLabel + OpStore %i %int_0 + OpBranch %switch_merge + + %switch_merge = OpLabel + %26 = OpLoad %int %i + %27 = OpConvertSToF %float %26 + %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag new file mode 100644 index 0000000000..2e5e030922 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.asm.frag @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %A %B %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %test_vector_ "test_vector(" + OpName %test_scalar_ "test_scalar(" + OpName %le "le" + OpName %A "A" + OpName %B "B" + OpName %leq "leq" + OpName %ge "ge" + OpName %geq "geq" + OpName %eq "eq" + OpName %neq "neq" + OpName %le_0 "le" + OpName %leq_0 "leq" + OpName %ge_0 "ge" + OpName %geq_0 "geq" + OpName %eq_0 "eq" + OpName %neq_0 "neq" + OpName %FragColor "FragColor" + OpDecorate %A Location 0 + OpDecorate %B Location 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %11 = OpTypeFunction %float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %A = OpVariable %_ptr_Input_v4float Input + %B = OpVariable %_ptr_Input_v4float Input + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %128 = OpFunctionCall %v4float %test_vector_ + %129 = OpFunctionCall %float %test_scalar_ + %130 = OpCompositeConstruct %v4float %129 %129 %129 %129 + %131 = OpFAdd %v4float %128 %130 + OpStore %FragColor %131 + OpReturn + OpFunctionEnd +%test_vector_ = OpFunction %v4float None %8 + %10 = OpLabel + %le = OpVariable %_ptr_Function_v4bool Function + %leq = OpVariable %_ptr_Function_v4bool Function + %ge = OpVariable %_ptr_Function_v4bool Function + %geq = OpVariable %_ptr_Function_v4bool Function + %eq = OpVariable %_ptr_Function_v4bool Function + %neq = OpVariable %_ptr_Function_v4bool Function + %20 = OpLoad %v4float %A + %22 = OpLoad %v4float %B + %23 = OpFUnordLessThan %v4bool %20 %22 + OpStore %le %23 + %25 = OpLoad %v4float %A + %26 = OpLoad %v4float %B + %27 = OpFUnordLessThanEqual %v4bool %25 %26 + OpStore %leq %27 + %29 = OpLoad %v4float %A + %30 = OpLoad %v4float %B + %31 = OpFUnordGreaterThan %v4bool %29 %30 + OpStore %ge %31 + %33 = OpLoad %v4float %A + %34 = OpLoad %v4float %B + %35 = OpFUnordGreaterThanEqual %v4bool %33 %34 + OpStore %geq %35 + %37 = OpLoad %v4float %A + %38 = OpLoad %v4float %B + %39 = OpFUnordEqual %v4bool %37 %38 + OpStore %eq %39 + %ordered = OpFOrdNotEqual %v4bool %37 %38 + OpStore %neq %ordered + %41 = OpLoad %v4float %A + %42 = OpLoad %v4float %B + %43 = OpFUnordNotEqual %v4bool %41 %42 + OpStore %neq %43 + %44 = OpLoad %v4bool %le + %49 = OpSelect %v4float %44 %48 %47 + %50 = OpLoad %v4bool %leq + %51 = OpSelect %v4float %50 %48 %47 + %52 = OpFAdd %v4float %49 %51 + %53 = OpLoad %v4bool %ge + %54 = OpSelect %v4float %53 %48 %47 + %55 = OpFAdd %v4float %52 %54 + %56 = OpLoad %v4bool %geq + %57 = OpSelect %v4float %56 %48 %47 + %58 = OpFAdd %v4float %55 %57 + %59 = OpLoad %v4bool %eq + %60 = OpSelect %v4float %59 %48 %47 + %61 = OpFAdd %v4float %58 %60 + %62 = OpLoad %v4bool %neq + %63 = OpSelect %v4float %62 %48 %47 + %64 = OpFAdd %v4float %61 %63 + OpReturnValue %64 + OpFunctionEnd +%test_scalar_ = OpFunction %float None %11 + %13 = OpLabel + %le_0 = OpVariable %_ptr_Function_bool Function + %leq_0 = OpVariable %_ptr_Function_bool Function + %ge_0 = OpVariable %_ptr_Function_bool Function + %geq_0 = OpVariable %_ptr_Function_bool Function + %eq_0 = OpVariable %_ptr_Function_bool Function + %neq_0 = OpVariable %_ptr_Function_bool Function + %72 = OpAccessChain %_ptr_Input_float %A %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Input_float %B %uint_0 + %75 = OpLoad %float %74 + %76 = OpFUnordLessThan %bool %73 %75 + OpStore %le_0 %76 + %78 = OpAccessChain %_ptr_Input_float %A %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Input_float %B %uint_0 + %81 = OpLoad %float %80 + %82 = OpFUnordLessThanEqual %bool %79 %81 + OpStore %leq_0 %82 + %84 = OpAccessChain %_ptr_Input_float %A %uint_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Input_float %B %uint_0 + %87 = OpLoad %float %86 + %88 = OpFUnordGreaterThan %bool %85 %87 + OpStore %ge_0 %88 + %90 = OpAccessChain %_ptr_Input_float %A %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Input_float %B %uint_0 + %93 = OpLoad %float %92 + %94 = OpFUnordGreaterThanEqual %bool %91 %93 + OpStore %geq_0 %94 + %96 = OpAccessChain %_ptr_Input_float %A %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Input_float %B %uint_0 + %99 = OpLoad %float %98 + %100 = OpFUnordEqual %bool %97 %99 + OpStore %eq_0 %100 + %102 = OpAccessChain %_ptr_Input_float %A %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Input_float %B %uint_0 + %105 = OpLoad %float %104 + %106 = OpFUnordNotEqual %bool %103 %105 + OpStore %neq_0 %106 + %107 = OpLoad %bool %le_0 + %108 = OpSelect %float %107 %float_1 %float_0 + %109 = OpLoad %bool %leq_0 + %110 = OpSelect %float %109 %float_1 %float_0 + %111 = OpFAdd %float %108 %110 + %112 = OpLoad %bool %ge_0 + %113 = OpSelect %float %112 %float_1 %float_0 + %114 = OpFAdd %float %111 %113 + %115 = OpLoad %bool %geq_0 + %116 = OpSelect %float %115 %float_1 %float_0 + %117 = OpFAdd %float %114 %116 + %118 = OpLoad %bool %eq_0 + %119 = OpSelect %float %118 %float_1 %float_0 + %120 = OpFAdd %float %117 %119 + %121 = OpLoad %bool %neq_0 + %122 = OpSelect %float %121 %float_1 %float_0 + %123 = OpFAdd %float %120 %122 + OpReturnValue %123 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag new file mode 100644 index 0000000000..2e5e030922 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %A %B %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %test_vector_ "test_vector(" + OpName %test_scalar_ "test_scalar(" + OpName %le "le" + OpName %A "A" + OpName %B "B" + OpName %leq "leq" + OpName %ge "ge" + OpName %geq "geq" + OpName %eq "eq" + OpName %neq "neq" + OpName %le_0 "le" + OpName %leq_0 "leq" + OpName %ge_0 "ge" + OpName %geq_0 "geq" + OpName %eq_0 "eq" + OpName %neq_0 "neq" + OpName %FragColor "FragColor" + OpDecorate %A Location 0 + OpDecorate %B Location 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %11 = OpTypeFunction %float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %A = OpVariable %_ptr_Input_v4float Input + %B = OpVariable %_ptr_Input_v4float Input + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %128 = OpFunctionCall %v4float %test_vector_ + %129 = OpFunctionCall %float %test_scalar_ + %130 = OpCompositeConstruct %v4float %129 %129 %129 %129 + %131 = OpFAdd %v4float %128 %130 + OpStore %FragColor %131 + OpReturn + OpFunctionEnd +%test_vector_ = OpFunction %v4float None %8 + %10 = OpLabel + %le = OpVariable %_ptr_Function_v4bool Function + %leq = OpVariable %_ptr_Function_v4bool Function + %ge = OpVariable %_ptr_Function_v4bool Function + %geq = OpVariable %_ptr_Function_v4bool Function + %eq = OpVariable %_ptr_Function_v4bool Function + %neq = OpVariable %_ptr_Function_v4bool Function + %20 = OpLoad %v4float %A + %22 = OpLoad %v4float %B + %23 = OpFUnordLessThan %v4bool %20 %22 + OpStore %le %23 + %25 = OpLoad %v4float %A + %26 = OpLoad %v4float %B + %27 = OpFUnordLessThanEqual %v4bool %25 %26 + OpStore %leq %27 + %29 = OpLoad %v4float %A + %30 = OpLoad %v4float %B + %31 = OpFUnordGreaterThan %v4bool %29 %30 + OpStore %ge %31 + %33 = OpLoad %v4float %A + %34 = OpLoad %v4float %B + %35 = OpFUnordGreaterThanEqual %v4bool %33 %34 + OpStore %geq %35 + %37 = OpLoad %v4float %A + %38 = OpLoad %v4float %B + %39 = OpFUnordEqual %v4bool %37 %38 + OpStore %eq %39 + %ordered = OpFOrdNotEqual %v4bool %37 %38 + OpStore %neq %ordered + %41 = OpLoad %v4float %A + %42 = OpLoad %v4float %B + %43 = OpFUnordNotEqual %v4bool %41 %42 + OpStore %neq %43 + %44 = OpLoad %v4bool %le + %49 = OpSelect %v4float %44 %48 %47 + %50 = OpLoad %v4bool %leq + %51 = OpSelect %v4float %50 %48 %47 + %52 = OpFAdd %v4float %49 %51 + %53 = OpLoad %v4bool %ge + %54 = OpSelect %v4float %53 %48 %47 + %55 = OpFAdd %v4float %52 %54 + %56 = OpLoad %v4bool %geq + %57 = OpSelect %v4float %56 %48 %47 + %58 = OpFAdd %v4float %55 %57 + %59 = OpLoad %v4bool %eq + %60 = OpSelect %v4float %59 %48 %47 + %61 = OpFAdd %v4float %58 %60 + %62 = OpLoad %v4bool %neq + %63 = OpSelect %v4float %62 %48 %47 + %64 = OpFAdd %v4float %61 %63 + OpReturnValue %64 + OpFunctionEnd +%test_scalar_ = OpFunction %float None %11 + %13 = OpLabel + %le_0 = OpVariable %_ptr_Function_bool Function + %leq_0 = OpVariable %_ptr_Function_bool Function + %ge_0 = OpVariable %_ptr_Function_bool Function + %geq_0 = OpVariable %_ptr_Function_bool Function + %eq_0 = OpVariable %_ptr_Function_bool Function + %neq_0 = OpVariable %_ptr_Function_bool Function + %72 = OpAccessChain %_ptr_Input_float %A %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Input_float %B %uint_0 + %75 = OpLoad %float %74 + %76 = OpFUnordLessThan %bool %73 %75 + OpStore %le_0 %76 + %78 = OpAccessChain %_ptr_Input_float %A %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Input_float %B %uint_0 + %81 = OpLoad %float %80 + %82 = OpFUnordLessThanEqual %bool %79 %81 + OpStore %leq_0 %82 + %84 = OpAccessChain %_ptr_Input_float %A %uint_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Input_float %B %uint_0 + %87 = OpLoad %float %86 + %88 = OpFUnordGreaterThan %bool %85 %87 + OpStore %ge_0 %88 + %90 = OpAccessChain %_ptr_Input_float %A %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Input_float %B %uint_0 + %93 = OpLoad %float %92 + %94 = OpFUnordGreaterThanEqual %bool %91 %93 + OpStore %geq_0 %94 + %96 = OpAccessChain %_ptr_Input_float %A %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Input_float %B %uint_0 + %99 = OpLoad %float %98 + %100 = OpFUnordEqual %bool %97 %99 + OpStore %eq_0 %100 + %102 = OpAccessChain %_ptr_Input_float %A %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Input_float %B %uint_0 + %105 = OpLoad %float %104 + %106 = OpFUnordNotEqual %bool %103 %105 + OpStore %neq_0 %106 + %107 = OpLoad %bool %le_0 + %108 = OpSelect %float %107 %float_1 %float_0 + %109 = OpLoad %bool %leq_0 + %110 = OpSelect %float %109 %float_1 %float_0 + %111 = OpFAdd %float %108 %110 + %112 = OpLoad %bool %ge_0 + %113 = OpSelect %float %112 %float_1 %float_0 + %114 = OpFAdd %float %111 %113 + %115 = OpLoad %bool %geq_0 + %116 = OpSelect %float %115 %float_1 %float_0 + %117 = OpFAdd %float %114 %116 + %118 = OpLoad %bool %eq_0 + %119 = OpSelect %float %118 %float_1 %float_0 + %120 = OpFAdd %float %117 %119 + %121 = OpLoad %bool %neq_0 + %122 = OpSelect %float %121 %float_1 %float_0 + %123 = OpFAdd %float %120 %122 + OpReturnValue %123 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag new file mode 100644 index 0000000000..38af5ec49d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vec4-straddle-packing-holes.asm.frag @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %PSMain "main" %out_var_SV_Target + OpExecutionMode %PSMain OriginUpperLeft + OpSource HLSL 600 + OpName %type_Test "type.Test" + OpMemberName %type_Test 0 "V0_xyz_" + OpMemberName %type_Test 1 "V1___zw" + OpName %Test "Test" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %PSMain "PSMain" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Test DescriptorSet 0 + OpDecorate %Test Binding 0 + OpMemberDecorate %type_Test 0 Offset 0 + OpMemberDecorate %type_Test 1 Offset 24 + OpDecorate %type_Test Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %type_Test = OpTypeStruct %v3float %v2float +%_ptr_Uniform_type_Test = OpTypePointer Uniform %type_Test + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %15 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Test = OpVariable %_ptr_Uniform_type_Test Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %PSMain = OpFunction %void None %15 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v3float %Test %int_0 + %20 = OpLoad %v3float %19 + %21 = OpAccessChain %_ptr_Uniform_float %Test %uint_1 %int_0 + %22 = OpLoad %float %21 + %23 = OpCompositeExtract %float %20 0 + %24 = OpCompositeExtract %float %20 1 + %25 = OpCompositeExtract %float %20 2 + %26 = OpCompositeConstruct %v4float %23 %24 %25 %22 + OpStore %out_var_SV_Target %26 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..22c4efca93 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vFloat + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vFloat "vFloat" + OpName %undef "undef" + OpDecorate %FragColor Location 0 + OpDecorate %vFloat Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vFloat = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %undef = OpUndef %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Private_float = OpTypePointer Private %float + %uint_3 = OpConstant %uint 3 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %v4float %vFloat + %26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3 + %27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3 + %28 = OpFAdd %v4float %26 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh new file mode 100644 index 0000000000..7b38001d8d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.4 +; Generator: Unknown(30017); 21022 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpCapability Geometry + OpCapability ShaderViewportIndexLayerEXT + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpExtension "SPV_EXT_shader_viewport_index_layer" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %SV_Position %B %SV_CullPrimitive %SV_RenderTargetArrayIndex %SV_PrimitiveID %C %indices %32 %gl_LocalInvocationIndex %38 + OpExecutionMode %main OutputVertices 24 + OpExecutionMode %main OutputPrimitivesNV 8 + OpExecutionMode %main OutputTrianglesNV + OpExecutionMode %main LocalSize 2 3 4 + OpName %main "main" + OpName %SV_Position "SV_Position" + OpName %B "B" + OpName %SV_CullPrimitive "SV_CullPrimitive" + OpName %SV_RenderTargetArrayIndex "SV_RenderTargetArrayIndex" + OpName %SV_PrimitiveID "SV_PrimitiveID" + OpName %C "C" + OpName %indices "indices" + OpName %_ "" + OpDecorate %SV_Position BuiltIn Position + OpDecorate %B Location 1 + OpDecorate %SV_CullPrimitive BuiltIn CullPrimitiveEXT + OpDecorate %SV_CullPrimitive PerPrimitiveNV + OpDecorate %SV_RenderTargetArrayIndex BuiltIn Layer + OpDecorate %SV_RenderTargetArrayIndex PerPrimitiveNV + OpDecorate %SV_PrimitiveID BuiltIn PrimitiveId + OpDecorate %SV_PrimitiveID PerPrimitiveNV + OpDecorate %C Location 3 + OpDecorate %C PerPrimitiveNV + OpDecorate %indices BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_24 = OpConstant %uint 24 +%_arr_v4float_uint_24 = OpTypeArray %v4float %uint_24 +%_ptr_Output__arr_v4float_uint_24 = OpTypePointer Output %_arr_v4float_uint_24 +%SV_Position = OpVariable %_ptr_Output__arr_v4float_uint_24 Output + %B = OpVariable %_ptr_Output__arr_v4float_uint_24 Output + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 +%_arr_bool_uint_8 = OpTypeArray %bool %uint_8 +%_ptr_Output__arr_bool_uint_8 = OpTypePointer Output %_arr_bool_uint_8 +%SV_CullPrimitive = OpVariable %_ptr_Output__arr_bool_uint_8 Output +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Output__arr_uint_uint_8 = OpTypePointer Output %_arr_uint_uint_8 +%SV_RenderTargetArrayIndex = OpVariable %_ptr_Output__arr_uint_uint_8 Output +%SV_PrimitiveID = OpVariable %_ptr_Output__arr_uint_uint_8 Output +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Output__arr_v4float_uint_8 = OpTypePointer Output %_arr_v4float_uint_8 + %C = OpVariable %_ptr_Output__arr_v4float_uint_8 Output + %v3uint = OpTypeVector %uint 3 +%_arr_v3uint_uint_8 = OpTypeArray %v3uint %uint_8 +%_ptr_Output__arr_v3uint_uint_8 = OpTypePointer Output %_arr_v3uint_uint_8 + %indices = OpVariable %_ptr_Output__arr_v3uint_uint_8 Output + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %32 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %_ = OpTypeStruct %float +%_ptr_TaskPayloadWorkgroupEXT__ = OpTypePointer TaskPayloadWorkgroupEXT %_ + %38 = OpVariable %_ptr_TaskPayloadWorkgroupEXT__ TaskPayloadWorkgroupEXT +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Output_float = OpTypePointer Output %float + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_ptr_TaskPayloadWorkgroupEXT_float = OpTypePointer TaskPayloadWorkgroupEXT %float +%_ptr_Output_v3uint = OpTypePointer Output %v3uint +%_ptr_Output_bool = OpTypePointer Output %bool +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %2 + %4 = OpLabel + OpBranch %85 + %85 = OpLabel + %35 = OpLoad %uint %gl_LocalInvocationIndex + %39 = OpConvertUToF %float %35 + %41 = OpAccessChain %_ptr_Workgroup_float %32 %35 + OpStore %41 %39 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSetMeshOutputsEXT %uint_24 %uint_8 + %44 = OpLoad %float %41 + %46 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_0 + OpStore %46 %44 + %48 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_1 + OpStore %48 %44 + %50 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_2 + OpStore %50 %44 + %51 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_3 + OpStore %51 %44 + %53 = OpBitwiseXor %uint %35 %uint_1 + %54 = OpAccessChain %_ptr_Workgroup_float %32 %53 + %55 = OpLoad %float %54 + %57 = OpInBoundsAccessChain %_ptr_TaskPayloadWorkgroupEXT_float %38 %uint_0 + %58 = OpLoad %float %57 + %59 = OpFAdd %float %58 %55 + %60 = OpAccessChain %_ptr_Output_float %B %35 %uint_0 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Output_float %B %35 %uint_1 + OpStore %61 %59 + %62 = OpAccessChain %_ptr_Output_float %B %35 %uint_2 + OpStore %62 %59 + %63 = OpAccessChain %_ptr_Output_float %B %35 %uint_3 + OpStore %63 %59 + %64 = OpULessThan %bool %35 %uint_8 + OpSelectionMerge %87 None + OpBranchConditional %64 %86 %87 + %86 = OpLabel + %65 = OpIMul %uint %35 %uint_3 + %66 = OpIAdd %uint %65 %uint_1 + %67 = OpIAdd %uint %65 %uint_2 + %68 = OpCompositeConstruct %v3uint %65 %66 %67 + %70 = OpAccessChain %_ptr_Output_v3uint %indices %35 + OpStore %70 %68 + %71 = OpBitwiseAnd %uint %35 %uint_1 + %72 = OpINotEqual %bool %71 %uint_0 + %74 = OpAccessChain %_ptr_Output_bool %SV_CullPrimitive %35 + OpStore %74 %72 + %76 = OpAccessChain %_ptr_Output_uint %SV_PrimitiveID %35 + OpStore %76 %35 + %77 = OpAccessChain %_ptr_Output_uint %SV_RenderTargetArrayIndex %35 + OpStore %77 %35 + %78 = OpBitwiseXor %uint %35 %uint_2 + %79 = OpAccessChain %_ptr_Workgroup_float %32 %78 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Output_float %C %35 %uint_0 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Output_float %C %35 %uint_1 + OpStore %82 %80 + %83 = OpAccessChain %_ptr_Output_float %C %35 %uint_2 + OpStore %83 %80 + %84 = OpAccessChain %_ptr_Output_float %C %35 %uint_3 + OpStore %84 %80 + OpBranch %87 + %87 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..eccff08b33 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %25 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Flat + OpDecorate %vB Location 1 + OpDecorate %38 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input + %bool = OpTypeBool + %int_20 = OpConstant %int 20 + %int_50 = OpConstant %int 50 + %vB = OpVariable %_ptr_Input_int Input + %int_40 = OpConstant %int 40 + %int_60 = OpConstant %int 60 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %11 + OpBranch %17 + %17 = OpLabel + %60 = OpPhi %int %int_0 %5 %58 %20 + %57 = OpPhi %int %int_0 %5 %56 %20 + %25 = OpLoad %int %vA + %27 = OpSLessThan %bool %57 %25 + OpLoopMerge %19 %20 None + OpBranchConditional %27 %18 %19 + %18 = OpLabel + %30 = OpIAdd %int %25 %57 + %32 = OpIEqual %bool %30 %int_20 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %36 + %33 = OpLabel + OpBranch %34 + %36 = OpLabel + %38 = OpLoad %int %vB + %40 = OpIAdd %int %38 %57 + %42 = OpIEqual %bool %40 %int_40 + %64 = OpSelect %int %42 %int_60 %60 + OpBranch %34 + %34 = OpLabel + %58 = OpPhi %int %int_50 %33 %64 %36 + %49 = OpIAdd %int %58 %int_10 + %51 = OpLoad %v4float %FragColor + %53 = OpFAdd %v4float %51 %63 + OpStore %FragColor %53 + OpBranch %20 + %20 = OpLabel + %56 = OpIAdd %int %57 %49 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..a431e6a717 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %foo + OpSource GLSL 450 + OpName %main "main" + OpName %Vert "Vert" + OpMemberName %Vert 0 "a" + OpMemberName %Vert 1 "b" + OpName %_ "" + OpName %Foo "Foo" + OpMemberName %Foo 0 "c" + OpMemberName %Foo 1 "d" + OpName %foo "foo" + OpDecorate %Vert Block + OpDecorate %_ Location 0 + OpDecorate %foo Location 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Vert = OpTypeStruct %float %float +%_ptr_Output_Vert = OpTypePointer Output %Vert + %zero_vert = OpConstantNull %Vert + %_ = OpVariable %_ptr_Output_Vert Output %zero_vert + %Foo = OpTypeStruct %float %float +%_ptr_Output_Foo = OpTypePointer Output %Foo +%zero_foo = OpConstantNull %Foo + %foo = OpVariable %_ptr_Output_Foo Output %zero_foo + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..aaa68662e5 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %zero = OpConstantNull %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output %zero + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert new file mode 100644 index 0000000000..94a883c1ed --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/complex-link-by-name.asm.vert @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %output_location_0 %output_location_2 %output_location_3 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Struct_vec4" + OpMemberName %Foo 0 "m0" + OpName %c "c" + OpName %Foo_0 "Struct_vec4" + OpMemberName %Foo_0 0 "m0" + OpName %Bar "Struct_vec4" + OpMemberName %Bar 0 "m0" + OpName %UBO "UBO" + OpMemberName %UBO 0 "m0" + OpMemberName %UBO 1 "m1" + OpName %ubo_binding_0 "ubo_binding_0" + OpName %Bar_0 "Struct_vec4" + OpMemberName %Bar_0 0 "m0" + OpName %b "b" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %VertexOut "VertexOut" + OpMemberName %VertexOut 0 "m0" + OpMemberName %VertexOut 1 "m1" + OpName %output_location_0 "output_location_0" + OpName %output_location_2 "output_location_2" + OpName %output_location_3 "output_location_3" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Bar 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %ubo_binding_0 DescriptorSet 0 + OpDecorate %ubo_binding_0 Binding 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %VertexOut Block + OpDecorate %output_location_0 Location 0 + OpDecorate %output_location_2 Location 2 + OpDecorate %output_location_3 Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Foo = OpTypeStruct %v4float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %v4float + %Bar = OpTypeStruct %v4float + %UBO = OpTypeStruct %Foo_0 %Bar +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO +%ubo_binding_0 = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %Bar_0 = OpTypeStruct %v4float +%_ptr_Function_Bar_0 = OpTypePointer Function %Bar_0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_Bar = OpTypePointer Uniform %Bar + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %VertexOut = OpTypeStruct %Foo %Bar_0 +%_ptr_Output_VertexOut = OpTypePointer Output %VertexOut +%output_location_0 = OpVariable %_ptr_Output_VertexOut Output +%_ptr_Output_Foo = OpTypePointer Output %Foo +%_ptr_Output_Bar_0 = OpTypePointer Output %Bar_0 +%output_location_2 = OpVariable %_ptr_Output_Foo Output +%output_location_3 = OpVariable %_ptr_Output_Bar_0 Output + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_Foo Function + %b = OpVariable %_ptr_Function_Bar_0 Function + %19 = OpAccessChain %_ptr_Uniform_Foo_0 %ubo_binding_0 %int_0 + %20 = OpLoad %Foo_0 %19 + %21 = OpCompositeExtract %v4float %20 0 + %23 = OpAccessChain %_ptr_Function_v4float %c %int_0 + OpStore %23 %21 + %29 = OpAccessChain %_ptr_Uniform_Bar %ubo_binding_0 %int_1 + %30 = OpLoad %Bar %29 + %31 = OpCompositeExtract %v4float %30 0 + %32 = OpAccessChain %_ptr_Function_v4float %b %int_0 + OpStore %32 %31 + %39 = OpAccessChain %_ptr_Function_v4float %c %int_0 + %40 = OpLoad %v4float %39 + %41 = OpAccessChain %_ptr_Function_v4float %b %int_0 + %42 = OpLoad %v4float %41 + %43 = OpFAdd %v4float %40 %42 + %45 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %45 %43 + %49 = OpLoad %Foo %c + %51 = OpAccessChain %_ptr_Output_Foo %output_location_0 %int_0 + OpStore %51 %49 + %52 = OpLoad %Bar_0 %b + %54 = OpAccessChain %_ptr_Output_Bar_0 %output_location_0 %int_1 + OpStore %54 %52 + %56 = OpLoad %Foo %c + OpStore %output_location_2 %56 + %58 = OpLoad %Bar_0 %b + OpStore %output_location_3 %58 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..038ecaa6e3 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.1 +; Generator: Google rspirv; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" + OpName %Test "Test" + OpName %t "t" + OpName %retvar "retvar" + OpName %main "main" + OpName %retvar_0 "retvar" + %void = OpTypeVoid + %6 = OpTypeFunction %void + %Test = OpTypeStruct +%_ptr_Function_Test = OpTypePointer Function %Test +%_ptr_Function_void = OpTypePointer Function %void + %2 = OpFunction %void None %6 + %7 = OpLabel + %t = OpVariable %_ptr_Function_Test Function + %retvar = OpVariable %_ptr_Function_void Function + OpBranch %4 + %4 = OpLabel + %13 = OpCompositeConstruct %Test + OpStore %t %13 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %6 + %15 = OpLabel + %retvar_0 = OpVariable %_ptr_Function_void Function + OpBranch %14 + %14 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/bitfield.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..a2ef9aa0b7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/bitfield.comp @@ -0,0 +1,44 @@ +#version 310 es + +void main() +{ + int signed_value = 0; + uint unsigned_value = 0u; + + ivec3 signed_values = ivec3(0); + uvec3 unsigned_values = uvec3(0u); + + { + int s = bitfieldExtract(signed_value, 5, 20); + uint u = bitfieldExtract(unsigned_value, 6, 21); + + s = bitfieldInsert(s, 40, 5, 4); + u = bitfieldInsert(u, 60u, 5, 4); + + u = bitfieldReverse(u); + s = bitfieldReverse(s); + + int v0 = bitCount(u); + int v1 = bitCount(s); + + int v2 = findMSB(u); + int v3 = findLSB(s); + } + + { + ivec3 s = bitfieldExtract(signed_values, 5, 20); + uvec3 u = bitfieldExtract(unsigned_values, 6, 21); + + s = bitfieldInsert(s, ivec3(40), 5, 4); + u = bitfieldInsert(u, uvec3(60u), 5, 4); + + u = bitfieldReverse(u); + s = bitfieldReverse(s); + + ivec3 v0 = bitCount(u); + ivec3 v1 = bitCount(s); + + ivec3 v2 = findMSB(u); + ivec3 v3 = findLSB(s); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp new file mode 100644 index 0000000000..83b714bc40 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/glsl.std450.fxconly.comp @@ -0,0 +1,130 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float res; + int ires; + uint ures; + + vec4 f32; + ivec4 s32; + uvec4 u32; + + mat2 m2; + mat3 m3; + mat4 m4; +}; + +void main() +{ + float tmp; + vec2 v2; + vec3 v3; + vec4 v4; + int itmp; + + res = round(f32.x); + //res = roundEven(f32.x); + res = trunc(f32.x); + res = abs(f32.x); + ires = abs(s32.x); + res = sign(f32.x); + ires = sign(s32.x); + res = floor(f32.x); + res = ceil(f32.x); + res = fract(f32.x); + res = radians(f32.x); + res = degrees(f32.x); + res = sin(f32.x); + res = cos(f32.x); + res = tan(f32.x); + res = asin(f32.x); + res = acos(f32.x); + res = atan(f32.x); + res = sinh(f32.x); + res = cosh(f32.x); + res = tanh(f32.x); + //res = asinh(f32.x); + //res = acosh(f32.x); + //res = atanh(f32.x); + res = atan(f32.x, f32.y); + res = pow(f32.x, f32.y); + res = exp(f32.x); + res = log(f32.x); + res = exp2(f32.x); + res = log2(f32.x); + res = sqrt(f32.x); + res = inversesqrt(f32.x); + + res = length(f32.x); + res = distance(f32.x, f32.y); + res = normalize(f32.x); + res = faceforward(f32.x, f32.y, f32.z); + res = reflect(f32.x, f32.y); + res = refract(f32.x, f32.y, f32.z); + + res = length(f32.xy); + res = distance(f32.xy, f32.zw); + v2 = normalize(f32.xy); + v2 = faceforward(f32.xy, f32.yz, f32.zw); + v2 = reflect(f32.xy, f32.zw); + v2 = refract(f32.xy, f32.yz, f32.w); + + v3 = cross(f32.xyz, f32.yzw); + + res = determinant(m2); + res = determinant(m3); + res = determinant(m4); + m2 = inverse(m2); + m3 = inverse(m3); + m4 = inverse(m4); + + res = modf(f32.x, tmp); + // ModfStruct + + res = min(f32.x, f32.y); + ures = min(u32.x, u32.y); + ires = min(s32.x, s32.y); + res = max(f32.x, f32.y); + ures = max(u32.x, u32.y); + ires = max(s32.x, s32.y); + + res = clamp(f32.x, f32.y, f32.z); + ures = clamp(u32.x, u32.y, u32.z); + ires = clamp(s32.x, s32.y, s32.z); + + res = mix(f32.x, f32.y, f32.z); + res = step(f32.x, f32.y); + res = smoothstep(f32.x, f32.y, f32.z); + res = fma(f32.x, f32.y, f32.z); + + res = frexp(f32.x, itmp); + + // FrexpStruct + res = ldexp(f32.x, itmp); + + ures = packSnorm4x8(f32); + ures = packUnorm4x8(f32); + ures = packSnorm2x16(f32.xy); + ures = packUnorm2x16(f32.xy); + ures = packHalf2x16(f32.xy); + // packDouble2x32 + + v2 = unpackSnorm2x16(u32.x); + v2 = unpackUnorm2x16(u32.x); + v2 = unpackHalf2x16(u32.x); + v4 = unpackSnorm4x8(u32.x); + v4 = unpackUnorm4x8(u32.x); + // unpackDouble2x32 + + s32 = findLSB(s32); + s32 = findLSB(u32); + s32 = findMSB(s32); + s32 = findMSB(u32); + + // interpolateAtSample + // interpolateAtOffset + + // NMin, NMax, NClamp +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..f7a8787d3d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Foo" + OpMemberName %Foo 0 "abs" + OpName %f "f" + OpName %Foo_0 "Foo" + OpMemberName %Foo_0 0 "abs" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "foo" + OpMemberName %SSBO 1 "foo2" + OpName %_ "" + OpName %linear "abs" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Foo = OpTypeStruct %float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %float + %SSBO = OpTypeStruct %Foo_0 %Foo_0 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_Foo Function + %linear = OpVariable %_ptr_Function_int Function + %17 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_0 + %18 = OpLoad %Foo_0 %17 + %19 = OpCompositeExtract %float %18 0 + %21 = OpAccessChain %_ptr_Function_float %f %int_0 + OpStore %21 %19 + OpStore %linear %int_10 + %26 = OpLoad %Foo %f + %27 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_1 + %28 = OpCompositeExtract %float %26 0 + %30 = OpAccessChain %_ptr_Uniform_float %27 %int_0 + OpStore %30 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..ee35cedabb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/intmin-literal.comp @@ -0,0 +1,18 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float b; +}; + +void main() +{ + a = intBitsToFloat(floatBitsToInt(b) ^ 0x80000000); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp new file mode 100644 index 0000000000..bc182c5292 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups-boolean.invalid.nofxc.sm60.comp @@ -0,0 +1,30 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 30) in; + +layout(std430, binding = 0) buffer SSBO +{ + uint FragColor[]; +}; + +void main() +{ + bool v = gl_GlobalInvocationID.x != 3; + bvec4 v4; + v4.x = subgroupOr(v); + v4.y = subgroupAnd(v); + v4.z = subgroupXor(v); + v4.w = subgroupAllEqual(v); + + uvec4 w = uvec4(v4); + FragColor[gl_GlobalInvocationID.x] = w.x + w.y + w.z + w.w; +} + + diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp new file mode 100644 index 0000000000..bbda0efd5b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/subgroups.invalid.nofxc.sm60.comp @@ -0,0 +1,138 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + //FragColor = float(gl_NumSubgroups); + //FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + //bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + //bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + //uint lsb = subgroupBallotFindLSB(ballot_value); + //uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(true); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + bvec4 anded_b = subgroupAnd(equal(ballot_value, uvec4(42))); + bvec4 ored_b = subgroupOr(equal(ballot_value, uvec4(42))); + bvec4 xored_b = subgroupXor(equal(ballot_value, uvec4(42))); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); +#if 0 + lo = subgroupInclusiveMin(lo); + hi = subgroupInclusiveMax(hi); + slo = subgroupInclusiveMin(slo); + shi = subgroupInclusiveMax(shi); + ulo = subgroupInclusiveMin(ulo); + uhi = subgroupInclusiveMax(uhi); + anded = subgroupInclusiveAnd(anded); + ored = subgroupInclusiveOr(ored); + xored = subgroupInclusiveXor(ored); + added = subgroupExclusiveAdd(lo); +#endif + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); +#if 0 + lo = subgroupExclusiveMin(lo); + hi = subgroupExclusiveMax(hi); + ulo = subgroupExclusiveMin(ulo); + uhi = subgroupExclusiveMax(uhi); + slo = subgroupExclusiveMin(slo); + shi = subgroupExclusiveMax(shi); + anded = subgroupExclusiveAnd(anded); + ored = subgroupExclusiveOr(ored); + xored = subgroupExclusiveXor(ored); +#endif + +#if 0 + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 4u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 4u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 4u); +#endif + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..c3e0922a16 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + vec3 a; + vec3 b; +}; + +void main() +{ + bvec3 c = lessThan(b, vec3(1.0)); + a = mix(vec3(1, 0, 0), vec3(0, 0, 1), c); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..5ffcc3f3a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + mat3 a; + float b; +}; + +void main() +{ + // Scalar to Matrix + bool c = b < 1.0; + a = c ? mat3(vec3(1), vec3(1), vec3(1)) : mat3(vec3(0), vec3(0), vec3(0)); + a = c ? mat3(1) : mat3(0); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag new file mode 100644 index 0000000000..4f22da56d9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/cbuffer-packing-straddle.frag @@ -0,0 +1,50 @@ +#version 450 + +layout(set = 0, binding = 0) uniform UBO +{ + vec4 a[2]; // 0 + vec4 b; // 32 + vec4 c; // 48 + mat4x4 d; // 64 + + float e; // 128 + vec2 f; // 136 + + float g; // 144 + vec2 h; // 152 + + float i; // 160 + vec2 j; // 168 + + float k; + vec2 l; + + float m; + float n; + float o; + + vec4 p; + vec4 q; + vec3 r; + vec4 s; + vec4 t; + vec4 u; + float v; + float w; + float x; + float y; + float z; + float aa; + float ab; + float ac; + float ad; + float ae; + vec4 ef; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = a[1]; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag new file mode 100644 index 0000000000..d60002a0f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/constant-buffer-array.invalid.sm51.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(std140, binding = 4) uniform CBO +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +} cbo[2][4]; + +layout(std430, push_constant) uniform PushMe +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +} push; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = cbo[1][2].a; + FragColor += cbo[1][2].b; + FragColor += cbo[1][2].c; + FragColor += cbo[1][2].d; + FragColor += push.a; + FragColor += push.b; + FragColor += push.c; + FragColor += push.d; +} + diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag new file mode 100644 index 0000000000..4f92e20359 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/fp16.invalid.desktop.frag @@ -0,0 +1,156 @@ +#version 450 +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) in float16_t v1; +layout(location = 1) in f16vec2 v2; +layout(location = 2) in f16vec3 v3; +layout(location = 3) in f16vec4 v4; + +layout(location = 0) out float o1; +layout(location = 1) out vec2 o2; +layout(location = 2) out vec3 o3; +layout(location = 3) out vec4 o4; + +#if 0 +// Doesn't work on glslang yet. +f16mat2 test_mat2(f16vec2 a, f16vec2 b, f16vec2 c, f16vec2 d) +{ + return f16mat2(a, b) * f16mat2(c, d); +} + +f16mat3 test_mat3(f16vec3 a, f16vec3 b, f16vec3 c, f16vec3 d, f16vec3 e, f16vec3 f) +{ + return f16mat3(a, b, c) * f16mat3(d, e, f); +} +#endif + +void test_constants() +{ + float16_t a = 1.0hf; + float16_t b = 1.5hf; + float16_t c = -1.5hf; // Negatives + float16_t d = (0.0hf / 0.0hf); // NaN + float16_t e = (1.0hf / 0.0hf); // +Inf + float16_t f = (-1.0hf / 0.0hf); // -Inf + float16_t g = 1014.0hf; // Large. + float16_t h = 0.000001hf; // Denormal +} + +float16_t test_result() +{ + return 1.0hf; +} + +void test_conversions() +{ + float16_t one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = bool(one); + float d = float(one); + double e = double(one); + float16_t a2 = float16_t(a); + float16_t b2 = float16_t(b); + float16_t c2 = float16_t(c); + float16_t d2 = float16_t(d); + float16_t e2 = float16_t(e); +} + +void test_builtins() +{ + f16vec4 res; + res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = atan(v4, v3.xyzz); + res = atan(v4); + res = sinh(v4); + res = cosh(v4); + res = tanh(v4); + //res = asinh(v4); + //res = acosh(v4); + //res = atanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = inversesqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + //res = roundEven(v4); + res = ceil(v4); + res = fract(v4); + res = mod(v4, v4); + f16vec4 tmp; + res = modf(v4, tmp); + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = mix(v4, v4, v4); + res = mix(v4, v4, lessThan(v4, v4)); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + + bvec4 btmp = isnan(v4); + btmp = isinf(v4); + res = fma(v4, v4, v4); + + //ivec4 itmp; + //res = frexp(v4, itmp); + //res = ldexp(res, itmp); + + uint pack0 = packFloat2x16(v4.xy); + uint pack1 = packFloat2x16(v4.zw); + res = f16vec4(unpackFloat2x16(pack0), unpackFloat2x16(pack1)); + + float16_t t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + f16vec3 res3 = cross(v3, v3); + res = normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + + btmp = lessThan(v4, v4); + btmp = lessThanEqual(v4, v4); + btmp = greaterThan(v4, v4); + btmp = greaterThanEqual(v4, v4); + btmp = equal(v4, v4); + btmp = notEqual(v4, v4); + + res = dFdx(v4); + res = dFdy(v4); + res = dFdxFine(v4); + res = dFdyFine(v4); + res = dFdxCoarse(v4); + res = dFdyCoarse(v4); + res = fwidth(v4); + res = fwidthFine(v4); + res = fwidthCoarse(v4); + + //res = interpolateAtCentroid(v4); + //res = interpolateAtSample(v4, 0); + //res = interpolateAtOffset(v4, f16vec2(0.1hf)); +} + +void main() +{ + // Basic matrix tests. +#if 0 + f16mat2 m0 = test_mat2(v2, v2, v3.xy, v3.xy); + f16mat3 m1 = test_mat3(v3, v3, v3, v4.xyz, v4.xyz, v4.yzw); +#endif + + test_constants(); + test_conversions(); + test_builtins(); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/frag-coord.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/frag-coord.frag new file mode 100644 index 0000000000..e688659a6b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/frag-coord.frag @@ -0,0 +1,8 @@ +#version 450 + +layout(location = 0) out vec3 FragColor; + +void main() +{ + FragColor = gl_FragCoord.xyz / gl_FragCoord.w; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag new file mode 100644 index 0000000000..6f70c77264 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/helper-invocation.fxconly.nofxc.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(gl_HelperInvocation); + demote; + FragColor = float(helperInvocationEXT()); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag new file mode 100644 index 0000000000..92e6621fda --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/native-16bit-types.fxconly.nofxc.sm62.native-16bit.frag @@ -0,0 +1,72 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types : require + +layout(location = 0) out f16vec4 Output; +layout(location = 0) in f16vec4 Input; +layout(location = 1) out i16vec4 OutputI; +layout(location = 1) flat in i16vec4 InputI; +layout(location = 2) out u16vec4 OutputU; +layout(location = 2) flat in u16vec4 InputU; + +layout(set = 0, binding = 0) buffer Buf +{ + float16_t foo0[4]; + int16_t foo1[4]; + uint16_t foo2[4]; + + f16vec4 foo3[4]; + i16vec4 foo4[4]; + u16vec4 foo5[4]; + + f16mat2x3 foo6[4]; + layout(row_major) f16mat2x3 foo7[4]; +}; + +void main() +{ + int index = int(gl_FragCoord.x); + Output = Input + float16_t(20.0); + OutputI = InputI + int16_t(-40); + OutputU = InputU + uint16_t(20); + + // Load 16-bit scalar. + Output += foo0[index]; + OutputI += foo1[index]; + OutputU += foo2[index]; + + // Load 16-bit vector. + Output += foo3[index]; + OutputI += foo4[index]; + OutputU += foo5[index]; + + // Load 16-bit vector from ColMajor matrix. + Output += foo6[index][1].xyzz; + + // Load 16-bit vector from RowMajor matrix. + Output += foo7[index][1].xyzz; + + // Load 16-bit matrix from ColMajor. + f16mat2x3 m0 = foo6[index]; + // Load 16-bit matrix from RowMajor. + f16mat2x3 m1 = foo7[index]; + + // Store 16-bit scalar + foo0[index] = Output.x; + foo1[index] = OutputI.y; + foo2[index] = OutputU.z; + + // Store 16-bit vector + foo3[index] = Output; + foo4[index] = OutputI; + foo5[index] = OutputU; + + // Store 16-bit vector to ColMajor matrix. + foo6[index][1] = Output.xyz; + // Store 16-bit vector to RowMajor matrix. + foo7[index][1] = Output.xyz; + + // Store 16-bit matrix to ColMajor. + foo6[index] = f16mat2x3(Output.xyz, Output.wzy); + // Store 16-bit matrix to RowMajor. + foo7[index] = f16mat2x3(Output.xyz, Output.wzy); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag new file mode 100644 index 0000000000..452aa953a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/nonuniform-constructor.sm51.nonuniformresource.frag @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(location = 1) flat in int vIndex; + +layout(set = 0, binding = 0) uniform texture2D uTex[]; +layout(set = 1, binding = 0) uniform sampler Immut; + +void main() +{ + FragColor = texture(nonuniformEXT(sampler2D(uTex[vIndex], Immut)), vUV); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag new file mode 100644 index 0000000000..59079fe58b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/pixel-interlock-simple-callstack.sm51.fxconly.frag @@ -0,0 +1,31 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require +layout(pixel_interlock_ordered) in; + +layout(set = 0, binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +}; + +layout(set = 0, binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +}; + +void callee2() +{ + values1[int(gl_FragCoord.x)] += 1; +} + +void callee() +{ + values0[int(gl_FragCoord.x)] += 1; + callee2(); +} + +void main() +{ + beginInvocationInterlockARB(); + callee(); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/spec-constant.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/spec-constant.frag new file mode 100644 index 0000000000..a6c8d94e78 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/spec-constant.frag @@ -0,0 +1,80 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; +// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. + +struct Foo +{ + float elems[d + 2]; +}; + +void main() +{ + float t0 = a; + float t1 = b; + + uint c0 = uint(c); // OpIAdd with different types. + // FConvert, float-to-double. + int c1 = -c; // SNegate + int c2 = ~c; // OpNot + int c3 = c + d; // OpIAdd + int c4 = c - d; // OpISub + int c5 = c * d; // OpIMul + int c6 = c / d; // OpSDiv + uint c7 = e / f; // OpUDiv + int c8 = c % d; // OpSMod + uint c9 = e % f; // OpUMod + // TODO: OpSRem, any way to access this in GLSL? + int c10 = c >> d; // OpShiftRightArithmetic + uint c11 = e >> f; // OpShiftRightLogical + int c12 = c << d; // OpShiftLeftLogical + int c13 = c | d; // OpBitwiseOr + int c14 = c ^ d; // OpBitwiseXor + int c15 = c & d; // OpBitwiseAnd + // VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. + bool c16 = g || h; // OpLogicalOr + bool c17 = g && h; // OpLogicalAnd + bool c18 = !g; // OpLogicalNot + bool c19 = g == h; // OpLogicalEqual + bool c20 = g != h; // OpLogicalNotEqual + // OpSelect not testable atm. + bool c21 = c == d; // OpIEqual + bool c22 = c != d; // OpINotEqual + bool c23 = c < d; // OpSLessThan + bool c24 = e < f; // OpULessThan + bool c25 = c > d; // OpSGreaterThan + bool c26 = e > f; // OpUGreaterThan + bool c27 = c <= d; // OpSLessThanEqual + bool c28 = e <= f; // OpULessThanEqual + bool c29 = c >= d; // OpSGreaterThanEqual + bool c30 = e >= f; // OpUGreaterThanEqual + // OpQuantizeToF16 not testable atm. + + int c31 = c8 + c3; + + int c32 = int(e); // OpIAdd with different types. + bool c33 = bool(c); // int -> bool + bool c34 = bool(e); // uint -> bool + int c35 = int(g); // bool -> int + uint c36 = uint(g); // bool -> uint + float c37 = float(g); // bool -> float + + // Flexible sized arrays with spec constants and spec constant ops. + float vec0[c + 3][8]; + float vec1[c + 2]; + vec0[0][0] = 10.0; + vec1[0] = 20.0; + + Foo foo; + foo.elems[c] = 10.0; + FragColor = vec4(t0 + t1) + vec0[0][0] + vec1[0] + foo.elems[c]; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..b4d9509ab4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamp "uSamp" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uSamp + %18 = OpLoad %v2float %vUV + %21 = OpImageGather %v4float %14 %18 %int_1 + OpStore %FragColor %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag new file mode 100644 index 0000000000..77760522f9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/ubo-offset-out-of-order.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform UBO +{ + layout(offset = 16) mat4 m; + layout(offset = 0) vec4 v; +}; + +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = m * vColor + v; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..41da8001f4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +int uninit_int; +ivec4 uninit_vector; +mat4 uninit_matrix; + +struct Foo { int a; }; +Foo uninit_foo; + +void main() +{ + int uninit_function_int; + if (vColor.x > 10.0) + uninit_function_int = 10; + else + uninit_function_int = 20; + FragColor = vColor; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag new file mode 100644 index 0000000000..9a8d9d20b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/frag/volatile-helper-invocation.fxconly.nofxc.spv16.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(gl_HelperInvocation); + demote; + FragColor = float(gl_HelperInvocation); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-instance.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-instance.vert new file mode 100644 index 0000000000..20b686cfe5 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-instance.vert @@ -0,0 +1,7 @@ +#version 450 +#extension GL_ARB_shader_draw_parameters : require + +void main() +{ + gl_Position = vec4(gl_BaseInstanceARB); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-vertex.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-vertex.vert new file mode 100644 index 0000000000..ef486c857d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/base-vertex.vert @@ -0,0 +1,7 @@ +#version 450 +#extension GL_ARB_shader_draw_parameters : require + +void main() +{ + gl_Position = vec4(gl_BaseVertexARB); +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert new file mode 100644 index 0000000000..98c39bd5ef --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/block-io-auto-location-assignment.vert @@ -0,0 +1,31 @@ +#version 450 + +struct Bar +{ + float v[2]; + float w; +}; + +layout(location = 0) out V +{ + float a; + float b[2]; + Bar c[2]; + Bar d; +}; + +void main() +{ + a = 1.0; + b[0] = 2.0; + b[1] = 3.0; + c[0].v[0] = 4.0; + c[0].v[1] = 5.0; + c[0].w = 6.0; + c[1].v[0] = 7.0; + c[1].v[1] = 8.0; + c[1].w = 9.0; + d.v[0] = 10.0; + d.v[1] = 11.0; + d.w = 12.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert new file mode 100644 index 0000000000..0b8dbb5a91 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/empty-shader.nofxc.sm30.vert @@ -0,0 +1,5 @@ +#version 450 + +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert new file mode 100644 index 0000000000..b49480617a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/flatten-matrix-input.flatten-matrix-vertex-input.vert @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) in mat4 m4; +layout(location = 4) in mat3 m3; +layout(location = 7) in mat2 m2; +layout(location = 9) in vec4 v; + +void main() +{ + gl_Position = m4 * v; + gl_Position.xyz += m3 * v.xyz; + gl_Position.xy += m2 * v.xy; +} diff --git a/third_party/spirv-cross/shaders-hlsl-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..2c142a7810 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,26 @@ +#version 310 es + +layout(location = 0) in int Index1; +layout(location = 1) in int Index2; + +vec4 consume_constant_arrays2(const vec4 positions[4], const vec4 positions2[4]) +{ + return positions[Index1] + positions2[Index2]; +} + +vec4 consume_constant_arrays(const vec4 positions[4], const vec4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +const vec4 LUT1[] = vec4[](vec4(0.0), vec4(1.0), vec4(2.0), vec4(3.0)); + +void main() +{ + vec4 LUT2[4]; + LUT2[0] = vec4(10.0); + LUT2[1] = vec4(11.0); + LUT2[2] = vec4(12.0); + LUT2[3] = vec4(13.0); + gl_Position = consume_constant_arrays(LUT1, LUT2); +} diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp new file mode 100644 index 0000000000..6e6ced1228 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/access-chain-invalidate.asm.comp @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 7 +; Bound: 41 +; Schema: 0 + 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" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "index" + OpMemberName %SSBO 1 "array" + OpName %_ "" + OpDecorate %_arr_uint_uint_64 ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_uint_uint_64 = OpTypeArray %uint %uint_64 + %SSBO = OpTypeStruct %uint %_arr_uint_uint_64 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %19 = OpLoad %uint %18 + %20 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %19 + %21 = OpLoad %uint %20 + OpBranch %24 + %24 = OpLabel + %40 = OpPhi %uint %uint_0 %5 %35 %25 + %31 = OpULessThan %bool %40 %uint_64 + OpLoopMerge %26 %25 None + OpBranchConditional %31 %25 %26 + %25 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %40 + OpStore %33 %uint_0 + %35 = OpIAdd %uint %40 %int_1 + OpBranch %24 + %26 = OpLabel + %37 = OpLoad %uint %18 + %39 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %37 + OpStore %39 %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..f716cbb944 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 1 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIDecrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..40c1de3b9d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 1 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIIncrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..b7b4e0b2e1 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %bool = OpTypeBool + %bvec4 = OpTypeVector %bool 4 + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + %uzero = OpConstant %uint 0 + %uone = OpConstant %uint 1 + %utrue = OpConstantComposite %uvec4 %uone %uone %uone %uone + %ufalse = OpConstantComposite %uvec4 %uzero %uzero %uzero %uzero + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + + %result_slt = OpSLessThan %bvec4 %input0 %input1 + %result_sle = OpSLessThanEqual %bvec4 %input0 %input1 + %result_ult = OpULessThan %bvec4 %input0 %input1 + %result_ule = OpULessThanEqual %bvec4 %input0 %input1 + %result_sgt = OpSGreaterThan %bvec4 %input0 %input1 + %result_sge = OpSGreaterThanEqual %bvec4 %input0 %input1 + %result_ugt = OpUGreaterThan %bvec4 %input0 %input1 + %result_uge = OpUGreaterThanEqual %bvec4 %input0 %input1 + + %int_slt = OpSelect %uvec4 %result_slt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_slt + + %int_sle = OpSelect %uvec4 %result_sle %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sle + + %int_ult = OpSelect %uvec4 %result_ult %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ult + + %int_ule = OpSelect %uvec4 %result_ule %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ule + + %int_sgt = OpSelect %uvec4 %result_sgt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sgt + + %int_sge = OpSelect %uvec4 %result_sge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sge + + %int_ugt = OpSelect %uvec4 %result_ugt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ugt + + %int_uge = OpSelect %uvec4 %result_uge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_uge + + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..85f6cc0414 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 59 +; Schema: 0 + 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 %Foo "A" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpName %A "A" + OpMemberName %A 0 "Data" + OpName %C1 "C1" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %Foo_0 "A" + OpMemberName %Foo_0 0 "a" + OpMemberName %Foo_0 1 "b" + OpName %A_0 "A" + OpMemberName %A_0 0 "Data" + OpName %C2 "C2" + OpName %B "B" + OpMemberName %B 0 "Data" + OpName %C3 "C3" + OpName %B_0 "B" + OpMemberName %B_0 0 "Data" + OpName %C4 "C4" + OpMemberDecorate %Foo 0 Offset 0 + OpMemberDecorate %Foo 1 Offset 4 + OpDecorate %_runtimearr_Foo ArrayStride 8 + OpMemberDecorate %A 0 Offset 0 + OpDecorate %A BufferBlock + OpDecorate %C1 DescriptorSet 0 + OpDecorate %C1 Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Foo_0 1 Offset 4 + OpDecorate %_arr_Foo_0_uint_1024 ArrayStride 16 + OpMemberDecorate %A_0 0 Offset 0 + OpDecorate %A_0 Block + OpDecorate %C2 DescriptorSet 0 + OpDecorate %C2 Binding 2 + OpDecorate %_runtimearr_Foo_0 ArrayStride 8 + OpMemberDecorate %B 0 Offset 0 + OpDecorate %B BufferBlock + OpDecorate %C3 DescriptorSet 0 + OpDecorate %C3 Binding 0 + OpDecorate %_arr_Foo_0_uint_1024_0 ArrayStride 16 + OpMemberDecorate %B_0 0 Offset 0 + OpDecorate %B_0 Block + OpDecorate %C4 DescriptorSet 0 + OpDecorate %C4 Binding 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %Foo = OpTypeStruct %int %int +%_runtimearr_Foo = OpTypeRuntimeArray %Foo + %A = OpTypeStruct %_runtimearr_Foo +%_ptr_Uniform_A = OpTypePointer Uniform %A + %C1 = OpVariable %_ptr_Uniform_A Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %Foo_0 = OpTypeStruct %int %int + %uint_1024 = OpConstant %uint 1024 +%_arr_Foo_0_uint_1024 = OpTypeArray %Foo_0 %uint_1024 + %A_0 = OpTypeStruct %_arr_Foo_0_uint_1024 +%_ptr_Uniform_A_0 = OpTypePointer Uniform %A_0 + %C2 = OpVariable %_ptr_Uniform_A_0 Uniform +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_runtimearr_Foo_0 = OpTypeRuntimeArray %Foo + %B = OpTypeStruct %_runtimearr_Foo_0 +%_ptr_Uniform_B = OpTypePointer Uniform %B + %C3 = OpVariable %_ptr_Uniform_B Uniform +%_arr_Foo_0_uint_1024_0 = OpTypeArray %Foo_0 %uint_1024 + %B_0 = OpTypeStruct %_arr_Foo_0_uint_1024_0 +%_ptr_Uniform_B_0 = OpTypePointer Uniform %B_0 + %C4 = OpVariable %_ptr_Uniform_B_0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_Uniform_Foo_0 %C2 %int_0 %28 + %31 = OpLoad %Foo_0 %30 + %33 = OpAccessChain %_ptr_Uniform_Foo %C1 %int_0 %20 + %34 = OpCompositeExtract %int %31 0 + %36 = OpAccessChain %_ptr_Uniform_int %33 %int_0 + OpStore %36 %34 + %37 = OpCompositeExtract %int %31 1 + %39 = OpAccessChain %_ptr_Uniform_int %33 %int_1 + OpStore %39 %37 + %44 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %50 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %51 = OpLoad %uint %50 + %52 = OpAccessChain %_ptr_Uniform_Foo_0 %C4 %int_0 %51 + %53 = OpLoad %Foo_0 %52 + %54 = OpAccessChain %_ptr_Uniform_Foo %C3 %int_0 %45 + %55 = OpCompositeExtract %int %53 0 + %56 = OpAccessChain %_ptr_Uniform_int %54 %int_0 + OpStore %56 %55 + %57 = OpCompositeExtract %int %53 1 + %58 = OpAccessChain %_ptr_Uniform_int %54 %int_1 + OpStore %58 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..74a15955c2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %i "i" + OpName %bar "bar" + OpMemberName %bar 0 "@data" + OpName %bar_0 "bar" + OpName %foo "foo" + OpName %i_0 "i" + OpName %v "v" + OpName %w "w" + OpName %value "value" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %bar 0 Offset 0 + OpDecorate %bar BufferBlock + OpDecorate %bar_0 DescriptorSet 0 + OpDecorate %bar_0 Binding 0 + OpDecorate %foo DescriptorSet 0 + OpDecorate %foo Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %bar = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_bar = OpTypePointer Uniform %bar + %bar_0 = OpVariable %_ptr_Uniform_bar Uniform + %foo = OpVariable %_ptr_Uniform_bar Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %int_15 = OpConstant %int 15 +%_ptr_Function_float = OpTypePointer Function %float + %int_10 = OpConstant %int 10 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_10 = OpConstant %float 10 + %int_20 = OpConstant %int 20 + %float_5 = OpConstant %float 5 + %72 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %float_20 = OpConstant %float 20 + %float_40 = OpConstant %float 40 + %main = OpFunction %void None %3 + %5 = OpLabel + %84 = OpFunctionCall %void %_main_ + OpReturn + OpFunctionEnd + %_main_ = OpFunction %void None %3 + %7 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_float Function + %w = OpVariable %_ptr_Function_float Function + %value = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 Unroll + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %int %i + %20 = OpSLessThan %bool %17 %int_16 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %27 = OpLoad %int %i + %29 = OpLoad %int %i + %31 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %29 + %32 = OpLoad %v4float %31 + %33 = OpAccessChain %_ptr_Uniform_v4float %bar_0 %int_0 %27 + OpStore %33 %32 + OpBranch %15 + %15 = OpLabel + %34 = OpLoad %int %i + %36 = OpIAdd %int %34 %int_1 + OpStore %i %36 + OpBranch %12 + %14 = OpLabel + OpStore %i_0 %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 DontUnroll + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i_0 + %44 = OpSLessThan %bool %43 %int_16 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + %46 = OpLoad %int %i_0 + %47 = OpISub %int %int_15 %46 + %48 = OpLoad %int %i_0 + %49 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %48 + %50 = OpLoad %v4float %49 + %51 = OpAccessChain %_ptr_Uniform_v4float %bar_0 %int_0 %47 + OpStore %51 %50 + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %int %i_0 + %53 = OpIAdd %int %52 %int_1 + OpStore %i_0 %53 + OpBranch %38 + %40 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %bar_0 %int_0 %int_10 %uint_0 + %61 = OpLoad %float %60 + OpStore %v %61 + %63 = OpAccessChain %_ptr_Uniform_float %foo %int_0 %int_10 %uint_0 + %64 = OpLoad %float %63 + OpStore %w %64 + %65 = OpLoad %float %v + %67 = OpFOrdGreaterThan %bool %65 %float_10 + OpSelectionMerge %69 DontFlatten + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %int_20 + OpStore %73 %72 + OpBranch %69 + %69 = OpLabel + OpStore %value %float_20 + %76 = OpLoad %float %w + %78 = OpFOrdGreaterThan %bool %76 %float_40 + OpSelectionMerge %80 Flatten + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpStore %value %float_20 + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %float %value + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %int_20 + OpStore %83 %82 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..78b1dc74e8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %id_1 + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %Load_u1_ "Load(u1;" + OpName %size "size" + OpName %_main_vu3_ "@main(vu3;" + OpName %id "id" + OpName %data "data" + OpName %byteAddrTemp "byteAddrTemp" + OpName %ssbo "ssbo" + OpMemberName %ssbo 0 "@data" + OpName %ssbo_0 "ssbo" + OpName %param "param" + OpName %id_0 "id" + OpName %id_1 "id" + OpName %param_0 "param" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %ssbo 0 NonWritable + OpMemberDecorate %ssbo 0 Offset 0 + OpDecorate %ssbo BufferBlock + OpDecorate %ssbo_0 DescriptorSet 0 + OpDecorate %ssbo_0 Binding 1 + OpDecorate %id_1 BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %8 = OpTypeFunction %void %_ptr_Function_uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %14 = OpTypeFunction %void %_ptr_Function_v3uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %ssbo = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo + %ssbo_0 = OpVariable %_ptr_Uniform_ssbo Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %id_1 = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %id_0 = OpVariable %_ptr_Function_v3uint Function + %param_0 = OpVariable %_ptr_Function_v3uint Function + %57 = OpLoad %v3uint %id_1 + OpStore %id_0 %57 + %59 = OpLoad %v3uint %id_0 + OpStore %param_0 %59 + %60 = OpFunctionCall %void %_main_vu3_ %param_0 + OpReturn + OpFunctionEnd + %Load_u1_ = OpFunction %void None %8 + %size = OpFunctionParameter %_ptr_Function_uint + %11 = OpLabel + %data = OpVariable %_ptr_Function_v4uint Function +%byteAddrTemp = OpVariable %_ptr_Function_int Function + %24 = OpLoad %uint %size + %26 = OpShiftRightLogical %int %24 %int_2 + OpStore %byteAddrTemp %26 + %32 = OpLoad %int %byteAddrTemp + %34 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %32 + %35 = OpLoad %uint %34 + %36 = OpLoad %int %byteAddrTemp + %38 = OpIAdd %int %36 %int_1 + %39 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpLoad %int %byteAddrTemp + %42 = OpIAdd %int %41 %int_2 + %43 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %42 + %44 = OpLoad %uint %43 + %45 = OpLoad %int %byteAddrTemp + %47 = OpIAdd %int %45 %int_3 + %48 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %47 + %49 = OpLoad %uint %48 + %50 = OpCompositeConstruct %v4uint %35 %40 %44 %49 + OpStore %data %50 + OpReturn + OpFunctionEnd + %_main_vu3_ = OpFunction %void None %14 + %id = OpFunctionParameter %_ptr_Function_v3uint + %17 = OpLabel + %param = OpVariable %_ptr_Function_uint Function + OpStore %param %uint_4 + %53 = OpFunctionCall %void %Load_u1_ %param + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..6c060eedad --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a1" + OpMemberName %SSBO 1 "a2" + OpMemberName %SSBO 2 "a3" + OpMemberName %SSBO 3 "a4" + OpMemberName %SSBO 4 "b1" + OpMemberName %SSBO 5 "b2" + OpMemberName %SSBO 6 "b3" + OpMemberName %SSBO 7 "b4" + OpMemberName %SSBO 8 "c1" + OpMemberName %SSBO 9 "c2" + OpMemberName %SSBO 10 "c3" + OpMemberName %SSBO 11 "c4" + OpName %_ "" + OpName %i "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 8 + OpMemberDecorate %SSBO 2 Offset 16 + OpMemberDecorate %SSBO 3 Offset 32 + OpMemberDecorate %SSBO 4 Offset 48 + OpMemberDecorate %SSBO 5 Offset 56 + OpMemberDecorate %SSBO 6 Offset 64 + OpMemberDecorate %SSBO 7 Offset 80 + OpMemberDecorate %SSBO 8 Offset 96 + OpMemberDecorate %SSBO 9 Offset 104 + OpMemberDecorate %SSBO 10 Offset 112 + OpMemberDecorate %SSBO 11 Offset 128 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %SSBO = OpTypeStruct %float %v2float %v3float %v4float %float %v2float %v3float %v4float %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_7 = OpConstant %int 7 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_11 = OpConstant %int 11 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %7 + %35 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %39 = OpLoad %float %38 + %40 = OpExtInst %float %1 NMin %37 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %43 = OpLoad %v2float %42 + %44 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %45 = OpLoad %v2float %44 + %46 = OpExtInst %v2float %1 NMin %43 %45 + %47 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %47 %46 + %48 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %49 = OpLoad %v3float %48 + %50 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %51 = OpLoad %v3float %50 + %52 = OpExtInst %v3float %1 NMin %49 %51 + %53 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %53 %52 + %54 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %55 = OpLoad %v4float %54 + %56 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %57 = OpLoad %v4float %56 + %58 = OpExtInst %v4float %1 NMin %55 %57 + %59 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %63 = OpLoad %float %62 + %64 = OpExtInst %float %1 NMax %61 %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %65 %64 + %66 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %67 = OpLoad %v2float %66 + %68 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %69 = OpLoad %v2float %68 + %70 = OpExtInst %v2float %1 NMax %67 %69 + %71 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %71 %70 + %72 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %73 = OpLoad %v3float %72 + %74 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %75 = OpLoad %v3float %74 + %76 = OpExtInst %v3float %1 NMax %73 %75 + %77 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %77 %76 + %78 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %79 = OpLoad %v4float %78 + %80 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %81 = OpLoad %v4float %80 + %82 = OpExtInst %v4float %1 NMax %79 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %83 %82 + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %89 = OpLoad %float %88 + %90 = OpExtInst %float %1 NClamp %85 %87 %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %91 %90 + %92 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + %93 = OpLoad %v2float %92 + %94 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %95 = OpLoad %v2float %94 + %96 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %97 = OpLoad %v2float %96 + %98 = OpExtInst %v2float %1 NClamp %93 %95 %97 + %99 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %99 %98 + %100 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %101 = OpLoad %v3float %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %103 = OpLoad %v3float %102 + %104 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %105 = OpLoad %v3float %104 + %106 = OpExtInst %v3float %1 NClamp %101 %103 %105 + %107 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + %109 = OpLoad %v4float %108 + %110 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %111 = OpLoad %v4float %110 + %112 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %113 = OpLoad %v4float %112 + %114 = OpExtInst %v4float %1 NClamp %109 %111 %113 + %115 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %115 %114 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %121 = OpSLessThan %bool %120 %int_2 + OpBranchConditional %121 %122 %117 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %124 = OpLoad %v2float %123 + %125 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %126 = OpLoad %v2float %125 + %127 = OpExtInst %v2float %1 NMin %124 %126 + %128 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %128 %127 + OpBranch %118 + %118 = OpLabel + %129 = OpLoad %int %i + %130 = OpIAdd %int %129 %int_1 + OpStore %i %130 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %132 = OpLoad %float %131 + %133 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_1 + %136 = OpLoad %float %135 + %137 = OpExtInst %float %1 NClamp %132 %134 %136 + %138 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %138 %137 + OpBranch %116 + %117 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..6c060eedad --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a1" + OpMemberName %SSBO 1 "a2" + OpMemberName %SSBO 2 "a3" + OpMemberName %SSBO 3 "a4" + OpMemberName %SSBO 4 "b1" + OpMemberName %SSBO 5 "b2" + OpMemberName %SSBO 6 "b3" + OpMemberName %SSBO 7 "b4" + OpMemberName %SSBO 8 "c1" + OpMemberName %SSBO 9 "c2" + OpMemberName %SSBO 10 "c3" + OpMemberName %SSBO 11 "c4" + OpName %_ "" + OpName %i "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 8 + OpMemberDecorate %SSBO 2 Offset 16 + OpMemberDecorate %SSBO 3 Offset 32 + OpMemberDecorate %SSBO 4 Offset 48 + OpMemberDecorate %SSBO 5 Offset 56 + OpMemberDecorate %SSBO 6 Offset 64 + OpMemberDecorate %SSBO 7 Offset 80 + OpMemberDecorate %SSBO 8 Offset 96 + OpMemberDecorate %SSBO 9 Offset 104 + OpMemberDecorate %SSBO 10 Offset 112 + OpMemberDecorate %SSBO 11 Offset 128 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %SSBO = OpTypeStruct %float %v2float %v3float %v4float %float %v2float %v3float %v4float %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_7 = OpConstant %int 7 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_11 = OpConstant %int 11 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %7 + %35 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %39 = OpLoad %float %38 + %40 = OpExtInst %float %1 NMin %37 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %43 = OpLoad %v2float %42 + %44 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %45 = OpLoad %v2float %44 + %46 = OpExtInst %v2float %1 NMin %43 %45 + %47 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %47 %46 + %48 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %49 = OpLoad %v3float %48 + %50 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %51 = OpLoad %v3float %50 + %52 = OpExtInst %v3float %1 NMin %49 %51 + %53 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %53 %52 + %54 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %55 = OpLoad %v4float %54 + %56 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %57 = OpLoad %v4float %56 + %58 = OpExtInst %v4float %1 NMin %55 %57 + %59 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %63 = OpLoad %float %62 + %64 = OpExtInst %float %1 NMax %61 %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %65 %64 + %66 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %67 = OpLoad %v2float %66 + %68 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %69 = OpLoad %v2float %68 + %70 = OpExtInst %v2float %1 NMax %67 %69 + %71 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %71 %70 + %72 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %73 = OpLoad %v3float %72 + %74 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %75 = OpLoad %v3float %74 + %76 = OpExtInst %v3float %1 NMax %73 %75 + %77 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %77 %76 + %78 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %79 = OpLoad %v4float %78 + %80 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %81 = OpLoad %v4float %80 + %82 = OpExtInst %v4float %1 NMax %79 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %83 %82 + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %89 = OpLoad %float %88 + %90 = OpExtInst %float %1 NClamp %85 %87 %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %91 %90 + %92 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + %93 = OpLoad %v2float %92 + %94 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %95 = OpLoad %v2float %94 + %96 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %97 = OpLoad %v2float %96 + %98 = OpExtInst %v2float %1 NClamp %93 %95 %97 + %99 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %99 %98 + %100 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %101 = OpLoad %v3float %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %103 = OpLoad %v3float %102 + %104 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %105 = OpLoad %v3float %104 + %106 = OpExtInst %v3float %1 NClamp %101 %103 %105 + %107 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + %109 = OpLoad %v4float %108 + %110 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %111 = OpLoad %v4float %110 + %112 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %113 = OpLoad %v4float %112 + %114 = OpExtInst %v4float %1 NClamp %109 %111 %113 + %115 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %115 %114 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %121 = OpSLessThan %bool %120 %int_2 + OpBranchConditional %121 %122 %117 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %124 = OpLoad %v2float %123 + %125 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %126 = OpLoad %v2float %125 + %127 = OpExtInst %v2float %1 NMin %124 %126 + %128 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %128 %127 + OpBranch %118 + %118 = OpLabel + %129 = OpLoad %int %i + %130 = OpIAdd %int %129 %int_1 + OpStore %i %130 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %132 = OpLoad %float %131 + %133 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_1 + %136 = OpLoad %float %135 + %137 = OpExtInst %float %1 NClamp %132 %134 %136 + %138 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %138 %137 + OpBranch %116 + %117 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag new file mode 100644 index 0000000000..bc83abf5c7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 660 + OpName %type_StructuredBuffer_Data "type.StructuredBuffer.Data" + OpName %Data "Data" + OpMemberName %Data 0 "Color" + OpName %Colors "Colors" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorateString %out_var_SV_Target UserSemantic "SV_Target" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Colors DescriptorSet 0 + OpDecorate %Colors Binding 0 + OpMemberDecorate %Data 0 Offset 0 + OpDecorate %_runtimearr_Data ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_Data 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_Data 0 NonWritable + OpDecorate %type_StructuredBuffer_Data BufferBlock + OpDecorateString %Colors UserTypeGOOGLE "structuredbuffer:" + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %uint_2 = OpConstant %uint 2 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Data = OpTypeStruct %v4float +%_runtimearr_Data = OpTypeRuntimeArray %Data +%type_StructuredBuffer_Data = OpTypeStruct %_runtimearr_Data +%_arr_type_StructuredBuffer_Data_uint_2 = OpTypeArray %type_StructuredBuffer_Data %uint_2 +%_ptr_Uniform__arr_type_StructuredBuffer_Data_uint_2 = OpTypePointer Uniform %_arr_type_StructuredBuffer_Data_uint_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %Colors = OpVariable %_ptr_Uniform__arr_type_StructuredBuffer_Data_uint_2 Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %20 + %22 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_v4float %Colors %int_1 %int_0 %uint_3 %int_0 + %24 = OpLoad %v4float %23 + OpStore %out_var_SV_Target %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag new file mode 100644 index 0000000000..d778034b5f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/cbuffer-stripped.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpMemberDecorate %UBO 0 RowMajor + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 0 MatrixStride 16 + OpMemberDecorate %UBO 1 Offset 64 + OpDecorate %UBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %8 = OpTypeFunction %v2float +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%mat2v4float = OpTypeMatrix %v4float 2 + %UBO = OpTypeStruct %mat2v4float %v4float +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %_ = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_0 = OpConstant %int 0 +%_ptr_Uniform_mat2v4float = OpTypePointer Uniform %mat2v4float +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_entryPointOutput = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %33 = OpFunctionCall %v2float %_main_ + OpStore %_entryPointOutput %33 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v2float None %8 + %10 = OpLabel + %a0 = OpVariable %_ptr_Function_v2float Function + %21 = OpAccessChain %_ptr_Uniform_v4float %_ %int_1 + %22 = OpLoad %v4float %21 + %25 = OpAccessChain %_ptr_Uniform_mat2v4float %_ %int_0 + %26 = OpLoad %mat2v4float %25 + %27 = OpVectorTimesMatrix %v2float %22 %26 + OpStore %a0 %27 + %28 = OpLoad %v2float %a0 + OpReturnValue %28 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..ba2f95b234 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTex "uTex" + OpName %uSampler "uSampler" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uTex DescriptorSet 0 + OpDecorate %uTex Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %uTex = OpVariable %_ptr_UniformConstant_10 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %uSampler = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeSampledImage %10 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v2int %int_1 %int_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %10 %uTex + %17 = OpLoad %14 %uSampler + %19 = OpSampledImage %18 %13 %17 + %23 = OpLoad %v2float %vUV + %24 = OpImageSampleImplicitLod %v4float %19 %23 + OpStore %FragColor %24 + %28 = OpLoad %v2float %vUV + %33 = OpImageSampleImplicitLod %v4float %19 %28 ConstOffset %32 + %34 = OpLoad %v4float %FragColor + %35 = OpFAdd %v4float %34 %33 + OpStore %FragColor %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..0efd3158cb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%_ptr_Function_EmptyStructTest = OpTypePointer Function %EmptyStructTest + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStructTest + %6 = OpTypeFunction %float %EmptyStructTest + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStructTest + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStructTest + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStructTest + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStructTest Function + %18 = OpVariable %_ptr_Function_EmptyStructTest Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value2 + OpStore %value %22 + OpStore %value %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/frem.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..8350c75c04 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/frem.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 16 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Location 1 + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vA = OpVariable %_ptr_Input_v4float Input + %vB = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %vA + %14 = OpLoad %v4float %vB + %15 = OpFRem %v4float %12 %14 + OpStore %FragColor %15 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..397aa98ce2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,153 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %foobar_vf4_ "foo" + OpName %a "foo" + OpName %foobar_vf3_ "foo" + OpName %a_0 "foo" + OpName %foobaz_vf4_ "foo" + OpName %a_1 "foo" + OpName %foobaz_vf2_ "foo" + OpName %a_2 "foo" + OpName %a_3 "foo" + OpName %param "foo" + OpName %b "foo" + OpName %param_0 "foo" + OpName %c "foo" + OpName %param_1 "foo" + OpName %d "foo" + OpName %param_2 "foo" + OpName %FragColor "FragColor" + OpDecorate %foobar_vf4_ RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %foobar_vf3_ RelaxedPrecision + OpDecorate %a_0 RelaxedPrecision + OpDecorate %foobaz_vf4_ RelaxedPrecision + OpDecorate %a_1 RelaxedPrecision + OpDecorate %foobaz_vf2_ RelaxedPrecision + OpDecorate %a_2 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %a_3 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %9 = OpTypeFunction %v4float %_ptr_Function_v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %15 = OpTypeFunction %v4float %_ptr_Function_v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpTypeFunction %v4float %_ptr_Function_v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %57 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %64 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_3 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_v4float Function + %param_0 = OpVariable %_ptr_Function_v3float Function + %c = OpVariable %_ptr_Function_v4float Function + %param_1 = OpVariable %_ptr_Function_v4float Function + %d = OpVariable %_ptr_Function_v4float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + OpStore %param %53 + %55 = OpFunctionCall %v4float %foobar_vf4_ %param + OpStore %a_3 %55 + OpStore %param_0 %57 + %59 = OpFunctionCall %v4float %foobar_vf3_ %param_0 + OpStore %b %59 + OpStore %param_1 %53 + %62 = OpFunctionCall %v4float %foobaz_vf4_ %param_1 + OpStore %c %62 + OpStore %param_2 %64 + %66 = OpFunctionCall %v4float %foobaz_vf2_ %param_2 + OpStore %d %66 + %69 = OpLoad %v4float %a_3 + %70 = OpLoad %v4float %b + %71 = OpFAdd %v4float %69 %70 + %72 = OpLoad %v4float %c + %73 = OpFAdd %v4float %71 %72 + %74 = OpLoad %v4float %d + %75 = OpFAdd %v4float %73 %74 + OpStore %FragColor %75 + OpReturn + OpFunctionEnd +%foobar_vf4_ = OpFunction %v4float None %9 + %a = OpFunctionParameter %_ptr_Function_v4float + %12 = OpLabel + %28 = OpLoad %v4float %a + %30 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %31 = OpFAdd %v4float %28 %30 + OpReturnValue %31 + OpFunctionEnd +%foobar_vf3_ = OpFunction %v4float None %15 + %a_0 = OpFunctionParameter %_ptr_Function_v3float + %18 = OpLabel + %34 = OpLoad %v3float %a_0 + %35 = OpVectorShuffle %v4float %34 %34 0 1 2 2 + %36 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %37 = OpFAdd %v4float %35 %36 + OpReturnValue %37 + OpFunctionEnd +%foobaz_vf4_ = OpFunction %v4float None %9 + %a_1 = OpFunctionParameter %_ptr_Function_v4float + %21 = OpLabel + %40 = OpLoad %v4float %a_1 + %42 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %43 = OpFAdd %v4float %40 %42 + OpReturnValue %43 + OpFunctionEnd +%foobaz_vf2_ = OpFunction %v4float None %24 + %a_2 = OpFunctionParameter %_ptr_Function_v2float + %27 = OpLabel + %46 = OpLoad %v2float %a_2 + %47 = OpVectorShuffle %v4float %46 %46 0 1 0 1 + %48 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %49 = OpFAdd %v4float %47 %48 + OpReturnValue %49 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..63c8ab57a5 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %Size + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %Size "Size" + OpName %uTexture "uTexture" + OpDecorate %Size Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Output_v2int = OpTypePointer Output %v2int + %Size = OpVariable %_ptr_Output_v2int Output + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %17 = OpImage %11 %15 + %18 = OpImageQuerySizeLod %v2int %17 %int_0 + %19 = OpImageQuerySizeLod %v2int %17 %int_1 + %20 = OpIAdd %v2int %18 %19 + OpStore %Size %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..ccdfeef58d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v0 %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %phi "phi" + OpName %i "i" + OpName %v0 "v0" + OpName %FragColor "FragColor" + OpName %uImage "uImage" + OpDecorate %v0 Location 0 + OpDecorate %FragColor Location 0 + OpDecorate %uImage DescriptorSet 0 + OpDecorate %uImage Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %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 + %v0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %36 = OpTypeImage %float 2D 0 0 0 1 Unknown + %37 = OpTypeSampledImage %36 +%_ptr_UniformConstant_37 = OpTypePointer UniformConstant %37 + %uImage = OpVariable %_ptr_UniformConstant_37 UniformConstant + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_2 = OpConstant %float 2 + %int_1 = OpConstant %int 1 + %float_1_vec = OpConstantComposite %v4float %float_1 %float_2 %float_1 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %loop_header + %loop_header = OpLabel + %phi = OpPhi %float %float_1 %5 %phi_plus_2 %continue_block + %tex_phi = OpPhi %v4float %float_1_vec %5 %texture_load_result %continue_block + OpLoopMerge %merge_block %continue_block None + OpBranch %loop_body + %loop_body = OpLabel + OpStore %FragColor %tex_phi + %19 = OpLoad %int %i + %22 = OpSLessThan %bool %19 %int_4 + OpBranchConditional %22 %15 %merge_block + %15 = OpLabel + %26 = OpLoad %int %i + %28 = OpAccessChain %_ptr_Input_float %v0 %26 + %29 = OpLoad %float %28 + %31 = OpFOrdGreaterThan %bool %29 %float_0 + OpBranchConditional %31 %continue_block %merge_block + %continue_block = OpLabel + %40 = OpLoad %37 %uImage + %43 = OpCompositeConstruct %v2float %phi %phi + %texture_load_result = OpImageSampleExplicitLod %v4float %40 %43 Lod %float_0 + %phi_plus_2 = OpFAdd %float %phi %float_2 + %54 = OpLoad %int %i + %56 = OpIAdd %int %54 %int_1 + OpStore %i %56 + OpBranch %loop_header + %merge_block = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..40e5d3a89c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 14 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %FragColor = OpVariable %_ptr_Output_v3float Output +%float_0x1p_128 = OpConstant %float 0x1p+128 +%float_n0x1p_128 = OpConstant %float -0x1p+128 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %13 = OpConstantComposite %v3float %float_0x1p_128 %float_n0x1p_128 %float_0x1_8p_128 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %13 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..9e08e9a891 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 7 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vColor + OpExecutionMode %main OriginUpperLeft + %1 = OpString "test.frag" + OpSource GLSL 450 %1 "// OpModuleProcessed entry-point main +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed entry-point main +#line 1 +#version 450 + +layout(location = 0) in float vColor; +layout(location = 0) out float FragColor; + +void func() +{ + FragColor = 1.0; + FragColor = 2.0; + if (vColor < 0.0) + { + FragColor = 3.0; + } + else + { + FragColor = 4.0; + } + + for (int i = 0; i < 40 + vColor; i += int(vColor) + 5) + { + FragColor += 0.2; + FragColor += 0.3; + } + + switch (int(vColor)) + { + case 0: + FragColor += 0.2; + break; + + case 1: + FragColor += 0.4; + break; + + default: + FragColor += 0.8; + break; + } + + do + { + FragColor += 10.0 + vColor; + } while(FragColor < 100.0); +} + +void main() +{ + func(); +} +" + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %func_ "func(" + OpName %FragColor "FragColor" + OpName %vColor "vColor" + OpName %i "i" + OpDecorate %FragColor Location 0 + OpDecorate %vColor Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 +%_ptr_Input_float = OpTypePointer Input %float + %vColor = OpVariable %_ptr_Input_float Input + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int = OpTypeInt 32 1 + + ; Should be ignored + OpLine %1 5 0 + +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float_40 = OpConstant %float 40 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %int_5 = OpConstant %int 5 + + ; Should be ignored + OpLine %1 5 0 + +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_800000012 = OpConstant %float 0.800000012 + %float_10 = OpConstant %float 10 + %float_100 = OpConstant %float 100 + %main = OpFunction %void None %4 + OpLine %1 46 0 + %6 = OpLabel + OpLine %1 48 0 + %82 = OpFunctionCall %void %func_ + OpReturn + OpFunctionEnd + + ; Should be ignored + OpLine %1 5 0 + + %func_ = OpFunction %void None %4 + OpLine %1 6 0 + %8 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpLine %1 8 0 + OpStore %FragColor %float_1 + OpLine %1 9 0 + OpStore %FragColor %float_2 + OpLine %1 10 0 + %16 = OpLoad %float %vColor + %19 = OpFOrdLessThan %bool %16 %float_0 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %23 + %20 = OpLabel + OpLine %1 12 0 + OpStore %FragColor %float_3 + OpBranch %21 + %23 = OpLabel + OpLine %1 16 0 + OpStore %FragColor %float_4 + OpBranch %21 + %21 = OpLabel + OpLine %1 19 0 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpConvertSToF %float %34 + %37 = OpLoad %float %vColor + %38 = OpFAdd %float %float_40 %37 + %39 = OpFOrdLessThan %bool %35 %38 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + OpLine %1 21 0 + %41 = OpLoad %float %FragColor + %42 = OpFAdd %float %41 %float_0_200000003 + OpStore %FragColor %42 + OpLine %1 22 0 + %44 = OpLoad %float %FragColor + %45 = OpFAdd %float %44 %float_0_300000012 + OpStore %FragColor %45 + OpBranch %32 + %32 = OpLabel + OpLine %1 19 0 + %46 = OpLoad %float %vColor + %47 = OpConvertFToS %int %46 + %49 = OpIAdd %int %47 %int_5 + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %49 + OpStore %i %51 + OpBranch %29 + %31 = OpLabel + OpLine %1 25 0 + %52 = OpLoad %float %vColor + %53 = OpConvertFToS %int %52 + OpSelectionMerge %57 None + OpSwitch %53 %56 0 %54 1 %55 + %56 = OpLabel + OpLine %1 36 0 + %66 = OpLoad %float %FragColor + %67 = OpFAdd %float %66 %float_0_800000012 + OpStore %FragColor %67 + OpLine %1 37 0 + OpBranch %57 + %54 = OpLabel + OpLine %1 28 0 + %58 = OpLoad %float %FragColor + %59 = OpFAdd %float %58 %float_0_200000003 + OpStore %FragColor %59 + OpLine %1 29 0 + OpBranch %57 + %55 = OpLabel + OpLine %1 32 0 + %62 = OpLoad %float %FragColor + %63 = OpFAdd %float %62 %float_0_400000006 + OpStore %FragColor %63 + OpLine %1 33 0 + OpBranch %57 + %57 = OpLabel + OpBranch %70 + OpLine %1 43 0 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %71 + %71 = OpLabel + OpLine %1 42 0 + %75 = OpLoad %float %vColor + %76 = OpFAdd %float %float_10 %75 + %77 = OpLoad %float %FragColor + %78 = OpFAdd %float %77 %76 + OpStore %FragColor %78 + OpBranch %73 + %73 = OpLabel + OpLine %1 43 0 + %79 = OpLoad %float %FragColor + %81 = OpFOrdLessThan %bool %79 %float_100 + OpBranchConditional %81 %70 %72 + %72 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..320e5ebfbd --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,195 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %index + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %index "index" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %foo "foo" + OpName %foobar "foobar" + OpName %baz "baz" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %index RelaxedPrecision + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %foo RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %foobar RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %baz RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_float_uint_16 = OpTypeArray %float %uint_16 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %_arr_float_uint_16 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input +%_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16 +%_ptr_Function_float = OpTypePointer Function %float + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 + %float_0 = OpConstant %float 0 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %55 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_8 = OpConstant %float 8 + %57 = OpConstantComposite %v4float %float_8 %float_8 %float_8 %float_8 + %float_5 = OpConstant %float 5 + %59 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %60 = OpConstantComposite %_arr_v4float_uint_4 %54 %55 %57 %59 + %int_30 = OpConstant %int 30 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %float_20 = OpConstant %float 20 + %uint_2 = OpConstant %uint 2 + %97 = OpConstantComposite %v4float %float_20 %float_20 %float_20 %float_20 + %float_30 = OpConstant %float 30 + %99 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 + %float_50 = OpConstant %float 50 + %101 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50 + %float_60 = OpConstant %float 60 + %103 = OpConstantComposite %v4float %float_60 %float_60 %float_60 %float_60 + %104 = OpConstantComposite %_arr_v4float_uint_4 %97 %99 %101 %103 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_0 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_1 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 + %foo = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %foobar = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %baz = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %20 = OpLoad %int %index + %24 = OpAccessChain %_ptr_Function_float %indexable %20 + %25 = OpLoad %float %24 + OpStore %FragColor %25 + %26 = OpLoad %int %index + %29 = OpSLessThan %bool %26 %int_10 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %40 + %30 = OpLabel + %32 = OpLoad %int %index + %34 = OpBitwiseXor %int %32 %int_1 + %36 = OpAccessChain %_ptr_Function_float %indexable_0 %34 + %37 = OpLoad %float %36 + %38 = OpLoad %float %FragColor + %39 = OpFAdd %float %38 %37 + OpStore %FragColor %39 + OpBranch %31 + %40 = OpLabel + %41 = OpLoad %int %index + %42 = OpBitwiseAnd %int %41 %int_1 + %44 = OpAccessChain %_ptr_Function_float %indexable_1 %42 + %45 = OpLoad %float %44 + %46 = OpLoad %float %FragColor + %47 = OpFAdd %float %46 %45 + OpStore %FragColor %47 + OpBranch %31 + %31 = OpLabel + %61 = OpLoad %int %index + %63 = OpSGreaterThan %bool %61 %int_30 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %74 + %64 = OpLabel + %66 = OpLoad %int %index + %68 = OpBitwiseAnd %int %66 %int_3 + %70 = OpAccessChain %_ptr_Function_float %foo %68 %uint_1 + %71 = OpLoad %float %70 + %72 = OpLoad %float %FragColor + %73 = OpFAdd %float %72 %71 + OpStore %FragColor %73 + OpBranch %65 + %74 = OpLabel + %75 = OpLoad %int %index + %76 = OpBitwiseAnd %int %75 %int_1 + %78 = OpAccessChain %_ptr_Function_float %foo %76 %uint_0 + %79 = OpLoad %float %78 + %80 = OpLoad %float %FragColor + %81 = OpFAdd %float %80 %79 + OpStore %FragColor %81 + OpBranch %65 + %65 = OpLabel + %83 = OpLoad %int %index + %84 = OpSGreaterThan %bool %83 %int_30 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %foobar %int_1 %uint_2 + OpStore %89 %float_20 + OpBranch %86 + %86 = OpLabel + %90 = OpLoad %int %index + %91 = OpBitwiseAnd %int %90 %int_3 + %92 = OpAccessChain %_ptr_Function_float %foobar %91 %uint_2 + %93 = OpLoad %float %92 + %94 = OpLoad %float %FragColor + %95 = OpFAdd %float %94 %93 + OpStore %FragColor %95 + OpStore %baz %104 + %105 = OpLoad %int %index + %106 = OpBitwiseAnd %int %105 %int_3 + %107 = OpAccessChain %_ptr_Function_float %baz %106 %uint_2 + %108 = OpLoad %float %107 + %109 = OpLoad %float %FragColor + %110 = OpFAdd %float %109 %108 + OpStore %FragColor %110 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag new file mode 100644 index 0000000000..43d0970e8d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpName %main "main" + OpName %packed "packed" + OpName %unpacked "unpacked" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %ulong = OpTypeInt 64 0 +%_ptr_Function_ulong = OpTypePointer Function %ulong + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_18 = OpConstant %uint 18 + %uint_52 = OpConstant %uint 52 + %13 = OpConstantComposite %v2uint %uint_18 %uint_52 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %packed = OpVariable %_ptr_Function_ulong Function + %unpacked = OpVariable %_ptr_Function_v2uint Function + %14 = OpBitcast %ulong %13 + OpStore %packed %14 + %17 = OpLoad %ulong %packed + %18 = OpBitcast %v2uint %17 + OpStore %unpacked %18 + %25 = OpAccessChain %_ptr_Function_uint %unpacked %uint_0 + %26 = OpLoad %uint %25 + %27 = OpConvertUToF %float %26 + %29 = OpAccessChain %_ptr_Function_uint %unpacked %uint_1 + %30 = OpLoad %uint %29 + %31 = OpConvertUToF %float %30 + %33 = OpCompositeConstruct %v4float %27 %31 %float_1 %float_1 + OpStore %FragColor %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..16dcd0d6e0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %g_Texture "g_Texture" + OpName %type_sampler "type.sampler" + OpName %g_Sampler "g_Sampler" + OpName %g_CompareSampler "g_CompareSampler" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %g_Texture DescriptorSet 0 + OpDecorate %g_Texture Binding 0 + OpDecorate %g_Sampler DescriptorSet 0 + OpDecorate %g_Sampler Binding 0 + OpDecorate %g_CompareSampler DescriptorSet 0 + OpDecorate %g_CompareSampler Binding 1 + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %float_0 = OpConstant %float 0 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_float = OpTypePointer Output %float + %void = OpTypeVoid + %19 = OpTypeFunction %void +%type_sampled_image = OpTypeSampledImage %type_2d_image + %v4float = OpTypeVector %float 4 + %g_Texture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %g_Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%g_CompareSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %19 + %21 = OpLabel + %22 = OpLoad %v2float %in_var_TEXCOORD0 + %23 = OpLoad %type_2d_image %g_Texture + %24 = OpLoad %type_sampler %g_Sampler + %25 = OpSampledImage %type_sampled_image %23 %24 + %26 = OpImageSampleImplicitLod %v4float %25 %22 None + %27 = OpCompositeExtract %float %26 0 + %28 = OpLoad %type_sampler %g_CompareSampler + %29 = OpSampledImage %type_sampled_image %23 %28 + %30 = OpImageSampleDrefExplicitLod %float %29 %22 %float_0_5 Lod %float_0 + %31 = OpFAdd %float %27 %30 + OpStore %out_var_SV_Target %31 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..0d5b29c638 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %o_color + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpName %main "main" + OpName %myType "myType" + OpMemberName %myType 0 "data" + OpName %myData "myData" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %index "index" + OpName %elt "elt" + OpName %o_color "o_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %o_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %myType = OpTypeStruct %float + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_myType_uint_5 = OpTypeArray %myType %uint_5 +%_ptr_Private__arr_myType_uint_5 = OpTypePointer Private %_arr_myType_uint_5 + %myData = OpVariable %_ptr_Private__arr_myType_uint_5 Private + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %myType %float_0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %myType %float_1 + %21 = OpConstantComposite %_arr_myType_uint_5 %18 %20 %18 %20 %18 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 +%_ptr_Function_myType = OpTypePointer Function %myType +%_ptr_Private_myType = OpTypePointer Private %myType + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o_color = OpVariable %_ptr_Output_v4float Output + %36 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %11 + %38 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + %index = OpVariable %_ptr_Function_int Function + %elt = OpVariable %_ptr_Function_myType Function + OpStore %myData %21 + %39 = OpLoad %v4float %gl_FragCoord + %40 = OpVectorShuffle %v2float %39 %39 0 1 + OpStore %uv %40 + %41 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %42 = OpLoad %float %41 + %43 = OpFMod %float %42 %float_4 + %44 = OpConvertFToS %int %43 + OpStore %index %44 + %45 = OpLoad %int %index + %46 = OpAccessChain %_ptr_Private_myType %myData %45 + %47 = OpLoad %myType %46 + OpStore %elt %47 + %48 = OpAccessChain %_ptr_Function_float %elt %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdGreaterThan %bool %49 %float_0 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %o_color %36 + OpBranch %51 + %53 = OpLabel + OpStore %o_color %37 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/srem.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..c6f8e27cbd --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/srem.asm.frag @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %vB Flat + OpDecorate %vB Location 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %vA = OpVariable %_ptr_Input_v4int Input + %vB = OpVariable %_ptr_Input_v4int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %v4int %vA + %16 = OpLoad %v4int %vB + %17 = OpLoad %v4int %vA + %18 = OpLoad %v4int %vB + %19 = OpSRem %v4int %17 %18 + %20 = OpConvertSToF %v4float %19 + OpStore %FragColor %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..7763b7c17c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColors %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColors "FragColors" + OpName %FragColor "FragColor" + OpDecorate %FragColors Location 0 + OpDecorate %FragColor Location 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Output__arr_v4float_uint_2 = OpTypePointer Output %_arr_v4float_uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_10 = OpConstant %float 10 + %19 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %20 = OpConstantComposite %_arr_v4float_uint_2 %17 %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %float_5 = OpConstant %float 5 + %24 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %FragColors = OpVariable %_ptr_Output__arr_v4float_uint_2 Output %20 + %FragColor = OpVariable %_ptr_Output_v4float Output %24 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag new file mode 100644 index 0000000000..afce11480e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 660 + OpName %type_StructuredBuffer_Data "type.StructuredBuffer.Data" + OpName %Data "Data" + OpMemberName %Data 0 "Color" + OpName %Colors "Colors" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorateString %out_var_SV_Target UserSemantic "SV_Target" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Colors DescriptorSet 0 + OpDecorate %Colors Binding 0 + OpMemberDecorate %Data 0 Offset 0 + OpDecorate %_runtimearr_Data ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_Data 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_Data 0 NonWritable + OpDecorate %type_StructuredBuffer_Data BufferBlock + OpDecorateString %Colors UserTypeGOOGLE "structuredbuffer:" + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Data = OpTypeStruct %v4float +%_runtimearr_Data = OpTypeRuntimeArray %Data +%type_StructuredBuffer_Data = OpTypeStruct %_runtimearr_Data +%_ptr_Uniform_type_StructuredBuffer_Data = OpTypePointer Uniform %type_StructuredBuffer_Data +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %Colors = OpVariable %_ptr_Uniform_type_StructuredBuffer_Data Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %17 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_v4float %Colors %int_0 %uint_3 %int_0 + %21 = OpLoad %v4float %20 + OpStore %out_var_SV_Target %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..53dc63809c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uTexture + %18 = OpLoad %v4float %gl_FragCoord + %19 = OpVectorShuffle %v2float %18 %18 0 1 + %22 = OpConvertFToS %v2int %19 + %24 = OpImage %10 %14 + %25 = OpImageFetch %v4float %24 %22 + OpStore %FragColor %25 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..e7e6f37ea2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability StorageInputOutput16 + OpCapability Float16 + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %UV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16" + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %UV "UV" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %UV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %half = OpTypeFloat 16 + %float = OpTypeFloat 32 + %v4half = OpTypeVector %half 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4half = OpTypePointer Output %v4half + %FragColor = OpVariable %_ptr_Output_v4half Output + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v2half = OpTypeVector %half 2 +%_ptr_Input_v2half = OpTypePointer Input %v2half + %UV = OpVariable %_ptr_Input_v2half Input + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %19 = OpLoad %v2half %UV + %23 = OpImageSampleImplicitLod %v4float %15 %19 + %24 = OpFConvert %v4half %23 + OpStore %FragColor %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..89036f0eb2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vUV %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %sample_combined_ "sample_combined(" + OpName %sample_separate_ "sample_separate(" + OpName %uShadow "uShadow" + OpName %vUV "vUV" + OpName %uTexture "uTexture" + OpName %uSampler "uSampler" + OpName %FragColor "FragColor" + OpDecorate %uShadow DescriptorSet 0 + OpDecorate %uShadow Binding 0 + OpDecorate %vUV Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 2 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float + %12 = OpTypeImage %float 2D 2 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %uShadow = OpVariable %_ptr_UniformConstant_13 UniformConstant + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %vUV = OpVariable %_ptr_Input_v3float Input +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_25 UniformConstant + %29 = OpTypeSampler +%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29 + %uSampler = OpVariable %_ptr_UniformConstant_29 UniformConstant +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %41 = OpFunctionCall %float %sample_combined_ + %42 = OpFunctionCall %float %sample_separate_ + %43 = OpFAdd %float %41 %42 + OpStore %FragColor %43 + OpReturn + OpFunctionEnd +%sample_combined_ = OpFunction %float None %7 + %9 = OpLabel + %16 = OpLoad %13 %uShadow + %20 = OpLoad %v3float %vUV + %21 = OpCompositeExtract %float %20 2 + %22 = OpImageSampleDrefImplicitLod %float %16 %20 %21 + OpReturnValue %22 + OpFunctionEnd +%sample_separate_ = OpFunction %float None %7 + %11 = OpLabel + %28 = OpLoad %12 %uTexture + %32 = OpLoad %29 %uSampler + %33 = OpSampledImage %13 %28 %32 + %34 = OpLoad %v3float %vUV + %35 = OpCompositeExtract %float %34 2 + %36 = OpImageSampleDrefImplicitLod %float %33 %34 %35 + OpReturnValue %36 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/shaders-hlsl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..e2ce2eb56a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/frag/unreachable.asm.frag @@ -0,0 +1,61 @@ +; 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 %main "main" %counter %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %counter "counter" + OpName %FragColor "FragColor" + OpDecorate %counter Flat + OpDecorate %counter Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %counter = OpVariable %_ptr_Input_int Input + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %21 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %float_30 = OpConstant %float 30 + %25 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %false = OpConstantFalse %bool + %44 = OpUndef %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %33 + %33 = OpLabel + %45 = OpPhi %v4float %44 %5 %44 %35 + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %counter + %38 = OpIEqual %bool %37 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %34 + %41 = OpLabel + OpBranch %34 + %39 = OpLabel + OpUnreachable + %35 = OpLabel + OpBranchConditional %false %33 %34 + %34 = OpLabel + %46 = OpPhi %v4float %21 %40 %25 %41 %44 %35 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..f51d903b04 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %VS "main" %PosL_1 %instanceID_1 %_entryPointOutput_Position %_entryPointOutput_Color + OpSource HLSL 500 + OpName %VS "VS" + OpName %V2F "V2F" + OpMemberName %V2F 0 "Position" + OpMemberName %V2F 1 "Color" + OpName %_VS_vf3_u1_ "@VS(vf3;u1;" + OpName %PosL "PosL" + OpName %instanceID "instanceID" + OpName %InstanceData "InstanceData" + OpMemberName %InstanceData 0 "MATRIX_MVP" + OpMemberName %InstanceData 1 "Color" + OpName %instData "instData" + OpName %InstanceData_0 "InstanceData" + OpMemberName %InstanceData_0 0 "MATRIX_MVP" + OpMemberName %InstanceData_0 1 "Color" + OpName %gInstanceData "gInstanceData" + OpMemberName %gInstanceData 0 "@data" + OpName %gInstanceData_0 "gInstanceData" + OpName %v2f "v2f" + OpName %PosL_0 "PosL" + OpName %PosL_1 "PosL" + OpName %instanceID_0 "instanceID" + OpName %instanceID_1 "instanceID" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_Position "@entryPointOutput.Position" + OpName %_entryPointOutput_Color "@entryPointOutput.Color" + OpMemberDecorate %InstanceData_0 0 RowMajor + OpMemberDecorate %InstanceData_0 0 Offset 0 + OpMemberDecorate %InstanceData_0 0 MatrixStride 16 + OpMemberDecorate %InstanceData_0 1 Offset 64 + OpDecorate %_runtimearr_InstanceData_0 ArrayStride 80 + OpMemberDecorate %gInstanceData 0 Offset 0 + OpDecorate %gInstanceData Block + OpDecorate %gInstanceData_0 DescriptorSet 1 + OpDecorate %gInstanceData_0 Binding 0 + OpDecorate %PosL_1 Location 0 + OpDecorate %instanceID_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput_Position BuiltIn Position + OpDecorate %_entryPointOutput_Color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint = OpTypeInt 32 0 + %int_32 = OpConstant %uint 32 +%_ptr_Function_uint = OpTypePointer Function %uint + %v4float = OpTypeVector %float 4 + %V2F = OpTypeStruct %v4float %v4float + %13 = OpTypeFunction %V2F %_ptr_Function_v3float %_ptr_Function_uint +%mat4v4float = OpTypeMatrix %v4float 4 +%InstanceData = OpTypeStruct %mat4v4float %v4float +%_ptr_Function_InstanceData = OpTypePointer Function %InstanceData +%InstanceData_0 = OpTypeStruct %mat4v4float %v4float +%_runtimearr_InstanceData_0 = OpTypeArray %InstanceData_0 %int_32 +%gInstanceData = OpTypeStruct %_runtimearr_InstanceData_0 +%_ptr_Uniform_gInstanceData = OpTypePointer Uniform %gInstanceData +%gInstanceData_0 = OpVariable %_ptr_Uniform_gInstanceData Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_InstanceData_0 = OpTypePointer Uniform %InstanceData_0 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_V2F = OpTypePointer Function %V2F + %float_1 = OpConstant %float 1 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %PosL_1 = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_uint = OpTypePointer Input %uint +%instanceID_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_Position = OpVariable %_ptr_Output_v4float Output +%_entryPointOutput_Color = OpVariable %_ptr_Output_v4float Output + %VS = OpFunction %void None %3 + %5 = OpLabel + %PosL_0 = OpVariable %_ptr_Function_v3float Function +%instanceID_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_V2F Function + %param = OpVariable %_ptr_Function_v3float Function + %param_0 = OpVariable %_ptr_Function_uint Function + %61 = OpLoad %v3float %PosL_1 + OpStore %PosL_0 %61 + %65 = OpLoad %uint %instanceID_1 + OpStore %instanceID_0 %65 + %68 = OpLoad %v3float %PosL_0 + OpStore %param %68 + %70 = OpLoad %uint %instanceID_0 + OpStore %param_0 %70 + %71 = OpFunctionCall %V2F %_VS_vf3_u1_ %param %param_0 + OpStore %flattenTemp %71 + %74 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %75 = OpLoad %v4float %74 + OpStore %_entryPointOutput_Position %75 + %77 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_1 + %78 = OpLoad %v4float %77 + OpStore %_entryPointOutput_Color %78 + OpReturn + OpFunctionEnd +%_VS_vf3_u1_ = OpFunction %V2F None %13 + %PosL = OpFunctionParameter %_ptr_Function_v3float + %instanceID = OpFunctionParameter %_ptr_Function_uint + %17 = OpLabel + %instData = OpVariable %_ptr_Function_InstanceData Function + %v2f = OpVariable %_ptr_Function_V2F Function + %29 = OpLoad %uint %instanceID + %31 = OpAccessChain %_ptr_Uniform_InstanceData_0 %gInstanceData_0 %int_0 %29 + %32 = OpLoad %InstanceData_0 %31 + %33 = OpCompositeExtract %mat4v4float %32 0 + %35 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + OpStore %35 %33 + %36 = OpCompositeExtract %v4float %32 1 + %39 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + OpStore %39 %36 + %42 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + %43 = OpLoad %mat4v4float %42 + %44 = OpLoad %v3float %PosL + %46 = OpCompositeExtract %float %44 0 + %47 = OpCompositeExtract %float %44 1 + %48 = OpCompositeExtract %float %44 2 + %49 = OpCompositeConstruct %v4float %46 %47 %48 %float_1 + %50 = OpMatrixTimesVector %v4float %43 %49 + %51 = OpAccessChain %_ptr_Function_v4float %v2f %int_0 + OpStore %51 %50 + %52 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + %53 = OpLoad %v4float %52 + %54 = OpAccessChain %_ptr_Function_v4float %v2f %int_1 + OpStore %54 %53 + %55 = OpLoad %V2F %v2f + OpReturnValue %55 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..b566a3d1a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability ClipDistance + OpCapability CullDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %52 %output + OpSource GLSL 450 + OpName %4 "main" + OpName %9 "pos" + OpName %50 "gl_PerVertex" + OpMemberName %50 0 "gl_Position" + OpMemberName %50 1 "gl_PointSize" + OpMemberName %50 2 "gl_ClipDistance" + OpMemberName %50 3 "gl_CullDistance" + OpName %52 "" + OpDecorate %13 SpecId 201 + OpDecorate %24 SpecId 202 + OpMemberDecorate %50 0 BuiltIn Position + OpMemberDecorate %50 1 BuiltIn PointSize + OpMemberDecorate %50 2 BuiltIn ClipDistance + OpMemberDecorate %50 3 BuiltIn CullDistance + OpDecorate %50 Block + OpDecorate %57 SpecId 200 + OpDecorate %output Flat + OpDecorate %output Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %int_ptr = OpTypePointer Output %12 + %13 = OpSpecConstant %12 -10 + %14 = OpConstant %12 2 + %15 = OpSpecConstantOp %12 IAdd %13 %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Function %6 + %24 = OpSpecConstant %17 100 + %25 = OpConstant %17 5 + %26 = OpSpecConstantOp %17 UMod %24 %25 + %28 = OpConstant %17 2 + %33 = OpConstant %12 20 + %34 = OpConstant %12 30 + %35 = OpTypeVector %12 4 + %36 = OpSpecConstantComposite %35 %33 %34 %15 %15 + %40 = OpTypeVector %12 2 + %41 = OpSpecConstantOp %40 VectorShuffle %36 %36 1 0 + %foo = OpSpecConstantOp %12 CompositeExtract %36 1 + %42 = OpTypeVector %6 2 + %49 = OpTypeArray %6 %18 + %50 = OpTypeStruct %7 %6 %49 %49 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %output = OpVariable %int_ptr Output + %53 = OpConstant %12 0 + %55 = OpTypePointer Output %7 + %57 = OpSpecConstant %6 3.14159 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + OpStore %9 %11 + %16 = OpConvertSToF %6 %15 + %20 = OpAccessChain %19 %9 %18 + %21 = OpLoad %6 %20 + %22 = OpFAdd %6 %21 %16 + %23 = OpAccessChain %19 %9 %18 + OpStore %23 %22 + %27 = OpConvertUToF %6 %26 + %29 = OpAccessChain %19 %9 %28 + %30 = OpLoad %6 %29 + %31 = OpFAdd %6 %30 %27 + %32 = OpAccessChain %19 %9 %28 + OpStore %32 %31 + %37 = OpConvertSToF %7 %36 + %38 = OpLoad %7 %9 + %39 = OpFAdd %7 %38 %37 + OpStore %9 %39 + %43 = OpConvertSToF %42 %41 + %44 = OpLoad %7 %9 + %45 = OpVectorShuffle %42 %44 %44 0 1 + %46 = OpFAdd %42 %45 %43 + %47 = OpLoad %7 %9 + %48 = OpVectorShuffle %7 %47 %46 4 5 2 3 + OpStore %9 %48 + %54 = OpLoad %7 %9 + %56 = OpAccessChain %55 %52 %53 + OpStore %56 %54 + OpStore %output %foo + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..29b0076a1e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %vid_1 %iid_1 %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_u1_u1_ "@main(u1;u1;" + OpName %vid "vid" + OpName %iid "iid" + OpName %vid_0 "vid" + OpName %vid_1 "vid" + OpName %iid_0 "iid" + OpName %iid_1 "iid" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %vid_1 BuiltIn VertexIndex + OpDecorate %iid_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_uint %_ptr_Function_uint +%_ptr_Input_uint = OpTypePointer Input %uint + %vid_1 = OpVariable %_ptr_Input_uint Input + %iid_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %vid_0 = OpVariable %_ptr_Function_uint Function + %iid_0 = OpVariable %_ptr_Function_uint Function + %param = OpVariable %_ptr_Function_uint Function + %param_0 = OpVariable %_ptr_Function_uint Function + %25 = OpLoad %uint %vid_1 + OpStore %vid_0 %25 + %28 = OpLoad %uint %iid_1 + OpStore %iid_0 %28 + %32 = OpLoad %uint %vid_0 + OpStore %param %32 + %34 = OpLoad %uint %iid_0 + OpStore %param_0 %34 + %35 = OpFunctionCall %v4float %_main_u1_u1_ %param %param_0 + OpStore %_entryPointOutput %35 + OpReturn + OpFunctionEnd +%_main_u1_u1_ = OpFunction %v4float None %10 + %vid = OpFunctionParameter %_ptr_Function_uint + %iid = OpFunctionParameter %_ptr_Function_uint + %14 = OpLabel + %15 = OpLoad %uint %vid + %16 = OpLoad %uint %iid + %17 = OpIAdd %uint %15 %16 + %18 = OpConvertUToF %float %17 + %19 = OpCompositeConstruct %v4float %18 %18 %18 %18 + OpReturnValue %19 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert b/third_party/spirv-cross/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..4587fc1e96 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/asm/vert/vertex-id-instance-id.asm.vert @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %gl_VertexID %gl_InstanceID + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %gl_VertexID "gl_VertexID" + OpName %gl_InstanceID "gl_InstanceID" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_VertexID BuiltIn VertexIndex + OpDecorate %gl_InstanceID BuiltIn InstanceIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexID = OpVariable %_ptr_Input_int Input +%gl_InstanceID = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %int %gl_VertexID + %20 = OpLoad %int %gl_InstanceID + %21 = OpIAdd %int %18 %20 + %22 = OpConvertSToF %float %21 + %23 = OpCompositeConstruct %v4float %22 %22 %22 %22 + %25 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %25 %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-hlsl/comp/access-chain-load-composite.comp b/third_party/spirv-cross/shaders-hlsl/comp/access-chain-load-composite.comp new file mode 100644 index 0000000000..69cc7a13be --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/access-chain-load-composite.comp @@ -0,0 +1,35 @@ +#version 450 +layout(local_size_x = 1) in; + +struct Baz +{ + float c; +}; + +struct Bar +{ + float d[2][4]; + Baz baz[2]; +}; + +struct Foo +{ + mat2 a; + vec2 b; + Bar c[5]; +}; + +layout(row_major, std430, set = 0, binding = 0) buffer SSBO +{ + Foo foo; + Foo foo2; +}; + +void main() +{ + Foo f = foo; + f.a += 1.0; + f.b += 2.0; + f.c[3].d[1][1] += 5.0; + foo2 = f; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/access-chains.comp b/third_party/spirv-cross/shaders-hlsl/comp/access-chains.comp new file mode 100644 index 0000000000..639f3cac15 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/access-chains.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1) in; + +// TODO: Read structs, matrices and arrays. + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 a[3][2][4]; + float b[3][2][4]; + vec4 unsized[]; +} ro; + +layout(std430, binding = 1) writeonly buffer SSBO1 +{ + vec4 c[3][2][4]; + float d[3][2][4]; + vec4 unsized[]; +} wo; + +void main() +{ + wo.c[2][gl_GlobalInvocationID.x][1] = ro.a[1][gl_GlobalInvocationID.x][2]; + wo.unsized[gl_GlobalInvocationID.x] = ro.unsized[gl_GlobalInvocationID.x]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/access-chains.force-uav.comp b/third_party/spirv-cross/shaders-hlsl/comp/access-chains.force-uav.comp new file mode 100644 index 0000000000..639f3cac15 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/access-chains.force-uav.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1) in; + +// TODO: Read structs, matrices and arrays. + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 a[3][2][4]; + float b[3][2][4]; + vec4 unsized[]; +} ro; + +layout(std430, binding = 1) writeonly buffer SSBO1 +{ + vec4 c[3][2][4]; + float d[3][2][4]; + vec4 unsized[]; +} wo; + +void main() +{ + wo.c[2][gl_GlobalInvocationID.x][1] = ro.a[1][gl_GlobalInvocationID.x][2]; + wo.unsized[gl_GlobalInvocationID.x] = ro.unsized[gl_GlobalInvocationID.x]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/address-buffers.comp b/third_party/spirv-cross/shaders-hlsl/comp/address-buffers.comp new file mode 100644 index 0000000000..3ba582ccd6 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/address-buffers.comp @@ -0,0 +1,23 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) readonly buffer ReadOnlyBuffer +{ + vec4 ro; +} ReadOnly; + +layout(binding = 1, std430) buffer ReadWriteBuffer +{ + vec4 rw; +} ReadWrite; + +layout(binding = 2, std430) buffer WriteOnlyBuffer +{ + vec4 wo; +} WriteOnly; + +void main() +{ + WriteOnly.wo = ReadOnly.ro; + ReadWrite.rw += 10.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/atomic.comp b/third_party/spirv-cross/shaders-hlsl/comp/atomic.comp new file mode 100644 index 0000000000..6f69ec725c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/atomic.comp @@ -0,0 +1,66 @@ +#version 310 es +#extension GL_OES_shader_image_atomic : require +layout(local_size_x = 1) in; + +layout(r32ui, binding = 0) uniform highp uimage2D uImage; +layout(r32i, binding = 1) uniform highp iimage2D iImage; +layout(binding = 2, std430) buffer SSBO +{ + uint u32; + int i32; +} ssbo; + +shared int int_atomic; +shared uint uint_atomic; +shared int int_atomic_array[1]; +shared uint uint_atomic_array[1]; + +void main() +{ + imageAtomicAdd(uImage, ivec2(1, 5), 1u); + + // Test that we do not invalidate OpImage variables which are loaded from UniformConstant + // address space. + imageStore(iImage, ivec2(1, 6), ivec4(imageAtomicAdd(uImage, ivec2(1, 5), 1u))); + + imageAtomicOr(uImage, ivec2(1, 5), 1u); + imageAtomicXor(uImage, ivec2(1, 5), 1u); + imageAtomicAnd(uImage, ivec2(1, 5), 1u); + imageAtomicMin(uImage, ivec2(1, 5), 1u); + imageAtomicMax(uImage, ivec2(1, 5), 1u); + //imageAtomicExchange(uImage, ivec2(1, 5), 1u); + imageAtomicCompSwap(uImage, ivec2(1, 5), 10u, 2u); + + imageAtomicAdd(iImage, ivec2(1, 6), 1); + imageAtomicOr(iImage, ivec2(1, 6), 1); + imageAtomicXor(iImage, ivec2(1, 6), 1); + imageAtomicAnd(iImage, ivec2(1, 6), 1); + imageAtomicMin(iImage, ivec2(1, 6), 1); + imageAtomicMax(iImage, ivec2(1, 6), 1); + //imageAtomicExchange(iImage, ivec2(1, 5), 1u); + imageAtomicCompSwap(iImage, ivec2(1, 5), 10, 2); + + atomicAdd(ssbo.u32, 1u); + atomicOr(ssbo.u32, 1u); + atomicXor(ssbo.u32, 1u); + atomicAnd(ssbo.u32, 1u); + atomicMin(ssbo.u32, 1u); + atomicMax(ssbo.u32, 1u); + atomicExchange(ssbo.u32, 1u); + atomicCompSwap(ssbo.u32, 10u, 2u); + + atomicAdd(ssbo.i32, 1); + atomicOr(ssbo.i32, 1); + atomicXor(ssbo.i32, 1); + atomicAnd(ssbo.i32, 1); + atomicMin(ssbo.i32, 1); + atomicMax(ssbo.i32, 1); + atomicExchange(ssbo.i32, 1); + atomicCompSwap(ssbo.i32, 10, 2); + + atomicAdd(int_atomic, 10); + atomicAdd(uint_atomic, 10u); + atomicAdd(int_atomic_array[0], 10); + atomicAdd(uint_atomic_array[0], 10u); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/barriers.comp b/third_party/spirv-cross/shaders-hlsl/comp/barriers.comp new file mode 100644 index 0000000000..7e0ea42d4e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/barriers.comp @@ -0,0 +1,79 @@ +#version 310 es +layout(local_size_x = 4) in; + +void barrier_shared() +{ + memoryBarrierShared(); +} + +void full_barrier() +{ + memoryBarrier(); +} + +void image_barrier() +{ + memoryBarrierImage(); +} + +void buffer_barrier() +{ + memoryBarrierBuffer(); +} + +void group_barrier() +{ + groupMemoryBarrier(); +} + +void barrier_shared_exec() +{ + memoryBarrierShared(); + barrier(); +} + +void full_barrier_exec() +{ + memoryBarrier(); + barrier(); +} + +void image_barrier_exec() +{ + memoryBarrierImage(); + barrier(); +} + +void buffer_barrier_exec() +{ + memoryBarrierBuffer(); + barrier(); +} + +void group_barrier_exec() +{ + groupMemoryBarrier(); + barrier(); +} + +void exec_barrier() +{ + barrier(); +} + +void main() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + + exec_barrier(); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/builtins.comp b/third_party/spirv-cross/shaders-hlsl/comp/builtins.comp new file mode 100644 index 0000000000..b41cb53913 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/builtins.comp @@ -0,0 +1,11 @@ +#version 310 es +layout(local_size_x = 8, local_size_y = 4, local_size_z = 2) in; + +void main() +{ + uvec3 local_id = gl_LocalInvocationID; + uvec3 global_id = gl_GlobalInvocationID; + uint local_index = gl_LocalInvocationIndex; + uvec3 work_group_size = gl_WorkGroupSize; + uvec3 work_group_id = gl_WorkGroupID; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/composite-array-initialization.comp b/third_party/spirv-cross/shaders-hlsl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..319f466301 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/composite-array-initialization.comp @@ -0,0 +1,29 @@ +#version 450 +layout(local_size_x = 2) in; + +struct Data +{ + float a; + float b; +}; + +layout(std430, binding = 0) buffer SSBO +{ + Data outdata[]; +}; + +layout(constant_id = 0) const float X = 4.0; + +Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); +Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); + +Data combine(Data a, Data b) +{ + return Data(a.a + b.a, a.b + b.b); +} + +void main() +{ + if (gl_LocalInvocationIndex == 0u) + outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/globallycoherent.comp b/third_party/spirv-cross/shaders-hlsl/comp/globallycoherent.comp new file mode 100644 index 0000000000..168b9404ea --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/globallycoherent.comp @@ -0,0 +1,25 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(r32f, binding = 0) uniform readonly image2D uImageIn; +layout(r32f, binding = 1) uniform coherent writeonly image2D uImageOut; + +layout(set = 0, binding = 2) readonly buffer Foo +{ + float foo; +}; + +layout(set = 0, binding = 3) coherent writeonly buffer Bar +{ + float bar; +}; + +void main() +{ + ivec2 coord = ivec2(9, 7); + vec4 indata = imageLoad(uImageIn, coord); + imageStore(uImageOut, coord, indata); + + bar = foo; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/image.comp b/third_party/spirv-cross/shaders-hlsl/comp/image.comp new file mode 100644 index 0000000000..1d3c8b4c65 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/image.comp @@ -0,0 +1,77 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(r32f, binding = 0) uniform readonly image2D uImageInF; +layout(r32f, binding = 1) uniform writeonly image2D uImageOutF; +layout(r32i, binding = 2) uniform readonly iimage2D uImageInI; +layout(r32i, binding = 3) uniform writeonly iimage2D uImageOutI; +layout(r32ui, binding = 4) uniform readonly uimage2D uImageInU; +layout(r32ui, binding = 5) uniform writeonly uimage2D uImageOutU; +layout(r32f, binding = 6) uniform readonly imageBuffer uImageInBuffer; +layout(r32f, binding = 7) uniform writeonly imageBuffer uImageOutBuffer; + +layout(rg32f, binding = 8) uniform readonly image2D uImageInF2; +layout(rg32f, binding = 9) uniform writeonly image2D uImageOutF2; +layout(rg32i, binding = 10) uniform readonly iimage2D uImageInI2; +layout(rg32i, binding = 11) uniform writeonly iimage2D uImageOutI2; +layout(rg32ui, binding = 12) uniform readonly uimage2D uImageInU2; +layout(rg32ui, binding = 13) uniform writeonly uimage2D uImageOutU2; +layout(rg32f, binding = 14) uniform readonly imageBuffer uImageInBuffer2; +layout(rg32f, binding = 15) uniform writeonly imageBuffer uImageOutBuffer2; + +layout(rgba32f, binding = 16) uniform readonly image2D uImageInF4; +layout(rgba32f, binding = 17) uniform writeonly image2D uImageOutF4; +layout(rgba32i, binding = 18) uniform readonly iimage2D uImageInI4; +layout(rgba32i, binding = 19) uniform writeonly iimage2D uImageOutI4; +layout(rgba32ui, binding = 20) uniform readonly uimage2D uImageInU4; +layout(rgba32ui, binding = 21) uniform writeonly uimage2D uImageOutU4; +layout(rgba32f, binding = 22) uniform readonly imageBuffer uImageInBuffer4; +layout(rgba32f, binding = 23) uniform writeonly imageBuffer uImageOutBuffer4; + +layout(binding = 24) uniform writeonly image2D uImageNoFmtF; +layout(binding = 25) uniform writeonly uimage2D uImageNoFmtU; +layout(binding = 26) uniform writeonly iimage2D uImageNoFmtI; + +void main() +{ + vec4 f = imageLoad(uImageInF, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF, ivec2(gl_GlobalInvocationID.xy), f); + + ivec4 i = imageLoad(uImageInI, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI, ivec2(gl_GlobalInvocationID.xy), i); + + uvec4 u = imageLoad(uImageInU, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU, ivec2(gl_GlobalInvocationID.xy), u); + + vec4 b = imageLoad(uImageInBuffer, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer, int(gl_GlobalInvocationID.x), b); + + vec4 f2 = imageLoad(uImageInF2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF2, ivec2(gl_GlobalInvocationID.xy), f2); + + ivec4 i2 = imageLoad(uImageInI2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI2, ivec2(gl_GlobalInvocationID.xy), i2); + + uvec4 u2 = imageLoad(uImageInU2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU2, ivec2(gl_GlobalInvocationID.xy), u2); + + vec4 b2 = imageLoad(uImageInBuffer2, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer2, int(gl_GlobalInvocationID.x), b2); + + vec4 f4 = imageLoad(uImageInF4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF4, ivec2(gl_GlobalInvocationID.xy), f4); + + ivec4 i4 = imageLoad(uImageInI4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI4, ivec2(gl_GlobalInvocationID.xy), i4); + + uvec4 u4 = imageLoad(uImageInU4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU4, ivec2(gl_GlobalInvocationID.xy), u4); + + vec4 b4 = imageLoad(uImageInBuffer4, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer4, int(gl_GlobalInvocationID.x), b4); + + imageStore(uImageNoFmtF, ivec2(gl_GlobalInvocationID.xy), b2); + imageStore(uImageNoFmtU, ivec2(gl_GlobalInvocationID.xy), u4); + imageStore(uImageNoFmtI, ivec2(gl_GlobalInvocationID.xy), i4); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/image.nonwritable-uav-texture.comp b/third_party/spirv-cross/shaders-hlsl/comp/image.nonwritable-uav-texture.comp new file mode 100644 index 0000000000..1d3c8b4c65 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/image.nonwritable-uav-texture.comp @@ -0,0 +1,77 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(r32f, binding = 0) uniform readonly image2D uImageInF; +layout(r32f, binding = 1) uniform writeonly image2D uImageOutF; +layout(r32i, binding = 2) uniform readonly iimage2D uImageInI; +layout(r32i, binding = 3) uniform writeonly iimage2D uImageOutI; +layout(r32ui, binding = 4) uniform readonly uimage2D uImageInU; +layout(r32ui, binding = 5) uniform writeonly uimage2D uImageOutU; +layout(r32f, binding = 6) uniform readonly imageBuffer uImageInBuffer; +layout(r32f, binding = 7) uniform writeonly imageBuffer uImageOutBuffer; + +layout(rg32f, binding = 8) uniform readonly image2D uImageInF2; +layout(rg32f, binding = 9) uniform writeonly image2D uImageOutF2; +layout(rg32i, binding = 10) uniform readonly iimage2D uImageInI2; +layout(rg32i, binding = 11) uniform writeonly iimage2D uImageOutI2; +layout(rg32ui, binding = 12) uniform readonly uimage2D uImageInU2; +layout(rg32ui, binding = 13) uniform writeonly uimage2D uImageOutU2; +layout(rg32f, binding = 14) uniform readonly imageBuffer uImageInBuffer2; +layout(rg32f, binding = 15) uniform writeonly imageBuffer uImageOutBuffer2; + +layout(rgba32f, binding = 16) uniform readonly image2D uImageInF4; +layout(rgba32f, binding = 17) uniform writeonly image2D uImageOutF4; +layout(rgba32i, binding = 18) uniform readonly iimage2D uImageInI4; +layout(rgba32i, binding = 19) uniform writeonly iimage2D uImageOutI4; +layout(rgba32ui, binding = 20) uniform readonly uimage2D uImageInU4; +layout(rgba32ui, binding = 21) uniform writeonly uimage2D uImageOutU4; +layout(rgba32f, binding = 22) uniform readonly imageBuffer uImageInBuffer4; +layout(rgba32f, binding = 23) uniform writeonly imageBuffer uImageOutBuffer4; + +layout(binding = 24) uniform writeonly image2D uImageNoFmtF; +layout(binding = 25) uniform writeonly uimage2D uImageNoFmtU; +layout(binding = 26) uniform writeonly iimage2D uImageNoFmtI; + +void main() +{ + vec4 f = imageLoad(uImageInF, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF, ivec2(gl_GlobalInvocationID.xy), f); + + ivec4 i = imageLoad(uImageInI, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI, ivec2(gl_GlobalInvocationID.xy), i); + + uvec4 u = imageLoad(uImageInU, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU, ivec2(gl_GlobalInvocationID.xy), u); + + vec4 b = imageLoad(uImageInBuffer, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer, int(gl_GlobalInvocationID.x), b); + + vec4 f2 = imageLoad(uImageInF2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF2, ivec2(gl_GlobalInvocationID.xy), f2); + + ivec4 i2 = imageLoad(uImageInI2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI2, ivec2(gl_GlobalInvocationID.xy), i2); + + uvec4 u2 = imageLoad(uImageInU2, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU2, ivec2(gl_GlobalInvocationID.xy), u2); + + vec4 b2 = imageLoad(uImageInBuffer2, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer2, int(gl_GlobalInvocationID.x), b2); + + vec4 f4 = imageLoad(uImageInF4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutF4, ivec2(gl_GlobalInvocationID.xy), f4); + + ivec4 i4 = imageLoad(uImageInI4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutI4, ivec2(gl_GlobalInvocationID.xy), i4); + + uvec4 u4 = imageLoad(uImageInU4, ivec2(gl_GlobalInvocationID.xy)); + imageStore(uImageOutU4, ivec2(gl_GlobalInvocationID.xy), u4); + + vec4 b4 = imageLoad(uImageInBuffer4, int(gl_GlobalInvocationID.x)); + imageStore(uImageOutBuffer4, int(gl_GlobalInvocationID.x), b4); + + imageStore(uImageNoFmtF, ivec2(gl_GlobalInvocationID.xy), b2); + imageStore(uImageNoFmtU, ivec2(gl_GlobalInvocationID.xy), u4); + imageStore(uImageNoFmtI, ivec2(gl_GlobalInvocationID.xy), i4); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/inverse.comp b/third_party/spirv-cross/shaders-hlsl/comp/inverse.comp new file mode 100644 index 0000000000..03b06d6464 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/inverse.comp @@ -0,0 +1,23 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std430, binding = 0) writeonly buffer MatrixOut +{ + mat2 m2out; + mat3 m3out; + mat4 m4out; +}; + +layout(std430, binding = 1) readonly buffer MatrixIn +{ + mat2 m2in; + mat3 m3in; + mat4 m4in; +}; + +void main() +{ + m2out = inverse(m2in); + m3out = inverse(m3in); + m4out = inverse(m4in); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-alone.comp b/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-alone.comp new file mode 100644 index 0000000000..10b5817ce2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-alone.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + uvec3 outdata; +}; + +void main() +{ + outdata = gl_NumWorkGroups; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-with-builtins.comp b/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-with-builtins.comp new file mode 100644 index 0000000000..d19a06c104 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/num-workgroups-with-builtins.comp @@ -0,0 +1,13 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + uvec3 outdata; +}; + +void main() +{ + outdata = gl_NumWorkGroups + gl_WorkGroupID; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/outer-product.comp b/third_party/spirv-cross/shaders-hlsl/comp/outer-product.comp new file mode 100644 index 0000000000..9aba2a54b7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/outer-product.comp @@ -0,0 +1,37 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, std430) writeonly buffer SSBO +{ + mat2 m22; + mat2x3 m23; + mat2x4 m24; + mat3x2 m32; + mat3 m33; + mat3x4 m34; + mat4x2 m42; + mat4x3 m43; + mat4 m44; +}; + +layout(set = 0, binding = 1, std430) readonly buffer ReadSSBO +{ + vec2 v2; + vec3 v3; + vec4 v4; +}; + +void main() +{ + m22 = outerProduct(v2, v2); + m23 = outerProduct(v3, v2); + m24 = outerProduct(v4, v2); + + m32 = outerProduct(v2, v3); + m33 = outerProduct(v3, v3); + m34 = outerProduct(v4, v3); + + m42 = outerProduct(v2, v4); + m43 = outerProduct(v3, v4); + m44 = outerProduct(v4, v4); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp b/third_party/spirv-cross/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp new file mode 100644 index 0000000000..3a2a8d0d2d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/rayquery.nofxc.fxconly.comp @@ -0,0 +1,213 @@ +#version 460 +#extension GL_EXT_ray_query : enable +#extension GL_EXT_ray_flags_primitive_culling : enable + +layout(primitive_culling); +struct Ray +{ + vec3 pos; + float tmin; + vec3 dir; + float tmax; +}; + +layout(std430, set = 0, binding = 0) buffer Log +{ + uint x; + uint y; +}; + +layout(binding = 1, set = 0) uniform accelerationStructureEXT rtas; +layout(std430, set = 0, binding = 2) buffer Rays { Ray rays[]; }; + +void doSomething() +{ + x = 0; + y = 0; +} + +Ray makeRayDesc() +{ + Ray ray; + ray.pos= vec3(0,0,0); + ray.dir = vec3(1,0,0); + ray.tmin = 0.0f; + ray.tmax = 9999.0; + return ray; +} + +void main() +{ + Ray ray = makeRayDesc(); + rayQueryEXT rayQuery; + rayQueryInitializeEXT(rayQuery, rtas, gl_RayFlagsNoneEXT, 0xFF, ray.pos, ray.tmin, ray.dir, ray.tmax); + + mat4x3 _mat4x3; + mat3x4 _mat3x4; + + while (rayQueryProceedEXT(rayQuery)) + { + uint candidateType = rayQueryGetIntersectionTypeEXT(rayQuery, false); + switch(candidateType) + { + case gl_RayQueryCandidateIntersectionTriangleEXT: + + rayQueryTerminateEXT(rayQuery); + _mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false); + _mat3x4 = transpose(_mat4x3); + rayQueryConfirmIntersectionEXT(rayQuery); + + if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true)) + { + doSomething(); + } + + if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).x == 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).x > 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if (rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f) + { + doSomething(); + } + + if (rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, true) > 0) + { + doSomething(); + } + break; + + case gl_RayQueryCandidateIntersectionAABBEXT: + { + _mat4x3 = rayQueryGetIntersectionObjectToWorldEXT(rayQuery, false); + _mat3x4 = transpose(_mat4x3); + if (rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQuery)) + { + doSomething(); + } + + float t = 0.5; + rayQueryGenerateIntersectionEXT(rayQuery, t); + rayQueryTerminateEXT(rayQuery); + break; + } + } + } + + if(_mat3x4[0][0] == _mat4x3[0][0]) + { + doSomething(); + } + + uint committedStatus = rayQueryGetIntersectionTypeEXT(rayQuery, true); + + switch(committedStatus) + { + case gl_RayQueryCommittedIntersectionNoneEXT : + _mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, false); + _mat3x4 = transpose(_mat4x3); + break; + + case gl_RayQueryCommittedIntersectionTriangleEXT : + _mat4x3 = rayQueryGetIntersectionWorldToObjectEXT(rayQuery, true); + _mat3x4 = transpose(_mat4x3); + + if (rayQueryGetIntersectionFrontFaceEXT(rayQuery, true)) + { + doSomething(); + } + + if (rayQueryGetIntersectionBarycentricsEXT(rayQuery, true).y == 0) + { + doSomething(); + } + break; + + case gl_RayQueryCommittedIntersectionGeneratedEXT : + + if(rayQueryGetIntersectionGeometryIndexEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionInstanceIdEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionObjectRayDirectionEXT(rayQuery, true).z > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionObjectRayOriginEXT(rayQuery, true).x > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true) > 0) + { + doSomething(); + } + + if(rayQueryGetIntersectionTEXT(rayQuery, true) > 0.f) + { + doSomething(); + } + break; + } + + if (_mat3x4[0][0] == _mat4x3[0][0]) + { + doSomething(); + } + + if (rayQueryGetRayFlagsEXT(rayQuery) > gl_RayFlagsSkipTrianglesEXT) + { + doSomething(); + } + + if (rayQueryGetRayTMinEXT(rayQuery) > 0.0) + { + doSomething(); + } + + vec3 o = rayQueryGetWorldRayOriginEXT(rayQuery); + vec3 d = rayQueryGetWorldRayDirectionEXT(rayQuery); + + if (o.x == d.z) + { + doSomething(); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/rmw-matrix.comp b/third_party/spirv-cross/shaders-hlsl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..c158ab4ddd --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/rmw-matrix.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float a; + vec4 b; + mat4 c; + + float a1; + vec4 b1; + mat4 c1; +}; + +void main() +{ + a *= a1; + b *= b1; + c *= c1; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/rwbuffer-matrix.comp b/third_party/spirv-cross/shaders-hlsl/comp/rwbuffer-matrix.comp new file mode 100644 index 0000000000..0e722e0a51 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/rwbuffer-matrix.comp @@ -0,0 +1,104 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std140, binding = 1) uniform UBO +{ + int index0; + int index1; +}; + +layout(binding = 0, std430) buffer SSBO +{ + layout(column_major) mat4 mcol; + layout(row_major) mat4 mrow; + + layout(column_major) mat2 mcol2x2; + layout(row_major) mat2 mrow2x2; + + layout(column_major) mat2x3 mcol2x3; + layout(row_major) mat2x3 mrow2x3; + + layout(column_major) mat3x2 mcol3x2; + layout(row_major) mat3x2 mrow3x2; +}; + +void col_to_row() +{ + // Load column-major, store row-major. + mrow = mcol; + mrow2x2 = mcol2x2; + mrow2x3 = mcol2x3; + mrow3x2 = mcol3x2; +} + +void row_to_col() +{ + // Load row-major, store column-major. + mcol = mrow; + mcol2x2 = mrow2x2; + mcol2x3 = mrow2x3; + mcol3x2 = mrow3x2; +} + +void write_dynamic_index_row() +{ + mrow[index0][index1] = 1.0; + mrow2x2[index0][index1] = 2.0; + mrow2x3[index0][index1] = 3.0; + mrow3x2[index0][index1] = 4.0; + + mrow[index0] = vec4(1.0); + mrow2x2[index0] = vec2(2.0); + mrow2x3[index0] = vec3(3.0); + mrow3x2[index0] = vec2(4.0); +} + +void write_dynamic_index_col() +{ + mcol[index0][index1] = 1.0; + mcol2x2[index0][index1] = 2.0; + mcol2x3[index0][index1] = 3.0; + mcol3x2[index0][index1] = 4.0; + + mcol[index0] = vec4(1.0); + mcol2x2[index0] = vec2(2.0); + mcol2x3[index0] = vec3(3.0); + mcol3x2[index0] = vec2(4.0); +} + +void read_dynamic_index_row() +{ + float a0 = mrow[index0][index1]; + float a1 = mrow2x2[index0][index1]; + float a2 = mrow2x3[index0][index1]; + float a3 = mrow3x2[index0][index1]; + + vec4 v0 = mrow[index0]; + vec2 v1 = mrow2x2[index0]; + vec3 v2 = mrow2x3[index0]; + vec2 v3 = mrow3x2[index0]; +} + +void read_dynamic_index_col() +{ + float a0 = mcol[index0][index1]; + float a1 = mcol2x2[index0][index1]; + float a2 = mcol2x3[index0][index1]; + float a3 = mcol3x2[index0][index1]; + + vec4 v0 = mcol[index0]; + vec2 v1 = mcol2x2[index0]; + vec3 v2 = mcol2x3[index0]; + vec2 v3 = mcol3x2[index0]; +} + +void main() +{ + row_to_col(); + col_to_row(); + write_dynamic_index_row(); + write_dynamic_index_col(); + read_dynamic_index_row(); + read_dynamic_index_col(); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..37414737fd --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std430, set = 0, binding = 0) buffer SSBO +{ + float a; + float b; + float c; + float d; + float e; +}; + +void main() +{ + c = distance(a, b); + d = length(a); + e = normalize(a); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/shared.comp b/third_party/spirv-cross/shaders-hlsl/comp/shared.comp new file mode 100644 index 0000000000..4deff93597 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/shared.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 4) in; + +shared float sShared[gl_WorkGroupSize.x]; + +layout(std430, binding = 0) readonly buffer SSBO +{ + float in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + float out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = in_data[ident]; + + sShared[gl_LocalInvocationIndex] = idata; + memoryBarrierShared(); + barrier(); + + out_data[ident] = sShared[gl_WorkGroupSize.x - gl_LocalInvocationIndex - 1u]; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..0b428eb0cf --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; +layout(constant_id = 2) const int c = 300; +const int d = c + 50; +layout(constant_id = 3) const int e = 400; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(set = 1, binding = 0) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +void main() +{ + w[gl_GlobalInvocationID.x] += v[gl_GlobalInvocationID.x] + e; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..c86097ec7d --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,19 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[0] = 10; + spec_const_array_size[1] = 40; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y + gl_GlobalInvocationID.x] = b + spec_const_array_size[1 - a]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array-length.comp b/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..3ad4b95159 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array-length.comp @@ -0,0 +1,12 @@ +#version 450 +layout(local_size_x = 1) in; +layout(set = 0, binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +}; + +void main() +{ + size = v.length(); +} diff --git a/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array.comp b/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array.comp new file mode 100644 index 0000000000..38b56e9a0a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/comp/ssbo-array.comp @@ -0,0 +1,29 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + vec4 a; +} ssbo0; + +// Does not seem to work in glslang yet in HLSL output, disable for now. +#if 0 +layout(binding = 1, std430) buffer SSBO1 +{ + vec4 b; +} ssbo1[2]; + +layout(binding = 2, std430) buffer SSBO2 +{ + vec4 c; +} ssbo2[3][3]; +#endif + +void main() +{ +#if 0 + ssbo1[1].b = ssbo0.a; + ssbo2[1][2].c = ssbo0.a; +#endif +} + diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/array.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/array.flatten.vert new file mode 100644 index 0000000000..fa6da076c9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/array.flatten.vert @@ -0,0 +1,19 @@ +#version 310 es + +layout(std140) uniform UBO +{ + vec4 A4[5][4][2]; + mat4 uMVP; + vec4 A1[2]; + vec4 A2[2][3]; + float A3[3]; + vec4 Offset; +}; +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec4 a4 = A4[2][3][1]; // 2 * (4 * 2) + 3 * 2 + 1 = 16 + 6 + 1 = 23. + vec4 offset = A2[1][1] + A1[1] + A3[2]; + gl_Position = uMVP * aVertex + Offset + offset; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/basic.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..e60a9067b1 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/basic.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/copy.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/copy.flatten.vert new file mode 100644 index 0000000000..4f1b8805e7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/copy.flatten.vert @@ -0,0 +1,34 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + Light light = lights[i]; + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/dynamic.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..a341d45288 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/dynamic.flatten.vert @@ -0,0 +1,33 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + vec3 L = aVertex.xyz - lights[i].Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / lights[i].Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/shaders-hlsl/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..427825c340 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in vec3 vNormal; + +layout(binding = 0, std140) uniform UBO +{ + mat4 m; +}; + +void main() +{ + FragColor = mat3(m) * vNormal; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..0ee7838432 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/matrixindex.flatten.vert @@ -0,0 +1,25 @@ +#version 310 es + +layout(std140) uniform UBO +{ + layout(column_major) mat4 M1C; + layout(row_major) mat4 M1R; + layout(column_major) mat2x4 M2C; + layout(row_major) mat2x4 M2R; +}; + +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; + +void main() +{ + gl_Position = vec4(0.0); + oA = M1C[1]; + oB = M1R[1]; + oC = M2C[1]; + oD = M2R[0]; + oE = vec4(M1C[1][2], M1R[1][2], M2C[1][2], M2R[1][2]); +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..0b471d86e0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/multiindex.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +layout(std140) uniform UBO +{ + vec4 Data[3][5]; +}; + +layout(location = 0) in ivec2 aIndex; + +void main() +{ + gl_Position = Data[aIndex.x][aIndex.y]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..c7b1b42e1b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/push-constant.flatten.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(push_constant, std430) uniform PushMe +{ + mat4 MVP; + mat2 Rot; // The MatrixStride will be 8 here. + float Arr[4]; +} registers; + +layout(location = 0) in vec2 Rot; +layout(location = 1) in vec4 Pos; +layout(location = 0) out vec2 vRot; +void main() +{ + gl_Position = registers.MVP * Pos; + vRot = registers.Rot * Rot + registers.Arr[2]; // Constant access should work even if array stride is just 4 here. +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..88c468c8f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/rowmajor.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + layout(column_major) mat4 uMVPR; + layout(row_major) mat4 uMVPC; + layout(row_major) mat2x4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec2 v = aVertex * uMVP; + gl_Position = uMVPR * aVertex + uMVPC * aVertex; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/struct.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..936bb41b85 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/struct.flatten.vert @@ -0,0 +1,30 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light light; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * light.Color); +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..231389b8f4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,26 @@ +#version 310 es + +struct Foo +{ + mat3x4 MVP0; + mat3x4 MVP1; +}; + +layout(std140, binding = 0) uniform UBO +{ + layout(row_major) Foo foo; +}; + +layout(location = 0) in vec4 v0; +layout(location = 1) in vec4 v1; +layout(location = 0) out vec3 V0; +layout(location = 1) out vec3 V1; + +void main() +{ + Foo f = foo; + vec3 a = v0 * f.MVP0; + vec3 b = v1 * f.MVP1; + V0 = a; + V1 = b; +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/shaders-hlsl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..fafff7734e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/swizzle.flatten.vert @@ -0,0 +1,47 @@ +#version 310 es + +// comments note the 16b alignment boundaries (see GL spec 7.6.2.2 Standard Uniform Block Layout) +layout(std140, binding = 0) uniform UBO +{ + // 16b boundary + vec4 A; + // 16b boundary + vec2 B0; + vec2 B1; + // 16b boundary + float C0; + // 16b boundary (vec3 is aligned to 16b) + vec3 C1; + // 16b boundary + vec3 D0; + float D1; + // 16b boundary + float E0; + float E1; + float E2; + float E3; + // 16b boundary + float F0; + vec2 F1; + // 16b boundary (vec2 before us is aligned to 8b) + float F2; +}; + +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; +layout(location = 5) out vec4 oF; + +void main() +{ + gl_Position = vec4(0.0); + + oA = A; + oB = vec4(B0, B1); + oC = vec4(C0, C1); + oD = vec4(D0, D1); + oE = vec4(E0, E1, E2, E3); + oF = vec4(F0, F1, F2); +} diff --git a/third_party/spirv-cross/shaders-hlsl/flatten/types.flatten.frag b/third_party/spirv-cross/shaders-hlsl/flatten/types.flatten.frag new file mode 100644 index 0000000000..faab5b7e05 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/flatten/types.flatten.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(std140, binding = 0) uniform UBO0 +{ + vec4 a; + vec4 b; +}; + +layout(std140, binding = 0) uniform UBO1 +{ + ivec4 c; + ivec4 d; +}; + +layout(std140, binding = 0) uniform UBO2 +{ + uvec4 e; + uvec4 f; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(c) + vec4(d) + vec4(e) + vec4(f) + a + b; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/shaders-hlsl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..3493e0cccc --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 v0; + +void main() +{ + float lut[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); + for (int i = 0; i < 4; i++, FragColor += lut[i]) + { + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm30.frag b/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm30.frag new file mode 100644 index 0000000000..64211b6501 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm30.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec3 FragColor; + +void main() +{ + FragColor = vColor.xyz; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm50.frag b/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm50.frag new file mode 100644 index 0000000000..64211b6501 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/basic-color-3comp.sm50.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec3 FragColor; + +void main() +{ + FragColor = vColor.xyz; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/basic.frag b/third_party/spirv-cross/shaders-hlsl/frag/basic.frag new file mode 100644 index 0000000000..dd9a8f8507 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/basic.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/bit-conversions.frag b/third_party/spirv-cross/shaders-hlsl/frag/bit-conversions.frag new file mode 100644 index 0000000000..faacdc0f15 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/bit-conversions.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec2 value; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + int i = floatBitsToInt(value.x); + FragColor = vec4(1.0, 0.0, intBitsToFloat(i), 1.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/boolean-mix.frag b/third_party/spirv-cross/shaders-hlsl/frag/boolean-mix.frag new file mode 100644 index 0000000000..9fd8ab3475 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/boolean-mix.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec2 x0; +layout(location = 0) out vec2 FragColor; + +void main() +{ + FragColor = x0.x > x0.y ? vec2(1.0, 0.0) : vec2(0.0, 1.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/builtins.frag b/third_party/spirv-cross/shaders-hlsl/frag/builtins.frag new file mode 100644 index 0000000000..99e6e2df5b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/builtins.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = gl_FragCoord + vColor; + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/bvec-operations.frag b/third_party/spirv-cross/shaders-hlsl/frag/bvec-operations.frag new file mode 100644 index 0000000000..7221604d9a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/bvec-operations.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec2 value; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + bvec2 bools1 = not(bvec2(value.x == 0.0, value.y == 0.0)); + bvec2 bools2 = lessThanEqual(value, vec2(1.5, 0.5)); + FragColor = vec4(1.0, 0.0, bools1.x ? 1.0 : 0.0, bools2.x ? 1.0 : 0.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/clip-cull-distance.frag b/third_party/spirv-cross/shaders-hlsl/frag/clip-cull-distance.frag new file mode 100644 index 0000000000..625a7dab31 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/clip-cull-distance.frag @@ -0,0 +1,12 @@ +#version 450 + +in float gl_ClipDistance[2]; +in float gl_CullDistance[1]; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = gl_ClipDistance[0] + gl_CullDistance[0] + gl_ClipDistance[1]; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-parameter.frag b/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-parameter.frag new file mode 100644 index 0000000000..e5721b9026 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-parameter.frag @@ -0,0 +1,31 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler2D uSampler; +layout(set = 0, binding = 1) uniform mediump sampler2DShadow uSamplerShadow; +layout(location = 0) out float FragColor; + +vec4 samp2(sampler2D s) +{ + return texture(s, vec2(1.0)) + texelFetch(s, ivec2(10), 0); +} + +vec4 samp3(sampler2D s) +{ + return samp2(s); +} + +float samp4(mediump sampler2DShadow s) +{ + return texture(s, vec3(1.0)); +} + +float samp(sampler2D s0, mediump sampler2DShadow s1) +{ + return samp3(s0).x + samp4(s1); +} + +void main() +{ + FragColor = samp(uSampler, uSamplerShadow); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-shadow.frag b/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-shadow.frag new file mode 100644 index 0000000000..2fabb5ea8a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/combined-texture-sampler-shadow.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump samplerShadow uSampler; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; +layout(set = 0, binding = 2) uniform texture2D uDepth; +layout(location = 0) out float FragColor; + +float samp2(texture2D t, mediump samplerShadow s) +{ + return texture(sampler2DShadow(t, s), vec3(1.0)); +} + +float samp3(texture2D t, mediump sampler s) +{ + return texture(sampler2D(t, s), vec2(1.0)).x; +} + +float samp(texture2D t, mediump samplerShadow s, mediump sampler s1) +{ + float r0 = samp2(t, s); + float r1 = samp3(t, s1); + return r0 + r1; +} + +void main() +{ + FragColor = samp(uDepth, uSampler, uSampler1); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/shaders-hlsl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..47f93931ce --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +struct Foo +{ + vec4 a; + vec4 b; +}; + +layout(binding = 0) buffer UBO +{ + vec4 results[1024]; +}; + +layout(binding = 1) uniform highp isampler2D Buf; +layout(location = 0) flat in int vIn; +layout(location = 1) flat in int vIn2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec4 coords = texelFetch(Buf, ivec2(gl_FragCoord.xy), 0); + vec4 foo = results[coords.x % 16]; + + int c = vIn * vIn; + int d = vIn2 * vIn2; + FragColor = foo + foo + results[c + d]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/constant-composites.frag b/third_party/spirv-cross/shaders-hlsl/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..7c75ffe1bd --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,36 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) in vec4 vInput; + +void main() +{ + FragColor = vInput; + vec4 t = texture(uSampler, vInput.xy); + vec4 d0 = dFdx(vInput); + vec4 d1 = dFdy(vInput); + vec4 d2 = fwidth(vInput); + vec4 d3 = dFdxCoarse(vInput); + vec4 d4 = dFdyCoarse(vInput); + vec4 d5 = fwidthCoarse(vInput); + vec4 d6 = dFdxFine(vInput); + vec4 d7 = dFdyFine(vInput); + vec4 d8 = fwidthFine(vInput); + vec2 lod = textureQueryLod(uSampler, vInput.zw); + if (vInput.y > 10.0) + { + FragColor += t; + FragColor += d0; + FragColor += d1; + FragColor += d2; + FragColor += d3; + FragColor += d4; + FragColor += d5; + FragColor += d6; + FragColor += d7; + FragColor += d8; + FragColor += lod.xyxy; + } +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/demote-to-helper.frag b/third_party/spirv-cross/shaders-hlsl/frag/demote-to-helper.frag new file mode 100644 index 0000000000..bdfef6f9b4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/demote-to-helper.frag @@ -0,0 +1,7 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + demote; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/depth-greater-than.frag b/third_party/spirv-cross/shaders-hlsl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..88f9a4214f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/depth-greater-than.frag @@ -0,0 +1,8 @@ +#version 450 +layout(early_fragment_tests) in; +layout(depth_greater) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/depth-less-than.frag b/third_party/spirv-cross/shaders-hlsl/frag/depth-less-than.frag new file mode 100644 index 0000000000..87fdd4620c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/depth-less-than.frag @@ -0,0 +1,8 @@ +#version 450 +layout(early_fragment_tests) in; +layout(depth_less) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/dual-source-blending.frag b/third_party/spirv-cross/shaders-hlsl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..f322cf4c38 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/dual-source-blending.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0, index = 0) out vec4 FragColor0; +layout(location = 0, index = 1) out vec4 FragColor1; + +void main() +{ + FragColor0 = vec4(1.0); + FragColor1 = vec4(2.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/early-fragment-test.frag b/third_party/spirv-cross/shaders-hlsl/frag/early-fragment-test.frag new file mode 100644 index 0000000000..9f84e09880 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/early-fragment-test.frag @@ -0,0 +1,7 @@ +#version 420 + +layout(early_fragment_tests) in; + +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/shaders-hlsl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..1f91cca2a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +void main() +{ + FragColor = vec4(0.0); + for (int i = 0; i < 3; (0 > 1) ? 1 : i ++) + { + int a = i; + FragColor[a] += float(i); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/fp16-packing.frag b/third_party/spirv-cross/shaders-hlsl/frag/fp16-packing.frag new file mode 100644 index 0000000000..98ca24e2f8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/fp16-packing.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) flat in uint FP16; +layout(location = 1) flat in vec2 FP32; +layout(location = 0) out vec2 FP32Out; +layout(location = 1) out uint FP16Out; + +void main() +{ + FP32Out = unpackHalf2x16(FP16); + FP16Out = packHalf2x16(FP32); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/front-facing.frag b/third_party/spirv-cross/shaders-hlsl/frag/front-facing.frag new file mode 100644 index 0000000000..90ca1abf4e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/front-facing.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + if (gl_FrontFacing) + FragColor = vA; + else + FragColor = vB; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/hyperbolic.frag b/third_party/spirv-cross/shaders-hlsl/frag/hyperbolic.frag new file mode 100644 index 0000000000..a52a3eeb0a --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/hyperbolic.frag @@ -0,0 +1,26 @@ +#version 450 + +layout(location=0) in float scalar; +layout(location=1) in vec3 vector; + +layout(location=0) out vec4 result; + +void main() { + result = vec4(1.0); + + result.w *= sinh(scalar); + result.w *= cosh(scalar); + result.w *= tanh(scalar); + + result.w *= asinh(scalar); + result.w *= acosh(scalar); + result.w *= atanh(scalar); + + result.xyz *= sinh(vector); + result.xyz *= cosh(vector); + result.xyz *= tanh(vector); + + result.xyz *= asinh(vector); + result.xyz *= acosh(vector); + result.xyz *= atanh(vector); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/image-query-selective.frag b/third_party/spirv-cross/shaders-hlsl/frag/image-query-selective.frag new file mode 100644 index 0000000000..bb595bcb9b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/image-query-selective.frag @@ -0,0 +1,35 @@ +#version 450 + +layout(binding = 0) uniform usampler1D uSampler1DUint; +layout(binding = 0) uniform isampler1D uSampler1DInt; +layout(binding = 0) uniform sampler1D uSampler1DFloat; +layout(binding = 1) uniform sampler2D uSampler2D; +layout(binding = 2) uniform isampler2DArray uSampler2DArray; +layout(binding = 3) uniform sampler3D uSampler3D; +layout(binding = 4) uniform samplerCube uSamplerCube; +layout(binding = 5) uniform usamplerCubeArray uSamplerCubeArray; +layout(binding = 6) uniform samplerBuffer uSamplerBuffer; +layout(binding = 7) uniform isampler2DMS uSamplerMS; +layout(binding = 8) uniform sampler2DMSArray uSamplerMSArray; + +void main() +{ + int a = textureSize(uSampler1DUint, 0); + a = textureSize(uSampler1DInt, 0); + a = textureSize(uSampler1DFloat, 0); + + ivec3 c = textureSize(uSampler2DArray, 0); + ivec3 d = textureSize(uSampler3D, 0); + ivec2 e = textureSize(uSamplerCube, 0); + ivec3 f = textureSize(uSamplerCubeArray, 0); + int g = textureSize(uSamplerBuffer); + ivec2 h = textureSize(uSamplerMS); + ivec3 i = textureSize(uSamplerMSArray); + + int l1 = textureQueryLevels(uSampler2D); + int l2 = textureQueryLevels(uSampler2DArray); + int l3 = textureQueryLevels(uSampler3D); + int l4 = textureQueryLevels(uSamplerCube); + int s0 = textureSamples(uSamplerMS); + int s1 = textureSamples(uSamplerMSArray); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.frag b/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.frag new file mode 100644 index 0000000000..25103e6e95 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(rgba32f, binding = 0) uniform writeonly image1D uImage1D; +layout(rg32f, binding = 1) uniform writeonly image2D uImage2D; +layout(r32f, binding = 2) uniform readonly image2DArray uImage2DArray; +layout(rgba8, binding = 3) uniform writeonly image3D uImage3D; +layout(rgba8_snorm, binding = 6) uniform writeonly imageBuffer uImageBuffer; + +// There is no RWTexture2DMS. + +void main() +{ + int a = imageSize(uImage1D); + ivec2 b = imageSize(uImage2D); + ivec3 c = imageSize(uImage2DArray); + ivec3 d = imageSize(uImage3D); + int e = imageSize(uImageBuffer); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag b/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag new file mode 100644 index 0000000000..25103e6e95 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/image-query-uav.nonwritable-uav-texture.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(rgba32f, binding = 0) uniform writeonly image1D uImage1D; +layout(rg32f, binding = 1) uniform writeonly image2D uImage2D; +layout(r32f, binding = 2) uniform readonly image2DArray uImage2DArray; +layout(rgba8, binding = 3) uniform writeonly image3D uImage3D; +layout(rgba8_snorm, binding = 6) uniform writeonly imageBuffer uImageBuffer; + +// There is no RWTexture2DMS. + +void main() +{ + int a = imageSize(uImage1D); + ivec2 b = imageSize(uImage2D); + ivec3 c = imageSize(uImage2DArray); + ivec3 d = imageSize(uImage3D); + int e = imageSize(uImageBuffer); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/image-query.frag b/third_party/spirv-cross/shaders-hlsl/frag/image-query.frag new file mode 100644 index 0000000000..8e840fba11 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/image-query.frag @@ -0,0 +1,33 @@ +#version 450 + +layout(binding = 0) uniform sampler1D uSampler1D; +layout(binding = 1) uniform sampler2D uSampler2D; +layout(binding = 2) uniform sampler2DArray uSampler2DArray; +layout(binding = 3) uniform sampler3D uSampler3D; +layout(binding = 4) uniform samplerCube uSamplerCube; +layout(binding = 5) uniform samplerCubeArray uSamplerCubeArray; +layout(binding = 6) uniform samplerBuffer uSamplerBuffer; +layout(binding = 7) uniform sampler2DMS uSamplerMS; +layout(binding = 8) uniform sampler2DMSArray uSamplerMSArray; + +void main() +{ + int a = textureSize(uSampler1D, 0); + ivec2 b = textureSize(uSampler2D, 0); + ivec3 c = textureSize(uSampler2DArray, 0); + ivec3 d = textureSize(uSampler3D, 0); + ivec2 e = textureSize(uSamplerCube, 0); + ivec3 f = textureSize(uSamplerCubeArray, 0); + int g = textureSize(uSamplerBuffer); + ivec2 h = textureSize(uSamplerMS); + ivec3 i = textureSize(uSamplerMSArray); + + int l0 = textureQueryLevels(uSampler1D); + int l1 = textureQueryLevels(uSampler2D); + int l2 = textureQueryLevels(uSampler2DArray); + int l3 = textureQueryLevels(uSampler3D); + int l4 = textureQueryLevels(uSamplerCube); + int l5 = textureQueryLevels(uSamplerCubeArray); + int s0 = textureSamples(uSamplerMS); + int s1 = textureSamples(uSamplerMSArray); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/input-attachment-ms.frag b/third_party/spirv-cross/shaders-hlsl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..b3d44c9436 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/input-attachment-ms.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInputMS uInput) +{ + return subpassLoad(uInput, gl_SampleID); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + load_subpasses(uSubpass0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/input-attachment.frag b/third_party/spirv-cross/shaders-hlsl/frag/input-attachment.frag new file mode 100644 index 0000000000..877d0525a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/input-attachment.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInput uInput) +{ + return subpassLoad(uInput); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0) + load_subpasses(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/io-block.frag b/third_party/spirv-cross/shaders-hlsl/frag/io-block.frag new file mode 100644 index 0000000000..1e3e3d77e8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/io-block.frag @@ -0,0 +1,16 @@ +#version 310 es +#extension GL_EXT_shader_io_blocks : require +precision mediump float; + +layout(location = 1) in VertexOut +{ + vec4 a; + vec4 b; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = a + b; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag b/third_party/spirv-cross/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag new file mode 100644 index 0000000000..30b957b26b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/legacy-tex-modifiers.sm30.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 0) uniform sampler2D uSampler; + +void main() +{ + FragColor = textureProj(uSampler, vec3(vUV, 5.0)); + FragColor += texture(uSampler, vUV, 3.0); + FragColor += textureLod(uSampler, vUV, 2.0); + FragColor += textureGrad(uSampler, vUV, vec2(4.0), vec2(5.0)); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/lut-promotion.frag b/third_party/spirv-cross/shaders-hlsl/frag/lut-promotion.frag new file mode 100644 index 0000000000..0cdc8148f9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/lut-promotion.frag @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; +layout(location = 0) out float FragColor; +layout(location = 0) flat in int index; + +const float LUT[16] = float[]( + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0); + +void main() +{ + // Try reading LUTs, both in branches and not branch. + FragColor = LUT[index]; + if (index < 10) + FragColor += LUT[index ^ 1]; + else + FragColor += LUT[index & 1]; + + // Not declared as a LUT, but can be promoted to one. + vec4 foo[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + FragColor += foo[index & 3].y; + } + else + { + FragColor += foo[index & 1].x; + } + + // Not declared as a LUT, but this cannot be promoted, because we have a partial write. + vec4 foobar[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + foobar[1].z = 20.0; + } + FragColor += foobar[index & 3].z; + + // Not declared as a LUT, but this cannot be promoted, because we have two complete writes. + vec4 baz[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[index & 3].z; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/matrix-input.frag b/third_party/spirv-cross/shaders-hlsl/frag/matrix-input.frag new file mode 100644 index 0000000000..ffe242cec2 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/matrix-input.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 1) in mat4 m; + +void main() +{ + FragColor = m[0] + m[1] + m[2] + m[3]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/mod.frag b/third_party/spirv-cross/shaders-hlsl/frag/mod.frag new file mode 100644 index 0000000000..32edb61841 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/mod.frag @@ -0,0 +1,22 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 a4; +layout(location = 1) in vec3 a3; +layout(location = 2) in vec2 a2; +layout(location = 3) in float a1; +layout(location = 4) in vec4 b4; +layout(location = 5) in vec3 b3; +layout(location = 6) in vec2 b2; +layout(location = 7) in float b1; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 m0 = mod(a4, b4); + vec3 m1 = mod(a3, b3); + vec2 m2 = mod(a2, b2); + float m3 = mod(a1, b1); + FragColor = m0 + m1.xyzx + m2.xyxy + m3; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/mrt.frag b/third_party/spirv-cross/shaders-hlsl/frag/mrt.frag new file mode 100644 index 0000000000..77a2bb29c7 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/mrt.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 RT0; +layout(location = 1) out vec4 RT1; +layout(location = 2) out vec4 RT2; +layout(location = 3) out vec4 RT3; + +void main() +{ + RT0 = vec4(1.0); + RT1 = vec4(2.0); + RT2 = vec4(3.0); + RT3 = vec4(4.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/no-return.frag b/third_party/spirv-cross/shaders-hlsl/frag/no-return.frag new file mode 100644 index 0000000000..f0ef8702ce --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/no-return.frag @@ -0,0 +1,5 @@ +#version 310 es + +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/no-return2.frag b/third_party/spirv-cross/shaders-hlsl/frag/no-return2.frag new file mode 100644 index 0000000000..46bf9fbf20 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/no-return2.frag @@ -0,0 +1,9 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; + +void main() +{ + vec4 v = vColor; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag b/third_party/spirv-cross/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag new file mode 100644 index 0000000000..35373279fc --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/nonuniform-qualifier.nonuniformresource.sm51.frag @@ -0,0 +1,52 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(set = 0, binding = 0) uniform texture2D uSamplers[]; +layout(set = 1, binding = 0) uniform texture2DMS uSamplersMS[]; +layout(set = 2, binding = 4) uniform sampler2D uCombinedSamplers[]; +layout(set = 3, binding = 1) uniform sampler uSamps[]; +layout(location = 0) flat in int vIndex; +layout(location = 1) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +layout(r32f, set = 7, binding = 5) uniform image2D uImages[]; +layout(r32ui, set = 8, binding = 5) uniform uimage2D uImagesU32[]; + +layout(set = 9, binding = 2) uniform UBO +{ + vec4 v[64]; +} ubos[]; + +layout(set = 10, binding = 3) buffer SSBO +{ + uint counter; + vec4 v[]; +} ssbos[]; + +void main() +{ + int i = vIndex; + FragColor = texture(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + FragColor = texture(uCombinedSamplers[nonuniformEXT(i + 10)], vUV); + FragColor += ubos[nonuniformEXT(i + 20)].v[nonuniformEXT(i + 40)]; + FragColor += ssbos[nonuniformEXT(i + 50)].v[nonuniformEXT(i + 60)]; + ssbos[nonuniformEXT(i + 60)].v[nonuniformEXT(i + 70)] = vec4(20.0); + + FragColor = texelFetch(uSamplers[nonuniformEXT(i + 10)], ivec2(vUV), 0); + atomicAdd(ssbos[nonuniformEXT(i + 100)].counter, 100u); + + vec2 queried = textureQueryLod(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + queried += textureQueryLod(uCombinedSamplers[nonuniformEXT(i + 10)], vUV); + FragColor.xy += queried; + + FragColor.x += float(textureQueryLevels(uSamplers[nonuniformEXT(i + 20)])); + FragColor.y += float(textureSamples(uSamplersMS[nonuniformEXT(i + 20)])); + FragColor.xy += vec2(textureSize(uSamplers[nonuniformEXT(i + 20)], 0)); + + FragColor += imageLoad(uImages[nonuniformEXT(i + 50)], ivec2(vUV)); + FragColor.xy += vec2(imageSize(uImages[nonuniformEXT(i + 20)])); + imageStore(uImages[nonuniformEXT(i + 60)], ivec2(vUV), vec4(50.0)); + + imageAtomicAdd(uImagesU32[nonuniformEXT(i + 70)], ivec2(vUV), 40u); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/partial-write-preserve.frag b/third_party/spirv-cross/shaders-hlsl/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..f30270b91b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/partial-write-preserve.frag @@ -0,0 +1,64 @@ +#version 310 es +precision mediump float; + +layout(std140, binding = 0) uniform UBO +{ + int some_value; +}; + +struct B +{ + float a; + float b; +}; + +void partial_inout(inout vec4 x) +{ + x.x = 10.0; +} + +void partial_inout(inout B b) +{ + b.b = 40.0; +} + +// Make a complete write, but only conditionally ... +void branchy_inout(inout vec4 v) +{ + v.y = 20.0; + if (some_value == 20) + { + v = vec4(50.0); + } +} + +void branchy_inout_2(out vec4 v) +{ + if (some_value == 20) + { + v = vec4(50.0); + } + else + { + v = vec4(70.0); + } + v.y = 20.0; +} + +void complete_inout(out vec4 x) +{ + x = vec4(50.0); +} + +void main() +{ + vec4 a = vec4(10.0); + partial_inout(a); + complete_inout(a); + branchy_inout(a); + branchy_inout_2(a); + + B b = B(10.0, 20.0); + partial_inout(b); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag b/third_party/spirv-cross/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag new file mode 100644 index 0000000000..ceac8cc50e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/pixel-interlock-ordered.sm51.fxconly.frag @@ -0,0 +1,36 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(pixel_interlock_ordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2, rgba8) uniform readonly image2D img3; +layout(binding = 3) coherent buffer Buffer +{ + int foo; + uint bar; +}; +layout(binding = 4) buffer Buffer2 +{ + uint quux; +}; + +layout(binding = 5, rgba8) uniform writeonly image2D img4; +layout(binding = 6) buffer Buffer3 +{ + int baz; +}; + +void main() +{ + // Deliberately outside the critical section to test usage tracking. + baz = 0; + imageStore(img4, ivec2(1, 1), vec4(1.0, 0.0, 0.0, 1.0)); + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), imageLoad(img3, ivec2(0, 0))); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, quux); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/point-coord-compat.frag b/third_party/spirv-cross/shaders-hlsl/frag/point-coord-compat.frag new file mode 100644 index 0000000000..dc7d6b55fb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/point-coord-compat.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + FragColor = gl_PointCoord; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/query-lod.desktop.frag b/third_party/spirv-cross/shaders-hlsl/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..0cb160402f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/query-lod.desktop.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) in vec2 vTexCoord; +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureQueryLod(uSampler, vTexCoord).xyxy; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag b/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag new file mode 100644 index 0000000000..cd035467be --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.force-uav.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 0) coherent readonly buffer SSBO +{ + vec4 a; +}; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = a; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.frag b/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.frag new file mode 100644 index 0000000000..cd035467be --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/readonly-coherent-ssbo.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 0) coherent readonly buffer SSBO +{ + vec4 a; +}; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = a; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/resources.frag b/third_party/spirv-cross/shaders-hlsl/frag/resources.frag new file mode 100644 index 0000000000..16178bfd77 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/resources.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(binding = 3, std140) uniform CBuffer +{ + vec4 a; +} cbuf; + +layout(binding = 4) uniform sampler2D uSampledImage; +layout(binding = 5) uniform mediump texture2D uTexture; +layout(binding = 6) uniform mediump sampler uSampler; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; + +layout(std430, push_constant) uniform PushMe +{ + vec4 d; +} registers; + +void main() +{ + vec4 c0 = texture(uSampledImage, vTex); + vec4 c1 = texture(sampler2D(uTexture, uSampler), vTex); + vec4 c2 = cbuf.a + registers.d; + FragColor = c0 + c1 + c2; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/row-major-layout-in-struct.frag b/third_party/spirv-cross/shaders-hlsl/frag/row-major-layout-in-struct.frag new file mode 100644 index 0000000000..3e93bb2b43 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/row-major-layout-in-struct.frag @@ -0,0 +1,29 @@ +#version 450 + +struct Foo +{ + mat4 v; + mat4 w; +}; + +struct NonFoo +{ + mat4 v; + mat4 w; +}; + +layout(std140, binding = 0) uniform UBO +{ + layout(column_major) Foo foo; +}; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vUV; + +void main() +{ + NonFoo f; + f.v = foo.v; + f.w = foo.w; + FragColor = f.v * (f.w * vUV); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sample-cmp-level-zero.frag b/third_party/spirv-cross/shaders-hlsl/frag/sample-cmp-level-zero.frag new file mode 100644 index 0000000000..c40d742eeb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sample-cmp-level-zero.frag @@ -0,0 +1,27 @@ +#version 450 + +layout(location = 0) out float FragColor; +layout(binding = 0) uniform sampler2DShadow uSampler2D; +layout(binding = 1) uniform sampler2DArrayShadow uSampler2DArray; +layout(binding = 2) uniform samplerCubeShadow uSamplerCube; +layout(binding = 3) uniform samplerCubeArrayShadow uSamplerCubeArray; + +layout(location = 0) in vec3 vUVRef; +layout(location = 1) in vec4 vDirRef; + +void main() +{ + float s0 = textureOffset(uSampler2D, vUVRef, ivec2(-1)); + float s1 = textureOffset(uSampler2DArray, vDirRef, ivec2(-1)); + float s2 = texture(uSamplerCube, vDirRef); + float s3 = texture(uSamplerCubeArray, vDirRef, 0.5); + + float l0 = textureLodOffset(uSampler2D, vUVRef, 0.0, ivec2(-1)); + float l1 = textureGradOffset(uSampler2DArray, vDirRef, vec2(0.0), vec2(0.0), ivec2(-1)); + float l2 = textureGrad(uSamplerCube, vDirRef, vec3(0.0), vec3(0.0)); + + float p0 = textureProjOffset(uSampler2D, vDirRef, ivec2(+1)); + float p1 = textureProjLodOffset(uSampler2D, vDirRef, 0.0, ivec2(+1)); + + FragColor = s0 + s1 + s2 + s3 + l0 + l1 + l2 + p0 + p1; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in-and-out.frag b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in-and-out.frag new file mode 100644 index 0000000000..75ed3cc167 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in-and-out.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = gl_SampleMaskIn[0]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in.frag b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in.frag new file mode 100644 index 0000000000..16031a3557 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-in.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + if ((gl_SampleMaskIn[0] & (1 << gl_SampleID)) != 0) + { + FragColor = vec4(1.0); + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-out.frag b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-out.frag new file mode 100644 index 0000000000..c7fb80eba9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sample-mask-out.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = 0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sampler-array.frag b/third_party/spirv-cross/shaders-hlsl/frag/sampler-array.frag new file mode 100644 index 0000000000..75910ed163 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sampler-array.frag @@ -0,0 +1,28 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uCombined[4]; +layout(binding = 4) uniform texture2D uTex[4]; +layout(binding = 8) uniform sampler uSampler[4]; +layout(binding = 12, rgba32f) uniform writeonly image2D uImage[8]; +layout(location = 0) in vec2 vTex; +layout(location = 1) flat in int vIndex; + +vec4 sample_in_function(sampler2D samp) +{ + return texture(samp, vTex); +} + +vec4 sample_in_function2(texture2D tex, sampler samp) +{ + return texture(sampler2D(tex, samp), vTex); +} + +void main() +{ + vec4 color = texture(uCombined[vIndex], vTex); + color += texture(sampler2D(uTex[vIndex], uSampler[vIndex]), vTex); + color += sample_in_function(uCombined[vIndex + 1]); + color += sample_in_function2(uTex[vIndex + 1], uSampler[vIndex + 1]); + + imageStore(uImage[vIndex], ivec2(gl_FragCoord.xy), color); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/sampler-image-arrays.frag b/third_party/spirv-cross/shaders-hlsl/frag/sampler-image-arrays.frag new file mode 100644 index 0000000000..42370d9728 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/sampler-image-arrays.frag @@ -0,0 +1,33 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in vec2 vTex; +layout(location = 1) flat in int vIndex; +layout(binding = 0) uniform sampler2D uSampler[4]; +layout(binding = 4) uniform sampler uSamplers[4]; +layout(binding = 8) uniform texture2D uTextures[4]; + +vec4 sample_from_argument(sampler2D samplers[4]) +{ + return texture(samplers[vIndex], vTex + 0.2); +} + +vec4 sample_single_from_argument(sampler2D samp) +{ + return texture(samp, vTex + 0.3); +} + +vec4 sample_from_global() +{ + return texture(uSampler[vIndex], vTex + 0.1); +} + +void main() +{ + FragColor = vec4(0.0); + FragColor += texture(sampler2D(uTextures[2], uSamplers[1]), vTex); + FragColor += texture(uSampler[vIndex], vTex); + FragColor += sample_from_global(); + FragColor += sample_from_argument(uSampler); + FragColor += sample_single_from_argument(uSampler[3]); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/shaders-hlsl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..486ed90bd5 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/scalar-refract-reflect.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vRefract; + +void main() +{ + FragColor = refract(vRefract.x, vRefract.y, vRefract.z); + FragColor += reflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag b/third_party/spirv-cross/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag new file mode 100644 index 0000000000..22d18a26a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/separate-combined-fake-overload.sm30.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uSamp; +layout(binding = 1) uniform texture2D uT; +layout(binding = 2) uniform sampler uS; + +vec4 samp(sampler2D uSamp) +{ + return texture(uSamp, vec2(0.5)); +} + +vec4 samp(texture2D T, sampler S) +{ + return texture(sampler2D(T, S), vec2(0.5)); +} + +void main() +{ + FragColor = samp(uSamp) + samp(uT, uS); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..8d2b1f326f --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-block-size.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +layout(constant_id = 10) const int Value = 2; +layout(binding = 0) uniform SpecConstArray +{ + vec4 samples[Value]; +}; + +layout(location = 0) flat in int Index; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = samples[Index]; +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..78dccbf044 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/spec-constant-ternary.frag @@ -0,0 +1,9 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(constant_id = 0) const uint s = 10u; +const uint f = s > 20u ? 30u : 50u; + +void main() +{ + FragColor = float(f); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/shaders-hlsl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..b0421e60ef --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/switch-unreachable-break.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vInput; + +layout(set = 0, binding = 0) uniform UBO +{ + int cond; + int cond2; +}; + +void main() +{ + bool frog = false; + switch (cond) + { + case 1: + if (cond2 < 50) + break; + else + discard; + + break; + + default: + frog = true; + break; + } + + FragColor = frog ? vec4(10.0) : vec4(20.0); +} + diff --git a/third_party/spirv-cross/shaders-hlsl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/shaders-hlsl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..d8aee43a6c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/switch-unsigned-case.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; + +#define ENUM_0 0u +#define ENUM_1 1u + +layout(set = 0, binding = 0) uniform Buff +{ + uint TestVal; +}; + +layout(location = 0) out vec4 fsout_Color; + +void main() +{ + fsout_Color = vec4(1.0); + switch (TestVal) + { + case ENUM_0: + fsout_Color = vec4(0.1); + break; + case ENUM_1: + fsout_Color = vec4(0.2); + break; + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/swizzle-scalar.frag b/third_party/spirv-cross/shaders-hlsl/frag/swizzle-scalar.frag new file mode 100644 index 0000000000..c27524f7a6 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/swizzle-scalar.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) flat in float vFloat; +layout(location = 1) flat in int vInt; +layout(location = 0) out vec4 Float; +layout(location = 1) out ivec4 Int; +layout(location = 2) out vec4 Float2; +layout(location = 3) out ivec4 Int2; + +void main() +{ + Float = vec4(vFloat) * 2.0; + Int = ivec4(vInt) * 2; + Float2 = vec4(10.0); + Int2 = ivec4(10); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling-ms.frag b/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling-ms.frag new file mode 100644 index 0000000000..7badbb1a35 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling-ms.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2DMS uTex; + +void main() +{ + FragColor = + texelFetch(uTex, ivec2(gl_FragCoord.xy), 0); + FragColor += + texelFetch(uTex, ivec2(gl_FragCoord.xy), 1); + FragColor += + texelFetch(uTex, ivec2(gl_FragCoord.xy), 2); + FragColor += + texelFetch(uTex, ivec2(gl_FragCoord.xy), 3); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling.frag b/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling.frag new file mode 100644 index 0000000000..762c60ac6e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/tex-sampling.frag @@ -0,0 +1,81 @@ +#version 450 + +layout(binding = 0) uniform sampler1D tex1d; +layout(binding = 1) uniform sampler2D tex2d; +layout(binding = 2) uniform sampler3D tex3d; +layout(binding = 3) uniform samplerCube texCube; + +layout(binding = 4) uniform sampler1DShadow tex1dShadow; +layout(binding = 5) uniform sampler2DShadow tex2dShadow; +layout(binding = 6) uniform samplerCubeShadow texCubeShadow; + +layout(binding = 7) uniform sampler1DArray tex1dArray; +layout(binding = 8) uniform sampler2DArray tex2dArray; +layout(binding = 9) uniform samplerCubeArray texCubeArray; + +layout(binding = 10) uniform samplerShadow samplerDepth; +layout(binding = 11) uniform sampler samplerNonDepth; +layout(binding = 12) uniform texture2D separateTex2d; +layout(binding = 13) uniform texture2D separateTex2dDepth; + +layout(location = 0) in float texCoord1d; +layout(location = 1) in vec2 texCoord2d; +layout(location = 2) in vec3 texCoord3d; +layout(location = 3) in vec4 texCoord4d; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 texcolor = texture(tex1d, texCoord1d); + texcolor += textureOffset(tex1d, texCoord1d, 1); + texcolor += textureLod(tex1d, texCoord1d, 2); + texcolor += textureGrad(tex1d, texCoord1d, 1.0, 2.0); + texcolor += textureProj(tex1d, vec2(texCoord1d, 2.0)); + texcolor += texture(tex1d, texCoord1d, 1.0); + + texcolor += texture(tex2d, texCoord2d); + texcolor += textureOffset(tex2d, texCoord2d, ivec2(1, 2)); + texcolor += textureLod(tex2d, texCoord2d, 2); + texcolor += textureGrad(tex2d, texCoord2d, vec2(1.0, 2.0), vec2(3.0, 4.0)); + texcolor += textureProj(tex2d, vec3(texCoord2d, 2.0)); + texcolor += texture(tex2d, texCoord2d, 1.0); + + texcolor += texture(tex3d, texCoord3d); + texcolor += textureOffset(tex3d, texCoord3d, ivec3(1, 2, 3)); + texcolor += textureLod(tex3d, texCoord3d, 2); + texcolor += textureGrad(tex3d, texCoord3d, vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0)); + texcolor += textureProj(tex3d, vec4(texCoord3d, 2.0)); + texcolor += texture(tex3d, texCoord3d, 1.0); + + texcolor += texture(texCube, texCoord3d); + texcolor += textureLod(texCube, texCoord3d, 2); + texcolor += texture(texCube, texCoord3d, 1.0); + + texcolor.a += texture(tex1dShadow, vec3(texCoord1d, 0.0, 0.0)); + texcolor.a += texture(tex2dShadow, vec3(texCoord2d, 0.0)); + texcolor.a += texture(texCubeShadow, vec4(texCoord3d, 0.0)); + + texcolor += texture(tex1dArray, texCoord2d); + texcolor += texture(tex2dArray, texCoord3d); + texcolor += texture(texCubeArray, texCoord4d); + + texcolor += textureGather(tex2d, texCoord2d); + texcolor += textureGather(tex2d, texCoord2d, 0); + texcolor += textureGather(tex2d, texCoord2d, 1); + texcolor += textureGather(tex2d, texCoord2d, 2); + texcolor += textureGather(tex2d, texCoord2d, 3); + + texcolor += textureGatherOffset(tex2d, texCoord2d, ivec2(1, 1)); + texcolor += textureGatherOffset(tex2d, texCoord2d, ivec2(1, 1), 0); + texcolor += textureGatherOffset(tex2d, texCoord2d, ivec2(1, 1), 1); + texcolor += textureGatherOffset(tex2d, texCoord2d, ivec2(1, 1), 2); + texcolor += textureGatherOffset(tex2d, texCoord2d, ivec2(1, 1), 3); + + texcolor += texelFetch(tex2d, ivec2(1, 2), 0); + + texcolor += texture(sampler2D(separateTex2d, samplerNonDepth), texCoord2d); + texcolor.a += texture(sampler2DShadow(separateTex2dDepth, samplerDepth), texCoord3d); + + FragColor = texcolor; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/shaders-hlsl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..0c4cf8f5a8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/texture-proj-shadow.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(binding = 0) uniform sampler1DShadow uShadow1D; +layout(binding = 1) uniform sampler2DShadow uShadow2D; +layout(binding = 2) uniform sampler1D uSampler1D; +layout(binding = 3) uniform sampler2D uSampler2D; +layout(binding = 4) uniform sampler3D uSampler3D; + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vClip3; +layout(location = 1) in vec4 vClip4; +layout(location = 2) in vec2 vClip2; + +void main() +{ + FragColor = textureProj(uShadow1D, vClip4); + FragColor = textureProj(uShadow2D, vClip4); + FragColor = textureProj(uSampler1D, vClip2).x; + FragColor = textureProj(uSampler2D, vClip3).x; + FragColor = textureProj(uSampler3D, vClip4).x; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag b/third_party/spirv-cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag new file mode 100644 index 0000000000..9488059595 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/texture-size-combined-image-sampler.frag @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) uniform texture2D uTex; +layout(set = 0, binding = 1) uniform sampler uSampler; +layout(location = 0) out ivec2 FooOut; + +void main() +{ + FooOut = textureSize(sampler2D(uTex, uSampler), 0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/unary-enclose.frag b/third_party/spirv-cross/shaders-hlsl/frag/unary-enclose.frag new file mode 100644 index 0000000000..ea502e1de8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/unary-enclose.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn; +layout(location = 1) flat in ivec4 vIn1; + +void main() +{ + FragColor = +(-(-vIn)); + ivec4 a = ~(~vIn1); + + bool b = false; + b = !!b; +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/unorm-snorm-packing.frag b/third_party/spirv-cross/shaders-hlsl/frag/unorm-snorm-packing.frag new file mode 100644 index 0000000000..c0a01aaf8b --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/unorm-snorm-packing.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(location = 0) flat in uint SNORM8; +layout(location = 1) flat in uint UNORM8; +layout(location = 2) flat in uint SNORM16; +layout(location = 3) flat in uint UNORM16; +layout(location = 4) flat in vec4 FP32; +layout(location = 0) out vec4 FP32Out; +layout(location = 1) out uint UNORM8Out; +layout(location = 2) out uint SNORM8Out; +layout(location = 3) out uint UNORM16Out; +layout(location = 4) out uint SNORM16Out; + +void main() +{ + FP32Out = unpackUnorm4x8(UNORM8); + FP32Out = unpackSnorm4x8(SNORM8); + FP32Out.xy = unpackUnorm2x16(UNORM16); + FP32Out.xy = unpackSnorm2x16(SNORM16); + UNORM8Out = packUnorm4x8(FP32); + SNORM8Out = packSnorm4x8(FP32); + UNORM16Out = packUnorm2x16(FP32.xy); + SNORM16Out = packSnorm2x16(FP32.zw); +} diff --git a/third_party/spirv-cross/shaders-hlsl/frag/various-glsl-ops.frag b/third_party/spirv-cross/shaders-hlsl/frag/various-glsl-ops.frag new file mode 100644 index 0000000000..0d4af80a6e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/frag/various-glsl-ops.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) in vec2 interpolant; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 color = vec4(0.0, 0.0, 0.0, interpolateAtOffset(interpolant, vec2(0.1, 0.1))); + + // glslang's HLSL parser currently fails here + //color += vec4(0.0, 0.0, 0.0, interpolateAtSample(interpolant, gl_SampleID)); + //color += vec4(0.0, 0.0, 0.0, interpolateAtCentroid(interpolant)); + + color += vec4(0.0, 0.0, 0.0, dFdxCoarse(interpolant.x)); + FragColor = color; +} diff --git a/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh b/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..4f9500fe17 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh @@ -0,0 +1,74 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(lines, max_vertices = 24, max_primitives = 22) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +layout(location = 0) out vec4 vOut[]; +layout(location = 1) perprimitiveEXT out vec4 vPrim[]; + +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[]; + +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[]; + +shared float shared_float[16]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main3() +{ + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uvec2(0, 1) + gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = bool(gl_GlobalInvocationID.x & 1); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; +} + +void main2() +{ + SetMeshOutputsEXT(24, 22); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); + // gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 6.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(gl_GlobalInvocationID, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22) + { + vPrim[gl_LocalInvocationIndex] = vec4(gl_WorkGroupID, 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + main3(); + } +} + +void main() +{ + main2(); +} diff --git a/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh b/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..4d8e3f6494 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh @@ -0,0 +1,64 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(triangles, max_vertices = 24, max_primitives = 22) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +layout(location = 0) out vec4 vOut[]; +layout(location = 1) perprimitiveEXT out vec4 vPrim[]; + +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[]; + +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[]; + +shared float shared_float[16]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main() +{ + SetMeshOutputsEXT(24, 22); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); + // gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 3.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(gl_GlobalInvocationID, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22) + { + vPrim[gl_LocalInvocationIndex] = vec4(gl_WorkGroupID, 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0, 1, 2) + gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = bool(gl_GlobalInvocationID.x & 1); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} diff --git a/third_party/spirv-cross/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task b/third_party/spirv-cross/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task new file mode 100644 index 0000000000..6422977fc3 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/task/task-basic.spv14.vk.nocompat.task @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_mesh_shader : require + +layout(local_size_x = 1) in; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main() +{ + payload.a = 1.2; + payload.b = 2.3; + payload.c = 3; + + EmitMeshTasksEXT(1, 2, 3); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/basic.vert b/third_party/spirv-cross/shaders-hlsl/vert/basic.vert new file mode 100644 index 0000000000..f03114feef --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/basic.vert @@ -0,0 +1,15 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/clip-cull-distance.vert b/third_party/spirv-cross/shaders-hlsl/vert/clip-cull-distance.vert new file mode 100644 index 0000000000..34f65fc18e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/clip-cull-distance.vert @@ -0,0 +1,11 @@ +#version 450 +out float gl_ClipDistance[2]; +out float gl_CullDistance[1]; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_CullDistance[0] = 4.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/instancing.vert b/third_party/spirv-cross/shaders-hlsl/vert/instancing.vert new file mode 100644 index 0000000000..0e62ef6b0e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/instancing.vert @@ -0,0 +1,6 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(float(gl_VertexIndex + gl_InstanceIndex)); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/invariant.vert b/third_party/spirv-cross/shaders-hlsl/vert/invariant.vert new file mode 100644 index 0000000000..239b985da1 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/invariant.vert @@ -0,0 +1,13 @@ +#version 310 es + +invariant gl_Position; +layout(location = 0) invariant out vec4 vColor; +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; +layout(location = 2) in vec4 vInput2; + +void main() +{ + gl_Position = vInput0 + vInput1 * vInput2; + vColor = (vInput0 - vInput1) * vInput2; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/legacy-int-attribute.sm30.vert b/third_party/spirv-cross/shaders-hlsl/vert/legacy-int-attribute.sm30.vert new file mode 100644 index 0000000000..6f88febfb9 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/legacy-int-attribute.sm30.vert @@ -0,0 +1,10 @@ +#version 310 es + +layout(location=0) in ivec4 attr_int4; +layout(location=1) in int attr_int1; + +void main() +{ + gl_Position.x = float(attr_int4[attr_int1]); + gl_Position.yzw = vec3(0.0f, 0.0f, 0.0f); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/locations.vert b/third_party/spirv-cross/shaders-hlsl/vert/locations.vert new file mode 100644 index 0000000000..df1a44e923 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/locations.vert @@ -0,0 +1,51 @@ +#version 310 es +#extension GL_EXT_shader_io_blocks : require + +struct Foo +{ + vec3 a; + vec3 b; + vec3 c; +}; + +// This will lock to input location 2. +layout(location = 2) in vec4 Input2; +// This will lock to input location 4. +layout(location = 4) in vec4 Input4; +// This will pick first available, which is 0. +layout(location = 0) in vec4 Input0; + +// Locks output 0. +layout(location = 0) out float vLocation0; +// Locks output 1. +layout(location = 1) out float vLocation1; +// Picks first available two locations, so, 2 and 3. +layout(location = 2) out float vLocation2[2]; +// Picks first available location, 4. +layout(location = 4) out Foo vLocation4; +// Picks first available location 9. +layout(location = 9) out float vLocation9; + +// Locks location 7 and 8. +layout(location = 7) out VertexOut +{ + vec3 color; + vec3 foo; +} vout; + +void main() +{ + gl_Position = vec4(1.0) + Input2 + Input4 + Input0; + vLocation0 = 0.0; + vLocation1 = 1.0; + vLocation2[0] = 2.0; + vLocation2[1] = 2.0; + Foo foo; + foo.a = vec3(1.0); + foo.b = vec3(1.0); + foo.c = vec3(1.0); + vLocation4 = foo; + vLocation9 = 9.0; + vout.color = vec3(2.0); + vout.foo = vec3(4.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/matrix-attribute.vert b/third_party/spirv-cross/shaders-hlsl/vert/matrix-attribute.vert new file mode 100644 index 0000000000..8a1393f8d6 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/matrix-attribute.vert @@ -0,0 +1,9 @@ +#version 310 es + +layout(location = 0) in vec3 pos; +layout(location = 1) in mat4 m; + +void main() +{ + gl_Position = m * vec4(pos, 1.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/matrix-output.vert b/third_party/spirv-cross/shaders-hlsl/vert/matrix-output.vert new file mode 100644 index 0000000000..1151d4bd32 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/matrix-output.vert @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out mat4 m; + +void main() +{ + gl_Position = vec4(1.0); + m = mat4(1.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/no-contraction.vert b/third_party/spirv-cross/shaders-hlsl/vert/no-contraction.vert new file mode 100644 index 0000000000..206fbf0de8 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/no-contraction.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; + +void main() +{ + precise vec4 mul = vA * vB; + precise vec4 add = vA + vB; + precise vec4 sub = vA - vB; + precise vec4 mad = vA * vB + vC; + precise vec4 summed = mul + add + sub + mad; + gl_Position = summed; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/no-input.vert b/third_party/spirv-cross/shaders-hlsl/vert/no-input.vert new file mode 100644 index 0000000000..8de8e816a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/no-input.vert @@ -0,0 +1,6 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/point-size-compat.vert b/third_party/spirv-cross/shaders-hlsl/vert/point-size-compat.vert new file mode 100644 index 0000000000..ed86c764a6 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/point-size-compat.vert @@ -0,0 +1,7 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(1.0); + gl_PointSize = 1.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/point-size.sm30.vert b/third_party/spirv-cross/shaders-hlsl/vert/point-size.sm30.vert new file mode 100644 index 0000000000..6a122bd2eb --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/point-size.sm30.vert @@ -0,0 +1,7 @@ +#version 310 es + +void main() +{ + gl_Position = vec4(1.0); + gl_PointSize = 4.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/qualifiers.vert b/third_party/spirv-cross/shaders-hlsl/vert/qualifiers.vert new file mode 100644 index 0000000000..080a70915c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/qualifiers.vert @@ -0,0 +1,27 @@ +#version 450 + +layout(location = 0) flat out float vFlat; +layout(location = 1) centroid out float vCentroid; +layout(location = 2) sample out float vSample; +layout(location = 3) noperspective out float vNoperspective; + +layout(location = 4) out Block +{ + flat float vFlat; + centroid float vCentroid; + sample float vSample; + noperspective float vNoperspective; +} vout; + +void main() +{ + gl_Position = vec4(1.0); + vFlat = 0.0; + vCentroid = 1.0; + vSample = 2.0; + vNoperspective = 3.0; + vout.vFlat = 0.0; + vout.vCentroid = 1.0; + vout.vSample = 2.0; + vout.vNoperspective = 3.0; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/shaders-hlsl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..792fb8e36c --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/read-from-row-major-array.vert @@ -0,0 +1,20 @@ +#version 310 es +layout(location = 0) in highp vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +layout(set = 0, binding = 0, std140, row_major) uniform Block +{ + highp mat2x3 var[3][4]; +}; + +mediump float compare_float (highp float a, highp float b) { return abs(a - b) < 0.05 ? 1.0 : 0.0; } +mediump float compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)*compare_float(a.y, b.y)*compare_float(a.z, b.z); } +mediump float compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])*compare_vec3(a[1], b[1]); } + +void main (void) +{ + gl_Position = a_position; + mediump float result = 1.0; + result *= compare_mat2x3(var[0][0], mat2x3(2.0, 6.0, -6.0, 0.0, 5.0, 5.0)); + v_vtxResult = result; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/return-array.vert b/third_party/spirv-cross/shaders-hlsl/vert/return-array.vert new file mode 100644 index 0000000000..708460114e --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/return-array.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; + +vec4[2] test() +{ + return vec4[](vec4(10.0), vec4(20.0)); +} + +vec4[2] test2() +{ + vec4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +void main() +{ + gl_Position = test()[0] + test2()[1]; +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/sampler-buffers.vert b/third_party/spirv-cross/shaders-hlsl/vert/sampler-buffers.vert new file mode 100644 index 0000000000..dccbf77849 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/sampler-buffers.vert @@ -0,0 +1,17 @@ +#version 450 + +layout(binding = 1) uniform samplerBuffer uFloatSampler; +layout(binding = 2) uniform isamplerBuffer uIntSampler; +layout(binding = 3) uniform usamplerBuffer uUintSampler; + +vec4 sample_from_function(samplerBuffer s0, isamplerBuffer s1, usamplerBuffer s2) +{ + return texelFetch(s0, 20) + + intBitsToFloat(texelFetch(s1, 40)) + + uintBitsToFloat(texelFetch(s2, 60)); +} + +void main() +{ + gl_Position = sample_from_function(uFloatSampler, uIntSampler, uUintSampler); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/struct-composite-decl.vert b/third_party/spirv-cross/shaders-hlsl/vert/struct-composite-decl.vert new file mode 100644 index 0000000000..c527fdf518 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/struct-composite-decl.vert @@ -0,0 +1,26 @@ +#version 310 es + +layout(location = 0) in vec4 a; +layout(location = 1) in vec4 b; +layout(location = 2) in vec4 c; +layout(location = 3) in vec4 d; + +struct VOut +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +layout(location = 0) out VOut vout; + +void emit_result(VOut v) +{ + vout = v; +} + +void main() +{ + emit_result(VOut(a, b, c, d)); +} diff --git a/third_party/spirv-cross/shaders-hlsl/vert/texture_buffer.vert b/third_party/spirv-cross/shaders-hlsl/vert/texture_buffer.vert new file mode 100644 index 0000000000..b071e0c966 --- /dev/null +++ b/third_party/spirv-cross/shaders-hlsl/vert/texture_buffer.vert @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 4) uniform samplerBuffer uSamp; +layout(rgba32f, binding = 5) uniform readonly imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..87aee2db54 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %T "T" + OpMemberName %T 0 "a" + OpName %v "v" + OpName %T_0 "T" + OpMemberName %T_0 0 "b" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "foo" + OpName %_ "" + OpName %T_1 "T" + OpMemberName %T_1 0 "c" + OpName %SSBO2 "SSBO2" + OpMemberName %SSBO2 0 "bar" + OpName %__0 "" + OpMemberDecorate %T_0 0 Offset 0 + OpDecorate %_runtimearr_T_0 ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %T_1 0 Offset 0 + OpDecorate %_runtimearr_T_1 ArrayStride 16 + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %T = OpTypeStruct %float +%_ptr_Function_T = OpTypePointer Function %T + %float_40 = OpConstant %float 40 + %11 = OpConstantComposite %T %float_40 + %T_0 = OpTypeStruct %float +%_runtimearr_T_0 = OpTypeRuntimeArray %T_0 + %SSBO1 = OpTypeStruct %_runtimearr_T_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_T_0 = OpTypePointer Uniform %T_0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %T_1 = OpTypeStruct %float +%_runtimearr_T_1 = OpTypeRuntimeArray %T_1 + %SSBO2 = OpTypeStruct %_runtimearr_T_1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %__0 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int_30 = OpConstant %int 30 +%_ptr_Uniform_T_1 = OpTypePointer Uniform %T_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_T Function + OpStore %v %11 + %20 = OpLoad %T %v + %22 = OpAccessChain %_ptr_Uniform_T_0 %_ %int_0 %int_10 + %23 = OpCompositeExtract %float %20 0 + %25 = OpAccessChain %_ptr_Uniform_float %22 %int_0 + OpStore %25 %23 + %32 = OpLoad %T %v + %34 = OpAccessChain %_ptr_Uniform_T_1 %__0 %int_0 %int_30 + %35 = OpCompositeExtract %float %32 0 + %36 = OpAccessChain %_ptr_Uniform_float %34 %int_0 + OpStore %36 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp new file mode 100644 index 0000000000..0e1ce235d2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/arithmetic-conversion-signs.asm.comp @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 76 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_int16" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "s32" + OpMemberName %SSBO 1 "u32" + OpMemberName %SSBO 2 "s16" + OpMemberName %SSBO 3 "u16" + OpMemberName %SSBO 4 "f32" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpMemberDecorate %SSBO 3 Offset 10 + OpMemberDecorate %SSBO 4 Offset 12 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %short = OpTypeInt 16 1 + %ushort = OpTypeInt 16 0 + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %int %uint %short %ushort %float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_short = OpTypePointer Uniform %short + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_3 = OpConstant %int 3 +%_ptr_Uniform_ushort = OpTypePointer Uniform %ushort + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr_s32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %ptr_u32 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %ptr_s16 = OpAccessChain %_ptr_Uniform_short %_ %int_2 + %ptr_u16 = OpAccessChain %_ptr_Uniform_ushort %_ %int_3 + %ptr_f32 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %s32 = OpLoad %int %ptr_s32 + %u32 = OpLoad %uint %ptr_u32 + %s16 = OpLoad %short %ptr_s16 + %u16 = OpLoad %ushort %ptr_u16 + %f32 = OpLoad %float %ptr_f32 + + ; Sign-extend + %s16_to_s32_signed = OpSConvert %int %s16 + OpStore %ptr_s32 %s16_to_s32_signed + %s16_to_u32_signed = OpSConvert %uint %s16 + OpStore %ptr_u32 %s16_to_u32_signed + + %u16_to_s32_signed = OpSConvert %int %u16 + OpStore %ptr_s32 %u16_to_s32_signed + %u16_to_u32_signed = OpSConvert %uint %u16 + OpStore %ptr_u32 %u16_to_u32_signed + + ; Zero-extend + ; Result must be unsigned for OpUConvert. + ;%s16_to_s32_unsigned = OpUConvert %int %s16 + ;OpStore %ptr_s32 %s16_to_s32_unsigned + %s16_to_u32_unsigned = OpUConvert %uint %s16 + OpStore %ptr_u32 %s16_to_u32_unsigned + + ;%u16_to_s32_unsigned = OpUConvert %int %u16 + ;OpStore %ptr_s32 %u16_to_s32_unsigned + %u16_to_u32_unsigned = OpUConvert %uint %u16 + OpStore %ptr_u32 %u16_to_u32_unsigned + + ; Truncate (SConvert == UConvert) + %s32_to_s16_signed = OpSConvert %short %s32 + OpStore %ptr_s16 %s32_to_s16_signed + %s32_to_u16_signed = OpSConvert %ushort %s32 + OpStore %ptr_u16 %s32_to_u16_signed + + %u32_to_s16_signed = OpSConvert %short %u32 + OpStore %ptr_s16 %u32_to_s16_signed + %u32_to_u16_signed = OpSConvert %ushort %u32 + OpStore %ptr_u16 %u32_to_u16_signed + + ;%s32_to_s16_unsigned = OpUConvert %short %s32 + ;OpStore %ptr_s16 %s32_to_s16_unsigned + %s32_to_u16_unsigned = OpUConvert %ushort %s32 + OpStore %ptr_u16 %s32_to_u16_unsigned + + ;%u32_to_s16_unsigned = OpUConvert %short %u32 + ;OpStore %ptr_s16 %u32_to_s16_unsigned + %u32_to_u16_unsigned = OpUConvert %ushort %u32 + OpStore %ptr_u16 %u32_to_u16_unsigned + + ; SToF + %s16_to_f32_signed = OpConvertSToF %float %s16 + OpStore %ptr_f32 %s16_to_f32_signed + %u16_to_f32_signed = OpConvertSToF %float %u16 + OpStore %ptr_f32 %u16_to_f32_signed + %s16_to_f32_unsigned = OpConvertUToF %float %s16 + OpStore %ptr_f32 %s16_to_f32_unsigned + %u16_to_f32_unsigned = OpConvertUToF %float %u16 + OpStore %ptr_f32 %u16_to_f32_unsigned + + ; FToS + %f32_to_s16_signed = OpConvertFToS %short %f32 + OpStore %ptr_s16 %f32_to_s16_signed + %f32_to_u16_signed = OpConvertFToS %ushort %f32 + OpStore %ptr_u16 %f32_to_u16_signed + + ; FToU + %f32_to_u16_unsigned = OpConvertFToU %ushort %f32 + OpStore %ptr_u16 %f32_to_u16_unsigned + ; Result must be unsigned for FToU, so don't bother testing that. + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..3f2d141a1f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %c "c" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %SSBO = OpTypeStruct %uint %uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_0 = OpConstant %int 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_uint Function + %15 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %16 = OpAtomicLoad %uint %15 %int_1 %int_0 + OpStore %c %16 + %18 = OpLoad %uint %c + %19 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + OpAtomicStore %19 %int_1 %int_0 %18 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp new file mode 100644 index 0000000000..832a273549 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-min-max-sign.asm.comp @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %SSBO = OpTypeStruct %uint %int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%uint_4294967295 = OpConstant %uint 4294967295 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_n3 = OpConstant %int -3 + %int_4 = OpConstant %int 4 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %18 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %22 = OpAccessChain %_ptr_Uniform_int %_ %int_1 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_1 + %30 = OpAtomicUMax %uint %13 %uint_1 %uint_0 %uint_1 + %31 = OpAtomicSMin %uint %13 %uint_1 %uint_0 %uint_1 + %32 = OpAtomicUMin %uint %18 %uint_1 %uint_0 %uint_4294967295 + %33 = OpAtomicSMax %uint %18 %uint_1 %uint_0 %uint_4294967295 + %34 = OpAtomicSMax %int %22 %uint_1 %uint_0 %int_n3 + %35 = OpAtomicUMin %int %22 %uint_1 %uint_0 %int_n3 + %36 = OpAtomicSMin %int %25 %uint_1 %uint_0 %int_4 + %37 = OpAtomicUMax %int %25 %uint_1 %uint_0 %int_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..a323841596 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "count" + OpMemberName %SSBO 1 "data" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO = OpTypeStruct %uint %_runtimearr_uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_1024 = OpConstant %uint 1024 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %19 = OpAtomicIAdd %uint %16 %uint_1 %uint_0 %uint_1 + %23 = OpULessThan %bool %19 %uint_1024 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %19 + OpStore %34 %33 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp new file mode 100644 index 0000000000..0cca78f6a5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.msl24.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos; 35 +; Bound: 5550 +; Schema: 0 + OpCapability Int8 + OpCapability Int64 + OpCapability Int64 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_physical_storage_buffer" + OpMemoryModel PhysicalStorageBuffer64 Simple + OpEntryPoint GLCompute %main "main" %globals + OpExecutionMode %main LocalSize 16 16 1 + + OpDecorate %ptr_uchar ArrayStride 8 + OpDecorate %ptr_uint ArrayStride 8 + OpDecorate %ptr_array_t ArrayStride 8 + OpDecorate %array_t ArrayStride 1 + OpDecorate %struct_t Block + OpMemberDecorate %struct_t 0 Offset 0 + OpMemberDecorate %struct_t 1 Offset 8 + OpDecorate %ptr_struct ArrayStride 32 + OpDecorate %globals DescriptorSet 0 + OpDecorate %globals Binding 0 + + %void = OpTypeVoid + %uchar = OpTypeInt 8 0 + %uint = OpTypeInt 32 0 + %ulong = OpTypeInt 64 0 + %bool = OpTypeBool + + %ulong_12 = OpConstant %ulong 12 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uchar_69 = OpConstant %uchar 69 + %ulong_16 = OpConstant %ulong 16 + + %ptr_uint = OpTypePointer PhysicalStorageBuffer %uint + %ptr_uchar = OpTypePointer PhysicalStorageBuffer %uchar + + %array_t = OpTypeArray %uchar %ulong_12 +%ptr_array_t = OpTypePointer PhysicalStorageBuffer %array_t + + %struct_t = OpTypeStruct %ptr_uchar %ptr_array_t + %ptr_struct = OpTypePointer StorageBuffer %struct_t + + %void_fn = OpTypeFunction %void + %foo_t = OpTypeFunction %ptr_uint + +%ptr_uchararr_sb = OpTypePointer StorageBuffer %ptr_array_t + + %globals = OpVariable %ptr_struct StorageBuffer + + %foo = OpFunction %ptr_uint None %foo_t + %foo_entry = OpLabel + %lea2 = OpAccessChain %ptr_uchararr_sb %globals %uint_1 + %loaded2 = OpLoad %ptr_array_t %lea2 + %cast = OpConvertPtrToU %ulong %loaded2 + %adjusted = OpIAdd %ulong %cast %ulong_16 + %cast2 = OpConvertUToPtr %ptr_uint %adjusted + OpStore %cast2 %uint_1 Aligned 4 ; eliminating this store generates different code and the problem disappears + OpReturnValue %cast2 + OpFunctionEnd + + %main = OpFunction %void None %void_fn + %main_entry = OpLabel + %nothing = OpFunctionCall %ptr_uint %foo + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp new file mode 100644 index 0000000000..3651a4de52 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitcast-fp16-fp32.asm.comp @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpMemberName %SSBO 2 "c" + OpMemberName %SSBO 3 "d" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpMemberDecorate %SSBO 3 Offset 12 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %v2half %float %float %v2half +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %uint = OpTypeInt 32 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v2half %_ %int_0 + %17 = OpLoad %v2half %16 + %20 = OpBitcast %float %17 + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_1 + OpStore %22 %20 + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_2 + %26 = OpLoad %float %25 + %28 = OpBitcast %v2half %26 + %29 = OpAccessChain %_ptr_Uniform_v2half %_ %int_3 + OpStore %29 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..435fa32221 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..e3b785cd52 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "u" + OpMemberName %SSBO 1 "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %uvec4 %ivec4 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uvec4 = OpTypePointer Uniform %uvec4 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_ivec4 = OpTypePointer Uniform %ivec4 + %main = OpFunction %void None %3 + %5 = OpLabel + %uptr = OpAccessChain %_ptr_Uniform_uvec4 %_ %int_0 + %iptr = OpAccessChain %_ptr_Uniform_ivec4 %_ %int_1 + %uvalue = OpLoad %uvec4 %uptr + %ivalue = OpLoad %ivec4 %iptr + + %lsb_uint_to_uint = OpExtInst %uvec4 %1 FindILsb %uvalue + %lsb_uint_to_int = OpExtInst %ivec4 %1 FindILsb %uvalue + %lsb_int_to_uint = OpExtInst %uvec4 %1 FindILsb %ivalue + %lsb_int_to_int = OpExtInst %ivec4 %1 FindILsb %ivalue + + %umsb_uint_to_uint = OpExtInst %uvec4 %1 FindUMsb %uvalue + %umsb_uint_to_int = OpExtInst %ivec4 %1 FindUMsb %uvalue + %umsb_int_to_uint = OpExtInst %uvec4 %1 FindUMsb %ivalue + %umsb_int_to_int = OpExtInst %ivec4 %1 FindUMsb %ivalue + + %smsb_uint_to_uint = OpExtInst %uvec4 %1 FindSMsb %uvalue + %smsb_uint_to_int = OpExtInst %ivec4 %1 FindSMsb %uvalue + %smsb_int_to_uint = OpExtInst %uvec4 %1 FindSMsb %ivalue + %smsb_int_to_int = OpExtInst %ivec4 %1 FindSMsb %ivalue + + OpStore %uptr %lsb_uint_to_uint + OpStore %iptr %lsb_uint_to_int + OpStore %uptr %lsb_int_to_uint + OpStore %iptr %lsb_int_to_int + + OpStore %uptr %umsb_uint_to_uint + OpStore %iptr %umsb_uint_to_int + OpStore %uptr %umsb_int_to_uint + OpStore %iptr %umsb_int_to_int + + OpStore %uptr %smsb_uint_to_uint + OpStore %iptr %smsb_uint_to_int + OpStore %uptr %smsb_int_to_uint + OpStore %iptr %smsb_int_to_int + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp new file mode 100644 index 0000000000..37ff035fa6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct-2.asm.comp @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %csMainClear "main" %gl_GlobalInvocationID + OpExecutionMode %csMainClear LocalSize 64 1 1 + OpSource HLSL 600 + OpName %type_CommonConstants "type.CommonConstants" + OpMemberName %type_CommonConstants 0 "g_count" + OpMemberName %type_CommonConstants 1 "g_padding4" + OpName %CommonConstants "CommonConstants" + OpName %type_RWStructuredBuffer_MyStruct "type.RWStructuredBuffer.MyStruct" + OpName %MyStruct "MyStruct" + OpMemberName %MyStruct 0 "m_coefficients" + OpName %g_data "g_data" + OpName %csMainClear "csMainClear" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorateString %gl_GlobalInvocationID UserSemantic "SV_DispatchThreadID" + OpDecorate %CommonConstants DescriptorSet 0 + OpDecorate %CommonConstants Binding 0 + OpDecorate %g_data DescriptorSet 0 + OpDecorate %g_data Binding 1 + OpMemberDecorate %type_CommonConstants 0 Offset 0 + OpMemberDecorate %type_CommonConstants 1 Offset 4 + OpDecorate %type_CommonConstants Block + OpDecorateString %CommonConstants UserTypeGOOGLE "cbuffer" + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %MyStruct 0 Offset 0 + OpDecorate %_runtimearr_MyStruct ArrayStride 64 + OpMemberDecorate %type_RWStructuredBuffer_MyStruct 0 Offset 0 + OpDecorate %type_RWStructuredBuffer_MyStruct BufferBlock + OpDecorateString %g_data UserTypeGOOGLE "rwstructuredbuffer" + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3uint = OpTypeVector %uint 3 +%type_CommonConstants = OpTypeStruct %uint %v3uint +%_ptr_Uniform_type_CommonConstants = OpTypePointer Uniform %type_CommonConstants +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %MyStruct = OpTypeStruct %_arr_v4float_uint_4 +%_runtimearr_MyStruct = OpTypeRuntimeArray %MyStruct +%type_RWStructuredBuffer_MyStruct = OpTypeStruct %_runtimearr_MyStruct +%_ptr_Uniform_type_RWStructuredBuffer_MyStruct = OpTypePointer Uniform %type_RWStructuredBuffer_MyStruct +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %void = OpTypeVoid + %21 = OpTypeFunction %void +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool +%_ptr_Uniform_MyStruct = OpTypePointer Uniform %MyStruct +%CommonConstants = OpVariable %_ptr_Uniform_type_CommonConstants Uniform + %g_data = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_MyStruct Uniform +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 + %26 = OpConstantNull %v4float + %27 = OpConstantComposite %_arr_v4float_uint_4 %26 %26 %26 %26 + %28 = OpConstantComposite %MyStruct %27 +%csMainClear = OpFunction %void None %21 + %29 = OpLabel + %30 = OpLoad %v3uint %gl_GlobalInvocationID + OpSelectionMerge %31 None + OpSwitch %uint_0 %32 + %32 = OpLabel + %33 = OpCompositeExtract %uint %30 0 + %34 = OpAccessChain %_ptr_Uniform_uint %CommonConstants %int_0 + %35 = OpLoad %uint %34 + %36 = OpUGreaterThanEqual %bool %33 %35 + OpSelectionMerge %37 DontFlatten + OpBranchConditional %36 %38 %37 + %38 = OpLabel + OpBranch %31 + %37 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_MyStruct %g_data %int_0 %33 + OpStore %39 %28 + OpBranch %31 + %31 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp new file mode 100644 index 0000000000..8aaa9500af --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/block-like-array-type-construct.asm.comp @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %foo2 "foo2" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpName %_ "" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_arr_float_uint_4 ArrayStride 4 + OpDecorate %struct_arr ArrayStride 32 + OpMemberDecorate %struct 0 Offset 0 + OpMemberDecorate %struct 1 Offset 16 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Private__arr_float_uint_4 = OpTypePointer Private %_arr_float_uint_4 + %foo = OpVariable %_ptr_Private__arr_float_uint_4 Private + %foo2 = OpVariable %_ptr_Private__arr_float_uint_4 Private + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %struct = OpTypeStruct %_arr_float_uint_4 %_arr_float_uint_4 + %struct_arr = OpTypeArray %struct %uint_2 + %ptr_struct = OpTypePointer Function %struct +%_ptr_Private_float = OpTypePointer Private %float + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 + %int_2 = OpConstant %int 2 + %float_3 = OpConstant %float 3 + %int_3 = OpConstant %int 3 + %float_4 = OpConstant %float 4 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %carr = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4 + %struct_constant_0 = OpConstantComposite %struct %carr %carr + %struct_constant_1 = OpConstantComposite %struct %carr %carr + %struct_arr_constant = OpConstantComposite %struct_arr %struct_constant_0 %struct_constant_1 + %SSBO = OpTypeStruct %uint %int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %struct_var = OpVariable %ptr_struct Function + %16 = OpAccessChain %_ptr_Private_float %foo %int_0 + OpStore %16 %float_1 + OpStore %foo %carr + %19 = OpAccessChain %_ptr_Private_float %foo %int_1 + OpStore %19 %float_2 + %22 = OpAccessChain %_ptr_Private_float %foo %int_2 + OpStore %22 %float_3 + %25 = OpAccessChain %_ptr_Private_float %foo %int_3 + OpStore %25 %float_4 + OpCopyMemory %foo2 %foo + %l0 = OpLoad %_arr_float_uint_4 %foo + %l1 = OpLoad %_arr_float_uint_4 %foo2 + %struct0 = OpCompositeConstruct %struct %l0 %l1 + OpStore %struct_var %struct0 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp new file mode 100644 index 0000000000..ed8d0ba6f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/buffer-device-address-ptr-casting.msl24.asm.comp @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpSourceExtension "GL_EXT_buffer_reference" + OpSourceExtension "GL_EXT_buffer_reference_uvec2" + OpName %main "main" + OpName %SomeBuffer "SomeBuffer" + OpMemberName %SomeBuffer 0 "v" + OpMemberName %SomeBuffer 1 "a" + OpMemberName %SomeBuffer 2 "b" + OpName %Registers "Registers" + OpMemberName %Registers 0 "address" + OpMemberName %Registers 1 "address2" + OpName %registers "registers" + OpName %a "a" + OpName %b "b" + OpMemberDecorate %SomeBuffer 0 Offset 0 + OpMemberDecorate %SomeBuffer 1 Offset 16 + OpMemberDecorate %SomeBuffer 2 Offset 24 + OpDecorate %SomeBuffer Block + OpMemberDecorate %Registers 0 Offset 0 + OpMemberDecorate %Registers 1 Offset 8 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_SomeBuffer PhysicalStorageBuffer + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %ulong = OpTypeInt 64 0 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %SomeBuffer = OpTypeStruct %v4float %ulong %v2uint +%_ptr_PhysicalStorageBuffer_SomeBuffer = OpTypePointer PhysicalStorageBuffer %SomeBuffer +%_ptr_Function__ptr_PhysicalStorageBuffer_SomeBuffer = OpTypePointer Function %_ptr_PhysicalStorageBuffer_SomeBuffer + %Registers = OpTypeStruct %ulong %v2uint +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_ulong = OpTypePointer PushConstant %ulong + %int_1 = OpConstant %int 1 +%_ptr_PushConstant_v2uint = OpTypePointer PushConstant %v2uint + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %35 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%_ptr_PhysicalStorageBuffer_v4float = OpTypePointer PhysicalStorageBuffer %v4float + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %43 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 +%_ptr_Function_ulong = OpTypePointer Function %ulong +%_ptr_Function_v2uint = OpTypePointer Function %v2uint +%_ptr_PhysicalStorageBuffer_ulong = OpTypePointer PhysicalStorageBuffer %ulong + %int_2 = OpConstant %int 2 +%_ptr_PhysicalStorageBuffer_v2uint = OpTypePointer PhysicalStorageBuffer %v2uint + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_ulong Function + %b = OpVariable %_ptr_Function_v2uint Function + %21 = OpAccessChain %_ptr_PushConstant_ulong %registers %int_0 + %27 = OpAccessChain %_ptr_PushConstant_v2uint %registers %int_1 + %uint_ptr0 = OpLoad %ulong %21 + %uint_ptr1 = OpLoad %v2uint %27 + + ; ConvertUToPtr and vice versa do not accept vectors. + %ulong_ptr0 = OpConvertUToPtr %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr0 + %ulong_ptr1 = OpBitcast %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr0 + %uvec2_ptr0 = OpBitcast %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr1 + + %vec4_write0 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %ulong_ptr0 %int_0 + %vec4_write1 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %ulong_ptr1 %int_0 + %vec4_write2 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %uvec2_ptr0 %int_0 + + OpStore %vec4_write0 %35 Aligned 16 + OpStore %vec4_write1 %35 Aligned 16 + OpStore %vec4_write2 %35 Aligned 16 + + %ulong_from_ptr0 = OpConvertPtrToU %ulong %ulong_ptr0 + %ulong_from_ptr1 = OpBitcast %ulong %ulong_ptr1 + %uvec2_from_ptr0 = OpBitcast %v2uint %uvec2_ptr0 + + %ptr0 = OpAccessChain %_ptr_PhysicalStorageBuffer_ulong %ulong_ptr0 %int_1 + %ptr1 = OpAccessChain %_ptr_PhysicalStorageBuffer_ulong %ulong_ptr1 %int_1 + %ptr2 = OpAccessChain %_ptr_PhysicalStorageBuffer_v2uint %uvec2_ptr0 %int_2 + + OpStore %ptr0 %ulong_from_ptr0 Aligned 8 + OpStore %ptr1 %ulong_from_ptr1 Aligned 8 + OpStore %ptr2 %uvec2_from_ptr0 Aligned 8 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp new file mode 100644 index 0000000000..c7b76a8c06 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/composite-construct-buffer-struct.asm.comp @@ -0,0 +1,54 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Block "Block" + OpName %SSBO "SSBO" + OpName %SSBO_Var "ssbo" + OpName %UBO_Var "ubo" + OpDecorate %SSBO_Var Binding 0 + OpDecorate %SSBO_Var DescriptorSet 0 + OpDecorate %UBO_Var Binding 1 + OpDecorate %UBO_Var DescriptorSet 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %Block 0 Offset 0 + OpMemberDecorate %Block 1 Offset 16 + OpDecorate %BlockArray ArrayStride 32 + OpDecorate %arr_uvec2_2 ArrayStride 8 + OpDecorate %SSBO Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uvec2 = OpTypeVector %uint 2 + %arr_uvec2_2 = OpTypeArray %uvec2 %uint_2 + %arr_uvec2_2_ptr = OpTypePointer StorageBuffer %arr_uvec2_2 + %arr_uvec2_2_ptr_const = OpTypePointer Uniform %arr_uvec2_2 + %arr_uvec2_2_ptr_func = OpTypePointer Function %arr_uvec2_2 + %arr_uvec2_2_ptr_workgroup = OpTypePointer Workgroup %arr_uvec2_2 + %wg = OpVariable %arr_uvec2_2_ptr_workgroup Workgroup + %Block = OpTypeStruct %arr_uvec2_2 %arr_uvec2_2 + %Block_ptr = OpTypePointer StorageBuffer %Block +%BlockArray = OpTypeArray %Block %uint_3 +%SSBO = OpTypeStruct %BlockArray +%SSBO_Ptr = OpTypePointer StorageBuffer %SSBO +%SSBO_Var = OpVariable %SSBO_Ptr StorageBuffer +%UBO_Ptr = OpTypePointer Uniform %SSBO +%UBO_Var = OpVariable %UBO_Ptr Uniform +%void = OpTypeVoid +%func_type = OpTypeFunction %void + + %main = OpFunction %void None %func_type + %25 = OpLabel + %func = OpVariable %arr_uvec2_2_ptr_func Function + + ; Copy device array to temporary. + %ptr = OpAccessChain %Block_ptr %SSBO_Var %uint_0 %uint_0 + %ptr_arr_1 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array = OpLoad %arr_uvec2_2 %ptr_arr_1 + %constructed = OpCompositeConstruct %Block %loaded_array %loaded_array + OpStore %ptr %constructed + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..8997d0aaf9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Block "Block" + OpMemberName %Block 0 "f" + OpName %block "block" + OpMemberDecorate %Block 0 Offset 0 + OpDecorate %Block BufferBlock + OpDecorate %block DescriptorSet 0 + OpDecorate %block Binding 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Block = OpTypeStruct %v4float +%_ptr_Uniform_Block = OpTypePointer Uniform %Block + %block = OpVariable %_ptr_Uniform_Block Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %15 = OpUndef %float + %16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %6 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0 + OpStore %19 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..e1dcb0ef8e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %gl_LocalInvocationID + OpExecutionMode %main LocalSize 4 4 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %25 "indexable" + OpName %38 "indexable" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %25 = OpConstantComposite %_arr_int_uint_4 %int_0 %int_1 %int_2 %int_3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %38 = OpConstantComposite %_arr_int_uint_4 %int_4 %int_5 %int_6 %int_7 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function +%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_4 Function + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %28 = OpLoad %uint %27 + OpStore %indexable %25 + %32 = OpAccessChain %_ptr_Function_int %indexable %28 + %33 = OpLoad %int %32 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %41 = OpLoad %uint %40 + OpStore %indexable_0 %38 + %43 = OpAccessChain %_ptr_Function_int %indexable_0 %41 + %44 = OpLoad %int %43 + %45 = OpIAdd %int %33 %44 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %47 %45 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp new file mode 100644 index 0000000000..6a7065a6fb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-2.spv14.asm.comp @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ssbo + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %B1 "B1" + OpName %A "A" + OpName %C "C" + OpName %B2 "B2" + OpMemberName %A 0 "a" + OpMemberName %A 1 "b1" + OpMemberName %A 2 "b1_array" + OpMemberName %C 0 "c" + OpMemberName %C 1 "b2" + OpMemberName %C 2 "b2_array" + OpMemberName %B1 0 "elem1" + OpMemberName %B2 0 "elem2" + OpMemberName %SSBO 0 "a_block" + OpMemberName %SSBO 1 "c_block" + OpDecorate %B1Array ArrayStride 16 + OpDecorate %B2Array ArrayStride 16 + OpMemberDecorate %B1 0 Offset 0 + OpMemberDecorate %A 0 Offset 0 + OpMemberDecorate %A 1 Offset 16 + OpMemberDecorate %A 2 Offset 32 + OpMemberDecorate %A 3 Offset 96 + OpMemberDecorate %B2 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %C 1 Offset 16 + OpMemberDecorate %C 2 Offset 32 + OpMemberDecorate %C 3 Offset 96 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 112 + OpMemberDecorate %A0 0 Offset 0 + OpMemberDecorate %C0 0 Offset 0 + OpMemberDecorate %A0 0 RowMajor + OpMemberDecorate %A0 0 MatrixStride 8 + OpMemberDecorate %C0 0 ColMajor + OpMemberDecorate %C0 0 MatrixStride 16 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 + %m2float = OpTypeMatrix %v2float 2 + %A0 = OpTypeStruct %m2float + %C0 = OpTypeStruct %m2float + %B2 = OpTypeStruct %v4float + %B2Array = OpTypeArray %B2 %uint_4 + %C = OpTypeStruct %v4float %B2 %B2Array %C0 + %B1 = OpTypeStruct %v4float + %B1Array = OpTypeArray %B1 %uint_4 + %A = OpTypeStruct %v4float %B1 %B1Array %A0 + %SSBO = OpTypeStruct %A %C +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_C = OpTypePointer StorageBuffer %C + %int_0 = OpConstant %int 0 +%_ptr_Uniform_A = OpTypePointer StorageBuffer %A + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_C %ssbo %int_1 + %39 = OpAccessChain %_ptr_Uniform_A %ssbo %int_0 + %23 = OpLoad %C %22 + %24 = OpCopyLogical %A %23 + OpStore %39 %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp new file mode 100644 index 0000000000..026bd11317 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical-offset-and-array-stride-diffs.spv14.asm.comp @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 24 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 %4 + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %5 Block + OpMemberDecorate %5 0 Offset 0 + OpMemberDecorate %5 1 Offset 16 + OpMemberDecorate %5 2 Offset 48 + OpMemberDecorate %5 3 Offset 64 + OpMemberDecorate %5 4 Offset 80 + OpMemberDecorate %5 5 Offset 96 + OpMemberDecorate %5 6 Offset 112 + OpDecorate %6 Block + OpMemberDecorate %6 0 Offset 0 + OpMemberDecorate %6 1 Offset 4 + OpMemberDecorate %6 2 Offset 12 + OpMemberDecorate %6 3 Offset 16 + OpMemberDecorate %6 4 Offset 32 + OpMemberDecorate %6 5 Offset 48 + OpMemberDecorate %6 6 Offset 64 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 1 + OpDecorate %7 ArrayStride 4 + OpDecorate %8 ArrayStride 16 + OpMemberDecorate %9 0 Offset 4 + OpMemberDecorate %10 0 Offset 8 + %11 = OpTypeVoid + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 2 + %14 = OpTypeVector %12 3 + %15 = OpTypeVector %12 4 + %16 = OpTypeMatrix %15 4 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 2 + %7 = OpTypeArray %17 %18 + %8 = OpTypeArray %17 %18 + %9 = OpTypeStruct %17 + %10 = OpTypeStruct %17 + %5 = OpTypeStruct %17 %8 %17 %9 %15 %14 %13 + %19 = OpTypePointer StorageBuffer %5 + %6 = OpTypeStruct %17 %7 %17 %10 %15 %14 %13 + %20 = OpTypePointer StorageBuffer %6 + %3 = OpVariable %20 StorageBuffer + %4 = OpVariable %19 StorageBuffer + %21 = OpTypeFunction %11 + %2 = OpFunction %11 None %21 + %1 = OpLabel + %22 = OpLoad %6 %3 + %23 = OpCopyLogical %5 %22 + OpStore %4 %23 + OpReturn + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp new file mode 100644 index 0000000000..20fa0b099b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/copy-logical.spv14.asm.comp @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ssbo + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %B1 "B1" + OpName %A "A" + OpName %C "C" + OpName %B2 "B2" + OpMemberName %A 0 "a" + OpMemberName %A 1 "b1" + OpMemberName %A 2 "b1_array" + OpMemberName %C 0 "c" + OpMemberName %C 1 "b2" + OpMemberName %C 2 "b2_array" + OpMemberName %B1 0 "elem1" + OpMemberName %B2 0 "elem2" + OpMemberName %SSBO 0 "a_block" + OpMemberName %SSBO 1 "c_block" + OpDecorate %B1Array ArrayStride 16 + OpDecorate %B2Array ArrayStride 16 + OpMemberDecorate %B1 0 Offset 0 + OpMemberDecorate %A 0 Offset 0 + OpMemberDecorate %A 1 Offset 16 + OpMemberDecorate %A 2 Offset 32 + OpMemberDecorate %B2 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %C 1 Offset 16 + OpMemberDecorate %C 2 Offset 32 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 96 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %v4float = OpTypeVector %float 4 + %B2 = OpTypeStruct %v4float + %B2Array = OpTypeArray %B2 %uint_4 + %C = OpTypeStruct %v4float %B2 %B2Array + %B1 = OpTypeStruct %v4float + %B1Array = OpTypeArray %B1 %uint_4 + %A = OpTypeStruct %v4float %B1 %B1Array + %SSBO = OpTypeStruct %A %C +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_C = OpTypePointer StorageBuffer %C + %int_0 = OpConstant %int 0 +%_ptr_Uniform_A = OpTypePointer StorageBuffer %A + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_C %ssbo %int_1 + %39 = OpAccessChain %_ptr_Uniform_A %ssbo %int_0 + %23 = OpLoad %C %22 + %24 = OpCopyLogical %A %23 + OpStore %39 %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp new file mode 100644 index 0000000000..d59aad3cef --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.asm.comp @@ -0,0 +1,53 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Block "Block" + OpName %SSBO "SSBO" + OpName %SSBO_Var "ssbo" + OpName %UBO_Var "ubo" + OpDecorate %SSBO_Var Binding 0 + OpDecorate %SSBO_Var DescriptorSet 0 + OpDecorate %UBO_Var Binding 1 + OpDecorate %UBO_Var DescriptorSet 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %Block 0 Offset 0 + OpMemberDecorate %Block 1 Offset 16 + OpDecorate %BlockArray ArrayStride 32 + OpDecorate %arr_uvec2_2 ArrayStride 8 + OpDecorate %SSBO Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uvec2 = OpTypeVector %uint 2 + %arr_uvec2_2 = OpTypeArray %uvec2 %uint_2 + %arr_uvec2_2_ptr = OpTypePointer StorageBuffer %arr_uvec2_2 + %arr_uvec2_2_ptr_const = OpTypePointer Uniform %arr_uvec2_2 + %arr_uvec2_2_ptr_func = OpTypePointer Function %arr_uvec2_2 + %arr_uvec2_2_ptr_workgroup = OpTypePointer Workgroup %arr_uvec2_2 + %wg = OpVariable %arr_uvec2_2_ptr_workgroup Workgroup + %Block = OpTypeStruct %arr_uvec2_2 %arr_uvec2_2 +%BlockArray = OpTypeArray %Block %uint_3 +%SSBO = OpTypeStruct %BlockArray +%SSBO_Ptr = OpTypePointer StorageBuffer %SSBO +%SSBO_Var = OpVariable %SSBO_Ptr StorageBuffer +%UBO_Ptr = OpTypePointer Uniform %SSBO +%UBO_Var = OpVariable %UBO_Ptr Uniform +%void = OpTypeVoid +%func_type = OpTypeFunction %void + + %main = OpFunction %void None %func_type + %25 = OpLabel + %func = OpVariable %arr_uvec2_2_ptr_func Function + + ; Copy device array to temporary. + %ptr_arr_0 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_0 + %ptr_arr_1 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %ptr_arr_0 %loaded_array + OpStore %ptr_arr_0 %loaded_array + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp new file mode 100644 index 0000000000..d59aad3cef --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-array-load-temporary.force-native-array.asm.comp @@ -0,0 +1,53 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Block "Block" + OpName %SSBO "SSBO" + OpName %SSBO_Var "ssbo" + OpName %UBO_Var "ubo" + OpDecorate %SSBO_Var Binding 0 + OpDecorate %SSBO_Var DescriptorSet 0 + OpDecorate %UBO_Var Binding 1 + OpDecorate %UBO_Var DescriptorSet 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %Block 0 Offset 0 + OpMemberDecorate %Block 1 Offset 16 + OpDecorate %BlockArray ArrayStride 32 + OpDecorate %arr_uvec2_2 ArrayStride 8 + OpDecorate %SSBO Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uvec2 = OpTypeVector %uint 2 + %arr_uvec2_2 = OpTypeArray %uvec2 %uint_2 + %arr_uvec2_2_ptr = OpTypePointer StorageBuffer %arr_uvec2_2 + %arr_uvec2_2_ptr_const = OpTypePointer Uniform %arr_uvec2_2 + %arr_uvec2_2_ptr_func = OpTypePointer Function %arr_uvec2_2 + %arr_uvec2_2_ptr_workgroup = OpTypePointer Workgroup %arr_uvec2_2 + %wg = OpVariable %arr_uvec2_2_ptr_workgroup Workgroup + %Block = OpTypeStruct %arr_uvec2_2 %arr_uvec2_2 +%BlockArray = OpTypeArray %Block %uint_3 +%SSBO = OpTypeStruct %BlockArray +%SSBO_Ptr = OpTypePointer StorageBuffer %SSBO +%SSBO_Var = OpVariable %SSBO_Ptr StorageBuffer +%UBO_Ptr = OpTypePointer Uniform %SSBO +%UBO_Var = OpVariable %UBO_Ptr Uniform +%void = OpTypeVoid +%func_type = OpTypeFunction %void + + %main = OpFunction %void None %func_type + %25 = OpLabel + %func = OpVariable %arr_uvec2_2_ptr_func Function + + ; Copy device array to temporary. + %ptr_arr_0 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_0 + %ptr_arr_1 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %ptr_arr_0 %loaded_array + OpStore %ptr_arr_0 %loaded_array + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp new file mode 100644 index 0000000000..d9d0d51c39 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.asm.comp @@ -0,0 +1,81 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Block "Block" + OpName %SSBO "SSBO" + OpName %SSBO_Var "ssbo" + OpName %UBO_Var "ubo" + OpDecorate %SSBO_Var Binding 0 + OpDecorate %SSBO_Var DescriptorSet 0 + OpDecorate %UBO_Var Binding 1 + OpDecorate %UBO_Var DescriptorSet 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %Block 0 Offset 0 + OpMemberDecorate %Block 1 Offset 16 + OpDecorate %BlockArray ArrayStride 32 + OpDecorate %arr_uvec2_2 ArrayStride 8 + OpDecorate %SSBO Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uvec2 = OpTypeVector %uint 2 + %arr_uvec2_2 = OpTypeArray %uvec2 %uint_2 + %arr_uvec2_2_ptr = OpTypePointer StorageBuffer %arr_uvec2_2 + %arr_uvec2_2_ptr_const = OpTypePointer Uniform %arr_uvec2_2 + %arr_uvec2_2_ptr_func = OpTypePointer Function %arr_uvec2_2 + %arr_uvec2_2_ptr_workgroup = OpTypePointer Workgroup %arr_uvec2_2 + %wg = OpVariable %arr_uvec2_2_ptr_workgroup Workgroup + %Block = OpTypeStruct %arr_uvec2_2 %arr_uvec2_2 +%BlockArray = OpTypeArray %Block %uint_3 +%SSBO = OpTypeStruct %BlockArray +%SSBO_Ptr = OpTypePointer StorageBuffer %SSBO +%SSBO_Var = OpVariable %SSBO_Ptr StorageBuffer +%UBO_Ptr = OpTypePointer Uniform %SSBO +%UBO_Var = OpVariable %UBO_Ptr Uniform +%void = OpTypeVoid +%func_type = OpTypeFunction %void + + %main = OpFunction %void None %func_type + %25 = OpLabel + %func = OpVariable %arr_uvec2_2_ptr_func Function + + ; DeviceToDevice + %ptr_arr_0 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_0 + %ptr_arr_1 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %ptr_arr_0 %loaded_array + + ; ConstantToDevice + %ptr_arr_1_const = OpAccessChain %arr_uvec2_2_ptr_const %UBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array_const = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %ptr_arr_0 %loaded_array_const + + ; StackToDevice + %loaded_array_func = OpLoad %arr_uvec2_2 %func + OpStore %ptr_arr_0 %loaded_array_func + + ; ThreadGroupToDevice + %loaded_array_workgroup = OpLoad %arr_uvec2_2 %wg + OpStore %ptr_arr_0 %loaded_array_workgroup + + ; DeviceToThreadGroup + %loaded_array_2 = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %wg %loaded_array_2 + + ; DeviceToStack + %loaded_array_3 = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %func %loaded_array_3 + + ; ConstantToThreadGroup + %loaded_array_const_2 = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %wg %loaded_array_const_2 + + ; ConstantToStack + %loaded_array_const_3 = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %func %loaded_array_const_3 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp new file mode 100644 index 0000000000..d9d0d51c39 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/device-constant-array-load-store.force-native-array.asm.comp @@ -0,0 +1,81 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %Block "Block" + OpName %SSBO "SSBO" + OpName %SSBO_Var "ssbo" + OpName %UBO_Var "ubo" + OpDecorate %SSBO_Var Binding 0 + OpDecorate %SSBO_Var DescriptorSet 0 + OpDecorate %UBO_Var Binding 1 + OpDecorate %UBO_Var DescriptorSet 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %Block 0 Offset 0 + OpMemberDecorate %Block 1 Offset 16 + OpDecorate %BlockArray ArrayStride 32 + OpDecorate %arr_uvec2_2 ArrayStride 8 + OpDecorate %SSBO Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uvec2 = OpTypeVector %uint 2 + %arr_uvec2_2 = OpTypeArray %uvec2 %uint_2 + %arr_uvec2_2_ptr = OpTypePointer StorageBuffer %arr_uvec2_2 + %arr_uvec2_2_ptr_const = OpTypePointer Uniform %arr_uvec2_2 + %arr_uvec2_2_ptr_func = OpTypePointer Function %arr_uvec2_2 + %arr_uvec2_2_ptr_workgroup = OpTypePointer Workgroup %arr_uvec2_2 + %wg = OpVariable %arr_uvec2_2_ptr_workgroup Workgroup + %Block = OpTypeStruct %arr_uvec2_2 %arr_uvec2_2 +%BlockArray = OpTypeArray %Block %uint_3 +%SSBO = OpTypeStruct %BlockArray +%SSBO_Ptr = OpTypePointer StorageBuffer %SSBO +%SSBO_Var = OpVariable %SSBO_Ptr StorageBuffer +%UBO_Ptr = OpTypePointer Uniform %SSBO +%UBO_Var = OpVariable %UBO_Ptr Uniform +%void = OpTypeVoid +%func_type = OpTypeFunction %void + + %main = OpFunction %void None %func_type + %25 = OpLabel + %func = OpVariable %arr_uvec2_2_ptr_func Function + + ; DeviceToDevice + %ptr_arr_0 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_0 + %ptr_arr_1 = OpAccessChain %arr_uvec2_2_ptr %SSBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %ptr_arr_0 %loaded_array + + ; ConstantToDevice + %ptr_arr_1_const = OpAccessChain %arr_uvec2_2_ptr_const %UBO_Var %uint_0 %uint_0 %uint_1 + %loaded_array_const = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %ptr_arr_0 %loaded_array_const + + ; StackToDevice + %loaded_array_func = OpLoad %arr_uvec2_2 %func + OpStore %ptr_arr_0 %loaded_array_func + + ; ThreadGroupToDevice + %loaded_array_workgroup = OpLoad %arr_uvec2_2 %wg + OpStore %ptr_arr_0 %loaded_array_workgroup + + ; DeviceToThreadGroup + %loaded_array_2 = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %wg %loaded_array_2 + + ; DeviceToStack + %loaded_array_3 = OpLoad %arr_uvec2_2 %ptr_arr_1 + OpStore %func %loaded_array_3 + + ; ConstantToThreadGroup + %loaded_array_const_2 = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %wg %loaded_array_const_2 + + ; ConstantToStack + %loaded_array_const_3 = OpLoad %arr_uvec2_2 %ptr_arr_1_const + OpStore %func %loaded_array_const_3 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..73f3ceee1a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + ;OpEntryPoint GLCompute %main "main" %Samp %ubo %ssbo %v %w + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Samp "Samp" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %ubo "ubo" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbo "ssbo" + OpName %v "v" + OpName %w "w" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %Samp DescriptorSet 0 + OpDecorate %Samp Binding 0 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubo DescriptorSet 0 + OpDecorate %ubo Binding 1 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %float = OpTypeFloat 32 + %12 = OpTypeImage %float 2D 0 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %Samp = OpVariable %_ptr_UniformConstant_13 UniformConstant + %UBO = OpTypeStruct %float +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %SSBO = OpTypeStruct %float +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer +%_ptr_Private_float = OpTypePointer Private %float + %v = OpVariable %_ptr_Private_float Private +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %w = OpVariable %_ptr_Workgroup_float Workgroup + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..7da9f95b9e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints + %int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints + %uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints + %uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints + + %int_to_int_ssign = OpExtInst %v4int %1 SSign %ints + %int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints + %uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints + %uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints + + %int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints + %int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints + %uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints + %uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints + + %int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints + %int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints + %uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints + %uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints + + %int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints + %int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints + %uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints + %uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints + + %int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints + %int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints + %uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints + %uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints + + %int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints + %int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints + %uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints + %uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints + + %int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints + %int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints + %uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints + %uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints + + OpStore %ints_ptr %int_to_int_sabs + OpStore %uints_ptr %int_to_uint_sabs + OpStore %ints_ptr %uint_to_int_sabs + OpStore %uints_ptr %uint_to_uint_sabs + + OpStore %ints_ptr %int_to_int_ssign + OpStore %uints_ptr %int_to_uint_ssign + OpStore %ints_ptr %uint_to_int_ssign + OpStore %uints_ptr %uint_to_uint_ssign + + OpStore %ints_ptr %int_to_int_smsb + OpStore %uints_ptr %int_to_uint_smsb + OpStore %ints_ptr %uint_to_int_umsb + OpStore %uints_ptr %uint_to_uint_umsb + + OpStore %ints_ptr %int_to_int_smin + OpStore %uints_ptr %int_to_uint_smin + OpStore %ints_ptr %uint_to_int_smin + OpStore %uints_ptr %uint_to_uint_smin + + OpStore %ints_ptr %int_to_int_umin + OpStore %uints_ptr %int_to_uint_umin + OpStore %ints_ptr %uint_to_int_umin + OpStore %uints_ptr %uint_to_uint_umin + + OpStore %ints_ptr %int_to_int_smax + OpStore %uints_ptr %int_to_uint_smax + OpStore %ints_ptr %uint_to_int_smax + OpStore %uints_ptr %uint_to_uint_smax + + OpStore %ints_ptr %int_to_int_umax + OpStore %uints_ptr %int_to_uint_umax + OpStore %ints_ptr %uint_to_int_umax + OpStore %uints_ptr %uint_to_uint_umax + + OpStore %ints_ptr %int_to_int_sclamp + OpStore %uints_ptr %int_to_uint_sclamp + OpStore %ints_ptr %uint_to_int_uclamp + OpStore %uints_ptr %uint_to_uint_uclamp + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp new file mode 100644 index 0000000000..30db11d45b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %ResTypeMod = OpTypeStruct %float %float +%_ptr_Function_ResTypeMod = OpTypePointer Function %ResTypeMod + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_20 = OpConstant %float 20 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%ResTypeFrexp = OpTypeStruct %float %int +%_ptr_Function_ResTypeFrexp = OpTypePointer Function %ResTypeFrexp + %float_40 = OpConstant %float 40 +%_ptr_Function_int = OpTypePointer Function %int + %SSBO = OpTypeStruct %float %int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %3 + %5 = OpLabel + %modres = OpExtInst %ResTypeMod %1 ModfStruct %float_20 + %frexpres = OpExtInst %ResTypeFrexp %1 FrexpStruct %float_40 + + %modres_f = OpCompositeExtract %float %modres 0 + %modres_i = OpCompositeExtract %float %modres 1 + %frexpres_f = OpCompositeExtract %float %frexpres 0 + %frexpres_i = OpCompositeExtract %int %frexpres 1 + + %float_ptr = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %int_ptr = OpAccessChain %_ptr_Uniform_int %_ %int_1 + + OpStore %float_ptr %modres_f + OpStore %float_ptr %modres_i + OpStore %float_ptr %frexpres_f + OpStore %int_ptr %frexpres_i + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp new file mode 100644 index 0000000000..2eaef4bdbe --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id-override.asm.comp @@ -0,0 +1,60 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + %spec_1 = OpSpecConstant %uint 11 + %spec_2 = OpSpecConstant %uint 12 + %spec_3 = OpSpecConstant %uint 13 + %spec_4 = OpSpecConstant %uint 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %uint_3 %spec_1 %spec_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp new file mode 100644 index 0000000000..3031f4bb8a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/local-size-id.asm.comp @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + ; Test that we can declare the spec constant as signed. + ; Needs implicit bitcast since WorkGroupSize is uint. + %spec_1 = OpSpecConstant %int 11 + %spec_2 = OpSpecConstant %int 12 + %spec_3 = OpSpecConstant %int 13 + %spec_4 = OpSpecConstant %int 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + ; Test that we can build spec constant composites out of local size id values. + ; Needs special case handling. + %spec_3_op = OpSpecConstantOp %uint IAdd %spec_3 %uint_3 +%WorkGroupSize = OpSpecConstantComposite %v3uint %spec_3_op %spec_4 %uint_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %wg_f = OpConvertUToF %v3float %WorkGroupSize + %wg_f4 = OpVectorShuffle %v4float %wg_f %wg_f 0 1 2 2 + ; Test that we can use the spec constants directly which needs to translate to gl_WorkGroupSize.elem. + ; Needs special case handling. + %res = OpFAdd %v4float %27 %wg_f4 + %f0 = OpConvertSToF %float %spec_3 + %f1 = OpConvertSToF %float %spec_4 + %f2 = OpConvertSToF %float %uint_2 + %res1 = OpVectorTimesScalar %v4float %res %f0 + %res2 = OpVectorTimesScalar %v4float %res1 %f1 + %res3 = OpVectorTimesScalar %v4float %res2 %f2 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %res3 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp new file mode 100644 index 0000000000..126b01e461 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/modf-storage-class.asm.comp @@ -0,0 +1,116 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 91 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" + OpExecutionMode %2 LocalSize 1 1 1 + OpDecorate %_arr_v2uint_uint_324 ArrayStride 8 + OpMemberDecorate %_struct_6 0 NonWritable + OpMemberDecorate %_struct_6 0 Offset 0 + OpDecorate %_struct_6 BufferBlock + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 0 + OpDecorate %_arr_v2float_uint_648 ArrayStride 8 + OpMemberDecorate %_struct_9 0 Offset 0 + OpDecorate %_struct_9 BufferBlock + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 1 + OpDecorate %_arr_v2float_uint_648_0 ArrayStride 8 + OpMemberDecorate %_struct_13 0 Offset 0 + OpDecorate %_struct_13 BufferBlock + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %_struct_19 = OpTypeStruct %v2float %v2float + %10 = OpTypeFunction %_struct_19 %_ptr_Function_v2float +%_ptr_Function__struct_19 = OpTypePointer Function %_struct_19 + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %uint_648 = OpConstant %uint 648 + %bool = OpTypeBool + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_324 = OpConstant %uint 324 +%_arr_v2uint_uint_324 = OpTypeArray %v2uint %uint_324 + %_struct_6 = OpTypeStruct %_arr_v2uint_uint_324 +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 + %7 = OpVariable %_ptr_Uniform__struct_6 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_arr_v2float_uint_648 = OpTypeArray %v2float %uint_648 + %_struct_9 = OpTypeStruct %_arr_v2float_uint_648 +%_ptr_Uniform__struct_9 = OpTypePointer Uniform %_struct_9 + %11 = OpVariable %_ptr_Uniform__struct_9 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_arr_v2float_uint_648_0 = OpTypeArray %v2float %uint_648 + %_struct_13 = OpTypeStruct %_arr_v2float_uint_648_0 +%_ptr_Uniform__struct_13 = OpTypePointer Uniform %_struct_13 + %14 = OpVariable %_ptr_Uniform__struct_13 Uniform + %int_1 = OpConstant %int 1 + %2 = OpFunction %void None %3 + %5 = OpLabel + %46 = OpVariable %_ptr_Function_uint Function + %47 = OpVariable %_ptr_Function_v2uint Function + %48 = OpVariable %_ptr_Function_v2float Function + %50 = OpVariable %_ptr_Function__struct_19 Function + OpStore %46 %uint_0 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %uint %46 + %38 = OpULessThan %bool %35 %uint_648 + OpBranchConditional %38 %31 %32 + %31 = OpLabel + %49 = OpLoad %uint %46 + %51 = OpUDiv %uint %49 %uint_2 + %53 = OpAccessChain %_ptr_Uniform_v2uint %7 %int_0 %51 + %54 = OpLoad %v2uint %53 + OpStore %47 %54 + %56 = OpLoad %v2uint %47 + %57 = OpBitcast %v2float %56 + OpStore %48 %57 + %62 = OpLoad %uint %46 + %64 = OpIAdd %uint %62 %uint_1 + %65 = OpLoad %v2float %48 + %66 = OpLoad %uint %46 + %68 = OpAccessChain %_ptr_Uniform_v2float %11 %int_0 %66 + %69 = OpExtInst %v2float %1 Modf %65 %68 + %70 = OpAccessChain %_ptr_Uniform_v2float %11 %int_0 %64 + OpStore %70 %69 + %73 = OpLoad %v2float %48 + %74 = OpExtInst %_struct_19 %1 ModfStruct %73 + OpStore %50 %74 + %79 = OpLoad %uint %46 + %81 = OpAccessChain %_ptr_Function_v2float %50 %int_1 + %82 = OpLoad %v2float %81 + %83 = OpAccessChain %_ptr_Uniform_v2float %14 %int_0 %79 + OpStore %83 %82 + %84 = OpLoad %uint %46 + %85 = OpIAdd %uint %84 %uint_1 + %86 = OpAccessChain %_ptr_Function_v2float %50 %int_0 + %87 = OpLoad %v2float %86 + %88 = OpAccessChain %_ptr_Uniform_v2float %14 %int_0 %85 + OpStore %88 %87 + OpBranch %33 + %33 = OpLabel + %89 = OpLoad %uint %46 + %90 = OpIAdd %uint %89 %uint_2 + OpStore %46 %90 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp new file mode 100644 index 0000000000..8319dfdb60 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-basic.spv14.asm.comp @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 %3 %4 %5 %6 + OpExecutionMode %1 LocalSize 4 1 1 + OpDecorate %7 Block + OpMemberDecorate %7 0 Offset 0 + OpDecorate %8 ArrayStride 16 + OpDecorate %9 Block + OpMemberDecorate %9 0 Offset 0 + OpDecorate %10 ArrayStride 68 + OpDecorate %11 Block + OpMemberDecorate %11 0 Offset 0 + OpDecorate %12 ArrayStride 4 + OpDecorate %13 ArrayStride 4 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 1 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 2 + OpDecorate %5 BuiltIn LocalInvocationId + OpDecorate %6 BuiltIn WorkgroupId + %14 = OpTypeVoid + %15 = OpTypeBool + %16 = OpTypeInt 32 1 + %17 = OpConstant %16 0 + %18 = OpConstant %16 1 + %19 = OpConstant %16 4 + %20 = OpConstant %16 16 + %21 = OpConstant %16 17 + %22 = OpTypeVector %16 3 + %23 = OpTypePointer Input %22 + %12 = OpTypeArray %16 %19 + %8 = OpTypeRuntimeArray %12 + %7 = OpTypeStruct %8 + %24 = OpTypePointer StorageBuffer %7 + %25 = OpTypePointer StorageBuffer %12 + %13 = OpTypeArray %16 %21 + %10 = OpTypeRuntimeArray %13 + %9 = OpTypeStruct %10 + %26 = OpTypePointer StorageBuffer %9 + %27 = OpTypePointer StorageBuffer %13 + %28 = OpTypePointer StorageBuffer %16 + %11 = OpTypeStruct %16 + %29 = OpTypePointer Uniform %11 + %30 = OpTypePointer Uniform %16 + %2 = OpVariable %24 StorageBuffer + %3 = OpVariable %26 StorageBuffer + %4 = OpVariable %29 Uniform + %5 = OpVariable %23 Input + %6 = OpVariable %23 Input + %31 = OpTypeFunction %14 + %1 = OpFunction %14 None %31 + %32 = OpLabel + %33 = OpAccessChain %30 %4 %17 + %34 = OpLoad %16 %33 + %35 = OpLoad %22 %6 + %36 = OpCompositeExtract %16 %35 0 + %37 = OpLoad %22 %5 + %38 = OpCompositeExtract %16 %37 0 + %39 = OpAccessChain %25 %2 %17 %17 + %40 = OpAccessChain %25 %2 %17 %36 + %41 = OpSGreaterThanEqual %15 %36 %34 + OpSelectionMerge %42 None + OpBranchConditional %41 %43 %42 + %43 = OpLabel + OpReturn + %42 = OpLabel + %44 = OpIEqual %15 %38 %18 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %45 + %46 = OpLabel + %47 = OpPtrDiff %16 %40 %39 + %48 = OpAccessChain %28 %3 %17 %36 %20 + OpStore %48 %47 + OpBranch %45 + %45 = OpLabel + %49 = OpPhi %16 %17 %42 %17 %46 %50 %45 + %50 = OpIAdd %16 %49 %18 + %51 = OpIEqual %15 %50 %19 + %52 = OpIMul %16 %38 %19 + %53 = OpIAdd %16 %52 %49 + %54 = OpAccessChain %28 %40 %38 + %55 = OpAccessChain %28 %40 %49 + %56 = OpPtrDiff %16 %54 %55 + %57 = OpAccessChain %28 %3 %17 %36 %53 + OpStore %57 %56 + OpLoopMerge %58 %45 None + OpBranchConditional %51 %58 %45 + %58 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp new file mode 100644 index 0000000000..8566491955 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrdiff-opptraccesschain-elem-offset.spv14.asm.comp @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 46 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 %3 %4 %5 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %6 ArrayStride 4 + OpDecorate %7 Block + OpMemberDecorate %7 0 Offset 0 + OpMemberDecorate %7 1 Offset 4 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %8 ArrayStride 8 + OpDecorate %9 Block + OpMemberDecorate %9 0 Offset 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 1 + OpDecorate %10 ArrayStride 4 + %11 = OpTypeVoid + %12 = OpTypeBool + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 -1 + %15 = OpConstant %13 0 + %16 = OpConstant %13 1 + %17 = OpConstant %13 2 + %18 = OpConstant %13 3 + %19 = OpTypeVector %13 2 + %6 = OpTypeRuntimeArray %13 + %7 = OpTypeStruct %13 %6 + %20 = OpTypePointer StorageBuffer %7 + %2 = OpVariable %20 StorageBuffer + %8 = OpTypeRuntimeArray %19 + %9 = OpTypeStruct %8 + %21 = OpTypePointer StorageBuffer %9 + %3 = OpVariable %21 StorageBuffer + %10 = OpTypePointer StorageBuffer %13 + %22 = OpTypePointer Private %10 + %4 = OpVariable %22 Private + %5 = OpVariable %22 Private + %23 = OpTypePointer StorageBuffer %13 + %24 = OpTypePointer StorageBuffer %19 + %25 = OpTypeFunction %11 + %1 = OpFunction %11 None %25 + %26 = OpLabel + %27 = OpAccessChain %23 %2 %15 + %28 = OpLoad %13 %27 + %29 = OpAccessChain %10 %2 %16 %15 + OpStore %4 %29 + %30 = OpPtrAccessChain %10 %29 %28 + OpStore %5 %30 + %31 = OpSLessThanEqual %12 %28 %15 + OpSelectionMerge %32 None + OpBranchConditional %31 %32 %33 + %33 = OpLabel + %34 = OpPhi %13 %15 %26 %35 %33 + %36 = OpLoad %10 %4 + %37 = OpLoad %10 %5 + %38 = OpPtrAccessChain %10 %36 %16 + %39 = OpPtrAccessChain %10 %37 %14 + %35 = OpIAdd %13 %34 %16 + OpStore %4 %38 + OpStore %5 %39 + %40 = OpPtrDiff %13 %36 %37 + %41 = OpPtrDiff %13 %37 %36 + %42 = OpCompositeConstruct %19 %40 %41 + %43 = OpAccessChain %24 %3 %15 %34 + OpStore %43 %42 + %44 = OpSGreaterThanEqual %12 %34 %28 + OpLoopMerge %45 %33 None + OpBranchConditional %44 %45 %33 + %45 = OpLabel + OpBranch %32 + %32 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp new file mode 100644 index 0000000000..5a97976ce8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-basic.spv14.asm.comp @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 %3 %4 %5 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %6 ArrayStride 4 + OpDecorate %7 Block + OpMemberDecorate %7 0 Offset 0 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 1 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 2 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 3 + %8 = OpTypeVoid + %9 = OpTypeBool + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpConstant %10 1 + %6 = OpTypeRuntimeArray %10 + %7 = OpTypeStruct %6 + %13 = OpTypePointer StorageBuffer %7 + %14 = OpTypePointer StorageBuffer %6 + %15 = OpTypePointer StorageBuffer %10 + %2 = OpVariable %13 StorageBuffer + %3 = OpVariable %13 StorageBuffer + %4 = OpVariable %13 StorageBuffer + %5 = OpVariable %13 StorageBuffer + %16 = OpTypeFunction %8 + %1 = OpFunction %8 None %16 + %17 = OpLabel + %18 = OpCopyObject %10 %11 + %19 = OpAccessChain %14 %2 %11 + %20 = OpAccessChain %15 %2 %11 %11 + %21 = OpAccessChain %14 %3 %11 + %22 = OpAccessChain %15 %3 %11 %11 + %23 = OpAccessChain %14 %4 %11 + %24 = OpAccessChain %15 %4 %11 %11 + %25 = OpPtrEqual %9 %2 %3 + %26 = OpSelect %10 %25 %12 %11 + %27 = OpAccessChain %15 %5 %11 %18 + %28 = OpIAdd %10 %18 %12 + OpStore %27 %26 + %29 = OpPtrEqual %9 %19 %21 + %30 = OpSelect %10 %29 %12 %11 + %31 = OpAccessChain %15 %5 %11 %28 + %32 = OpIAdd %10 %28 %12 + OpStore %31 %30 + %33 = OpPtrEqual %9 %20 %22 + %34 = OpSelect %10 %33 %12 %11 + %35 = OpAccessChain %15 %5 %11 %32 + %36 = OpIAdd %10 %32 %12 + OpStore %35 %34 + %37 = OpPtrEqual %9 %2 %4 + %38 = OpSelect %10 %37 %12 %11 + %39 = OpAccessChain %15 %5 %11 %36 + %40 = OpIAdd %10 %36 %12 + OpStore %39 %38 + %41 = OpPtrEqual %9 %19 %23 + %42 = OpSelect %10 %41 %12 %11 + %43 = OpAccessChain %15 %5 %11 %40 + %44 = OpIAdd %10 %40 %12 + OpStore %43 %42 + %45 = OpPtrEqual %9 %20 %24 + %46 = OpSelect %10 %45 %12 %11 + %47 = OpAccessChain %15 %5 %11 %44 + %48 = OpIAdd %10 %44 %12 + OpStore %47 %46 + %49 = OpPtrEqual %9 %3 %4 + %50 = OpSelect %10 %49 %12 %11 + %51 = OpAccessChain %15 %5 %11 %48 + %52 = OpIAdd %10 %48 %12 + OpStore %51 %50 + %53 = OpPtrEqual %9 %21 %23 + %54 = OpSelect %10 %53 %12 %11 + %55 = OpAccessChain %15 %5 %11 %52 + %56 = OpIAdd %10 %52 %12 + OpStore %55 %54 + %57 = OpPtrEqual %9 %22 %24 + %58 = OpSelect %10 %57 %12 %11 + %59 = OpAccessChain %15 %5 %11 %56 + %60 = OpIAdd %10 %56 %12 + OpStore %59 %58 + %61 = OpPtrEqual %9 %2 %2 + %62 = OpSelect %10 %61 %12 %11 + %63 = OpAccessChain %15 %5 %11 %60 + OpStore %63 %62 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp new file mode 100644 index 0000000000..89813b2265 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrequal-row-maj-mtx-bypass-transpose.spv14.asm.comp @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 %3 %4 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %5 ArrayStride 4 + OpDecorate %6 Block + OpDecorate %7 Block + OpMemberDecorate %6 0 ColMajor + OpMemberDecorate %6 0 Offset 0 + OpMemberDecorate %6 0 MatrixStride 16 + OpMemberDecorate %6 1 RowMajor + OpMemberDecorate %6 1 Offset 64 + OpMemberDecorate %6 1 MatrixStride 16 + OpMemberDecorate %6 2 Offset 128 + OpMemberDecorate %6 3 Offset 132 + OpMemberDecorate %7 0 Offset 0 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 1 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 2 + %8 = OpTypeVoid + %9 = OpTypeBool + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpConstant %10 1 + %13 = OpConstant %10 2 + %14 = OpConstant %10 3 + %15 = OpTypeFloat 32 + %5 = OpTypeRuntimeArray %10 + %16 = OpTypeVector %15 4 + %17 = OpTypeMatrix %16 4 + %6 = OpTypeStruct %17 %17 %15 %15 + %7 = OpTypeStruct %5 + %18 = OpTypePointer StorageBuffer %6 + %19 = OpTypePointer StorageBuffer %7 + %20 = OpTypePointer StorageBuffer %17 + %21 = OpTypePointer StorageBuffer %10 + %22 = OpTypePointer StorageBuffer %15 + %23 = OpTypePointer StorageBuffer %16 + %2 = OpVariable %18 StorageBuffer + %3 = OpVariable %18 StorageBuffer + %4 = OpVariable %19 StorageBuffer + %24 = OpTypeFunction %8 + %1 = OpFunction %8 None %24 + %25 = OpLabel + %26 = OpCopyObject %10 %11 + %27 = OpAccessChain %22 %2 %13 + %28 = OpAccessChain %22 %2 %14 + %29 = OpAccessChain %22 %3 %13 + %30 = OpAccessChain %22 %3 %14 + %31 = OpAccessChain %20 %2 %11 + %32 = OpAccessChain %20 %2 %12 + %33 = OpAccessChain %23 %2 %11 %11 + %34 = OpAccessChain %23 %2 %11 %12 + %35 = OpAccessChain %22 %2 %11 %11 %11 + %36 = OpPtrEqual %9 %27 %28 + %37 = OpSelect %10 %36 %11 %12 + %38 = OpAccessChain %21 %4 %11 %26 + %39 = OpIAdd %10 %26 %12 + OpStore %38 %37 + %40 = OpPtrEqual %9 %27 %29 + %41 = OpSelect %10 %40 %11 %12 + %42 = OpAccessChain %21 %4 %11 %39 + %43 = OpIAdd %10 %39 %12 + OpStore %42 %41 + %44 = OpSelect %22 %40 %27 %28 + %45 = OpSelect %22 %40 %29 %30 + %46 = OpPtrEqual %9 %44 %45 + %47 = OpSelect %10 %46 %11 %12 + %48 = OpAccessChain %21 %4 %11 %43 + %49 = OpIAdd %10 %43 %12 + OpStore %48 %47 + %50 = OpSelect %22 %46 %27 %28 + %51 = OpPtrEqual %9 %50 %35 + %52 = OpSelect %10 %51 %11 %12 + %53 = OpAccessChain %21 %4 %11 %49 + %54 = OpIAdd %10 %49 %12 + OpStore %53 %52 + %55 = OpPtrEqual %9 %31 %32 + %56 = OpSelect %10 %55 %11 %12 + %57 = OpAccessChain %21 %4 %11 %54 + %58 = OpIAdd %10 %54 %12 + OpStore %57 %56 + %59 = OpPtrEqual %9 %33 %34 + %60 = OpSelect %10 %59 %11 %12 + %61 = OpAccessChain %21 %4 %11 %58 + %62 = OpIAdd %10 %58 %12 + OpStore %61 %56 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp new file mode 100644 index 0000000000..1cbf8045c5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/opptrnotequal-basic.spv14.asm.comp @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 64 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 %3 %4 %5 + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %6 ArrayStride 4 + OpDecorate %7 Block + OpMemberDecorate %7 0 Offset 0 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 1 + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 2 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 3 + %8 = OpTypeVoid + %9 = OpTypeBool + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpConstant %10 1 + %6 = OpTypeRuntimeArray %10 + %7 = OpTypeStruct %6 + %13 = OpTypePointer StorageBuffer %7 + %14 = OpTypePointer StorageBuffer %6 + %15 = OpTypePointer StorageBuffer %10 + %2 = OpVariable %13 StorageBuffer + %3 = OpVariable %13 StorageBuffer + %4 = OpVariable %13 StorageBuffer + %5 = OpVariable %13 StorageBuffer + %16 = OpTypeFunction %8 + %1 = OpFunction %8 None %16 + %17 = OpLabel + %18 = OpCopyObject %10 %11 + %19 = OpAccessChain %14 %2 %11 + %20 = OpAccessChain %15 %2 %11 %11 + %21 = OpAccessChain %14 %3 %11 + %22 = OpAccessChain %15 %3 %11 %11 + %23 = OpAccessChain %14 %4 %11 + %24 = OpAccessChain %15 %4 %11 %11 + %25 = OpPtrNotEqual %9 %2 %3 + %26 = OpSelect %10 %25 %12 %11 + %27 = OpAccessChain %15 %5 %11 %18 + %28 = OpIAdd %10 %18 %12 + OpStore %27 %26 + %29 = OpPtrNotEqual %9 %19 %21 + %30 = OpSelect %10 %29 %12 %11 + %31 = OpAccessChain %15 %5 %11 %28 + %32 = OpIAdd %10 %28 %12 + OpStore %31 %30 + %33 = OpPtrNotEqual %9 %20 %22 + %34 = OpSelect %10 %33 %12 %11 + %35 = OpAccessChain %15 %5 %11 %32 + %36 = OpIAdd %10 %32 %12 + OpStore %35 %34 + %37 = OpPtrNotEqual %9 %2 %4 + %38 = OpSelect %10 %37 %12 %11 + %39 = OpAccessChain %15 %5 %11 %36 + %40 = OpIAdd %10 %36 %12 + OpStore %39 %38 + %41 = OpPtrNotEqual %9 %19 %23 + %42 = OpSelect %10 %41 %12 %11 + %43 = OpAccessChain %15 %5 %11 %40 + %44 = OpIAdd %10 %40 %12 + OpStore %43 %42 + %45 = OpPtrNotEqual %9 %20 %24 + %46 = OpSelect %10 %45 %12 %11 + %47 = OpAccessChain %15 %5 %11 %44 + %48 = OpIAdd %10 %44 %12 + OpStore %47 %46 + %49 = OpPtrNotEqual %9 %3 %4 + %50 = OpSelect %10 %49 %12 %11 + %51 = OpAccessChain %15 %5 %11 %48 + %52 = OpIAdd %10 %48 %12 + OpStore %51 %50 + %53 = OpPtrNotEqual %9 %21 %23 + %54 = OpSelect %10 %53 %12 %11 + %55 = OpAccessChain %15 %5 %11 %52 + %56 = OpIAdd %10 %52 %12 + OpStore %55 %54 + %57 = OpPtrNotEqual %9 %22 %24 + %58 = OpSelect %10 %57 %12 %11 + %59 = OpAccessChain %15 %5 %11 %56 + %60 = OpIAdd %10 %56 %12 + OpStore %59 %58 + %61 = OpPtrNotEqual %9 %2 %2 + %62 = OpSelect %10 %61 %12 %11 + %63 = OpAccessChain %15 %5 %11 %60 + OpStore %63 %62 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp new file mode 100644 index 0000000000..b4e622bace --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/spec-constant-name-aliasing.asm.comp @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %A "A" + OpName %B "A" + OpName %C "A" + OpName %D "A" + OpName %E "A" + OpName %F "A" + OpName %G "A" + OpName %H "A" + OpName %I "A" + OpName %J "A" + OpName %K "A" + OpName %L "A" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %A SpecId 0 + OpDecorate %B SpecId 1 + OpDecorate %C SpecId 2 + OpDecorate %D SpecId 3 + OpDecorate %E SpecId 4 + OpDecorate %F SpecId 5 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %A = OpSpecConstant %int 0 + %B = OpSpecConstant %int 1 + %C = OpSpecConstant %int 2 + %D = OpSpecConstant %int 3 + %E = OpSpecConstant %int 4 + %F = OpSpecConstant %int 5 + %G = OpSpecConstantOp %int ISub %A %B + %H = OpSpecConstantOp %int ISub %G %C + %I = OpSpecConstantOp %int ISub %H %D + %J = OpSpecConstantOp %int ISub %I %E + %K = OpSpecConstantOp %int ISub %J %F + %L = OpSpecConstantOp %int IAdd %K %F +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %32 %L + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp new file mode 100644 index 0000000000..bdf2027a80 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-basic.invalid.asm.comp @@ -0,0 +1,58 @@ +; SPIR-V +; Version: 1.0 +; Generator: Codeplay; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpExtension "SPV_KHR_variable_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "main" %gl_WorkGroupID + OpSource OpenCL_C 120 + OpDecorate %15 SpecId 0 + ;OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %size1 = OpConstant %uint 1 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_runtimearr_float = OpTypeArray %float %size1 ; Runtime arrays do not work yet in MSL. + %_struct_4 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %uint_0 = OpConstant %uint 0 +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpSpecConstant %uint 1 + %16 = OpConstant %uint 2 + %17 = OpSpecConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %20 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %22 = OpFunction %void None %8 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %25 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %25 + %29 = OpLoad %float %28 + %30 = OpFAdd %float %27 %29 + OpStore %28 %30 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp new file mode 100644 index 0000000000..010d17c202 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointersStorageBuffer + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %copy_out_f1_f1_ "copy_out(f1;f1;" + OpName %A "A" + OpName %B "B" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpName %_ "" + OpName %SSBORead "SSBORead" + OpMemberName %SSBORead 0 "b" + OpName %__0 "" + OpMemberDecorate %SSBO 0 NonReadable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %SSBORead 0 NonWritable + OpMemberDecorate %SSBORead 0 Offset 0 + OpDecorate %SSBORead Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %8 = OpTypeFunction %void %_ptr_StorageBuffer_float %_ptr_StorageBuffer_float + %SSBO = OpTypeStruct %float +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %SSBORead = OpTypeStruct %float +%_ptr_StorageBuffer_SSBORead = OpTypePointer StorageBuffer %SSBORead + %__0 = OpVariable %_ptr_StorageBuffer_SSBORead StorageBuffer + %main = OpFunction %void None %3 + %5 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %25 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0 + %26 = OpAccessChain %_ptr_StorageBuffer_float %__0 %int_0 + %27 = OpFunctionCall %void %copy_out_f1_f1_ %25 %26 + OpReturn + OpFunctionEnd +%copy_out_f1_f1_ = OpFunction %void None %8 + %A = OpFunctionParameter %_ptr_StorageBuffer_float + %B = OpFunctionParameter %_ptr_StorageBuffer_float + %12 = OpLabel + %13 = OpLoad %float %B + OpStore %A %13 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp new file mode 100644 index 0000000000..ba6267cc08 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp @@ -0,0 +1,152 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + %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 %foo "foo" + OpMemberName %foo 0 "a" + OpMemberName %foo 1 "b" + OpMemberName %foo 2 "c" + OpName %bar "bar" + OpMemberName %bar 0 "d" + OpName %baz "baz" + OpMemberName %baz 0 "e" + OpName %buf "buf" + OpName %buf2 "buf2" + OpName %cb "cb" + OpName %tgsm "tgsm" + OpName %sbuf "sbuf" + OpName %sbuf2 "sbuf2" + OpName %stgsm "stgsm" + OpName %select_buffer "select_buffer" + OpName %select_buffer_null "select_buffer_null" + OpName %select_tgsm "select_tgsm" + OpName %cur "cur" + OpMemberDecorate %foo 0 Offset 0 + OpMemberDecorate %foo 1 Offset 512 + OpMemberDecorate %foo 2 Offset 520 + OpMemberDecorate %bar 0 Offset 0 + OpMemberDecorate %baz 0 Offset 0 + OpDecorate %foo Block + OpDecorate %bar Block + OpDecorate %baz Block + OpDecorate %buf DescriptorSet 0 + OpDecorate %buf Binding 0 + OpDecorate %cb DescriptorSet 0 + OpDecorate %cb Binding 3 + OpDecorate %buf2 DescriptorSet 0 + OpDecorate %buf2 Binding 4 + OpDecorate %_ptr_Workgroup_int ArrayStride 4 + OpDecorate %_ptr_StorageBuffer_int ArrayStride 4 + OpDecorate %_arr_int_uint_128 ArrayStride 4 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %22 = OpTypeFunction %void + %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 + %uint_128 = OpConstant %uint 128 +%_arr_int_uint_128 = OpTypeArray %int %uint_128 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %foo = OpTypeStruct %_arr_int_uint_128 %uint %v2float +%_ptr_StorageBuffer_foo = OpTypePointer StorageBuffer %foo + %buf = OpVariable %_ptr_StorageBuffer_foo StorageBuffer + %bar = OpTypeStruct %int +%_ptr_Uniform_bar = OpTypePointer Uniform %bar + %cb = OpVariable %_ptr_Uniform_bar Uniform + %baz = OpTypeStruct %_arr_int_uint_128 +%_ptr_StorageBuffer_baz = OpTypePointer StorageBuffer %baz + %buf2 = OpVariable %_ptr_StorageBuffer_baz StorageBuffer +%_ptr_Workgroup__arr_int_uint_128 = OpTypePointer Workgroup %_arr_int_uint_128 + %tgsm = OpVariable %_ptr_Workgroup__arr_int_uint_128 Workgroup +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Private__ptr_StorageBuffer_int = OpTypePointer Private %_ptr_StorageBuffer_int + %sbuf = OpVariable %_ptr_Private__ptr_StorageBuffer_int Private + %sbuf2 = OpVariable %_ptr_Private__ptr_StorageBuffer_int Private +%_ptr_Workgroup_int = OpTypePointer Workgroup %int +%_ptr_Private__ptr_Workgroup_int = OpTypePointer Private %_ptr_Workgroup_int + %stgsm = OpVariable %_ptr_Private__ptr_Workgroup_int Private + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %44 = OpTypeFunction %_ptr_StorageBuffer_int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %47 = OpConstantNull %_ptr_StorageBuffer_int + %48 = OpTypeFunction %_ptr_Workgroup_int + %49 = OpConstantNull %_ptr_Workgroup_int +%_ptr_Function__ptr_Workgroup_int = OpTypePointer Function %_ptr_Workgroup_int +%select_buffer = OpFunction %_ptr_StorageBuffer_int None %44 + %51 = OpLabel + %52 = OpAccessChain %_ptr_Uniform_int %cb %uint_0 + %53 = OpLoad %int %52 + %54 = OpINotEqual %bool %53 %int_0 + %55 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 %uint_0 + %56 = OpAccessChain %_ptr_StorageBuffer_int %buf2 %uint_0 %uint_0 + %57 = OpSelect %_ptr_StorageBuffer_int %54 %55 %56 + OpReturnValue %57 + OpFunctionEnd +%select_buffer_null = OpFunction %_ptr_StorageBuffer_int None %44 + %58 = OpLabel + %59 = OpAccessChain %_ptr_Uniform_int %cb %uint_0 + %60 = OpLoad %int %59 + %61 = OpINotEqual %bool %60 %int_0 + %62 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 %uint_0 + %63 = OpSelect %_ptr_StorageBuffer_int %61 %62 %47 + OpReturnValue %63 + OpFunctionEnd +%select_tgsm = OpFunction %_ptr_Workgroup_int None %48 + %64 = OpLabel + %65 = OpAccessChain %_ptr_Uniform_int %cb %uint_0 + %66 = OpLoad %int %65 + %67 = OpINotEqual %bool %66 %int_0 + %68 = OpAccessChain %_ptr_Workgroup_int %tgsm %uint_0 + %69 = OpSelect %_ptr_Workgroup_int %67 %68 %49 + OpReturnValue %69 + OpFunctionEnd + %main = OpFunction %void None %22 + %70 = OpLabel + %cur = OpVariable %_ptr_Function__ptr_Workgroup_int Function + %71 = OpFunctionCall %_ptr_StorageBuffer_int %select_buffer + OpStore %sbuf %71 + %72 = OpFunctionCall %_ptr_StorageBuffer_int %select_buffer_null + OpStore %sbuf2 %72 + %73 = OpFunctionCall %_ptr_Workgroup_int %select_tgsm + OpStore %stgsm %73 + %74 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 %uint_0 + %75 = OpLoad %_ptr_Workgroup_int %stgsm + %76 = OpCopyObject %_ptr_Workgroup_int %75 + OpStore %cur %76 + OpBranch %77 + %77 = OpLabel + %78 = OpPhi %_ptr_StorageBuffer_int %74 %70 %79 %80 + %81 = OpLoad %_ptr_Workgroup_int %cur + %82 = OpLoad %int %78 + %83 = OpINotEqual %bool %82 %int_0 + OpLoopMerge %85 %80 None + OpBranchConditional %83 %84 %85 + %84 = OpLabel + %86 = OpLoad %int %81 + %87 = OpIAdd %int %82 %86 + OpStore %78 %87 + OpStore %81 %87 + OpBranch %80 + %80 = OpLabel + %79 = OpPtrAccessChain %_ptr_StorageBuffer_int %78 %uint_1 + %88 = OpPtrAccessChain %_ptr_Workgroup_int %81 %uint_1 + OpStore %cur %88 + OpBranch %77 + %85 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag new file mode 100644 index 0000000000..1a268acb2f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.argument.msl2.asm.frag @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %UBOs "UBOs" + OpMemberName %UBOs 0 "v" + OpName %ubos "ubos" + OpDecorate %FragColor Location 0 + OpMemberDecorate %UBOs 0 Offset 0 + OpDecorate %UBOs Block + OpDecorate %ubos DescriptorSet 0 + OpDecorate %ubos Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %UBOs = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_UBOs_uint_2 = OpTypeArray %UBOs %uint_2 +%_ptr_Uniform__arr_UBOs_uint_2 = OpTypePointer Uniform %_arr_UBOs_uint_2 +%_ptr_Uniform_UBOs = OpTypePointer Uniform %UBOs + %ubos = OpVariable %_ptr_Uniform__arr_UBOs_uint_2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr0_partial = OpAccessChain %_ptr_Uniform_UBOs %ubos %int_0 + %ptr0 = OpAccessChain %_ptr_Uniform_v4float %ptr0_partial %int_0 + %ptr1_partial = OpAccessChain %_ptr_Uniform_UBOs %ubos %int_1 + %ptr1 = OpAccessChain %_ptr_Uniform_v4float %ptr1_partial %int_0 + %20 = OpLoad %v4float %ptr0 + %23 = OpLoad %v4float %ptr1 + %24 = OpFAdd %v4float %20 %23 + OpStore %FragColor %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag new file mode 100644 index 0000000000..1a268acb2f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/access-chain-array-ubo-partial.asm.frag @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %UBOs "UBOs" + OpMemberName %UBOs 0 "v" + OpName %ubos "ubos" + OpDecorate %FragColor Location 0 + OpMemberDecorate %UBOs 0 Offset 0 + OpDecorate %UBOs Block + OpDecorate %ubos DescriptorSet 0 + OpDecorate %ubos Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %UBOs = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_UBOs_uint_2 = OpTypeArray %UBOs %uint_2 +%_ptr_Uniform__arr_UBOs_uint_2 = OpTypePointer Uniform %_arr_UBOs_uint_2 +%_ptr_Uniform_UBOs = OpTypePointer Uniform %UBOs + %ubos = OpVariable %_ptr_Uniform__arr_UBOs_uint_2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr0_partial = OpAccessChain %_ptr_Uniform_UBOs %ubos %int_0 + %ptr0 = OpAccessChain %_ptr_Uniform_v4float %ptr0_partial %int_0 + %ptr1_partial = OpAccessChain %_ptr_Uniform_UBOs %ubos %int_1 + %ptr1 = OpAccessChain %_ptr_Uniform_v4float %ptr1_partial %int_0 + %20 = OpLoad %v4float %ptr0 + %23 = OpLoad %v4float %ptr1 + %24 = OpFAdd %v4float %20 %23 + OpStore %FragColor %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..6782b12473 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_ + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpMemberName %AA 0 "foo" + OpMemberName %AB 0 "foo" + OpMemberName %A 0 "_aa" + OpMemberName %A 1 "ab" + OpMemberName %BA 0 "foo" + OpMemberName %BB 0 "foo" + OpMemberName %B 0 "_ba" + OpMemberName %B 1 "bb" + OpName %VertexData "VertexData" + OpMemberName %VertexData 0 "_a" + OpMemberName %VertexData 1 "b" + OpName %_ "" + OpMemberName %CA 0 "foo" + OpMemberName %C 0 "_ca" + OpMemberName %DA 0 "foo" + OpMemberName %D 0 "da" + OpName %UBO "UBO" + OpMemberName %UBO 0 "_c" + OpMemberName %UBO 1 "d" + OpName %__0 "" + OpMemberName %E 0 "a" + OpName %SSBO "SSBO" + ;OpMemberName %SSBO 0 "e" Test that we don't try to assign bogus aliases. + OpMemberName %SSBO 1 "_e" + OpMemberName %SSBO 2 "f" + OpName %__1 "" + OpDecorate %VertexData Block + OpDecorate %_ Location 0 + OpMemberDecorate %CA 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %DA 0 Offset 0 + OpMemberDecorate %D 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %E 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpDecorate %SSBO BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %AA = OpTypeStruct %int + %AB = OpTypeStruct %int + %A = OpTypeStruct %AA %AB + %BA = OpTypeStruct %int + %BB = OpTypeStruct %int + %B = OpTypeStruct %BA %BB + %VertexData = OpTypeStruct %A %B +%_ptr_Input_VertexData = OpTypePointer Input %VertexData + %_ = OpVariable %_ptr_Input_VertexData Input + %CA = OpTypeStruct %int + %C = OpTypeStruct %CA + %DA = OpTypeStruct %int + %D = OpTypeStruct %DA + %UBO = OpTypeStruct %C %D +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %__0 = OpVariable %_ptr_Uniform_UBO Uniform + %E = OpTypeStruct %int + %SSBO = OpTypeStruct %E %E %E +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %__1 = OpVariable %_ptr_Uniform_SSBO Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag new file mode 100644 index 0000000000..fb7cdb0718 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/component-insert-packed-expression.asm.frag @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %frag "main" %gl_FragCoord %out_var_SV_Target + OpExecutionMode %frag OriginUpperLeft + OpSource HLSL 600 + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "_BorderWidths" + OpName %_Globals "$Globals" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %frag "frag" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 0 + OpDecorate %_arr_float_uint_4 ArrayStride 16 + OpMemberDecorate %type__Globals 0 Offset 0 + OpDecorate %type__Globals Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int_2 = OpConstant %int 2 + %uint = OpTypeInt 32 0 + %float_1 = OpConstant %float 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%type__Globals = OpTypeStruct %_arr_float_uint_4 +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %21 = OpTypeFunction %void + %v2float = OpTypeVector %float 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %bool = OpTypeBool + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %frag = OpFunction %void None %21 + %25 = OpLabel + %26 = OpLoad %v4float %gl_FragCoord + %27 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_0 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_1 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v2float %28 %30 + %32 = OpCompositeExtract %float %26 0 + %33 = OpFOrdGreaterThan %bool %32 %float_0 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + %36 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %37 = OpLoad %float %36 + %38 = OpCompositeInsert %v2float %37 %31 0 + OpBranch %34 + %34 = OpLabel + %39 = OpPhi %v2float %31 %25 %38 %35 + %40 = OpCompositeExtract %float %39 0 + %41 = OpCompositeExtract %float %39 1 + %42 = OpCompositeConstruct %v4float %40 %41 %float_0 %float_1 + OpStore %out_var_SV_Target %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..9408e69ac0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vInput %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %vInput "vInput" + OpName %FragColor "FragColor" + OpName %phi "PHI" + OpDecorate %vInput RelaxedPrecision + OpDecorate %vInput Location 0 + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %b0 RelaxedPrecision + OpDecorate %b1 RelaxedPrecision + OpDecorate %b2 RelaxedPrecision + OpDecorate %b3 RelaxedPrecision + OpDecorate %c1 RelaxedPrecision + OpDecorate %c3 RelaxedPrecision + OpDecorate %d4_mp RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vInput = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %float_3 = OpConstant %float 3 + %uint_2 = OpConstant %uint 2 + %float_4 = OpConstant %float 4 + %uint_3 = OpConstant %uint 3 + %v4float_arr2 = OpTypeArray %v4float %uint_2 + %v44float = OpTypeMatrix %v4float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v4undef = OpUndef %v4float + %v4const = OpConstantNull %v4float + %v4arrconst = OpConstantNull %v4float_arr2 + %v44const = OpConstantNull %v44float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + + %loaded0 = OpLoad %v4float %vInput + + ; Basic case (highp). + %a0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %a1 = OpCompositeInsert %v4float %float_2 %a0 1 + %a2 = OpCompositeInsert %v4float %float_3 %a1 2 + %a3 = OpCompositeInsert %v4float %float_4 %a2 3 + OpStore %FragColor %a3 + + ; Basic case (mediump). + %b0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %b1 = OpCompositeInsert %v4float %float_2 %b0 1 + %b2 = OpCompositeInsert %v4float %float_3 %b1 2 + %b3 = OpCompositeInsert %v4float %float_4 %b2 3 + OpStore %FragColor %b3 + + ; Mix relaxed precision. + %c0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %c1 = OpCompositeInsert %v4float %float_2 %c0 1 + %c2 = OpCompositeInsert %v4float %float_3 %c1 2 + %c3 = OpCompositeInsert %v4float %float_4 %c2 3 + OpStore %FragColor %c3 + + ; SSA use after insert + %d0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %d1 = OpCompositeInsert %v4float %float_2 %d0 1 + %d2 = OpCompositeInsert %v4float %float_3 %d1 2 + %d3 = OpCompositeInsert %v4float %float_4 %d2 3 + %d4 = OpFAdd %v4float %d3 %d0 + OpStore %FragColor %d4 + %d4_mp = OpFAdd %v4float %d3 %d1 + OpStore %FragColor %d4_mp + + ; Verify Insert behavior on Undef. + %e0 = OpCompositeInsert %v4float %float_1 %v4undef 0 + %e1 = OpCompositeInsert %v4float %float_2 %e0 1 + %e2 = OpCompositeInsert %v4float %float_3 %e1 2 + %e3 = OpCompositeInsert %v4float %float_4 %e2 3 + OpStore %FragColor %e3 + + ; Verify Insert behavior on Constant. + %f0 = OpCompositeInsert %v4float %float_1 %v4const 0 + OpStore %FragColor %f0 + + ; Verify Insert behavior on Array. + %g0 = OpCompositeInsert %v4float_arr2 %float_1 %v4arrconst 1 2 + %g1 = OpCompositeInsert %v4float_arr2 %float_2 %g0 0 3 + %g2 = OpCompositeExtract %v4float %g1 0 + OpStore %FragColor %g2 + %g3 = OpCompositeExtract %v4float %g1 1 + OpStore %FragColor %g3 + + ; Verify Insert behavior on Matrix. + %h0 = OpCompositeInsert %v44float %float_1 %v44const 1 2 + %h1 = OpCompositeInsert %v44float %float_2 %h0 2 3 + %h2 = OpCompositeExtract %v4float %h1 0 + OpStore %FragColor %h2 + %h3 = OpCompositeExtract %v4float %h1 1 + OpStore %FragColor %h3 + %h4 = OpCompositeExtract %v4float %h1 2 + OpStore %FragColor %h4 + %h5 = OpCompositeExtract %v4float %h1 3 + OpStore %FragColor %h5 + + ; Verify that we cannot RMW PHI variables. + OpBranch %next + %next = OpLabel + %phi = OpPhi %v4float %d2 %5 + %i0 = OpCompositeInsert %v4float %float_4 %phi 3 + OpStore %FragColor %i0 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag new file mode 100644 index 0000000000..d4bf014bbf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/constant-composite-block-no-array-stride-2.asm.frag @@ -0,0 +1,33 @@ +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %frag_out +OpExecutionMode %main OriginUpperLeft +OpDecorate %frag_out Location 0 +OpMemberDecorate %type 1 Offset 0 +%void = OpTypeVoid +%float = OpTypeFloat 32 +%uint = OpTypeInt 32 0 +%uint_2 = OpConstant %uint 2 +%const_1 = OpConstant %float 1.0 +%const_2 = OpConstant %float 2.0 +%const_3 = OpConstant %float 3.0 +%const_4 = OpConstant %float 4.0 +%const_5 = OpConstant %float 5.0 +%const_6 = OpConstant %float 6.0 +%arr_float_2 = OpTypeArray %float %uint_2 +%const_arr0 = OpConstantComposite %arr_float_2 %const_1 %const_2 +%const_arr1 = OpConstantComposite %arr_float_2 %const_3 %const_4 +%const_arr2 = OpConstantComposite %arr_float_2 %const_5 %const_6 +%type = OpTypeStruct %arr_float_2 %arr_float_2 %arr_float_2 +%float_ptr = OpTypePointer Output %float +%const_var = OpConstantComposite %type %const_arr0 %const_arr1 %const_arr2 +%type_ptr = OpTypePointer Function %type +%frag_out = OpVariable %float_ptr Output +%main_func = OpTypeFunction %void +%main = OpFunction %void None %main_func +%label = OpLabel +%var = OpVariable %type_ptr Function +OpStore %var %const_var +OpStore %frag_out %const_1 +OpReturn +OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag new file mode 100644 index 0000000000..ebab7fd0c9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/copy-memory-block-like-thread-local.asm.frag @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google rspirv; 0 +; Bound: 43 +; Schema: 0 + OpCapability ImageQuery + OpCapability Int8 + OpCapability RuntimeDescriptorArray + OpCapability StorageImageWriteWithoutFormat + OpCapability Shader + OpCapability VulkanMemoryModel + OpExtension "SPV_EXT_descriptor_indexing" + OpExtension "SPV_KHR_vulkan_memory_model" + OpMemoryModel Logical Vulkan + OpEntryPoint Fragment %1 "main" + OpExecutionMode %1 OriginUpperLeft + OpDecorate %2 ArrayStride 4 + OpMemberDecorate %3 0 Offset 0 + %4 = OpTypeInt 32 0 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpConstant %4 0 + %10 = OpConstant %4 1 + %11 = OpConstant %4 2 + %12 = OpConstant %4 4 + %13 = OpConstant %4 3 + %14 = OpConstant %5 0 + %2 = OpTypeArray %5 %12 + %15 = OpTypePointer Function %2 + %16 = OpTypeFunction %7 %15 + %3 = OpTypeStruct %2 + %17 = OpTypePointer Function %3 + %1 = OpFunction %7 None %8 + %31 = OpLabel + %33 = OpVariable %17 Function + %34 = OpVariable %15 Function + %39 = OpAccessChain %6 %34 %9 + OpStore %39 %14 + %40 = OpAccessChain %6 %34 %10 + OpStore %40 %14 + %41 = OpAccessChain %6 %34 %11 + OpStore %41 %14 + %42 = OpAccessChain %6 %34 %13 + OpStore %42 %14 + %37 = OpAccessChain %15 %33 %9 + OpCopyMemory %37 %34 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..a9650ddbb6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %EmptyStruct2Test "EmptyStruct2Test" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%EmptyStruct2Test = OpTypeStruct %EmptyStructTest +%_ptr_Function_EmptyStruct2Test = OpTypePointer Function %EmptyStruct2Test + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStruct2Test + %6 = OpTypeFunction %float %EmptyStruct2Test + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStruct2Test + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %value4 = OpConstantNull %EmptyStruct2Test + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStruct2Test + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStruct2Test + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStruct2Test Function + %18 = OpVariable %_ptr_Function_EmptyStruct2Test Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %value3 = OpCompositeConstruct %EmptyStruct2Test %value2 + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value3 + %24 = OpFunctionCall %float %GetValue2 %value4 + OpStore %value %22 + OpStore %value %23 + OpStore %value %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag new file mode 100644 index 0000000000..2f522f44b5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/fixup-entry-point-identifier.nomain.asm.frag @@ -0,0 +1,27 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 12 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %foo "_5ma@@in" %FragColor + OpExecutionMode %foo OriginUpperLeft + OpSource GLSL 450 + OpName %foo "FOO" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %foo = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %11 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..ca8022d4bb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %Tex "Tex" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %main "main" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %Tex DescriptorSet 0 + OpDecorate %Tex Binding 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %16 = OpTypeFunction %void + %Tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v3uint Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpLoad %v3uint %in_var_TEXCOORD0 + %21 = OpCompositeExtract %uint %20 2 + %27 = OpLoad %type_2d_image %Tex + %28 = OpImageFetch %v4float %27 %20 Lod %21 + OpStore %out_var_SV_Target0 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-gather.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-gather.asm.frag new file mode 100644 index 0000000000..f26bb07264 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-gather.asm.frag @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %psMain "main" %gl_FragCoord %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %psMain OriginUpperLeft + OpSource HLSL 500 + OpName %type_2d_image "type.2d.image" + OpName %g_texture "g_texture" + OpName %type_sampler "type.sampler" + OpName %g_sampler "g_sampler" + OpName %g_comp "g_comp" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %psMain "psMain" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %g_texture DescriptorSet 0 + OpDecorate %g_texture Binding 0 + OpDecorate %g_sampler DescriptorSet 0 + OpDecorate %g_sampler Binding 0 + OpDecorate %g_comp DescriptorSet 0 + OpDecorate %g_comp Binding 1 + OpDecorateString %g_texture UserTypeGOOGLE "texture2d" + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 + %16 = OpConstantComposite %v2int %int_0 %int_0 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %25 = OpTypeFunction %void +%type_sampled_image = OpTypeSampledImage %type_2d_image +%g_texture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %g_sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %g_comp = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %psMain = OpFunction %void None %25 + %26 = OpLabel + %27 = OpLoad %v2float %in_var_TEXCOORD0 + %28 = OpLoad %type_2d_image %g_texture + %29 = OpLoad %type_sampler %g_comp + %30 = OpSampledImage %type_sampled_image %28 %29 + %32 = OpLoad %type_sampler %g_sampler + %33 = OpSampledImage %type_sampled_image %28 %32 + %31 = OpImageGather %v4float %33 %27 %int_1 ConstOffset %16 + %34 = OpImageGather %v4float %33 %27 %int_0 ConstOffset %16 + %35 = OpFMul %v4float %34 %31 + OpStore %out_var_SV_Target0 %35 + OpReturn + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag new file mode 100644 index 0000000000..d4c2643978 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/image-type-normal-comparison-usage.asm.frag @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %ShadowMap "ShadowMap" + OpName %type_sampler "type.sampler" + OpName %SampleNormal "SampleNormal" + OpName %SampleShadow "SampleShadow" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %main "main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %ShadowMap DescriptorSet 0 + OpDecorate %ShadowMap Binding 0 + OpDecorate %SampleNormal DescriptorSet 0 + OpDecorate %SampleNormal Binding 0 + OpDecorate %SampleShadow DescriptorSet 0 + OpDecorate %SampleShadow Binding 1 + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %21 = OpTypeFunction %void + %bool = OpTypeBool +%type_sampled_image = OpTypeSampledImage %type_2d_image + %ShadowMap = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%SampleNormal = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%SampleShadow = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %21 + %23 = OpLabel + %24 = OpLoad %v2float %in_var_TEXCOORD0 + %25 = OpCompositeExtract %float %24 0 + %26 = OpFOrdGreaterThan %bool %25 %float_0_5 + OpSelectionMerge %27 None + OpBranchConditional %26 %28 %29 + %28 = OpLabel + %30 = OpLoad %type_2d_image %ShadowMap + %31 = OpLoad %type_sampler %SampleNormal + %32 = OpSampledImage %type_sampled_image %30 %31 + %33 = OpImageSampleImplicitLod %v4float %32 %24 None + %34 = OpCompositeExtract %float %33 0 + %35 = OpFOrdLessThanEqual %bool %34 %float_0_5 + %36 = OpSelect %float %35 %float_1 %float_0 + OpBranch %27 + %29 = OpLabel + %37 = OpLoad %type_2d_image %ShadowMap + %38 = OpLoad %type_sampler %SampleShadow + %39 = OpSampledImage %type_sampled_image %37 %38 + %40 = OpImageSampleDrefExplicitLod %float %39 %24 %float_0_5 Lod %float_0 + OpBranch %27 + %27 = OpLabel + %41 = OpPhi %float %36 %28 %40 %29 + %42 = OpCompositeConstruct %v4float %41 %41 %41 %float_1 + OpStore %out_var_SV_Target0 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag new file mode 100644 index 0000000000..1840c9b137 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/in_block_with_aliased_struct_and_name.asm.frag @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %foos %bars + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpName %foos "ALIAS" + OpName %bars "ALIAS" + OpDecorate %FragColor Location 0 + OpDecorate %foos Location 1 + OpDecorate %bars Location 10 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %Foo = OpTypeStruct %float %float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_Foo_uint_4 = OpTypeArray %Foo %uint_4 +%_ptr_Input__arr_Foo_uint_4 = OpTypePointer Input %_arr_Foo_uint_4 + %foos = OpVariable %_ptr_Input__arr_Foo_uint_4 Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 + %bars = OpVariable %_ptr_Input__arr_Foo_uint_4 Input + %int_3 = OpConstant %int 3 + %uint_3 = OpConstant %uint 3 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_float %foos %int_0 %int_0 + %20 = OpLoad %float %19 + %23 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %23 %20 + %25 = OpAccessChain %_ptr_Input_float %foos %int_1 %int_1 + %26 = OpLoad %float %25 + %28 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + OpStore %28 %26 + %30 = OpAccessChain %_ptr_Input_float %foos %int_2 %int_0 + %31 = OpLoad %float %30 + %33 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %33 %31 + %36 = OpAccessChain %_ptr_Input_float %bars %int_3 %int_1 + %37 = OpLoad %float %36 + %39 = OpAccessChain %_ptr_Output_float %FragColor %uint_3 + OpStore %39 %37 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag new file mode 100644 index 0000000000..518dbd81e4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/input-attachment-unused-frag-coord.asm.frag @@ -0,0 +1,74 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 35 +; Schema: 0 + OpCapability Shader + OpCapability InputAttachment + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %load_subpasses_IP1_ "load_subpasses(IP1;" + OpName %uInput "uInput" + OpName %FragColor "FragColor" + OpName %uSubpass0 "uSubpass0" + OpName %uSubpass1 "uSubpass1" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %load_subpasses_IP1_ RelaxedPrecision + OpDecorate %uInput RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %uSubpass0 RelaxedPrecision + OpDecorate %uSubpass0 DescriptorSet 0 + OpDecorate %uSubpass0 Binding 0 + OpDecorate %uSubpass0 InputAttachmentIndex 0 + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %uSubpass1 RelaxedPrecision + OpDecorate %uSubpass1 DescriptorSet 0 + OpDecorate %uSubpass1 Binding 1 + OpDecorate %uSubpass1 InputAttachmentIndex 1 + OpDecorate %28 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeImage %float SubpassData 0 0 0 2 Unknown +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_UniformConstant_7 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %18 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %uSubpass0 = OpVariable %_ptr_UniformConstant_7 UniformConstant + %uSubpass1 = OpVariable %_ptr_UniformConstant_7 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %25 = OpLoad %7 %uSubpass0 + %26 = OpImageRead %v4float %25 %18 + %28 = OpFunctionCall %v4float %load_subpasses_IP1_ %uSubpass1 + %29 = OpFAdd %v4float %26 %28 + ;%32 = OpLoad %v4float %gl_FragCoord + ;%33 = OpVectorShuffle %v4float %32 %32 0 1 0 1 + ;%34 = OpFAdd %v4float %29 %33 + OpStore %FragColor %29 + OpReturn + OpFunctionEnd +%load_subpasses_IP1_ = OpFunction %v4float None %10 + %uInput = OpFunctionParameter %_ptr_UniformConstant_7 + %13 = OpLabel + %14 = OpLoad %7 %uInput + %19 = OpImageRead %v4float %14 %18 + OpReturnValue %19 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag new file mode 100644 index 0000000000..707fa550b9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/modf-frexp-scalar-access-chain-output.asm.frag @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 17 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %col "col" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0_150000006 = OpConstant %float 0.150000006 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %5 = OpLabel + %col = OpVariable %_ptr_Function_v3float Function + %icol = OpVariable %_ptr_Function_v2int Function + %ptr_x = OpAccessChain %_ptr_Function_float %col %int_0 + %ptr_y = OpAccessChain %_ptr_Function_int %icol %int_1 + %16 = OpExtInst %float %1 Modf %float_0_150000006 %ptr_x + %17 = OpExtInst %float %1 Frexp %float_0_150000006 %ptr_y + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..17aab1d8f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..3696660d36 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vColor %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vColor "vColor" + OpName %uninit_function_int "uninit_function_int" + OpName %FragColor "FragColor" + OpName %uninit_int "uninit_int" + OpName %uninit_vector "uninit_vector" + OpName %uninit_matrix "uninit_matrix" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpName %uninit_foo "uninit_foo" + OpDecorate %vColor Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vColor = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_10 = OpConstant %float 10 + %bool = OpTypeBool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_20 = OpConstant %int 20 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_int = OpTypePointer Private %int + %uninit_int = OpUndef %int + %v4int = OpTypeVector %int 4 +%_ptr_Private_v4int = OpTypePointer Private %v4int +%uninit_vector = OpUndef %v4int +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float +%uninit_matrix = OpUndef %mat4v4float + %Foo = OpTypeStruct %int +%_ptr_Private_Foo = OpTypePointer Private %Foo + %uninit_foo = OpUndef %Foo + %main = OpFunction %void None %3 + %5 = OpLabel +%uninit_function_int = OpVariable %_ptr_Function_int Function + %13 = OpAccessChain %_ptr_Input_float %vColor %uint_0 + %14 = OpLoad %float %13 + %17 = OpFOrdGreaterThan %bool %14 %float_10 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %24 + %18 = OpLabel + OpBranch %19 + %24 = OpLabel + OpBranch %19 + %19 = OpLabel + %27 = OpPhi %int %int_10 %18 %int_20 %24 + %28 = OpLoad %v4float %vColor + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag new file mode 100644 index 0000000000..ebd8d6bab7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + OpReturn + OpFunctionEnd + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + OpBeginInvocationInterlockEXT + %43 = OpFunctionCall %void %callee2_ + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag new file mode 100644 index 0000000000..69b8f91120 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %ssbo2 DescriptorSet 0 + OpDecorate %ssbo2 Binding 2 + + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint + %SSBO2 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %ssbo2 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_4 = OpConstant %uint 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %callee3_res = OpFunctionCall %void %callee3_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %calle3_block = OpLabel + %frag_coord_x_ptr = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %frag_coord_x = OpLoad %float %frag_coord_x_ptr + %frag_coord_int = OpConvertFToS %int %frag_coord_x + %ssbo_ptr = OpAccessChain %_ptr_Uniform_uint %ssbo2 %int_0 %frag_coord_int + OpStore %ssbo_ptr %uint_4 + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + + OpSelectionMerge %merged_block None + OpBranchConditional %true %dummy_block %merged_block + %dummy_block = OpLabel + OpBeginInvocationInterlockEXT + OpEndInvocationInterlockEXT + OpBranch %merged_block + + %merged_block = OpLabel + OpReturn + + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag new file mode 100644 index 0000000000..7c0fe9a2b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %call3res = OpFunctionCall %void %callee3_ + %call4res = OpFunctionCall %void %callee4_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %begin3 = OpLabel + OpBeginInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee4_ = OpFunction %void None %3 + %begin4 = OpLabel + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag new file mode 100644 index 0000000000..49ed96094a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/private-initializer-direct-store.asm.frag @@ -0,0 +1,32 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 17 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %b "b" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %float_10 = OpConstant %float 10 + %float_20 = OpConstant %float 20 + %b = OpVariable %_ptr_Private_float Private %float_10 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %b %float_20 + %15 = OpLoad %float %b + %16 = OpFAdd %float %15 %15 + OpStore %FragColor %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..a5a16f2873 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %ACOS_f1_ "mat3" + OpName %a "a" + OpName %ACOS_i1_ "gl_Foo" + OpName %a_0 "a" + OpName %FragColor "FragColor" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %float %_ptr_Function_int + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_2 = OpConstant %float 2 + %int_4 = OpConstant %int 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %param %float_2 + %32 = OpFunctionCall %float %ACOS_f1_ %param + OpStore %param_0 %int_4 + %35 = OpFunctionCall %float %ACOS_i1_ %param_0 + %36 = OpFAdd %float %32 %35 + OpStore %FragColor %36 + OpReturn + OpFunctionEnd + %ACOS_f1_ = OpFunction %float None %8 + %a = OpFunctionParameter %_ptr_Function_float + %11 = OpLabel + %18 = OpLoad %float %a + %20 = OpFAdd %float %18 %float_1 + OpReturnValue %20 + OpFunctionEnd + %ACOS_i1_ = OpFunction %float None %14 + %a_0 = OpFunctionParameter %_ptr_Function_int + %17 = OpLabel + %23 = OpLoad %int %a_0 + %24 = OpConvertSToF %float %23 + %25 = OpFAdd %float %24 %float_1 + OpReturnValue %25 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..07450ee80b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %s = OpTypeStruct %float + %arr = OpTypeArray %float %uint_2 +%_ptr_Function_s = OpTypePointer Function %s +%_ptr_Function_arr = OpTypePointer Function %arr + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %s0 = OpConstantComposite %s %float_0 + %s1 = OpConstantComposite %s %float_1 + %v4bool = OpTypeVector %bool 4 + %b4 = OpConstantComposite %v4bool %false %true %false %true + %arr1 = OpConstantComposite %arr %float_0 %float_1 + %arr2 = OpConstantComposite %arr %float_1 %float_0 + %main = OpFunction %void None %3 + %5 = OpLabel + %ss = OpVariable %_ptr_Function_s Function + %arrvar = OpVariable %_ptr_Function_arr Function + ; Not trivial + %21 = OpSelect %v4float %false %17 %18 + OpStore %FragColor %21 + ; Trivial + %22 = OpSelect %v4float %false %19 %20 + OpStore %FragColor %22 + ; Vector not trivial + %23 = OpSelect %v4float %b4 %17 %18 + OpStore %FragColor %23 + ; Vector trivial + %24 = OpSelect %v4float %b4 %19 %20 + OpStore %FragColor %24 + ; Struct selection + %sout = OpSelect %s %false %s0 %s1 + OpStore %ss %sout + ; Array selection + %arrout = OpSelect %arr %true %arr1 %arr2 + OpStore %arrvar %arrout + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag new file mode 100644 index 0000000000..5f0734062d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/subgroup-arithmetic-cast.msl21.asm.frag @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpCapability GroupNonUniform + OpCapability GroupNonUniformArithmetic + OpCapability GroupNonUniformClustered + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %index %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_KHR_shader_subgroup_arithmetic" + OpSourceExtension "GL_KHR_shader_subgroup_basic" + OpSourceExtension "GL_KHR_shader_subgroup_clustered" + OpName %main "main" + OpName %index "index" + OpName %FragColor "FragColor" + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Output_uint = OpTypePointer Output %uint + %FragColor = OpVariable %_ptr_Output_uint Output + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpLoad %int %index + %u = OpBitcast %uint %i + %res0 = OpGroupNonUniformSMin %uint %uint_3 Reduce %i + %res1 = OpGroupNonUniformSMax %uint %uint_3 Reduce %u + %res2 = OpGroupNonUniformUMin %uint %uint_3 Reduce %i + %res3 = OpGroupNonUniformUMax %uint %uint_3 Reduce %u + ;%res4 = OpGroupNonUniformSMax %uint %uint_3 InclusiveScan %i + ;%res5 = OpGroupNonUniformSMin %uint %uint_3 InclusiveScan %u + ;%res6 = OpGroupNonUniformUMax %uint %uint_3 ExclusiveScan %i + ;%res7 = OpGroupNonUniformUMin %uint %uint_3 ExclusiveScan %u + %res8 = OpGroupNonUniformSMin %uint %uint_3 ClusteredReduce %i %uint_4 + %res9 = OpGroupNonUniformSMax %uint %uint_3 ClusteredReduce %u %uint_4 + %res10 = OpGroupNonUniformUMin %uint %uint_3 ClusteredReduce %i %uint_4 + %res11 = OpGroupNonUniformUMax %uint %uint_3 ClusteredReduce %u %uint_4 + OpStore %FragColor %res0 + OpStore %FragColor %res1 + OpStore %FragColor %res2 + OpStore %FragColor %res3 + ;OpStore %FragColor %res4 + ;OpStore %FragColor %res5 + ;OpStore %FragColor %res6 + ;OpStore %FragColor %res7 + OpStore %FragColor %res8 + OpStore %FragColor %res9 + OpStore %FragColor %res10 + OpStore %FragColor %res11 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..6556c3c8c4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %j "j" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %header = OpLabel + %i = OpVariable %_ptr_Function_int Function %int_0 + %j = OpVariable %_ptr_Function_int Function + %9 = OpLoad %int %vIndex + OpSelectionMerge %switch_merge None + OpSwitch %9 %default_case 100 %default_case 0 %case_0 1 %case_1 11 %case_1 2 %case_2 3 %case_3 4 %case_4 5 %case_5 + + %case_0 = OpLabel + OpBranch %default_case + + %default_case = OpLabel + %default_case_phi = OpPhi %int %int_2 %header %int_3 %case_0 + ; Test what happens when a case block dominates access to a variable. + OpStore %j %default_case_phi + OpBranch %case_1 + + %case_1 = OpLabel + ; Test phi nodes between case labels. + %case_1_phi = OpPhi %int %int_0 %default_case %int_1 %header + OpStore %j %case_1_phi + OpBranch %case_2 + + %case_2 = OpLabel + OpBranch %switch_merge + + %case_3 = OpLabel + ; Conditionally branch to another case block. This is really dumb, but it is apparently legal. + %case_3_cond = OpSGreaterThan %bool %9 %int_3 + OpBranchConditional %case_3_cond %case_4 %switch_merge + + %case_4 = OpLabel + ; When emitted from case 3, we should *not* see fallthrough behavior. + OpBranch %case_5 + + %case_5 = OpLabel + OpStore %i %int_0 + OpBranch %switch_merge + + %switch_merge = OpLabel + %26 = OpLoad %int %i + %27 = OpConvertSToF %float %26 + %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag new file mode 100644 index 0000000000..4c1408b38c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag @@ -0,0 +1,364 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 247 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability SampledCubeArray + OpCapability SampledBuffer + %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 %tex1d "tex1d" + OpName %tex2d "tex2d" + OpName %tex3d "tex3d" + OpName %texCube "texCube" + OpName %tex2dArray "tex2dArray" + OpName %texCubeArray "texCubeArray" + OpName %depth2d "depth2d" + OpName %depthCube "depthCube" + OpName %depth2dArray "depth2dArray" + OpName %depthCubeArray "depthCubeArray" + OpName %texBuffer "texBuffer" + OpName %tex1dSamp "tex1dSamp" + OpName %tex2dSamp "tex2dSamp" + OpName %tex3dSamp "tex3dSamp" + OpName %texCubeSamp "texCubeSamp" + OpName %tex2dArraySamp "tex2dArraySamp" + OpName %texCubeArraySamp "texCubeArraySamp" + OpName %depth2dSamp "depth2dSamp" + OpName %depthCubeSamp "depthCubeSamp" + OpName %depth2dArraySamp "depth2dArraySamp" + OpName %depthCubeArraySamp "depthCubeArraySamp" + OpDecorate %tex1d DescriptorSet 0 + OpDecorate %tex1d Binding 0 + OpDecorate %tex2d DescriptorSet 0 + OpDecorate %tex2d Binding 1 + OpDecorate %tex3d DescriptorSet 0 + OpDecorate %tex3d Binding 2 + OpDecorate %texCube DescriptorSet 0 + OpDecorate %texCube Binding 3 + OpDecorate %tex2dArray DescriptorSet 0 + OpDecorate %tex2dArray Binding 4 + OpDecorate %texCubeArray DescriptorSet 0 + OpDecorate %texCubeArray Binding 5 + OpDecorate %depth2d DescriptorSet 0 + OpDecorate %depth2d Binding 7 + OpDecorate %depthCube DescriptorSet 0 + OpDecorate %depthCube Binding 8 + OpDecorate %depth2dArray DescriptorSet 0 + OpDecorate %depth2dArray Binding 9 + OpDecorate %depthCubeArray DescriptorSet 0 + OpDecorate %depthCubeArray Binding 10 + OpDecorate %texBuffer DescriptorSet 0 + OpDecorate %texBuffer Binding 6 + OpDecorate %tex1dSamp DescriptorSet 1 + OpDecorate %tex1dSamp Binding 0 + OpDecorate %tex2dSamp DescriptorSet 1 + OpDecorate %tex2dSamp Binding 1 + OpDecorate %tex3dSamp DescriptorSet 1 + OpDecorate %tex3dSamp Binding 2 + OpDecorate %texCubeSamp DescriptorSet 1 + OpDecorate %texCubeSamp Binding 3 + OpDecorate %tex2dArraySamp DescriptorSet 1 + OpDecorate %tex2dArraySamp Binding 4 + OpDecorate %texCubeArraySamp DescriptorSet 1 + OpDecorate %texCubeArraySamp Binding 5 + OpDecorate %depth2dSamp DescriptorSet 1 + OpDecorate %depth2dSamp Binding 7 + OpDecorate %depthCubeSamp DescriptorSet 1 + OpDecorate %depthCubeSamp Binding 8 + OpDecorate %depth2dArraySamp DescriptorSet 1 + OpDecorate %depth2dArraySamp Binding 9 + OpDecorate %depthCubeArraySamp DescriptorSet 1 + OpDecorate %depthCubeArraySamp Binding 10 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %10 = OpTypeImage %float 1D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %tex1d = OpVariable %_ptr_UniformConstant_10 UniformConstant +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %tex1dSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %float_0 = OpConstant %float 0 + %17 = OpTypeImage %float 2D 0 0 0 1 Unknown + %18 = OpTypeSampledImage %17 +%_ptr_UniformConstant_17 = OpTypePointer UniformConstant %17 + %tex2d = OpVariable %_ptr_UniformConstant_17 UniformConstant + %tex2dSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v2float = OpTypeVector %float 2 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %25 = OpTypeImage %float 3D 0 0 0 1 Unknown + %26 = OpTypeSampledImage %25 +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25 + %tex3d = OpVariable %_ptr_UniformConstant_25 UniformConstant + %tex3dSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v3float = OpTypeVector %float 3 + %31 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %33 = OpTypeImage %float Cube 0 0 0 1 Unknown + %34 = OpTypeSampledImage %33 +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 + %texCube = OpVariable %_ptr_UniformConstant_33 UniformConstant +%texCubeSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %39 = OpTypeImage %float 2D 0 1 0 1 Unknown + %40 = OpTypeSampledImage %39 +%_ptr_UniformConstant_39 = OpTypePointer UniformConstant %39 + %tex2dArray = OpVariable %_ptr_UniformConstant_39 UniformConstant +%tex2dArraySamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %45 = OpTypeImage %float Cube 0 1 0 1 Unknown + %46 = OpTypeSampledImage %45 +%_ptr_UniformConstant_45 = OpTypePointer UniformConstant %45 +%texCubeArray = OpVariable %_ptr_UniformConstant_45 UniformConstant +%texCubeArraySamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %50 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %52 = OpTypeImage %float 2D 1 0 0 1 Unknown + %53 = OpTypeSampledImage %52 +%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52 + %depth2d = OpVariable %_ptr_UniformConstant_52 UniformConstant +%depth2dSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %float_1 = OpConstant %float 1 + %58 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %65 = OpTypeImage %float Cube 1 0 0 1 Unknown + %66 = OpTypeSampledImage %65 +%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65 + %depthCube = OpVariable %_ptr_UniformConstant_65 UniformConstant +%depthCubeSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %70 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %74 = OpTypeImage %float 2D 1 1 0 1 Unknown + %75 = OpTypeSampledImage %74 +%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74 +%depth2dArray = OpVariable %_ptr_UniformConstant_74 UniformConstant +%depth2dArraySamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %82 = OpTypeImage %float Cube 1 1 0 1 Unknown + %83 = OpTypeSampledImage %82 +%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82 +%depthCubeArray = OpVariable %_ptr_UniformConstant_82 UniformConstant +%depthCubeArraySamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %97 = OpConstantComposite %v2float %float_0 %float_1 + %98 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %138 = OpConstantComposite %v2int %int_0 %int_0 + %v3int = OpTypeVector %int 3 + %143 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %149 = OpTypeImage %float Buffer 0 0 0 1 Unknown +%_ptr_UniformConstant_149 = OpTypePointer UniformConstant %149 + %texBuffer = OpVariable %_ptr_UniformConstant_149 UniformConstant + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_v4float Function + %13 = OpLoad %10 %tex1d + %14 = OpLoad %12 %tex1dSamp + %15 = OpSampledImage %11 %13 %14 + %16 = OpImageSampleImplicitLod %v4float %15 %float_0 + OpStore %c %16 + %19 = OpLoad %17 %tex2d + %20 = OpLoad %12 %tex2dSamp + %21 = OpSampledImage %18 %19 %20 + %24 = OpImageSampleImplicitLod %v4float %21 %23 + OpStore %c %24 + %27 = OpLoad %25 %tex3d + %28 = OpLoad %12 %tex3dSamp + %29 = OpSampledImage %26 %27 %28 + %32 = OpImageSampleImplicitLod %v4float %29 %31 + OpStore %c %32 + %35 = OpLoad %33 %texCube + %36 = OpLoad %12 %texCubeSamp + %37 = OpSampledImage %34 %35 %36 + %38 = OpImageSampleImplicitLod %v4float %37 %31 + OpStore %c %38 + %41 = OpLoad %39 %tex2dArray + %42 = OpLoad %12 %tex2dArraySamp + %43 = OpSampledImage %40 %41 %42 + %44 = OpImageSampleImplicitLod %v4float %43 %31 + OpStore %c %44 + %47 = OpLoad %45 %texCubeArray + %48 = OpLoad %12 %texCubeArraySamp + %49 = OpSampledImage %46 %47 %48 + %51 = OpImageSampleImplicitLod %v4float %49 %50 + OpStore %c %51 + %54 = OpLoad %52 %depth2d + %55 = OpLoad %12 %depth2dSamp + %56 = OpSampledImage %53 %54 %55 + %59 = OpCompositeExtract %float %58 2 + %60 = OpImageSampleDrefImplicitLod %float %56 %58 %59 + %64 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %64 %60 + %67 = OpLoad %65 %depthCube + %68 = OpLoad %12 %depthCubeSamp + %69 = OpSampledImage %66 %67 %68 + %71 = OpCompositeExtract %float %70 3 + %72 = OpImageSampleDrefImplicitLod %float %69 %70 %71 + %73 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %73 %72 + %76 = OpLoad %74 %depth2dArray + %77 = OpLoad %12 %depth2dArraySamp + %78 = OpSampledImage %75 %76 %77 + %79 = OpCompositeExtract %float %70 3 + %80 = OpImageSampleDrefImplicitLod %float %78 %70 %79 + %81 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %81 %80 + %84 = OpLoad %82 %depthCubeArray + %85 = OpLoad %12 %depthCubeArraySamp + %86 = OpSampledImage %83 %84 %85 + %87 = OpImageSampleDrefImplicitLod %float %86 %50 %float_1 + %88 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %88 %87 + %89 = OpLoad %10 %tex1d + %90 = OpLoad %12 %tex1dSamp + %91 = OpSampledImage %11 %89 %90 + %92 = OpImageSampleProjImplicitLod %v4float %91 %97 + OpStore %c %92 + %93 = OpLoad %17 %tex2d + %94 = OpLoad %12 %tex2dSamp + %95 = OpSampledImage %18 %93 %94 + %96 = OpImageSampleProjImplicitLod %v4float %95 %58 + OpStore %c %96 + %99 = OpLoad %25 %tex3d + %100 = OpLoad %12 %tex3dSamp + %101 = OpSampledImage %26 %99 %100 + %102 = OpImageSampleProjImplicitLod %v4float %101 %70 + OpStore %c %102 + %103 = OpLoad %52 %depth2d + %104 = OpLoad %12 %depth2dSamp + %105 = OpSampledImage %53 %103 %104 + %106 = OpCompositeExtract %float %98 2 + %107 = OpCompositeExtract %float %98 3 + %108 = OpCompositeInsert %v4float %107 %98 2 + %109 = OpImageSampleProjDrefImplicitLod %float %105 %108 %106 + %110 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %110 %109 + %111 = OpLoad %10 %tex1d + %112 = OpLoad %12 %tex1dSamp + %113 = OpSampledImage %11 %111 %112 + %114 = OpImageSampleExplicitLod %v4float %113 %float_0 Lod %float_0 + OpStore %c %114 + %115 = OpLoad %17 %tex2d + %116 = OpLoad %12 %tex2dSamp + %117 = OpSampledImage %18 %115 %116 + %118 = OpImageSampleExplicitLod %v4float %117 %23 Lod %float_0 + OpStore %c %118 + %119 = OpLoad %25 %tex3d + %120 = OpLoad %12 %tex3dSamp + %121 = OpSampledImage %26 %119 %120 + %122 = OpImageSampleExplicitLod %v4float %121 %31 Lod %float_0 + OpStore %c %122 + %123 = OpLoad %33 %texCube + %124 = OpLoad %12 %texCubeSamp + %125 = OpSampledImage %34 %123 %124 + %126 = OpImageSampleExplicitLod %v4float %125 %31 Lod %float_0 + OpStore %c %126 + %127 = OpLoad %39 %tex2dArray + %128 = OpLoad %12 %tex2dArraySamp + %129 = OpSampledImage %40 %127 %128 + %130 = OpImageSampleExplicitLod %v4float %129 %31 Lod %float_0 + OpStore %c %130 + %131 = OpLoad %45 %texCubeArray + %132 = OpLoad %12 %texCubeArraySamp + %133 = OpSampledImage %46 %131 %132 + %134 = OpImageSampleExplicitLod %v4float %133 %50 Lod %float_0 + OpStore %c %134 + %135 = OpLoad %52 %depth2d + %136 = OpLoad %12 %depth2dSamp + %137 = OpSampledImage %53 %135 %136 + %139 = OpCompositeExtract %float %58 2 + %140 = OpImageSampleDrefExplicitLod %float %137 %58 %139 Lod %float_0 + %141 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %141 %140 + %142 = OpLoad %10 %tex1d + %144 = OpLoad %12 %tex1dSamp + %145 = OpSampledImage %11 %142 %144 + %146 = OpImageSampleProjExplicitLod %v4float %145 %97 Lod %float_0 + OpStore %c %146 + %147 = OpLoad %17 %tex2d + %148 = OpLoad %12 %tex2dSamp + %150 = OpSampledImage %18 %147 %148 + %151 = OpImageSampleProjExplicitLod %v4float %150 %58 Lod %float_0 + OpStore %c %151 + %152 = OpLoad %25 %tex3d + %153 = OpLoad %12 %tex3dSamp + %154 = OpSampledImage %26 %152 %153 + %155 = OpImageSampleProjExplicitLod %v4float %154 %70 Lod %float_0 + OpStore %c %155 + %156 = OpLoad %52 %depth2d + %157 = OpLoad %12 %depth2dSamp + %158 = OpSampledImage %53 %156 %157 + %159 = OpCompositeExtract %float %98 2 + %160 = OpCompositeExtract %float %98 3 + %161 = OpCompositeInsert %v4float %160 %98 2 + %162 = OpImageSampleProjDrefExplicitLod %float %158 %161 %159 Lod %float_0 + %163 = OpAccessChain %_ptr_Function_float %c %uint_0 + OpStore %163 %162 + %164 = OpLoad %10 %tex1d + %165 = OpImageFetch %v4float %164 %int_0 Lod %int_0 + OpStore %c %165 + %166 = OpLoad %17 %tex2d + %167 = OpImageFetch %v4float %166 %138 Lod %int_0 + OpStore %c %167 + %168 = OpLoad %25 %tex3d + %169 = OpImageFetch %v4float %168 %143 Lod %int_0 + OpStore %c %169 + %170 = OpLoad %39 %tex2dArray + %171 = OpImageFetch %v4float %170 %143 Lod %int_0 + OpStore %c %171 + %172 = OpLoad %149 %texBuffer + %173 = OpImageFetch %v4float %172 %int_0 + OpStore %c %173 + %174 = OpLoad %17 %tex2d + %175 = OpLoad %12 %tex2dSamp + %176 = OpSampledImage %18 %174 %175 + %177 = OpImageGather %v4float %176 %23 %int_0 + OpStore %c %177 + %178 = OpLoad %33 %texCube + %179 = OpLoad %12 %texCubeSamp + %180 = OpSampledImage %34 %178 %179 + %181 = OpImageGather %v4float %180 %31 %int_1 + OpStore %c %181 + %182 = OpLoad %39 %tex2dArray + %183 = OpLoad %12 %tex2dArraySamp + %184 = OpSampledImage %40 %182 %183 + %185 = OpImageGather %v4float %184 %31 %int_2 + OpStore %c %185 + %186 = OpLoad %45 %texCubeArray + %187 = OpLoad %12 %texCubeArraySamp + %188 = OpSampledImage %46 %186 %187 + %189 = OpImageGather %v4float %188 %50 %int_3 + OpStore %c %189 + %190 = OpLoad %52 %depth2d + %191 = OpLoad %12 %depth2dSamp + %192 = OpSampledImage %53 %190 %191 + %193 = OpImageDrefGather %v4float %192 %23 %float_1 + OpStore %c %193 + %194 = OpLoad %65 %depthCube + %195 = OpLoad %12 %depthCubeSamp + %196 = OpSampledImage %66 %194 %195 + %197 = OpImageDrefGather %v4float %196 %31 %float_1 + OpStore %c %197 + %198 = OpLoad %74 %depth2dArray + %199 = OpLoad %12 %depth2dArraySamp + %200 = OpSampledImage %75 %198 %199 + %201 = OpImageDrefGather %v4float %200 %31 %float_1 + OpStore %c %201 + %202 = OpLoad %82 %depthCubeArray + %203 = OpLoad %12 %depthCubeArraySamp + %204 = OpSampledImage %83 %202 %203 + %205 = OpImageDrefGather %v4float %204 %50 %float_1 + OpStore %c %205 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag new file mode 100644 index 0000000000..702b826e5b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/usage-tracking-modf-io-pointer.asm.frag @@ -0,0 +1,28 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 14 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %10 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpExtInst %v4float %1 Modf %10 %_GLF_color + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..22c4efca93 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vFloat + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vFloat "vFloat" + OpName %undef "undef" + OpDecorate %FragColor Location 0 + OpDecorate %vFloat Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vFloat = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %undef = OpUndef %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Private_float = OpTypePointer Private %float + %uint_3 = OpConstant %uint 3 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %v4float %vFloat + %26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3 + %27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3 + %28 = OpFAdd %v4float %26 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc new file mode 100644 index 0000000000..a3d489941c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.msl2.asm.tesc @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..a3d489941c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-0.multi-patch.msl2.asm.tesc @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc new file mode 100644 index 0000000000..a3d489941c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.msl2.asm.tesc @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..a3d489941c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-location-1.multi-patch.msl2.asm.tesc @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc new file mode 100644 index 0000000000..23424ff7ba --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.msl2.asm.tesc @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..23424ff7ba --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-point-size.multi-patch.msl2.asm.tesc @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc new file mode 100644 index 0000000000..23424ff7ba --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.msl2.asm.tesc @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc new file mode 100644 index 0000000000..23424ff7ba --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers-block.mask-position.multi-patch.msl2.asm.tesc @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 44 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %c %gl_InvocationID %p %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %C "C" + OpMemberName %C 0 "v" + OpName %c "c" + OpName %gl_InvocationID "gl_InvocationID" + OpName %P "P" + OpMemberName %P 0 "v" + OpName %p "p" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %C Block + OpDecorate %c Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %P 0 Patch + OpDecorate %P Block + OpDecorate %p Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %C = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_C_uint_4 = OpTypeArray %C %uint_4 +%_ptr_Output__arr_C_uint_4 = OpTypePointer Output %_arr_C_uint_4 + %zero_c = OpConstantNull %_arr_C_uint_4 + %c = OpVariable %_ptr_Output__arr_C_uint_4 Output %zero_c + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %P = OpTypeStruct %v4float +%_ptr_Output_P = OpTypePointer Output %P + %zero_p = OpConstantNull %P + %p = OpVariable %_ptr_Output_P Output %zero_p + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %float_3 = OpConstant %float 3 + %37 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpLoad %int %gl_InvocationID + %22 = OpAccessChain %_ptr_Output_v4float %c %17 %int_0 + OpStore %22 %20 + %28 = OpAccessChain %_ptr_Output_v4float %p %int_0 + OpStore %28 %27 + %38 = OpAccessChain %_ptr_Output_v4float %gl_out %17 %int_0 + OpStore %38 %37 + %43 = OpAccessChain %_ptr_Output_float %gl_out %17 %int_1 + OpStore %43 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-0.msl2.multi-patch.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-location-1.multi-patch.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-point-size.msl2.multi-patch.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc new file mode 100644 index 0000000000..6b616b0416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/masking/initializers.mask-position.msl2.multi-patch.asm.tesc @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 40 +; Schema: 0 + OpCapability Tessellation + OpCapability TessellationPointSize + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %foo %gl_InvocationID %foo_patch %gl_out + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo_patch "foo_patch" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpDecorate %foo Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo_patch Patch + OpDecorate %foo_patch Location 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %zero_foo = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output__arr_v4float_uint_4 = OpTypePointer Output %_arr_v4float_uint_4 + %foo = OpVariable %_ptr_Output__arr_v4float_uint_4 Output %zero_foo + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %zero_foo_patch = OpConstantNull %v4float + %foo_patch = OpVariable %_ptr_Output_v4float Output %zero_foo_patch + %float_2 = OpConstant %float 2 + %23 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %zero_gl_out = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %zero_gl_out + %int_0 = OpConstant %int 0 + %float_3 = OpConstant %float 3 + %33 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 + %int_1 = OpConstant %int 1 + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %int %gl_InvocationID + %20 = OpAccessChain %_ptr_Output_v4float %foo %16 + OpStore %20 %18 + OpStore %foo_patch %23 + %34 = OpAccessChain %_ptr_Output_v4float %gl_out %16 %int_0 + OpStore %34 %33 + %39 = OpAccessChain %_ptr_Output_float %gl_out %16 %int_1 + OpStore %39 %float_4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp new file mode 100644 index 0000000000..a37bdd9195 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBORow "SSBORow" + OpMemberName %SSBORow 0 "v" + OpMemberName %SSBORow 1 "row_major0" + OpName %_ "" + OpMemberDecorate %SSBORow 0 Offset 0 + OpMemberDecorate %SSBORow 1 RowMajor + OpMemberDecorate %SSBORow 1 Offset 16 + OpMemberDecorate %SSBORow 1 MatrixStride 16 + OpDecorate %SSBORow BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %SSBORow = OpTypeStruct %float %mat4v4float +%_ptr_Uniform_SSBORow = OpTypePointer Uniform %SSBORow + %_ = OpVariable %_ptr_Uniform_SSBORow Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %row_ptr = OpAccessChain %_ptr_Uniform_v4float %_ %int_1 %int_1 + %vec = OpLoad %v4float %row_ptr + %float_val = OpCompositeExtract %float %vec 2 + + %20 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %20 %float_val + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp new file mode 100644 index 0000000000..4c22245444 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-2.asm.comp @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 23 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpName %_ "" + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 RowMajor + OpMemberDecorate %SSBOScalar 1 Offset 16 + OpMemberDecorate %SSBOScalar 1 MatrixStride 16 + OpMemberDecorate %SSBOScalar 2 RowMajor + OpMemberDecorate %SSBOScalar 2 Offset 64 + OpMemberDecorate %SSBOScalar 2 MatrixStride 16 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %SSBOScalar = OpTypeStruct %v3float %mat3v3float %mat3v3float +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %main = OpFunction %void None %3 + %5 = OpLabel + %b_ptr = OpAccessChain %_ptr_Uniform_mat3v3float %_ %int_1 + %c_ptr = OpAccessChain %_ptr_Uniform_mat3v3float %_ %int_2 + %b = OpLoad %mat3v3float %b_ptr + %c = OpLoad %mat3v3float %c_ptr + OpStore %b_ptr %c + %19 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 + %20 = OpLoad %v3float %19 + %21 = OpMatrixTimesVector %v3float %b %20 + %22 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 + OpStore %22 %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp new file mode 100644 index 0000000000..85a220f516 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-3.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 22 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpName %_ "" + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 Offset 12 + OpMemberDecorate %SSBOScalar 2 Offset 24 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %SSBOScalar = OpTypeStruct %v3float %v3float %v3float +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpAccessChain %_ptr_Uniform_v3float %_ %int_1 + %16 = OpLoad %v3float %15 + %18 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %19 = OpLoad %v3float %18 + OpStore %18 %16 + %20 = OpFMul %v3float %16 %19 + %21 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 + OpStore %21 %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp new file mode 100644 index 0000000000..bef3fcb766 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-4.asm.comp @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpName %_ "" + OpDecorate %_arr_v2float_uint_16 ArrayStride 16 + OpDecorate %_arr_v2float_uint_16_0 ArrayStride 16 + OpDecorate %_arr_float_uint_16 ArrayStride 16 + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 Offset 256 + OpMemberDecorate %SSBOScalar 2 Offset 512 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_v2float_uint_16 = OpTypeArray %v2float %uint_16 +%_arr_v2float_uint_16_0 = OpTypeArray %v2float %uint_16 +%_arr_float_uint_16 = OpTypeArray %float %uint_16 + %SSBOScalar = OpTypeStruct %_arr_v2float_uint_16 %_arr_v2float_uint_16_0 %_arr_float_uint_16 +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_2 = OpConstant %int 2 + %float_10 = OpConstant %float 10.0 + %float_11 = OpConstant %float 11.0 + %float_const = OpConstantComposite %v2float %float_10 %float_11 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 %int_10 + %22 = OpLoad %v2float %21 + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_2 %int_10 + %26 = OpLoad %float %25 + OpStore %21 %float_const + %27 = OpVectorTimesScalar %v2float %22 %26 + %28 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_10 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp new file mode 100644 index 0000000000..8de22b8285 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding-5.asm.comp @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpName %_ "" + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 Offset 8 + OpMemberDecorate %SSBOScalar 2 Offset 20 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %SSBOScalar = OpTypeStruct %v2float %v3float %v3float +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_2 = OpConstant %int 2 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v3float %_ %int_1 + %17 = OpLoad %v3float %16 + %18 = OpVectorShuffle %v2float %17 %17 0 1 + %20 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %21 = OpLoad %v3float %20 + %22 = OpVectorShuffle %v2float %21 %21 1 2 + OpStore %16 %27 + %23 = OpFMul %v2float %18 %22 + %25 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + OpStore %25 %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp new file mode 100644 index 0000000000..0b0ba53e8e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/load-packed-no-forwarding.asm.comp @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 23 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpName %_ "" + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 RowMajor + OpMemberDecorate %SSBOScalar 1 Offset 12 + OpMemberDecorate %SSBOScalar 1 MatrixStride 12 + OpMemberDecorate %SSBOScalar 2 RowMajor + OpMemberDecorate %SSBOScalar 2 Offset 48 + OpMemberDecorate %SSBOScalar 2 MatrixStride 12 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %SSBOScalar = OpTypeStruct %v3float %mat3v3float %mat3v3float +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_Uniform_mat3v3float = OpTypePointer Uniform %mat3v3float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %main = OpFunction %void None %3 + %5 = OpLabel + %b_ptr = OpAccessChain %_ptr_Uniform_mat3v3float %_ %int_1 + %c_ptr = OpAccessChain %_ptr_Uniform_mat3v3float %_ %int_2 + %b = OpLoad %mat3v3float %b_ptr + %c = OpLoad %mat3v3float %c_ptr + OpStore %b_ptr %c + %19 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 + %20 = OpLoad %v3float %19 + %21 = OpMatrixTimesVector %v3float %b %20 + %22 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 + OpStore %22 %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp new file mode 100644 index 0000000000..70b1752791 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/packed-vector-extract-insert.asm.comp @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 28 +; Schema: 0 + 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_EXT_scalar_block_layout" + OpName %main "main" + OpName %SSBOScalar "SSBOScalar" + OpMemberName %SSBOScalar 0 "a" + OpMemberName %SSBOScalar 1 "b" + OpMemberName %SSBOScalar 2 "c" + OpMemberName %SSBOScalar 3 "d" + OpName %_ "" + OpMemberDecorate %SSBOScalar 0 Offset 0 + OpMemberDecorate %SSBOScalar 1 Offset 8 + OpMemberDecorate %SSBOScalar 2 Offset 20 + OpMemberDecorate %SSBOScalar 3 Offset 32 + OpDecorate %SSBOScalar BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %SSBOScalar = OpTypeStruct %v2float %v3float %v3float %v3float +%_ptr_Uniform_SSBOScalar = OpTypePointer Uniform %SSBOScalar + %_ = OpVariable %_ptr_Uniform_SSBOScalar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_2 = OpConstant %int 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_2 = OpConstant %float 2.0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + %v3_ptr = OpAccessChain %_ptr_Uniform_v3float %_ %int_1 + %v3 = OpLoad %v3float %v3_ptr + %v3_mod = OpCompositeInsert %v3float %float_2 %v3 2 + %v2 = OpVectorShuffle %v2float %v3 %v3 0 1 + %v1 = OpCompositeExtract %float %v3 2 + %v2_mul = OpVectorTimesScalar %v2float %v2 %v1 + %v2_ptr = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + OpStore %v2_ptr %v2_mul + OpStore %v3_ptr %v3_mod + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp new file mode 100644 index 0000000000..398c8d135c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/row-major-split-access-chain.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBORow "SSBORow" + OpMemberName %SSBORow 0 "v" + OpMemberName %SSBORow 1 "row_major0" + OpName %_ "" + OpMemberDecorate %SSBORow 0 Offset 0 + OpMemberDecorate %SSBORow 1 RowMajor + OpMemberDecorate %SSBORow 1 Offset 16 + OpMemberDecorate %SSBORow 1 MatrixStride 16 + OpDecorate %SSBORow BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %SSBORow = OpTypeStruct %float %mat4v4float +%_ptr_Uniform_SSBORow = OpTypePointer Uniform %SSBORow + %_ = OpVariable %_ptr_Uniform_SSBORow Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %row_ptr = OpAccessChain %_ptr_Uniform_v4float %_ %int_1 %int_1 + %float_ptr = OpAccessChain %_ptr_Uniform_float %row_ptr %uint_2 + + %19 = OpLoad %float %float_ptr + %20 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %20 %19 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag new file mode 100644 index 0000000000..85249d9981 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float2.asm.frag @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpDecorate %_arr_v2float_uint_2 ArrayStride 16 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 1 Offset 24 + OpDecorate %type_Foo Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 + %type_Foo = OpTypeStruct %_arr_v2float_uint_2 %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v2float = OpTypePointer Output %v2float + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %int_0 + %21 = OpLoad %v2float %20 + %22 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %int_1 + %23 = OpLoad %v2float %22 + %24 = OpFAdd %v2float %21 %23 + %25 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %26 = OpLoad %float %25 + %27 = OpCompositeConstruct %v2float %26 %26 + %28 = OpFAdd %v2float %24 %27 + OpStore %out_var_SV_Target %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag new file mode 100644 index 0000000000..7ed32bee41 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3-one-element.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpDecorate %_arr_v3float_uint_1 ArrayStride 16 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 1 Offset 12 + OpDecorate %type_Foo Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_arr_v3float_uint_1 = OpTypeArray %v3float %uint_1 + %type_Foo = OpTypeStruct %_arr_v3float_uint_1 %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %int_0 + %21 = OpLoad %v3float %20 + %22 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %23 = OpLoad %float %22 + %24 = OpCompositeConstruct %v3float %23 %23 %23 + %25 = OpFAdd %v3float %21 %24 + OpStore %out_var_SV_Target %25 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag new file mode 100644 index 0000000000..406328b8d4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpDecorate %_arr_v3float_uint_2 ArrayStride 16 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 1 Offset 28 + OpDecorate %type_Foo Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2 + %type_Foo = OpTypeStruct %_arr_v3float_uint_2 %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %16 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %int_0 + %21 = OpLoad %v3float %20 + %22 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %int_1 + %23 = OpLoad %v3float %22 + %24 = OpFAdd %v3float %21 %23 + %25 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %26 = OpLoad %float %25 + %27 = OpCompositeConstruct %v3float %26 %26 %26 + %28 = OpFAdd %v3float %24 %27 + OpStore %out_var_SV_Target %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag new file mode 100644 index 0000000000..b9b4f5a017 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-col-major.invalid.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 ColMajor + OpMemberDecorate %type_Foo 1 Offset 24 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %type_Foo = OpTypeStruct %mat2v2float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v2float = OpTypePointer Output %v2float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_0 + %22 = OpLoad %v2float %21 + %23 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_1 + %24 = OpLoad %v2float %23 + %25 = OpFAdd %v2float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v2float %27 %27 + %29 = OpFAdd %v2float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag new file mode 100644 index 0000000000..e1830e9cf9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x2-row-major.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 RowMajor + OpMemberDecorate %type_Foo 1 Offset 24 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 + %type_Foo = OpTypeStruct %mat2v2float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v2float = OpTypePointer Output %v2float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_0 + %22 = OpLoad %v2float %21 + %23 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_1 + %24 = OpLoad %v2float %23 + %25 = OpFAdd %v2float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v2float %27 %27 + %29 = OpFAdd %v2float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag new file mode 100644 index 0000000000..647939f205 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-col-major.invalid.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 ColMajor + OpMemberDecorate %type_Foo 1 Offset 28 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %type_Foo = OpTypeStruct %mat2v3float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_0 + %22 = OpLoad %v3float %21 + %23 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_1 + %24 = OpLoad %v3float %23 + %25 = OpFAdd %v3float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v3float %27 %27 %27 + %29 = OpFAdd %v3float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag new file mode 100644 index 0000000000..733465a0fb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float2x3-row-major.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 RowMajor + OpMemberDecorate %type_Foo 1 Offset 40 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 + %type_Foo = OpTypeStruct %mat2v3float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_0 + %22 = OpLoad %v3float %21 + %23 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_1 + %24 = OpLoad %v3float %23 + %25 = OpFAdd %v3float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v3float %27 %27 %27 + %29 = OpFAdd %v3float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag new file mode 100644 index 0000000000..c97fb81f6a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-col-major.invalid.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 ColMajor + OpMemberDecorate %type_Foo 1 Offset 40 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %type_Foo = OpTypeStruct %mat3v2float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v2float = OpTypePointer Output %v2float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_0 + %22 = OpLoad %v2float %21 + %23 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_1 + %24 = OpLoad %v2float %23 + %25 = OpFAdd %v2float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v2float %27 %27 + %29 = OpFAdd %v2float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag new file mode 100644 index 0000000000..b1cfa561e0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x2-row-major.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 RowMajor + OpMemberDecorate %type_Foo 1 Offset 28 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %type_Foo = OpTypeStruct %mat3v2float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v2float = OpTypePointer Output %v2float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_0 + %22 = OpLoad %v2float %21 + %23 = OpAccessChain %_ptr_Uniform_v2float %Foo %int_0 %uint_1 + %24 = OpLoad %v2float %23 + %25 = OpFAdd %v2float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v2float %27 %27 + %29 = OpFAdd %v2float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag new file mode 100644 index 0000000000..cef8308b2f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-col-major.invalid.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 ColMajor + OpMemberDecorate %type_Foo 1 Offset 44 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %type_Foo = OpTypeStruct %mat3v3float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_0 + %22 = OpLoad %v3float %21 + %23 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_1 + %24 = OpLoad %v3float %23 + %25 = OpFAdd %v3float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v3float %27 %27 %27 + %29 = OpFAdd %v3float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag new file mode 100644 index 0000000000..35d7ebc319 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/packing/scalar-float3x3-row-major.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_Foo "type.Foo" + OpMemberName %type_Foo 0 "a" + OpMemberName %type_Foo 1 "b" + OpName %Foo "Foo" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %Foo DescriptorSet 0 + OpDecorate %Foo Binding 0 + OpMemberDecorate %type_Foo 0 Offset 0 + OpMemberDecorate %type_Foo 0 MatrixStride 16 + OpMemberDecorate %type_Foo 0 RowMajor + OpMemberDecorate %type_Foo 1 Offset 44 + OpDecorate %type_Foo Block + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 + %type_Foo = OpTypeStruct %mat3v3float %float +%_ptr_Uniform_type_Foo = OpTypePointer Uniform %type_Foo +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %17 = OpTypeFunction %void +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Foo = OpVariable %_ptr_Uniform_type_Foo Uniform +%out_var_SV_Target = OpVariable %_ptr_Output_v3float Output + %main = OpFunction %void None %17 + %20 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_0 + %22 = OpLoad %v3float %21 + %23 = OpAccessChain %_ptr_Uniform_v3float %Foo %int_0 %uint_1 + %24 = OpLoad %v3float %23 + %25 = OpFAdd %v3float %22 %24 + %26 = OpAccessChain %_ptr_Uniform_float %Foo %int_1 + %27 = OpLoad %float %26 + %28 = OpCompositeConstruct %v3float %27 %27 %27 + %29 = OpFAdd %v3float %25 %28 + OpStore %out_var_SV_Target %29 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..eccff08b33 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %25 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Flat + OpDecorate %vB Location 1 + OpDecorate %38 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input + %bool = OpTypeBool + %int_20 = OpConstant %int 20 + %int_50 = OpConstant %int 50 + %vB = OpVariable %_ptr_Input_int Input + %int_40 = OpConstant %int 40 + %int_60 = OpConstant %int 60 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %11 + OpBranch %17 + %17 = OpLabel + %60 = OpPhi %int %int_0 %5 %58 %20 + %57 = OpPhi %int %int_0 %5 %56 %20 + %25 = OpLoad %int %vA + %27 = OpSLessThan %bool %57 %25 + OpLoopMerge %19 %20 None + OpBranchConditional %27 %18 %19 + %18 = OpLabel + %30 = OpIAdd %int %25 %57 + %32 = OpIEqual %bool %30 %int_20 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %36 + %33 = OpLabel + OpBranch %34 + %36 = OpLabel + %38 = OpLoad %int %vB + %40 = OpIAdd %int %38 %57 + %42 = OpIEqual %bool %40 %int_40 + %64 = OpSelect %int %42 %int_60 %60 + OpBranch %34 + %34 = OpLabel + %58 = OpPhi %int %int_50 %33 %64 %36 + %49 = OpIAdd %int %58 %int_10 + %51 = OpLoad %v4float %FragColor + %53 = OpFAdd %v4float %51 %63 + OpStore %FragColor %53 + OpBranch %20 + %20 = OpLabel + %56 = OpIAdd %int %57 %49 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..5bbe951df4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/array-control-point-initializer.asm.tesc @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 48 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %foo + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %foo "foo" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_arr__arr_float_uint_3_uint_4 = OpTypeArray %_arr_float_uint_3 %uint_4 +%_ptr_Output__arr__arr_float_uint_3_uint_4 = OpTypePointer Output %_arr__arr_float_uint_3_uint_4 +%foo_zero = OpConstantNull %_arr__arr_float_uint_3_uint_4 + %foo = OpVariable %_ptr_Output__arr__arr_float_uint_3_uint_4 Output %foo_zero +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_2 = OpConstant %float 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpLoad %int %gl_InvocationID + %31 = OpLoad %int %gl_InvocationID + %32 = OpConvertSToF %float %31 + %34 = OpAccessChain %_ptr_Output_float %foo %30 %int_0 + OpStore %34 %32 + %35 = OpLoad %int %gl_InvocationID + %37 = OpLoad %int %gl_InvocationID + %38 = OpConvertSToF %float %37 + %39 = OpFAdd %float %38 %float_1 + %40 = OpAccessChain %_ptr_Output_float %foo %35 %int_1 + OpStore %40 %39 + %41 = OpLoad %int %gl_InvocationID + %43 = OpLoad %int %gl_InvocationID + %44 = OpConvertSToF %float %43 + %46 = OpFAdd %float %44 %float_2 + %47 = OpAccessChain %_ptr_Output_float %foo %41 %int_2 + OpStore %47 %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..d4e14be4ab --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/block-control-point-initializer.asm.tesc @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %verts + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %Verts "Verts" + OpMemberName %Verts 0 "a" + OpMemberName %Verts 1 "b" + OpName %verts "verts" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %Verts Block + OpDecorate %verts Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 +;%gl_out_zero = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output ;%gl_out_zero + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2float = OpTypeVector %float 2 + %Verts = OpTypeStruct %float %v2float +%_arr_Verts_uint_4 = OpTypeArray %Verts %uint_4 +%_ptr_Output__arr_Verts_uint_4 = OpTypePointer Output %_arr_Verts_uint_4 + %verts_zero = OpConstantNull %_arr_Verts_uint_4 + %verts = OpVariable %_ptr_Output__arr_Verts_uint_4 Output %verts_zero +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpLoad %int %gl_InvocationID + %31 = OpLoad %int %gl_InvocationID + %32 = OpConvertSToF %float %31 + %34 = OpAccessChain %_ptr_Output_float %verts %30 %int_0 + OpStore %34 %32 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..1219183ca7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/builtin-control-point-initializer.asm.tesc @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %verts + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %Verts "Verts" + OpMemberName %Verts 0 "a" + OpMemberName %Verts 1 "b" + OpName %verts "verts" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %Verts Block + OpDecorate %verts Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%gl_PerVertex = OpTypeStruct %v4float %float + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 +%gl_out_zero = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %gl_out_zero + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2float = OpTypeVector %float 2 + %Verts = OpTypeStruct %float %v2float +%_arr_Verts_uint_4 = OpTypeArray %Verts %uint_4 +%_ptr_Output__arr_Verts_uint_4 = OpTypePointer Output %_arr_Verts_uint_4 + %verts_zero = OpConstantNull %_arr_Verts_uint_4 + %verts = OpVariable %_ptr_Output__arr_Verts_uint_4 Output %verts_zero +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpLoad %int %gl_InvocationID + %31 = OpLoad %int %gl_InvocationID + %32 = OpConvertSToF %float %31 + %34 = OpAccessChain %_ptr_Output_float %verts %30 %int_0 + OpStore %34 %32 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..03ac99befb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/composite-control-point-initializer.asm.tesc @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %foo + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpMemberName %Foo 2 "c" + OpName %foo "foo" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %foo Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v2float = OpTypeVector %float 2 + %Foo = OpTypeStruct %float %v2float %v4float +%_arr_Foo_uint_4 = OpTypeArray %Foo %uint_4 +%_ptr_Output__arr_Foo_uint_4 = OpTypePointer Output %_arr_Foo_uint_4 + %foo_zero = OpConstantNull %_arr_Foo_uint_4 + %foo = OpVariable %_ptr_Output__arr_Foo_uint_4 Output %foo_zero +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpLoad %int %gl_InvocationID + %31 = OpLoad %int %gl_InvocationID + %32 = OpConvertSToF %float %31 + %34 = OpAccessChain %_ptr_Output_float %foo %30 %int_0 + OpStore %34 %32 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc new file mode 100644 index 0000000000..7c0a638f98 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-memory-control-point.asm.tesc @@ -0,0 +1,199 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 2 +; Bound: 126 +; Schema: 0 + OpCapability Tessellation + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %1 "main" %4 %30 %80 %101 %103 %108 %110 %115 %117 + OpExecutionMode %1 OutputVertices 3 + OpExecutionMode %1 Triangles + OpExecutionMode %1 SpacingEqual + OpExecutionMode %1 VertexOrderCw + OpName %1 "main" + OpName %11 "opc" + OpName %14 "cb1_struct" + OpName %16 "cb0_0" + OpName %22 "vicp" + OpName %23 "fork0" + OpName %26 "vForkInstanceId" + OpName %34 "r0" + OpName %32 "fork0_epilogue" + OpName %75 "fork1" + OpName %81 "fork1_epilogue" + OpName %101 "v0" + OpName %103 "v1" + OpName %108 "vicp0" + OpName %110 "vocp0" + OpName %115 "vicp1" + OpName %117 "vocp1" + OpDecorate %4 BuiltIn InvocationId + OpDecorate %13 ArrayStride 16 + OpDecorate %14 Block + OpMemberDecorate %14 0 Offset 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %30 BuiltIn TessLevelOuter + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %80 BuiltIn TessLevelInner + OpDecorate %80 Patch + OpDecorate %80 Patch + OpDecorate %101 Location 0 + OpDecorate %103 Location 1 + OpDecorate %108 Location 2 + OpDecorate %110 Location 3 + OpDecorate %115 Location 4 + OpDecorate %117 Location 5 + %2 = OpTypeInt 32 1 + %3 = OpTypePointer Input %2 + %4 = OpVariable %3 Input + %5 = OpTypeFloat 32 + %6 = OpTypeVector %5 4 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 4 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Private %9 + %11 = OpVariable %10 Private + %12 = OpConstant %7 1 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %7 3 + %18 = OpTypeArray %6 %17 + %19 = OpConstant %7 2 + %20 = OpTypeArray %18 %19 + %21 = OpTypePointer Private %20 + %22 = OpVariable %21 Private + %24 = OpTypeVoid + %25 = OpTypeFunction %24 %7 + %28 = OpTypeArray %5 %8 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %7 0 + %33 = OpTypePointer Function %6 + %36 = OpTypePointer Function %5 + %38 = OpTypePointer Uniform %6 + %40 = OpTypePointer Uniform %5 + %46 = OpTypePointer Private %6 + %48 = OpTypePointer Private %5 + %52 = OpVariable %46 Private + %55 = OpVariable %46 Private + %58 = OpVariable %46 Private + %60 = OpTypeFunction %24 %46 %46 %46 + %69 = OpTypePointer Output %5 + %76 = OpTypeFunction %24 + %78 = OpTypeArray %5 %19 + %79 = OpTypePointer Output %78 + %80 = OpVariable %79 Output + %89 = OpVariable %46 Private + %91 = OpTypeFunction %24 %46 + %98 = OpTypePointer Private %18 + %100 = OpTypePointer Input %18 + %101 = OpVariable %100 Input + %103 = OpVariable %100 Input + %105 = OpTypeVector %5 3 + %106 = OpTypeArray %105 %17 + %107 = OpTypePointer Input %106 + %108 = OpVariable %107 Input + %109 = OpTypePointer Output %106 + %110 = OpVariable %109 Output + %111 = OpTypePointer Output %105 + %112 = OpTypePointer Input %105 + %115 = OpVariable %100 Input + %116 = OpTypePointer Output %18 + %117 = OpVariable %116 Output + %118 = OpTypePointer Output %6 + %119 = OpTypePointer Input %6 + %23 = OpFunction %24 None %25 + %26 = OpFunctionParameter %7 + %27 = OpLabel + %34 = OpVariable %33 Function + %35 = OpBitcast %5 %26 + %37 = OpInBoundsAccessChain %36 %34 %31 + OpStore %37 %35 + %39 = OpAccessChain %38 %16 %31 %31 + %41 = OpInBoundsAccessChain %40 %39 %31 + %42 = OpLoad %5 %41 + %43 = OpInBoundsAccessChain %36 %34 %31 + %44 = OpLoad %5 %43 + %45 = OpBitcast %2 %44 + %47 = OpAccessChain %46 %11 %45 + %49 = OpInBoundsAccessChain %48 %47 %31 + OpStore %49 %42 + %50 = OpAccessChain %46 %11 %31 + %51 = OpLoad %6 %50 + OpStore %52 %51 + %53 = OpAccessChain %46 %11 %12 + %54 = OpLoad %6 %53 + OpStore %55 %54 + %56 = OpAccessChain %46 %11 %19 + %57 = OpLoad %6 %56 + OpStore %58 %57 + %59 = OpFunctionCall %24 %32 %52 %55 %58 + OpReturn + OpFunctionEnd + %32 = OpFunction %24 None %60 + %61 = OpFunctionParameter %46 + %62 = OpFunctionParameter %46 + %63 = OpFunctionParameter %46 + %64 = OpLabel + %65 = OpLoad %6 %61 + %66 = OpLoad %6 %62 + %67 = OpLoad %6 %63 + %68 = OpCompositeExtract %5 %65 0 + %70 = OpAccessChain %69 %30 %31 + OpStore %70 %68 + %71 = OpCompositeExtract %5 %66 0 + %72 = OpAccessChain %69 %30 %12 + OpStore %72 %71 + %73 = OpCompositeExtract %5 %67 0 + %74 = OpAccessChain %69 %30 %19 + OpStore %74 %73 + OpReturn + OpFunctionEnd + %75 = OpFunction %24 None %76 + %77 = OpLabel + %82 = OpAccessChain %38 %16 %31 %31 + %83 = OpInBoundsAccessChain %40 %82 %31 + %84 = OpLoad %5 %83 + %85 = OpAccessChain %46 %11 %17 + %86 = OpInBoundsAccessChain %48 %85 %31 + OpStore %86 %84 + %87 = OpAccessChain %46 %11 %17 + %88 = OpLoad %6 %87 + OpStore %89 %88 + %90 = OpFunctionCall %24 %81 %89 + OpReturn + OpFunctionEnd + %81 = OpFunction %24 None %91 + %92 = OpFunctionParameter %46 + %93 = OpLabel + %94 = OpLoad %6 %92 + %95 = OpCompositeExtract %5 %94 0 + %96 = OpAccessChain %69 %80 %31 + OpStore %96 %95 + OpReturn + OpFunctionEnd + %1 = OpFunction %24 None %76 + %97 = OpLabel + %99 = OpInBoundsAccessChain %98 %22 %31 + OpCopyMemory %99 %101 + %102 = OpInBoundsAccessChain %98 %22 %12 + OpCopyMemory %102 %103 + %104 = OpLoad %2 %4 + %113 = OpAccessChain %111 %110 %104 + %114 = OpAccessChain %112 %108 %104 + OpCopyMemory %113 %114 + %120 = OpAccessChain %118 %117 %104 + %121 = OpAccessChain %119 %115 %104 + OpCopyMemory %120 %121 + %122 = OpFunctionCall %24 %23 %31 + %123 = OpFunctionCall %24 %23 %12 + %124 = OpFunctionCall %24 %23 %19 + %125 = OpFunctionCall %24 %75 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc new file mode 100644 index 0000000000..346466e61f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/copy-tess-level-tri.asm.tesc @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 43 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID + OpExecutionMode %main OutputVertices 1 + OpExecutionMode %main Triangles + OpSource GLSL 450 + OpName %main "main" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpName %inner "inner" + OpName %outer "outer" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %14 = OpConstantComposite %_arr_float_uint_2 %float_1 %float_2 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %21 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_1 = OpTypeArray %gl_PerVertex %uint_1 +%_ptr_Output__arr_gl_PerVertex_uint_1 = OpTypePointer Output %_arr_gl_PerVertex_uint_1 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_1 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %40 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %inner = OpVariable %_ptr_Function__arr_float_uint_2 Function + %outer = OpVariable %_ptr_Function__arr_float_uint_4 Function + OpStore %gl_TessLevelInner %14 + OpStore %gl_TessLevelOuter %21 + %24 = OpLoad %_arr_float_uint_2 %gl_TessLevelInner + OpStore %inner %24 + %27 = OpLoad %_arr_float_uint_4 %gl_TessLevelOuter + OpStore %outer %27 + %38 = OpLoad %int %gl_InvocationID + %42 = OpAccessChain %_ptr_Output_v4float %gl_out %38 %int_0 + OpStore %42 %40 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc new file mode 100644 index 0000000000..2a95da04b7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/plain-control-point-initializer.asm.tesc @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 33 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %v + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %v "v" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %v Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %v_zero = OpConstantNull %_arr_float_uint_4 + %v = OpVariable %_ptr_Output__arr_float_uint_4 Output %v_zero +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %28 = OpLoad %int %gl_InvocationID + %29 = OpLoad %int %gl_InvocationID + %30 = OpConvertSToF %float %29 + %32 = OpAccessChain %_ptr_Output_float %v %28 + OpStore %32 %30 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc new file mode 100644 index 0000000000..0fd4dce256 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -0,0 +1,248 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 162 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %hs_main "main" %p_pos %p_1 %i_1 %_entryPointOutput_pos %_entryPointOutput %_patchConstantOutput_EdgeTess %_patchConstantOutput_InsideTess + OpExecutionMode %hs_main OutputVertices 3 + OpExecutionMode %hs_main Triangles + OpExecutionMode %hs_main SpacingFractionalOdd + OpExecutionMode %hs_main VertexOrderCw + OpSource HLSL 500 + OpName %hs_main "hs_main" + OpName %VertexOutput "VertexOutput" + OpMemberName %VertexOutput 0 "pos" + OpMemberName %VertexOutput 1 "uv" + OpName %HSOut "HSOut" + OpMemberName %HSOut 0 "pos" + OpMemberName %HSOut 1 "uv" + OpName %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ "@hs_main(struct-VertexOutput-vf4-vf21[3];u1;" + OpName %p "p" + OpName %i "i" + OpName %HSConstantOut "HSConstantOut" + OpMemberName %HSConstantOut 0 "EdgeTess" + OpMemberName %HSConstantOut 1 "InsideTess" + OpName %PatchHS_struct_VertexOutput_vf4_vf21_3__ "PatchHS(struct-VertexOutput-vf4-vf21[3];" + OpName %patch "patch" + OpName %output "output" + OpName %p_0 "p" + OpName %p_pos "p.pos" + OpName %VertexOutput_0 "VertexOutput" + OpMemberName %VertexOutput_0 0 "uv" + OpName %p_1 "p" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %HSOut_0 "HSOut" + OpMemberName %HSOut_0 0 "uv" + OpName %_entryPointOutput "@entryPointOutput" + OpName %_patchConstantResult "@patchConstantResult" + OpName %param_1 "param" + OpName %_patchConstantOutput_EdgeTess "@patchConstantOutput.EdgeTess" + OpName %_patchConstantOutput_InsideTess "@patchConstantOutput.InsideTess" + OpName %output_0 "output" + OpDecorate %p_pos BuiltIn Position + OpDecorate %p_1 Location 0 + OpDecorate %i_1 BuiltIn InvocationId + OpDecorate %_entryPointOutput_pos BuiltIn Position + OpDecorate %_entryPointOutput Location 0 + OpDecorate %_patchConstantOutput_EdgeTess Patch + OpDecorate %_patchConstantOutput_EdgeTess BuiltIn TessLevelOuter + OpDecorate %_patchConstantOutput_InsideTess Patch + OpDecorate %_patchConstantOutput_InsideTess BuiltIn TessLevelInner + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%VertexOutput = OpTypeStruct %v4float %v2float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_VertexOutput_uint_3 = OpTypeArray %VertexOutput %uint_3 +%_ptr_Function__arr_VertexOutput_uint_3 = OpTypePointer Function %_arr_VertexOutput_uint_3 +%_ptr_Function_uint = OpTypePointer Function %uint + %HSOut = OpTypeStruct %v4float %v2float + %16 = OpTypeFunction %HSOut %_ptr_Function__arr_VertexOutput_uint_3 %_ptr_Function_uint +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%HSConstantOut = OpTypeStruct %_arr_float_uint_3 %float + %23 = OpTypeFunction %HSConstantOut %_ptr_Function__arr_VertexOutput_uint_3 +%_ptr_Function_HSOut = OpTypePointer Function %HSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 + %p_pos = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%VertexOutput_0 = OpTypeStruct %v2float +%_arr_VertexOutput_0_uint_3 = OpTypeArray %VertexOutput_0 %uint_3 +%_ptr_Input__arr_VertexOutput_0_uint_3 = OpTypePointer Input %_arr_VertexOutput_0_uint_3 + %p_1 = OpVariable %_ptr_Input__arr_VertexOutput_0_uint_3 Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %int_2 = OpConstant %int 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %i_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_entryPointOutput_pos = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %HSOut_0 = OpTypeStruct %v2float +%_arr_HSOut_0_uint_3 = OpTypeArray %HSOut_0 %uint_3 +%_ptr_Output__arr_HSOut_0_uint_3 = OpTypePointer Output %_arr_HSOut_0_uint_3 +%_entryPointOutput = OpVariable %_ptr_Output__arr_HSOut_0_uint_3 Output +%_ptr_Output_v2float = OpTypePointer Output %v2float + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Function_HSConstantOut = OpTypePointer Function %HSConstantOut + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_patchConstantOutput_EdgeTess = OpVariable %_ptr_Output__arr_float_uint_4 Output +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_patchConstantOutput_InsideTess = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %hs_main = OpFunction %void None %3 + %5 = OpLabel + %p_0 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %i_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_HSOut Function + %param = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %param_0 = OpVariable %_ptr_Function_uint Function +%_patchConstantResult = OpVariable %_ptr_Function_HSConstantOut Function + %param_1 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %50 = OpAccessChain %_ptr_Input_v4float %p_pos %int_0 + %51 = OpLoad %v4float %50 + %52 = OpAccessChain %_ptr_Function_v4float %p_0 %int_0 %int_0 + OpStore %52 %51 + %58 = OpAccessChain %_ptr_Input_v2float %p_1 %int_0 %int_0 + %59 = OpLoad %v2float %58 + %60 = OpAccessChain %_ptr_Function_v2float %p_0 %int_0 %int_1 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Input_v4float %p_pos %int_1 + %62 = OpLoad %v4float %61 + %63 = OpAccessChain %_ptr_Function_v4float %p_0 %int_1 %int_0 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Input_v2float %p_1 %int_1 %int_0 + %65 = OpLoad %v2float %64 + %66 = OpAccessChain %_ptr_Function_v2float %p_0 %int_1 %int_1 + OpStore %66 %65 + %68 = OpAccessChain %_ptr_Input_v4float %p_pos %int_2 + %69 = OpLoad %v4float %68 + %70 = OpAccessChain %_ptr_Function_v4float %p_0 %int_2 %int_0 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Input_v2float %p_1 %int_2 %int_0 + %72 = OpLoad %v2float %71 + %73 = OpAccessChain %_ptr_Function_v2float %p_0 %int_2 %int_1 + OpStore %73 %72 + %77 = OpLoad %uint %i_1 + OpStore %i_0 %77 + %80 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param %80 + %82 = OpLoad %uint %i_0 + OpStore %param_0 %82 + %83 = OpFunctionCall %HSOut %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ %param %param_0 + OpStore %flattenTemp %83 + %86 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %87 = OpLoad %v4float %86 + %94 = OpLoad %uint %i_1 + %89 = OpAccessChain %_ptr_Output_v4float %_entryPointOutput_pos %94 + OpStore %89 %87 + %95 = OpAccessChain %_ptr_Function_v2float %flattenTemp %int_1 + %96 = OpLoad %v2float %95 + %98 = OpAccessChain %_ptr_Output_v2float %_entryPointOutput %94 %int_0 + OpStore %98 %96 + OpControlBarrier %uint_2 %uint_1 %uint_0 + %102 = OpLoad %uint %i_1 + %104 = OpIEqual %bool %102 %int_0 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %110 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param_1 %110 + %111 = OpFunctionCall %HSConstantOut %PatchHS_struct_VertexOutput_vf4_vf21_3__ %param_1 + OpStore %_patchConstantResult %111 + %117 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_0 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_0 + OpStore %120 %118 + %121 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_1 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_1 + OpStore %123 %122 + %124 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_2 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_2 + OpStore %126 %125 + %130 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_1 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_InsideTess %int_0 + OpStore %132 %131 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +%_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ = OpFunction %HSOut None %16 + %p = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %i = OpFunctionParameter %_ptr_Function_uint + %20 = OpLabel + %output = OpVariable %_ptr_Function_HSOut Function + %31 = OpLoad %uint %i + %33 = OpAccessChain %_ptr_Function_v4float %p %31 %int_0 + %34 = OpLoad %v4float %33 + %35 = OpAccessChain %_ptr_Function_v4float %output %int_0 + OpStore %35 %34 + %37 = OpLoad %uint %i + %39 = OpAccessChain %_ptr_Function_v2float %p %37 %int_1 + %40 = OpLoad %v2float %39 + %41 = OpAccessChain %_ptr_Function_v2float %output %int_1 + OpStore %41 %40 + %42 = OpLoad %HSOut %output + OpReturnValue %42 + OpFunctionEnd +%PatchHS_struct_VertexOutput_vf4_vf21_3__ = OpFunction %HSConstantOut None %23 + %patch = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %26 = OpLabel + %output_0 = OpVariable %_ptr_Function_HSConstantOut Function + %135 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %136 = OpLoad %v2float %135 + %137 = OpCompositeConstruct %v2float %float_1 %float_1 + %138 = OpFAdd %v2float %137 %136 + %139 = OpCompositeExtract %float %138 0 + %140 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_0 + OpStore %140 %139 + %141 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %142 = OpLoad %v2float %141 + %143 = OpCompositeConstruct %v2float %float_1 %float_1 + %144 = OpFAdd %v2float %143 %142 + %145 = OpCompositeExtract %float %144 0 + %146 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_1 + OpStore %146 %145 + %147 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %148 = OpLoad %v2float %147 + %149 = OpCompositeConstruct %v2float %float_1 %float_1 + %150 = OpFAdd %v2float %149 %148 + %151 = OpCompositeExtract %float %150 0 + %152 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_2 + OpStore %152 %151 + %153 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %154 = OpLoad %v2float %153 + %155 = OpCompositeConstruct %v2float %float_1 %float_1 + %156 = OpFAdd %v2float %155 %154 + %157 = OpCompositeExtract %float %156 0 + %158 = OpAccessChain %_ptr_Function_float %output_0 %int_1 + OpStore %158 %157 + %159 = OpLoad %HSConstantOut %output_0 + OpReturnValue %159 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc new file mode 100644 index 0000000000..0fd4dce256 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.multi-patch.asm.tesc @@ -0,0 +1,248 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 162 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %hs_main "main" %p_pos %p_1 %i_1 %_entryPointOutput_pos %_entryPointOutput %_patchConstantOutput_EdgeTess %_patchConstantOutput_InsideTess + OpExecutionMode %hs_main OutputVertices 3 + OpExecutionMode %hs_main Triangles + OpExecutionMode %hs_main SpacingFractionalOdd + OpExecutionMode %hs_main VertexOrderCw + OpSource HLSL 500 + OpName %hs_main "hs_main" + OpName %VertexOutput "VertexOutput" + OpMemberName %VertexOutput 0 "pos" + OpMemberName %VertexOutput 1 "uv" + OpName %HSOut "HSOut" + OpMemberName %HSOut 0 "pos" + OpMemberName %HSOut 1 "uv" + OpName %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ "@hs_main(struct-VertexOutput-vf4-vf21[3];u1;" + OpName %p "p" + OpName %i "i" + OpName %HSConstantOut "HSConstantOut" + OpMemberName %HSConstantOut 0 "EdgeTess" + OpMemberName %HSConstantOut 1 "InsideTess" + OpName %PatchHS_struct_VertexOutput_vf4_vf21_3__ "PatchHS(struct-VertexOutput-vf4-vf21[3];" + OpName %patch "patch" + OpName %output "output" + OpName %p_0 "p" + OpName %p_pos "p.pos" + OpName %VertexOutput_0 "VertexOutput" + OpMemberName %VertexOutput_0 0 "uv" + OpName %p_1 "p" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %HSOut_0 "HSOut" + OpMemberName %HSOut_0 0 "uv" + OpName %_entryPointOutput "@entryPointOutput" + OpName %_patchConstantResult "@patchConstantResult" + OpName %param_1 "param" + OpName %_patchConstantOutput_EdgeTess "@patchConstantOutput.EdgeTess" + OpName %_patchConstantOutput_InsideTess "@patchConstantOutput.InsideTess" + OpName %output_0 "output" + OpDecorate %p_pos BuiltIn Position + OpDecorate %p_1 Location 0 + OpDecorate %i_1 BuiltIn InvocationId + OpDecorate %_entryPointOutput_pos BuiltIn Position + OpDecorate %_entryPointOutput Location 0 + OpDecorate %_patchConstantOutput_EdgeTess Patch + OpDecorate %_patchConstantOutput_EdgeTess BuiltIn TessLevelOuter + OpDecorate %_patchConstantOutput_InsideTess Patch + OpDecorate %_patchConstantOutput_InsideTess BuiltIn TessLevelInner + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%VertexOutput = OpTypeStruct %v4float %v2float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_VertexOutput_uint_3 = OpTypeArray %VertexOutput %uint_3 +%_ptr_Function__arr_VertexOutput_uint_3 = OpTypePointer Function %_arr_VertexOutput_uint_3 +%_ptr_Function_uint = OpTypePointer Function %uint + %HSOut = OpTypeStruct %v4float %v2float + %16 = OpTypeFunction %HSOut %_ptr_Function__arr_VertexOutput_uint_3 %_ptr_Function_uint +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%HSConstantOut = OpTypeStruct %_arr_float_uint_3 %float + %23 = OpTypeFunction %HSConstantOut %_ptr_Function__arr_VertexOutput_uint_3 +%_ptr_Function_HSOut = OpTypePointer Function %HSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 + %p_pos = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%VertexOutput_0 = OpTypeStruct %v2float +%_arr_VertexOutput_0_uint_3 = OpTypeArray %VertexOutput_0 %uint_3 +%_ptr_Input__arr_VertexOutput_0_uint_3 = OpTypePointer Input %_arr_VertexOutput_0_uint_3 + %p_1 = OpVariable %_ptr_Input__arr_VertexOutput_0_uint_3 Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %int_2 = OpConstant %int 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %i_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_entryPointOutput_pos = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %HSOut_0 = OpTypeStruct %v2float +%_arr_HSOut_0_uint_3 = OpTypeArray %HSOut_0 %uint_3 +%_ptr_Output__arr_HSOut_0_uint_3 = OpTypePointer Output %_arr_HSOut_0_uint_3 +%_entryPointOutput = OpVariable %_ptr_Output__arr_HSOut_0_uint_3 Output +%_ptr_Output_v2float = OpTypePointer Output %v2float + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Function_HSConstantOut = OpTypePointer Function %HSConstantOut + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_patchConstantOutput_EdgeTess = OpVariable %_ptr_Output__arr_float_uint_4 Output +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_patchConstantOutput_InsideTess = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %hs_main = OpFunction %void None %3 + %5 = OpLabel + %p_0 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %i_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_HSOut Function + %param = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %param_0 = OpVariable %_ptr_Function_uint Function +%_patchConstantResult = OpVariable %_ptr_Function_HSConstantOut Function + %param_1 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %50 = OpAccessChain %_ptr_Input_v4float %p_pos %int_0 + %51 = OpLoad %v4float %50 + %52 = OpAccessChain %_ptr_Function_v4float %p_0 %int_0 %int_0 + OpStore %52 %51 + %58 = OpAccessChain %_ptr_Input_v2float %p_1 %int_0 %int_0 + %59 = OpLoad %v2float %58 + %60 = OpAccessChain %_ptr_Function_v2float %p_0 %int_0 %int_1 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Input_v4float %p_pos %int_1 + %62 = OpLoad %v4float %61 + %63 = OpAccessChain %_ptr_Function_v4float %p_0 %int_1 %int_0 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Input_v2float %p_1 %int_1 %int_0 + %65 = OpLoad %v2float %64 + %66 = OpAccessChain %_ptr_Function_v2float %p_0 %int_1 %int_1 + OpStore %66 %65 + %68 = OpAccessChain %_ptr_Input_v4float %p_pos %int_2 + %69 = OpLoad %v4float %68 + %70 = OpAccessChain %_ptr_Function_v4float %p_0 %int_2 %int_0 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Input_v2float %p_1 %int_2 %int_0 + %72 = OpLoad %v2float %71 + %73 = OpAccessChain %_ptr_Function_v2float %p_0 %int_2 %int_1 + OpStore %73 %72 + %77 = OpLoad %uint %i_1 + OpStore %i_0 %77 + %80 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param %80 + %82 = OpLoad %uint %i_0 + OpStore %param_0 %82 + %83 = OpFunctionCall %HSOut %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ %param %param_0 + OpStore %flattenTemp %83 + %86 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %87 = OpLoad %v4float %86 + %94 = OpLoad %uint %i_1 + %89 = OpAccessChain %_ptr_Output_v4float %_entryPointOutput_pos %94 + OpStore %89 %87 + %95 = OpAccessChain %_ptr_Function_v2float %flattenTemp %int_1 + %96 = OpLoad %v2float %95 + %98 = OpAccessChain %_ptr_Output_v2float %_entryPointOutput %94 %int_0 + OpStore %98 %96 + OpControlBarrier %uint_2 %uint_1 %uint_0 + %102 = OpLoad %uint %i_1 + %104 = OpIEqual %bool %102 %int_0 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %110 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param_1 %110 + %111 = OpFunctionCall %HSConstantOut %PatchHS_struct_VertexOutput_vf4_vf21_3__ %param_1 + OpStore %_patchConstantResult %111 + %117 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_0 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_0 + OpStore %120 %118 + %121 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_1 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_1 + OpStore %123 %122 + %124 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_2 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_2 + OpStore %126 %125 + %130 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_1 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_InsideTess %int_0 + OpStore %132 %131 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +%_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ = OpFunction %HSOut None %16 + %p = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %i = OpFunctionParameter %_ptr_Function_uint + %20 = OpLabel + %output = OpVariable %_ptr_Function_HSOut Function + %31 = OpLoad %uint %i + %33 = OpAccessChain %_ptr_Function_v4float %p %31 %int_0 + %34 = OpLoad %v4float %33 + %35 = OpAccessChain %_ptr_Function_v4float %output %int_0 + OpStore %35 %34 + %37 = OpLoad %uint %i + %39 = OpAccessChain %_ptr_Function_v2float %p %37 %int_1 + %40 = OpLoad %v2float %39 + %41 = OpAccessChain %_ptr_Function_v2float %output %int_1 + OpStore %41 %40 + %42 = OpLoad %HSOut %output + OpReturnValue %42 + OpFunctionEnd +%PatchHS_struct_VertexOutput_vf4_vf21_3__ = OpFunction %HSConstantOut None %23 + %patch = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %26 = OpLabel + %output_0 = OpVariable %_ptr_Function_HSConstantOut Function + %135 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %136 = OpLoad %v2float %135 + %137 = OpCompositeConstruct %v2float %float_1 %float_1 + %138 = OpFAdd %v2float %137 %136 + %139 = OpCompositeExtract %float %138 0 + %140 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_0 + OpStore %140 %139 + %141 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %142 = OpLoad %v2float %141 + %143 = OpCompositeConstruct %v2float %float_1 %float_1 + %144 = OpFAdd %v2float %143 %142 + %145 = OpCompositeExtract %float %144 0 + %146 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_1 + OpStore %146 %145 + %147 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %148 = OpLoad %v2float %147 + %149 = OpCompositeConstruct %v2float %float_1 %float_1 + %150 = OpFAdd %v2float %149 %148 + %151 = OpCompositeExtract %float %150 0 + %152 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_2 + OpStore %152 %151 + %153 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %154 = OpLoad %v2float %153 + %155 = OpCompositeConstruct %v2float %float_1 %float_1 + %156 = OpFAdd %v2float %155 %154 + %157 = OpCompositeExtract %float %156 0 + %158 = OpAccessChain %_ptr_Function_float %output_0 %int_1 + OpStore %158 %157 + %159 = OpLoad %HSConstantOut %output_0 + OpReturnValue %159 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc new file mode 100644 index 0000000000..53248f17e6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-quad.asm.tesc @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 47 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 4 + OpExecutionMode %main Quads + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 + %inner_zero = OpConstantNull %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %inner_zero +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %outer_zero = OpConstantNull %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %outer_zero + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int_2 = OpConstant %int 2 + %float_5 = OpConstant %float 5 + %int_3 = OpConstant %int 3 + %float_6 = OpConstant %float 6 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %30 %float_1 + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %33 %float_2 + %38 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %38 %float_3 + %40 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %40 %float_4 + %43 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %43 %float_5 + %46 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %46 %float_6 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc new file mode 100644 index 0000000000..6fbc33dc22 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-initializer-triangle.asm.tesc @@ -0,0 +1,88 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 47 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 4 + OpExecutionMode %main Triangles + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 + %inner_zero = OpConstantNull %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %inner_zero +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %outer_zero = OpConstantNull %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %outer_zero + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int_2 = OpConstant %int 2 + %float_5 = OpConstant %float 5 + %int_3 = OpConstant %int 3 + %float_6 = OpConstant %float 6 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %30 %float_1 + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %33 %float_2 + %38 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %38 %float_3 + %40 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %40 %float_4 + %43 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %43 %float_5 + %46 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %46 %float_6 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc new file mode 100644 index 0000000000..33b8883cc8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tesc/tess-level-read-write-in-function-tri.asm.tesc @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 64 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter %gl_out %gl_InvocationID + OpExecutionMode %main OutputVertices 1 + OpExecutionMode %main Triangles + OpSource GLSL 450 + OpName %main "main" + OpName %load_tess_level_in_func_ "load_tess_level_in_func(" + OpName %store_tess_level_in_func_ "store_tess_level_in_func(" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpName %v "v" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Output_float = OpTypePointer Output %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int_2 = OpConstant %int 2 + %float_5 = OpConstant %float 5 + %int_3 = OpConstant %int 3 + %float_6 = OpConstant %float 6 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_1 = OpTypeArray %gl_PerVertex %uint_1 +%_ptr_Output__arr_gl_PerVertex_uint_1 = OpTypePointer Output %_arr_gl_PerVertex_uint_1 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_1 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_float Function + %46 = OpFunctionCall %void %store_tess_level_in_func_ + %49 = OpFunctionCall %float %load_tess_level_in_func_ + OpStore %v %49 + %59 = OpLoad %int %gl_InvocationID + %60 = OpLoad %float %v + %61 = OpCompositeConstruct %v4float %60 %60 %60 %60 + %63 = OpAccessChain %_ptr_Output_v4float %gl_out %59 %int_0 + OpStore %63 %61 + OpReturn + OpFunctionEnd +%load_tess_level_in_func_ = OpFunction %float None %7 + %9 = OpLabel + %20 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + %21 = OpLoad %float %20 + %27 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + %28 = OpLoad %float %27 + %29 = OpFAdd %float %21 %28 + OpReturnValue %29 + OpFunctionEnd +%store_tess_level_in_func_ = OpFunction %void None %3 + %11 = OpLabel + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %33 %float_1 + %35 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %35 %float_2 + %37 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %37 %float_3 + %39 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %39 %float_4 + %42 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %42 %float_5 + %45 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %45 %float_6 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese b/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese new file mode 100644 index 0000000000..5a7e730634 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/copy-tess-level.asm.msl2.tese @@ -0,0 +1,58 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 35 +; Schema: 0 + OpCapability Tessellation + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %Domain "main" %gl_TessLevelOuter %gl_TessLevelInner %in_var_CUSTOM_VALUE %gl_TessCoord %out_var_CUSTOM_VALUE + OpExecutionMode %Domain Quads + OpSource HLSL 600 + OpName %in_var_CUSTOM_VALUE "in.var.CUSTOM_VALUE" + OpName %out_var_CUSTOM_VALUE "out.var.CUSTOM_VALUE" + OpName %Domain "Domain" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorate %gl_TessCoord Patch + OpDecorate %in_var_CUSTOM_VALUE Location 0 + OpDecorate %out_var_CUSTOM_VALUE Location 0 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %float = OpTypeFloat 32 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 + %v4float = OpTypeVector %float 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Input__arr_v4float_uint_4 = OpTypePointer Input %_arr_v4float_uint_4 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %22 = OpTypeFunction %void +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input +%in_var_CUSTOM_VALUE = OpVariable %_ptr_Input__arr_v4float_uint_4 Input +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input +%out_var_CUSTOM_VALUE = OpVariable %_ptr_Output_v4float Output + %Domain = OpFunction %void None %22 + %23 = OpLabel + %24 = OpLoad %_arr_float_uint_4 %gl_TessLevelOuter + %25 = OpLoad %_arr_float_uint_2 %gl_TessLevelInner + %26 = OpCompositeExtract %float %24 0 + %27 = OpCompositeExtract %float %24 1 + %28 = OpCompositeExtract %float %24 2 + %29 = OpCompositeExtract %float %24 3 + %30 = OpCompositeExtract %float %25 0 + %31 = OpCompositeExtract %float %25 1 + %32 = OpFAdd %float %26 %30 + %33 = OpFAdd %float %27 %31 + %34 = OpCompositeConstruct %v4float %32 %33 %28 %29 + OpStore %out_var_CUSTOM_VALUE %34 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese b/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese new file mode 100644 index 0000000000..e13064f94f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/tese/split-access-chain.asm.tese @@ -0,0 +1,35 @@ + OpCapability Tessellation + %94 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %in0 %o0 + OpExecutionMode %main Quads + OpName %main "main" + OpName %in0 "in0" + OpName %o0 "o0" + OpDecorate %in0 Location 0 + OpDecorate %o0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Input__arr_v4float_uint_1 = OpTypePointer Input %_arr_v4float_uint_1 + %in0 = OpVariable %_ptr_Input__arr_v4float_uint_1 Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o0 = OpVariable %_ptr_Output_float Output +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %4 = OpLabel + %ac = OpAccessChain %_ptr_Input_v4float %in0 %uint_0 + %bac = OpInBoundsAccessChain %_ptr_Input_float %ac %uint_2 + %loaded = OpLoad %float %bac + OpStore %o0 %loaded + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert new file mode 100644 index 0000000000..628cdc2855 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-io-use-in-function.asm.vert @@ -0,0 +1,314 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 102 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %a_color %a_texcoord %a_position %__1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpSourceExtension "GL_EXT_multiview" + OpName %main "main" + OpName %DrawWorldVS_ "DrawWorldVS(" + OpName %PerVertex "PerVertex" + OpMemberName %PerVertex 0 "v_color" + OpMemberName %PerVertex 1 "v_texPos" + OpMemberName %PerVertex 2 "v_worldPosition" + OpName %_ "" + OpName %a_color "a_color" + OpName %a_texcoord "a_texcoord" + OpName %a_position "a_position" + OpName %worldSpacePosition "worldSpacePosition" + OpName %u_objToWorlds "u_objToWorlds" + OpMemberName %u_objToWorlds 0 "u_objToWorld" + OpName %__0 "" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %__1 "" + OpName %CameraData "CameraData" + OpMemberName %CameraData 0 "u_projectFromView" + OpMemberName %CameraData 1 "u_projectFromWorld" + OpMemberName %CameraData 2 "u_clipFromPixels" + OpMemberName %CameraData 3 "u_viewFromWorld" + OpMemberName %CameraData 4 "u_worldFromView" + OpMemberName %CameraData 5 "u_viewFromProject" + OpMemberName %CameraData 6 "u_cameraPosition" + OpMemberName %CameraData 7 "pad0" + OpMemberName %CameraData 8 "u_cameraRight" + OpMemberName %CameraData 9 "pad1" + OpMemberName %CameraData 10 "u_cameraUp" + OpMemberName %CameraData 11 "pad2" + OpMemberName %CameraData 12 "u_cameraForward" + OpMemberName %CameraData 13 "pad3" + OpMemberName %CameraData 14 "u_clipPlanes" + OpMemberName %CameraData 15 "u_invProjParams" + OpMemberName %CameraData 16 "u_viewportSize" + OpMemberName %CameraData 17 "u_invViewportSize" + OpMemberName %CameraData 18 "u_viewportOffset" + OpMemberName %CameraData 19 "u_fragToLightGrid" + OpMemberName %CameraData 20 "u_screenToLightGrid" + OpMemberName %CameraData 21 "pad4" + OpMemberName %CameraData 22 "u_lightGridZParams" + OpName %LightData "LightData" + OpMemberName %LightData 0 "posRadius" + OpMemberName %LightData 1 "color" + OpMemberName %LightData 2 "axis" + OpMemberName %LightData 3 "directionalParams" + OpMemberName %LightData 4 "spotParams" + OpMemberName %LightData 5 "shadowSize" + OpMemberName %LightData 6 "cookieFromWorld" + OpMemberName %LightData 7 "shadowFromWorld" + OpMemberName %LightData 8 "shadowTextureValid" + OpMemberName %LightData 9 "lightCookieValid" + OpMemberName %LightData 10 "minLightDistance" + OpMemberName %LightData 11 "pad" + OpName %SceneSettings "SceneSettings" + OpMemberName %SceneSettings 0 "u_cameras" + OpMemberName %SceneSettings 1 "u_centerPosition" + OpMemberName %SceneSettings 2 "u_centerRight" + OpMemberName %SceneSettings 3 "u_centerUp" + OpMemberName %SceneSettings 4 "u_centerForward" + OpMemberName %SceneSettings 5 "u_times" + OpMemberName %SceneSettings 6 "u_lightFXMask" + OpMemberName %SceneSettings 7 "u_lights" + OpMemberName %SceneSettings 8 "u_globalLightDir" + OpMemberName %SceneSettings 9 "u_globalLightDiffuseColor" + OpMemberName %SceneSettings 10 "u_globalLightSpecularColor" + OpMemberName %SceneSettings 11 "u_distanceFog" + OpMemberName %SceneSettings 12 "u_heightFog" + OpMemberName %SceneSettings 13 "u_fogColor" + OpMemberName %SceneSettings 14 "u_debugMode" + OpName %__2 "" + OpName %LightContext "LightContext" + OpMemberName %LightContext 0 "u_ambientIBLTint" + OpMemberName %LightContext 1 "u_specularIBLTint" + OpMemberName %LightContext 2 "u_iblAABBMin" + OpMemberName %LightContext 3 "u_iblAABBMax" + OpMemberName %LightContext 4 "u_iblAABBCenter" + OpMemberName %LightContext 5 "LightContext_unusued0" + OpMemberName %LightContext 6 "u_exposureMultiplier" + OpName %__3 "" + OpName %u_sceneDepthMS "u_sceneDepthMS" + OpName %u_sceneStencilMS "u_sceneStencilMS" + OpName %u_lightGrid "u_lightGrid" + OpName %u_texture "u_texture" + OpDecorate %PerVertex Block + OpDecorate %_ Location 1 + OpDecorate %a_color Location 2 + OpDecorate %a_texcoord Location 1 + OpDecorate %a_position Location 0 + OpMemberDecorate %u_objToWorlds 0 ColMajor + OpMemberDecorate %u_objToWorlds 0 Offset 0 + OpMemberDecorate %u_objToWorlds 0 MatrixStride 16 + OpDecorate %u_objToWorlds Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %CameraData 0 ColMajor + OpMemberDecorate %CameraData 0 Offset 0 + OpMemberDecorate %CameraData 0 MatrixStride 16 + OpMemberDecorate %CameraData 1 ColMajor + OpMemberDecorate %CameraData 1 Offset 64 + OpMemberDecorate %CameraData 1 MatrixStride 16 + OpMemberDecorate %CameraData 2 ColMajor + OpMemberDecorate %CameraData 2 Offset 128 + OpMemberDecorate %CameraData 2 MatrixStride 16 + OpMemberDecorate %CameraData 3 ColMajor + OpMemberDecorate %CameraData 3 Offset 192 + OpMemberDecorate %CameraData 3 MatrixStride 16 + OpMemberDecorate %CameraData 4 ColMajor + OpMemberDecorate %CameraData 4 Offset 256 + OpMemberDecorate %CameraData 4 MatrixStride 16 + OpMemberDecorate %CameraData 5 ColMajor + OpMemberDecorate %CameraData 5 Offset 320 + OpMemberDecorate %CameraData 5 MatrixStride 16 + OpMemberDecorate %CameraData 6 Offset 384 + OpMemberDecorate %CameraData 7 Offset 396 + OpMemberDecorate %CameraData 8 Offset 400 + OpMemberDecorate %CameraData 9 Offset 412 + OpMemberDecorate %CameraData 10 Offset 416 + OpMemberDecorate %CameraData 11 Offset 428 + OpMemberDecorate %CameraData 12 Offset 432 + OpMemberDecorate %CameraData 13 Offset 444 + OpMemberDecorate %CameraData 14 Offset 448 + OpMemberDecorate %CameraData 15 Offset 456 + OpMemberDecorate %CameraData 16 Offset 464 + OpMemberDecorate %CameraData 17 Offset 472 + OpMemberDecorate %CameraData 18 Offset 480 + OpMemberDecorate %CameraData 19 Offset 488 + OpMemberDecorate %CameraData 20 Offset 496 + OpMemberDecorate %CameraData 21 Offset 504 + OpMemberDecorate %CameraData 22 Offset 512 + OpDecorate %_arr_CameraData_uint_2 ArrayStride 528 + OpMemberDecorate %LightData 0 Offset 0 + OpMemberDecorate %LightData 1 Offset 16 + OpMemberDecorate %LightData 2 Offset 32 + OpMemberDecorate %LightData 3 Offset 48 + OpMemberDecorate %LightData 4 Offset 64 + OpMemberDecorate %LightData 5 Offset 80 + OpMemberDecorate %LightData 6 ColMajor + OpMemberDecorate %LightData 6 Offset 96 + OpMemberDecorate %LightData 6 MatrixStride 16 + OpMemberDecorate %LightData 7 ColMajor + OpMemberDecorate %LightData 7 Offset 160 + OpMemberDecorate %LightData 7 MatrixStride 16 + OpMemberDecorate %LightData 8 Offset 224 + OpMemberDecorate %LightData 9 Offset 228 + OpMemberDecorate %LightData 10 Offset 232 + OpMemberDecorate %LightData 11 Offset 236 + OpDecorate %_arr_LightData_uint_8 ArrayStride 240 + OpMemberDecorate %SceneSettings 0 Offset 0 + OpMemberDecorate %SceneSettings 1 Offset 1056 + OpMemberDecorate %SceneSettings 2 Offset 1072 + OpMemberDecorate %SceneSettings 3 Offset 1088 + OpMemberDecorate %SceneSettings 4 Offset 1104 + OpMemberDecorate %SceneSettings 5 Offset 1120 + OpMemberDecorate %SceneSettings 6 Offset 1128 + OpMemberDecorate %SceneSettings 7 Offset 1136 + OpMemberDecorate %SceneSettings 8 Offset 3056 + OpMemberDecorate %SceneSettings 9 Offset 3072 + OpMemberDecorate %SceneSettings 10 Offset 3088 + OpMemberDecorate %SceneSettings 11 Offset 3104 + OpMemberDecorate %SceneSettings 12 Offset 3112 + OpMemberDecorate %SceneSettings 13 Offset 3120 + OpMemberDecorate %SceneSettings 14 Offset 3136 + OpDecorate %SceneSettings Block + OpDecorate %__2 DescriptorSet 0 + OpDecorate %__2 Binding 0 + OpMemberDecorate %LightContext 0 Offset 0 + OpMemberDecorate %LightContext 1 Offset 16 + OpMemberDecorate %LightContext 2 Offset 32 + OpMemberDecorate %LightContext 3 Offset 48 + OpMemberDecorate %LightContext 4 Offset 64 + OpMemberDecorate %LightContext 5 Offset 76 + OpMemberDecorate %LightContext 6 Offset 80 + OpDecorate %LightContext Block + OpDecorate %__3 DescriptorSet 0 + OpDecorate %__3 Binding 0 + OpDecorate %u_sceneDepthMS DescriptorSet 0 + OpDecorate %u_sceneDepthMS Binding 0 + OpDecorate %u_sceneStencilMS DescriptorSet 0 + OpDecorate %u_sceneStencilMS Binding 0 + OpDecorate %u_lightGrid DescriptorSet 0 + OpDecorate %u_lightGrid Binding 0 + OpDecorate %u_texture DescriptorSet 0 + OpDecorate %u_texture Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %PerVertex = OpTypeStruct %v4float %v2float %v3float +%_ptr_Output_PerVertex = OpTypePointer Output %PerVertex + %_ = OpVariable %_ptr_Output_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %a_color = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %int_1 = OpConstant %int 1 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %a_texcoord = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_v2float = OpTypePointer Output %v2float + %int_2 = OpConstant %int 2 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %a_position = OpVariable %_ptr_Input_v3float Input +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%mat4v4float = OpTypeMatrix %v4float 4 +%u_objToWorlds = OpTypeStruct %mat4v4float +%_ptr_Uniform_u_objToWorlds = OpTypePointer Uniform %u_objToWorlds + %__0 = OpVariable %_ptr_Uniform_u_objToWorlds Uniform +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %__1 = OpVariable %_ptr_Output_gl_PerVertex Output + %CameraData = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v2float %v2float %v2float %v2float %v2float %v2float %v2float %v2float %v4float + %uint_2 = OpConstant %uint 2 +%_arr_CameraData_uint_2 = OpTypeArray %CameraData %uint_2 + %LightData = OpTypeStruct %v4float %v3float %v4float %v3float %v4float %v4float %mat4v4float %mat4v4float %uint %uint %float %float + %uint_8 = OpConstant %uint 8 +%_arr_LightData_uint_8 = OpTypeArray %LightData %uint_8 +%SceneSettings = OpTypeStruct %_arr_CameraData_uint_2 %v3float %v3float %v3float %v3float %v2float %uint %_arr_LightData_uint_8 %v3float %v3float %v3float %v2float %v2float %v4float %uint +%_ptr_Uniform_SceneSettings = OpTypePointer Uniform %SceneSettings + %__2 = OpVariable %_ptr_Uniform_SceneSettings Uniform + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %uint_7 = OpConstant %uint 7 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %uint_12 = OpConstant %uint 12 + %uint_13 = OpConstant %uint 13 + %uint_14 = OpConstant %uint 14 +%LightContext = OpTypeStruct %v3float %v3float %v3float %v3float %v3float %float %float +%_ptr_Uniform_LightContext = OpTypePointer Uniform %LightContext + %__3 = OpVariable %_ptr_Uniform_LightContext Uniform + %86 = OpTypeImage %float 2D 0 0 1 1 Unknown + %87 = OpTypeSampledImage %86 +%_ptr_UniformConstant_87 = OpTypePointer UniformConstant %87 +%u_sceneDepthMS = OpVariable %_ptr_UniformConstant_87 UniformConstant + %90 = OpTypeImage %uint 2D 0 0 1 1 Unknown + %91 = OpTypeSampledImage %90 +%_ptr_UniformConstant_91 = OpTypePointer UniformConstant %91 +%u_sceneStencilMS = OpVariable %_ptr_UniformConstant_91 UniformConstant + %94 = OpTypeImage %uint 3D 0 0 0 1 Unknown + %95 = OpTypeSampledImage %94 +%_ptr_UniformConstant_95 = OpTypePointer UniformConstant %95 +%u_lightGrid = OpVariable %_ptr_UniformConstant_95 UniformConstant + %98 = OpTypeImage %float 2D 0 1 0 1 Unknown + %99 = OpTypeSampledImage %98 +%_ptr_UniformConstant_99 = OpTypePointer UniformConstant %99 + %u_texture = OpVariable %_ptr_UniformConstant_99 UniformConstant + %main = OpFunction %void None %3 + %5 = OpLabel + %70 = OpFunctionCall %void %DrawWorldVS_ + OpReturn + OpFunctionEnd +%DrawWorldVS_ = OpFunction %void None %3 + %7 = OpLabel +%worldSpacePosition = OpVariable %_ptr_Function_v4float Function + %19 = OpLoad %v4float %a_color + %21 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %21 %19 + %25 = OpLoad %v2float %a_texcoord + %27 = OpAccessChain %_ptr_Output_v2float %_ %int_1 + OpStore %27 %25 + %31 = OpLoad %v3float %a_position + %33 = OpAccessChain %_ptr_Output_v3float %_ %int_2 + OpStore %33 %31 + %41 = OpAccessChain %_ptr_Uniform_mat4v4float %__0 %int_0 + %42 = OpLoad %mat4v4float %41 + %43 = OpLoad %v3float %a_position + %45 = OpCompositeExtract %float %43 0 + %46 = OpCompositeExtract %float %43 1 + %47 = OpCompositeExtract %float %43 2 + %48 = OpCompositeConstruct %v4float %45 %46 %47 %float_1 + %49 = OpMatrixTimesVector %v4float %42 %48 + OpStore %worldSpacePosition %49 + %65 = OpAccessChain %_ptr_Uniform_mat4v4float %__2 %int_0 %int_0 %int_1 + %66 = OpLoad %mat4v4float %65 + %67 = OpLoad %v4float %worldSpacePosition + %68 = OpMatrixTimesVector %v4float %66 %67 + %69 = OpAccessChain %_ptr_Output_v4float %__1 %int_0 + OpStore %69 %68 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..6ae3b67e59 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 13 +; Schema: 0 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %_ %foo %gl_Position +OpSource GLSL 450 +OpName %main "main" +OpName %Vert "Vert" +OpMemberName %Vert 0 "a" +OpMemberName %Vert 1 "b" +OpName %_ "" +OpName %Foo "Foo" +OpMemberName %Foo 0 "c" +OpMemberName %Foo 1 "d" +OpName %foo "foo" +OpDecorate %Vert Block +OpDecorate %_ Location 0 +OpDecorate %foo Location 2 +OpDecorate %gl_Position BuiltIn Position +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%Vert = OpTypeStruct %float %float +%vec4 = OpTypeVector %float 4 +%ptr_Output_vec4 = OpTypePointer Output %vec4 +%_ptr_Output_Vert = OpTypePointer Output %Vert +%zero_vert = OpConstantNull %Vert +%_ = OpVariable %_ptr_Output_Vert Output %zero_vert +%gl_Position = OpVariable %ptr_Output_vec4 Output +%Foo = OpTypeStruct %float %float +%_ptr_Output_Foo = OpTypePointer Output %Foo +%zero_foo = OpConstantNull %Foo +%blank = OpConstantNull %vec4 +%foo = OpVariable %_ptr_Output_Foo Output %zero_foo +%main = OpFunction %void None %3 +%5 = OpLabel +OpStore %gl_Position %blank +OpReturn +OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..a00d4b71bb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,39 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %zero = OpConstantNull %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output %zero + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert new file mode 100644 index 0000000000..d44e325b1c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/composite-extract-physical-type-id.asm.vert @@ -0,0 +1,63 @@ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %VSMain "main" %gl_VertexIndex %gl_Position + OpSource HLSL 600 + OpName %type_Float2Array "type.Float2Array" + OpMemberName %type_Float2Array 0 "arr" + OpName %Float2Array "Float2Array" + OpName %VSMain "VSMain" + OpName %param_var_i "param.var.i" + OpName %src_VSMain "src.VSMain" + OpName %i "i" + OpName %bb_entry "bb.entry" + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %gl_Position BuiltIn Position + OpDecorate %Float2Array DescriptorSet 0 + OpDecorate %Float2Array Binding 0 + OpDecorate %_arr_v2float_uint_3 ArrayStride 16 + OpMemberDecorate %type_Float2Array 0 Offset 0 + OpDecorate %type_Float2Array Block + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %v2float = OpTypeVector %float 2 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%type_Float2Array = OpTypeStruct %_arr_v2float_uint_3 +%_ptr_Uniform_type_Float2Array = OpTypePointer Uniform %type_Float2Array +%_ptr_Input_uint = OpTypePointer Input %uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %20 = OpTypeFunction %void +%_ptr_Function_uint = OpTypePointer Function %uint + %27 = OpTypeFunction %v4float %_ptr_Function_uint +%_ptr_Uniform__arr_v2float_uint_3 = OpTypePointer Uniform %_arr_v2float_uint_3 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%Float2Array = OpVariable %_ptr_Uniform_type_Float2Array Uniform +%gl_VertexIndex = OpVariable %_ptr_Input_uint Input +%gl_Position = OpVariable %_ptr_Output_v4float Output + %VSMain = OpFunction %void None %20 + %21 = OpLabel +%param_var_i = OpVariable %_ptr_Function_uint Function + %24 = OpLoad %uint %gl_VertexIndex + OpStore %param_var_i %24 + %25 = OpFunctionCall %v4float %src_VSMain %param_var_i + OpStore %gl_Position %25 + OpReturn + OpFunctionEnd + %src_VSMain = OpFunction %v4float None %27 + %i = OpFunctionParameter %_ptr_Function_uint + %bb_entry = OpLabel + %30 = OpLoad %uint %i + %32 = OpAccessChain %_ptr_Uniform__arr_v2float_uint_3 %Float2Array %int_0 + %34 = OpAccessChain %_ptr_Uniform_v2float %32 %30 + %35 = OpLoad %v2float %34 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %float %35 1 + %38 = OpCompositeConstruct %v4float %36 %37 %float_0 %float_1 + OpReturnValue %38 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert new file mode 100644 index 0000000000..992b1fc21b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/constant-composite-block-no-array-stride.asm.vert @@ -0,0 +1,157 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 121 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" %2 %3 %4 %5 %gl_VertexIndex %gl_InstanceIndex + OpMemberDecorate %_struct_8 0 BuiltIn Position + OpMemberDecorate %_struct_8 1 BuiltIn PointSize + OpMemberDecorate %_struct_8 2 BuiltIn ClipDistance + OpMemberDecorate %_struct_8 3 BuiltIn CullDistance + OpDecorate %_struct_8 Block + OpDecorate %3 Location 0 + OpDecorate %4 Location 1 + OpDecorate %5 Location 1 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex + OpDecorate %9 ArrayStride 4 + OpDecorate %10 Offset 0 + %9 = OpDecorationGroup + %10 = OpDecorationGroup + OpDecorate %11 RelaxedPrecision + OpDecorate %12 RelaxedPrecision + OpDecorate %12 Flat + OpDecorate %12 Restrict + %13 = OpDecorationGroup + %11 = OpDecorationGroup + %12 = OpDecorationGroup + OpGroupMemberDecorate %10 %_struct_14 0 %_struct_15 0 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2int = OpTypeVector %int 2 + %v2uint = OpTypeVector %uint 2 + %v2float = OpTypeVector %float 2 + %v3int = OpTypeVector %int 3 + %v3uint = OpTypeVector %uint 3 + %v3float = OpTypeVector %float 3 + %v4int = OpTypeVector %int 4 + %v4uint = OpTypeVector %uint 4 + %v4float = OpTypeVector %float 4 + %v4bool = OpTypeVector %bool 4 + %31 = OpTypeFunction %v4float %v4float + %32 = OpTypeFunction %bool + %33 = OpTypeFunction %void +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Input_v2int = OpTypePointer Input %v2int +%_ptr_Input_v2uint = OpTypePointer Input %v2uint +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_v4int = OpTypePointer Input %v4int +%_ptr_Input_v4uint = OpTypePointer Input %v4uint +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_ptr_Output_v2int = OpTypePointer Output %v2int +%_ptr_Output_v2uint = OpTypePointer Output %v2uint +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_v4int = OpTypePointer Output %v4int +%_ptr_Output_v4uint = OpTypePointer Output %v4uint +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %float_0_5 = OpConstant %float 0.5 + %float_n1 = OpConstant %float -1 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %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 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_32 = OpConstant %uint 32 + %uint_4 = OpConstant %uint 4 +%uint_2147483647 = OpConstant %uint 2147483647 + %74 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %75 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %76 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %_struct_8 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output__struct_8 = OpTypePointer Output %_struct_8 + %2 = OpVariable %_ptr_Output__struct_8 Output + %3 = OpVariable %_ptr_Input_v4float Input + %4 = OpVariable %_ptr_Output_v4float Output + %5 = OpVariable %_ptr_Input_v4float Input +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%gl_InstanceIndex = OpVariable %_ptr_Input_int Input +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %_struct_14 = OpTypeStruct %_arr_float_uint_3 + %_struct_15 = OpTypeStruct %_arr_float_uint_3 +%_ptr_Function__struct_14 = OpTypePointer Function %_struct_14 +%_ptr_Function__struct_15 = OpTypePointer Function %_struct_15 + %float_2 = OpConstant %float 2 + %float_n2 = OpConstant %float -2 + %93 = OpConstantComposite %_arr_float_uint_3 %float_1 %float_2 %float_1 + %94 = OpConstantComposite %_arr_float_uint_3 %float_n1 %float_n2 %float_n1 + %95 = OpConstantComposite %_struct_14 %93 + %96 = OpConstantComposite %_struct_15 %94 + %1 = OpFunction %void None %33 + %97 = OpLabel + %98 = OpLoad %v4float %3 + %99 = OpAccessChain %_ptr_Output_v4float %2 %int_0 + OpStore %99 %98 + %100 = OpLoad %v4float %5 + %101 = OpFunctionCall %v4float %102 %100 + OpStore %4 %101 + OpReturn + OpFunctionEnd + %103 = OpFunction %bool None %32 + %104 = OpLabel + %105 = OpLoad %int %gl_VertexIndex + %106 = OpIEqual %bool %105 %int_0 + OpReturnValue %106 + OpFunctionEnd + %102 = OpFunction %v4float None %31 + %107 = OpFunctionParameter %v4float + %108 = OpLabel + %109 = OpVariable %_ptr_Function_v4float Function + %110 = OpVariable %_ptr_Function__struct_14 Function + %111 = OpVariable %_ptr_Function__struct_15 Function + OpStore %109 %107 + OpStore %110 %95 + OpStore %111 %96 + %112 = OpAccessChain %_ptr_Function_float %110 %int_0 %int_2 + %113 = OpLoad %float %112 + %114 = OpAccessChain %_ptr_Function_float %111 %int_0 %int_2 + %115 = OpLoad %float %114 + %116 = OpFAdd %float %113 %115 + %117 = OpAccessChain %_ptr_Function_float %109 %int_1 + %118 = OpLoad %float %117 + %119 = OpFAdd %float %116 %118 + OpStore %117 %119 + %120 = OpLoad %v4float %109 + OpReturnValue %120 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert new file mode 100644 index 0000000000..00ad1ee9cb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/duplicate-view-index.asm.vert @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 23 +; Schema: 0 + OpCapability Shader + OpCapability MultiView + OpExtension "SPV_KHR_multiview" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %gl_ViewIndex + OpEntryPoint Vertex %main2 "main2" %_ %gl_ViewIndex2 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_multiview" + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %gl_ViewIndex "gl_ViewIndex" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_ViewIndex BuiltIn ViewIndex + OpDecorate %gl_ViewIndex2 BuiltIn ViewIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int +%gl_ViewIndex = OpVariable %_ptr_Input_int Input +%gl_ViewIndex2 = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %int %gl_ViewIndex + %19 = OpConvertSToF %float %18 + %20 = OpCompositeConstruct %v4float %19 %19 %19 %19 + %22 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %22 %20 + OpReturn + OpFunctionEnd + + %main2 = OpFunction %void None %3 + %100 = OpLabel + %101 = OpLoad %int %gl_ViewIndex2 + %102 = OpConvertSToF %float %101 + %103 = OpCompositeConstruct %v4float %102 %102 %102 %102 + %104 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %104 %103 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..038ecaa6e3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.1 +; Generator: Google rspirv; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" + OpName %Test "Test" + OpName %t "t" + OpName %retvar "retvar" + OpName %main "main" + OpName %retvar_0 "retvar" + %void = OpTypeVoid + %6 = OpTypeFunction %void + %Test = OpTypeStruct +%_ptr_Function_Test = OpTypePointer Function %Test +%_ptr_Function_void = OpTypePointer Function %void + %2 = OpFunction %void None %6 + %7 = OpLabel + %t = OpVariable %_ptr_Function_Test Function + %retvar = OpVariable %_ptr_Function_void Function + OpBranch %4 + %4 = OpLabel + %13 = OpCompositeConstruct %Test + OpStore %t %13 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %6 + %15 = OpLabel + %retvar_0 = OpVariable %_ptr_Function_void Function + OpBranch %14 + %14 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag new file mode 100644 index 0000000000..fecc83a95d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vs_main "main" %gl_Position + OpSource HLSL 600 + OpName %vs_main "vs_main" + OpDecorate %gl_Position BuiltIn Position + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int_1 = OpConstant %int 1 + %float_3 = OpConstant %float 3 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Function__arr_float_uint_2 = OpTypePointer Function %_arr_float_uint_2 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%gl_Position = OpVariable %_ptr_Output_v4float Output + %21 = OpUndef %float + %vs_main = OpFunction %void None %15 + %22 = OpLabel + %23 = OpVariable %_ptr_Function__arr_float_uint_2 Function + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %int %int_0 %22 %26 %27 + %28 = OpSLessThan %bool %25 %int_2 + OpLoopMerge %29 %27 None + OpBranchConditional %28 %27 %29 + %27 = OpLabel + %30 = OpAccessChain %_ptr_Function_float %23 %25 + OpStore %30 %float_0 + %26 = OpIAdd %int %25 %int_1 + OpBranch %24 + %29 = OpLabel + %31 = OpLoad %_arr_float_uint_2 %23 + %32 = OpBitcast %uint %float_3 + %33 = OpINotEqual %bool %32 %uint_0 + OpSelectionMerge %34 None + OpBranchConditional %33 %35 %34 + %35 = OpLabel + %36 = OpCompositeExtract %float %31 0 + OpBranch %34 + %34 = OpLabel + %37 = OpPhi %float %21 %29 %36 %35 + %38 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %37 + OpStore %gl_Position %38 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert new file mode 100644 index 0000000000..22058d2c8c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/asm/vert/pointer-to-pointer.asm.vert @@ -0,0 +1,34 @@ +OpCapability Shader +OpCapability VariablePointers +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 + +OpEntryPoint Vertex %fn_vert "main" + +%F = OpTypeFloat 32 +%PF = OpTypePointer StorageBuffer %F +%PPF = OpTypePointer Private %PF +%PPPF = OpTypePointer Function %PPF + +%V = OpTypeVoid +%Fn0V = OpTypeFunction %V + +%FnArg = OpTypeFunction %V %PPPF + +%uPPF = OpUndef %PPF + +%fn_ptr = OpFunction %V None %FnArg + %arg = OpFunctionParameter %PPPF + %fn_ptr_bb0 = OpLabel + OpReturn +OpFunctionEnd + +%fn_vert = OpFunction %V None %Fn0V + %fn_vert_bb0 = OpLabel + %VPPPF = OpVariable %PPPF Function + OpStore %VPPPF %uPPF + %VV = OpFunctionCall %V %fn_ptr %VPPPF + OpReturn +OpFunctionEnd + + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp new file mode 100644 index 0000000000..081c39626d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 8) in; + +shared float shared_group[8][8]; +shared float shared_group_alt[8][8]; + +void main() +{ + float blob[8]; + for (int i = 0; i < 8; i++) + blob[i] = float(i); + shared_group[gl_LocalInvocationIndex] = blob; + + barrier(); + + float copied_blob[8] = shared_group[gl_LocalInvocationIndex ^ 1u]; + shared_group_alt[gl_LocalInvocationIndex] = shared_group[gl_LocalInvocationIndex]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp new file mode 100644 index 0000000000..c2965731e9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/basic.dynamic-buffer.msl2.invalid.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 3, local_size_y = 3, local_size_z = 2) in; + +layout(set = 0, binding = 0) uniform Foo +{ + int a; + int b; +}; + +layout(set = 0, binding = 1) uniform Bar +{ + int c; + int d; +}; + +layout(set = 1, binding = 2) buffer Baz +{ + int e; + int f; +} baz[3][3][2]; + +void main() +{ + uvec3 coords = gl_GlobalInvocationID; + baz[coords.x][coords.y][coords.z].e = a + c; + baz[coords.x][coords.y][coords.z].f = b * d; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp new file mode 100644 index 0000000000..8f1d97861c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/bda-restrict-pointer-variable.msl2.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_EXT_buffer_reference : require + +layout(buffer_reference) buffer Ref +{ + vec4 v; +}; + +layout(push_constant) uniform Registers +{ + Ref foo; +}; + +void main() +{ + restrict Ref ref = foo; + ref.v = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp new file mode 100644 index 0000000000..0c21cda306 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-1.invalid.comp @@ -0,0 +1,23 @@ +#version 450 core +#extension GL_AMD_gpu_shader_half_float : require +#extension GL_AMD_gpu_shader_int16 : require +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + i16vec4 inputs[]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + f16vec2 a = int16BitsToFloat16(inputs[ident].xy); + outputs[ident].x = int(packFloat2x16(a + f16vec2(1, 1))); + outputs[ident].y = packInt2x16(inputs[ident].zw); + outputs[ident].z = int(packUint2x16(u16vec2(inputs[ident].xy))); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp new file mode 100644 index 0000000000..6bb662412c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitcast-16bit-2.invalid.comp @@ -0,0 +1,26 @@ +#version 450 core +#extension GL_AMD_gpu_shader_half_float : require +#extension GL_AMD_gpu_shader_int16 : require +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + i16vec4 outputs[]; +}; + +layout(binding = 2) uniform UBO +{ + f16vec4 const0; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + outputs[ident].xy = unpackInt2x16(inputs[ident].x) + float16BitsToInt16(const0.xy); + outputs[ident].zw = i16vec2(unpackUint2x16(uint(inputs[ident].y)) - float16BitsToUint16(const0.zw)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/bitfield.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..0cac0b257c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/bitfield.comp @@ -0,0 +1,23 @@ +#version 310 es + +void main() +{ + int signed_value = 0; + uint unsigned_value = 0u; + + int s = bitfieldExtract(signed_value, 5, 20); + uint u = bitfieldExtract(unsigned_value, 6, 21); + s = bitfieldInsert(s, 40, 5, 4); + u = bitfieldInsert(u, 60u, 5, 4); + + u = bitfieldReverse(u); + s = bitfieldReverse(s); + + int v0 = bitCount(u); + int v1 = bitCount(s); + + int v2 = findMSB(u); + int v3 = findMSB(s); + int v4 = findLSB(u); + int v5 = findLSB(s); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp new file mode 100644 index 0000000000..56c11bbb75 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/buffer-device-address-from-pointer-complex-chain.msl23.comp @@ -0,0 +1,21 @@ +#version 460 + +#extension GL_EXT_buffer_reference: enable +#extension GL_EXT_buffer_reference_uvec2: enable + +struct S { + vec3 v; +}; + +layout(buffer_reference) buffer SSBO{ + S s[]; +}; + +layout(push_constant) uniform PC { + uvec2 ptr; +} pc; + +void main(){ + SSBO ssbo = SSBO(pc.ptr); + ssbo.s[0].v = vec3(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/glsl.std450.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/glsl.std450.comp new file mode 100644 index 0000000000..a17a82b82a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/glsl.std450.comp @@ -0,0 +1,129 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float res; + int ires; + uint ures; + + vec4 f32; + ivec4 s32; + uvec4 u32; + + mat2 m2; + mat3 m3; + mat4 m4; +}; + +void main() +{ + float tmp; + vec2 v2; + vec3 v3; + vec4 v4; + int itmp; + + res = round(f32.x); + res = roundEven(f32.x); + res = trunc(f32.x); + res = abs(f32.x); + ires = abs(s32.x); + res = sign(f32.x); + ires = sign(s32.x); + res = floor(f32.x); + res = ceil(f32.x); + res = fract(f32.x); + res = radians(f32.x); + res = degrees(f32.x); + res = sin(f32.x); + res = cos(f32.x); + res = tan(f32.x); + res = asin(f32.x); + res = acos(f32.x); + res = atan(f32.x); + res = sinh(f32.x); + res = cosh(f32.x); + res = tanh(f32.x); + res = asinh(f32.x); + res = acosh(f32.x); + res = atanh(f32.x); + res = atan(f32.x, f32.y); + res = pow(f32.x, f32.y); + res = exp(f32.x); + res = log(f32.x); + res = exp2(f32.x); + res = log2(f32.x); + res = sqrt(f32.x); + res = inversesqrt(f32.x); + + res = length(f32.x); + res = distance(f32.x, f32.y); + res = normalize(f32.x); + res = faceforward(f32.x, f32.y, f32.z); + res = reflect(f32.x, f32.y); + res = refract(f32.x, f32.y, f32.z); + + res = length(f32.xy); + res = distance(f32.xy, f32.zw); + v2 = normalize(f32.xy); + v2 = faceforward(f32.xy, f32.yz, f32.zw); + v2 = reflect(f32.xy, f32.zw); + v2 = refract(f32.xy, f32.yz, f32.w); + + v3 = cross(f32.xyz, f32.yzw); + + res = determinant(m2); + res = determinant(m3); + res = determinant(m4); + m2 = inverse(m2); + m3 = inverse(m3); + m4 = inverse(m4); + + res = modf(f32.x, tmp); + // ModfStruct + + res = min(f32.x, f32.y); + ures = min(u32.x, u32.y); + ires = min(s32.x, s32.y); + res = max(f32.x, f32.y); + ures = max(u32.x, u32.y); + ires = max(s32.x, s32.y); + + res = clamp(f32.x, f32.y, f32.z); + ures = clamp(u32.x, u32.y, u32.z); + ires = clamp(s32.x, s32.y, s32.z); + + res = mix(f32.x, f32.y, f32.z); + res = step(f32.x, f32.y); + res = smoothstep(f32.x, f32.y, f32.z); + res = fma(f32.x, f32.y, f32.z); + + res = frexp(f32.x, itmp); + // FrexpStruct + res = ldexp(f32.x, itmp); + + ures = packSnorm4x8(f32); + ures = packUnorm4x8(f32); + ures = packSnorm2x16(f32.xy); + ures = packUnorm2x16(f32.xy); + ures = packHalf2x16(f32.xy); + // packDouble2x32 + + v2 = unpackSnorm2x16(u32.x); + v2 = unpackUnorm2x16(u32.x); + v2 = unpackHalf2x16(u32.x); + v4 = unpackSnorm4x8(u32.x); + v4 = unpackUnorm4x8(u32.x); + // unpackDouble2x32 + + s32 = findLSB(s32); + s32 = findLSB(u32); + s32 = findMSB(s32); + s32 = findMSB(u32); + + // interpolateAtSample + // interpolateAtOffset + + // NMin, NMax, NClamp +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..f7a8787d3d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Foo" + OpMemberName %Foo 0 "abs" + OpName %f "f" + OpName %Foo_0 "Foo" + OpMemberName %Foo_0 0 "abs" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "foo" + OpMemberName %SSBO 1 "foo2" + OpName %_ "" + OpName %linear "abs" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Foo = OpTypeStruct %float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %float + %SSBO = OpTypeStruct %Foo_0 %Foo_0 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_Foo Function + %linear = OpVariable %_ptr_Function_int Function + %17 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_0 + %18 = OpLoad %Foo_0 %17 + %19 = OpCompositeExtract %float %18 0 + %21 = OpAccessChain %_ptr_Function_float %f %int_0 + OpStore %21 %19 + OpStore %linear %int_10 + %26 = OpLoad %Foo %f + %27 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_1 + %28 = OpCompositeExtract %float %26 0 + %30 = OpAccessChain %_ptr_Uniform_float %27 %int_0 + OpStore %30 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/implicit-integer-promotion.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/implicit-integer-promotion.comp new file mode 100644 index 0000000000..a0ee95b3a1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/implicit-integer-promotion.comp @@ -0,0 +1,85 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require + +layout(set = 0, binding = 0) buffer BUF0 +{ + f16vec2 f16s; + u16vec2 u16; + i16vec2 i16; + u16vec4 u16s; + i16vec4 i16s; + float16_t f16; +}; + +void test_i16() +{ + f16 += int16BitsToFloat16(i16.x + i16.y); + f16 += int16BitsToFloat16(i16.x - i16.y); + f16 += int16BitsToFloat16(i16.x * i16.y); + f16 += int16BitsToFloat16(i16.x / i16.y); + f16 += int16BitsToFloat16(i16.x % i16.y); + f16 += int16BitsToFloat16(i16.x << i16.y); + f16 += int16BitsToFloat16(i16.x >> i16.y); + f16 += int16BitsToFloat16(~i16.x); + f16 += int16BitsToFloat16(-i16.x); + f16 += int16BitsToFloat16(i16.x ^ i16.y); + f16 += int16BitsToFloat16(i16.x & i16.y); + f16 += int16BitsToFloat16(i16.x | i16.y); +} + +void test_u16() +{ + f16 += uint16BitsToFloat16(u16.x + u16.y); + f16 += uint16BitsToFloat16(u16.x - u16.y); + f16 += uint16BitsToFloat16(u16.x * u16.y); + f16 += uint16BitsToFloat16(u16.x / u16.y); + f16 += uint16BitsToFloat16(u16.x % u16.y); + f16 += uint16BitsToFloat16(u16.x << u16.y); + f16 += uint16BitsToFloat16(u16.x >> u16.y); + f16 += uint16BitsToFloat16(~u16.x); + f16 += uint16BitsToFloat16(-u16.x); + f16 += uint16BitsToFloat16(u16.x ^ u16.y); + f16 += uint16BitsToFloat16(u16.x & u16.y); + f16 += uint16BitsToFloat16(u16.x | u16.y); +} + +void test_u16s() +{ + f16s += uint16BitsToFloat16(u16s.xy + u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy - u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy * u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy / u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy % u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy << u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy >> u16s.zw); + f16s += uint16BitsToFloat16(~u16s.xy); + f16s += uint16BitsToFloat16(-u16s.xy); + f16s += uint16BitsToFloat16(u16s.xy ^ u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy & u16s.zw); + f16s += uint16BitsToFloat16(u16s.xy | u16s.zw); +} + +void test_i16s() +{ + f16s += int16BitsToFloat16(i16s.xy + i16s.zw); + f16s += int16BitsToFloat16(i16s.xy - i16s.zw); + f16s += int16BitsToFloat16(i16s.xy * i16s.zw); + f16s += int16BitsToFloat16(i16s.xy / i16s.zw); + f16s += int16BitsToFloat16(i16s.xy % i16s.zw); + f16s += int16BitsToFloat16(i16s.xy << i16s.zw); + f16s += int16BitsToFloat16(i16s.xy >> i16s.zw); + f16s += int16BitsToFloat16(~i16s.xy); + f16s += int16BitsToFloat16(-i16s.xy); + f16s += int16BitsToFloat16(i16s.xy ^ i16s.zw); + f16s += int16BitsToFloat16(i16s.xy & i16s.zw); + f16s += int16BitsToFloat16(i16s.xy | i16s.zw); +} + +void main() +{ + test_u16(); + test_i16(); + test_u16s(); + test_i16s(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/int16min-literal.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/int16min-literal.comp new file mode 100644 index 0000000000..c1b345266d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/int16min-literal.comp @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float16_t a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float16_t b; +}; + +void main() +{ + int16_t v = float16BitsToInt16(b); + v ^= 0x8000s; + a = int16BitsToFloat16(v); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/int64.invalid.msl22.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/int64.invalid.msl22.comp new file mode 100644 index 0000000000..965bed4ae4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/int64.invalid.msl22.comp @@ -0,0 +1,65 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require +layout(local_size_x = 1) in; + +struct M0 +{ + int64_t v; + i64vec2 b[2]; + uint64_t c; + uint64_t d[5]; +}; + +struct SSBO0_Type +{ + i64vec4 a; + M0 m0; +}; + +struct SSBO1_Type +{ + u64vec4 b; + M0 m0; +}; + +struct SSBO2_Type +{ + int64_t a[4]; + i64vec2 b[4]; +}; + +struct SSBO3_Type +{ + int64_t a[4]; + i64vec2 b[4]; +}; + +layout(set = 0, binding = 0, std430) buffer SSBO +{ + int s32; + uint u32; +}; + +void main() +{ + SSBO0_Type ssbo_0; + SSBO1_Type ssbo_1; + SSBO2_Type ssbo_2; + SSBO3_Type ssbo_3; + + ssbo_0.a += i64vec4(10, 20, 30, 40); + ssbo_1.b += u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul); + ssbo_0.a += 20; + ssbo_0.a = abs(ssbo_0.a + i64vec4(ssbo_1.b)); + + ssbo_0.a++; + ssbo_1.b++; + ssbo_0.a--; + ssbo_1.b--; + + ssbo_2.a[0] += 1l; + ssbo_3.a[0] += 2l; + + s32 = int(ssbo_0.a.x + ssbo_1.b.y + ssbo_2.a[1] + ssbo_3.a[2]); + u32 = uint(ssbo_0.a.y + ssbo_1.b.z + ssbo_2.a[0] + ssbo_3.a[1]); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/int64min-literal.msl22.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/int64min-literal.msl22.comp new file mode 100644 index 0000000000..7929605446 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/int64min-literal.msl22.comp @@ -0,0 +1,21 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float b; +}; + +void main() +{ + int64_t v = int64_t(floatBitsToInt(b)); + v ^= 0x8000000000000000L; + a = intBitsToFloat(int(v)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..ee35cedabb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/intmin-literal.comp @@ -0,0 +1,18 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float b; +}; + +void main() +{ + a = intBitsToFloat(floatBitsToInt(b) ^ 0x80000000); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/loop.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/loop.comp new file mode 100644 index 0000000000..6d6c324243 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/loop.comp @@ -0,0 +1,98 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = in_data[ident]; + + int k = 0; + uint i = 0u; + + if (idat.y == 20.0) + { + do + { + k = k * 2; + i++; + } while (i < ident); + } + + switch (k) + { + case 10: + for (;;) + { + i++; + if (i > 10u) + break; + } + break; + + default: + for (;;) + { + i += 2u; + if (i > 20u) + break; + } + break; + } + + while (k < 10) + { + idat *= 2.0; + k++; + } + + for (uint i = 0u; i < 16u; i++, k++) + for (uint j = 0u; j < 30u; j++) + idat = mvp * idat; + + k = 0; + for (;;) + { + k++; + if (k > 10) + { + k += 2; + } + else + { + k += 3; + continue; + } + + k += 10; + } + + k = 0; + do + { + k++; + } while (k > 10); + + int l = 0; + for (;; l++) + { + if (l == 5) + { + continue; + } + + idat += 1.0; + } + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/return.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/return.comp new file mode 100644 index 0000000000..617f437182 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/return.comp @@ -0,0 +1,33 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + + if (ident == 2u) + { + out_data[ident] = vec4(20.0); + } + else if (ident == 4u) + { + out_data[ident] = vec4(10.0); + return; + } + + for (int i = 0; i < 20; i++) + { + if (i == 10) + break; + + return; + } + + out_data[ident] = vec4(10.0); +} + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp new file mode 100644 index 0000000000..af1c47b32c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/std140-array-load-composite-construct.comp @@ -0,0 +1,13 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer SSBO +{ + float a[16]; + vec4 b[16]; +}; + +void main() +{ + b[gl_GlobalInvocationID.x] = vec4(a[gl_GlobalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp new file mode 100644 index 0000000000..47d88912f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp @@ -0,0 +1,100 @@ +#version 310 es +#extension GL_EXT_scalar_block_layout : require + +layout(local_size_x = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + + // glslang seems to miscompile this atm into ArrayStride of 16 even in scalar layout. + //S4 m3s[8]; +}; + +layout(binding = 2, scalar) restrict buffer SSBO2 +{ + float m0; + mat2 m1; + layout(row_major) mat3x2 m2; +} ssbo_scalar2; + +layout(binding = 1, scalar) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_scalar; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + + float array[]; +} ssbo_140; + +void main() +{ + ssbo_scalar.content = ssbo_140.content; + ssbo_scalar.content.m1.a = ssbo_scalar.m2[1] * ssbo_scalar.content.m0.a[0]; // test packed matrix access + ssbo_scalar.m0 = ssbo_scalar2.m1; + ssbo_scalar2.m1 = ssbo_scalar.m4; + ssbo_scalar2.m2 = ssbo_scalar.m3; +} + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp new file mode 100644 index 0000000000..8a0be2269e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl12.emulate-subgroup.comp @@ -0,0 +1,25 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +// Reduced test for emulated functionality. + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp new file mode 100644 index 0000000000..f840d2aee8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.comp @@ -0,0 +1,145 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + bvec4 anded_b = subgroupAnd(equal(ballot_value, uvec4(42))); + bvec4 ored_b = subgroupOr(equal(ballot_value, uvec4(42))); + bvec4 xored_b = subgroupXor(equal(ballot_value, uvec4(42))); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + //lo = subgroupInclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupInclusiveMax(hi); + //slo = subgroupInclusiveMin(slo); + //shi = subgroupInclusiveMax(shi); + //ulo = subgroupInclusiveMin(ulo); + //uhi = subgroupInclusiveMax(uhi); + //anded = subgroupInclusiveAnd(anded); + //ored = subgroupInclusiveOr(ored); + //xored = subgroupInclusiveXor(ored); + //added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + //lo = subgroupExclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupExclusiveMax(hi); + //ulo = subgroupExclusiveMin(ulo); + //uhi = subgroupExclusiveMax(uhi); + //slo = subgroupExclusiveMin(slo); + //shi = subgroupExclusiveMax(shi); + //anded = subgroupExclusiveAnd(anded); + //ored = subgroupExclusiveOr(ored); + //xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 4u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 4u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp new file mode 100644 index 0000000000..28c5d6b34d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.fixed-subgroup.comp @@ -0,0 +1,138 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + //lo = subgroupInclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupInclusiveMax(hi); + //slo = subgroupInclusiveMin(slo); + //shi = subgroupInclusiveMax(shi); + //ulo = subgroupInclusiveMin(ulo); + //uhi = subgroupInclusiveMax(uhi); + //anded = subgroupInclusiveAnd(anded); + //ored = subgroupInclusiveOr(ored); + //xored = subgroupInclusiveXor(ored); + //added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + //lo = subgroupExclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupExclusiveMax(hi); + //ulo = subgroupExclusiveMin(ulo); + //uhi = subgroupExclusiveMax(uhi); + //slo = subgroupExclusiveMin(slo); + //shi = subgroupExclusiveMax(shi); + //anded = subgroupExclusiveAnd(anded); + //ored = subgroupExclusiveOr(ored); + //xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp new file mode 100644 index 0000000000..a78527f542 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl21.ios.comp @@ -0,0 +1,49 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +// Reduced test for functionality exposed on iOS. + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp new file mode 100644 index 0000000000..bc904a4f75 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl22.ios.comp @@ -0,0 +1,79 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +// Reduced test for functionality exposed on iOS. + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp new file mode 100644 index 0000000000..28c5d6b34d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/subgroups.nocompat.invalid.vk.msl23.ios.simd.comp @@ -0,0 +1,138 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + //lo = subgroupInclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupInclusiveMax(hi); + //slo = subgroupInclusiveMin(slo); + //shi = subgroupInclusiveMax(shi); + //ulo = subgroupInclusiveMin(ulo); + //uhi = subgroupInclusiveMax(uhi); + //anded = subgroupInclusiveAnd(anded); + //ored = subgroupInclusiveOr(ored); + //xored = subgroupInclusiveXor(ored); + //added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + //lo = subgroupExclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupExclusiveMax(hi); + //ulo = subgroupExclusiveMin(ulo); + //uhi = subgroupExclusiveMax(uhi); + //slo = subgroupExclusiveMin(slo); + //shi = subgroupExclusiveMax(shi); + //anded = subgroupExclusiveAnd(anded); + //ored = subgroupExclusiveOr(ored); + //xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..c3e0922a16 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + vec3 a; + vec3 b; +}; + +void main() +{ + bvec3 c = lessThan(b, vec3(1.0)); + a = mix(vec3(1, 0, 0), vec3(0, 0, 1), c); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..5ffcc3f3a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + mat3 a; + float b; +}; + +void main() +{ + // Scalar to Matrix + bool c = b < 1.0; + a = c ? mat3(vec3(1), vec3(1), vec3(1)) : mat3(vec3(0), vec3(0), vec3(0)); + a = c ? mat3(1) : mat3(0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-input-component.frag b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-input-component.frag new file mode 100644 index 0000000000..60d48bef7e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-input-component.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0, component = 3) in float Foo1; +layout(location = 0, component = 0) in vec3 Foo3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(Foo3, Foo1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.frag b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.frag new file mode 100644 index 0000000000..29a57dfa1f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0, component = 0) out float FragColor0; +layout(location = 0, component = 1) out vec2 FragColor1; +layout(location = 0, component = 3) out float FragColor3; + +void main() +{ + FragColor0 = 1.0; + FragColor1 = vec2(2.0, 3.0); + FragColor3 = 4.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag new file mode 100644 index 0000000000..ae9b7f75e7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/components/fragment-output-component.pad-fragment.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0, component = 0) out float FragColor0; +layout(location = 0, component = 1) out vec2 FragColor1; + +void main() +{ + FragColor0 = 1.0; + FragColor1 = vec2(2.0, 3.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-input-component.vert b/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-input-component.vert new file mode 100644 index 0000000000..7ba31bf655 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-input-component.vert @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0, component = 0) in vec3 Foo3; +layout(location = 0, component = 3) in float Foo1; +layout(location = 0) out vec3 Foo; + +void main() +{ + gl_Position = vec4(Foo3, Foo1); + Foo = Foo3 + Foo1; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-output-component.vert b/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-output-component.vert new file mode 100644 index 0000000000..5abd8dc6ff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/components/vertex-output-component.vert @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) in vec4 vFoo; +layout(location = 0) out vec3 Foo3; +layout(location = 0, component = 3) out float Foo1; + +void main() +{ + gl_Position = vFoo; + Foo3 = vFoo.xyz; + Foo1 = vFoo.w; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/16bit-constants.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/16bit-constants.invalid.frag new file mode 100644 index 0000000000..c53091b5b9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/16bit-constants.invalid.frag @@ -0,0 +1,14 @@ +#version 450 core + +#extension GL_AMD_gpu_shader_int16 : require +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) out float16_t foo; +layout(location = 1) out int16_t bar; +layout(location = 2) out uint16_t baz; + +void main() { + foo = 1.0hf; + bar = 2s; + baz = 3us; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag new file mode 100644 index 0000000000..12c4d24531 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/combined-sampler-parameter-names.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %UV %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %UV Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uSamp = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %UV = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %25 = OpFunctionCall %v4float %samp_ + OpStore %FragColor %25 + OpReturn + OpFunctionEnd + %samp_ = OpFunction %v4float None %8 + %10 = OpLabel + %15 = OpLoad %12 %uSamp + %19 = OpLoad %v2float %UV + %20 = OpImageSampleImplicitLod %v4float %15 %19 + OpReturnValue %20 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag new file mode 100644 index 0000000000..8cce059bab --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/demote-to-helper.vk.nocompat.msl21.invalid.frag @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + //demote; // FIXME: Not implemented for MSL + bool helper = helperInvocationEXT(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/depth-image-gather.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/depth-image-gather.asm.frag new file mode 100644 index 0000000000..430899c6f0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/depth-image-gather.asm.frag @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + OpExtension "SPV_GOOGLE_user_type" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %psMain "main" %gl_FragCoord %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %psMain OriginUpperLeft + OpSource HLSL 500 + OpName %type_2d_image "type.2d.image" + OpName %g_depthTexture "g_depthTexture" + OpName %type_sampler "type.sampler" + OpName %g_sampler "g_sampler" + OpName %g_comp "g_comp" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %psMain "psMain" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %g_depthTexture DescriptorSet 0 + OpDecorate %g_depthTexture Binding 0 + OpDecorate %g_sampler DescriptorSet 0 + OpDecorate %g_sampler Binding 0 + OpDecorate %g_comp DescriptorSet 0 + OpDecorate %g_comp Binding 1 + OpDecorateString %g_depthTexture UserTypeGOOGLE "texture2d" + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2int = OpTypeVector %int 2 + %16 = OpConstantComposite %v2int %int_0 %int_0 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %25 = OpTypeFunction %void +%type_sampled_image = OpTypeSampledImage %type_2d_image +%g_depthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %g_sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %g_comp = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %psMain = OpFunction %void None %25 + %26 = OpLabel + %27 = OpLoad %v2float %in_var_TEXCOORD0 + %28 = OpLoad %type_2d_image %g_depthTexture + %29 = OpLoad %type_sampler %g_comp + %30 = OpSampledImage %type_sampled_image %28 %29 + %31 = OpImageDrefGather %v4float %30 %27 %float_0_5 None + %32 = OpLoad %type_sampler %g_sampler + %33 = OpSampledImage %type_sampled_image %28 %32 + %34 = OpImageGather %v4float %33 %27 %int_0 ConstOffset %16 + %35 = OpFMul %v4float %31 %34 + OpStore %out_var_SV_Target0 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag new file mode 100644 index 0000000000..b1b058d014 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/force-active-resources.msl2.argument..force-active.discrete.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform sampler2D uTexture1; +layout(set = 0, binding = 1) uniform sampler2D uTexture2; +layout(set = 2, binding = 0) uniform sampler2D uTextureDiscrete1; +layout(set = 2, binding = 1) uniform sampler2D uTextureDiscrete2; + +void main() +{ + FragColor = texture(uTexture2, vUV); + FragColor += texture(uTextureDiscrete2, vUV); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag new file mode 100644 index 0000000000..1e4026eb2b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/fp16.desktop.invalid.frag @@ -0,0 +1,151 @@ +#version 450 +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) in float16_t v1; +layout(location = 1) in f16vec2 v2; +layout(location = 2) in f16vec3 v3; +layout(location = 3) in f16vec4 v4; + +layout(location = 0) out float o1; +layout(location = 1) out vec2 o2; +layout(location = 2) out vec3 o3; +layout(location = 3) out vec4 o4; + +f16mat2 test_mat2(f16vec2 a, f16vec2 b, f16vec2 c, f16vec2 d) +{ + return f16mat2(a, b) * f16mat2(c, d); +} + +f16mat3 test_mat3(f16vec3 a, f16vec3 b, f16vec3 c, f16vec3 d, f16vec3 e, f16vec3 f) +{ + return f16mat3(a, b, c) * f16mat3(d, e, f); +} + +void test_constants() +{ + float16_t a = 1.0hf; + float16_t b = 1.5hf; + float16_t c = -1.5hf; // Negatives + float16_t d = (0.0hf / 0.0hf); // NaN + float16_t e = (1.0hf / 0.0hf); // +Inf + float16_t f = (-1.0hf / 0.0hf); // -Inf + float16_t g = 1014.0hf; // Large. + float16_t h = 0.000001hf; // Denormal +} + +float16_t test_result() +{ + return 1.0hf; +} + +void test_conversions() +{ + float16_t one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = bool(one); + float d = float(one); + //double e = double(one); + float16_t a2 = float16_t(a); + float16_t b2 = float16_t(b); + float16_t c2 = float16_t(c); + float16_t d2 = float16_t(d); + //float16_t e2 = float16_t(e); +} + +void test_builtins() +{ + f16vec4 res; + res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = atan(v4, v3.xyzz); + res = atan(v4); + res = sinh(v4); + res = cosh(v4); + res = tanh(v4); + res = asinh(v4); + res = acosh(v4); + res = atanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = inversesqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + res = roundEven(v4); + res = ceil(v4); + res = fract(v4); + res = mod(v4, v4); + f16vec4 tmp; + res = modf(v4, tmp); + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = mix(v4, v4, v4); + res = mix(v4, v4, lessThan(v4, v4)); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + + bvec4 btmp = isnan(v4); + btmp = isinf(v4); + res = fma(v4, v4, v4); + + ivec4 itmp; + res = frexp(v4, itmp); + res = ldexp(res, itmp); + + uint pack0 = packFloat2x16(v4.xy); + uint pack1 = packFloat2x16(v4.zw); + res = f16vec4(unpackFloat2x16(pack0), unpackFloat2x16(pack1)); + + float16_t t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + f16vec3 res3 = cross(v3, v3); + res = normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + + btmp = lessThan(v4, v4); + btmp = lessThanEqual(v4, v4); + btmp = greaterThan(v4, v4); + btmp = greaterThanEqual(v4, v4); + btmp = equal(v4, v4); + btmp = notEqual(v4, v4); + + res = dFdx(v4); + res = dFdy(v4); + res = dFdxFine(v4); + res = dFdyFine(v4); + res = dFdxCoarse(v4); + res = dFdyCoarse(v4); + res = fwidth(v4); + res = fwidthFine(v4); + res = fwidthCoarse(v4); + + //res = interpolateAtCentroid(v4); + //res = interpolateAtSample(v4, 0); + //res = interpolateAtOffset(v4, f16vec2(0.1hf)); +} + +void main() +{ + // Basic matrix tests. + f16mat2 m0 = test_mat2(v2, v2, v3.xy, v3.xy); + f16mat3 m1 = test_mat3(v3, v3, v3, v4.xyz, v4.xyz, v4.yzw); + + test_constants(); + test_conversions(); + test_builtins(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/image-gather.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/image-gather.frag new file mode 100644 index 0000000000..b492cfbe90 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/image-gather.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(set = 0, binding = 1) uniform sampler2DShadow uSampShadow; +layout(location = 0) in vec3 vUV; + +void main() +{ + FragColor = textureGather(uSamp, vUV.xy, 0); + FragColor += textureGather(uSamp, vUV.xy, 1); + FragColor += textureGather(uSampShadow, vUV.xy, vUV.z); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/in_block_assign.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/in_block_assign.frag new file mode 100644 index 0000000000..760a3ba2d3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/in_block_assign.frag @@ -0,0 +1,16 @@ +#version 450 + +struct VOUT +{ + vec4 a; +}; + +layout(location = 0) in VOUT Clip; +layout(location = 0) out vec4 FragColor; + +void main() +{ + VOUT tmp = Clip; + tmp.a += 1.0; + FragColor = tmp.a; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag new file mode 100644 index 0000000000..ad566615f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.invalid.asm.frag @@ -0,0 +1,293 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 205 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpExtension "SPV_AMD_gpu_shader_half_float" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v1 %v2 %v3 %v4 %h1 %h2 %h3 %h4 + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_AMD_gpu_shader_half_float" + OpName %main "main" + OpName %res "res" + OpName %res2 "res2" + OpName %res3 "res3" + OpName %res4 "res4" + OpName %hres "hres" + OpName %hres2 "hres2" + OpName %hres3 "hres3" + OpName %hres4 "hres4" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %h1 "h1" + OpName %h2 "h2" + OpName %h3 "h3" + OpName %h4 "h4" + OpDecorate %v1 Location 0 + OpDecorate %v2 Location 1 + OpDecorate %v3 Location 2 + OpDecorate %v4 Location 3 + OpDecorate %h1 Location 4 + OpDecorate %h2 Location 5 + OpDecorate %h3 Location 6 + OpDecorate %h4 Location 7 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %v3half = OpTypeVector %half 3 + %v4half = OpTypeVector %half 4 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Function_half = OpTypePointer Function %half +%_ptr_Input_half = OpTypePointer Input %half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Input_v2half = OpTypePointer Input %v2half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Input_v3half = OpTypePointer Input %v3half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Input_v4half = OpTypePointer Input %v4half + %v1 = OpVariable %_ptr_Input_float Input + %v2 = OpVariable %_ptr_Input_v2float Input + %v3 = OpVariable %_ptr_Input_v3float Input + %v4 = OpVariable %_ptr_Input_v4float Input + %h1 = OpVariable %_ptr_Input_half Input + %h2 = OpVariable %_ptr_Input_v2half Input + %h3 = OpVariable %_ptr_Input_v3half Input + %h4 = OpVariable %_ptr_Input_v4half Input + %main = OpFunction %void None %3 + %5 = OpLabel + %res = OpVariable %_ptr_Function_float Function + %46 = OpLoad %float %v1 + %47 = OpLoad %float %v1 + %48 = OpExtInst %float %1 FMin %46 %47 + OpStore %res %48 + %49 = OpLoad %float %v1 + %50 = OpLoad %float %v1 + %51 = OpExtInst %float %1 FMax %49 %50 + OpStore %res %51 + %52 = OpLoad %float %v1 + %53 = OpLoad %float %v1 + %54 = OpLoad %float %v1 + %55 = OpExtInst %float %1 FClamp %52 %53 %54 + OpStore %res %55 + %56 = OpLoad %float %v1 + %57 = OpLoad %float %v1 + %58 = OpExtInst %float %1 NMin %56 %57 + OpStore %res %58 + %59 = OpLoad %float %v1 + %60 = OpLoad %float %v1 + %61 = OpExtInst %float %1 NMax %59 %60 + OpStore %res %61 + %62 = OpLoad %float %v1 + %63 = OpLoad %float %v1 + %64 = OpLoad %float %v1 + %65 = OpExtInst %float %1 NClamp %62 %63 %64 + OpStore %res %65 + %res2 = OpVariable %_ptr_Function_v2float Function + %66 = OpLoad %v2float %v2 + %67 = OpLoad %v2float %v2 + %68 = OpExtInst %v2float %1 FMin %66 %67 + OpStore %res2 %68 + %69 = OpLoad %v2float %v2 + %70 = OpLoad %v2float %v2 + %71 = OpExtInst %v2float %1 FMax %69 %70 + OpStore %res2 %71 + %72 = OpLoad %v2float %v2 + %73 = OpLoad %v2float %v2 + %74 = OpLoad %v2float %v2 + %75 = OpExtInst %v2float %1 FClamp %72 %73 %74 + OpStore %res2 %75 + %76 = OpLoad %v2float %v2 + %77 = OpLoad %v2float %v2 + %78 = OpExtInst %v2float %1 NMin %76 %77 + OpStore %res2 %78 + %79 = OpLoad %v2float %v2 + %80 = OpLoad %v2float %v2 + %81 = OpExtInst %v2float %1 NMax %79 %80 + OpStore %res2 %81 + %82 = OpLoad %v2float %v2 + %83 = OpLoad %v2float %v2 + %84 = OpLoad %v2float %v2 + %85 = OpExtInst %v2float %1 NClamp %82 %83 %84 + OpStore %res2 %85 + %res3 = OpVariable %_ptr_Function_v3float Function + %86 = OpLoad %v3float %v3 + %87 = OpLoad %v3float %v3 + %88 = OpExtInst %v3float %1 FMin %86 %87 + OpStore %res3 %88 + %89 = OpLoad %v3float %v3 + %90 = OpLoad %v3float %v3 + %91 = OpExtInst %v3float %1 FMax %89 %90 + OpStore %res3 %91 + %92 = OpLoad %v3float %v3 + %93 = OpLoad %v3float %v3 + %94 = OpLoad %v3float %v3 + %95 = OpExtInst %v3float %1 FClamp %92 %93 %94 + OpStore %res3 %95 + %96 = OpLoad %v3float %v3 + %97 = OpLoad %v3float %v3 + %98 = OpExtInst %v3float %1 NMin %96 %97 + OpStore %res3 %98 + %99 = OpLoad %v3float %v3 + %100 = OpLoad %v3float %v3 + %101 = OpExtInst %v3float %1 NMax %99 %100 + OpStore %res3 %101 + %102 = OpLoad %v3float %v3 + %103 = OpLoad %v3float %v3 + %104 = OpLoad %v3float %v3 + %105 = OpExtInst %v3float %1 NClamp %102 %103 %104 + OpStore %res3 %105 + %res4 = OpVariable %_ptr_Function_v4float Function + %106 = OpLoad %v4float %v4 + %107 = OpLoad %v4float %v4 + %108 = OpExtInst %v4float %1 FMin %106 %107 + OpStore %res4 %108 + %109 = OpLoad %v4float %v4 + %110 = OpLoad %v4float %v4 + %111 = OpExtInst %v4float %1 FMax %109 %110 + OpStore %res4 %111 + %112 = OpLoad %v4float %v4 + %113 = OpLoad %v4float %v4 + %114 = OpLoad %v4float %v4 + %115 = OpExtInst %v4float %1 FClamp %112 %113 %114 + OpStore %res4 %115 + %116 = OpLoad %v4float %v4 + %117 = OpLoad %v4float %v4 + %118 = OpExtInst %v4float %1 NMin %116 %117 + OpStore %res4 %118 + %119 = OpLoad %v4float %v4 + %120 = OpLoad %v4float %v4 + %121 = OpExtInst %v4float %1 NMax %119 %120 + OpStore %res4 %121 + %122 = OpLoad %v4float %v4 + %123 = OpLoad %v4float %v4 + %124 = OpLoad %v4float %v4 + %125 = OpExtInst %v4float %1 NClamp %122 %123 %124 + OpStore %res4 %125 + %hres = OpVariable %_ptr_Function_half Function + %126 = OpLoad %half %h1 + %127 = OpLoad %half %h1 + %128 = OpExtInst %half %1 FMin %126 %127 + OpStore %hres %128 + %129 = OpLoad %half %h1 + %130 = OpLoad %half %h1 + %131 = OpExtInst %half %1 FMax %129 %130 + OpStore %hres %131 + %132 = OpLoad %half %h1 + %133 = OpLoad %half %h1 + %134 = OpLoad %half %h1 + %135 = OpExtInst %half %1 FClamp %132 %133 %134 + OpStore %hres %135 + %136 = OpLoad %half %h1 + %137 = OpLoad %half %h1 + %138 = OpExtInst %half %1 NMin %136 %137 + OpStore %hres %138 + %139 = OpLoad %half %h1 + %140 = OpLoad %half %h1 + %141 = OpExtInst %half %1 NMax %139 %140 + OpStore %hres %141 + %142 = OpLoad %half %h1 + %143 = OpLoad %half %h1 + %144 = OpLoad %half %h1 + %145 = OpExtInst %half %1 NClamp %142 %143 %144 + OpStore %hres %145 + %hres2 = OpVariable %_ptr_Function_v2half Function + %146 = OpLoad %v2half %h2 + %147 = OpLoad %v2half %h2 + %148 = OpExtInst %v2half %1 FMin %146 %147 + OpStore %hres2 %148 + %149 = OpLoad %v2half %h2 + %150 = OpLoad %v2half %h2 + %151 = OpExtInst %v2half %1 FMax %149 %150 + OpStore %hres2 %151 + %152 = OpLoad %v2half %h2 + %153 = OpLoad %v2half %h2 + %154 = OpLoad %v2half %h2 + %155 = OpExtInst %v2half %1 FClamp %152 %153 %154 + OpStore %hres2 %155 + %156 = OpLoad %v2half %h2 + %157 = OpLoad %v2half %h2 + %158 = OpExtInst %v2half %1 NMin %156 %157 + OpStore %hres2 %158 + %159 = OpLoad %v2half %h2 + %160 = OpLoad %v2half %h2 + %161 = OpExtInst %v2half %1 NMax %159 %160 + OpStore %hres2 %161 + %162 = OpLoad %v2half %h2 + %163 = OpLoad %v2half %h2 + %164 = OpLoad %v2half %h2 + %165 = OpExtInst %v2half %1 NClamp %162 %163 %164 + OpStore %hres2 %165 + %hres3 = OpVariable %_ptr_Function_v3half Function + %166 = OpLoad %v3half %h3 + %167 = OpLoad %v3half %h3 + %168 = OpExtInst %v3half %1 FMin %166 %167 + OpStore %hres3 %168 + %169 = OpLoad %v3half %h3 + %170 = OpLoad %v3half %h3 + %171 = OpExtInst %v3half %1 FMax %169 %170 + OpStore %hres3 %171 + %172 = OpLoad %v3half %h3 + %173 = OpLoad %v3half %h3 + %174 = OpLoad %v3half %h3 + %175 = OpExtInst %v3half %1 FClamp %172 %173 %174 + OpStore %hres3 %175 + %176 = OpLoad %v3half %h3 + %177 = OpLoad %v3half %h3 + %178 = OpExtInst %v3half %1 NMin %176 %177 + OpStore %hres3 %178 + %179 = OpLoad %v3half %h3 + %180 = OpLoad %v3half %h3 + %181 = OpExtInst %v3half %1 NMax %179 %180 + OpStore %hres3 %181 + %182 = OpLoad %v3half %h3 + %183 = OpLoad %v3half %h3 + %184 = OpLoad %v3half %h3 + %185 = OpExtInst %v3half %1 NClamp %182 %183 %184 + OpStore %hres3 %185 + %hres4 = OpVariable %_ptr_Function_v4half Function + %186 = OpLoad %v4half %h4 + %187 = OpLoad %v4half %h4 + %188 = OpExtInst %v4half %1 FMin %186 %187 + OpStore %hres4 %188 + %189 = OpLoad %v4half %h4 + %190 = OpLoad %v4half %h4 + %191 = OpExtInst %v4half %1 FMax %189 %190 + OpStore %hres4 %191 + %192 = OpLoad %v4half %h4 + %193 = OpLoad %v4half %h4 + %194 = OpLoad %v4half %h4 + %195 = OpExtInst %v4half %1 FClamp %192 %193 %194 + OpStore %hres4 %195 + %196 = OpLoad %v4half %h4 + %197 = OpLoad %v4half %h4 + %198 = OpExtInst %v4half %1 NMin %196 %197 + OpStore %hres4 %198 + %199 = OpLoad %v4half %h4 + %200 = OpLoad %v4half %h4 + %201 = OpExtInst %v4half %1 NMax %199 %200 + OpStore %hres4 %201 + %202 = OpLoad %v4half %h4 + %203 = OpLoad %v4half %h4 + %204 = OpLoad %v4half %h4 + %205 = OpExtInst %v4half %1 NClamp %202 %203 %204 + OpStore %hres4 %205 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag new file mode 100644 index 0000000000..ad566615f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/min-max-clamp.relax-nan.invalid.asm.frag @@ -0,0 +1,293 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 205 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpExtension "SPV_AMD_gpu_shader_half_float" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v1 %v2 %v3 %v4 %h1 %h2 %h3 %h4 + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_AMD_gpu_shader_half_float" + OpName %main "main" + OpName %res "res" + OpName %res2 "res2" + OpName %res3 "res3" + OpName %res4 "res4" + OpName %hres "hres" + OpName %hres2 "hres2" + OpName %hres3 "hres3" + OpName %hres4 "hres4" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %v4 "v4" + OpName %h1 "h1" + OpName %h2 "h2" + OpName %h3 "h3" + OpName %h4 "h4" + OpDecorate %v1 Location 0 + OpDecorate %v2 Location 1 + OpDecorate %v3 Location 2 + OpDecorate %v4 Location 3 + OpDecorate %h1 Location 4 + OpDecorate %h2 Location 5 + OpDecorate %h3 Location 6 + OpDecorate %h4 Location 7 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %v3half = OpTypeVector %half 3 + %v4half = OpTypeVector %half 4 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Function_half = OpTypePointer Function %half +%_ptr_Input_half = OpTypePointer Input %half +%_ptr_Function_v2half = OpTypePointer Function %v2half +%_ptr_Input_v2half = OpTypePointer Input %v2half +%_ptr_Function_v3half = OpTypePointer Function %v3half +%_ptr_Input_v3half = OpTypePointer Input %v3half +%_ptr_Function_v4half = OpTypePointer Function %v4half +%_ptr_Input_v4half = OpTypePointer Input %v4half + %v1 = OpVariable %_ptr_Input_float Input + %v2 = OpVariable %_ptr_Input_v2float Input + %v3 = OpVariable %_ptr_Input_v3float Input + %v4 = OpVariable %_ptr_Input_v4float Input + %h1 = OpVariable %_ptr_Input_half Input + %h2 = OpVariable %_ptr_Input_v2half Input + %h3 = OpVariable %_ptr_Input_v3half Input + %h4 = OpVariable %_ptr_Input_v4half Input + %main = OpFunction %void None %3 + %5 = OpLabel + %res = OpVariable %_ptr_Function_float Function + %46 = OpLoad %float %v1 + %47 = OpLoad %float %v1 + %48 = OpExtInst %float %1 FMin %46 %47 + OpStore %res %48 + %49 = OpLoad %float %v1 + %50 = OpLoad %float %v1 + %51 = OpExtInst %float %1 FMax %49 %50 + OpStore %res %51 + %52 = OpLoad %float %v1 + %53 = OpLoad %float %v1 + %54 = OpLoad %float %v1 + %55 = OpExtInst %float %1 FClamp %52 %53 %54 + OpStore %res %55 + %56 = OpLoad %float %v1 + %57 = OpLoad %float %v1 + %58 = OpExtInst %float %1 NMin %56 %57 + OpStore %res %58 + %59 = OpLoad %float %v1 + %60 = OpLoad %float %v1 + %61 = OpExtInst %float %1 NMax %59 %60 + OpStore %res %61 + %62 = OpLoad %float %v1 + %63 = OpLoad %float %v1 + %64 = OpLoad %float %v1 + %65 = OpExtInst %float %1 NClamp %62 %63 %64 + OpStore %res %65 + %res2 = OpVariable %_ptr_Function_v2float Function + %66 = OpLoad %v2float %v2 + %67 = OpLoad %v2float %v2 + %68 = OpExtInst %v2float %1 FMin %66 %67 + OpStore %res2 %68 + %69 = OpLoad %v2float %v2 + %70 = OpLoad %v2float %v2 + %71 = OpExtInst %v2float %1 FMax %69 %70 + OpStore %res2 %71 + %72 = OpLoad %v2float %v2 + %73 = OpLoad %v2float %v2 + %74 = OpLoad %v2float %v2 + %75 = OpExtInst %v2float %1 FClamp %72 %73 %74 + OpStore %res2 %75 + %76 = OpLoad %v2float %v2 + %77 = OpLoad %v2float %v2 + %78 = OpExtInst %v2float %1 NMin %76 %77 + OpStore %res2 %78 + %79 = OpLoad %v2float %v2 + %80 = OpLoad %v2float %v2 + %81 = OpExtInst %v2float %1 NMax %79 %80 + OpStore %res2 %81 + %82 = OpLoad %v2float %v2 + %83 = OpLoad %v2float %v2 + %84 = OpLoad %v2float %v2 + %85 = OpExtInst %v2float %1 NClamp %82 %83 %84 + OpStore %res2 %85 + %res3 = OpVariable %_ptr_Function_v3float Function + %86 = OpLoad %v3float %v3 + %87 = OpLoad %v3float %v3 + %88 = OpExtInst %v3float %1 FMin %86 %87 + OpStore %res3 %88 + %89 = OpLoad %v3float %v3 + %90 = OpLoad %v3float %v3 + %91 = OpExtInst %v3float %1 FMax %89 %90 + OpStore %res3 %91 + %92 = OpLoad %v3float %v3 + %93 = OpLoad %v3float %v3 + %94 = OpLoad %v3float %v3 + %95 = OpExtInst %v3float %1 FClamp %92 %93 %94 + OpStore %res3 %95 + %96 = OpLoad %v3float %v3 + %97 = OpLoad %v3float %v3 + %98 = OpExtInst %v3float %1 NMin %96 %97 + OpStore %res3 %98 + %99 = OpLoad %v3float %v3 + %100 = OpLoad %v3float %v3 + %101 = OpExtInst %v3float %1 NMax %99 %100 + OpStore %res3 %101 + %102 = OpLoad %v3float %v3 + %103 = OpLoad %v3float %v3 + %104 = OpLoad %v3float %v3 + %105 = OpExtInst %v3float %1 NClamp %102 %103 %104 + OpStore %res3 %105 + %res4 = OpVariable %_ptr_Function_v4float Function + %106 = OpLoad %v4float %v4 + %107 = OpLoad %v4float %v4 + %108 = OpExtInst %v4float %1 FMin %106 %107 + OpStore %res4 %108 + %109 = OpLoad %v4float %v4 + %110 = OpLoad %v4float %v4 + %111 = OpExtInst %v4float %1 FMax %109 %110 + OpStore %res4 %111 + %112 = OpLoad %v4float %v4 + %113 = OpLoad %v4float %v4 + %114 = OpLoad %v4float %v4 + %115 = OpExtInst %v4float %1 FClamp %112 %113 %114 + OpStore %res4 %115 + %116 = OpLoad %v4float %v4 + %117 = OpLoad %v4float %v4 + %118 = OpExtInst %v4float %1 NMin %116 %117 + OpStore %res4 %118 + %119 = OpLoad %v4float %v4 + %120 = OpLoad %v4float %v4 + %121 = OpExtInst %v4float %1 NMax %119 %120 + OpStore %res4 %121 + %122 = OpLoad %v4float %v4 + %123 = OpLoad %v4float %v4 + %124 = OpLoad %v4float %v4 + %125 = OpExtInst %v4float %1 NClamp %122 %123 %124 + OpStore %res4 %125 + %hres = OpVariable %_ptr_Function_half Function + %126 = OpLoad %half %h1 + %127 = OpLoad %half %h1 + %128 = OpExtInst %half %1 FMin %126 %127 + OpStore %hres %128 + %129 = OpLoad %half %h1 + %130 = OpLoad %half %h1 + %131 = OpExtInst %half %1 FMax %129 %130 + OpStore %hres %131 + %132 = OpLoad %half %h1 + %133 = OpLoad %half %h1 + %134 = OpLoad %half %h1 + %135 = OpExtInst %half %1 FClamp %132 %133 %134 + OpStore %hres %135 + %136 = OpLoad %half %h1 + %137 = OpLoad %half %h1 + %138 = OpExtInst %half %1 NMin %136 %137 + OpStore %hres %138 + %139 = OpLoad %half %h1 + %140 = OpLoad %half %h1 + %141 = OpExtInst %half %1 NMax %139 %140 + OpStore %hres %141 + %142 = OpLoad %half %h1 + %143 = OpLoad %half %h1 + %144 = OpLoad %half %h1 + %145 = OpExtInst %half %1 NClamp %142 %143 %144 + OpStore %hres %145 + %hres2 = OpVariable %_ptr_Function_v2half Function + %146 = OpLoad %v2half %h2 + %147 = OpLoad %v2half %h2 + %148 = OpExtInst %v2half %1 FMin %146 %147 + OpStore %hres2 %148 + %149 = OpLoad %v2half %h2 + %150 = OpLoad %v2half %h2 + %151 = OpExtInst %v2half %1 FMax %149 %150 + OpStore %hres2 %151 + %152 = OpLoad %v2half %h2 + %153 = OpLoad %v2half %h2 + %154 = OpLoad %v2half %h2 + %155 = OpExtInst %v2half %1 FClamp %152 %153 %154 + OpStore %hres2 %155 + %156 = OpLoad %v2half %h2 + %157 = OpLoad %v2half %h2 + %158 = OpExtInst %v2half %1 NMin %156 %157 + OpStore %hres2 %158 + %159 = OpLoad %v2half %h2 + %160 = OpLoad %v2half %h2 + %161 = OpExtInst %v2half %1 NMax %159 %160 + OpStore %hres2 %161 + %162 = OpLoad %v2half %h2 + %163 = OpLoad %v2half %h2 + %164 = OpLoad %v2half %h2 + %165 = OpExtInst %v2half %1 NClamp %162 %163 %164 + OpStore %hres2 %165 + %hres3 = OpVariable %_ptr_Function_v3half Function + %166 = OpLoad %v3half %h3 + %167 = OpLoad %v3half %h3 + %168 = OpExtInst %v3half %1 FMin %166 %167 + OpStore %hres3 %168 + %169 = OpLoad %v3half %h3 + %170 = OpLoad %v3half %h3 + %171 = OpExtInst %v3half %1 FMax %169 %170 + OpStore %hres3 %171 + %172 = OpLoad %v3half %h3 + %173 = OpLoad %v3half %h3 + %174 = OpLoad %v3half %h3 + %175 = OpExtInst %v3half %1 FClamp %172 %173 %174 + OpStore %hres3 %175 + %176 = OpLoad %v3half %h3 + %177 = OpLoad %v3half %h3 + %178 = OpExtInst %v3half %1 NMin %176 %177 + OpStore %hres3 %178 + %179 = OpLoad %v3half %h3 + %180 = OpLoad %v3half %h3 + %181 = OpExtInst %v3half %1 NMax %179 %180 + OpStore %hres3 %181 + %182 = OpLoad %v3half %h3 + %183 = OpLoad %v3half %h3 + %184 = OpLoad %v3half %h3 + %185 = OpExtInst %v3half %1 NClamp %182 %183 %184 + OpStore %hres3 %185 + %hres4 = OpVariable %_ptr_Function_v4half Function + %186 = OpLoad %v4half %h4 + %187 = OpLoad %v4half %h4 + %188 = OpExtInst %v4half %1 FMin %186 %187 + OpStore %hres4 %188 + %189 = OpLoad %v4half %h4 + %190 = OpLoad %v4half %h4 + %191 = OpExtInst %v4half %1 FMax %189 %190 + OpStore %hres4 %191 + %192 = OpLoad %v4half %h4 + %193 = OpLoad %v4half %h4 + %194 = OpLoad %v4half %h4 + %195 = OpExtInst %v4half %1 FClamp %192 %193 %194 + OpStore %hres4 %195 + %196 = OpLoad %v4half %h4 + %197 = OpLoad %v4half %h4 + %198 = OpExtInst %v4half %1 NMin %196 %197 + OpStore %hres4 %198 + %199 = OpLoad %v4half %h4 + %200 = OpLoad %v4half %h4 + %201 = OpExtInst %v4half %1 NMax %199 %200 + OpStore %hres4 %201 + %202 = OpLoad %v4half %h4 + %203 = OpLoad %v4half %h4 + %204 = OpLoad %v4half %h4 + %205 = OpExtInst %v4half %1 NClamp %202 %203 %204 + OpStore %hres4 %205 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag new file mode 100644 index 0000000000..4e0460afbb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/nonuniform-constructor.msl2.frag @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(location = 1) flat in int vIndex; + +layout(set = 0, binding = 0) uniform texture2D uTex[10]; +layout(set = 1, binding = 0) uniform sampler Immut; + +void main() +{ + FragColor = texture(nonuniformEXT(sampler2D(uTex[vIndex], Immut)), vUV); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag new file mode 100644 index 0000000000..59079fe58b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag @@ -0,0 +1,31 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require +layout(pixel_interlock_ordered) in; + +layout(set = 0, binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +}; + +layout(set = 0, binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +}; + +void callee2() +{ + values1[int(gl_FragCoord.x)] += 1; +} + +void callee() +{ + values0[int(gl_FragCoord.x)] += 1; + callee2(); +} + +void main() +{ + beginInvocationInterlockARB(); + callee(); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag new file mode 100644 index 0000000000..a2be5ef62f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/pull-interpolant-access-chain.msl23.frag @@ -0,0 +1,12 @@ +#version 450 +layout(location = 0) centroid in vec4 a[2]; +layout(location = 2) centroid in vec4 b[2]; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor.x = interpolateAtOffset(a[0].x, vec2(0.5)); + FragColor.y = interpolateAtOffset(a[1].y, vec2(0.5)); + FragColor.z = interpolateAtOffset(b[0].z, vec2(0.5)); + FragColor.w = interpolateAtOffset(b[1].w, vec2(0.5)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag new file mode 100644 index 0000000000..56e809c0b3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag @@ -0,0 +1,23 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require + +layout(std430, binding = 0) uniform UBO +{ + float a[1]; + vec2 b[2]; +}; + +layout(std430, binding = 1) uniform UBOEnhancedLayout +{ + float c[1]; + vec2 d[2]; + layout(offset = 10000) float e; +}; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = a[vIndex] + c[vIndex] + e; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag new file mode 100644 index 0000000000..d885a78471 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/shadow-compare-global-alias.invalid.frag @@ -0,0 +1,38 @@ +#version 450 + +layout(location = 0) out float FragColor; +layout(binding = 0) uniform sampler2DShadow uSampler; +layout(location = 0) in vec3 vUV; + +layout(binding = 1) uniform texture2D uTex; +layout(binding = 2) uniform samplerShadow uSamp; + +float Samp(vec3 uv) +{ + return texture(sampler2DShadow(uTex, uSamp), uv); +} + +float Samp2(vec3 uv) +{ + return texture(uSampler, vUV); +} + +float Samp3(texture2D uT, samplerShadow uS, vec3 uv) +{ + return texture(sampler2DShadow(uT, uS), vUV); +} + +float Samp4(sampler2DShadow uS, vec3 uv) +{ + return texture(uS, vUV); +} + +void main() +{ + FragColor = texture(uSampler, vUV); + FragColor += texture(sampler2DShadow(uTex, uSamp), vUV); + FragColor += Samp(vUV); + FragColor += Samp2(vUV); + FragColor += Samp3(uTex, uSamp, vUV); + FragColor += Samp4(uSampler, vUV); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag new file mode 100644 index 0000000000..643ad541d9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/struct-bool-edge-cases.frag @@ -0,0 +1,58 @@ +#version 450 + +layout(location = 0) out float FragColor; + +struct Test +{ + bool a; + bvec2 b; + bvec3 c; + bvec4 d; +}; + +struct Test2 +{ + bool a[2]; + bvec2 b[2]; + bvec3 c[2]; + bvec4 d[2]; + Test e; +}; + +void main() +{ + Test t; + Test2 t2; + + t.a = true; + t.b = bvec2(true, false); + t.c = bvec3(true, false, true); + t.d = bvec4(true, false, true, false); + + t2.a = bool[](true, false); + t2.b = bvec2[](bvec2(true, false), bvec2(false, true)); + t2.c = bvec3[](bvec3(true, false, true), bvec3(false, true, false)); + t2.d = bvec4[](bvec4(true, false, true, false), bvec4(false, true, false, true)); + + bool a = t.a; + bvec2 b = t.b; + bvec3 c = t.c; + bvec4 d = t.d; + + bool a2[2] = t2.a; + bvec2 b2[2] = t2.b; + bvec3 c2[2] = t2.c; + bvec4 d2[2] = t2.d; + + t = Test(true, bvec2(true, false), bvec3(true), bvec4(false)); + t2 = Test2( + bool[](true, true), + bvec2[](bvec2(true), bvec2(false)), + bvec3[](bvec3(true), bvec3(false)), + bvec4[](bvec4(true), bvec4(false)), + Test(true, bvec2(true, false), bvec3(true), bvec4(false))); + + Test t3[2] = Test[]( + Test(true, bvec2(true, false), bvec3(true), bvec4(false)), + Test(false, bvec2(false, true), bvec3(false), bvec4(true))); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag new file mode 100644 index 0000000000..05aa521202 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subgroups.nocompat.invalid.vk.msl22.frag @@ -0,0 +1,131 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require + +layout(location = 0) out float FragColor; + +void main() +{ + // basic + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + bvec2 broadcasted_bool = subgroupBroadcast(bvec2(true), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + bvec4 first_bool = subgroupBroadcastFirst(bvec4(false)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + bool shuffled_bool = subgroupShuffle(true, 9u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + bool shuffled_xor_bool = subgroupShuffleXor(false, 9u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + bool shuffled_up_bool = subgroupShuffleUp(true, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + bool shuffled_down_bool = subgroupShuffleDown(false, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(0); + has_equal = subgroupAllEqual(true); + has_equal = subgroupAllEqual(vec3(0.0, 1.0, 2.0)); + has_equal = subgroupAllEqual(bvec4(true, true, false, true)); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + //lo = subgroupInclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupInclusiveMax(hi); + //slo = subgroupInclusiveMin(slo); + //shi = subgroupInclusiveMax(shi); + //ulo = subgroupInclusiveMin(ulo); + //uhi = subgroupInclusiveMax(uhi); + //anded = subgroupInclusiveAnd(anded); + //ored = subgroupInclusiveOr(ored); + //xored = subgroupInclusiveXor(ored); + //added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + //lo = subgroupExclusiveMin(lo); // FIXME: Unsupported by Metal + //hi = subgroupExclusiveMax(hi); + //ulo = subgroupExclusiveMin(ulo); + //uhi = subgroupExclusiveMax(uhi); + //slo = subgroupExclusiveMin(slo); + //shi = subgroupExclusiveMax(shi); + //anded = subgroupExclusiveAnd(anded); + //ored = subgroupExclusiveOr(ored); + //xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + bvec4 swap_horiz_bool = subgroupQuadSwapHorizontal(bvec4(true)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + bvec4 swap_vertical_bool = subgroupQuadSwapVertical(bvec4(true)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + bvec4 swap_diagonal_bool = subgroupQuadSwapDiagonal(bvec4(true)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); + bvec4 quad_broadcast_bool = subgroupQuadBroadcast(bvec4(true), 3u); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag new file mode 100644 index 0000000000..70822aee99 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl20.ios.framebuffer-fetch.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 4, input_attachment_index = 1) uniform subpassInput uInput; +layout(location = 1) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uInput); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag new file mode 100644 index 0000000000..70822aee99 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-attachment-index-fallback.msl23.framebuffer-fetch.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 4, input_attachment_index = 1) uniform subpassInput uInput; +layout(location = 1) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uInput); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag new file mode 100644 index 0000000000..ef9ef77d56 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.ios.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(set = 0, input_attachment_index = 0, binding = 0) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +vec4 samp3(subpassInput uS) +{ + return subpassLoad(uS); +} + +vec4 samp2(subpassInput uS) +{ + return subpassLoad(uS) + samp3(uS); +} + +vec4 samp() +{ + return subpassLoad(uSub) + samp3(uSub); +} + +void main() +{ + FragColor = samp() + samp2(uSub); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag new file mode 100644 index 0000000000..ef9ef77d56 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input-function-argument.framebuffer-fetch.msl23.frag @@ -0,0 +1,24 @@ +#version 450 + +layout(set = 0, input_attachment_index = 0, binding = 0) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +vec4 samp3(subpassInput uS) +{ + return subpassLoad(uS); +} + +vec4 samp2(subpassInput uS) +{ + return subpassLoad(uS) + samp3(uS); +} + +vec4 samp() +{ + return subpassLoad(uSub) + samp3(uSub); +} + +void main() +{ + FragColor = samp() + samp2(uSub); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag new file mode 100644 index 0000000000..671a4d1b41 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.argument.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 10, input_attachment_index = 1) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 9) uniform texture2D uTex; +layout(set = 0, binding = 8) uniform sampler uSampler; + +void main() +{ + FragColor = subpassLoad(uSub) + texture(sampler2D(uTex, uSampler), vec2(0.5)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag new file mode 100644 index 0000000000..671a4d1b41 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.framebuffer-fetch.msl23.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 10, input_attachment_index = 1) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 9) uniform texture2D uTex; +layout(set = 0, binding = 8) uniform sampler uSampler; + +void main() +{ + FragColor = subpassLoad(uSub) + texture(sampler2D(uTex, uSampler), vec2(0.5)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag new file mode 100644 index 0000000000..671a4d1b41 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.argument.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 10, input_attachment_index = 1) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 9) uniform texture2D uTex; +layout(set = 0, binding = 8) uniform sampler uSampler; + +void main() +{ + FragColor = subpassLoad(uSub) + texture(sampler2D(uTex, uSampler), vec2(0.5)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag new file mode 100644 index 0000000000..671a4d1b41 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/subpass-input.decoration-binding.ios.framebuffer-fetch.msl2.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 10, input_attachment_index = 1) uniform subpassInput uSub; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 9) uniform texture2D uTex; +layout(set = 0, binding = 8) uniform sampler uSampler; + +void main() +{ + FragColor = subpassLoad(uSub) + texture(sampler2D(uTex, uSampler), vec2(0.5)); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag new file mode 100644 index 0000000000..4b75d4f317 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag @@ -0,0 +1,53 @@ +#version 450 + +layout(binding = 0) uniform isampler1D tex1d; +layout(binding = 1) uniform isampler2D tex2d; +layout(binding = 2) uniform isampler3D tex3d; +layout(binding = 3) uniform isamplerCube texCube; +layout(binding = 4) uniform isampler2DArray tex2dArray; +layout(binding = 5) uniform isamplerCubeArray texCubeArray; +layout(binding = 6) uniform isamplerBuffer texBuffer; + +void main() +{ + // OpImageSampleImplicitLod + vec4 c = texture(tex1d, 0.0); + c = texture(tex2d, vec2(0.0, 0.0)); + c = texture(tex3d, vec3(0.0, 0.0, 0.0)); + c = texture(texCube, vec3(0.0, 0.0, 0.0)); + c = texture(tex2dArray, vec3(0.0, 0.0, 0.0)); + c = texture(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0)); + + // OpImageSampleProjImplicitLod + c = textureProj(tex1d, vec2(0.0, 1.0)); + c = textureProj(tex2d, vec3(0.0, 0.0, 1.0)); + c = textureProj(tex3d, vec4(0.0, 0.0, 0.0, 1.0)); + + // OpImageSampleExplicitLod + c = textureLod(tex1d, 0.0, 0.0); + c = textureLod(tex2d, vec2(0.0, 0.0), 0.0); + c = textureLod(tex3d, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCube, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(tex2dArray, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 0.0); + + // OpImageSampleProjExplicitLod + c = textureProjLod(tex1d, vec2(0.0, 1.0), 0.0); + c = textureProjLod(tex2d, vec3(0.0, 0.0, 1.0), 0.0); + c = textureProjLod(tex3d, vec4(0.0, 0.0, 0.0, 1.0), 0.0); + + // OpImageFetch + c = texelFetch(tex1d, 0, 0); + c = texelFetch(tex2d, ivec2(0, 0), 0); + c = texelFetch(tex3d, ivec3(0, 0, 0), 0); + c = texelFetch(tex2dArray, ivec3(0, 0, 0), 0); + + // Show that this transformation doesn't apply to Buffer images. + c = texelFetch(texBuffer, 0); + + // OpImageGather + c = textureGather(tex2d, vec2(0.0, 0.0), 0); + c = textureGather(texCube, vec3(0.0, 0.0, 0.0), 1); + c = textureGather(tex2dArray, vec3(0.0, 0.0, 0.0), 2); + c = textureGather(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 3); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag new file mode 100644 index 0000000000..2b7e9370d4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag @@ -0,0 +1,86 @@ +#version 450 + +layout(binding = 0) uniform sampler1D tex1d; +layout(binding = 1) uniform sampler2D tex2d; +layout(binding = 2) uniform sampler3D tex3d; +layout(binding = 3) uniform samplerCube texCube; +layout(binding = 4) uniform sampler2DArray tex2dArray; +layout(binding = 5) uniform samplerCubeArray texCubeArray; +layout(binding = 6) uniform samplerBuffer texBuffer; + +layout(binding = 7) uniform sampler2DShadow depth2d; +layout(binding = 8) uniform samplerCubeShadow depthCube; +layout(binding = 9) uniform sampler2DArrayShadow depth2dArray; +layout(binding = 10) uniform samplerCubeArrayShadow depthCubeArray; + +vec4 doSwizzle() +{ + // OpImageSampleImplicitLod + vec4 c = texture(tex1d, 0.0); + c = texture(tex2d, vec2(0.0, 0.0)); + c = texture(tex3d, vec3(0.0, 0.0, 0.0)); + c = texture(texCube, vec3(0.0, 0.0, 0.0)); + c = texture(tex2dArray, vec3(0.0, 0.0, 0.0)); + c = texture(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0)); + + // OpImageSampleDrefImplicitLod + c.r = texture(depth2d, vec3(0.0, 0.0, 1.0)); + c.r = texture(depthCube, vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(depth2dArray, vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(depthCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 1.0); + + // OpImageSampleProjImplicitLod + c = textureProj(tex1d, vec2(0.0, 1.0)); + c = textureProj(tex2d, vec3(0.0, 0.0, 1.0)); + c = textureProj(tex3d, vec4(0.0, 0.0, 0.0, 1.0)); + + // OpImageSampleProjDrefImplicitLod + c.r = textureProj(depth2d, vec4(0.0, 0.0, 1.0, 1.0)); + + // OpImageSampleExplicitLod + c = textureLod(tex1d, 0.0, 0.0); + c = textureLod(tex2d, vec2(0.0, 0.0), 0.0); + c = textureLod(tex3d, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCube, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(tex2dArray, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 0.0); + + // OpImageSampleDrefExplicitLod + c.r = textureLod(depth2d, vec3(0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjExplicitLod + c = textureProjLod(tex1d, vec2(0.0, 1.0), 0.0); + c = textureProjLod(tex2d, vec3(0.0, 0.0, 1.0), 0.0); + c = textureProjLod(tex3d, vec4(0.0, 0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjDrefExplicitLod + c.r = textureProjLod(depth2d, vec4(0.0, 0.0, 1.0, 1.0), 0.0); + + // OpImageFetch + c = texelFetch(tex1d, 0, 0); + c = texelFetch(tex2d, ivec2(0, 0), 0); + c = texelFetch(tex3d, ivec3(0, 0, 0), 0); + c = texelFetch(tex2dArray, ivec3(0, 0, 0), 0); + + // Show that this transformation doesn't apply to Buffer images. + c = texelFetch(texBuffer, 0); + + // OpImageGather + c = textureGather(tex2d, vec2(0.0, 0.0), 0); + c = textureGather(texCube, vec3(0.0, 0.0, 0.0), 1); + c = textureGather(tex2dArray, vec3(0.0, 0.0, 0.0), 2); + c = textureGather(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 3); + + // OpImageDrefGather + c = textureGather(depth2d, vec2(0.0, 0.0), 1.0); + c = textureGather(depthCube, vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(depth2dArray, vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(depthCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 1.0); + + return c; +} + +void main() +{ + vec4 c = doSwizzle(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag new file mode 100644 index 0000000000..5f0acf65fd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag @@ -0,0 +1,53 @@ +#version 450 + +layout(binding = 0) uniform usampler1D tex1d; +layout(binding = 1) uniform usampler2D tex2d; +layout(binding = 2) uniform usampler3D tex3d; +layout(binding = 3) uniform usamplerCube texCube; +layout(binding = 4) uniform usampler2DArray tex2dArray; +layout(binding = 5) uniform usamplerCubeArray texCubeArray; +layout(binding = 6) uniform usamplerBuffer texBuffer; + +void main() +{ + // OpImageSampleImplicitLod + vec4 c = texture(tex1d, 0.0); + c = texture(tex2d, vec2(0.0, 0.0)); + c = texture(tex3d, vec3(0.0, 0.0, 0.0)); + c = texture(texCube, vec3(0.0, 0.0, 0.0)); + c = texture(tex2dArray, vec3(0.0, 0.0, 0.0)); + c = texture(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0)); + + // OpImageSampleProjImplicitLod + c = textureProj(tex1d, vec2(0.0, 1.0)); + c = textureProj(tex2d, vec3(0.0, 0.0, 1.0)); + c = textureProj(tex3d, vec4(0.0, 0.0, 0.0, 1.0)); + + // OpImageSampleExplicitLod + c = textureLod(tex1d, 0.0, 0.0); + c = textureLod(tex2d, vec2(0.0, 0.0), 0.0); + c = textureLod(tex3d, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCube, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(tex2dArray, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 0.0); + + // OpImageSampleProjExplicitLod + c = textureProjLod(tex1d, vec2(0.0, 1.0), 0.0); + c = textureProjLod(tex2d, vec3(0.0, 0.0, 1.0), 0.0); + c = textureProjLod(tex3d, vec4(0.0, 0.0, 0.0, 1.0), 0.0); + + // OpImageFetch + c = texelFetch(tex1d, 0, 0); + c = texelFetch(tex2d, ivec2(0, 0), 0); + c = texelFetch(tex3d, ivec3(0, 0, 0), 0); + c = texelFetch(tex2dArray, ivec3(0, 0, 0), 0); + + // Show that this transformation doesn't apply to Buffer images. + c = texelFetch(texBuffer, 0); + + // OpImageGather + c = textureGather(tex2d, vec2(0.0, 0.0), 0); + c = textureGather(texCube, vec3(0.0, 0.0, 0.0), 1); + c = textureGather(tex2dArray, vec3(0.0, 0.0, 0.0), 2); + c = textureGather(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 3); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access.swizzle.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access.swizzle.frag new file mode 100644 index 0000000000..b09ebed77e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-access.swizzle.frag @@ -0,0 +1,79 @@ +#version 450 + +layout(binding = 0) uniform sampler1D tex1d; +layout(binding = 1) uniform sampler2D tex2d; +layout(binding = 2) uniform sampler3D tex3d; +layout(binding = 3) uniform samplerCube texCube; +layout(binding = 4) uniform sampler2DArray tex2dArray; +layout(binding = 5) uniform samplerCubeArray texCubeArray; +layout(binding = 6) uniform samplerBuffer texBuffer; + +layout(binding = 7) uniform sampler2DShadow depth2d; +layout(binding = 8) uniform samplerCubeShadow depthCube; +layout(binding = 9) uniform sampler2DArrayShadow depth2dArray; +layout(binding = 10) uniform samplerCubeArrayShadow depthCubeArray; + +void main() +{ + // OpImageSampleImplicitLod + vec4 c = texture(tex1d, 0.0); + c = texture(tex2d, vec2(0.0, 0.0)); + c = texture(tex3d, vec3(0.0, 0.0, 0.0)); + c = texture(texCube, vec3(0.0, 0.0, 0.0)); + c = texture(tex2dArray, vec3(0.0, 0.0, 0.0)); + c = texture(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0)); + + // OpImageSampleDrefImplicitLod + c.r = texture(depth2d, vec3(0.0, 0.0, 1.0)); + c.r = texture(depthCube, vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(depth2dArray, vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(depthCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 1.0); + + // OpImageSampleProjImplicitLod + c = textureProj(tex1d, vec2(0.0, 1.0)); + c = textureProj(tex2d, vec3(0.0, 0.0, 1.0)); + c = textureProj(tex3d, vec4(0.0, 0.0, 0.0, 1.0)); + + // OpImageSampleProjDrefImplicitLod + c.r = textureProj(depth2d, vec4(0.0, 0.0, 1.0, 1.0)); + + // OpImageSampleExplicitLod + c = textureLod(tex1d, 0.0, 0.0); + c = textureLod(tex2d, vec2(0.0, 0.0), 0.0); + c = textureLod(tex3d, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCube, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(tex2dArray, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 0.0); + + // OpImageSampleDrefExplicitLod + c.r = textureLod(depth2d, vec3(0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjExplicitLod + c = textureProjLod(tex1d, vec2(0.0, 1.0), 0.0); + c = textureProjLod(tex2d, vec3(0.0, 0.0, 1.0), 0.0); + c = textureProjLod(tex3d, vec4(0.0, 0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjDrefExplicitLod + c.r = textureProjLod(depth2d, vec4(0.0, 0.0, 1.0, 1.0), 0.0); + + // OpImageFetch + c = texelFetch(tex1d, 0, 0); + c = texelFetch(tex2d, ivec2(0, 0), 0); + c = texelFetch(tex3d, ivec3(0, 0, 0), 0); + c = texelFetch(tex2dArray, ivec3(0, 0, 0), 0); + + // Show that this transformation doesn't apply to Buffer images. + c = texelFetch(texBuffer, 0); + + // OpImageGather + c = textureGather(tex2d, vec2(0.0, 0.0), 0); + c = textureGather(texCube, vec3(0.0, 0.0, 0.0), 1); + c = textureGather(tex2dArray, vec3(0.0, 0.0, 0.0), 2); + c = textureGather(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 3); + + // OpImageDrefGather + c = textureGather(depth2d, vec2(0.0, 0.0), 1.0); + c = textureGather(depthCube, vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(depth2dArray, vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(depthCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..b4d9509ab4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamp "uSamp" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uSamp + %18 = OpLoad %v2float %vUV + %21 = OpImageGather %v4float %14 %18 %int_1 + OpStore %FragColor %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag new file mode 100644 index 0000000000..f3cf0e190d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.argument.msl2.frag @@ -0,0 +1,18 @@ +#version 450 + +struct Foo +{ + vec4 v; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + Foo foo; +} ubos[2]; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ubos[1].foo.v; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag new file mode 100644 index 0000000000..f3cf0e190d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-array-multiple-structs-access-chain.frag @@ -0,0 +1,18 @@ +#version 450 + +struct Foo +{ + vec4 v; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + Foo foo; +} ubos[2]; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = ubos[1].foo.v; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag new file mode 100644 index 0000000000..77760522f9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/ubo-offset-out-of-order.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform UBO +{ + layout(offset = 16) mat4 m; + layout(offset = 0) vec4 v; +}; + +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = m * vColor + v; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..41da8001f4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +int uninit_int; +ivec4 uninit_vector; +mat4 uninit_matrix; + +struct Foo { int a; }; +Foo uninit_foo; + +void main() +{ + int uninit_function_int; + if (vColor.x > 10.0) + uninit_function_int = 10; + else + uninit_function_int = 20; + FragColor = vColor; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag b/third_party/spirv-cross/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag new file mode 100644 index 0000000000..9a8d9d20b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/frag/volatile-helper-invocation.msl23.spv16.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(gl_HelperInvocation); + demote; + FragColor = float(gl_HelperInvocation); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec3.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec3.comp new file mode 100644 index 0000000000..6157212222 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec3.comp @@ -0,0 +1,13 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, scalar) buffer SSBO +{ + vec3 v[16]; +}; + +void main() +{ + v[1] = v[0]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec4.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec4.comp new file mode 100644 index 0000000000..c5bf5e8a3f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/array-of-vec4.comp @@ -0,0 +1,13 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, scalar) buffer SSBO +{ + vec4 v[16]; +}; + +void main() +{ + v[1] = v[0]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/isolated-scalar-access.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/isolated-scalar-access.comp new file mode 100644 index 0000000000..32c9288993 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/isolated-scalar-access.comp @@ -0,0 +1,25 @@ +#version 450 + +layout(set = 0, binding = 0) buffer SSBO +{ + vec4 v; + mat4 cm; + layout(row_major) mat4 rm; + + vec3 v3; + float f; +}; + +shared vec4 shared_vec4; +shared vec3 shared_vec3; + +void main() +{ + v.x = 10.0; + v3.y = 40.0; + cm[1][2] = 20.0; + rm[3][1] = 30.0; + + shared_vec4.z = 40.0; + shared_vec3.y = 1.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/load-store-col-rows.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/load-store-col-rows.comp new file mode 100644 index 0000000000..b3f2897034 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/load-store-col-rows.comp @@ -0,0 +1,59 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +layout(binding = 0, std140) buffer SSBO1 +{ + mat2 a; + layout(row_major) mat2 a2; +}; + +layout(scalar, binding = 1) buffer SSBO2 +{ + mat2x3 b; + layout(row_major) mat3x2 b2; +}; + +void load_store_column() +{ + vec2 u = a[0]; + vec2 v = a[1]; + u += v; + a[0] = u; + a[1] = v; +} + +void load_store_row() +{ + vec2 u = a2[0]; + vec2 v = a2[1]; + u += v; + a2[0] = u; + a2[1] = v; +} + +void load_store_packed_column() +{ + vec3 u = b[0]; + vec3 v = b[1]; + u += v; + b[0] = u; + b[1] = v; +} + +void load_store_packed_row() +{ + vec2 u = b2[0]; + vec2 v = b2[1]; + u += v; + b2[0] = u; + b2[1] = v; +} + +void main() +{ + load_store_column(); + load_store_row(); + load_store_packed_column(); + load_store_packed_row(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp new file mode 100644 index 0000000000..6a94c86ac0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat2 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std140.comp new file mode 100644 index 0000000000..3940e5c3b9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std430.comp new file mode 100644 index 0000000000..342c3989ca --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x2-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp new file mode 100644 index 0000000000..cf40f89a05 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat2x3 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std140.comp new file mode 100644 index 0000000000..6fbe149d1f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2x3 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std430.comp new file mode 100644 index 0000000000..36a6bab145 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x3-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2x3 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp new file mode 100644 index 0000000000..70fa4748d8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat2x4 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std140.comp new file mode 100644 index 0000000000..6c5d06fe51 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2x4 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std430.comp new file mode 100644 index 0000000000..177b966940 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-2x4-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat2x4 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp new file mode 100644 index 0000000000..296efa673c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat3x2 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std140.comp new file mode 100644 index 0000000000..1334c4eae7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3x2 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std430.comp new file mode 100644 index 0000000000..fe82993ddb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x2-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3x2 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp new file mode 100644 index 0000000000..0741384ea2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat3 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std140.comp new file mode 100644 index 0000000000..0de5d599c1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std430.comp new file mode 100644 index 0000000000..8e48109e93 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x3-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp new file mode 100644 index 0000000000..23297d5c63 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat3x4 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std140.comp new file mode 100644 index 0000000000..11135eeccf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3x4 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std430.comp new file mode 100644 index 0000000000..78c577f2ef --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-3x4-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat3x4 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp new file mode 100644 index 0000000000..412c208148 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat4x2 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std140.comp new file mode 100644 index 0000000000..e130cb0a46 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4x2 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std430.comp new file mode 100644 index 0000000000..76aa9ae4a6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x2-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4x2 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp new file mode 100644 index 0000000000..8468b289cd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat4x3 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std140.comp new file mode 100644 index 0000000000..8223eae49f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4x3 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std430.comp new file mode 100644 index 0000000000..aa4d685cf9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x3-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4x3 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp new file mode 100644 index 0000000000..6f14c07311 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp @@ -0,0 +1,86 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +#define T mat4 +#define PACKING scalar + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std140.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std140.comp new file mode 100644 index 0000000000..45193b3257 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std140.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4 +#define PACKING std140 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std430.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std430.comp new file mode 100644 index 0000000000..3a1eb9f020 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-4x4-std430.comp @@ -0,0 +1,85 @@ +#version 450 +layout(local_size_x = 1) in; + +#define T mat4 +#define PACKING std430 + +layout(set = 0, binding = 0, PACKING) buffer SSBOCol +{ + layout(column_major) T col_major0; + layout(column_major) T col_major1; +}; + +layout(set = 0, binding = 1, PACKING) buffer SSBORow +{ + layout(row_major) T row_major0; + layout(row_major) T row_major1; +}; + +void load_store_to_variable_col_major() +{ + // Load to variable. + T loaded = col_major0; + + // Store from variable. + col_major1 = loaded; +} + +void load_store_to_variable_row_major() +{ + // Load to variable. + T loaded = row_major0; + + // Store to variable. + row_major0 = loaded; +} + +void copy_col_major_to_col_major() +{ + // Copy col -> col + col_major0 = col_major1; +} + +void copy_row_major_to_col_major() +{ + // Copy row -> col + col_major0 = row_major0; +} + +void copy_col_major_to_row_major() +{ + // Copy col -> row + row_major0 = col_major0; +} + +void copy_row_major_to_row_major() +{ + // Copy row -> row + row_major0 = row_major1; +} + +void copy_columns() +{ + // Copy columns/rows. + col_major0[1] = row_major0[1]; + row_major0[1] = col_major0[1]; +} + +void copy_elements() +{ + // Copy individual elements. + col_major0[0][1] = row_major0[0][1]; + row_major0[0][1] = col_major0[0][1]; +} + +void main() +{ + load_store_to_variable_col_major(); + load_store_to_variable_row_major(); + copy_col_major_to_col_major(); + copy_col_major_to_row_major(); + copy_row_major_to_col_major(); + copy_row_major_to_row_major(); + copy_columns(); + copy_elements(); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp new file mode 100644 index 0000000000..9b7b9fc37e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-row-major.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(row_major, set = 0, binding = 0) buffer SSBO +{ + mat3 m0; + mat3 m1; + vec3 v0; + vec3 v1; +}; + +void main() +{ + v0 = (m0 * m1) * v1; + v0 = m0 * (m1 * v1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp new file mode 100644 index 0000000000..cd77d242a6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major-2.comp @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +layout(scalar, set = 0, binding = 0) buffer SSBO +{ + mat3 m0; + mat3 m1; + vec3 v0; + vec3 v1; +}; + +void main() +{ + v0 = (m0 * m1) * v1; + v0 = m0 * (m1 * v1); + v0 = (v1 * m0) * m1; + v0 = v1 * (m0 * m1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp new file mode 100644 index 0000000000..847d2e8f60 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-col-major.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + mat2 m0; + mat2 m1; + vec2 v0; + vec2 v1; +}; + +void main() +{ + v0 = (m0 * m1) * v1; + v0 = m0 * (m1 * v1); + v0 = (v1 * m0) * m1; + v0 = v1 * (m0 * m1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp new file mode 100644 index 0000000000..60a3da0aa3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major-2.comp @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +layout(scalar, row_major, set = 0, binding = 0) buffer SSBO +{ + mat3 m0; + mat3 m1; + vec3 v0; + vec3 v1; +}; + +void main() +{ + v0 = (m0 * m1) * v1; + v0 = m0 * (m1 * v1); + v0 = (v1 * m0) * m1; + v0 = v1 * (m0 * m1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp new file mode 100644 index 0000000000..5b71ae9bc7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/matrix-multiply-unpacked-row-major.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, row_major, set = 0, binding = 0) buffer SSBO +{ + mat2 m0; + mat2 m1; + vec2 v0; + vec2 v1; +}; + +void main() +{ + v0 = (m0 * m1) * v1; + v0 = m0 * (m1 * v1); + v0 = (v1 * m0) * m1; + v0 = v1 * (m0 * m1); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/member-padding.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/member-padding.comp new file mode 100644 index 0000000000..a413662f38 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/member-padding.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + layout(offset = 16) float a; + layout(offset = 40) float b; +}; + +void main() +{ + a = 10.0; + b = 20.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/std140-array-of-vectors.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/std140-array-of-vectors.comp new file mode 100644 index 0000000000..260a49810a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/std140-array-of-vectors.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + float v1[4]; + vec2 v2[4]; + vec3 v3[4]; + vec4 v4[4]; + + float v1_array_of_array[4][4]; + vec2 v2_array_of_array[4][4]; + vec3 v3_array_of_array[4][4]; + vec4 v4_array_of_array[4][4]; + + float v_unsized[]; +}; + +void main() +{ + float loaded1 = v1[1]; + v1[2] = loaded1; + + vec2 loaded2 = v2[1]; + v2[2] = loaded2; + + vec3 loaded3 = v3[1]; + v3[2] = loaded3; + + vec4 loaded4 = v4[1]; + v4[2] = loaded4; + + loaded1 = v1_array_of_array[1][2]; + v1_array_of_array[2][3] = loaded1; + + loaded2 = v2_array_of_array[1][2]; + v2_array_of_array[2][3] = loaded2; + + loaded3 = v3_array_of_array[1][2]; + v3_array_of_array[2][3] = loaded3; + + loaded4 = v4_array_of_array[1][2]; + v4_array_of_array[2][3] = loaded4; + + loaded1 = v_unsized[1]; + v_unsized[2] = loaded1; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-alignment.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-alignment.comp new file mode 100644 index 0000000000..f9f58b7327 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-alignment.comp @@ -0,0 +1,22 @@ +#version 450 +layout(local_size_x = 1) in; + +struct Foo +{ + vec3 a; // <- This one should become packed_float3, and the MSL alignment of the struct is now 4. + float b; +}; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + vec2 a; + float b; + // <- We expect 4 bytes of padding here since MSL alignment of Foo must be lowered to 4. + Foo foo; +}; + +void main() +{ + a.x = 10.0; + b = 20.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp new file mode 100644 index 0000000000..08742d5bba --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-array-of-scalar.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +struct Foo +{ + vec3 a; +}; + +layout(scalar, set = 0, binding = 0) buffer SSBOScalar +{ + Foo v[]; +} buffer_scalar; + +void main() +{ + buffer_scalar.v[1].a.y = 1.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-recursive.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-recursive.comp new file mode 100644 index 0000000000..c3281b9ce0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing-recursive.comp @@ -0,0 +1,29 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +struct Foo +{ + vec4 a; +}; + +struct Bar +{ + Foo a; +}; + +struct Baz +{ + Bar a; +}; + +layout(scalar, set = 0, binding = 0) buffer SSBOScalar +{ + float v; + Baz baz; +} buffer_scalar; + +void main() +{ + buffer_scalar.baz.a.a.a.a.x = 10.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing.comp new file mode 100644 index 0000000000..69a80382e4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-packing.comp @@ -0,0 +1,27 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 1) in; + +// Foo will be marked packed_float3 because offset of bar is just 12 bytes after foo. +struct Foo +{ + vec3 a; +}; + +// Bar will be marked as packed due to alignment of the struct itself cannot work without packed. +struct Bar +{ + vec3 a; +}; + +layout(scalar, set = 0, binding = 0) buffer SSBOScalar +{ + Foo foo; + Bar bar; +} buffer_scalar; + +void main() +{ + buffer_scalar.foo.a.x = 10.0; + buffer_scalar.bar.a.x = 20.0; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp new file mode 100644 index 0000000000..ef1ba65cf4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding-array-of-array.comp @@ -0,0 +1,45 @@ +#version 450 +layout(local_size_x = 1) in; + +struct A +{ + float v; +}; + +struct B +{ + vec2 v; +}; + +struct C +{ + vec3 v; +}; + +struct D +{ + vec4 v; +}; + +struct E +{ + vec4 a; + vec2 b; +}; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + A a[2][4]; + B b[2][4]; + C c[2][4]; + D d[2][4]; + mat2 e[2][4]; + E f[]; +}; + +void main() +{ + f[0].a = vec4(2.0); + mat2 tmp = e[0][1]; + e[1][2] = tmp; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding.comp b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding.comp new file mode 100644 index 0000000000..ad65415baf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/packing/struct-size-padding.comp @@ -0,0 +1,45 @@ +#version 450 +layout(local_size_x = 1) in; + +struct A +{ + float v; +}; + +struct B +{ + vec2 v; +}; + +struct C +{ + vec3 v; +}; + +struct D +{ + vec4 v; +}; + +struct E +{ + vec4 a; + vec2 b; +}; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + A a[4]; + B b[4]; + C c[4]; + D d[4]; + mat2 e[4]; + E f[]; +}; + +void main() +{ + f[0].a = vec4(2.0); + mat2 tmp = e[1]; + e[2] = tmp; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/tesc/copy-tess-level.tesc b/third_party/spirv-cross/shaders-msl-no-opt/tesc/copy-tess-level.tesc new file mode 100644 index 0000000000..7510ff8f67 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/tesc/copy-tess-level.tesc @@ -0,0 +1,12 @@ +#version 450 +layout(vertices = 1) out; + +void main() +{ + gl_TessLevelInner = float[](1.0, 2.0); + gl_TessLevelOuter = float[](1.0, 2.0, 3.0, 4.0); + + float inner[2] = gl_TessLevelInner; + float outer[4] = gl_TessLevelOuter; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc b/third_party/spirv-cross/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc new file mode 100644 index 0000000000..16b60e495a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/tesc/passthrough-clip-cull.multi-patch.tesc @@ -0,0 +1,22 @@ +#version 450 + +layout(vertices = 4) out; + +in gl_PerVertex +{ + float gl_ClipDistance[2]; + float gl_CullDistance[1]; +} gl_in[]; + +out gl_PerVertex +{ + float gl_ClipDistance[2]; + float gl_CullDistance[1]; +} gl_out[]; + +void main() +{ + gl_out[gl_InvocationID].gl_ClipDistance[0] = gl_in[gl_InvocationID].gl_ClipDistance[0]; + gl_out[gl_InvocationID].gl_ClipDistance[1] = gl_in[gl_InvocationID].gl_ClipDistance[1]; + gl_out[gl_InvocationID].gl_CullDistance[0] = gl_in[gl_InvocationID].gl_CullDistance[0]; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc b/third_party/spirv-cross/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc new file mode 100644 index 0000000000..4ccfa28267 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/tesc/tess-level-read-write-in-function-quad.tesc @@ -0,0 +1,24 @@ +#version 450 +layout(vertices = 1) out; + +float load_tess_level_in_func() +{ + return gl_TessLevelInner[0] + gl_TessLevelOuter[1]; +} + +void store_tess_level_in_func() +{ + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 2.0; + gl_TessLevelOuter[0] = 3.0; + gl_TessLevelOuter[1] = 4.0; + gl_TessLevelOuter[2] = 5.0; + gl_TessLevelOuter[3] = 6.0; +} + +void main() +{ + store_tess_level_in_func(); + float v = load_tess_level_in_func(); + gl_out[gl_InvocationID].gl_Position = vec4(v); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese b/third_party/spirv-cross/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese new file mode 100644 index 0000000000..1d8a50062e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/tese/builtin-input-automatic-attribute-assignment.tese @@ -0,0 +1,10 @@ +#version 450 +layout(quads) in; + +layout(location = 0) patch in vec4 FragColor; +layout(location = 2) in vec4 FragColors[]; + +void main() +{ + gl_Position = vec4(1.0) + FragColor + FragColors[0] + FragColors[1] + gl_TessLevelInner[0] + gl_TessLevelOuter[gl_PrimitiveID & 1] + gl_in[0].gl_Position; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese b/third_party/spirv-cross/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese new file mode 100644 index 0000000000..e86619e1a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/tese/load-clip-cull.msl2.tese @@ -0,0 +1,19 @@ +#version 450 +layout(quads) in; + +in gl_PerVertex +{ + float gl_ClipDistance[2]; + float gl_CullDistance[3]; + vec4 gl_Position; +} gl_in[]; + +void main() +{ + gl_Position.x = gl_in[0].gl_ClipDistance[0]; + gl_Position.y = gl_in[1].gl_CullDistance[0]; + gl_Position.z = gl_in[0].gl_ClipDistance[1]; + gl_Position.w = gl_in[1].gl_CullDistance[1]; + gl_Position += gl_in[0].gl_Position; + gl_Position += gl_in[1].gl_Position; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/cull-distance.for-tess.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/cull-distance.for-tess.vert new file mode 100644 index 0000000000..8df181cdb3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/cull-distance.for-tess.vert @@ -0,0 +1,10 @@ +#version 450 + +out float gl_CullDistance[2]; + +void main() +{ + gl_CullDistance[0] = 1.0; + gl_CullDistance[1] = 3.0; + gl_Position = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/functions_nested.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/functions_nested.vert new file mode 100644 index 0000000000..2eec5ac551 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/functions_nested.vert @@ -0,0 +1,132 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable + +layout(std140, set = 0, binding = 0) uniform VertexBuffer +{ + mat4 scale_offset_mat; + uint vertex_base_index; + ivec4 input_attributes[16]; +}; +layout(set=0, binding=3) uniform usamplerBuffer buff_in_1; +layout(set=0, binding=4) uniform usamplerBuffer buff_in_2; + +layout(location=10) out vec4 back_color; +layout(location=0) out vec4 tc0; + +layout(std140, set=0, binding = 1) uniform VertexConstantsBuffer +{ + vec4 vc[16]; +}; + +struct attr_desc +{ + int type; + int attribute_size; + int starting_offset; + int stride; + int swap_bytes; + int is_volatile; +}; + +uint get_bits(uvec4 v, int swap) +{ + if (swap != 0) return (v.w | v.z << 8 | v.y << 16 | v.x << 24); + return (v.x | v.y << 8 | v.z << 16 | v.w << 24); +} + +vec4 fetch_attr(attr_desc desc, int vertex_id, usamplerBuffer input_stream) +{ + vec4 result = vec4(0.0f, 0.0f, 0.0f, 1.0f); + uvec4 tmp; + uint bits; + bool reverse_order = false; + + int first_byte = (vertex_id * desc.stride) + desc.starting_offset; + for (int n = 0; n < 4; n++) + { + if (n == desc.attribute_size) break; + + switch (desc.type) + { + case 0: + //signed normalized 16-bit + tmp.x = texelFetch(input_stream, first_byte++).x; + tmp.y = texelFetch(input_stream, first_byte++).x; + result[n] = get_bits(tmp, desc.swap_bytes); + break; + case 1: + //float + tmp.x = texelFetch(input_stream, first_byte++).x; + tmp.y = texelFetch(input_stream, first_byte++).x; + tmp.z = texelFetch(input_stream, first_byte++).x; + tmp.w = texelFetch(input_stream, first_byte++).x; + result[n] = uintBitsToFloat(get_bits(tmp, desc.swap_bytes)); + break; + case 2: + //unsigned byte + result[n] = texelFetch(input_stream, first_byte++).x; + reverse_order = (desc.swap_bytes != 0); + break; + } + } + + return (reverse_order)? result.wzyx: result; +} + +attr_desc fetch_desc(int location) +{ + attr_desc result; + int attribute_flags = input_attributes[location].w; + result.type = input_attributes[location].x; + result.attribute_size = input_attributes[location].y; + result.starting_offset = input_attributes[location].z; + result.stride = attribute_flags & 0xFF; + result.swap_bytes = (attribute_flags >> 8) & 0x1; + result.is_volatile = (attribute_flags >> 9) & 0x1; + return result; +} + +vec4 read_location(int location) +{ + attr_desc desc = fetch_desc(location); + + int vertex_id = gl_VertexIndex - int(vertex_base_index); + if (desc.is_volatile != 0) + return fetch_attr(desc, vertex_id, buff_in_2); + else + return fetch_attr(desc, vertex_id, buff_in_1); +} + +void vs_adjust(inout vec4 dst_reg0, inout vec4 dst_reg1, inout vec4 dst_reg7) +{ + vec4 tmp0; + vec4 tmp1; + vec4 in_diff_color= read_location(3); + vec4 in_pos= read_location(0); + vec4 in_tc0= read_location(8); + dst_reg1 = (in_diff_color * vc[13]); + tmp0.x = vec4(dot(vec4(in_pos.xyzx.xyz, 1.0), vc[4])).x; + tmp0.y = vec4(dot(vec4(in_pos.xyzx.xyz, 1.0), vc[5])).y; + tmp0.z = vec4(dot(vec4(in_pos.xyzx.xyz, 1.0), vc[6])).z; + tmp1.xy = in_tc0.xyxx.xy; + tmp1.z = vc[15].xxxx.z; + dst_reg7.y = vec4(dot(vec4(tmp1.xyzx.xyz, 1.0), vc[8])).y; + dst_reg7.x = vec4(dot(vec4(tmp1.xyzx.xyz, 1.0), vc[7])).x; + dst_reg0.y = vec4(dot(vec4(tmp0.xyzx.xyz, 1.0), vc[1])).y; + dst_reg0.x = vec4(dot(vec4(tmp0.xyzx.xyz, 1.0), vc[0])).x; +} + +void main () +{ + vec4 dst_reg0= vec4(0.0f, 0.0f, 0.0f, 1.0f); + vec4 dst_reg1= vec4(0.0, 0.0, 0.0, 0.0); + vec4 dst_reg7= vec4(0.0, 0.0, 0.0, 0.0); + + vs_adjust(dst_reg0, dst_reg1, dst_reg7); + + gl_Position = dst_reg0; + back_color = dst_reg1; + tc0 = dst_reg7; + gl_Position = gl_Position * scale_offset_mat; +} + diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/layer.msl11.invalid.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/layer.msl11.invalid.vert new file mode 100644 index 0000000000..73b918c80e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/layer.msl11.invalid.vert @@ -0,0 +1,10 @@ +#version 450 +#extension GL_ARB_shader_viewport_layer_array : require + +layout(location = 0) in vec4 coord; + +void main() +{ + gl_Position = coord; + gl_Layer = int(coord.z); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/modf-storage-class.capture.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/modf-storage-class.capture.vert new file mode 100644 index 0000000000..447c4975d9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/modf-storage-class.capture.vert @@ -0,0 +1,9 @@ +#version 450 + +layout(location = 0) out vec4 f; +layout(location = 0) in vec4 f2; + +void main() +{ + gl_Position = modf(f2, f); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert new file mode 100644 index 0000000000..2c142a7810 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.force-native-array.vert @@ -0,0 +1,26 @@ +#version 310 es + +layout(location = 0) in int Index1; +layout(location = 1) in int Index2; + +vec4 consume_constant_arrays2(const vec4 positions[4], const vec4 positions2[4]) +{ + return positions[Index1] + positions2[Index2]; +} + +vec4 consume_constant_arrays(const vec4 positions[4], const vec4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +const vec4 LUT1[] = vec4[](vec4(0.0), vec4(1.0), vec4(2.0), vec4(3.0)); + +void main() +{ + vec4 LUT2[4]; + LUT2[0] = vec4(10.0); + LUT2[1] = vec4(11.0); + LUT2[2] = vec4(12.0); + LUT2[3] = vec4(13.0); + gl_Position = consume_constant_arrays(LUT1, LUT2); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..2c142a7810 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,26 @@ +#version 310 es + +layout(location = 0) in int Index1; +layout(location = 1) in int Index2; + +vec4 consume_constant_arrays2(const vec4 positions[4], const vec4 positions2[4]) +{ + return positions[Index1] + positions2[Index2]; +} + +vec4 consume_constant_arrays(const vec4 positions[4], const vec4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +const vec4 LUT1[] = vec4[](vec4(0.0), vec4(1.0), vec4(2.0), vec4(3.0)); + +void main() +{ + vec4 LUT2[4]; + LUT2[0] = vec4(10.0); + LUT2[1] = vec4(11.0); + LUT2[2] = vec4(12.0); + LUT2[3] = vec4(13.0); + gl_Position = consume_constant_arrays(LUT1, LUT2); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert new file mode 100644 index 0000000000..54c7afd07a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/uninitialized-vertex-output.vert @@ -0,0 +1,8 @@ +#version 450 + +layout(location = 0) out vec4 Pos; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert new file mode 100644 index 0000000000..4ec228df29 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/unused-subgroup-builtin.msl22.vert @@ -0,0 +1,7 @@ +#version 450 +#extension GL_KHR_shader_subgroup_ballot : require + +void main() +{ + gl_SubgroupEqMask; +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert b/third_party/spirv-cross/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert new file mode 100644 index 0000000000..c05c104848 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vert/viewport-index.msl2.invalid.vert @@ -0,0 +1,10 @@ +#version 450 +#extension GL_ARB_shader_viewport_layer_array : require + +layout(location = 0) in vec4 coord; + +void main() +{ + gl_Position = coord; + gl_ViewportIndex = int(coord.z); +} diff --git a/third_party/spirv-cross/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag b/third_party/spirv-cross/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag new file mode 100644 index 0000000000..91f0866551 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag @@ -0,0 +1,90 @@ +#version 450 + +layout(binding = 0) uniform sampler1D tex1d; +layout(binding = 1) uniform texture2D tex2d; +layout(binding = 2) uniform sampler3D tex3d; +layout(binding = 3) uniform textureCube texCube; +layout(binding = 4) uniform sampler2DArray tex2dArray; +layout(binding = 5) uniform samplerCubeArray texCubeArray; +layout(binding = 6) uniform samplerBuffer texBuffer; + +layout(binding = 7) uniform sampler2DShadow depth2d; +layout(binding = 8) uniform samplerCubeShadow depthCube; +layout(binding = 9) uniform texture2DArray depth2dArray; +layout(binding = 10) uniform samplerCubeArrayShadow depthCubeArray; + +layout(binding = 11) uniform sampler defaultSampler; +layout(binding = 12) uniform samplerShadow shadowSampler; + +layout(location = 0) out vec4 fragColor; + +vec4 do_samples(sampler1D t1, texture2D t2, sampler3D t3, textureCube tc, sampler2DArray t2a, samplerCubeArray tca, samplerBuffer tb, sampler2DShadow d2, samplerCubeShadow dc, texture2DArray d2a, samplerCubeArrayShadow dca) +{ + // OpImageSampleImplicitLod + vec4 c = texture(t1, 0.0); + c = texture(sampler2D(t2, defaultSampler), vec2(0.0, 0.0)); + c = texture(t3, vec3(0.0, 0.0, 0.0)); + c = texture(samplerCube(tc, defaultSampler), vec3(0.0, 0.0, 0.0)); + c = texture(t2a, vec3(0.0, 0.0, 0.0)); + c = texture(tca, vec4(0.0, 0.0, 0.0, 0.0)); + + // OpImageSampleDrefImplicitLod + c.r = texture(d2, vec3(0.0, 0.0, 1.0)); + c.r = texture(dc, vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(sampler2DArrayShadow(d2a, shadowSampler), vec4(0.0, 0.0, 0.0, 1.0)); + c.r = texture(dca, vec4(0.0, 0.0, 0.0, 0.0), 1.0); + + // OpImageSampleProjImplicitLod + c = textureProj(t1, vec2(0.0, 1.0)); + c = textureProj(sampler2D(t2, defaultSampler), vec3(0.0, 0.0, 1.0)); + c = textureProj(t3, vec4(0.0, 0.0, 0.0, 1.0)); + + // OpImageSampleProjDrefImplicitLod + c.r = textureProj(d2, vec4(0.0, 0.0, 1.0, 1.0)); + + // OpImageSampleExplicitLod + c = textureLod(t1, 0.0, 0.0); + c = textureLod(sampler2D(t2, defaultSampler), vec2(0.0, 0.0), 0.0); + c = textureLod(t3, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(samplerCube(tc, defaultSampler), vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(t2a, vec3(0.0, 0.0, 0.0), 0.0); + c = textureLod(tca, vec4(0.0, 0.0, 0.0, 0.0), 0.0); + + // OpImageSampleDrefExplicitLod + c.r = textureLod(d2, vec3(0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjExplicitLod + c = textureProjLod(t1, vec2(0.0, 1.0), 0.0); + c = textureProjLod(sampler2D(t2, defaultSampler), vec3(0.0, 0.0, 1.0), 0.0); + c = textureProjLod(t3, vec4(0.0, 0.0, 0.0, 1.0), 0.0); + + // OpImageSampleProjDrefExplicitLod + c.r = textureProjLod(d2, vec4(0.0, 0.0, 1.0, 1.0), 0.0); + + // OpImageFetch + c = texelFetch(t1, 0, 0); + c = texelFetch(sampler2D(t2, defaultSampler), ivec2(0, 0), 0); + c = texelFetch(t3, ivec3(0, 0, 0), 0); + c = texelFetch(t2a, ivec3(0, 0, 0), 0); + + // Show that this transformation doesn't apply to Buffer images. + c = texelFetch(tb, 0); + + // OpImageGather + c = textureGather(sampler2D(t2, defaultSampler), vec2(0.0, 0.0), 0); + c = textureGather(samplerCube(tc, defaultSampler), vec3(0.0, 0.0, 0.0), 1); + c = textureGather(t2a, vec3(0.0, 0.0, 0.0), 2); + c = textureGather(tca, vec4(0.0, 0.0, 0.0, 0.0), 3); + + // OpImageDrefGather + c = textureGather(d2, vec2(0.0, 0.0), 1.0); + c = textureGather(dc, vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(sampler2DArrayShadow(d2a, shadowSampler), vec3(0.0, 0.0, 0.0), 1.0); + c = textureGather(dca, vec4(0.0, 0.0, 0.0, 0.0), 1.0); + return c; +} + +void main() +{ + fragColor = do_samples(tex1d, tex2d, tex3d, texCube, tex2dArray, texCubeArray, texBuffer, depth2d, depthCube, depth2dArray, depthCubeArray); +} diff --git a/third_party/spirv-cross/shaders-msl/amd/shader_trinary_minmax.msl21.comp b/third_party/spirv-cross/shaders-msl/amd/shader_trinary_minmax.msl21.comp new file mode 100644 index 0000000000..f836146a17 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/amd/shader_trinary_minmax.msl21.comp @@ -0,0 +1,11 @@ +#version 450 +#extension GL_AMD_shader_trinary_minmax : require + +layout (local_size_x = 64) in; + +void main () +{ + int t11 = min3(0, 3, 2); + int t12 = max3(0, 3, 2); + int t13 = mid3(0, 3, 2); +} diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..a87b931880 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 0 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIDecrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..3acb7115f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 0 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIIncrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..3b31ab2851 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of IAdd + %result_iadd_0 = OpIAdd %uvec4 %input0 %input1 + %result_iadd_1 = OpIAdd %uvec4 %input1 %input0 + %result_iadd_2 = OpIAdd %uvec4 %input0 %input0 + %result_iadd_3 = OpIAdd %uvec4 %input1 %input1 + %result_iadd_4 = OpIAdd %ivec4 %input0 %input0 + %result_iadd_5 = OpIAdd %ivec4 %input1 %input1 + %result_iadd_6 = OpIAdd %ivec4 %input0 %input1 + %result_iadd_7 = OpIAdd %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..b7b4e0b2e1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %bool = OpTypeBool + %bvec4 = OpTypeVector %bool 4 + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + %uzero = OpConstant %uint 0 + %uone = OpConstant %uint 1 + %utrue = OpConstantComposite %uvec4 %uone %uone %uone %uone + %ufalse = OpConstantComposite %uvec4 %uzero %uzero %uzero %uzero + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + + %result_slt = OpSLessThan %bvec4 %input0 %input1 + %result_sle = OpSLessThanEqual %bvec4 %input0 %input1 + %result_ult = OpULessThan %bvec4 %input0 %input1 + %result_ule = OpULessThanEqual %bvec4 %input0 %input1 + %result_sgt = OpSGreaterThan %bvec4 %input0 %input1 + %result_sge = OpSGreaterThanEqual %bvec4 %input0 %input1 + %result_ugt = OpUGreaterThan %bvec4 %input0 %input1 + %result_uge = OpUGreaterThanEqual %bvec4 %input0 %input1 + + %int_slt = OpSelect %uvec4 %result_slt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_slt + + %int_sle = OpSelect %uvec4 %result_sle %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sle + + %int_ult = OpSelect %uvec4 %result_ult %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ult + + %int_ule = OpSelect %uvec4 %result_ule %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ule + + %int_sgt = OpSelect %uvec4 %result_sgt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sgt + + %int_sge = OpSelect %uvec4 %result_sge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sge + + %int_ugt = OpSelect %uvec4 %result_ugt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ugt + + %int_uge = OpSelect %uvec4 %result_uge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_uge + + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..64f19fc349 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of ShiftRightArithmetic + %result_iadd_0 = OpShiftRightArithmetic %uvec4 %input0 %input1 + %result_iadd_1 = OpShiftRightArithmetic %uvec4 %input1 %input0 + %result_iadd_2 = OpShiftRightArithmetic %uvec4 %input0 %input0 + %result_iadd_3 = OpShiftRightArithmetic %uvec4 %input1 %input1 + %result_iadd_4 = OpShiftRightArithmetic %ivec4 %input0 %input0 + %result_iadd_5 = OpShiftRightArithmetic %ivec4 %input1 %input1 + %result_iadd_6 = OpShiftRightArithmetic %ivec4 %input0 %input1 + %result_iadd_7 = OpShiftRightArithmetic %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..ab73ec83df --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of SDiv + %result_iadd_0 = OpSDiv %uvec4 %input0 %input1 + %result_iadd_1 = OpSDiv %uvec4 %input1 %input0 + %result_iadd_2 = OpSDiv %uvec4 %input0 %input0 + %result_iadd_3 = OpSDiv %uvec4 %input1 %input1 + %result_iadd_4 = OpSDiv %ivec4 %input0 %input0 + %result_iadd_5 = OpSDiv %ivec4 %input1 %input1 + %result_iadd_6 = OpSDiv %ivec4 %input0 %input1 + %result_iadd_7 = OpSDiv %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..6741f5cb58 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of ShiftRightLogical + %result_iadd_0 = OpShiftRightLogical %uvec4 %input0 %input1 + %result_iadd_1 = OpShiftRightLogical %uvec4 %input1 %input0 + %result_iadd_2 = OpShiftRightLogical %uvec4 %input0 %input0 + %result_iadd_3 = OpShiftRightLogical %uvec4 %input1 %input1 + %result_iadd_4 = OpShiftRightLogical %ivec4 %input0 %input0 + %result_iadd_5 = OpShiftRightLogical %ivec4 %input1 %input1 + %result_iadd_6 = OpShiftRightLogical %ivec4 %input0 %input1 + %result_iadd_7 = OpShiftRightLogical %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..85f6cc0414 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 59 +; Schema: 0 + 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 %Foo "A" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpName %A "A" + OpMemberName %A 0 "Data" + OpName %C1 "C1" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %Foo_0 "A" + OpMemberName %Foo_0 0 "a" + OpMemberName %Foo_0 1 "b" + OpName %A_0 "A" + OpMemberName %A_0 0 "Data" + OpName %C2 "C2" + OpName %B "B" + OpMemberName %B 0 "Data" + OpName %C3 "C3" + OpName %B_0 "B" + OpMemberName %B_0 0 "Data" + OpName %C4 "C4" + OpMemberDecorate %Foo 0 Offset 0 + OpMemberDecorate %Foo 1 Offset 4 + OpDecorate %_runtimearr_Foo ArrayStride 8 + OpMemberDecorate %A 0 Offset 0 + OpDecorate %A BufferBlock + OpDecorate %C1 DescriptorSet 0 + OpDecorate %C1 Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Foo_0 1 Offset 4 + OpDecorate %_arr_Foo_0_uint_1024 ArrayStride 16 + OpMemberDecorate %A_0 0 Offset 0 + OpDecorate %A_0 Block + OpDecorate %C2 DescriptorSet 0 + OpDecorate %C2 Binding 2 + OpDecorate %_runtimearr_Foo_0 ArrayStride 8 + OpMemberDecorate %B 0 Offset 0 + OpDecorate %B BufferBlock + OpDecorate %C3 DescriptorSet 0 + OpDecorate %C3 Binding 0 + OpDecorate %_arr_Foo_0_uint_1024_0 ArrayStride 16 + OpMemberDecorate %B_0 0 Offset 0 + OpDecorate %B_0 Block + OpDecorate %C4 DescriptorSet 0 + OpDecorate %C4 Binding 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %Foo = OpTypeStruct %int %int +%_runtimearr_Foo = OpTypeRuntimeArray %Foo + %A = OpTypeStruct %_runtimearr_Foo +%_ptr_Uniform_A = OpTypePointer Uniform %A + %C1 = OpVariable %_ptr_Uniform_A Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %Foo_0 = OpTypeStruct %int %int + %uint_1024 = OpConstant %uint 1024 +%_arr_Foo_0_uint_1024 = OpTypeArray %Foo_0 %uint_1024 + %A_0 = OpTypeStruct %_arr_Foo_0_uint_1024 +%_ptr_Uniform_A_0 = OpTypePointer Uniform %A_0 + %C2 = OpVariable %_ptr_Uniform_A_0 Uniform +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_runtimearr_Foo_0 = OpTypeRuntimeArray %Foo + %B = OpTypeStruct %_runtimearr_Foo_0 +%_ptr_Uniform_B = OpTypePointer Uniform %B + %C3 = OpVariable %_ptr_Uniform_B Uniform +%_arr_Foo_0_uint_1024_0 = OpTypeArray %Foo_0 %uint_1024 + %B_0 = OpTypeStruct %_arr_Foo_0_uint_1024_0 +%_ptr_Uniform_B_0 = OpTypePointer Uniform %B_0 + %C4 = OpVariable %_ptr_Uniform_B_0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_Uniform_Foo_0 %C2 %int_0 %28 + %31 = OpLoad %Foo_0 %30 + %33 = OpAccessChain %_ptr_Uniform_Foo %C1 %int_0 %20 + %34 = OpCompositeExtract %int %31 0 + %36 = OpAccessChain %_ptr_Uniform_int %33 %int_0 + OpStore %36 %34 + %37 = OpCompositeExtract %int %31 1 + %39 = OpAccessChain %_ptr_Uniform_int %33 %int_1 + OpStore %39 %37 + %44 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %50 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %51 = OpLoad %uint %50 + %52 = OpAccessChain %_ptr_Uniform_Foo_0 %C4 %int_0 %51 + %53 = OpLoad %Foo_0 %52 + %54 = OpAccessChain %_ptr_Uniform_Foo %C3 %int_0 %45 + %55 = OpCompositeExtract %int %53 0 + %56 = OpAccessChain %_ptr_Uniform_int %54 %int_0 + OpStore %56 %55 + %57 = OpCompositeExtract %int %53 1 + %58 = OpAccessChain %_ptr_Uniform_int %54 %int_1 + OpStore %58 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp new file mode 100644 index 0000000000..400690b045 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability UniformBufferArrayDynamicIndexing + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %vThreadIDInGroup + OpExecutionMode %main LocalSize 4 1 1 + OpName %main "main" + OpName %cb5_struct "cb5_struct" + OpName %cb0_5 "cb0_5" + OpName %u0 "u0" + OpName %vThreadIDInGroup "vThreadIDInGroup" + OpName %r0 "r0" + OpDecorate %_arr_v4float_uint_5 ArrayStride 16 + OpDecorate %cb5_struct Block + OpMemberDecorate %cb5_struct 0 Offset 0 + OpDecorate %cb0_5 DescriptorSet 0 + OpDecorate %cb0_5 Binding 1 + OpDecorate %u0 DescriptorSet 0 + OpDecorate %u0 Binding 0 + OpDecorate %u0 NonReadable + OpDecorate %vThreadIDInGroup BuiltIn LocalInvocationId + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_v4float_uint_5 = OpTypeArray %v4float %uint_5 + %cb5_struct = OpTypeStruct %_arr_v4float_uint_5 +%_ptr_Uniform_cb5_struct = OpTypePointer Uniform %cb5_struct + %cb0_5 = OpVariable %_ptr_Uniform_cb5_struct Uniform + %13 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %u0 = OpVariable %_ptr_UniformConstant_13 UniformConstant + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int +%vThreadIDInGroup = OpVariable %_ptr_Input_v3int Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_int = OpTypePointer Input %int + %uint_0 = OpConstant %uint 0 + %int_4 = OpConstant %int 4 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %v4uint = OpTypeVector %uint 4 + %uint_3 = OpConstant %uint 3 + %main = OpFunction %void None %2 + %4 = OpLabel + %r0 = OpVariable %_ptr_Function_v4float Function + %24 = OpInBoundsAccessChain %_ptr_Input_int %vThreadIDInGroup %uint_0 + %25 = OpLoad %int %24 + %27 = OpShiftLeftLogical %int %25 %int_4 + %28 = OpBitcast %float %27 + %30 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + OpStore %30 %28 + %31 = OpInBoundsAccessChain %_ptr_Input_int %vThreadIDInGroup %uint_0 + %32 = OpLoad %int %31 + %33 = OpBitcast %float %32 + %35 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_1 + OpStore %35 %33 + %36 = OpLoad %13 %u0 + %37 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + %38 = OpLoad %float %37 + %39 = OpBitcast %uint %38 + %41 = OpShiftRightLogical %uint %39 %uint_2 + %42 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_1 + %43 = OpLoad %float %42 + %44 = OpBitcast %int %43 + %45 = OpIAdd %uint %44 %uint_1 + %47 = OpAccessChain %_ptr_Uniform_v4float %cb0_5 %uint_0 %45 + %48 = OpLoad %v4float %47 + %50 = OpBitcast %v4uint %48 + %51 = OpVectorShuffle %v4uint %50 %50 0 0 0 0 + OpImageWrite %36 %41 %51 + %52 = OpVectorShuffle %v4uint %50 %50 1 1 1 1 + %53 = OpIAdd %uint %41 %uint_1 + OpImageWrite %36 %53 %52 + %54 = OpVectorShuffle %v4uint %50 %50 2 2 2 2 + %55 = OpIAdd %uint %41 %uint_2 + OpImageWrite %36 %55 %54 + %56 = OpVectorShuffle %v4uint %50 %50 3 3 3 3 + %58 = OpIAdd %uint %41 %uint_3 + OpImageWrite %36 %58 %56 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write.asm.comp new file mode 100644 index 0000000000..697324ba6d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/buffer-write.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability ImageBuffer + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %group_id %group_index + OpExecutionMode %main LocalSize 32 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %cb "cb" + OpMemberName %cb 0 "value" + OpName %_ "" + OpName %buffer "buffer" + OpName %group_id "group_id" + OpName %group_index "group_index" + OpMemberDecorate %cb 0 Offset 0 + OpDecorate %cb Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 7 + OpDecorate %buffer DescriptorSet 0 + OpDecorate %buffer Binding 0 + OpDecorate %group_id BuiltIn WorkgroupId + OpDecorate %group_index BuiltIn LocalInvocationIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_32 = OpConstant %uint 32 + %float = OpTypeFloat 32 + %cb = OpTypeStruct %float +%_ptr_Uniform_cb = OpTypePointer Uniform %cb + %_ = OpVariable %_ptr_Uniform_cb Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %34 = OpTypeImage %float Buffer 0 0 0 2 R32f +%_ptr_UniformConstant_34 = OpTypePointer UniformConstant %34 + %buffer = OpVariable %_ptr_UniformConstant_34 UniformConstant +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %group_id = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint +%group_index = OpVariable %_ptr_Input_uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %43 = OpLoad %v3uint %group_id + %47 = OpLoad %uint %group_index + %56 = OpCompositeExtract %uint %43 0 + %57 = OpIMul %uint %uint_32 %56 + %59 = OpIAdd %uint %57 %47 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %61 = OpLoad %float %60 + %62 = OpLoad %34 %buffer + OpImageWrite %62 %59 %61 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp new file mode 100644 index 0000000000..b01262f5bd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ssbo-to-ssbo.asm.comp @@ -0,0 +1,43 @@ +OpCapability Shader +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var_id +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var_id BuiltIn GlobalInvocationId +OpDecorate %var_input Binding 0 +OpDecorate %var_input DescriptorSet 0 +OpDecorate %var_outdata Binding 1 +OpDecorate %var_outdata DescriptorSet 0 +OpMemberDecorate %type_container_struct 0 Offset 0 +OpMemberDecorate %type_container_struct 1 Offset 4 +OpMemberDecorate %type_container_struct 2 Offset 8 +OpMemberDecorate %type_container_struct 3 Offset 12 +OpDecorate %type_container_struct Block +%bool = OpTypeBool +%void = OpTypeVoid +%voidf = OpTypeFunction %void +%u32 = OpTypeInt 32 0 +%i32 = OpTypeInt 32 1 +%f32 = OpTypeFloat 32 +%uvec3 = OpTypeVector %u32 3 +%fvec3 = OpTypeVector %f32 3 +%uvec3ptr = OpTypePointer Input %uvec3 +%i32ptr = OpTypePointer Uniform %i32 +%f32ptr = OpTypePointer Uniform %f32 +%i32arr = OpTypeRuntimeArray %i32 +%f32arr = OpTypeRuntimeArray %f32 +%type_empty_struct = OpTypeStruct +%type_container_struct = OpTypeStruct %i32 %type_empty_struct %type_empty_struct %i32 +%type_container_struct_ubo_ptr = OpTypePointer Uniform %type_container_struct +%type_container_struct_ssbo_ptr = OpTypePointer StorageBuffer %type_container_struct +%var_id = OpVariable %uvec3ptr Input +%var_input = OpVariable %type_container_struct_ssbo_ptr StorageBuffer +%var_outdata = OpVariable %type_container_struct_ssbo_ptr StorageBuffer + +%main = OpFunction %void None %voidf +%label = OpLabel +%input_copy = OpCopyObject %type_container_struct_ssbo_ptr %var_input +%result = OpLoad %type_container_struct %input_copy +OpStore %var_outdata %result +OpReturn +OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp new file mode 100644 index 0000000000..63df59ac32 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/copy-object-ubo-to-ssbo.asm.comp @@ -0,0 +1,43 @@ +OpCapability Shader +OpExtension "SPV_KHR_storage_buffer_storage_class" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %var_id +OpExecutionMode %main LocalSize 1 1 1 +OpDecorate %var_id BuiltIn GlobalInvocationId +OpDecorate %var_input Binding 0 +OpDecorate %var_input DescriptorSet 0 +OpDecorate %var_outdata Binding 1 +OpDecorate %var_outdata DescriptorSet 0 +OpMemberDecorate %type_container_struct 0 Offset 0 +OpMemberDecorate %type_container_struct 1 Offset 16 +OpMemberDecorate %type_container_struct 2 Offset 32 +OpMemberDecorate %type_container_struct 3 Offset 48 +OpDecorate %type_container_struct Block +%bool = OpTypeBool +%void = OpTypeVoid +%voidf = OpTypeFunction %void +%u32 = OpTypeInt 32 0 +%i32 = OpTypeInt 32 1 +%f32 = OpTypeFloat 32 +%uvec3 = OpTypeVector %u32 3 +%fvec3 = OpTypeVector %f32 3 +%uvec3ptr = OpTypePointer Input %uvec3 +%i32ptr = OpTypePointer Uniform %i32 +%f32ptr = OpTypePointer Uniform %f32 +%i32arr = OpTypeRuntimeArray %i32 +%f32arr = OpTypeRuntimeArray %f32 +%type_empty_struct = OpTypeStruct +%type_container_struct = OpTypeStruct %i32 %type_empty_struct %type_empty_struct %i32 +%type_container_struct_ubo_ptr = OpTypePointer Uniform %type_container_struct +%type_container_struct_ssbo_ptr = OpTypePointer StorageBuffer %type_container_struct +%var_id = OpVariable %uvec3ptr Input +%var_input = OpVariable %type_container_struct_ubo_ptr Uniform +%var_outdata = OpVariable %type_container_struct_ssbo_ptr StorageBuffer + +%main = OpFunction %void None %voidf +%label = OpLabel +%input_copy = OpCopyObject %type_container_struct_ubo_ptr %var_input +%result = OpLoad %type_container_struct %input_copy +OpStore %var_outdata %result +OpReturn +OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/duplicate-spec-id.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/duplicate-spec-id.asm.comp new file mode 100644 index 0000000000..4a5aa3d8b5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/duplicate-spec-id.asm.comp @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %StorageBuffer "StorageBuffer" + OpMemberName %StorageBuffer 0 "values" + OpName %ssbo "ssbo" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %foo "foo" + OpName %bar "bar" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %StorageBuffer 0 Offset 0 + OpDecorate %StorageBuffer Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 0 + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %foo SpecId 0 + OpDecorate %bar SpecId 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float +%StorageBuffer = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_StorageBuffer = OpTypePointer StorageBuffer %StorageBuffer + %ssbo = OpVariable %_ptr_StorageBuffer_StorageBuffer StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %foo = OpSpecConstant %int 1 + %bar = OpSpecConstant %float 2 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpLoad %uint %gl_LocalInvocationIndex + %18 = OpConvertSToF %float %foo + %20 = OpFAdd %float %18 %bar + %22 = OpAccessChain %_ptr_StorageBuffer_float %ssbo %int_0 %16 + OpStore %22 %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..78b1dc74e8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %id_1 + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %Load_u1_ "Load(u1;" + OpName %size "size" + OpName %_main_vu3_ "@main(vu3;" + OpName %id "id" + OpName %data "data" + OpName %byteAddrTemp "byteAddrTemp" + OpName %ssbo "ssbo" + OpMemberName %ssbo 0 "@data" + OpName %ssbo_0 "ssbo" + OpName %param "param" + OpName %id_0 "id" + OpName %id_1 "id" + OpName %param_0 "param" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %ssbo 0 NonWritable + OpMemberDecorate %ssbo 0 Offset 0 + OpDecorate %ssbo BufferBlock + OpDecorate %ssbo_0 DescriptorSet 0 + OpDecorate %ssbo_0 Binding 1 + OpDecorate %id_1 BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %8 = OpTypeFunction %void %_ptr_Function_uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %14 = OpTypeFunction %void %_ptr_Function_v3uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %ssbo = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo + %ssbo_0 = OpVariable %_ptr_Uniform_ssbo Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %id_1 = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %id_0 = OpVariable %_ptr_Function_v3uint Function + %param_0 = OpVariable %_ptr_Function_v3uint Function + %57 = OpLoad %v3uint %id_1 + OpStore %id_0 %57 + %59 = OpLoad %v3uint %id_0 + OpStore %param_0 %59 + %60 = OpFunctionCall %void %_main_vu3_ %param_0 + OpReturn + OpFunctionEnd + %Load_u1_ = OpFunction %void None %8 + %size = OpFunctionParameter %_ptr_Function_uint + %11 = OpLabel + %data = OpVariable %_ptr_Function_v4uint Function +%byteAddrTemp = OpVariable %_ptr_Function_int Function + %24 = OpLoad %uint %size + %26 = OpShiftRightLogical %int %24 %int_2 + OpStore %byteAddrTemp %26 + %32 = OpLoad %int %byteAddrTemp + %34 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %32 + %35 = OpLoad %uint %34 + %36 = OpLoad %int %byteAddrTemp + %38 = OpIAdd %int %36 %int_1 + %39 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpLoad %int %byteAddrTemp + %42 = OpIAdd %int %41 %int_2 + %43 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %42 + %44 = OpLoad %uint %43 + %45 = OpLoad %int %byteAddrTemp + %47 = OpIAdd %int %45 %int_3 + %48 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %47 + %49 = OpLoad %uint %48 + %50 = OpCompositeConstruct %v4uint %35 %40 %44 %49 + OpStore %data %50 + OpReturn + OpFunctionEnd + %_main_vu3_ = OpFunction %void None %14 + %id = OpFunctionParameter %_ptr_Function_v3uint + %17 = OpLabel + %param = OpVariable %_ptr_Function_uint Function + OpStore %param %uint_4 + %53 = OpFunctionCall %void %Load_u1_ %param + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp new file mode 100644 index 0000000000..8f759293eb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 44 +; Schema: 0 + OpCapability Shader + OpCapability StorageImageExtendedFormats + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %id_1 + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_vu3_ "@main(vu3;" + OpName %id "id" + OpName %loaded "loaded" + OpName %TargetTexture "TargetTexture" + OpName %storeTemp "storeTemp" + OpName %id_0 "id" + OpName %id_1 "id" + OpName %param "param" + OpDecorate %TargetTexture DescriptorSet 0 + OpDecorate %TargetTexture Binding 0 + OpDecorate %id_1 BuiltIn WorkgroupId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %9 = OpTypeFunction %void %_ptr_Function_v3uint + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %17 = OpTypeImage %float 2D 0 0 0 2 Rg32f +%_ptr_UniformConstant_17 = OpTypePointer UniformConstant %17 +%TargetTexture = OpVariable %_ptr_UniformConstant_17 UniformConstant + %v2uint = OpTypeVector %uint 2 + %float_1 = OpConstant %float 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %id_1 = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %id_0 = OpVariable %_ptr_Function_v3uint Function + %param = OpVariable %_ptr_Function_v3uint Function + %40 = OpLoad %v3uint %id_1 + OpStore %id_0 %40 + %42 = OpLoad %v3uint %id_0 + OpStore %param %42 + %43 = OpFunctionCall %void %_main_vu3_ %param + OpReturn + OpFunctionEnd + %_main_vu3_ = OpFunction %void None %9 + %id = OpFunctionParameter %_ptr_Function_v3uint + %12 = OpLabel + %loaded = OpVariable %_ptr_Function_v2float Function + %storeTemp = OpVariable %_ptr_Function_v2float Function + %20 = OpLoad %17 %TargetTexture + %22 = OpLoad %v3uint %id + %23 = OpVectorShuffle %v2uint %22 %22 0 1 + %24 = OpImageRead %v2float %20 %23 + OpStore %loaded %24 + %26 = OpLoad %v2float %loaded + %28 = OpCompositeConstruct %v2float %float_1 %float_1 + %29 = OpFAdd %v2float %26 %28 + OpStore %storeTemp %29 + %30 = OpLoad %17 %TargetTexture + %31 = OpLoad %v3uint %id + %32 = OpVectorShuffle %v2uint %31 %31 0 1 + %34 = OpCompositeConstruct %v2uint %uint_1 %uint_1 + %35 = OpIAdd %v2uint %32 %34 + %36 = OpLoad %v2float %storeTemp + OpImageWrite %30 %35 %36 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..9ddc07bccf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %func_alt "main2" %frag_in %frag_out + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpExecutionMode %func_alt OriginUpperLeft + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + OpDecorate %frag_in Location 0 + OpDecorate %frag_out Location 0 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %float = OpTypeFloat 32 + %vec4 = OpTypeVector %float 4 + %vec4_input_ptr = OpTypePointer Input %vec4 + %vec4_output_ptr = OpTypePointer Output %vec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %frag_in = OpVariable %vec4_input_ptr Input + %frag_out = OpVariable %vec4_output_ptr Output + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of IAdd + %result_iadd_0 = OpIAdd %uvec4 %input0 %input1 + %result_iadd_1 = OpIAdd %uvec4 %input1 %input0 + %result_iadd_2 = OpIAdd %uvec4 %input0 %input0 + %result_iadd_3 = OpIAdd %uvec4 %input1 %input1 + %result_iadd_4 = OpIAdd %ivec4 %input0 %input0 + %result_iadd_5 = OpIAdd %ivec4 %input1 %input1 + %result_iadd_6 = OpIAdd %ivec4 %input0 %input1 + %result_iadd_7 = OpIAdd %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd + + %func_alt = OpFunction %void None %main_func + %block_alt = OpLabel + %frag_input_value = OpLoad %vec4 %frag_in + OpStore %frag_out %frag_input_value + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp new file mode 100644 index 0000000000..65a7eedd90 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/op-spec-constant-op-vector-related.asm.comp @@ -0,0 +1,107 @@ +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %id +OpExecutionMode %main LocalSize 1 1 1 +OpName %main "main" +OpName %id "gl_GlobalInvocationID" +OpDecorate %id BuiltIn GlobalInvocationId +OpDecorate %sc_0 SpecId 0 +OpDecorate %sc_1 SpecId 1 +OpDecorate %sc_2 SpecId 2 +OpDecorate %i32arr ArrayStride 4 +OpDecorate %buf BufferBlock +OpDecorate %indata DescriptorSet 0 +OpDecorate %indata Binding 0 +OpDecorate %outdata DescriptorSet 0 +OpDecorate %outdata Binding 1 +OpDecorate %f32arr ArrayStride 4 +OpMemberDecorate %buf 0 Offset 0 +%bool = OpTypeBool +%void = OpTypeVoid +%voidf = OpTypeFunction %void +%u32 = OpTypeInt 32 0 +%i32 = OpTypeInt 32 1 +%f32 = OpTypeFloat 32 +%uvec3 = OpTypeVector %u32 3 +%fvec3 = OpTypeVector %f32 3 +%uvec3ptr = OpTypePointer Input %uvec3 +%i32ptr = OpTypePointer Uniform %i32 +%f32ptr = OpTypePointer Uniform %f32 +%i32arr = OpTypeRuntimeArray %i32 +%f32arr = OpTypeRuntimeArray %f32 +%ivec3 = OpTypeVector %i32 3 +%zero = OpConstant %i32 0 +%one = OpConstant %i32 1 +%two = OpConstant %i32 2 +%three = OpConstant %i32 3 +%iarr3 = OpTypeArray %i32 %three +%imat3 = OpTypeArray %iarr3 %three +%struct = OpTypeStruct %imat3 +%buf = OpTypeStruct %i32arr +%bufptr = OpTypePointer Uniform %buf +%indata = OpVariable %bufptr Uniform +%outdata = OpVariable %bufptr Uniform +%id = OpVariable %uvec3ptr Input +%ivec3_0 = OpConstantComposite %ivec3 %zero %zero %zero +%vec3_undef = OpUndef %ivec3 +%iarr3_0 = OpConstantComposite %iarr3 %zero %zero %zero +%imat3_0 = OpConstantComposite %imat3 %iarr3_0 %iarr3_0 %iarr3_0 +%struct_0 = OpConstantComposite %struct %imat3_0 +%sc_0 = OpSpecConstant %i32 0 +%sc_1 = OpSpecConstant %i32 0 +%sc_2 = OpSpecConstant %i32 0 +%iarr3_a = OpSpecConstantOp %iarr3 CompositeInsert %sc_0 %iarr3_0 0 +%iarr3_b = OpSpecConstantOp %iarr3 CompositeInsert %sc_1 %iarr3_a 1 +%iarr3_c = OpSpecConstantOp %iarr3 CompositeInsert %sc_2 %iarr3_b 2 +%iarr3_d = OpSpecConstantOp %iarr3 CompositeInsert %sc_1 %iarr3_0 0 +%iarr3_e = OpSpecConstantOp %iarr3 CompositeInsert %sc_2 %iarr3_d 1 +%iarr3_f = OpSpecConstantOp %iarr3 CompositeInsert %sc_0 %iarr3_e 2 +%iarr3_g = OpSpecConstantOp %iarr3 CompositeInsert %sc_2 %iarr3_0 0 +%iarr3_h = OpSpecConstantOp %iarr3 CompositeInsert %sc_0 %iarr3_g 1 +%iarr3_i = OpSpecConstantOp %iarr3 CompositeInsert %sc_1 %iarr3_h 2 +%imat3_a = OpSpecConstantOp %imat3 CompositeInsert %iarr3_c %imat3_0 0 +%imat3_b = OpSpecConstantOp %imat3 CompositeInsert %iarr3_f %imat3_a 1 +%imat3_c = OpSpecConstantOp %imat3 CompositeInsert %iarr3_i %imat3_b 2 +%struct_a = OpSpecConstantOp %struct CompositeInsert %imat3_c %struct_0 0 +%struct_b = OpSpecConstantOp %struct CompositeInsert %sc_2 %struct_a 0 1 2 +%comp_0_0 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 0 0 +%comp_1_0 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 1 0 +%comp_0_1 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 0 1 +%comp_2_2 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 2 2 +%comp_2_0 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 2 0 +%comp_1_1 = OpSpecConstantOp %i32 CompositeExtract %struct_a 0 1 1 +%cmpres_0 = OpSpecConstantOp %bool IEqual %comp_0_0 %comp_1_0 +%cmpres_1 = OpSpecConstantOp %bool IEqual %comp_0_1 %comp_2_2 +%cmpres_2 = OpSpecConstantOp %bool IEqual %comp_2_0 %comp_1_1 +%mustbe_0 = OpSpecConstantOp %i32 Select %cmpres_0 %one %zero +%mustbe_1 = OpSpecConstantOp %i32 Select %cmpres_1 %one %zero +%mustbe_2 = OpSpecConstantOp %i32 Select %cmpres_2 %two %one +%sc_vec3_0 = OpSpecConstantOp %ivec3 CompositeInsert %sc_0 %ivec3_0 0 +%sc_vec3_1 = OpSpecConstantOp %ivec3 CompositeInsert %sc_1 %ivec3_0 1 +%sc_vec3_2 = OpSpecConstantOp %ivec3 CompositeInsert %sc_2 %ivec3_0 2 +%sc_vec3_0_s = OpSpecConstantOp %ivec3 VectorShuffle %sc_vec3_0 %vec3_undef 0 0xFFFFFFFF 2 +%sc_vec3_1_s = OpSpecConstantOp %ivec3 VectorShuffle %sc_vec3_1 %vec3_undef 0xFFFFFFFF 1 0 +%sc_vec3_2_s = OpSpecConstantOp %ivec3 VectorShuffle %vec3_undef %sc_vec3_2 5 0xFFFFFFFF 5 +%sc_vec3_01 = OpSpecConstantOp %ivec3 VectorShuffle %sc_vec3_0_s %sc_vec3_1_s 1 0 4 +%sc_vec3_012 = OpSpecConstantOp %ivec3 VectorShuffle %sc_vec3_01 %sc_vec3_2_s 5 1 2 +%sc_ext_0 = OpSpecConstantOp %i32 CompositeExtract %sc_vec3_012 0 +%sc_ext_1 = OpSpecConstantOp %i32 CompositeExtract %sc_vec3_012 1 +%sc_ext_2 = OpSpecConstantOp %i32 CompositeExtract %sc_vec3_012 2 +%sc_sub = OpSpecConstantOp %i32 ISub %sc_ext_0 %sc_ext_1 +%sc_factor = OpSpecConstantOp %i32 IMul %sc_sub %sc_ext_2 +%main = OpFunction %void None %voidf +%label = OpLabel +%subf_a = OpISub %i32 %one %mustbe_0 +%subf_b = OpIMul %i32 %subf_a %mustbe_1 +%subf_c = OpISub %i32 %mustbe_2 %one +%factor = OpIMul %i32 %subf_b %subf_c +%sc_final = OpIMul %i32 %factor %sc_factor +%idval = OpLoad %uvec3 %id +%x = OpCompositeExtract %u32 %idval 0 +%inloc = OpAccessChain %i32ptr %indata %zero %x +%inval = OpLoad %i32 %inloc +%final = OpIAdd %i32 %inval %sc_final +%outloc = OpAccessChain %i32ptr %outdata %zero %x + OpStore %outloc %final + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/quantize.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..f5afc6570c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/quantize.asm.comp @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "SSBO0" + OpMemberName %10 0 "scalar" + OpMemberName %10 1 "vec2_val" + OpMemberName %10 2 "vec3_val" + OpMemberName %10 3 "vec4_val" + OpName %12 "" + OpMemberDecorate %10 0 Offset 0 + OpMemberDecorate %10 1 Offset 8 + OpMemberDecorate %10 2 Offset 16 + OpMemberDecorate %10 3 Offset 32 + OpDecorate %10 BufferBlock + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeVector %6 3 + %9 = OpTypeVector %6 4 + %10 = OpTypeStruct %6 %7 %8 %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %20 = OpConstant %13 1 + %21 = OpTypePointer Uniform %7 + %26 = OpConstant %13 2 + %27 = OpTypePointer Uniform %8 + %32 = OpConstant %13 3 + %33 = OpTypePointer Uniform %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %6 %16 + %18 = OpQuantizeToF16 %6 %17 + %19 = OpAccessChain %15 %12 %14 + OpStore %19 %18 + %22 = OpAccessChain %21 %12 %20 + %23 = OpLoad %7 %22 + %24 = OpQuantizeToF16 %7 %23 + %25 = OpAccessChain %21 %12 %20 + OpStore %25 %24 + %28 = OpAccessChain %27 %12 %26 + %29 = OpLoad %8 %28 + %30 = OpQuantizeToF16 %8 %29 + %31 = OpAccessChain %27 %12 %26 + OpStore %31 %30 + %34 = OpAccessChain %33 %12 %32 + %35 = OpLoad %9 %34 + %36 = OpQuantizeToF16 %9 %35 + %37 = OpAccessChain %33 %12 %32 + OpStore %37 %36 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/relaxed-block-layout.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/relaxed-block-layout.asm.comp new file mode 100644 index 0000000000..dd909426d5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/relaxed-block-layout.asm.comp @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability StorageBuffer16BitAccess + OpCapability StorageBuffer8BitAccess + OpCapability UniformAndStorageBuffer8BitAccess + OpExtension "SPV_KHR_8bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationID %gl_GlobalInvocationID %gl_WorkGroupID %gl_NumWorkGroups + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_16bit_storage" + OpSourceExtension "GL_EXT_shader_8bit_storage" + OpName %main "main" + OpName %foo "foo" + OpMemberName %foo 0 "bar" + OpMemberName %foo 1 "baz" + OpMemberName %foo 2 "quux" + OpMemberName %foo 3 "blah" + OpMemberName %foo 4 "wibble" + OpName %_ "" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %gl_NumWorkGroups "gl_NumWorkGroups" + OpMemberDecorate %foo 0 Offset 0 + OpMemberDecorate %foo 1 Offset 4 + OpMemberDecorate %foo 2 Offset 16 + OpMemberDecorate %foo 3 Offset 17 + OpMemberDecorate %foo 4 Offset 22 + OpDecorate %foo BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %uchar = OpTypeInt 8 0 + %v4uchar = OpTypeVector %uchar 4 + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %foo = OpTypeStruct %uint %v3float %uchar %v4uchar %v2half +%_ptr_Uniform_foo = OpTypePointer Uniform %foo + %_ = OpVariable %_ptr_Uniform_foo Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_3 = OpConstant %int 3 +%_ptr_Uniform_v4uchar = OpTypePointer Uniform %v4uchar + %v4uint = OpTypeVector %uint 4 +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %int_4 = OpConstant %int 4 +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %v2float = OpTypeVector %float 2 +%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input + %v2uint = OpTypeVector %uint 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %23 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %24 = OpLoad %uint %23 + %26 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + OpStore %26 %24 + %29 = OpLoad %v3uint %gl_GlobalInvocationID + %30 = OpConvertUToF %v3float %29 + %32 = OpAccessChain %_ptr_Uniform_v3float %_ %int_1 + OpStore %32 %30 + %35 = OpAccessChain %_ptr_Uniform_v4uchar %_ %int_3 + %36 = OpLoad %v4uchar %35 + %38 = OpUConvert %v4uint %36 + %39 = OpVectorShuffle %v3uint %38 %38 0 1 2 + %41 = OpLoad %v3uint %gl_WorkGroupID + %42 = OpIAdd %v3uint %39 %41 + %43 = OpCompositeExtract %uint %42 0 + %44 = OpCompositeExtract %uint %42 1 + %45 = OpCompositeExtract %uint %42 2 + %46 = OpCompositeConstruct %v4uint %43 %44 %45 %uint_0 + %47 = OpUConvert %v4uchar %46 + %48 = OpAccessChain %_ptr_Uniform_v4uchar %_ %int_3 + OpStore %48 %47 + %51 = OpAccessChain %_ptr_Uniform_v2half %_ %int_4 + %52 = OpLoad %v2half %51 + %54 = OpFConvert %v2float %52 + %57 = OpLoad %v3uint %gl_NumWorkGroups + %58 = OpVectorShuffle %v2uint %57 %57 0 1 + %59 = OpConvertUToF %v2float %58 + %60 = OpFMul %v2float %54 %59 + %61 = OpFConvert %v2half %60 + %62 = OpAccessChain %_ptr_Uniform_v2half %_ %int_4 + OpStore %62 %61 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..188e3fec36 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 20 1 + OpSource ESSL 310 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %19 SpecId 10 + OpDecorate %21 SpecId 12 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %19 = OpSpecConstant %uint 9 + %uint_20 = OpConstant %uint 20 + %21 = OpSpecConstant %uint 4 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %19 %uint_20 %21 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %15 = OpLoad %float %14 + %16 = OpFAdd %float %15 %float_1 + %17 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %17 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp new file mode 100644 index 0000000000..384da305ad --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 8 8 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %bufA "bufA" + OpMemberName %bufA 0 "@data" + OpName %bufA_0 "bufA" + OpName %bufB "bufB" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %bufA 0 Offset 0 + OpDecorate %bufA BufferBlock + OpDecorate %bufA_0 DescriptorSet 0 + OpDecorate %bufB DescriptorSet 0 + OpDecorate %bufA_0 Binding 0 + OpDecorate %bufB Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %bufA = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_bufA = OpTypePointer Uniform %bufA + %bufA_0 = OpVariable %_ptr_Uniform_bufA Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bufB = OpVariable %_ptr_Uniform_bufA Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpFunctionCall %void %_main_ + OpReturn + OpFunctionEnd + %_main_ = OpFunction %void None %3 + %7 = OpLabel + %17 = OpAccessChain %_ptr_Uniform_uint %bufA_0 %int_0 %int_0 + OpStore %17 %uint_0 + %19 = OpAccessChain %_ptr_Uniform_uint %bufB %int_0 %int_0 + OpStore %19 %uint_0 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/uint_smulextended.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/uint_smulextended.asm.comp new file mode 100644 index 0000000000..32d483636a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/uint_smulextended.asm.comp @@ -0,0 +1,61 @@ + OpCapability Shader + + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId + OpExecutionMode %main LocalSize 1 1 1 + + OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId + OpDecorate %ra_uint ArrayStride 4 + OpDecorate %struct_uint4 BufferBlock + OpMemberDecorate %struct_uint4 0 Offset 0 + OpDecorate %input0 DescriptorSet 0 + OpDecorate %input0 Binding 0 + OpDecorate %input1 DescriptorSet 0 + OpDecorate %input1 Binding 1 + OpDecorate %output0 DescriptorSet 0 + OpDecorate %output0 Binding 2 + OpDecorate %output1 DescriptorSet 0 + OpDecorate %output1 Binding 3 + + %uint = OpTypeInt 32 0 + %ptr_uint = OpTypePointer Uniform %uint + %ptr_input_uint = OpTypePointer Input %uint + %uint3 = OpTypeVector %uint 3 + %ptr_input_uint3 = OpTypePointer Input %uint3 + %void = OpTypeVoid + %voidFn = OpTypeFunction %void + + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %ra_uint = OpTypeRuntimeArray %uint + %uint4 = OpTypeVector %uint 4 + %struct_uint4 = OpTypeStruct %ra_uint + %ptr_struct_uint4 = OpTypePointer Uniform %struct_uint4 + %resulttype = OpTypeStruct %uint %uint +%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input + %input0 = OpVariable %ptr_struct_uint4 Uniform + %input1 = OpVariable %ptr_struct_uint4 Uniform + + %output0 = OpVariable %ptr_struct_uint4 Uniform + %output1 = OpVariable %ptr_struct_uint4 Uniform + + %main = OpFunction %void None %voidFn + %mainStart = OpLabel + %index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 + %index = OpLoad %uint %index_ptr + %in_ptr0 = OpAccessChain %ptr_uint %input0 %uint_0 %index + %invalue0 = OpLoad %uint %in_ptr0 + %in_ptr1 = OpAccessChain %ptr_uint %input1 %uint_0 %index + %invalue1 = OpLoad %uint %in_ptr1 + + %outvalue = OpSMulExtended %resulttype %invalue0 %invalue1 + %outvalue0 = OpCompositeExtract %uint %outvalue 0 + %out_ptr0 = OpAccessChain %ptr_uint %output0 %uint_0 %index + OpStore %out_ptr0 %outvalue0 + %outvalue1 = OpCompositeExtract %uint %outvalue 1 + %out_ptr1 = OpAccessChain %ptr_uint %output1 %uint_0 %index + OpStore %out_ptr1 %outvalue1 + + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..9de0501fe2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,102 @@ +; +; The shader below is based on the following GLSL shader: +; +; #version 450 +; +; struct Pair { +; int first; +; int second; +; }; +; +; const Pair constant_pair = { 100, 200 }; +; +; layout(set=0, binding=0, std430) buffer InputBlock { +; int array[10]; +; } inputValues; +; +; layout(set=0, binding=1, std430) buffer OutputBlock { +; int array[10]; +; } outputValues; +; +; int add_second (int value, Pair pair) { +; return value + pair.second; +; } +; +; void main() { +; uint idx = gl_GlobalInvocationID.x; +; outputValues.array[idx] = add_second(inputValues.array[idx], constant_pair); +; } +; +; However, the first element of constant_pair has been modified to be undefined. +; + OpCapability Shader + %std450 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputValues DescriptorSet 0 + OpDecorate %outputValues Binding 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputValues DescriptorSet 0 + OpDecorate %inputValues Binding 0 + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 + %_ptr_Function_int = OpTypePointer Function %int + %Pair = OpTypeStruct %int %int + %_ptr_Function_Pair = OpTypePointer Function %Pair + %add_second_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair + %_ptr_Function_uint = OpTypePointer Function %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_arr_int_uint_10 = OpTypeArray %int %uint_10 + %OutputBlock = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock + %outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform + %InputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock + %inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform + ; Replaced %int_100 with an undefined int. + %undef_int = OpUndef %int + ; Composed a constant Pair with the undefined int in the first member. + %const_Pair = OpConstantComposite %Pair %undef_int %int_200 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %void_func + %main_label = OpLabel + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_Pair Function + %gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %gidx = OpLoad %uint %gidx_ptr + %input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx + %input_value = OpLoad %int %input_value_ptr + OpStore %param_1 %input_value + OpStore %param_2 %const_Pair + %retval = OpFunctionCall %int %add_second %param_1 %param_2 + %output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx + OpStore %output_value_ptr %retval + OpReturn + OpFunctionEnd + %add_second = OpFunction %int None %add_second_func_type + %value_ptr = OpFunctionParameter %_ptr_Function_int + %pair = OpFunctionParameter %_ptr_Function_Pair + %add_second_label = OpLabel + %value = OpLoad %int %value_ptr + ; Access the second struct member, which is defined. + %pair_second_ptr = OpAccessChain %_ptr_Function_int %pair %int_1 + %pair_second = OpLoad %int %pair_second_ptr + %add_result = OpIAdd %int %value %pair_second + OpReturnValue %add_result + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp new file mode 100644 index 0000000000..d89a402bf5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/undefined-spec-constant-composite.asm.comp @@ -0,0 +1,122 @@ +; +; The shader below is based on the following GLSL shader: +; +; #version 450 +; +; struct Pair { +; int first; +; int second; +; }; +; +; const Pair constant_pair = { 100, 200 }; +; +; layout (constant_id=0) const int constantFirst = 0; +; +; Pair spec_constant_pair = { constantFirst, 200 }; +; +; layout(set=0, binding=0, std430) buffer InputBlock { +; int array[10]; +; } inputValues; +; +; layout(set=0, binding=1, std430) buffer OutputBlock { +; int array[10]; +; } outputValues; +; +; int add_first_and_second (int value, Pair p1, Pair p2) { +; return value + p1.first + p2.second; +; } +; +; void main() { +; uint idx = gl_GlobalInvocationID.x; +; outputValues.array[idx] = add_first_and_second(inputValues.array[idx], spec_constant_pair, constant_pair); +; } +; +; However, both the constant_pair and the spec_constant_pair have one of their members replaced by undefined values. +; + OpCapability Shader + %std450 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputValues DescriptorSet 0 + OpDecorate %outputValues Binding 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputValues DescriptorSet 0 + OpDecorate %inputValues Binding 0 + OpDecorate %spec_constant SpecId 0 + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 + %_ptr_Function_int = OpTypePointer Function %int + %Pair = OpTypeStruct %int %int + %_ptr_Function_Pair = OpTypePointer Function %Pair +%add_pair_members_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair %_ptr_Function_Pair + %_ptr_Function_uint = OpTypePointer Function %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_arr_int_uint_10 = OpTypeArray %int %uint_10 + %OutputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock + %outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform + %InputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock + %inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform + ; Replaced %int_100 with an undefined int. + %undef_int = OpUndef %int + ; Composed a spec constant Pair with an undefined int in the second member. + %spec_constant = OpSpecConstant %int 0 + %spec_const_Pair = OpSpecConstantComposite %Pair %spec_constant %undef_int + ; Composed a constant Pair with the undefined int in the first member. + %const_Pair = OpConstantComposite %Pair %undef_int %int_200 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %void_func + %main_label = OpLabel + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_Pair Function + %param_3 = OpVariable %_ptr_Function_Pair Function + %gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %gidx = OpLoad %uint %gidx_ptr + %input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx + %input_value = OpLoad %int %input_value_ptr + OpStore %param_1 %input_value + OpStore %param_2 %spec_const_Pair + OpStore %param_3 %const_Pair + ; Pass the input value as the first argument. + ; Pass the specialization constant Pair as the second argument. + ; Pass the constant Pair as the third argument. + %retval = OpFunctionCall %int %add_pair_members %param_1 %param_2 %param_3 + %output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx + OpStore %output_value_ptr %retval + OpReturn + OpFunctionEnd + %add_pair_members = OpFunction %int None %add_pair_members_func_type + %value_ptr = OpFunctionParameter %_ptr_Function_int + %pair_1 = OpFunctionParameter %_ptr_Function_Pair + %pair_2 = OpFunctionParameter %_ptr_Function_Pair + %add_pair_members_label = OpLabel + %value = OpLoad %int %value_ptr + ; Access the first struct member from the first pair. + ; Access the second struct member from the second pair. + ; Both should be defined according to the function call above. + %pair_1_first_ptr = OpAccessChain %_ptr_Function_int %pair_1 %int_0 + %pair_2_second_ptr = OpAccessChain %_ptr_Function_int %pair_2 %int_1 + %pair_1_first = OpLoad %int %pair_1_first_ptr + %pair_2_second = OpLoad %int %pair_2_second_ptr + %partial_result = OpIAdd %int %value %pair_1_first + %final_result = OpIAdd %int %partial_result %pair_2_second + OpReturnValue %final_result + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-2.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-2.asm.comp new file mode 100644 index 0000000000..308162f0b9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-2.asm.comp @@ -0,0 +1,117 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 65 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %gl_LocalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpMemberName %foo 0 "a" + OpMemberName %foo 1 "b" + OpMemberName %foo 2 "c" + OpName %bar "bar" + OpMemberName %bar 0 "d" + OpName %buf "buf" + OpName %cb "cb" + OpName %select_buffer "select_buffer" + OpName %select_input "select_input" + OpName %a "a" + OpMemberDecorate %foo 0 Offset 0 + OpMemberDecorate %foo 1 Offset 512 + OpMemberDecorate %foo 2 Offset 520 + OpMemberDecorate %bar 0 Offset 0 + OpDecorate %foo Block + OpDecorate %bar Block + OpDecorate %buf DescriptorSet 0 + OpDecorate %buf Binding 0 + OpDecorate %cb DescriptorSet 0 + OpDecorate %cb Binding 1 + OpDecorate %_ptr_StorageBuffer_int ArrayStride 4 + OpDecorate %_arr_int_uint_128 ArrayStride 4 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + %void = OpTypeVoid + %15 = OpTypeFunction %void + %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 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_128 = OpConstant %uint 128 +%_arr_int_uint_128 = OpTypeArray %int %uint_128 + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %foo = OpTypeStruct %_arr_int_uint_128 %uint %v2float +%_ptr_StorageBuffer_foo = OpTypePointer StorageBuffer %foo + %buf = OpVariable %_ptr_StorageBuffer_foo StorageBuffer + %bar = OpTypeStruct %int +%_ptr_Uniform_bar = OpTypePointer Uniform %bar + %cb = OpVariable %_ptr_Uniform_bar Uniform + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Uniform_int = OpTypePointer Uniform %int + %28 = OpTypeFunction %_ptr_StorageBuffer_foo %_ptr_StorageBuffer_foo + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %31 = OpConstantNull %_ptr_StorageBuffer_foo + %32 = OpTypeFunction %_ptr_Input_v3uint +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int +%_ptr_Function__ptr_StorageBuffer_foo = OpTypePointer Function %_ptr_StorageBuffer_foo +%select_buffer = OpFunction %_ptr_StorageBuffer_foo None %28 + %a = OpFunctionParameter %_ptr_StorageBuffer_foo + %33 = OpLabel + %34 = OpAccessChain %_ptr_Uniform_int %cb %uint_0 + %35 = OpLoad %int %34 + %36 = OpINotEqual %bool %35 %int_0 + %37 = OpSelect %_ptr_StorageBuffer_foo %36 %a %31 + OpReturnValue %37 + OpFunctionEnd +%select_input = OpFunction %_ptr_Input_v3uint None %32 + %38 = OpLabel + %39 = OpAccessChain %_ptr_Uniform_int %cb %uint_0 + %40 = OpLoad %int %39 + %41 = OpINotEqual %bool %40 %int_0 + %42 = OpSelect %_ptr_Input_v3uint %41 %gl_GlobalInvocationID %gl_LocalInvocationID + OpReturnValue %42 + OpFunctionEnd + %main = OpFunction %void None %15 + %43 = OpLabel + %65 = OpVariable %_ptr_Function__ptr_StorageBuffer_foo Function + %44 = OpFunctionCall %_ptr_StorageBuffer_foo %select_buffer %buf + OpStore %65 %44 + %45 = OpFunctionCall %_ptr_Input_v3uint %select_input + %66 = OpLoad %_ptr_StorageBuffer_foo %65 + %46 = OpAccessChain %_ptr_StorageBuffer_int %66 %uint_0 %uint_0 + %47 = OpAccessChain %_ptr_StorageBuffer_int %buf %uint_0 %uint_0 + OpBranch %48 + %48 = OpLabel + %49 = OpPhi %_ptr_StorageBuffer_int %46 %43 %50 %51 + %52 = OpPhi %_ptr_StorageBuffer_int %47 %43 %53 %51 + %54 = OpLoad %int %49 + %55 = OpLoad %int %52 + %56 = OpINotEqual %bool %54 %55 + OpLoopMerge %58 %51 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %59 = OpIAdd %int %54 %55 + %60 = OpLoad %v3uint %45 + %61 = OpCompositeExtract %uint %60 0 + %62 = OpBitcast %int %61 + %63 = OpIAdd %int %59 %62 + OpStore %49 %63 + OpStore %52 %63 + OpBranch %51 + %51 = OpLabel + %50 = OpPtrAccessChain %_ptr_StorageBuffer_int %49 %uint_1 + %53 = OpPtrAccessChain %_ptr_StorageBuffer_int %52 %uint_1 + OpBranch %48 + %58 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp new file mode 100644 index 0000000000..3dcb04f027 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp @@ -0,0 +1,75 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 40 +; Schema: 0 + OpCapability Shader + OpCapability VariablePointers + %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 %foo "foo" + OpMemberName %foo 0 "a" + OpName %bar "bar" + OpMemberName %bar 0 "b" + OpName %x "x" + OpName %y "y" + OpName %a "a" + OpName %b "b" + OpMemberDecorate %foo 0 Offset 0 + OpMemberDecorate %bar 0 Offset 0 + OpDecorate %foo Block + OpDecorate %bar Block + OpDecorate %x DescriptorSet 0 + OpDecorate %x Binding 0 + OpDecorate %y DescriptorSet 0 + OpDecorate %y Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %11 = OpTypeFunction %void + %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 + %foo = OpTypeStruct %int +%_ptr_StorageBuffer_foo = OpTypePointer StorageBuffer %foo + %x = OpVariable %_ptr_StorageBuffer_foo StorageBuffer + %bar = OpTypeStruct %int +%_ptr_StorageBuffer_bar = OpTypePointer StorageBuffer %bar + %y = OpVariable %_ptr_StorageBuffer_bar StorageBuffer + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %22 = OpTypeFunction %_ptr_StorageBuffer_int %_ptr_StorageBuffer_foo %_ptr_StorageBuffer_bar +%_ptr_Function__ptr_StorageBuffer_int = OpTypePointer Function %_ptr_StorageBuffer_int + %24 = OpFunction %_ptr_StorageBuffer_int None %22 + %a = OpFunctionParameter %_ptr_StorageBuffer_foo + %b = OpFunctionParameter %_ptr_StorageBuffer_bar + %25 = OpLabel + %26 = OpLoad %v3uint %gl_GlobalInvocationID + %27 = OpCompositeExtract %uint %26 0 + %28 = OpINotEqual %bool %27 %uint_0 + %29 = OpAccessChain %_ptr_StorageBuffer_int %a %uint_0 + %30 = OpAccessChain %_ptr_StorageBuffer_int %b %uint_0 + %31 = OpSelect %_ptr_StorageBuffer_int %28 %29 %30 + OpReturnValue %31 + OpFunctionEnd + %main = OpFunction %void None %11 + %32 = OpLabel + %33 = OpVariable %_ptr_Function__ptr_StorageBuffer_int Function + %34 = OpFunctionCall %_ptr_StorageBuffer_int %24 %x %y + OpStore %33 %34 + %35 = OpLoad %_ptr_StorageBuffer_int %33 + %36 = OpAccessChain %_ptr_StorageBuffer_int %x %uint_0 + %37 = OpLoad %int %36 + OpStore %35 %int_0 + %38 = OpIAdd %int %37 %37 + %39 = OpAccessChain %_ptr_StorageBuffer_int %y %uint_0 + OpStore %39 %38 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp new file mode 100644 index 0000000000..c01432b5d7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp @@ -0,0 +1,147 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 90 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpCapability StorageImageWriteWithoutFormat + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationID + OpExecutionMode %main LocalSize 16 16 1 + OpSource GLSL 450 + OpName %main "main" + OpName %get_texcoord_vi2_vi2_ "get_texcoord(vi2;vi2;" + OpName %base "base" + OpName %index "index" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %r0 "r0" + OpName %u0 "u0" + OpName %i "i" + OpName %j "j" + OpName %param "param" + OpName %param_0 "param" + OpName %cb1_struct "cb1_struct" + OpMemberName %cb1_struct 0 "_m0" + OpName %cb0_1 "cb0_1" + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %u0 DescriptorSet 0 + OpDecorate %u0 Binding 1 + OpDecorate %u0 NonReadable + OpDecorate %_arr_v4float_uint_1 ArrayStride 16 + OpMemberDecorate %cb1_struct 0 Offset 0 + OpDecorate %cb1_struct Block + OpDecorate %cb0_1 DescriptorSet 0 + OpDecorate %cb0_1 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %9 = OpTypeFunction %v2int %_ptr_Function_v2int %_ptr_Function_v2int + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3int Input + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %float = OpTypeFloat 32 + %30 = OpTypeImage %float 2D 0 0 0 2 Unknown +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 + %u0 = OpVariable %_ptr_UniformConstant_30 UniformConstant + %uint_4 = OpConstant %uint 4 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %v4float = OpTypeVector %float 4 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 + %cb1_struct = OpTypeStruct %_arr_v4float_uint_1 +%_ptr_Uniform_cb1_struct = OpTypePointer Uniform %cb1_struct + %cb0_1 = OpVariable %_ptr_Uniform_cb1_struct Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %uint_16 = OpConstant %uint 16 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %r0 = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %param = OpVariable %_ptr_Function_v2int Function + %param_0 = OpVariable %_ptr_Function_v2int Function + %33 = OpLoad %30 %u0 + %34 = OpImageQuerySize %v2int %33 + %36 = OpCompositeConstruct %v2uint %uint_4 %uint_4 + %37 = OpShiftRightArithmetic %v2int %34 %36 + %38 = OpCompositeExtract %int %37 0 + %39 = OpCompositeExtract %int %37 1 + %40 = OpCompositeConstruct %v2int %38 %39 + OpStore %r0 %40 + OpStore %i %int_0 + OpBranch %44 + %44 = OpLabel + OpLoopMerge %46 %47 None + OpBranch %48 + %48 = OpLabel + %49 = OpLoad %int %i + %51 = OpAccessChain %_ptr_Function_int %r0 %uint_1 + %52 = OpLoad %int %51 + %54 = OpSLessThan %bool %49 %52 + OpBranchConditional %54 %45 %46 + %45 = OpLabel + OpStore %j %int_0 + OpBranch %56 + %56 = OpLabel + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %61 = OpLoad %int %j + %63 = OpAccessChain %_ptr_Function_int %r0 %uint_0 + %64 = OpLoad %int %63 + %65 = OpSLessThan %bool %61 %64 + OpBranchConditional %65 %57 %58 + %57 = OpLabel + %66 = OpLoad %30 %u0 + %67 = OpLoad %int %i + %68 = OpLoad %int %j + %69 = OpCompositeConstruct %v2int %67 %68 + %71 = OpLoad %v2int %r0 + OpStore %param %71 + OpStore %param_0 %69 + %73 = OpFunctionCall %v2int %get_texcoord_vi2_vi2_ %param %param_0 + %80 = OpAccessChain %_ptr_Uniform_v4float %cb0_1 %int_0 %int_0 + %81 = OpLoad %v4float %80 + %82 = OpVectorShuffle %v4float %81 %81 0 0 0 0 + OpImageWrite %66 %73 %82 + OpBranch %59 + %59 = OpLabel + %83 = OpLoad %int %j + %85 = OpIAdd %int %83 %int_1 + OpStore %j %85 + OpBranch %56 + %58 = OpLabel + OpBranch %47 + %47 = OpLabel + %86 = OpLoad %int %i + %87 = OpIAdd %int %86 %int_1 + OpStore %i %87 + OpBranch %44 + %46 = OpLabel + OpReturn + OpFunctionEnd +%get_texcoord_vi2_vi2_ = OpFunction %v2int None %9 + %base = OpFunctionParameter %_ptr_Function_v2int + %index = OpFunctionParameter %_ptr_Function_v2int + %13 = OpLabel + %14 = OpLoad %v2int %base + %20 = OpLoad %v3int %gl_LocalInvocationID + %21 = OpVectorShuffle %v2int %20 %20 0 1 + %23 = OpIMul %v2int %14 %21 + %24 = OpLoad %v2int %index + %25 = OpIAdd %v2int %23 %24 + OpReturnValue %25 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp b/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp new file mode 100644 index 0000000000..e793540268 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/comp/vector-builtin-type-cast.asm.comp @@ -0,0 +1,128 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + OpCapability StorageImageWriteWithoutFormat + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationID + OpExecutionMode %main LocalSize 16 16 1 + OpSource GLSL 450 + OpName %main "main" + OpName %r0 "r0" + OpName %u0 "u0" + OpName %i "i" + OpName %j "j" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %cb1_struct "cb1_struct" + OpMemberName %cb1_struct 0 "_m0" + OpName %cb0_1 "cb0_1" + OpDecorate %u0 DescriptorSet 0 + OpDecorate %u0 Binding 1 + OpDecorate %u0 NonReadable + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %_arr_v4float_uint_1 ArrayStride 16 + OpMemberDecorate %cb1_struct 0 Offset 0 + OpDecorate %cb1_struct Block + OpDecorate %cb0_1 DescriptorSet 0 + OpDecorate %cb0_1 Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 2 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %u0 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3int Input + %v4float = OpTypeVector %float 4 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 + %cb1_struct = OpTypeStruct %_arr_v4float_uint_1 +%_ptr_Uniform_cb1_struct = OpTypePointer Uniform %cb1_struct + %cb0_1 = OpVariable %_ptr_Uniform_cb1_struct Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %uint_16 = OpConstant %uint 16 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %r0 = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %14 = OpLoad %11 %u0 + %15 = OpImageQuerySize %v2int %14 + %19 = OpCompositeConstruct %v2uint %uint_4 %uint_4 + %20 = OpShiftRightArithmetic %v2int %15 %19 + %21 = OpCompositeExtract %int %20 0 + %22 = OpCompositeExtract %int %20 1 + %23 = OpCompositeConstruct %v2int %21 %22 + OpStore %r0 %23 + OpStore %i %int_0 + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %int %i + %34 = OpAccessChain %_ptr_Function_int %r0 %uint_1 + %35 = OpLoad %int %34 + %37 = OpSLessThan %bool %32 %35 + OpBranchConditional %37 %28 %29 + %28 = OpLabel + OpStore %j %int_0 + OpBranch %39 + %39 = OpLabel + OpLoopMerge %41 %42 None + OpBranch %43 + %43 = OpLabel + %44 = OpLoad %int %j + %46 = OpAccessChain %_ptr_Function_int %r0 %uint_0 + %47 = OpLoad %int %46 + %48 = OpSLessThan %bool %44 %47 + OpBranchConditional %48 %40 %41 + %40 = OpLabel + %49 = OpLoad %11 %u0 + %50 = OpLoad %v2int %r0 + %54 = OpLoad %v3int %gl_LocalInvocationID + %55 = OpVectorShuffle %v2int %54 %54 0 1 + %57 = OpIMul %v2int %50 %55 + %58 = OpLoad %int %i + %59 = OpLoad %int %j + %60 = OpCompositeConstruct %v2int %58 %59 + %61 = OpIAdd %v2int %57 %60 + %68 = OpAccessChain %_ptr_Uniform_v4float %cb0_1 %int_0 %int_0 + %69 = OpLoad %v4float %68 + %70 = OpVectorShuffle %v4float %69 %69 0 0 0 0 + OpImageWrite %49 %61 %70 + OpBranch %42 + %42 = OpLabel + %71 = OpLoad %int %j + %73 = OpIAdd %int %71 %int_1 + OpStore %j %73 + OpBranch %39 + %41 = OpLabel + OpBranch %30 + %30 = OpLabel + %74 = OpLoad %int %i + %75 = OpIAdd %int %74 %int_1 + OpStore %i %75 + OpBranch %27 + %29 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag new file mode 100644 index 0000000000..ba2f95b234 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/combined-sampler-reuse.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTex "uTex" + OpName %uSampler "uSampler" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uTex DescriptorSet 0 + OpDecorate %uTex Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %uTex = OpVariable %_ptr_UniformConstant_10 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %uSampler = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeSampledImage %10 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v2int %int_1 %int_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %10 %uTex + %17 = OpLoad %14 %uSampler + %19 = OpSampledImage %18 %13 %17 + %23 = OpLoad %v2float %vUV + %24 = OpImageSampleImplicitLod %v4float %19 %23 + OpStore %FragColor %24 + %28 = OpLoad %v2float %vUV + %33 = OpImageSampleImplicitLod %v4float %19 %28 ConstOffset %32 + %34 = OpLoad %v4float %FragColor + %35 = OpFAdd %v4float %34 %33 + OpStore %FragColor %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..ba493c0f91 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/default-member-names.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpDecorate %3 Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %12 = OpTypeFunction %v4float + %_struct_5 = OpTypeStruct %float + %_struct_6 = OpTypeStruct %float %float %float %float %float %float %float %float %float %float %float %float %_struct_5 +%_ptr_Function__struct_6 = OpTypePointer Function %_struct_6 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %2 = OpFunction %void None %9 + %22 = OpLabel + %23 = OpVariable %_ptr_Function__struct_6 Function + %24 = OpAccessChain %_ptr_Function_float %23 %int_0 + %25 = OpLoad %float %24 + %26 = OpAccessChain %_ptr_Function_float %23 %int_1 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_Function_float %23 %int_2 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Function_float %23 %int_3 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v4float %25 %27 %29 %31 + OpStore %3 %32 + OpReturn + OpFunctionEnd + %4 = OpFunction %v4float None %12 + %33 = OpLabel + %7 = OpVariable %_ptr_Function__struct_6 Function + %34 = OpAccessChain %_ptr_Function_float %7 %int_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %7 %int_1 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Function_float %7 %int_2 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Function_float %7 %int_3 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %v4float %35 %37 %39 %41 + OpReturnValue %42 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag new file mode 100644 index 0000000000..0be26d1c05 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag @@ -0,0 +1,170 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 132 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %2 %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %3 Location 0 + OpDecorate %2 Location 1 + OpDecorate %4 BuiltIn FragCoord + OpDecorate %5 ArrayStride 4 + OpDecorate %6 ArrayStride 16 + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 BufferBlock + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 1 + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 2 + %11 = OpTypeVoid + %12 = OpTypeBool + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %13 2 + %18 = OpTypeVector %14 2 + %19 = OpTypeVector %16 2 + %20 = OpTypeVector %13 3 + %21 = OpTypeVector %14 3 + %22 = OpTypeVector %16 3 + %23 = OpTypeVector %13 4 + %24 = OpTypeVector %14 4 + %25 = OpTypeVector %16 4 + %26 = OpTypeVector %12 4 + %27 = OpTypeFunction %25 %25 + %28 = OpTypeFunction %12 + %29 = OpTypeFunction %11 + %30 = OpTypePointer Input %16 + %31 = OpTypePointer Input %13 + %32 = OpTypePointer Input %14 + %33 = OpTypePointer Input %19 + %34 = OpTypePointer Input %17 + %35 = OpTypePointer Input %18 + %38 = OpTypePointer Input %22 + %40 = OpTypePointer Input %25 + %41 = OpTypePointer Input %23 + %42 = OpTypePointer Input %24 + %43 = OpTypePointer Output %16 + %44 = OpTypePointer Output %13 + %45 = OpTypePointer Output %14 + %46 = OpTypePointer Output %19 + %47 = OpTypePointer Output %17 + %48 = OpTypePointer Output %18 + %49 = OpTypePointer Output %25 + %50 = OpTypePointer Output %23 + %51 = OpTypePointer Output %24 + %52 = OpTypePointer Function %16 + %53 = OpTypePointer Function %13 + %54 = OpTypePointer Function %25 + %55 = OpConstant %16 1 + %56 = OpConstant %16 0 + %57 = OpConstant %16 0.5 + %58 = OpConstant %16 -1 + %59 = OpConstant %16 7 + %60 = OpConstant %16 8 + %61 = OpConstant %13 0 + %62 = OpConstant %13 1 + %63 = OpConstant %13 2 + %64 = OpConstant %13 3 + %65 = OpConstant %13 4 + %66 = OpConstant %14 0 + %67 = OpConstant %14 1 + %68 = OpConstant %14 2 + %69 = OpConstant %14 3 + %70 = OpConstant %14 32 + %71 = OpConstant %14 4 + %72 = OpConstant %14 2147483647 + %73 = OpConstantComposite %25 %55 %55 %55 %55 + %74 = OpConstantComposite %25 %55 %56 %56 %55 + %75 = OpConstantComposite %25 %57 %57 %57 %57 + %76 = OpTypeArray %16 %67 + %77 = OpTypeArray %16 %68 + %78 = OpTypeArray %25 %69 + %79 = OpTypeArray %16 %71 + %80 = OpTypeArray %25 %70 + %81 = OpTypePointer Input %78 + %82 = OpTypePointer Input %80 + %83 = OpTypePointer Output %77 + %84 = OpTypePointer Output %78 + %85 = OpTypePointer Output %79 + %4 = OpVariable %40 Input + %3 = OpVariable %49 Output + %2 = OpVariable %40 Input + %86 = OpConstant %14 64 + %87 = OpConstant %13 64 + %88 = OpConstant %13 8 + %89 = OpConstantComposite %19 %60 %60 + %5 = OpTypeArray %16 %86 + %6 = OpTypeArray %25 %86 + %90 = OpTypePointer Uniform %16 + %91 = OpTypePointer Uniform %25 + %7 = OpTypeStruct %6 + %92 = OpTypePointer Uniform %7 + %10 = OpVariable %92 Uniform + %93 = OpTypeImage %16 2D 1 0 0 1 Rgba32f + %94 = OpTypePointer UniformConstant %93 + %8 = OpVariable %94 UniformConstant + %95 = OpTypeSampler + %96 = OpTypePointer UniformConstant %95 + %9 = OpVariable %96 UniformConstant + %97 = OpTypeSampledImage %93 + %98 = OpTypeFunction %11 %13 + %1 = OpFunction %11 None %29 + %99 = OpLabel + %100 = OpLoad %25 %2 + %101 = OpFunctionCall %25 %102 %100 + OpStore %3 %101 + OpReturn + OpFunctionEnd + %103 = OpFunction %12 None %28 + %104 = OpLabel + %105 = OpAccessChain %30 %4 %61 + %106 = OpAccessChain %30 %4 %62 + %107 = OpLoad %16 %105 + %108 = OpLoad %16 %106 + %109 = OpFOrdEqual %12 %107 %57 + %110 = OpFOrdEqual %12 %108 %57 + %111 = OpLogicalAnd %12 %109 %110 + OpReturnValue %111 + OpFunctionEnd + %112 = OpFunction %11 None %98 + %113 = OpFunctionParameter %13 + %114 = OpLabel + %115 = OpSRem %13 %113 %88 + %116 = OpSDiv %13 %113 %88 + %117 = OpCompositeConstruct %17 %115 %116 + %118 = OpConvertSToF %19 %117 + %119 = OpFDiv %19 %118 %89 + %120 = OpLoad %93 %8 + %121 = OpImageFetch %25 %120 %117 + %36 = OpAccessChain %91 %10 %61 %113 + OpStore %36 %121 + OpReturn + OpFunctionEnd + %102 = OpFunction %25 None %27 + %122 = OpFunctionParameter %25 + %123 = OpLabel + %124 = OpVariable %53 Function + OpStore %124 %61 + OpBranch %125 + %125 = OpLabel + %15 = OpLoad %13 %124 + %126 = OpSLessThan %12 %15 %87 + OpLoopMerge %127 %128 None + OpBranchConditional %126 %129 %127 + %129 = OpLabel + %130 = OpLoad %13 %124 + %131 = OpFunctionCall %11 %112 %130 + OpBranch %128 + %128 = OpLabel + %37 = OpLoad %13 %124 + %39 = OpIAdd %13 %37 %62 + OpStore %124 %39 + OpBranch %125 + %127 = OpLabel + OpReturnValue %122 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag new file mode 100644 index 0000000000..97e88b55a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag @@ -0,0 +1,173 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 134 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" %2 %3 %4 + OpExecutionMode %1 OriginUpperLeft + OpDecorate %3 Location 0 + OpDecorate %2 Location 1 + OpDecorate %4 BuiltIn FragCoord + OpDecorate %5 ArrayStride 4 + OpDecorate %6 ArrayStride 16 + OpMemberDecorate %7 0 Offset 0 + OpDecorate %7 BufferBlock + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 1 + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 2 + %11 = OpTypeVoid + %12 = OpTypeBool + %13 = OpTypeInt 32 1 + %14 = OpTypeInt 32 0 + %16 = OpTypeFloat 32 + %17 = OpTypeVector %13 2 + %18 = OpTypeVector %14 2 + %19 = OpTypeVector %16 2 + %20 = OpTypeVector %13 3 + %21 = OpTypeVector %14 3 + %22 = OpTypeVector %16 3 + %23 = OpTypeVector %13 4 + %24 = OpTypeVector %14 4 + %25 = OpTypeVector %16 4 + %26 = OpTypeVector %12 4 + %27 = OpTypeFunction %25 %25 + %28 = OpTypeFunction %12 + %29 = OpTypeFunction %11 + %30 = OpTypePointer Input %16 + %31 = OpTypePointer Input %13 + %32 = OpTypePointer Input %14 + %33 = OpTypePointer Input %19 + %34 = OpTypePointer Input %17 + %35 = OpTypePointer Input %18 + %38 = OpTypePointer Input %22 + %40 = OpTypePointer Input %25 + %41 = OpTypePointer Input %23 + %42 = OpTypePointer Input %24 + %43 = OpTypePointer Output %16 + %44 = OpTypePointer Output %13 + %45 = OpTypePointer Output %14 + %46 = OpTypePointer Output %19 + %47 = OpTypePointer Output %17 + %48 = OpTypePointer Output %18 + %49 = OpTypePointer Output %25 + %50 = OpTypePointer Output %23 + %51 = OpTypePointer Output %24 + %52 = OpTypePointer Function %16 + %53 = OpTypePointer Function %13 + %54 = OpTypePointer Function %25 + %55 = OpConstant %16 1 + %56 = OpConstant %16 0 + %57 = OpConstant %16 0.5 + %58 = OpConstant %16 -1 + %59 = OpConstant %16 7 + %60 = OpConstant %16 8 + %61 = OpConstant %13 0 + %62 = OpConstant %13 1 + %63 = OpConstant %13 2 + %64 = OpConstant %13 3 + %65 = OpConstant %13 4 + %66 = OpConstant %14 0 + %67 = OpConstant %14 1 + %68 = OpConstant %14 2 + %69 = OpConstant %14 3 + %70 = OpConstant %14 32 + %71 = OpConstant %14 4 + %72 = OpConstant %14 2147483647 + %73 = OpConstantComposite %25 %55 %55 %55 %55 + %74 = OpConstantComposite %25 %55 %56 %56 %55 + %75 = OpConstantComposite %25 %57 %57 %57 %57 + %76 = OpTypeArray %16 %67 + %77 = OpTypeArray %16 %68 + %78 = OpTypeArray %25 %69 + %79 = OpTypeArray %16 %71 + %80 = OpTypeArray %25 %70 + %81 = OpTypePointer Input %78 + %82 = OpTypePointer Input %80 + %83 = OpTypePointer Output %77 + %84 = OpTypePointer Output %78 + %85 = OpTypePointer Output %79 + %4 = OpVariable %40 Input + %3 = OpVariable %49 Output + %2 = OpVariable %40 Input + %86 = OpConstant %14 64 + %87 = OpConstant %13 64 + %88 = OpConstant %13 8 + %89 = OpConstantComposite %19 %60 %60 + %5 = OpTypeArray %16 %86 + %6 = OpTypeArray %25 %86 + %90 = OpTypePointer Uniform %16 + %91 = OpTypePointer Uniform %25 + %7 = OpTypeStruct %6 + %92 = OpTypePointer Uniform %7 + %10 = OpVariable %92 Uniform + %93 = OpTypeImage %16 2D 1 0 0 1 Rgba32f + %94 = OpTypePointer UniformConstant %93 + %8 = OpVariable %94 UniformConstant + %95 = OpTypeSampler + %96 = OpTypePointer UniformConstant %95 + %9 = OpVariable %96 UniformConstant + %97 = OpTypeSampledImage %93 + %98 = OpTypeFunction %11 %13 + %1 = OpFunction %11 None %29 + %99 = OpLabel + %100 = OpLoad %25 %2 + %101 = OpFunctionCall %25 %102 %100 + OpStore %3 %101 + OpReturn + OpFunctionEnd + %103 = OpFunction %12 None %28 + %104 = OpLabel + %105 = OpAccessChain %30 %4 %61 + %106 = OpAccessChain %30 %4 %62 + %107 = OpLoad %16 %105 + %108 = OpLoad %16 %106 + %109 = OpFOrdEqual %12 %107 %57 + %110 = OpFOrdEqual %12 %108 %57 + %111 = OpLogicalAnd %12 %109 %110 + OpReturnValue %111 + OpFunctionEnd + %112 = OpFunction %11 None %98 + %113 = OpFunctionParameter %13 + %114 = OpLabel + %115 = OpSRem %13 %113 %88 + %116 = OpSDiv %13 %113 %88 + %117 = OpCompositeConstruct %17 %115 %116 + %118 = OpConvertSToF %19 %117 + %119 = OpFDiv %19 %118 %89 + %120 = OpLoad %93 %8 + %121 = OpLoad %95 %9 + %122 = OpSampledImage %97 %120 %121 + %123 = OpImageSampleExplicitLod %25 %122 %119 Lod %56 + %36 = OpAccessChain %91 %10 %61 %113 + OpStore %36 %123 + OpReturn + OpFunctionEnd + %102 = OpFunction %25 None %27 + %124 = OpFunctionParameter %25 + %125 = OpLabel + %126 = OpVariable %53 Function + OpStore %126 %61 + OpBranch %127 + %127 = OpLabel + %15 = OpLoad %13 %126 + %128 = OpSLessThan %12 %15 %87 + OpLoopMerge %129 %130 None + OpBranchConditional %128 %131 %129 + %131 = OpLabel + %132 = OpLoad %13 %126 + %133 = OpFunctionCall %11 %112 %132 + OpBranch %130 + %130 = OpLabel + %37 = OpLoad %13 %126 + %39 = OpIAdd %13 %37 %62 + OpStore %126 %39 + OpBranch %127 + %129 = OpLabel + OpReturnValue %124 + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag new file mode 100644 index 0000000000..7af7605d8a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/descriptor-array-unnamed.asm.frag @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpDecorate %FragColor Location 0 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 5 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubos DescriptorSet 0 + OpDecorate %ubos Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %SSBO = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_SSBO_uint_4 = OpTypeArray %SSBO %uint_4 +%_ptr_Uniform__arr_SSBO_uint_4 = OpTypePointer Uniform %_arr_SSBO_uint_4 + %ssbos = OpVariable %_ptr_Uniform__arr_SSBO_uint_4 Uniform + %int = OpTypeInt 32 1 + %Registers = OpTypeStruct %int +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_int = OpTypePointer PushConstant %int +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %UBO = OpTypeStruct %v4float +%_arr_UBO_uint_4 = OpTypeArray %UBO %uint_4 +%_ptr_Uniform__arr_UBO_uint_4 = OpTypePointer Uniform %_arr_UBO_uint_4 + %ubos = OpVariable %_ptr_Uniform__arr_UBO_uint_4 Uniform +%float_0_200000003 = OpConstant %float 0.200000003 + %36 = OpConstantComposite %v4float %float_0_200000003 %float_0_200000003 %float_0_200000003 %float_0_200000003 + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_PushConstant_int %registers %int_0 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_v4float %ssbos %23 %int_0 + %26 = OpLoad %v4float %25 + %31 = OpAccessChain %_ptr_PushConstant_int %registers %int_0 + %32 = OpLoad %int %31 + %33 = OpAccessChain %_ptr_Uniform_v4float %ubos %32 %int_0 + %34 = OpLoad %v4float %33 + %37 = OpFMul %v4float %34 %36 + %38 = OpFAdd %v4float %26 %37 + OpStore %FragColor %38 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag new file mode 100644 index 0000000000..02d018267a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/disable-renamed-output.frag-output.asm.frag @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 37 +; Schema: 0 + OpCapability Shader + OpCapability StencilExportEXT + OpExtension "SPV_EXT_shader_stencil_export" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o0 %o1 %o2 %o3 %o4 %o5 %o6 %o7 %oDepth %oStencil + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpSourceExtension "GL_ARB_shader_stencil_export" + OpName %main "main" + OpName %o0 "o0" + OpName %o1 "o1" + OpName %o2 "o2" + OpName %o3 "o3" + OpName %o4 "o4" + OpName %o5 "o5" + OpName %o6 "o6" + OpName %o7 "o7" + OpName %oDepth "oDepth" + OpName %oStencil "oStencil" + OpDecorate %o0 Location 0 + OpDecorate %o1 Location 1 + OpDecorate %o2 Location 2 + OpDecorate %o3 Location 3 + OpDecorate %o4 Location 4 + OpDecorate %o5 Location 5 + OpDecorate %o6 Location 6 + OpDecorate %o7 Location 7 + OpDecorate %oDepth BuiltIn FragDepth + OpDecorate %oStencil BuiltIn FragStencilRefEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o0 = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %o1 = OpVariable %_ptr_Output_v4float Output + %14 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %o2 = OpVariable %_ptr_Output_v4float Output + %16 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %o3 = OpVariable %_ptr_Output_v4float Output + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_1 + %o4 = OpVariable %_ptr_Output_v4float Output + %float_0_5 = OpConstant %float 0.5 + %21 = OpConstantComposite %v4float %float_1 %float_0 %float_1 %float_0_5 + %o5 = OpVariable %_ptr_Output_v4float Output + %float_0_25 = OpConstant %float 0.25 + %24 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 + %o6 = OpVariable %_ptr_Output_v4float Output + %float_0_75 = OpConstant %float 0.75 + %27 = OpConstantComposite %v4float %float_0_75 %float_0_75 %float_0_75 %float_0_75 + %o7 = OpVariable %_ptr_Output_v4float Output + %29 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_float = OpTypePointer Output %float + %oDepth = OpVariable %_ptr_Output_float Output +%float_0_899999976 = OpConstant %float 0.899999976 + %int = OpTypeInt 32 1 +%_ptr_Output_int = OpTypePointer Output %int + %oStencil = OpVariable %_ptr_Output_int Output + %int_127 = OpConstant %int 127 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %o0 %12 + OpStore %o1 %14 + OpStore %o2 %16 + OpStore %o3 %18 + OpStore %o4 %21 + OpStore %o5 %24 + OpStore %o6 %27 + OpStore %o7 %29 + OpStore %oDepth %float_0_899999976 + OpStore %oStencil %int_127 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..0efd3158cb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/empty-struct.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%_ptr_Function_EmptyStructTest = OpTypePointer Function %EmptyStructTest + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStructTest + %6 = OpTypeFunction %float %EmptyStructTest + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStructTest + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStructTest + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStructTest + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStructTest Function + %18 = OpVariable %_ptr_Function_EmptyStructTest Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value2 + OpStore %value %22 + OpStore %value %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag new file mode 100644 index 0000000000..b27f598a8e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag @@ -0,0 +1,108 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %pos_1 %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %_main_vf4_ "@main(vf4;" + OpName %pos "pos" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpName %foo "foo" + OpName %Foo_0 "Foo" + OpMemberName %Foo_0 0 "a" + OpMemberName %Foo_0 1 "b" + OpName %buf "buf" + OpMemberName %buf 0 "results" + OpMemberName %buf 1 "bar" + OpName %_ "" + OpName %pos_0 "pos" + OpName %pos_1 "pos" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param "param" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Foo_0 1 Offset 12 + OpDecorate %_arr_Foo_0_uint_16 ArrayStride 16 + OpMemberDecorate %buf 0 Offset 0 + OpMemberDecorate %buf 1 Offset 256 + OpDecorate %buf Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %pos_1 BuiltIn FragCoord + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %9 = OpTypeFunction %v4float %_ptr_Function_v4float + %v3float = OpTypeVector %float 3 + %Foo = OpTypeStruct %v3float %float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %v3float %float + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_Foo_0_uint_16 = OpTypeArray %Foo_0 %uint_16 + %buf = OpTypeStruct %_arr_Foo_0_uint_16 %v4float +%_ptr_Uniform_buf = OpTypePointer Uniform %buf + %_ = OpVariable %_ptr_Uniform_buf Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_16 = OpConstant %int 16 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %float_0 = OpConstant %float 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %pos_1 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %pos_0 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_v4float Function + %58 = OpLoad %v4float %pos_1 + OpStore %pos_0 %58 + %62 = OpLoad %v4float %pos_0 + OpStore %param %62 + %63 = OpFunctionCall %v4float %_main_vf4_ %param + OpStore %_entryPointOutput %63 + OpReturn + OpFunctionEnd + %_main_vf4_ = OpFunction %v4float None %9 + %pos = OpFunctionParameter %_ptr_Function_v4float + %12 = OpLabel + %foo = OpVariable %_ptr_Function_Foo Function + %28 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %29 = OpLoad %float %28 + %30 = OpConvertFToS %int %29 + %32 = OpSMod %int %30 %int_16 + %34 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_0 %32 + %35 = OpLoad %Foo_0 %34 + %36 = OpCompositeExtract %v3float %35 0 + %38 = OpAccessChain %_ptr_Function_v3float %foo %int_0 + OpStore %38 %36 + %39 = OpCompositeExtract %float %35 1 + %41 = OpAccessChain %_ptr_Function_float %foo %int_1 + OpStore %41 %39 + %42 = OpAccessChain %_ptr_Function_v3float %foo %int_0 + %43 = OpLoad %v3float %42 + %45 = OpAccessChain %_ptr_Uniform_v4float %_ %int_1 + %46 = OpLoad %v4float %45 + %47 = OpVectorShuffle %v3float %46 %46 0 1 2 + %48 = OpDot %float %43 %47 + %49 = OpAccessChain %_ptr_Function_float %foo %int_1 + %50 = OpLoad %float %49 + %52 = OpCompositeConstruct %v4float %48 %50 %float_0 %float_0 + OpReturnValue %52 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/frem.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..8350c75c04 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/frem.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 16 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Location 1 + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vA = OpVariable %_ptr_Input_v4float Input + %vB = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %vA + %14 = OpLoad %v4float %vB + %15 = OpFRem %v4float %12 %14 + OpStore %FragColor %15 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..397aa98ce2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,153 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %foobar_vf4_ "foo" + OpName %a "foo" + OpName %foobar_vf3_ "foo" + OpName %a_0 "foo" + OpName %foobaz_vf4_ "foo" + OpName %a_1 "foo" + OpName %foobaz_vf2_ "foo" + OpName %a_2 "foo" + OpName %a_3 "foo" + OpName %param "foo" + OpName %b "foo" + OpName %param_0 "foo" + OpName %c "foo" + OpName %param_1 "foo" + OpName %d "foo" + OpName %param_2 "foo" + OpName %FragColor "FragColor" + OpDecorate %foobar_vf4_ RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %foobar_vf3_ RelaxedPrecision + OpDecorate %a_0 RelaxedPrecision + OpDecorate %foobaz_vf4_ RelaxedPrecision + OpDecorate %a_1 RelaxedPrecision + OpDecorate %foobaz_vf2_ RelaxedPrecision + OpDecorate %a_2 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %a_3 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %9 = OpTypeFunction %v4float %_ptr_Function_v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %15 = OpTypeFunction %v4float %_ptr_Function_v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpTypeFunction %v4float %_ptr_Function_v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %57 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %64 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_3 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_v4float Function + %param_0 = OpVariable %_ptr_Function_v3float Function + %c = OpVariable %_ptr_Function_v4float Function + %param_1 = OpVariable %_ptr_Function_v4float Function + %d = OpVariable %_ptr_Function_v4float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + OpStore %param %53 + %55 = OpFunctionCall %v4float %foobar_vf4_ %param + OpStore %a_3 %55 + OpStore %param_0 %57 + %59 = OpFunctionCall %v4float %foobar_vf3_ %param_0 + OpStore %b %59 + OpStore %param_1 %53 + %62 = OpFunctionCall %v4float %foobaz_vf4_ %param_1 + OpStore %c %62 + OpStore %param_2 %64 + %66 = OpFunctionCall %v4float %foobaz_vf2_ %param_2 + OpStore %d %66 + %69 = OpLoad %v4float %a_3 + %70 = OpLoad %v4float %b + %71 = OpFAdd %v4float %69 %70 + %72 = OpLoad %v4float %c + %73 = OpFAdd %v4float %71 %72 + %74 = OpLoad %v4float %d + %75 = OpFAdd %v4float %73 %74 + OpStore %FragColor %75 + OpReturn + OpFunctionEnd +%foobar_vf4_ = OpFunction %v4float None %9 + %a = OpFunctionParameter %_ptr_Function_v4float + %12 = OpLabel + %28 = OpLoad %v4float %a + %30 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %31 = OpFAdd %v4float %28 %30 + OpReturnValue %31 + OpFunctionEnd +%foobar_vf3_ = OpFunction %v4float None %15 + %a_0 = OpFunctionParameter %_ptr_Function_v3float + %18 = OpLabel + %34 = OpLoad %v3float %a_0 + %35 = OpVectorShuffle %v4float %34 %34 0 1 2 2 + %36 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %37 = OpFAdd %v4float %35 %36 + OpReturnValue %37 + OpFunctionEnd +%foobaz_vf4_ = OpFunction %v4float None %9 + %a_1 = OpFunctionParameter %_ptr_Function_v4float + %21 = OpLabel + %40 = OpLoad %v4float %a_1 + %42 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %43 = OpFAdd %v4float %40 %42 + OpReturnValue %43 + OpFunctionEnd +%foobaz_vf2_ = OpFunction %v4float None %24 + %a_2 = OpFunctionParameter %_ptr_Function_v2float + %27 = OpLabel + %46 = OpLoad %v2float %a_2 + %47 = OpVectorShuffle %v4float %46 %46 0 1 0 1 + %48 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %49 = OpFAdd %v4float %47 %48 + OpReturnValue %49 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..63c8ab57a5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %Size + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %Size "Size" + OpName %uTexture "uTexture" + OpDecorate %Size Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Output_v2int = OpTypePointer Output %v2int + %Size = OpVariable %_ptr_Output_v2int Output + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %17 = OpImage %11 %15 + %18 = OpImageQuerySizeLod %v2int %17 %int_0 + %19 = OpImageQuerySizeLod %v2int %17 %int_1 + %20 = OpIAdd %v2int %18 %19 + OpStore %Size %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..ccdfeef58d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v0 %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %phi "phi" + OpName %i "i" + OpName %v0 "v0" + OpName %FragColor "FragColor" + OpName %uImage "uImage" + OpDecorate %v0 Location 0 + OpDecorate %FragColor Location 0 + OpDecorate %uImage DescriptorSet 0 + OpDecorate %uImage Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %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 + %v0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %36 = OpTypeImage %float 2D 0 0 0 1 Unknown + %37 = OpTypeSampledImage %36 +%_ptr_UniformConstant_37 = OpTypePointer UniformConstant %37 + %uImage = OpVariable %_ptr_UniformConstant_37 UniformConstant + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_2 = OpConstant %float 2 + %int_1 = OpConstant %int 1 + %float_1_vec = OpConstantComposite %v4float %float_1 %float_2 %float_1 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %loop_header + %loop_header = OpLabel + %phi = OpPhi %float %float_1 %5 %phi_plus_2 %continue_block + %tex_phi = OpPhi %v4float %float_1_vec %5 %texture_load_result %continue_block + OpLoopMerge %merge_block %continue_block None + OpBranch %loop_body + %loop_body = OpLabel + OpStore %FragColor %tex_phi + %19 = OpLoad %int %i + %22 = OpSLessThan %bool %19 %int_4 + OpBranchConditional %22 %15 %merge_block + %15 = OpLabel + %26 = OpLoad %int %i + %28 = OpAccessChain %_ptr_Input_float %v0 %26 + %29 = OpLoad %float %28 + %31 = OpFOrdGreaterThan %bool %29 %float_0 + OpBranchConditional %31 %continue_block %merge_block + %continue_block = OpLabel + %40 = OpLoad %37 %uImage + %43 = OpCompositeConstruct %v2float %phi %phi + %texture_load_result = OpImageSampleExplicitLod %v4float %40 %43 Lod %float_0 + %phi_plus_2 = OpFAdd %float %phi %float_2 + %54 = OpLoad %int %i + %56 = OpIAdd %int %54 %int_1 + OpStore %i %56 + OpBranch %loop_header + %merge_block = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..40e5d3a89c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 14 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %FragColor = OpVariable %_ptr_Output_v3float Output +%float_0x1p_128 = OpConstant %float 0x1p+128 +%float_n0x1p_128 = OpConstant %float -0x1p+128 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %13 = OpConstantComposite %v3float %float_0x1p_128 %float_n0x1p_128 %float_0x1_8p_128 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %13 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag new file mode 100644 index 0000000000..bd6d06fa73 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/interpolation-qualifiers-struct.asm.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpCapability SampleRateShading + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %inp + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %Input "Input" + OpMemberName %Input 0 "v0" + OpMemberName %Input 1 "v1" + OpMemberName %Input 2 "v2" + OpMemberName %Input 3 "v3" + OpMemberName %Input 4 "v4" + OpMemberName %Input 5 "v5" + OpMemberName %Input 6 "v6" + OpName %inp "inp" + OpDecorate %FragColor Location 0 + OpDecorate %inp Location 0 + OpMemberDecorate %Input 1 NoPerspective + OpMemberDecorate %Input 2 Centroid + OpMemberDecorate %Input 3 Centroid + OpMemberDecorate %Input 3 NoPerspective + OpMemberDecorate %Input 4 Sample + OpMemberDecorate %Input 5 Sample + OpMemberDecorate %Input 5 NoPerspective + OpMemberDecorate %Input 6 Flat + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %Input = OpTypeStruct %v2float %v2float %v3float %v4float %float %float %float +%_ptr_Input_Input = OpTypePointer Input %Input + %inp = OpVariable %_ptr_Input_Input Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 + %int_2 = OpConstant %int 2 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %int_3 = OpConstant %int 3 + %uint_3 = OpConstant %uint 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_float %inp %int_0 %uint_0 + %21 = OpLoad %float %20 + %24 = OpAccessChain %_ptr_Input_float %inp %int_1 %uint_1 + %25 = OpLoad %float %24 + %26 = OpFAdd %float %21 %25 + %29 = OpAccessChain %_ptr_Input_v3float %inp %int_2 + %30 = OpLoad %v3float %29 + %31 = OpVectorShuffle %v2float %30 %30 0 1 + %34 = OpAccessChain %_ptr_Input_float %inp %int_3 %uint_3 + %35 = OpLoad %float %34 + %37 = OpAccessChain %_ptr_Input_float %inp %int_4 + %38 = OpLoad %float %37 + %39 = OpFMul %float %35 %38 + %41 = OpAccessChain %_ptr_Input_float %inp %int_5 + %42 = OpLoad %float %41 + %43 = OpFAdd %float %39 %42 + %45 = OpAccessChain %_ptr_Input_float %inp %int_6 + %46 = OpLoad %float %45 + %47 = OpFSub %float %43 %46 + %48 = OpCompositeExtract %float %31 0 + %49 = OpCompositeExtract %float %31 1 + %50 = OpCompositeConstruct %v4float %26 %48 %49 %47 + OpStore %FragColor %50 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..9e08e9a891 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 7 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vColor + OpExecutionMode %main OriginUpperLeft + %1 = OpString "test.frag" + OpSource GLSL 450 %1 "// OpModuleProcessed entry-point main +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed entry-point main +#line 1 +#version 450 + +layout(location = 0) in float vColor; +layout(location = 0) out float FragColor; + +void func() +{ + FragColor = 1.0; + FragColor = 2.0; + if (vColor < 0.0) + { + FragColor = 3.0; + } + else + { + FragColor = 4.0; + } + + for (int i = 0; i < 40 + vColor; i += int(vColor) + 5) + { + FragColor += 0.2; + FragColor += 0.3; + } + + switch (int(vColor)) + { + case 0: + FragColor += 0.2; + break; + + case 1: + FragColor += 0.4; + break; + + default: + FragColor += 0.8; + break; + } + + do + { + FragColor += 10.0 + vColor; + } while(FragColor < 100.0); +} + +void main() +{ + func(); +} +" + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %func_ "func(" + OpName %FragColor "FragColor" + OpName %vColor "vColor" + OpName %i "i" + OpDecorate %FragColor Location 0 + OpDecorate %vColor Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 +%_ptr_Input_float = OpTypePointer Input %float + %vColor = OpVariable %_ptr_Input_float Input + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int = OpTypeInt 32 1 + + ; Should be ignored + OpLine %1 5 0 + +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float_40 = OpConstant %float 40 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %int_5 = OpConstant %int 5 + + ; Should be ignored + OpLine %1 5 0 + +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_800000012 = OpConstant %float 0.800000012 + %float_10 = OpConstant %float 10 + %float_100 = OpConstant %float 100 + %main = OpFunction %void None %4 + OpLine %1 46 0 + %6 = OpLabel + OpLine %1 48 0 + %82 = OpFunctionCall %void %func_ + OpReturn + OpFunctionEnd + + ; Should be ignored + OpLine %1 5 0 + + %func_ = OpFunction %void None %4 + OpLine %1 6 0 + %8 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpLine %1 8 0 + OpStore %FragColor %float_1 + OpLine %1 9 0 + OpStore %FragColor %float_2 + OpLine %1 10 0 + %16 = OpLoad %float %vColor + %19 = OpFOrdLessThan %bool %16 %float_0 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %23 + %20 = OpLabel + OpLine %1 12 0 + OpStore %FragColor %float_3 + OpBranch %21 + %23 = OpLabel + OpLine %1 16 0 + OpStore %FragColor %float_4 + OpBranch %21 + %21 = OpLabel + OpLine %1 19 0 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpConvertSToF %float %34 + %37 = OpLoad %float %vColor + %38 = OpFAdd %float %float_40 %37 + %39 = OpFOrdLessThan %bool %35 %38 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + OpLine %1 21 0 + %41 = OpLoad %float %FragColor + %42 = OpFAdd %float %41 %float_0_200000003 + OpStore %FragColor %42 + OpLine %1 22 0 + %44 = OpLoad %float %FragColor + %45 = OpFAdd %float %44 %float_0_300000012 + OpStore %FragColor %45 + OpBranch %32 + %32 = OpLabel + OpLine %1 19 0 + %46 = OpLoad %float %vColor + %47 = OpConvertFToS %int %46 + %49 = OpIAdd %int %47 %int_5 + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %49 + OpStore %i %51 + OpBranch %29 + %31 = OpLabel + OpLine %1 25 0 + %52 = OpLoad %float %vColor + %53 = OpConvertFToS %int %52 + OpSelectionMerge %57 None + OpSwitch %53 %56 0 %54 1 %55 + %56 = OpLabel + OpLine %1 36 0 + %66 = OpLoad %float %FragColor + %67 = OpFAdd %float %66 %float_0_800000012 + OpStore %FragColor %67 + OpLine %1 37 0 + OpBranch %57 + %54 = OpLabel + OpLine %1 28 0 + %58 = OpLoad %float %FragColor + %59 = OpFAdd %float %58 %float_0_200000003 + OpStore %FragColor %59 + OpLine %1 29 0 + OpBranch %57 + %55 = OpLabel + OpLine %1 32 0 + %62 = OpLoad %float %FragColor + %63 = OpFAdd %float %62 %float_0_400000006 + OpStore %FragColor %63 + OpLine %1 33 0 + OpBranch %57 + %57 = OpLabel + OpBranch %70 + OpLine %1 43 0 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %71 + %71 = OpLabel + OpLine %1 42 0 + %75 = OpLoad %float %vColor + %76 = OpFAdd %float %float_10 %75 + %77 = OpLoad %float %FragColor + %78 = OpFAdd %float %77 %76 + OpStore %FragColor %78 + OpBranch %73 + %73 = OpLabel + OpLine %1 43 0 + %79 = OpLoad %float %FragColor + %81 = OpFOrdLessThan %bool %79 %float_100 + OpBranchConditional %81 %70 %72 + %72 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..16bfc525bc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/locations-components.asm.frag @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %8 %16 %22 %28 %33 %o0 + OpExecutionMode %main OriginUpperLeft + OpName %main "main" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %o0 "o0" + OpName %r0 "r0" + OpDecorate %8 Location 1 + OpDecorate %16 Location 1 + OpDecorate %16 Component 2 + OpDecorate %22 Location 2 + OpDecorate %22 Flat + OpDecorate %28 Location 2 + OpDecorate %28 Component 1 + OpDecorate %28 Flat + OpDecorate %33 Location 2 + OpDecorate %33 Component 2 + OpDecorate %33 Flat + OpDecorate %o0 Location 0 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %8 = OpVariable %_ptr_Input_v2float Input + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %v1 = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_float = OpTypePointer Input %float + %16 = OpVariable %_ptr_Input_float Input +%_ptr_Private_float = OpTypePointer Private %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %22 = OpVariable %_ptr_Input_float Input + %v2 = OpVariable %_ptr_Private_v4float Private + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %28 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 + %33 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o0 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %2 + %4 = OpLabel + %r0 = OpVariable %_ptr_Function_v4float Function + %12 = OpLoad %v2float %8 + %13 = OpLoad %v4float %v1 + %14 = OpVectorShuffle %v4float %13 %12 4 5 2 3 + OpStore %v1 %14 + %17 = OpLoad %float %16 + %21 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_2 + OpStore %21 %17 + %24 = OpLoad %float %22 + %26 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0 + OpStore %26 %24 + %29 = OpLoad %uint %28 + %30 = OpBitcast %float %29 + %32 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1 + OpStore %32 %30 + %34 = OpLoad %uint %33 + %35 = OpBitcast %float %34 + %36 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2 + OpStore %36 %35 + %42 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1 + %43 = OpLoad %float %42 + %44 = OpBitcast %int %43 + %45 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2 + %46 = OpLoad %float %45 + %47 = OpBitcast %int %46 + %48 = OpIAdd %int %44 %47 + %49 = OpBitcast %float %48 + %51 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + OpStore %51 %49 + %52 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + %53 = OpLoad %float %52 + %54 = OpBitcast %uint %53 + %55 = OpConvertUToF %float %54 + %57 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_1 + OpStore %57 %55 + %58 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_1 + %59 = OpLoad %float %58 + %60 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0 + %61 = OpLoad %float %60 + %62 = OpFAdd %float %59 %61 + %63 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_0 + OpStore %63 %62 + %64 = OpLoad %v4float %v1 + %65 = OpLoad %v4float %o0 + %66 = OpVectorShuffle %v4float %65 %64 0 1 6 4 + OpStore %o0 %66 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..320e5ebfbd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,195 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %index + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %index "index" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %foo "foo" + OpName %foobar "foobar" + OpName %baz "baz" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %index RelaxedPrecision + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %foo RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %foobar RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %baz RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_float_uint_16 = OpTypeArray %float %uint_16 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %_arr_float_uint_16 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input +%_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16 +%_ptr_Function_float = OpTypePointer Function %float + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 + %float_0 = OpConstant %float 0 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %55 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_8 = OpConstant %float 8 + %57 = OpConstantComposite %v4float %float_8 %float_8 %float_8 %float_8 + %float_5 = OpConstant %float 5 + %59 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %60 = OpConstantComposite %_arr_v4float_uint_4 %54 %55 %57 %59 + %int_30 = OpConstant %int 30 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %float_20 = OpConstant %float 20 + %uint_2 = OpConstant %uint 2 + %97 = OpConstantComposite %v4float %float_20 %float_20 %float_20 %float_20 + %float_30 = OpConstant %float 30 + %99 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 + %float_50 = OpConstant %float 50 + %101 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50 + %float_60 = OpConstant %float 60 + %103 = OpConstantComposite %v4float %float_60 %float_60 %float_60 %float_60 + %104 = OpConstantComposite %_arr_v4float_uint_4 %97 %99 %101 %103 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_0 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_1 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 + %foo = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %foobar = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %baz = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %20 = OpLoad %int %index + %24 = OpAccessChain %_ptr_Function_float %indexable %20 + %25 = OpLoad %float %24 + OpStore %FragColor %25 + %26 = OpLoad %int %index + %29 = OpSLessThan %bool %26 %int_10 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %40 + %30 = OpLabel + %32 = OpLoad %int %index + %34 = OpBitwiseXor %int %32 %int_1 + %36 = OpAccessChain %_ptr_Function_float %indexable_0 %34 + %37 = OpLoad %float %36 + %38 = OpLoad %float %FragColor + %39 = OpFAdd %float %38 %37 + OpStore %FragColor %39 + OpBranch %31 + %40 = OpLabel + %41 = OpLoad %int %index + %42 = OpBitwiseAnd %int %41 %int_1 + %44 = OpAccessChain %_ptr_Function_float %indexable_1 %42 + %45 = OpLoad %float %44 + %46 = OpLoad %float %FragColor + %47 = OpFAdd %float %46 %45 + OpStore %FragColor %47 + OpBranch %31 + %31 = OpLabel + %61 = OpLoad %int %index + %63 = OpSGreaterThan %bool %61 %int_30 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %74 + %64 = OpLabel + %66 = OpLoad %int %index + %68 = OpBitwiseAnd %int %66 %int_3 + %70 = OpAccessChain %_ptr_Function_float %foo %68 %uint_1 + %71 = OpLoad %float %70 + %72 = OpLoad %float %FragColor + %73 = OpFAdd %float %72 %71 + OpStore %FragColor %73 + OpBranch %65 + %74 = OpLabel + %75 = OpLoad %int %index + %76 = OpBitwiseAnd %int %75 %int_1 + %78 = OpAccessChain %_ptr_Function_float %foo %76 %uint_0 + %79 = OpLoad %float %78 + %80 = OpLoad %float %FragColor + %81 = OpFAdd %float %80 %79 + OpStore %FragColor %81 + OpBranch %65 + %65 = OpLabel + %83 = OpLoad %int %index + %84 = OpSGreaterThan %bool %83 %int_30 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %foobar %int_1 %uint_2 + OpStore %89 %float_20 + OpBranch %86 + %86 = OpLabel + %90 = OpLoad %int %index + %91 = OpBitwiseAnd %int %90 %int_3 + %92 = OpAccessChain %_ptr_Function_float %foobar %91 %uint_2 + %93 = OpLoad %float %92 + %94 = OpLoad %float %FragColor + %95 = OpFAdd %float %94 %93 + OpStore %FragColor %95 + OpStore %baz %104 + %105 = OpLoad %int %index + %106 = OpBitwiseAnd %int %105 %int_3 + %107 = OpAccessChain %_ptr_Function_float %baz %106 %uint_2 + %108 = OpLoad %float %107 + %109 = OpLoad %float %FragColor + %110 = OpFAdd %float %109 %108 + OpStore %FragColor %110 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/min-lod.msl22.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/min-lod.msl22.asm.frag new file mode 100644 index 0000000000..0d30e1694a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/min-lod.msl22.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability MinLod + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSampler "uSampler" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSampler = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %float_4 = OpConstant %float 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uSampler + %18 = OpLoad %v2float %vUV + %20 = OpImageSampleImplicitLod %v4float %14 %18 MinLod %float_4 + OpStore %FragColor %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..61d2e579c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %D "D" + OpMemberName %D 0 "a" + OpMemberName %D 1 "b" + OpName %d "d" + OpName %e "e" + OpName %FragColor "FragColor" + OpDecorate %a RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpMemberDecorate %D 0 RelaxedPrecision + OpMemberDecorate %D 1 RelaxedPrecision + OpDecorate %e RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %44 RelaxedPrecision + OpDecorate %float_1 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstantNull %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_2 = OpConstantNull %float + %14 = OpConstantNull %v4float + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %float_4 = OpConstantNull %float + %20 = OpConstantNull %v3float + %float_5 = OpConstantNull %float + %22 = OpConstantNull %v3float + %23 = OpConstantNull %mat2v3float + %D = OpTypeStruct %v4float %float +%_ptr_Function_D = OpTypePointer Function %D + %27 = OpConstantNull %D + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 + %float_10 = OpConstantNull %float + %34 = OpConstantNull %v4float + %float_11 = OpConstantNull %float + %36 = OpConstantNull %v4float + %float_12 = OpConstantNull %float + %38 = OpConstantNull %v4float + %float_13 = OpConstantNull %float + %40 = OpConstantNull %v4float + %41 = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_v4float Function + %c = OpVariable %_ptr_Function_mat2v3float Function + %d = OpVariable %_ptr_Function_D Function + %e = OpVariable %_ptr_Function__arr_v4float_uint_4 Function + OpStore %a %float_1 + OpStore %b %14 + OpStore %c %23 + OpStore %d %27 + OpStore %e %41 + %44 = OpLoad %float %a + OpStore %FragColor %44 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/op-image-sampled-image.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/op-image-sampled-image.asm.frag new file mode 100644 index 0000000000..bf7ec56d70 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/op-image-sampled-image.asm.frag @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o0 + OpExecutionMode %main OriginUpperLeft + OpName %main "main" + OpName %t0 "t0" + OpName %o0 "o0" + OpName %r0 "r0" + OpName %push_cb "push_cb" + OpMemberName %push_cb 0 "cb0" + OpName %dummy_sampler "dummy_sampler" + OpDecorate %t0 DescriptorSet 0 + OpDecorate %t0 Binding 2 + OpDecorate %o0 Location 0 + OpDecorate %_arr_v4float_uint_1 ArrayStride 16 + OpDecorate %push_cb Block + OpMemberDecorate %push_cb 0 Offset 0 + OpDecorate %dummy_sampler DescriptorSet 0 + OpDecorate %dummy_sampler Binding 4 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %6 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 + %t0 = OpVariable %_ptr_UniformConstant_6 UniformConstant + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o0 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 + %push_cb = OpTypeStruct %_arr_v4float_uint_1 +%_ptr_PushConstant_push_cb = OpTypePointer PushConstant %push_cb + %19 = OpVariable %_ptr_PushConstant_push_cb PushConstant + %uint_0 = OpConstant %uint 0 +%_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %int = OpTypeInt 32 1 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %30 = OpConstantComposite %v2float %float_0 %float_0 + %33 = OpTypeSampler +%_ptr_UniformConstant_33 = OpTypePointer UniformConstant %33 +%dummy_sampler = OpVariable %_ptr_UniformConstant_33 UniformConstant + %38 = OpTypeSampledImage %6 + %v2int = OpTypeVector %int 2 +%_ptr_Function_float = OpTypePointer Function %float + %uint_3 = OpConstant %uint 3 + %int_n1 = OpConstant %int -1 + %int_n2 = OpConstant %int -2 + %52 = OpConstantComposite %v2int %int_n1 %int_n2 + %main = OpFunction %void None %2 + %4 = OpLabel + %r0 = OpVariable %_ptr_Function_v4float Function + %23 = OpAccessChain %_ptr_PushConstant_v4float %19 %uint_0 %uint_0 + %25 = OpLoad %v4float %23 + %26 = OpLoad %v4float %r0 + %27 = OpVectorShuffle %v4float %26 %25 6 7 2 3 + OpStore %r0 %27 + %31 = OpLoad %v4float %r0 + %32 = OpVectorShuffle %v4float %31 %30 0 1 4 5 + OpStore %r0 %32 + %36 = OpLoad %6 %t0 + %37 = OpLoad %33 %dummy_sampler + %39 = OpSampledImage %38 %36 %37 + %40 = OpImage %6 %39 + %41 = OpLoad %v4float %r0 + %42 = OpVectorShuffle %v2float %41 %41 0 1 + %44 = OpBitcast %v2int %42 + %47 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_3 + %48 = OpLoad %float %47 + %49 = OpBitcast %int %48 + %54 = OpImageFetch %v4float %40 %44 Lod|ConstOffset %49 %52 + OpStore %o0 %54 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..74c46b4af8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %v3float = OpTypeVector %float 3 + %11 = OpTypeFunction %v3float %_ptr_Function_mat2v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_35 = OpConstant %int 35 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %4 = OpFunction %void None %3 + %5 = OpLabel + OpBranch %48 + %48 = OpLabel + %58 = OpPhi %int %int_35 %5 %56 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %53 = OpSGreaterThanEqual %bool %58 %int_0 + OpBranchConditional %53 %54 %49 + %54 = OpLabel + OpBranch %50 + %50 = OpLabel + %56 = OpISub %int %58 %int_1 + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %v3float None %11 + %12 = OpFunctionParameter %_ptr_Function_mat2v2float + %14 = OpLabel + %16 = OpVariable %_ptr_Function_v3float Function + %21 = OpVariable %_ptr_Function_int Function + OpStore %16 %18 + OpStore %21 %int_35 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %21 + %31 = OpSGreaterThanEqual %bool %28 %int_0 + OpBranchConditional %31 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %32 = OpLoad %int %21 + %34 = OpISub %int %32 %int_1 + OpStore %21 %34 + OpBranch %23 + %25 = OpLabel + %35 = OpLoad %v3float %16 + OpReturnValue %35 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag b/third_party/spirv-cross/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag new file mode 100644 index 0000000000..9f03d77e3d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/pull-model-interpolation.asm.msl23.frag @@ -0,0 +1,425 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 325 +; Schema: 0 + OpCapability Shader + OpCapability SampleRateShading + OpCapability InterpolationFunction + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %baz %a %s %foo %sid %bar %b %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %func_ "func(" + OpName %FragColor "FragColor" + OpName %baz "baz" + OpName %a "a" + OpName %_ "" + OpMemberName %_ 0 "x" + OpMemberName %_ 1 "y" + OpMemberName %_ 2 "z" + OpMemberName %_ 3 "u" + OpMemberName %_ 4 "v" + OpMemberName %_ 5 "w" + OpName %s "s" + OpName %foo "foo" + OpName %sid "sid" + OpName %bar "bar" + OpName %b "b" + OpName %c "c" + OpDecorate %FragColor Location 0 + OpDecorate %baz Sample + OpDecorate %baz Location 2 + OpDecorate %a Location 4 + OpDecorate %s Location 10 + OpDecorate %foo NoPerspective + OpDecorate %foo Location 0 + OpDecorate %sid Flat + OpDecorate %sid Location 3 + OpDecorate %bar Centroid + OpDecorate %bar Location 1 + OpDecorate %b Centroid + OpDecorate %b Location 6 + OpDecorate %c Sample + OpDecorate %c Location 8 + OpMemberDecorate %_ 1 Centroid + OpMemberDecorate %_ 1 NoPerspective + OpMemberDecorate %_ 2 Sample + OpMemberDecorate %_ 3 Centroid + OpMemberDecorate %_ 4 Sample + OpMemberDecorate %_ 4 NoPerspective + %void = OpTypeVoid + %15 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %baz = OpVariable %_ptr_Input_v2float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %uint_1 = OpConstant %uint 1 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 +%float_n0_100000001 = OpConstant %float -0.100000001 +%float_0_100000001 = OpConstant %float 0.100000001 + %30 = OpConstantComposite %v2float %float_n0_100000001 %float_0_100000001 + %uint_2 = OpConstant %uint 2 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 +%_ptr_Input__arr_v2float_uint_2 = OpTypePointer Input %_arr_v2float_uint_2 + %a = OpVariable %_ptr_Input__arr_v2float_uint_2 Input + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Input__arr_v4float_uint_2 = OpTypePointer Input %_arr_v4float_uint_2 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %_ = OpTypeStruct %v4float %v4float %v4float %_arr_v4float_uint_2 %_arr_v2float_uint_2 %_arr_float_uint_3 +%_ptr_Input__ = OpTypePointer Input %_ + %s = OpVariable %_ptr_Input__ Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %foo = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_int = OpTypePointer Input %int + %sid = OpVariable %_ptr_Input_int Input + %44 = OpConstantComposite %v2float %float_0_100000001 %float_0_100000001 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %bar = OpVariable %_ptr_Input_v3float Input + %47 = OpConstantComposite %v2float %float_n0_100000001 %float_n0_100000001 + %b = OpVariable %_ptr_Input__arr_v2float_uint_2 Input + %c = OpVariable %_ptr_Input__arr_v2float_uint_2 Input + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %main = OpFunction %void None %15 + %50 = OpLabel + %51 = OpLoad %v4float %foo + OpStore %FragColor %51 + %52 = OpExtInst %v4float %1 InterpolateAtCentroid %foo + %53 = OpLoad %v4float %FragColor + %54 = OpFAdd %v4float %53 %52 + OpStore %FragColor %54 + %55 = OpLoad %int %sid + %56 = OpExtInst %v4float %1 InterpolateAtSample %foo %55 + %57 = OpLoad %v4float %FragColor + %58 = OpFAdd %v4float %57 %56 + OpStore %FragColor %58 + %59 = OpExtInst %v4float %1 InterpolateAtOffset %foo %44 + %60 = OpLoad %v4float %FragColor + %61 = OpFAdd %v4float %60 %59 + OpStore %FragColor %61 + %62 = OpLoad %v3float %bar + %63 = OpLoad %v4float %FragColor + %64 = OpVectorShuffle %v3float %63 %63 0 1 2 + %65 = OpFAdd %v3float %64 %62 + %66 = OpLoad %v4float %FragColor + %67 = OpVectorShuffle %v4float %66 %65 4 5 6 3 + OpStore %FragColor %67 + %68 = OpExtInst %v3float %1 InterpolateAtCentroid %bar + %69 = OpLoad %v4float %FragColor + %70 = OpVectorShuffle %v3float %69 %69 0 1 2 + %71 = OpFAdd %v3float %70 %68 + %72 = OpLoad %v4float %FragColor + %73 = OpVectorShuffle %v4float %72 %71 4 5 6 3 + OpStore %FragColor %73 + %74 = OpLoad %int %sid + %75 = OpExtInst %v3float %1 InterpolateAtSample %bar %74 + %76 = OpLoad %v4float %FragColor + %77 = OpVectorShuffle %v3float %76 %76 0 1 2 + %78 = OpFAdd %v3float %77 %75 + %79 = OpLoad %v4float %FragColor + %80 = OpVectorShuffle %v4float %79 %78 4 5 6 3 + OpStore %FragColor %80 + %81 = OpExtInst %v3float %1 InterpolateAtOffset %bar %47 + %82 = OpLoad %v4float %FragColor + %83 = OpVectorShuffle %v3float %82 %82 0 1 2 + %84 = OpFAdd %v3float %83 %81 + %85 = OpLoad %v4float %FragColor + %86 = OpVectorShuffle %v4float %85 %84 4 5 6 3 + OpStore %FragColor %86 + %87 = OpAccessChain %_ptr_Input_v2float %b %int_0 + %88 = OpLoad %v2float %87 + %89 = OpLoad %v4float %FragColor + %90 = OpVectorShuffle %v2float %89 %89 0 1 + %91 = OpFAdd %v2float %90 %88 + %92 = OpLoad %v4float %FragColor + %93 = OpVectorShuffle %v4float %92 %91 4 5 2 3 + OpStore %FragColor %93 + %94 = OpAccessChain %_ptr_Input_v2float %b %int_1 + %95 = OpExtInst %v2float %1 InterpolateAtCentroid %94 + %96 = OpLoad %v4float %FragColor + %97 = OpVectorShuffle %v2float %96 %96 0 1 + %98 = OpFAdd %v2float %97 %95 + %99 = OpLoad %v4float %FragColor + %100 = OpVectorShuffle %v4float %99 %98 4 5 2 3 + OpStore %FragColor %100 + %101 = OpAccessChain %_ptr_Input_v2float %b %int_0 + %102 = OpExtInst %v2float %1 InterpolateAtSample %101 %int_2 + %103 = OpLoad %v4float %FragColor + %104 = OpVectorShuffle %v2float %103 %103 0 1 + %105 = OpFAdd %v2float %104 %102 + %106 = OpLoad %v4float %FragColor + %107 = OpVectorShuffle %v4float %106 %105 4 5 2 3 + OpStore %FragColor %107 + %108 = OpAccessChain %_ptr_Input_v2float %b %int_1 + %109 = OpExtInst %v2float %1 InterpolateAtOffset %108 %30 + %110 = OpLoad %v4float %FragColor + %111 = OpVectorShuffle %v2float %110 %110 0 1 + %112 = OpFAdd %v2float %111 %109 + %113 = OpLoad %v4float %FragColor + %114 = OpVectorShuffle %v4float %113 %112 4 5 2 3 + OpStore %FragColor %114 + %115 = OpAccessChain %_ptr_Input_v2float %c %int_0 + %116 = OpLoad %v2float %115 + %117 = OpLoad %v4float %FragColor + %118 = OpVectorShuffle %v2float %117 %117 0 1 + %119 = OpFAdd %v2float %118 %116 + %120 = OpLoad %v4float %FragColor + %121 = OpVectorShuffle %v4float %120 %119 4 5 2 3 + OpStore %FragColor %121 + %122 = OpAccessChain %_ptr_Input_v2float %c %int_1 + %123 = OpExtInst %v2float %1 InterpolateAtCentroid %122 + %124 = OpVectorShuffle %v2float %123 %123 0 1 + %125 = OpLoad %v4float %FragColor + %126 = OpVectorShuffle %v2float %125 %125 0 1 + %127 = OpFAdd %v2float %126 %124 + %128 = OpLoad %v4float %FragColor + %129 = OpVectorShuffle %v4float %128 %127 4 5 2 3 + OpStore %FragColor %129 + %130 = OpAccessChain %_ptr_Input_v2float %c %int_0 + %131 = OpExtInst %v2float %1 InterpolateAtSample %130 %int_2 + %132 = OpVectorShuffle %v2float %131 %131 1 0 + %133 = OpLoad %v4float %FragColor + %134 = OpVectorShuffle %v2float %133 %133 0 1 + %135 = OpFAdd %v2float %134 %132 + %136 = OpLoad %v4float %FragColor + %137 = OpVectorShuffle %v4float %136 %135 4 5 2 3 + OpStore %FragColor %137 + %138 = OpAccessChain %_ptr_Input_v2float %c %int_1 + %139 = OpExtInst %v2float %1 InterpolateAtOffset %138 %30 + %140 = OpVectorShuffle %v2float %139 %139 0 0 + %141 = OpLoad %v4float %FragColor + %142 = OpVectorShuffle %v2float %141 %141 0 1 + %143 = OpFAdd %v2float %142 %140 + %144 = OpLoad %v4float %FragColor + %145 = OpVectorShuffle %v4float %144 %143 4 5 2 3 + OpStore %FragColor %145 + %146 = OpAccessChain %_ptr_Input_v4float %s %int_0 + %147 = OpLoad %v4float %146 + %148 = OpLoad %v4float %FragColor + %149 = OpFAdd %v4float %148 %147 + OpStore %FragColor %149 + %150 = OpAccessChain %_ptr_Input_v4float %s %int_0 + %151 = OpExtInst %v4float %1 InterpolateAtCentroid %150 + %152 = OpLoad %v4float %FragColor + %153 = OpFAdd %v4float %152 %151 + OpStore %FragColor %153 + %154 = OpAccessChain %_ptr_Input_v4float %s %int_0 + %155 = OpLoad %int %sid + %156 = OpExtInst %v4float %1 InterpolateAtSample %154 %155 + %157 = OpLoad %v4float %FragColor + %158 = OpFAdd %v4float %157 %156 + OpStore %FragColor %158 + %159 = OpAccessChain %_ptr_Input_v4float %s %int_0 + %160 = OpExtInst %v4float %1 InterpolateAtOffset %159 %44 + %161 = OpLoad %v4float %FragColor + %162 = OpFAdd %v4float %161 %160 + OpStore %FragColor %162 + %163 = OpAccessChain %_ptr_Input_v4float %s %int_1 + %164 = OpLoad %v4float %163 + %165 = OpLoad %v4float %FragColor + %166 = OpFAdd %v4float %165 %164 + OpStore %FragColor %166 + %167 = OpAccessChain %_ptr_Input_v4float %s %int_1 + %168 = OpExtInst %v4float %1 InterpolateAtCentroid %167 + %169 = OpLoad %v4float %FragColor + %170 = OpFAdd %v4float %169 %168 + OpStore %FragColor %170 + %171 = OpAccessChain %_ptr_Input_v4float %s %int_1 + %172 = OpLoad %int %sid + %173 = OpExtInst %v4float %1 InterpolateAtSample %171 %172 + %174 = OpLoad %v4float %FragColor + %175 = OpFAdd %v4float %174 %173 + OpStore %FragColor %175 + %176 = OpAccessChain %_ptr_Input_v4float %s %int_1 + %177 = OpExtInst %v4float %1 InterpolateAtOffset %176 %47 + %178 = OpLoad %v4float %FragColor + %179 = OpFAdd %v4float %178 %177 + OpStore %FragColor %179 + %180 = OpAccessChain %_ptr_Input_v2float %s %int_4 %int_0 + %181 = OpLoad %v2float %180 + %182 = OpLoad %v4float %FragColor + %183 = OpVectorShuffle %v2float %182 %182 0 1 + %184 = OpFAdd %v2float %183 %181 + %185 = OpLoad %v4float %FragColor + %186 = OpVectorShuffle %v4float %185 %184 4 5 2 3 + OpStore %FragColor %186 + %187 = OpAccessChain %_ptr_Input_v2float %s %int_4 %int_1 + %188 = OpExtInst %v2float %1 InterpolateAtCentroid %187 + %189 = OpLoad %v4float %FragColor + %190 = OpVectorShuffle %v2float %189 %189 0 1 + %191 = OpFAdd %v2float %190 %188 + %192 = OpLoad %v4float %FragColor + %193 = OpVectorShuffle %v4float %192 %191 4 5 2 3 + OpStore %FragColor %193 + %194 = OpAccessChain %_ptr_Input_v2float %s %int_4 %int_0 + %195 = OpExtInst %v2float %1 InterpolateAtSample %194 %int_2 + %196 = OpLoad %v4float %FragColor + %197 = OpVectorShuffle %v2float %196 %196 0 1 + %198 = OpFAdd %v2float %197 %195 + %199 = OpLoad %v4float %FragColor + %200 = OpVectorShuffle %v4float %199 %198 4 5 2 3 + OpStore %FragColor %200 + %201 = OpAccessChain %_ptr_Input_v2float %s %int_4 %int_1 + %202 = OpExtInst %v2float %1 InterpolateAtOffset %201 %30 + %203 = OpLoad %v4float %FragColor + %204 = OpVectorShuffle %v2float %203 %203 0 1 + %205 = OpFAdd %v2float %204 %202 + %206 = OpLoad %v4float %FragColor + %207 = OpVectorShuffle %v4float %206 %205 4 5 2 3 + OpStore %FragColor %207 + %208 = OpAccessChain %_ptr_Input_float %s %int_5 %int_0 + %209 = OpLoad %float %208 + %210 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %211 = OpLoad %float %210 + %212 = OpFAdd %float %211 %209 + %213 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %213 %212 + %214 = OpAccessChain %_ptr_Input_float %s %int_5 %int_1 + %215 = OpExtInst %float %1 InterpolateAtCentroid %214 + %216 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %217 = OpLoad %float %216 + %218 = OpFAdd %float %217 %215 + %219 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %219 %218 + %220 = OpAccessChain %_ptr_Input_float %s %int_5 %int_0 + %221 = OpExtInst %float %1 InterpolateAtSample %220 %int_2 + %222 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %223 = OpLoad %float %222 + %224 = OpFAdd %float %223 %221 + %225 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %225 %224 + %226 = OpAccessChain %_ptr_Input_float %s %int_5 %int_1 + %227 = OpExtInst %float %1 InterpolateAtOffset %226 %30 + %228 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %229 = OpLoad %float %228 + %230 = OpFAdd %float %229 %227 + %231 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %231 %230 + %232 = OpFunctionCall %void %func_ + OpReturn + OpFunctionEnd + %func_ = OpFunction %void None %15 + %233 = OpLabel + %234 = OpLoad %v2float %baz + %235 = OpLoad %v4float %FragColor + %236 = OpVectorShuffle %v2float %235 %235 0 1 + %237 = OpFAdd %v2float %236 %234 + %238 = OpLoad %v4float %FragColor + %239 = OpVectorShuffle %v4float %238 %237 4 5 2 3 + OpStore %FragColor %239 + %240 = OpAccessChain %_ptr_Input_float %baz %uint_0 + %241 = OpExtInst %float %1 InterpolateAtCentroid %240 + %242 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %243 = OpLoad %float %242 + %244 = OpFAdd %float %243 %241 + %245 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %245 %244 + %246 = OpAccessChain %_ptr_Input_float %baz %uint_1 + %247 = OpExtInst %float %1 InterpolateAtSample %246 %int_3 + %248 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + %249 = OpLoad %float %248 + %250 = OpFAdd %float %249 %247 + %251 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + OpStore %251 %250 + %252 = OpAccessChain %_ptr_Input_float %baz %uint_1 + %253 = OpExtInst %float %1 InterpolateAtOffset %252 %30 + %254 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + %255 = OpLoad %float %254 + %256 = OpFAdd %float %255 %253 + %257 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %257 %256 + %258 = OpAccessChain %_ptr_Input_v2float %a %int_1 + %259 = OpExtInst %v2float %1 InterpolateAtCentroid %258 + %260 = OpLoad %v4float %FragColor + %261 = OpVectorShuffle %v2float %260 %260 0 1 + %262 = OpFAdd %v2float %261 %259 + %263 = OpLoad %v4float %FragColor + %264 = OpVectorShuffle %v4float %263 %262 4 5 2 3 + OpStore %FragColor %264 + %265 = OpAccessChain %_ptr_Input_v2float %a %int_0 + %266 = OpExtInst %v2float %1 InterpolateAtSample %265 %int_2 + %267 = OpLoad %v4float %FragColor + %268 = OpVectorShuffle %v2float %267 %267 0 1 + %269 = OpFAdd %v2float %268 %266 + %270 = OpLoad %v4float %FragColor + %271 = OpVectorShuffle %v4float %270 %269 4 5 2 3 + OpStore %FragColor %271 + %272 = OpAccessChain %_ptr_Input_v2float %a %int_1 + %273 = OpExtInst %v2float %1 InterpolateAtOffset %272 %30 + %274 = OpLoad %v4float %FragColor + %275 = OpVectorShuffle %v2float %274 %274 0 1 + %276 = OpFAdd %v2float %275 %273 + %277 = OpLoad %v4float %FragColor + %278 = OpVectorShuffle %v4float %277 %276 4 5 2 3 + OpStore %FragColor %278 + %279 = OpAccessChain %_ptr_Input_v4float %s %int_2 + %280 = OpLoad %v4float %279 + %281 = OpLoad %v4float %FragColor + %282 = OpFAdd %v4float %281 %280 + OpStore %FragColor %282 + %283 = OpAccessChain %_ptr_Input_v4float %s %int_2 + %284 = OpExtInst %v4float %1 InterpolateAtCentroid %283 + %285 = OpVectorShuffle %v2float %284 %284 1 1 + %286 = OpLoad %v4float %FragColor + %287 = OpVectorShuffle %v2float %286 %286 0 1 + %288 = OpFAdd %v2float %287 %285 + %289 = OpLoad %v4float %FragColor + %290 = OpVectorShuffle %v4float %289 %288 4 5 2 3 + OpStore %FragColor %290 + %291 = OpAccessChain %_ptr_Input_v4float %s %int_2 + %292 = OpExtInst %v4float %1 InterpolateAtSample %291 %int_3 + %293 = OpVectorShuffle %v2float %292 %292 0 1 + %294 = OpLoad %v4float %FragColor + %295 = OpVectorShuffle %v2float %294 %294 1 2 + %296 = OpFAdd %v2float %295 %293 + %297 = OpLoad %v4float %FragColor + %298 = OpVectorShuffle %v4float %297 %296 0 4 5 3 + OpStore %FragColor %298 + %299 = OpAccessChain %_ptr_Input_v4float %s %int_2 + %300 = OpExtInst %v4float %1 InterpolateAtOffset %299 %30 + %301 = OpVectorShuffle %v2float %300 %300 3 0 + %302 = OpLoad %v4float %FragColor + %303 = OpVectorShuffle %v2float %302 %302 2 3 + %304 = OpFAdd %v2float %303 %301 + %305 = OpLoad %v4float %FragColor + %306 = OpVectorShuffle %v4float %305 %304 0 1 4 5 + OpStore %FragColor %306 + %308 = OpAccessChain %_ptr_Input_v4float %s %int_3 %int_0 + %309 = OpLoad %v4float %308 + %310 = OpLoad %v4float %FragColor + %311 = OpFAdd %v4float %310 %309 + OpStore %FragColor %311 + %312 = OpAccessChain %_ptr_Input__arr_v4float_uint_2 %s %int_3 + %313 = OpAccessChain %_ptr_Input_v4float %312 %int_1 + %314 = OpExtInst %v4float %1 InterpolateAtCentroid %313 + %315 = OpLoad %v4float %FragColor + %316 = OpFAdd %v4float %315 %314 + OpStore %FragColor %316 + %317 = OpAccessChain %_ptr_Input_v4float %s %int_3 %int_0 + %318 = OpExtInst %v4float %1 InterpolateAtSample %317 %int_2 + %319 = OpLoad %v4float %FragColor + %320 = OpFAdd %v4float %319 %318 + OpStore %FragColor %320 + %321 = OpAccessChain %_ptr_Input_v4float %s %int_3 %int_1 + %322 = OpExtInst %v4float %1 InterpolateAtOffset %321 %30 + %323 = OpLoad %v4float %FragColor + %324 = OpFAdd %v4float %323 %322 + OpStore %FragColor %324 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..16dcd0d6e0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %g_Texture "g_Texture" + OpName %type_sampler "type.sampler" + OpName %g_Sampler "g_Sampler" + OpName %g_CompareSampler "g_CompareSampler" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %g_Texture DescriptorSet 0 + OpDecorate %g_Texture Binding 0 + OpDecorate %g_Sampler DescriptorSet 0 + OpDecorate %g_Sampler Binding 0 + OpDecorate %g_CompareSampler DescriptorSet 0 + OpDecorate %g_CompareSampler Binding 1 + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %float_0 = OpConstant %float 0 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_float = OpTypePointer Output %float + %void = OpTypeVoid + %19 = OpTypeFunction %void +%type_sampled_image = OpTypeSampledImage %type_2d_image + %v4float = OpTypeVector %float 4 + %g_Texture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %g_Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%g_CompareSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %19 + %21 = OpLabel + %22 = OpLoad %v2float %in_var_TEXCOORD0 + %23 = OpLoad %type_2d_image %g_Texture + %24 = OpLoad %type_sampler %g_Sampler + %25 = OpSampledImage %type_sampled_image %23 %24 + %26 = OpImageSampleImplicitLod %v4float %25 %22 None + %27 = OpCompositeExtract %float %26 0 + %28 = OpLoad %type_sampler %g_CompareSampler + %29 = OpSampledImage %type_sampled_image %23 %28 + %30 = OpImageSampleDrefExplicitLod %float %29 %22 %float_0_5 Lod %float_0 + %31 = OpFAdd %float %27 %30 + OpStore %out_var_SV_Target %31 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..0d5b29c638 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %o_color + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpName %main "main" + OpName %myType "myType" + OpMemberName %myType 0 "data" + OpName %myData "myData" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %index "index" + OpName %elt "elt" + OpName %o_color "o_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %o_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %myType = OpTypeStruct %float + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_myType_uint_5 = OpTypeArray %myType %uint_5 +%_ptr_Private__arr_myType_uint_5 = OpTypePointer Private %_arr_myType_uint_5 + %myData = OpVariable %_ptr_Private__arr_myType_uint_5 Private + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %myType %float_0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %myType %float_1 + %21 = OpConstantComposite %_arr_myType_uint_5 %18 %20 %18 %20 %18 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 +%_ptr_Function_myType = OpTypePointer Function %myType +%_ptr_Private_myType = OpTypePointer Private %myType + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o_color = OpVariable %_ptr_Output_v4float Output + %36 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %11 + %38 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + %index = OpVariable %_ptr_Function_int Function + %elt = OpVariable %_ptr_Function_myType Function + OpStore %myData %21 + %39 = OpLoad %v4float %gl_FragCoord + %40 = OpVectorShuffle %v2float %39 %39 0 1 + OpStore %uv %40 + %41 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %42 = OpLoad %float %41 + %43 = OpFMod %float %42 %float_4 + %44 = OpConvertFToS %int %43 + OpStore %index %44 + %45 = OpLoad %int %index + %46 = OpAccessChain %_ptr_Private_myType %myData %45 + %47 = OpLoad %myType %46 + OpStore %elt %47 + %48 = OpAccessChain %_ptr_Function_float %elt %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdGreaterThan %bool %49 %float_0 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %o_color %36 + OpBranch %51 + %53 = OpLabel + OpStore %o_color %37 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/srem.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..c6f8e27cbd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/srem.asm.frag @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %vB Flat + OpDecorate %vB Location 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %vA = OpVariable %_ptr_Input_v4int Input + %vB = OpVariable %_ptr_Input_v4int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %v4int %vA + %16 = OpLoad %v4int %vB + %17 = OpLoad %v4int %vA + %18 = OpLoad %v4int %vB + %19 = OpSRem %v4int %17 %18 + %20 = OpConvertSToF %v4float %19 + OpStore %FragColor %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..7763b7c17c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColors %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColors "FragColors" + OpName %FragColor "FragColor" + OpDecorate %FragColors Location 0 + OpDecorate %FragColor Location 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Output__arr_v4float_uint_2 = OpTypePointer Output %_arr_v4float_uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_10 = OpConstant %float 10 + %19 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %20 = OpConstantComposite %_arr_v4float_uint_2 %17 %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %float_5 = OpConstant %float 5 + %24 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %FragColors = OpVariable %_ptr_Output__arr_v4float_uint_2 Output %20 + %FragColor = OpVariable %_ptr_Output_v4float Output %24 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/switch-different-sizes.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/switch-different-sizes.asm.frag new file mode 100644 index 0000000000..ee6daa3d2b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/switch-different-sizes.asm.frag @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 10 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpCapability Int8 + OpCapability Int16 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %sw0 "sw0" + OpName %result "result" + OpName %sw1 "sw1" + OpName %sw2 "sw2" + OpName %sw3 "sw3" + OpDecorate %sw1 RelaxedPrecision + OpDecorate %21 RelaxedPrecision + OpDecorate %sw2 RelaxedPrecision + OpDecorate %29 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %lowp_int = OpTypeInt 8 1 + %highp_int = OpTypeInt 16 1 + %_ptr_Function_int = OpTypePointer Function %int + %_ptr_Function_lowp_int = OpTypePointer Function %lowp_int + %_ptr_Function_highp_int = OpTypePointer Function %highp_int + %int_42 = OpConstant %int 42 + %int_0 = OpConstant %int 0 + %int_420 = OpConstant %int 420 + %int_10 = OpConstant %int 10 + %int_512 = OpConstant %int 512 + %lowp_int_10 = OpConstant %lowp_int 10 + %highp_int_10 = OpConstant %highp_int 10 + %main = OpFunction %void None %3 + %5 = OpLabel + %sw0 = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + %sw1 = OpVariable %_ptr_Function_lowp_int Function + %sw2 = OpVariable %_ptr_Function_highp_int Function + %sw3 = OpVariable %_ptr_Function_highp_int Function + OpStore %sw0 %int_42 + OpStore %result %int_0 + %12 = OpLoad %int %sw0 + OpSelectionMerge %16 None + OpSwitch %12 %16 -42 %13 420 %14 -1234 %15 + %13 = OpLabel + OpStore %result %int_42 + OpBranch %14 + %14 = OpLabel + OpStore %result %int_420 + OpBranch %15 + %15 = OpLabel + OpStore %result %int_420 + OpBranch %16 + %16 = OpLabel + OpStore %sw1 %lowp_int_10 + %21 = OpLoad %lowp_int %sw1 + OpSelectionMerge %25 None + OpSwitch %21 %25 -42 %22 42 %23 -123 %24 + %22 = OpLabel + OpStore %result %int_42 + OpBranch %23 + %23 = OpLabel + OpStore %result %int_420 + OpBranch %24 + %24 = OpLabel + OpStore %result %int_512 + OpBranch %25 + %25 = OpLabel + OpStore %sw2 %highp_int_10 + %29 = OpLoad %highp_int %sw2 + OpSelectionMerge %33 None + OpSwitch %29 %33 -42 %30 42 %31 -1234 %32 + %30 = OpLabel + OpStore %result %int_42 + OpBranch %31 + %31 = OpLabel + OpStore %result %int_420 + OpBranch %32 + %32 = OpLabel + OpStore %result %int_512 + OpBranch %33 + %33 = OpLabel + OpStore %sw3 %highp_int_10 + %36 = OpLoad %highp_int %sw3 + OpSelectionMerge %40 None + OpSwitch %36 %40 -42 %37 42 %38 -1234 %39 + %37 = OpLabel + OpStore %result %int_42 + OpBranch %38 + %38 = OpLabel + OpStore %result %int_420 + OpBranch %39 + %39 = OpLabel + OpStore %result %int_512 + OpBranch %40 + %40 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag b/third_party/spirv-cross/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag new file mode 100644 index 0000000000..62f2dc6807 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/switch-long-case.asm.msl22.frag @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %sw "sw" + OpName %result "result" + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %long = OpTypeInt 64 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_long = OpTypePointer Function %long + %int_42 = OpConstant %int 42 + %int_0 = OpConstant %int 0 + %int_420 = OpConstant %int 420 + %long_42 = OpConstant %long 42 + %main = OpFunction %void None %6 + %15 = OpLabel + %sw = OpVariable %_ptr_Function_long Function + %result = OpVariable %_ptr_Function_int Function + OpStore %sw %long_42 + OpStore %result %int_0 + %16 = OpLoad %long %sw + OpSelectionMerge %17 None + OpSwitch %16 %17 -42 %18 420 %19 -34359738368 %20 + %18 = OpLabel + OpStore %result %int_42 + OpBranch %19 + %19 = OpLabel + OpStore %result %int_420 + OpBranch %20 + %20 = OpLabel + OpStore %result %int_420 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag b/third_party/spirv-cross/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag new file mode 100644 index 0000000000..cea32b420a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/switch-unsigned-long-case.asm.msl22.frag @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 21 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %sw "sw" + OpName %result "result" + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %long = OpTypeInt 64 0 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_long = OpTypePointer Function %long + %int_42 = OpConstant %int 42 + %int_0 = OpConstant %int 0 + %int_420 = OpConstant %int 420 + %long_42 = OpConstant %long 42 + %main = OpFunction %void None %6 + %15 = OpLabel + %sw = OpVariable %_ptr_Function_long Function + %result = OpVariable %_ptr_Function_int Function + OpStore %sw %long_42 + OpStore %result %int_0 + %16 = OpLoad %long %sw + OpSelectionMerge %17 None + OpSwitch %16 %17 42 %18 420 %19 343597383680 %20 + %18 = OpLabel + OpStore %result %int_42 + OpBranch %19 + %19 = OpLabel + OpStore %result %int_420 + OpBranch %20 + %20 = OpLabel + OpStore %result %int_420 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..53dc63809c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uTexture + %18 = OpLoad %v4float %gl_FragCoord + %19 = OpVectorShuffle %v2float %18 %18 0 1 + %22 = OpConvertFToS %v2int %19 + %24 = OpImage %10 %14 + %25 = OpImageFetch %v4float %24 %22 + OpStore %FragColor %25 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag new file mode 100644 index 0000000000..e7e6f37ea2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/texture-sampling-fp16.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability StorageInputOutput16 + OpCapability Float16 + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %UV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16" + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %UV "UV" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %UV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %half = OpTypeFloat 16 + %float = OpTypeFloat 32 + %v4half = OpTypeVector %half 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4half = OpTypePointer Output %v4half + %FragColor = OpVariable %_ptr_Output_v4half Output + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v2half = OpTypeVector %half 2 +%_ptr_Input_v2half = OpTypePointer Input %v2half + %UV = OpVariable %_ptr_Input_v2half Input + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %19 = OpLoad %v2half %UV + %23 = OpImageSampleImplicitLod %v4float %15 %19 + %24 = OpFConvert %v4half %23 + OpStore %FragColor %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..966c2d9d5a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragmentProgram "main" %_entryPointOutput + OpExecutionMode %fragmentProgram OriginUpperLeft + OpSource HLSL 500 + OpName %fragmentProgram "fragmentProgram" + OpName %_fragmentProgram_ "@fragmentProgram(" + OpName %uv "uv" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v2float %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %false = OpConstantFalse %bool +%fragmentProgram = OpFunction %void None %3 + %5 = OpLabel + %35 = OpVariable %_ptr_Function_v2float Function + %37 = OpVariable %_ptr_Function_v4float Function + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + OpStore %35 %15 + %42 = OpAccessChain %_ptr_Function_float %35 %uint_0 + %43 = OpLoad %float %42 + %44 = OpFOrdNotEqual %bool %43 %float_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %37 %26 + OpBranch %39 + %47 = OpLabel + OpStore %37 %29 + OpBranch %39 + %45 = OpLabel + %48 = OpUndef %v4float + OpStore %37 %48 + OpBranch %39 + %40 = OpLabel + OpBranchConditional %false %38 %39 + %39 = OpLabel + %34 = OpLoad %v4float %37 + OpStore %_entryPointOutput %34 + OpReturn + OpFunctionEnd +%_fragmentProgram_ = OpFunction %v4float None %8 + %10 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + OpStore %uv %15 + %19 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %20 = OpLoad %float %19 + %22 = OpFOrdNotEqual %bool %20 %float_0 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %28 + %23 = OpLabel + OpReturnValue %26 + %28 = OpLabel + OpReturnValue %29 + %24 = OpLabel + %31 = OpUndef %v4float + OpReturnValue %31 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/unknown-depth-state.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/unknown-depth-state.asm.frag new file mode 100644 index 0000000000..89036f0eb2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/unknown-depth-state.asm.frag @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vUV %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %sample_combined_ "sample_combined(" + OpName %sample_separate_ "sample_separate(" + OpName %uShadow "uShadow" + OpName %vUV "vUV" + OpName %uTexture "uTexture" + OpName %uSampler "uSampler" + OpName %FragColor "FragColor" + OpDecorate %uShadow DescriptorSet 0 + OpDecorate %uShadow Binding 0 + OpDecorate %vUV Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 2 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float + %12 = OpTypeImage %float 2D 2 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %uShadow = OpVariable %_ptr_UniformConstant_13 UniformConstant + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %vUV = OpVariable %_ptr_Input_v3float Input +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_25 UniformConstant + %29 = OpTypeSampler +%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29 + %uSampler = OpVariable %_ptr_UniformConstant_29 UniformConstant +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %41 = OpFunctionCall %float %sample_combined_ + %42 = OpFunctionCall %float %sample_separate_ + %43 = OpFAdd %float %41 %42 + OpStore %FragColor %43 + OpReturn + OpFunctionEnd +%sample_combined_ = OpFunction %float None %7 + %9 = OpLabel + %16 = OpLoad %13 %uShadow + %20 = OpLoad %v3float %vUV + %21 = OpCompositeExtract %float %20 2 + %22 = OpImageSampleDrefImplicitLod %float %16 %20 %21 + OpReturnValue %22 + OpFunctionEnd +%sample_separate_ = OpFunction %float None %7 + %11 = OpLabel + %28 = OpLoad %12 %uTexture + %32 = OpLoad %29 %uSampler + %33 = OpSampledImage %13 %28 %32 + %34 = OpLoad %v3float %vUV + %35 = OpCompositeExtract %float %34 2 + %36 = OpImageSampleDrefImplicitLod %float %33 %34 %35 + OpReturnValue %36 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.asm.frag new file mode 100644 index 0000000000..824c051291 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.asm.frag @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c %d %e %f %g %h %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpName %main "main" + OpName %t0 "t0" + OpName %a "a" + OpName %t1 "t1" + OpName %b "b" + OpName %c1 "c1" + OpName %c2 "c2" + OpName %c3 "c3" + OpName %c4 "c4" + OpName %c5 "c5" + OpName %c6 "c6" + OpName %c7 "c7" + OpName %c "c" + OpName %d "d" + OpName %c8 "c8" + OpName %c9 "c9" + OpName %c10 "c10" + OpName %c11 "c11" + OpName %c12 "c12" + OpName %c13 "c13" + OpName %e "e" + OpName %f "f" + OpName %c14 "c14" + OpName %c15 "c15" + OpName %c16 "c16" + OpName %c17 "c17" + OpName %c18 "c18" + OpName %c19 "c19" + OpName %g "g" + OpName %h "h" + OpName %c20 "c20" + OpName %c21 "c21" + OpName %c22 "c22" + OpName %c23 "c23" + OpName %c24 "c24" + OpName %FragColor "FragColor" + OpDecorate %a SpecId 1 + OpDecorate %b SpecId 2 + OpDecorate %c Location 2 + OpDecorate %d Location 3 + OpDecorate %e Location 4 + OpDecorate %f Location 5 + OpDecorate %g Location 6 + OpDecorate %h Location 7 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %a = OpSpecConstant %float 1 + %b = OpSpecConstant %float 2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %c = OpVariable %_ptr_Input_v2float Input + %d = OpVariable %_ptr_Input_v2float Input + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %e = OpVariable %_ptr_Input_v3float Input + %f = OpVariable %_ptr_Input_v3float Input + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %g = OpVariable %_ptr_Input_v4float Input + %h = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %t0 = OpVariable %_ptr_Function_float Function + %t1 = OpVariable %_ptr_Function_float Function + %c1 = OpVariable %_ptr_Function_bool Function + %c2 = OpVariable %_ptr_Function_bool Function + %c3 = OpVariable %_ptr_Function_bool Function + %c4 = OpVariable %_ptr_Function_bool Function + %c5 = OpVariable %_ptr_Function_bool Function + %c6 = OpVariable %_ptr_Function_bool Function + %c7 = OpVariable %_ptr_Function_v2bool Function + %c8 = OpVariable %_ptr_Function_v2bool Function + %c9 = OpVariable %_ptr_Function_v2bool Function + %c10 = OpVariable %_ptr_Function_v2bool Function + %c11 = OpVariable %_ptr_Function_v2bool Function + %c12 = OpVariable %_ptr_Function_v2bool Function + %c13 = OpVariable %_ptr_Function_v3bool Function + %c14 = OpVariable %_ptr_Function_v3bool Function + %c15 = OpVariable %_ptr_Function_v3bool Function + %c16 = OpVariable %_ptr_Function_v3bool Function + %c17 = OpVariable %_ptr_Function_v3bool Function + %c18 = OpVariable %_ptr_Function_v3bool Function + %c19 = OpVariable %_ptr_Function_v4bool Function + %c20 = OpVariable %_ptr_Function_v4bool Function + %c21 = OpVariable %_ptr_Function_v4bool Function + %c22 = OpVariable %_ptr_Function_v4bool Function + %c23 = OpVariable %_ptr_Function_v4bool Function + %c24 = OpVariable %_ptr_Function_v4bool Function + OpStore %t0 %a + OpStore %t1 %b + %15 = OpFUnordEqual %bool %a %b + OpStore %c1 %15 + %ordered = OpFOrdNotEqual %bool %a %b + OpStore %c1 %ordered + %17 = OpFUnordNotEqual %bool %a %b + OpStore %c2 %17 + %19 = OpFUnordLessThan %bool %a %b + OpStore %c3 %19 + %21 = OpFUnordGreaterThan %bool %a %b + OpStore %c4 %21 + %23 = OpFUnordLessThanEqual %bool %a %b + OpStore %c5 %23 + %25 = OpFUnordGreaterThanEqual %bool %a %b + OpStore %c6 %25 + %32 = OpLoad %v2float %c + %34 = OpLoad %v2float %d + %35 = OpFUnordEqual %v2bool %32 %34 + OpStore %c7 %35 + %37 = OpLoad %v2float %c + %38 = OpLoad %v2float %d + %39 = OpFUnordNotEqual %v2bool %37 %38 + OpStore %c8 %39 + %41 = OpLoad %v2float %c + %42 = OpLoad %v2float %d + %43 = OpFUnordLessThan %v2bool %41 %42 + OpStore %c9 %43 + %45 = OpLoad %v2float %c + %46 = OpLoad %v2float %d + %47 = OpFUnordGreaterThan %v2bool %45 %46 + OpStore %c10 %47 + %49 = OpLoad %v2float %c + %50 = OpLoad %v2float %d + %51 = OpFUnordLessThanEqual %v2bool %49 %50 + OpStore %c11 %51 + %53 = OpLoad %v2float %c + %54 = OpLoad %v2float %d + %55 = OpFUnordGreaterThanEqual %v2bool %53 %54 + OpStore %c12 %55 + %62 = OpLoad %v3float %e + %64 = OpLoad %v3float %f + %65 = OpFUnordEqual %v3bool %62 %64 + OpStore %c13 %65 + %67 = OpLoad %v3float %e + %68 = OpLoad %v3float %f + %69 = OpFUnordNotEqual %v3bool %67 %68 + OpStore %c14 %69 + %71 = OpLoad %v3float %e + %72 = OpLoad %v3float %f + %73 = OpFUnordLessThan %v3bool %71 %72 + OpStore %c15 %73 + %75 = OpLoad %v3float %e + %76 = OpLoad %v3float %f + %77 = OpFUnordGreaterThan %v3bool %75 %76 + OpStore %c16 %77 + %79 = OpLoad %v3float %e + %80 = OpLoad %v3float %f + %81 = OpFUnordLessThanEqual %v3bool %79 %80 + OpStore %c17 %81 + %83 = OpLoad %v3float %e + %84 = OpLoad %v3float %f + %85 = OpFUnordGreaterThanEqual %v3bool %83 %84 + OpStore %c18 %85 + %92 = OpLoad %v4float %g + %94 = OpLoad %v4float %h + %95 = OpFUnordEqual %v4bool %92 %94 + OpStore %c19 %95 + %97 = OpLoad %v4float %g + %98 = OpLoad %v4float %h + %99 = OpFUnordNotEqual %v4bool %97 %98 + OpStore %c20 %99 + %101 = OpLoad %v4float %g + %102 = OpLoad %v4float %h + %103 = OpFUnordLessThan %v4bool %101 %102 + OpStore %c21 %103 + %105 = OpLoad %v4float %g + %106 = OpLoad %v4float %h + %107 = OpFUnordGreaterThan %v4bool %105 %106 + OpStore %c22 %107 + %109 = OpLoad %v4float %g + %110 = OpLoad %v4float %h + %111 = OpFUnordLessThanEqual %v4bool %109 %110 + OpStore %c23 %111 + %113 = OpLoad %v4float %g + %114 = OpLoad %v4float %h + %115 = OpFUnordGreaterThanEqual %v4bool %113 %114 + OpStore %c24 %115 + %118 = OpLoad %float %t0 + %119 = OpLoad %float %t1 + %120 = OpFAdd %float %118 %119 + %121 = OpCompositeConstruct %v4float %120 %120 %120 %120 + OpStore %FragColor %121 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag new file mode 100644 index 0000000000..824c051291 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/unord-relational-op.relax-nan.asm.frag @@ -0,0 +1,207 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 122 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c %d %e %f %g %h %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpName %main "main" + OpName %t0 "t0" + OpName %a "a" + OpName %t1 "t1" + OpName %b "b" + OpName %c1 "c1" + OpName %c2 "c2" + OpName %c3 "c3" + OpName %c4 "c4" + OpName %c5 "c5" + OpName %c6 "c6" + OpName %c7 "c7" + OpName %c "c" + OpName %d "d" + OpName %c8 "c8" + OpName %c9 "c9" + OpName %c10 "c10" + OpName %c11 "c11" + OpName %c12 "c12" + OpName %c13 "c13" + OpName %e "e" + OpName %f "f" + OpName %c14 "c14" + OpName %c15 "c15" + OpName %c16 "c16" + OpName %c17 "c17" + OpName %c18 "c18" + OpName %c19 "c19" + OpName %g "g" + OpName %h "h" + OpName %c20 "c20" + OpName %c21 "c21" + OpName %c22 "c22" + OpName %c23 "c23" + OpName %c24 "c24" + OpName %FragColor "FragColor" + OpDecorate %a SpecId 1 + OpDecorate %b SpecId 2 + OpDecorate %c Location 2 + OpDecorate %d Location 3 + OpDecorate %e Location 4 + OpDecorate %f Location 5 + OpDecorate %g Location 6 + OpDecorate %h Location 7 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %a = OpSpecConstant %float 1 + %b = OpSpecConstant %float 2 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %c = OpVariable %_ptr_Input_v2float Input + %d = OpVariable %_ptr_Input_v2float Input + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %e = OpVariable %_ptr_Input_v3float Input + %f = OpVariable %_ptr_Input_v3float Input + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %g = OpVariable %_ptr_Input_v4float Input + %h = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %t0 = OpVariable %_ptr_Function_float Function + %t1 = OpVariable %_ptr_Function_float Function + %c1 = OpVariable %_ptr_Function_bool Function + %c2 = OpVariable %_ptr_Function_bool Function + %c3 = OpVariable %_ptr_Function_bool Function + %c4 = OpVariable %_ptr_Function_bool Function + %c5 = OpVariable %_ptr_Function_bool Function + %c6 = OpVariable %_ptr_Function_bool Function + %c7 = OpVariable %_ptr_Function_v2bool Function + %c8 = OpVariable %_ptr_Function_v2bool Function + %c9 = OpVariable %_ptr_Function_v2bool Function + %c10 = OpVariable %_ptr_Function_v2bool Function + %c11 = OpVariable %_ptr_Function_v2bool Function + %c12 = OpVariable %_ptr_Function_v2bool Function + %c13 = OpVariable %_ptr_Function_v3bool Function + %c14 = OpVariable %_ptr_Function_v3bool Function + %c15 = OpVariable %_ptr_Function_v3bool Function + %c16 = OpVariable %_ptr_Function_v3bool Function + %c17 = OpVariable %_ptr_Function_v3bool Function + %c18 = OpVariable %_ptr_Function_v3bool Function + %c19 = OpVariable %_ptr_Function_v4bool Function + %c20 = OpVariable %_ptr_Function_v4bool Function + %c21 = OpVariable %_ptr_Function_v4bool Function + %c22 = OpVariable %_ptr_Function_v4bool Function + %c23 = OpVariable %_ptr_Function_v4bool Function + %c24 = OpVariable %_ptr_Function_v4bool Function + OpStore %t0 %a + OpStore %t1 %b + %15 = OpFUnordEqual %bool %a %b + OpStore %c1 %15 + %ordered = OpFOrdNotEqual %bool %a %b + OpStore %c1 %ordered + %17 = OpFUnordNotEqual %bool %a %b + OpStore %c2 %17 + %19 = OpFUnordLessThan %bool %a %b + OpStore %c3 %19 + %21 = OpFUnordGreaterThan %bool %a %b + OpStore %c4 %21 + %23 = OpFUnordLessThanEqual %bool %a %b + OpStore %c5 %23 + %25 = OpFUnordGreaterThanEqual %bool %a %b + OpStore %c6 %25 + %32 = OpLoad %v2float %c + %34 = OpLoad %v2float %d + %35 = OpFUnordEqual %v2bool %32 %34 + OpStore %c7 %35 + %37 = OpLoad %v2float %c + %38 = OpLoad %v2float %d + %39 = OpFUnordNotEqual %v2bool %37 %38 + OpStore %c8 %39 + %41 = OpLoad %v2float %c + %42 = OpLoad %v2float %d + %43 = OpFUnordLessThan %v2bool %41 %42 + OpStore %c9 %43 + %45 = OpLoad %v2float %c + %46 = OpLoad %v2float %d + %47 = OpFUnordGreaterThan %v2bool %45 %46 + OpStore %c10 %47 + %49 = OpLoad %v2float %c + %50 = OpLoad %v2float %d + %51 = OpFUnordLessThanEqual %v2bool %49 %50 + OpStore %c11 %51 + %53 = OpLoad %v2float %c + %54 = OpLoad %v2float %d + %55 = OpFUnordGreaterThanEqual %v2bool %53 %54 + OpStore %c12 %55 + %62 = OpLoad %v3float %e + %64 = OpLoad %v3float %f + %65 = OpFUnordEqual %v3bool %62 %64 + OpStore %c13 %65 + %67 = OpLoad %v3float %e + %68 = OpLoad %v3float %f + %69 = OpFUnordNotEqual %v3bool %67 %68 + OpStore %c14 %69 + %71 = OpLoad %v3float %e + %72 = OpLoad %v3float %f + %73 = OpFUnordLessThan %v3bool %71 %72 + OpStore %c15 %73 + %75 = OpLoad %v3float %e + %76 = OpLoad %v3float %f + %77 = OpFUnordGreaterThan %v3bool %75 %76 + OpStore %c16 %77 + %79 = OpLoad %v3float %e + %80 = OpLoad %v3float %f + %81 = OpFUnordLessThanEqual %v3bool %79 %80 + OpStore %c17 %81 + %83 = OpLoad %v3float %e + %84 = OpLoad %v3float %f + %85 = OpFUnordGreaterThanEqual %v3bool %83 %84 + OpStore %c18 %85 + %92 = OpLoad %v4float %g + %94 = OpLoad %v4float %h + %95 = OpFUnordEqual %v4bool %92 %94 + OpStore %c19 %95 + %97 = OpLoad %v4float %g + %98 = OpLoad %v4float %h + %99 = OpFUnordNotEqual %v4bool %97 %98 + OpStore %c20 %99 + %101 = OpLoad %v4float %g + %102 = OpLoad %v4float %h + %103 = OpFUnordLessThan %v4bool %101 %102 + OpStore %c21 %103 + %105 = OpLoad %v4float %g + %106 = OpLoad %v4float %h + %107 = OpFUnordGreaterThan %v4bool %105 %106 + OpStore %c22 %107 + %109 = OpLoad %v4float %g + %110 = OpLoad %v4float %h + %111 = OpFUnordLessThanEqual %v4bool %109 %110 + OpStore %c23 %111 + %113 = OpLoad %v4float %g + %114 = OpLoad %v4float %h + %115 = OpFUnordGreaterThanEqual %v4bool %113 %114 + OpStore %c24 %115 + %118 = OpLoad %float %t0 + %119 = OpLoad %float %t1 + %120 = OpFAdd %float %118 %119 + %121 = OpCompositeConstruct %v4float %120 %120 %120 %120 + OpStore %FragColor %121 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..e2ce2eb56a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/unreachable.asm.frag @@ -0,0 +1,61 @@ +; 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 %main "main" %counter %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %counter "counter" + OpName %FragColor "FragColor" + OpDecorate %counter Flat + OpDecorate %counter Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %counter = OpVariable %_ptr_Input_int Input + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %21 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %float_30 = OpConstant %float 30 + %25 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %false = OpConstantFalse %bool + %44 = OpUndef %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %33 + %33 = OpLabel + %45 = OpPhi %v4float %44 %5 %44 %35 + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %counter + %38 = OpIEqual %bool %37 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %34 + %41 = OpLabel + OpBranch %34 + %39 = OpLabel + OpUnreachable + %35 = OpLabel + OpBranchConditional %false %33 %34 + %34 = OpLabel + %46 = OpPhi %v4float %21 %40 %25 %41 %44 %35 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..92652161cb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,886 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 25007 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %5663 "main" %5800 %gl_FragCoord %4317 + OpExecutionMode %5663 OriginUpperLeft + OpMemberDecorate %_struct_1116 0 Offset 0 + OpMemberDecorate %_struct_1116 1 Offset 16 + OpMemberDecorate %_struct_1116 2 Offset 32 + OpDecorate %_struct_1116 Block + OpDecorate %22044 DescriptorSet 0 + OpDecorate %22044 Binding 0 + OpDecorate %5785 DescriptorSet 0 + OpDecorate %5785 Binding 14 + OpDecorate %5688 DescriptorSet 0 + OpDecorate %5688 Binding 6 + OpMemberDecorate %_struct_994 0 Offset 0 + OpMemberDecorate %_struct_994 1 Offset 16 + OpMemberDecorate %_struct_994 2 Offset 28 + OpMemberDecorate %_struct_994 3 Offset 32 + OpMemberDecorate %_struct_994 4 Offset 44 + OpMemberDecorate %_struct_994 5 Offset 48 + OpMemberDecorate %_struct_994 6 Offset 60 + OpMemberDecorate %_struct_994 7 Offset 64 + OpMemberDecorate %_struct_994 8 Offset 76 + OpMemberDecorate %_struct_994 9 Offset 80 + OpMemberDecorate %_struct_994 10 Offset 92 + OpMemberDecorate %_struct_994 11 Offset 96 + OpMemberDecorate %_struct_994 12 Offset 108 + OpMemberDecorate %_struct_994 13 Offset 112 + OpMemberDecorate %_struct_994 14 Offset 120 + OpMemberDecorate %_struct_994 15 Offset 128 + OpMemberDecorate %_struct_994 16 Offset 140 + OpMemberDecorate %_struct_994 17 Offset 144 + OpMemberDecorate %_struct_994 18 Offset 148 + OpMemberDecorate %_struct_994 19 Offset 152 + OpMemberDecorate %_struct_994 20 Offset 156 + OpMemberDecorate %_struct_994 21 Offset 160 + OpMemberDecorate %_struct_994 22 Offset 176 + OpMemberDecorate %_struct_994 23 RowMajor + OpMemberDecorate %_struct_994 23 Offset 192 + OpMemberDecorate %_struct_994 23 MatrixStride 16 + OpMemberDecorate %_struct_994 24 Offset 256 + OpDecorate %_struct_994 Block + OpDecorate %12348 DescriptorSet 0 + OpDecorate %12348 Binding 2 + OpDecorate %3312 DescriptorSet 0 + OpDecorate %3312 Binding 13 + OpDecorate %4646 DescriptorSet 0 + OpDecorate %4646 Binding 5 + OpDecorate %4862 DescriptorSet 0 + OpDecorate %4862 Binding 4 + OpDecorate %3594 DescriptorSet 0 + OpDecorate %3594 Binding 3 + OpDecorate %_arr_mat4v4float_uint_2 ArrayStride 64 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %_struct_408 0 RowMajor + OpMemberDecorate %_struct_408 0 Offset 0 + OpMemberDecorate %_struct_408 0 MatrixStride 16 + OpMemberDecorate %_struct_408 1 RowMajor + OpMemberDecorate %_struct_408 1 Offset 64 + OpMemberDecorate %_struct_408 1 MatrixStride 16 + OpMemberDecorate %_struct_408 2 RowMajor + OpMemberDecorate %_struct_408 2 Offset 128 + OpMemberDecorate %_struct_408 2 MatrixStride 16 + OpMemberDecorate %_struct_408 3 RowMajor + OpMemberDecorate %_struct_408 3 Offset 192 + OpMemberDecorate %_struct_408 3 MatrixStride 16 + OpMemberDecorate %_struct_408 4 Offset 256 + OpMemberDecorate %_struct_408 5 Offset 272 + OpMemberDecorate %_struct_408 6 Offset 288 + OpMemberDecorate %_struct_408 7 Offset 292 + OpMemberDecorate %_struct_408 8 Offset 296 + OpMemberDecorate %_struct_408 9 Offset 300 + OpMemberDecorate %_struct_408 10 Offset 304 + OpMemberDecorate %_struct_408 11 Offset 316 + OpMemberDecorate %_struct_408 12 Offset 320 + OpMemberDecorate %_struct_408 13 Offset 332 + OpMemberDecorate %_struct_408 14 Offset 336 + OpMemberDecorate %_struct_408 15 Offset 348 + OpMemberDecorate %_struct_408 16 Offset 352 + OpMemberDecorate %_struct_408 17 Offset 364 + OpMemberDecorate %_struct_408 18 Offset 368 + OpMemberDecorate %_struct_408 19 Offset 372 + OpMemberDecorate %_struct_408 20 Offset 376 + OpMemberDecorate %_struct_408 21 Offset 384 + OpMemberDecorate %_struct_408 22 Offset 392 + OpMemberDecorate %_struct_408 23 Offset 400 + OpMemberDecorate %_struct_408 24 Offset 416 + OpMemberDecorate %_struct_408 25 Offset 424 + OpMemberDecorate %_struct_408 26 Offset 432 + OpMemberDecorate %_struct_408 27 Offset 448 + OpMemberDecorate %_struct_408 28 Offset 460 + OpMemberDecorate %_struct_408 29 Offset 464 + OpMemberDecorate %_struct_408 30 Offset 468 + OpMemberDecorate %_struct_408 31 Offset 472 + OpMemberDecorate %_struct_408 32 Offset 476 + OpMemberDecorate %_struct_408 33 Offset 480 + OpMemberDecorate %_struct_408 34 Offset 488 + OpMemberDecorate %_struct_408 35 Offset 492 + OpMemberDecorate %_struct_408 36 Offset 496 + OpMemberDecorate %_struct_408 37 RowMajor + OpMemberDecorate %_struct_408 37 Offset 512 + OpMemberDecorate %_struct_408 37 MatrixStride 16 + OpMemberDecorate %_struct_408 38 Offset 640 + OpDecorate %_struct_408 Block + OpDecorate %15259 DescriptorSet 0 + OpDecorate %15259 Binding 1 + OpDecorate %5800 Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %4317 Location 0 + OpMemberDecorate %_struct_1395 0 Offset 0 + OpMemberDecorate %_struct_1395 1 Offset 16 + OpMemberDecorate %_struct_1395 2 Offset 32 + OpMemberDecorate %_struct_1395 3 Offset 40 + OpMemberDecorate %_struct_1395 4 Offset 48 + OpMemberDecorate %_struct_1395 5 Offset 60 + OpMemberDecorate %_struct_1395 6 Offset 64 + OpMemberDecorate %_struct_1395 7 Offset 76 + OpMemberDecorate %_struct_1395 8 Offset 80 + OpMemberDecorate %_struct_1395 9 Offset 96 + OpMemberDecorate %_struct_1395 10 Offset 112 + OpMemberDecorate %_struct_1395 11 Offset 128 + OpMemberDecorate %_struct_1395 12 Offset 140 + OpMemberDecorate %_struct_1395 13 Offset 144 + OpMemberDecorate %_struct_1395 14 Offset 156 + OpMemberDecorate %_struct_1395 15 Offset 160 + OpMemberDecorate %_struct_1395 16 Offset 176 + OpMemberDecorate %_struct_1395 17 Offset 192 + OpMemberDecorate %_struct_1395 18 Offset 204 + OpMemberDecorate %_struct_1395 19 Offset 208 + OpMemberDecorate %_struct_1395 20 Offset 224 + OpDecorate %_struct_1395 Block + OpMemberDecorate %_struct_1018 0 Offset 0 + OpDecorate %_struct_1018 Block + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 +%_struct_1017 = OpTypeStruct %v4float +%_struct_1116 = OpTypeStruct %v4float %float %v4float +%_ptr_Uniform__struct_1116 = OpTypePointer Uniform %_struct_1116 + %22044 = OpVariable %_ptr_Uniform__struct_1116 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %150 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_150 = OpTypePointer UniformConstant %150 + %5785 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %508 = OpTypeSampler +%_ptr_UniformConstant_508 = OpTypePointer UniformConstant %508 + %5688 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %510 = OpTypeSampledImage %150 + %float_0 = OpConstant %float 0 + %uint = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%mat4v4float = OpTypeMatrix %v4float 4 +%_struct_994 = OpTypeStruct %v3float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v2float %v2float %v3float %float %float %float %float %float %v4float %v4float %mat4v4float %v4float +%_ptr_Uniform__struct_994 = OpTypePointer Uniform %_struct_994 + %12348 = OpVariable %_ptr_Uniform__struct_994 Uniform + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %3312 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %4646 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %bool = OpTypeBool + %4862 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %3594 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %uint_2 = OpConstant %uint 2 + %2938 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_arr_mat4v4float_uint_2 = OpTypeArray %mat4v4float %uint_2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_struct_408 = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %float %float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float %v2float %v2float %v2float %v4float %v2float %v2float %v2float %v3float %float %float %float %float %float %v2float %float %float %v3float %_arr_mat4v4float_uint_2 %_arr_v4float_uint_2 +%_ptr_Uniform__struct_408 = OpTypePointer Uniform %_struct_408 + %15259 = OpVariable %_ptr_Uniform__struct_408 Uniform + %int_23 = OpConstant %int 23 + %int_2 = OpConstant %int 2 + %float_n2 = OpConstant %float -2 + %float_0_5 = OpConstant %float 0.5 + %1196 = OpConstantComposite %v3float %float_0 %float_n2 %float_0_5 + %float_n1 = OpConstant %float -1 + %836 = OpConstantComposite %v3float %float_n1 %float_n1 %float_0_5 + %float_0_75 = OpConstant %float 0.75 + %1367 = OpConstantComposite %v3float %float_0 %float_n1 %float_0_75 + %141 = OpConstantComposite %v3float %float_1 %float_n1 %float_0_5 + %38 = OpConstantComposite %v3float %float_n2 %float_0 %float_0_5 + %95 = OpConstantComposite %v3float %float_n1 %float_0 %float_0_75 + %626 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %2411 = OpConstantComposite %v3float %float_1 %float_0 %float_0_75 + %float_2 = OpConstant %float 2 + %2354 = OpConstantComposite %v3float %float_2 %float_0 %float_0_5 + %837 = OpConstantComposite %v3float %float_n1 %float_1 %float_0_5 + %1368 = OpConstantComposite %v3float %float_0 %float_1 %float_0_75 + %142 = OpConstantComposite %v3float %float_1 %float_1 %float_0_5 + %1197 = OpConstantComposite %v3float %float_0 %float_2 %float_0_5 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %5800 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %4317 = OpVariable %_ptr_Output_v4float Output +%_struct_1395 = OpTypeStruct %v4float %v4float %v2float %v2float %v3float %float %v3float %float %v4float %v4float %v4float %v3float %float %v3float %float %v3float %v4float %v3float %float %v3float %v2float +%_struct_1018 = OpTypeStruct %v4float + %10264 = OpUndef %_struct_1017 + %5663 = OpFunction %void None %1282 + %25006 = OpLabel + %17463 = OpLoad %v4float %gl_FragCoord + %13863 = OpCompositeInsert %_struct_1017 %2938 %10264 0 + %22969 = OpVectorShuffle %v2float %17463 %17463 0 1 + %13206 = OpAccessChain %_ptr_Uniform_v4float %15259 %int_23 + %10343 = OpLoad %v4float %13206 + %7422 = OpVectorShuffle %v2float %10343 %10343 0 1 + %19927 = OpFMul %v2float %22969 %7422 + %18174 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_2 + %16206 = OpLoad %v4float %18174 + %20420 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %21354 = OpLoad %v4float %20420 + %7688 = OpVectorShuffle %v4float %21354 %21354 0 1 0 1 + %17581 = OpFMul %v4float %16206 %7688 + %10673 = OpVectorShuffle %v2float %1196 %1196 0 1 + %18824 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10344 = OpLoad %v4float %18824 + %8638 = OpVectorShuffle %v2float %10344 %10344 0 1 + %9197 = OpFMul %v2float %10673 %8638 + %18505 = OpFAdd %v2float %19927 %9197 + %7011 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21058 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13149 = OpExtInst %v2float %1 FClamp %18505 %7011 %21058 + %23584 = OpLoad %150 %5785 + %10339 = OpLoad %508 %5688 + %12147 = OpSampledImage %510 %23584 %10339 + %15371 = OpImageSampleExplicitLod %v4float %12147 %13149 Lod %float_0 + %15266 = OpCompositeExtract %float %15371 3 + %12116 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12972 = OpLoad %float %12116 + %15710 = OpFMul %float %15266 %12972 + %15279 = OpExtInst %float %1 FClamp %15710 %float_0 %float_1 + %22213 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11756 = OpLoad %v3float %22213 + %12103 = OpVectorTimesScalar %v3float %11756 %15279 + %15516 = OpLoad %150 %3312 + %24569 = OpLoad %508 %4646 + %12148 = OpSampledImage %510 %15516 %24569 + %17670 = OpImageSampleExplicitLod %v4float %12148 %13149 Lod %float_0 + %16938 = OpCompositeExtract %float %17670 1 + %14185 = OpFOrdGreaterThan %bool %16938 %float_0 + OpSelectionMerge %22307 DontFlatten + OpBranchConditional %14185 %12821 %22307 + %12821 = OpLabel + %13239 = OpLoad %150 %4862 + %19960 = OpLoad %508 %3594 + %12149 = OpSampledImage %510 %13239 %19960 + %15675 = OpImageSampleExplicitLod %v4float %12149 %13149 Lod %float_0 + %13866 = OpCompositeExtract %float %17670 1 + %12427 = OpCompositeExtract %float %17670 2 + %23300 = OpFMul %float %13866 %12427 + %17612 = OpExtInst %float %1 FClamp %23300 %float_0 %float_1 + %20291 = OpVectorShuffle %v3float %15675 %15675 0 1 2 + %11186 = OpVectorTimesScalar %v3float %20291 %17612 + %15293 = OpFAdd %v3float %12103 %11186 + OpBranch %22307 + %22307 = OpLabel + %7719 = OpPhi %v3float %12103 %25006 %15293 %12821 + %23399 = OpVectorTimesScalar %v3float %7719 %float_0_5 + %9339 = OpFAdd %float %float_0 %float_0_5 + %16235 = OpVectorShuffle %v3float %2938 %2938 0 1 2 + %22177 = OpFAdd %v3float %16235 %23399 + %15527 = OpVectorShuffle %v4float %2938 %22177 4 5 6 3 + %6434 = OpCompositeInsert %_struct_1017 %15527 %13863 0 + %24572 = OpVectorShuffle %v2float %836 %836 0 1 + %13207 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10345 = OpLoad %v4float %13207 + %8639 = OpVectorShuffle %v2float %10345 %10345 0 1 + %9198 = OpFMul %v2float %24572 %8639 + %18506 = OpFAdd %v2float %19927 %9198 + %7012 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21059 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13150 = OpExtInst %v2float %1 FClamp %18506 %7012 %21059 + %23585 = OpLoad %150 %5785 + %10340 = OpLoad %508 %5688 + %12150 = OpSampledImage %510 %23585 %10340 + %15372 = OpImageSampleExplicitLod %v4float %12150 %13150 Lod %float_0 + %15267 = OpCompositeExtract %float %15372 3 + %12117 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12973 = OpLoad %float %12117 + %15711 = OpFMul %float %15267 %12973 + %15280 = OpExtInst %float %1 FClamp %15711 %float_0 %float_1 + %22214 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11757 = OpLoad %v3float %22214 + %12104 = OpVectorTimesScalar %v3float %11757 %15280 + %15517 = OpLoad %150 %3312 + %24570 = OpLoad %508 %4646 + %12151 = OpSampledImage %510 %15517 %24570 + %17671 = OpImageSampleExplicitLod %v4float %12151 %13150 Lod %float_0 + %16939 = OpCompositeExtract %float %17671 1 + %14186 = OpFOrdGreaterThan %bool %16939 %float_0 + OpSelectionMerge %22308 DontFlatten + OpBranchConditional %14186 %12822 %22308 + %12822 = OpLabel + %13240 = OpLoad %150 %4862 + %19961 = OpLoad %508 %3594 + %12152 = OpSampledImage %510 %13240 %19961 + %15676 = OpImageSampleExplicitLod %v4float %12152 %13150 Lod %float_0 + %13867 = OpCompositeExtract %float %17671 1 + %12428 = OpCompositeExtract %float %17671 2 + %23301 = OpFMul %float %13867 %12428 + %17613 = OpExtInst %float %1 FClamp %23301 %float_0 %float_1 + %20292 = OpVectorShuffle %v3float %15676 %15676 0 1 2 + %11187 = OpVectorTimesScalar %v3float %20292 %17613 + %15294 = OpFAdd %v3float %12104 %11187 + OpBranch %22308 + %22308 = OpLabel + %7720 = OpPhi %v3float %12104 %22307 %15294 %12822 + %23400 = OpVectorTimesScalar %v3float %7720 %float_0_5 + %9340 = OpFAdd %float %9339 %float_0_5 + %16236 = OpVectorShuffle %v3float %15527 %15527 0 1 2 + %22178 = OpFAdd %v3float %16236 %23400 + %15528 = OpVectorShuffle %v4float %15527 %22178 4 5 6 3 + %6435 = OpCompositeInsert %_struct_1017 %15528 %6434 0 + %24573 = OpVectorShuffle %v2float %1367 %1367 0 1 + %13208 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10346 = OpLoad %v4float %13208 + %8640 = OpVectorShuffle %v2float %10346 %10346 0 1 + %9199 = OpFMul %v2float %24573 %8640 + %18507 = OpFAdd %v2float %19927 %9199 + %7013 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21060 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13151 = OpExtInst %v2float %1 FClamp %18507 %7013 %21060 + %23586 = OpLoad %150 %5785 + %10341 = OpLoad %508 %5688 + %12153 = OpSampledImage %510 %23586 %10341 + %15373 = OpImageSampleExplicitLod %v4float %12153 %13151 Lod %float_0 + %15268 = OpCompositeExtract %float %15373 3 + %12118 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12974 = OpLoad %float %12118 + %15712 = OpFMul %float %15268 %12974 + %15281 = OpExtInst %float %1 FClamp %15712 %float_0 %float_1 + %22215 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11758 = OpLoad %v3float %22215 + %12105 = OpVectorTimesScalar %v3float %11758 %15281 + %15518 = OpLoad %150 %3312 + %24571 = OpLoad %508 %4646 + %12154 = OpSampledImage %510 %15518 %24571 + %17672 = OpImageSampleExplicitLod %v4float %12154 %13151 Lod %float_0 + %16940 = OpCompositeExtract %float %17672 1 + %14187 = OpFOrdGreaterThan %bool %16940 %float_0 + OpSelectionMerge %22309 DontFlatten + OpBranchConditional %14187 %12823 %22309 + %12823 = OpLabel + %13241 = OpLoad %150 %4862 + %19962 = OpLoad %508 %3594 + %12155 = OpSampledImage %510 %13241 %19962 + %15677 = OpImageSampleExplicitLod %v4float %12155 %13151 Lod %float_0 + %13868 = OpCompositeExtract %float %17672 1 + %12429 = OpCompositeExtract %float %17672 2 + %23302 = OpFMul %float %13868 %12429 + %17614 = OpExtInst %float %1 FClamp %23302 %float_0 %float_1 + %20293 = OpVectorShuffle %v3float %15677 %15677 0 1 2 + %11188 = OpVectorTimesScalar %v3float %20293 %17614 + %15295 = OpFAdd %v3float %12105 %11188 + OpBranch %22309 + %22309 = OpLabel + %7721 = OpPhi %v3float %12105 %22308 %15295 %12823 + %23401 = OpVectorTimesScalar %v3float %7721 %float_0_75 + %9341 = OpFAdd %float %9340 %float_0_75 + %16237 = OpVectorShuffle %v3float %15528 %15528 0 1 2 + %22179 = OpFAdd %v3float %16237 %23401 + %15529 = OpVectorShuffle %v4float %15528 %22179 4 5 6 3 + %6436 = OpCompositeInsert %_struct_1017 %15529 %6435 0 + %24574 = OpVectorShuffle %v2float %141 %141 0 1 + %13209 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10347 = OpLoad %v4float %13209 + %8641 = OpVectorShuffle %v2float %10347 %10347 0 1 + %9200 = OpFMul %v2float %24574 %8641 + %18508 = OpFAdd %v2float %19927 %9200 + %7014 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21061 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13152 = OpExtInst %v2float %1 FClamp %18508 %7014 %21061 + %23587 = OpLoad %150 %5785 + %10342 = OpLoad %508 %5688 + %12156 = OpSampledImage %510 %23587 %10342 + %15374 = OpImageSampleExplicitLod %v4float %12156 %13152 Lod %float_0 + %15269 = OpCompositeExtract %float %15374 3 + %12119 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12975 = OpLoad %float %12119 + %15713 = OpFMul %float %15269 %12975 + %15282 = OpExtInst %float %1 FClamp %15713 %float_0 %float_1 + %22216 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11759 = OpLoad %v3float %22216 + %12106 = OpVectorTimesScalar %v3float %11759 %15282 + %15519 = OpLoad %150 %3312 + %24575 = OpLoad %508 %4646 + %12157 = OpSampledImage %510 %15519 %24575 + %17673 = OpImageSampleExplicitLod %v4float %12157 %13152 Lod %float_0 + %16941 = OpCompositeExtract %float %17673 1 + %14188 = OpFOrdGreaterThan %bool %16941 %float_0 + OpSelectionMerge %22310 DontFlatten + OpBranchConditional %14188 %12824 %22310 + %12824 = OpLabel + %13242 = OpLoad %150 %4862 + %19963 = OpLoad %508 %3594 + %12158 = OpSampledImage %510 %13242 %19963 + %15678 = OpImageSampleExplicitLod %v4float %12158 %13152 Lod %float_0 + %13869 = OpCompositeExtract %float %17673 1 + %12430 = OpCompositeExtract %float %17673 2 + %23303 = OpFMul %float %13869 %12430 + %17615 = OpExtInst %float %1 FClamp %23303 %float_0 %float_1 + %20294 = OpVectorShuffle %v3float %15678 %15678 0 1 2 + %11189 = OpVectorTimesScalar %v3float %20294 %17615 + %15296 = OpFAdd %v3float %12106 %11189 + OpBranch %22310 + %22310 = OpLabel + %7722 = OpPhi %v3float %12106 %22309 %15296 %12824 + %23402 = OpVectorTimesScalar %v3float %7722 %float_0_5 + %9342 = OpFAdd %float %9341 %float_0_5 + %16238 = OpVectorShuffle %v3float %15529 %15529 0 1 2 + %22180 = OpFAdd %v3float %16238 %23402 + %15530 = OpVectorShuffle %v4float %15529 %22180 4 5 6 3 + %6437 = OpCompositeInsert %_struct_1017 %15530 %6436 0 + %24576 = OpVectorShuffle %v2float %38 %38 0 1 + %13210 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10348 = OpLoad %v4float %13210 + %8642 = OpVectorShuffle %v2float %10348 %10348 0 1 + %9201 = OpFMul %v2float %24576 %8642 + %18509 = OpFAdd %v2float %19927 %9201 + %7015 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21062 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13153 = OpExtInst %v2float %1 FClamp %18509 %7015 %21062 + %23588 = OpLoad %150 %5785 + %10349 = OpLoad %508 %5688 + %12159 = OpSampledImage %510 %23588 %10349 + %15375 = OpImageSampleExplicitLod %v4float %12159 %13153 Lod %float_0 + %15270 = OpCompositeExtract %float %15375 3 + %12120 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12976 = OpLoad %float %12120 + %15714 = OpFMul %float %15270 %12976 + %15283 = OpExtInst %float %1 FClamp %15714 %float_0 %float_1 + %22217 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11760 = OpLoad %v3float %22217 + %12107 = OpVectorTimesScalar %v3float %11760 %15283 + %15520 = OpLoad %150 %3312 + %24577 = OpLoad %508 %4646 + %12160 = OpSampledImage %510 %15520 %24577 + %17674 = OpImageSampleExplicitLod %v4float %12160 %13153 Lod %float_0 + %16942 = OpCompositeExtract %float %17674 1 + %14189 = OpFOrdGreaterThan %bool %16942 %float_0 + OpSelectionMerge %22311 DontFlatten + OpBranchConditional %14189 %12825 %22311 + %12825 = OpLabel + %13243 = OpLoad %150 %4862 + %19964 = OpLoad %508 %3594 + %12161 = OpSampledImage %510 %13243 %19964 + %15679 = OpImageSampleExplicitLod %v4float %12161 %13153 Lod %float_0 + %13870 = OpCompositeExtract %float %17674 1 + %12431 = OpCompositeExtract %float %17674 2 + %23304 = OpFMul %float %13870 %12431 + %17616 = OpExtInst %float %1 FClamp %23304 %float_0 %float_1 + %20295 = OpVectorShuffle %v3float %15679 %15679 0 1 2 + %11190 = OpVectorTimesScalar %v3float %20295 %17616 + %15297 = OpFAdd %v3float %12107 %11190 + OpBranch %22311 + %22311 = OpLabel + %7723 = OpPhi %v3float %12107 %22310 %15297 %12825 + %23403 = OpVectorTimesScalar %v3float %7723 %float_0_5 + %9343 = OpFAdd %float %9342 %float_0_5 + %16239 = OpVectorShuffle %v3float %15530 %15530 0 1 2 + %22181 = OpFAdd %v3float %16239 %23403 + %15531 = OpVectorShuffle %v4float %15530 %22181 4 5 6 3 + %6438 = OpCompositeInsert %_struct_1017 %15531 %6437 0 + %24578 = OpVectorShuffle %v2float %95 %95 0 1 + %13211 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10350 = OpLoad %v4float %13211 + %8643 = OpVectorShuffle %v2float %10350 %10350 0 1 + %9202 = OpFMul %v2float %24578 %8643 + %18510 = OpFAdd %v2float %19927 %9202 + %7016 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21063 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13154 = OpExtInst %v2float %1 FClamp %18510 %7016 %21063 + %23589 = OpLoad %150 %5785 + %10351 = OpLoad %508 %5688 + %12162 = OpSampledImage %510 %23589 %10351 + %15376 = OpImageSampleExplicitLod %v4float %12162 %13154 Lod %float_0 + %15271 = OpCompositeExtract %float %15376 3 + %12121 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12977 = OpLoad %float %12121 + %15715 = OpFMul %float %15271 %12977 + %15284 = OpExtInst %float %1 FClamp %15715 %float_0 %float_1 + %22218 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11761 = OpLoad %v3float %22218 + %12108 = OpVectorTimesScalar %v3float %11761 %15284 + %15521 = OpLoad %150 %3312 + %24579 = OpLoad %508 %4646 + %12163 = OpSampledImage %510 %15521 %24579 + %17675 = OpImageSampleExplicitLod %v4float %12163 %13154 Lod %float_0 + %16943 = OpCompositeExtract %float %17675 1 + %14190 = OpFOrdGreaterThan %bool %16943 %float_0 + OpSelectionMerge %22312 DontFlatten + OpBranchConditional %14190 %12826 %22312 + %12826 = OpLabel + %13244 = OpLoad %150 %4862 + %19965 = OpLoad %508 %3594 + %12164 = OpSampledImage %510 %13244 %19965 + %15680 = OpImageSampleExplicitLod %v4float %12164 %13154 Lod %float_0 + %13871 = OpCompositeExtract %float %17675 1 + %12432 = OpCompositeExtract %float %17675 2 + %23305 = OpFMul %float %13871 %12432 + %17617 = OpExtInst %float %1 FClamp %23305 %float_0 %float_1 + %20296 = OpVectorShuffle %v3float %15680 %15680 0 1 2 + %11191 = OpVectorTimesScalar %v3float %20296 %17617 + %15298 = OpFAdd %v3float %12108 %11191 + OpBranch %22312 + %22312 = OpLabel + %7724 = OpPhi %v3float %12108 %22311 %15298 %12826 + %23404 = OpVectorTimesScalar %v3float %7724 %float_0_75 + %9344 = OpFAdd %float %9343 %float_0_75 + %16240 = OpVectorShuffle %v3float %15531 %15531 0 1 2 + %22182 = OpFAdd %v3float %16240 %23404 + %15532 = OpVectorShuffle %v4float %15531 %22182 4 5 6 3 + %6439 = OpCompositeInsert %_struct_1017 %15532 %6438 0 + %24580 = OpVectorShuffle %v2float %626 %626 0 1 + %13212 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10352 = OpLoad %v4float %13212 + %8644 = OpVectorShuffle %v2float %10352 %10352 0 1 + %9203 = OpFMul %v2float %24580 %8644 + %18511 = OpFAdd %v2float %19927 %9203 + %7017 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21064 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13155 = OpExtInst %v2float %1 FClamp %18511 %7017 %21064 + %23590 = OpLoad %150 %5785 + %10353 = OpLoad %508 %5688 + %12165 = OpSampledImage %510 %23590 %10353 + %15377 = OpImageSampleExplicitLod %v4float %12165 %13155 Lod %float_0 + %15272 = OpCompositeExtract %float %15377 3 + %12122 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12978 = OpLoad %float %12122 + %15716 = OpFMul %float %15272 %12978 + %15285 = OpExtInst %float %1 FClamp %15716 %float_0 %float_1 + %22219 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11762 = OpLoad %v3float %22219 + %12109 = OpVectorTimesScalar %v3float %11762 %15285 + %15522 = OpLoad %150 %3312 + %24581 = OpLoad %508 %4646 + %12166 = OpSampledImage %510 %15522 %24581 + %17676 = OpImageSampleExplicitLod %v4float %12166 %13155 Lod %float_0 + %16944 = OpCompositeExtract %float %17676 1 + %14191 = OpFOrdGreaterThan %bool %16944 %float_0 + OpSelectionMerge %22313 DontFlatten + OpBranchConditional %14191 %12827 %22313 + %12827 = OpLabel + %13245 = OpLoad %150 %4862 + %19966 = OpLoad %508 %3594 + %12167 = OpSampledImage %510 %13245 %19966 + %15681 = OpImageSampleExplicitLod %v4float %12167 %13155 Lod %float_0 + %13872 = OpCompositeExtract %float %17676 1 + %12433 = OpCompositeExtract %float %17676 2 + %23306 = OpFMul %float %13872 %12433 + %17618 = OpExtInst %float %1 FClamp %23306 %float_0 %float_1 + %20297 = OpVectorShuffle %v3float %15681 %15681 0 1 2 + %11192 = OpVectorTimesScalar %v3float %20297 %17618 + %15299 = OpFAdd %v3float %12109 %11192 + OpBranch %22313 + %22313 = OpLabel + %7725 = OpPhi %v3float %12109 %22312 %15299 %12827 + %23405 = OpVectorTimesScalar %v3float %7725 %float_1 + %9345 = OpFAdd %float %9344 %float_1 + %16241 = OpVectorShuffle %v3float %15532 %15532 0 1 2 + %22183 = OpFAdd %v3float %16241 %23405 + %15533 = OpVectorShuffle %v4float %15532 %22183 4 5 6 3 + %6440 = OpCompositeInsert %_struct_1017 %15533 %6439 0 + %24582 = OpVectorShuffle %v2float %2411 %2411 0 1 + %13213 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10354 = OpLoad %v4float %13213 + %8645 = OpVectorShuffle %v2float %10354 %10354 0 1 + %9204 = OpFMul %v2float %24582 %8645 + %18512 = OpFAdd %v2float %19927 %9204 + %7018 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21065 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13156 = OpExtInst %v2float %1 FClamp %18512 %7018 %21065 + %23591 = OpLoad %150 %5785 + %10355 = OpLoad %508 %5688 + %12168 = OpSampledImage %510 %23591 %10355 + %15378 = OpImageSampleExplicitLod %v4float %12168 %13156 Lod %float_0 + %15273 = OpCompositeExtract %float %15378 3 + %12123 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12979 = OpLoad %float %12123 + %15717 = OpFMul %float %15273 %12979 + %15286 = OpExtInst %float %1 FClamp %15717 %float_0 %float_1 + %22220 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11763 = OpLoad %v3float %22220 + %12110 = OpVectorTimesScalar %v3float %11763 %15286 + %15523 = OpLoad %150 %3312 + %24583 = OpLoad %508 %4646 + %12169 = OpSampledImage %510 %15523 %24583 + %17677 = OpImageSampleExplicitLod %v4float %12169 %13156 Lod %float_0 + %16945 = OpCompositeExtract %float %17677 1 + %14192 = OpFOrdGreaterThan %bool %16945 %float_0 + OpSelectionMerge %22314 DontFlatten + OpBranchConditional %14192 %12828 %22314 + %12828 = OpLabel + %13246 = OpLoad %150 %4862 + %19967 = OpLoad %508 %3594 + %12170 = OpSampledImage %510 %13246 %19967 + %15682 = OpImageSampleExplicitLod %v4float %12170 %13156 Lod %float_0 + %13873 = OpCompositeExtract %float %17677 1 + %12434 = OpCompositeExtract %float %17677 2 + %23307 = OpFMul %float %13873 %12434 + %17619 = OpExtInst %float %1 FClamp %23307 %float_0 %float_1 + %20298 = OpVectorShuffle %v3float %15682 %15682 0 1 2 + %11193 = OpVectorTimesScalar %v3float %20298 %17619 + %15300 = OpFAdd %v3float %12110 %11193 + OpBranch %22314 + %22314 = OpLabel + %7726 = OpPhi %v3float %12110 %22313 %15300 %12828 + %23406 = OpVectorTimesScalar %v3float %7726 %float_0_75 + %9346 = OpFAdd %float %9345 %float_0_75 + %16242 = OpVectorShuffle %v3float %15533 %15533 0 1 2 + %22184 = OpFAdd %v3float %16242 %23406 + %15534 = OpVectorShuffle %v4float %15533 %22184 4 5 6 3 + %6441 = OpCompositeInsert %_struct_1017 %15534 %6440 0 + %24584 = OpVectorShuffle %v2float %2354 %2354 0 1 + %13214 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10356 = OpLoad %v4float %13214 + %8646 = OpVectorShuffle %v2float %10356 %10356 0 1 + %9205 = OpFMul %v2float %24584 %8646 + %18513 = OpFAdd %v2float %19927 %9205 + %7019 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21066 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13157 = OpExtInst %v2float %1 FClamp %18513 %7019 %21066 + %23592 = OpLoad %150 %5785 + %10357 = OpLoad %508 %5688 + %12171 = OpSampledImage %510 %23592 %10357 + %15379 = OpImageSampleExplicitLod %v4float %12171 %13157 Lod %float_0 + %15274 = OpCompositeExtract %float %15379 3 + %12124 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12980 = OpLoad %float %12124 + %15718 = OpFMul %float %15274 %12980 + %15287 = OpExtInst %float %1 FClamp %15718 %float_0 %float_1 + %22221 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11764 = OpLoad %v3float %22221 + %12111 = OpVectorTimesScalar %v3float %11764 %15287 + %15524 = OpLoad %150 %3312 + %24585 = OpLoad %508 %4646 + %12172 = OpSampledImage %510 %15524 %24585 + %17678 = OpImageSampleExplicitLod %v4float %12172 %13157 Lod %float_0 + %16946 = OpCompositeExtract %float %17678 1 + %14193 = OpFOrdGreaterThan %bool %16946 %float_0 + OpSelectionMerge %22315 DontFlatten + OpBranchConditional %14193 %12829 %22315 + %12829 = OpLabel + %13247 = OpLoad %150 %4862 + %19968 = OpLoad %508 %3594 + %12173 = OpSampledImage %510 %13247 %19968 + %15683 = OpImageSampleExplicitLod %v4float %12173 %13157 Lod %float_0 + %13874 = OpCompositeExtract %float %17678 1 + %12435 = OpCompositeExtract %float %17678 2 + %23308 = OpFMul %float %13874 %12435 + %17620 = OpExtInst %float %1 FClamp %23308 %float_0 %float_1 + %20299 = OpVectorShuffle %v3float %15683 %15683 0 1 2 + %11194 = OpVectorTimesScalar %v3float %20299 %17620 + %15301 = OpFAdd %v3float %12111 %11194 + OpBranch %22315 + %22315 = OpLabel + %7727 = OpPhi %v3float %12111 %22314 %15301 %12829 + %23407 = OpVectorTimesScalar %v3float %7727 %float_0_5 + %9347 = OpFAdd %float %9346 %float_0_5 + %16243 = OpVectorShuffle %v3float %15534 %15534 0 1 2 + %22185 = OpFAdd %v3float %16243 %23407 + %15535 = OpVectorShuffle %v4float %15534 %22185 4 5 6 3 + %6442 = OpCompositeInsert %_struct_1017 %15535 %6441 0 + %24586 = OpVectorShuffle %v2float %837 %837 0 1 + %13215 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10358 = OpLoad %v4float %13215 + %8647 = OpVectorShuffle %v2float %10358 %10358 0 1 + %9206 = OpFMul %v2float %24586 %8647 + %18514 = OpFAdd %v2float %19927 %9206 + %7020 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21067 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13158 = OpExtInst %v2float %1 FClamp %18514 %7020 %21067 + %23593 = OpLoad %150 %5785 + %10359 = OpLoad %508 %5688 + %12174 = OpSampledImage %510 %23593 %10359 + %15380 = OpImageSampleExplicitLod %v4float %12174 %13158 Lod %float_0 + %15275 = OpCompositeExtract %float %15380 3 + %12125 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12981 = OpLoad %float %12125 + %15719 = OpFMul %float %15275 %12981 + %15288 = OpExtInst %float %1 FClamp %15719 %float_0 %float_1 + %22222 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11765 = OpLoad %v3float %22222 + %12112 = OpVectorTimesScalar %v3float %11765 %15288 + %15525 = OpLoad %150 %3312 + %24587 = OpLoad %508 %4646 + %12175 = OpSampledImage %510 %15525 %24587 + %17679 = OpImageSampleExplicitLod %v4float %12175 %13158 Lod %float_0 + %16947 = OpCompositeExtract %float %17679 1 + %14194 = OpFOrdGreaterThan %bool %16947 %float_0 + OpSelectionMerge %22316 DontFlatten + OpBranchConditional %14194 %12830 %22316 + %12830 = OpLabel + %13248 = OpLoad %150 %4862 + %19969 = OpLoad %508 %3594 + %12176 = OpSampledImage %510 %13248 %19969 + %15684 = OpImageSampleExplicitLod %v4float %12176 %13158 Lod %float_0 + %13875 = OpCompositeExtract %float %17679 1 + %12436 = OpCompositeExtract %float %17679 2 + %23309 = OpFMul %float %13875 %12436 + %17621 = OpExtInst %float %1 FClamp %23309 %float_0 %float_1 + %20300 = OpVectorShuffle %v3float %15684 %15684 0 1 2 + %11195 = OpVectorTimesScalar %v3float %20300 %17621 + %15302 = OpFAdd %v3float %12112 %11195 + OpBranch %22316 + %22316 = OpLabel + %7728 = OpPhi %v3float %12112 %22315 %15302 %12830 + %23408 = OpVectorTimesScalar %v3float %7728 %float_0_5 + %9348 = OpFAdd %float %9347 %float_0_5 + %16244 = OpVectorShuffle %v3float %15535 %15535 0 1 2 + %22186 = OpFAdd %v3float %16244 %23408 + %15536 = OpVectorShuffle %v4float %15535 %22186 4 5 6 3 + %6443 = OpCompositeInsert %_struct_1017 %15536 %6442 0 + %24588 = OpVectorShuffle %v2float %1368 %1368 0 1 + %13216 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10360 = OpLoad %v4float %13216 + %8648 = OpVectorShuffle %v2float %10360 %10360 0 1 + %9207 = OpFMul %v2float %24588 %8648 + %18515 = OpFAdd %v2float %19927 %9207 + %7021 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21068 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13159 = OpExtInst %v2float %1 FClamp %18515 %7021 %21068 + %23594 = OpLoad %150 %5785 + %10361 = OpLoad %508 %5688 + %12177 = OpSampledImage %510 %23594 %10361 + %15381 = OpImageSampleExplicitLod %v4float %12177 %13159 Lod %float_0 + %15276 = OpCompositeExtract %float %15381 3 + %12126 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12982 = OpLoad %float %12126 + %15720 = OpFMul %float %15276 %12982 + %15289 = OpExtInst %float %1 FClamp %15720 %float_0 %float_1 + %22223 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11766 = OpLoad %v3float %22223 + %12113 = OpVectorTimesScalar %v3float %11766 %15289 + %15526 = OpLoad %150 %3312 + %24589 = OpLoad %508 %4646 + %12178 = OpSampledImage %510 %15526 %24589 + %17680 = OpImageSampleExplicitLod %v4float %12178 %13159 Lod %float_0 + %16948 = OpCompositeExtract %float %17680 1 + %14195 = OpFOrdGreaterThan %bool %16948 %float_0 + OpSelectionMerge %22317 DontFlatten + OpBranchConditional %14195 %12831 %22317 + %12831 = OpLabel + %13249 = OpLoad %150 %4862 + %19970 = OpLoad %508 %3594 + %12179 = OpSampledImage %510 %13249 %19970 + %15685 = OpImageSampleExplicitLod %v4float %12179 %13159 Lod %float_0 + %13876 = OpCompositeExtract %float %17680 1 + %12437 = OpCompositeExtract %float %17680 2 + %23310 = OpFMul %float %13876 %12437 + %17622 = OpExtInst %float %1 FClamp %23310 %float_0 %float_1 + %20301 = OpVectorShuffle %v3float %15685 %15685 0 1 2 + %11196 = OpVectorTimesScalar %v3float %20301 %17622 + %15303 = OpFAdd %v3float %12113 %11196 + OpBranch %22317 + %22317 = OpLabel + %7729 = OpPhi %v3float %12113 %22316 %15303 %12831 + %23409 = OpVectorTimesScalar %v3float %7729 %float_0_75 + %9349 = OpFAdd %float %9348 %float_0_75 + %16245 = OpVectorShuffle %v3float %15536 %15536 0 1 2 + %22187 = OpFAdd %v3float %16245 %23409 + %15537 = OpVectorShuffle %v4float %15536 %22187 4 5 6 3 + %6444 = OpCompositeInsert %_struct_1017 %15537 %6443 0 + %24590 = OpVectorShuffle %v2float %142 %142 0 1 + %13217 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10362 = OpLoad %v4float %13217 + %8649 = OpVectorShuffle %v2float %10362 %10362 0 1 + %9208 = OpFMul %v2float %24590 %8649 + %18516 = OpFAdd %v2float %19927 %9208 + %7022 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21069 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13160 = OpExtInst %v2float %1 FClamp %18516 %7022 %21069 + %23595 = OpLoad %150 %5785 + %10363 = OpLoad %508 %5688 + %12180 = OpSampledImage %510 %23595 %10363 + %15382 = OpImageSampleExplicitLod %v4float %12180 %13160 Lod %float_0 + %15277 = OpCompositeExtract %float %15382 3 + %12127 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12983 = OpLoad %float %12127 + %15721 = OpFMul %float %15277 %12983 + %15290 = OpExtInst %float %1 FClamp %15721 %float_0 %float_1 + %22224 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11767 = OpLoad %v3float %22224 + %12114 = OpVectorTimesScalar %v3float %11767 %15290 + %15538 = OpLoad %150 %3312 + %24591 = OpLoad %508 %4646 + %12181 = OpSampledImage %510 %15538 %24591 + %17681 = OpImageSampleExplicitLod %v4float %12181 %13160 Lod %float_0 + %16949 = OpCompositeExtract %float %17681 1 + %14196 = OpFOrdGreaterThan %bool %16949 %float_0 + OpSelectionMerge %22318 DontFlatten + OpBranchConditional %14196 %12832 %22318 + %12832 = OpLabel + %13250 = OpLoad %150 %4862 + %19971 = OpLoad %508 %3594 + %12182 = OpSampledImage %510 %13250 %19971 + %15686 = OpImageSampleExplicitLod %v4float %12182 %13160 Lod %float_0 + %13877 = OpCompositeExtract %float %17681 1 + %12438 = OpCompositeExtract %float %17681 2 + %23311 = OpFMul %float %13877 %12438 + %17623 = OpExtInst %float %1 FClamp %23311 %float_0 %float_1 + %20302 = OpVectorShuffle %v3float %15686 %15686 0 1 2 + %11197 = OpVectorTimesScalar %v3float %20302 %17623 + %15304 = OpFAdd %v3float %12114 %11197 + OpBranch %22318 + %22318 = OpLabel + %7730 = OpPhi %v3float %12114 %22317 %15304 %12832 + %23410 = OpVectorTimesScalar %v3float %7730 %float_0_5 + %9350 = OpFAdd %float %9349 %float_0_5 + %16246 = OpVectorShuffle %v3float %15537 %15537 0 1 2 + %22188 = OpFAdd %v3float %16246 %23410 + %15539 = OpVectorShuffle %v4float %15537 %22188 4 5 6 3 + %6445 = OpCompositeInsert %_struct_1017 %15539 %6444 0 + %24592 = OpVectorShuffle %v2float %1197 %1197 0 1 + %13218 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10364 = OpLoad %v4float %13218 + %8650 = OpVectorShuffle %v2float %10364 %10364 0 1 + %9209 = OpFMul %v2float %24592 %8650 + %18517 = OpFAdd %v2float %19927 %9209 + %7023 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21070 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13161 = OpExtInst %v2float %1 FClamp %18517 %7023 %21070 + %23596 = OpLoad %150 %5785 + %10365 = OpLoad %508 %5688 + %12183 = OpSampledImage %510 %23596 %10365 + %15383 = OpImageSampleExplicitLod %v4float %12183 %13161 Lod %float_0 + %15278 = OpCompositeExtract %float %15383 3 + %12128 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12984 = OpLoad %float %12128 + %15722 = OpFMul %float %15278 %12984 + %15291 = OpExtInst %float %1 FClamp %15722 %float_0 %float_1 + %22225 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11768 = OpLoad %v3float %22225 + %12115 = OpVectorTimesScalar %v3float %11768 %15291 + %15540 = OpLoad %150 %3312 + %24593 = OpLoad %508 %4646 + %12184 = OpSampledImage %510 %15540 %24593 + %17682 = OpImageSampleExplicitLod %v4float %12184 %13161 Lod %float_0 + %16950 = OpCompositeExtract %float %17682 1 + %14197 = OpFOrdGreaterThan %bool %16950 %float_0 + OpSelectionMerge %22319 DontFlatten + OpBranchConditional %14197 %12833 %22319 + %12833 = OpLabel + %13251 = OpLoad %150 %4862 + %19972 = OpLoad %508 %3594 + %12185 = OpSampledImage %510 %13251 %19972 + %15687 = OpImageSampleExplicitLod %v4float %12185 %13161 Lod %float_0 + %13878 = OpCompositeExtract %float %17682 1 + %12439 = OpCompositeExtract %float %17682 2 + %23312 = OpFMul %float %13878 %12439 + %17624 = OpExtInst %float %1 FClamp %23312 %float_0 %float_1 + %20303 = OpVectorShuffle %v3float %15687 %15687 0 1 2 + %11198 = OpVectorTimesScalar %v3float %20303 %17624 + %15305 = OpFAdd %v3float %12115 %11198 + OpBranch %22319 + %22319 = OpLabel + %7731 = OpPhi %v3float %12115 %22318 %15305 %12833 + %23411 = OpVectorTimesScalar %v3float %7731 %float_0_5 + %9351 = OpFAdd %float %9350 %float_0_5 + %16247 = OpVectorShuffle %v3float %15539 %15539 0 1 2 + %22189 = OpFAdd %v3float %16247 %23411 + %15541 = OpVectorShuffle %v4float %15539 %22189 4 5 6 3 + %6719 = OpCompositeInsert %_struct_1017 %15541 %6445 0 + %23412 = OpVectorShuffle %v3float %15541 %15541 0 1 2 + %10833 = OpCompositeConstruct %v3float %9351 %9351 %9351 + %13750 = OpFDiv %v3float %23412 %10833 + %24033 = OpVectorShuffle %v4float %15541 %13750 4 5 6 3 + %8636 = OpCompositeInsert %_struct_1017 %24033 %6719 0 + %16315 = OpCompositeInsert %_struct_1017 %float_1 %8636 0 3 + %11544 = OpCompositeExtract %v4float %16315 0 + OpStore %4317 %11544 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc b/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc new file mode 100644 index 0000000000..b21a2d3dd5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 46 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 1 + OpExecutionMode %main Triangles + OpSource ESSL 310 + OpSourceExtension "GL_EXT_shader_io_blocks" + OpSourceExtension "GL_EXT_tessellation_shader" + OpName %main "main" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %TessLevels "TessLevels" + OpMemberName %TessLevels 0 "inner0" + OpMemberName %TessLevels 1 "inner1" + OpMemberName %TessLevels 2 "outer0" + OpMemberName %TessLevels 3 "outer1" + OpMemberName %TessLevels 4 "outer2" + OpMemberName %TessLevels 5 "outer3" + OpName %sb_levels "sb_levels" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpMemberDecorate %TessLevels 0 Restrict + OpMemberDecorate %TessLevels 0 NonWritable + OpMemberDecorate %TessLevels 0 Offset 0 + OpMemberDecorate %TessLevels 1 Restrict + OpMemberDecorate %TessLevels 1 NonWritable + OpMemberDecorate %TessLevels 1 Offset 4 + OpMemberDecorate %TessLevels 2 Restrict + OpMemberDecorate %TessLevels 2 NonWritable + OpMemberDecorate %TessLevels 2 Offset 8 + OpMemberDecorate %TessLevels 3 Restrict + OpMemberDecorate %TessLevels 3 NonWritable + OpMemberDecorate %TessLevels 3 Offset 12 + OpMemberDecorate %TessLevels 4 Restrict + OpMemberDecorate %TessLevels 4 NonWritable + OpMemberDecorate %TessLevels 4 Offset 16 + OpMemberDecorate %TessLevels 5 Restrict + OpMemberDecorate %TessLevels 5 NonWritable + OpMemberDecorate %TessLevels 5 Offset 20 + OpDecorate %TessLevels Block + OpDecorate %sb_levels DescriptorSet 0 + OpDecorate %sb_levels Binding 0 + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %TessLevels = OpTypeStruct %float %float %float %float %float %float +%_ptr_StorageBuffer_TessLevels = OpTypePointer StorageBuffer %TessLevels + %sb_levels = OpVariable %_ptr_StorageBuffer_TessLevels StorageBuffer +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_0 + %19 = OpLoad %float %18 + %21 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %21 %19 + %23 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_1 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %25 %24 + %31 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_2 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %33 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_3 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %37 %36 + %39 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_4 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %41 %40 + %43 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_5 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %45 %44 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc b/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc new file mode 100644 index 0000000000..b21a2d3dd5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/tesc/tess-level-overrun.multi-patch.asm.tesc @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 46 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 1 + OpExecutionMode %main Triangles + OpSource ESSL 310 + OpSourceExtension "GL_EXT_shader_io_blocks" + OpSourceExtension "GL_EXT_tessellation_shader" + OpName %main "main" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %TessLevels "TessLevels" + OpMemberName %TessLevels 0 "inner0" + OpMemberName %TessLevels 1 "inner1" + OpMemberName %TessLevels 2 "outer0" + OpMemberName %TessLevels 3 "outer1" + OpMemberName %TessLevels 4 "outer2" + OpMemberName %TessLevels 5 "outer3" + OpName %sb_levels "sb_levels" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpMemberDecorate %TessLevels 0 Restrict + OpMemberDecorate %TessLevels 0 NonWritable + OpMemberDecorate %TessLevels 0 Offset 0 + OpMemberDecorate %TessLevels 1 Restrict + OpMemberDecorate %TessLevels 1 NonWritable + OpMemberDecorate %TessLevels 1 Offset 4 + OpMemberDecorate %TessLevels 2 Restrict + OpMemberDecorate %TessLevels 2 NonWritable + OpMemberDecorate %TessLevels 2 Offset 8 + OpMemberDecorate %TessLevels 3 Restrict + OpMemberDecorate %TessLevels 3 NonWritable + OpMemberDecorate %TessLevels 3 Offset 12 + OpMemberDecorate %TessLevels 4 Restrict + OpMemberDecorate %TessLevels 4 NonWritable + OpMemberDecorate %TessLevels 4 Offset 16 + OpMemberDecorate %TessLevels 5 Restrict + OpMemberDecorate %TessLevels 5 NonWritable + OpMemberDecorate %TessLevels 5 Offset 20 + OpDecorate %TessLevels Block + OpDecorate %sb_levels DescriptorSet 0 + OpDecorate %sb_levels Binding 0 + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %TessLevels = OpTypeStruct %float %float %float %float %float %float +%_ptr_StorageBuffer_TessLevels = OpTypePointer StorageBuffer %TessLevels + %sb_levels = OpVariable %_ptr_StorageBuffer_TessLevels StorageBuffer +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_0 + %19 = OpLoad %float %18 + %21 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %21 %19 + %23 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_1 + %24 = OpLoad %float %23 + %25 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %25 %24 + %31 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_2 + %32 = OpLoad %float %31 + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %33 %32 + %35 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_3 + %36 = OpLoad %float %35 + %37 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %37 %36 + %39 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_4 + %40 = OpLoad %float %39 + %41 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %41 %40 + %43 = OpAccessChain %_ptr_StorageBuffer_float %sb_levels %int_5 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %45 %44 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese b/third_party/spirv-cross/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese new file mode 100644 index 0000000000..956d2a65b4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/tese/unnamed-builtin-array.asm.tese @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 72 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %_ %gl_TessCoord %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main Quads + OpExecutionMode %main SpacingFractionalEven + OpExecutionMode %main VertexOrderCw + OpSource ESSL 310 + OpSourceExtension "GL_EXT_shader_io_blocks" + OpSourceExtension "GL_EXT_tessellation_shader" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpDecorate %gl_PerVertex Block + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%gl_PerVertex = OpTypeStruct %v4float %float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input + %float_1 = OpConstant %float 1 + %int_2 = OpConstant %int 2 + %uint_1 = OpConstant %uint 1 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %20 = OpLoad %float %19 + %25 = OpAccessChain %_ptr_Input_float %gl_TessLevelInner %int_0 + %26 = OpLoad %float %25 + %27 = OpFMul %float %20 %26 + %32 = OpAccessChain %_ptr_Input_float %gl_TessLevelOuter %int_0 + %33 = OpLoad %float %32 + %34 = OpFMul %float %27 %33 + %36 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpFSub %float %float_1 %37 + %39 = OpAccessChain %_ptr_Input_float %gl_TessLevelInner %int_0 + %40 = OpLoad %float %39 + %41 = OpFMul %float %38 %40 + %43 = OpAccessChain %_ptr_Input_float %gl_TessLevelOuter %int_2 + %44 = OpLoad %float %43 + %45 = OpFMul %float %41 %44 + %46 = OpFAdd %float %34 %45 + %48 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Input_float %gl_TessLevelInner %int_1 + %52 = OpLoad %float %51 + %53 = OpFMul %float %49 %52 + %54 = OpAccessChain %_ptr_Input_float %gl_TessLevelOuter %int_1 + %55 = OpLoad %float %54 + %56 = OpFMul %float %53 %55 + %57 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1 + %58 = OpLoad %float %57 + %59 = OpFSub %float %float_1 %58 + %60 = OpAccessChain %_ptr_Input_float %gl_TessLevelInner %int_1 + %61 = OpLoad %float %60 + %62 = OpFMul %float %59 %61 + %64 = OpAccessChain %_ptr_Input_float %gl_TessLevelOuter %int_3 + %65 = OpLoad %float %64 + %66 = OpFMul %float %62 %65 + %67 = OpFAdd %float %56 %66 + %69 = OpCompositeConstruct %v4float %46 %67 %float_0 %float_1 + %71 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %71 %69 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert new file mode 100644 index 0000000000..59ec3f9198 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.asm.vert @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability ClipDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %pos_1 %_entryPointOutput_pos %_entryPointOutput_clip + OpSource HLSL 500 + OpName %main "main" + OpName %VSOut "VSOut" + OpMemberName %VSOut 0 "pos" + OpMemberName %VSOut 1 "clip" + OpName %_main_vf4_ "@main(vf4;" + OpName %pos "pos" + OpName %vout "vout" + OpName %pos_0 "pos" + OpName %pos_1 "pos" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %_entryPointOutput_clip "@entryPointOutput.clip" + OpDecorate %pos_1 Location 0 + OpDecorate %_entryPointOutput_pos BuiltIn Position + OpDecorate %_entryPointOutput_clip BuiltIn ClipDistance + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 + %VSOut = OpTypeStruct %v4float %v2float + %11 = OpTypeFunction %VSOut %_ptr_Function_v4float +%_ptr_Function_VSOut = OpTypePointer Function %VSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %pos_1 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_pos = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_entryPointOutput_clip = OpVariable %_ptr_Output__arr_float_uint_2 Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %pos_0 = OpVariable %_ptr_Function_v4float Function +%flattenTemp = OpVariable %_ptr_Function_VSOut Function + %param = OpVariable %_ptr_Function_v4float Function + %32 = OpLoad %v4float %pos_1 + OpStore %pos_0 %32 + %35 = OpLoad %v4float %pos_0 + OpStore %param %35 + %36 = OpFunctionCall %VSOut %_main_vf4_ %param + OpStore %flattenTemp %36 + %39 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %40 = OpLoad %v4float %39 + OpStore %_entryPointOutput_pos %40 + %48 = OpAccessChain %_ptr_Function_float %flattenTemp %int_1 %uint_0 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Output_float %_entryPointOutput_clip %int_0 + OpStore %51 %49 + %53 = OpAccessChain %_ptr_Function_float %flattenTemp %int_1 %uint_1 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_entryPointOutput_clip %int_1 + OpStore %55 %54 + OpReturn + OpFunctionEnd + %_main_vf4_ = OpFunction %VSOut None %11 + %pos = OpFunctionParameter %_ptr_Function_v4float + %14 = OpLabel + %vout = OpVariable %_ptr_Function_VSOut Function + %19 = OpLoad %v4float %pos + %20 = OpAccessChain %_ptr_Function_v4float %vout %int_0 + OpStore %20 %19 + %22 = OpLoad %v4float %pos + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %25 = OpAccessChain %_ptr_Function_v2float %vout %int_1 + OpStore %25 %23 + %26 = OpLoad %VSOut %vout + OpReturnValue %26 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert new file mode 100644 index 0000000000..59ec3f9198 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/clip-distance-plain-variable.no-user-varying.asm.vert @@ -0,0 +1,91 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 56 +; Schema: 0 + OpCapability Shader + OpCapability ClipDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %pos_1 %_entryPointOutput_pos %_entryPointOutput_clip + OpSource HLSL 500 + OpName %main "main" + OpName %VSOut "VSOut" + OpMemberName %VSOut 0 "pos" + OpMemberName %VSOut 1 "clip" + OpName %_main_vf4_ "@main(vf4;" + OpName %pos "pos" + OpName %vout "vout" + OpName %pos_0 "pos" + OpName %pos_1 "pos" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %_entryPointOutput_clip "@entryPointOutput.clip" + OpDecorate %pos_1 Location 0 + OpDecorate %_entryPointOutput_pos BuiltIn Position + OpDecorate %_entryPointOutput_clip BuiltIn ClipDistance + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v2float = OpTypeVector %float 2 + %VSOut = OpTypeStruct %v4float %v2float + %11 = OpTypeFunction %VSOut %_ptr_Function_v4float +%_ptr_Function_VSOut = OpTypePointer Function %VSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %pos_1 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_pos = OpVariable %_ptr_Output_v4float Output + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_entryPointOutput_clip = OpVariable %_ptr_Output__arr_float_uint_2 Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %pos_0 = OpVariable %_ptr_Function_v4float Function +%flattenTemp = OpVariable %_ptr_Function_VSOut Function + %param = OpVariable %_ptr_Function_v4float Function + %32 = OpLoad %v4float %pos_1 + OpStore %pos_0 %32 + %35 = OpLoad %v4float %pos_0 + OpStore %param %35 + %36 = OpFunctionCall %VSOut %_main_vf4_ %param + OpStore %flattenTemp %36 + %39 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %40 = OpLoad %v4float %39 + OpStore %_entryPointOutput_pos %40 + %48 = OpAccessChain %_ptr_Function_float %flattenTemp %int_1 %uint_0 + %49 = OpLoad %float %48 + %51 = OpAccessChain %_ptr_Output_float %_entryPointOutput_clip %int_0 + OpStore %51 %49 + %53 = OpAccessChain %_ptr_Function_float %flattenTemp %int_1 %uint_1 + %54 = OpLoad %float %53 + %55 = OpAccessChain %_ptr_Output_float %_entryPointOutput_clip %int_1 + OpStore %55 %54 + OpReturn + OpFunctionEnd + %_main_vf4_ = OpFunction %VSOut None %11 + %pos = OpFunctionParameter %_ptr_Function_v4float + %14 = OpLabel + %vout = OpVariable %_ptr_Function_VSOut Function + %19 = OpLoad %v4float %pos + %20 = OpAccessChain %_ptr_Function_v4float %vout %int_0 + OpStore %20 %19 + %22 = OpLoad %v4float %pos + %23 = OpVectorShuffle %v2float %22 %22 0 1 + %25 = OpAccessChain %_ptr_Function_v2float %vout %int_1 + OpStore %25 %23 + %26 = OpLoad %VSOut %vout + OpReturnValue %26 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/copy-memory-interface.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/copy-memory-interface.asm.vert new file mode 100644 index 0000000000..c52c9bf0b5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/copy-memory-interface.asm.vert @@ -0,0 +1,33 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 1 +; Bound: 13 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" %8 %9 %11 %12 + OpName %1 "main" + OpName %8 "v0" + OpName %9 "v1" + OpName %11 "o0" + OpName %12 "o1" + OpDecorate %8 Location 0 + OpDecorate %9 Location 1 + OpDecorate %11 BuiltIn Position + OpDecorate %12 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %5 = OpTypeFloat 32 + %6 = OpTypeVector %5 4 + %7 = OpTypePointer Input %6 + %8 = OpVariable %7 Input + %9 = OpVariable %7 Input + %10 = OpTypePointer Output %6 + %11 = OpVariable %10 Output + %12 = OpVariable %10 Output + %1 = OpFunction %2 None %3 + %4 = OpLabel + OpCopyMemory %11 %8 + OpCopyMemory %12 %9 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..89edeaa731 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %VS "main" %PosL_1 %instanceID_1 %_entryPointOutput_Position %_entryPointOutput_Color + OpSource HLSL 500 + OpName %VS "VS" + OpName %V2F "V2F" + OpMemberName %V2F 0 "Position" + OpMemberName %V2F 1 "Color" + OpName %_VS_vf3_u1_ "@VS(vf3;u1;" + OpName %PosL "PosL" + OpName %instanceID "instanceID" + OpName %InstanceData "InstanceData" + OpMemberName %InstanceData 0 "MATRIX_MVP" + OpMemberName %InstanceData 1 "Color" + OpName %instData "instData" + OpName %InstanceData_0 "InstanceData" + OpMemberName %InstanceData_0 0 "MATRIX_MVP" + OpMemberName %InstanceData_0 1 "Color" + OpName %gInstanceData "gInstanceData" + OpMemberName %gInstanceData 0 "@data" + OpName %gInstanceData_0 "gInstanceData" + OpName %v2f "v2f" + OpName %PosL_0 "PosL" + OpName %PosL_1 "PosL" + OpName %instanceID_0 "instanceID" + OpName %instanceID_1 "instanceID" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_Position "@entryPointOutput.Position" + OpName %_entryPointOutput_Color "@entryPointOutput.Color" + OpMemberDecorate %InstanceData_0 0 RowMajor + OpMemberDecorate %InstanceData_0 0 Offset 0 + OpMemberDecorate %InstanceData_0 0 MatrixStride 16 + OpMemberDecorate %InstanceData_0 1 Offset 64 + OpDecorate %_runtimearr_InstanceData_0 ArrayStride 80 + OpMemberDecorate %gInstanceData 0 NonWritable + OpMemberDecorate %gInstanceData 0 Offset 0 + OpDecorate %gInstanceData BufferBlock + OpDecorate %gInstanceData_0 DescriptorSet 1 + OpDecorate %gInstanceData_0 Binding 0 + OpDecorate %PosL_1 Location 0 + OpDecorate %instanceID_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput_Position BuiltIn Position + OpDecorate %_entryPointOutput_Color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %v4float = OpTypeVector %float 4 + %V2F = OpTypeStruct %v4float %v4float + %13 = OpTypeFunction %V2F %_ptr_Function_v3float %_ptr_Function_uint +%mat4v4float = OpTypeMatrix %v4float 4 +%InstanceData = OpTypeStruct %mat4v4float %v4float +%_ptr_Function_InstanceData = OpTypePointer Function %InstanceData +%InstanceData_0 = OpTypeStruct %mat4v4float %v4float +%_runtimearr_InstanceData_0 = OpTypeRuntimeArray %InstanceData_0 +%gInstanceData = OpTypeStruct %_runtimearr_InstanceData_0 +%_ptr_Uniform_gInstanceData = OpTypePointer Uniform %gInstanceData +%gInstanceData_0 = OpVariable %_ptr_Uniform_gInstanceData Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_InstanceData_0 = OpTypePointer Uniform %InstanceData_0 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_V2F = OpTypePointer Function %V2F + %float_1 = OpConstant %float 1 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %PosL_1 = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_uint = OpTypePointer Input %uint +%instanceID_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_Position = OpVariable %_ptr_Output_v4float Output +%_entryPointOutput_Color = OpVariable %_ptr_Output_v4float Output + %VS = OpFunction %void None %3 + %5 = OpLabel + %PosL_0 = OpVariable %_ptr_Function_v3float Function +%instanceID_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_V2F Function + %param = OpVariable %_ptr_Function_v3float Function + %param_0 = OpVariable %_ptr_Function_uint Function + %61 = OpLoad %v3float %PosL_1 + OpStore %PosL_0 %61 + %65 = OpLoad %uint %instanceID_1 + OpStore %instanceID_0 %65 + %68 = OpLoad %v3float %PosL_0 + OpStore %param %68 + %70 = OpLoad %uint %instanceID_0 + OpStore %param_0 %70 + %71 = OpFunctionCall %V2F %_VS_vf3_u1_ %param %param_0 + OpStore %flattenTemp %71 + %74 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %75 = OpLoad %v4float %74 + OpStore %_entryPointOutput_Position %75 + %77 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_1 + %78 = OpLoad %v4float %77 + OpStore %_entryPointOutput_Color %78 + OpReturn + OpFunctionEnd +%_VS_vf3_u1_ = OpFunction %V2F None %13 + %PosL = OpFunctionParameter %_ptr_Function_v3float + %instanceID = OpFunctionParameter %_ptr_Function_uint + %17 = OpLabel + %instData = OpVariable %_ptr_Function_InstanceData Function + %v2f = OpVariable %_ptr_Function_V2F Function + %29 = OpLoad %uint %instanceID + %31 = OpAccessChain %_ptr_Uniform_InstanceData_0 %gInstanceData_0 %int_0 %29 + %32 = OpLoad %InstanceData_0 %31 + %33 = OpCompositeExtract %mat4v4float %32 0 + %35 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + OpStore %35 %33 + %36 = OpCompositeExtract %v4float %32 1 + %39 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + OpStore %39 %36 + %42 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + %43 = OpLoad %mat4v4float %42 + %44 = OpLoad %v3float %PosL + %46 = OpCompositeExtract %float %44 0 + %47 = OpCompositeExtract %float %44 1 + %48 = OpCompositeExtract %float %44 2 + %49 = OpCompositeConstruct %v4float %46 %47 %48 %float_1 + %50 = OpMatrixTimesVector %v4float %43 %49 + %51 = OpAccessChain %_ptr_Function_v4float %v2f %int_0 + OpStore %51 %50 + %52 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + %53 = OpLoad %v4float %52 + %54 = OpAccessChain %_ptr_Function_v4float %v2f %int_1 + OpStore %54 %53 + %55 = OpLoad %V2F %v2f + OpReturnValue %55 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/fake-builtin-input.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/fake-builtin-input.asm.vert new file mode 100644 index 0000000000..4de1d1945c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/fake-builtin-input.asm.vert @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageInputOutput16 + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertexShader "main" %in_var_POSITION %gl_Position %gl_FragCoord %out_var_SV_Target + OpEntryPoint Fragment %fragmentShader "fragmentShader" %in_var_POSITION %gl_Position %gl_FragCoord %out_var_SV_Target + OpExecutionMode %fragmentShader OriginUpperLeft + OpSource HLSL 640 + OpName %in_var_POSITION "in.var.POSITION" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %vertexShader "vertexShader" + OpName %fragmentShader "fragmentShader" + OpDecorate %gl_Position BuiltIn Position + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %in_var_POSITION Location 0 + OpDecorate %out_var_SV_Target Location 0 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %half = OpTypeFloat 16 +%half_0x1p_0 = OpConstant %half 0x1p+0 +%half_0x0p_0 = OpConstant %half 0x0p+0 + %v4half = OpTypeVector %half 4 + %14 = OpConstantComposite %v4half %half_0x1p_0 %half_0x0p_0 %half_0x1p_0 %half_0x1p_0 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4half = OpTypePointer Output %v4half + %void = OpTypeVoid + %22 = OpTypeFunction %void +%in_var_POSITION = OpVariable %_ptr_Input_v2float Input +%gl_Position = OpVariable %_ptr_Output_v4float Output +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4half Output +%vertexShader = OpFunction %void None %22 + %23 = OpLabel + %24 = OpLoad %v2float %in_var_POSITION + %25 = OpCompositeExtract %float %24 0 + %26 = OpCompositeExtract %float %24 1 + %27 = OpCompositeConstruct %v4float %25 %26 %float_0 %float_1 + OpStore %gl_Position %27 + OpReturn + OpFunctionEnd +%fragmentShader = OpFunction %void None %22 + %28 = OpLabel + OpStore %out_var_SV_Target %14 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/invariant.msl21.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/invariant.msl21.asm.vert new file mode 100644 index 0000000000..c0d381ee23 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/invariant.msl21.asm.vert @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 18 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_entryPointOutput Invariant + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %17 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + OpReturnValue %12 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert new file mode 100644 index 0000000000..429d3e4127 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool-to-uint.asm.vert @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 62 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %gl_VertexIndex %a_position + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %Struct "Struct" + OpMemberName %Struct 0 "flags" + OpName %defaultUniformsVS "defaultUniformsVS" + OpMemberName %defaultUniformsVS 0 "flags" + OpMemberName %defaultUniformsVS 1 "uquad" + OpMemberName %defaultUniformsVS 2 "umatrix" + OpName %__0 "" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %a_position "a_position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %_arr_uint_uint_1 ArrayStride 16 + OpMemberDecorate %Struct 0 Offset 0 + OpDecorate %_arr_v2float_uint_4 ArrayStride 16 + OpMemberDecorate %defaultUniformsVS 0 Offset 0 + OpMemberDecorate %defaultUniformsVS 1 Offset 16 + OpMemberDecorate %defaultUniformsVS 2 ColMajor + OpMemberDecorate %defaultUniformsVS 2 Offset 80 + OpMemberDecorate %defaultUniformsVS 2 MatrixStride 16 + OpDecorate %defaultUniformsVS Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %a_position Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %Struct = OpTypeStruct %_arr_uint_uint_1 + %v2float = OpTypeVector %float 2 + %uint_4 = OpConstant %uint 4 +%_arr_v2float_uint_4 = OpTypeArray %v2float %uint_4 +%mat4v4float = OpTypeMatrix %v4float 4 +%defaultUniformsVS = OpTypeStruct %Struct %_arr_v2float_uint_4 %mat4v4float +%_ptr_Uniform_defaultUniformsVS = OpTypePointer Uniform %defaultUniformsVS + %__0 = OpVariable %_ptr_Uniform_defaultUniformsVS Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float + %int_1 = OpConstant %int 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %a_position = OpVariable %_ptr_Input_v4float Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_float = OpTypePointer Input %float + %uint_3 = OpConstant %uint 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %27 = OpAccessChain %_ptr_Uniform_mat4v4float %__0 %int_2 + %28 = OpLoad %mat4v4float %27 + %32 = OpLoad %int %gl_VertexIndex + %34 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_1 %32 + %35 = OpLoad %v2float %34 + %40 = OpAccessChain %_ptr_Input_float %a_position %uint_2 + %41 = OpLoad %float %40 + %43 = OpAccessChain %_ptr_Input_float %a_position %uint_3 + %44 = OpLoad %float %43 + %45 = OpCompositeExtract %float %35 0 + %46 = OpCompositeExtract %float %35 1 + %47 = OpCompositeConstruct %v4float %45 %46 %41 %44 + %48 = OpMatrixTimesVector %v4float %28 %47 + %50 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %50 %48 + %52 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %int_0 %int_0 + %53 = OpLoad %uint %52 + %56 = OpINotEqual %bool %53 %uint_0 + OpSelectionMerge %58 None + OpBranchConditional %56 %57 %58 + %57 = OpLabel + %61 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_2 + OpStore %61 %float_0 + OpBranch %58 + %58 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert new file mode 100644 index 0000000000..8448265c1d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/packed-bool2-to-packed_uint2.asm.vert @@ -0,0 +1,113 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 64 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %gl_VertexIndex %a_position + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %Struct "Struct" + OpMemberName %Struct 0 "flags" + OpName %defaultUniformsVS "defaultUniformsVS" + OpMemberName %defaultUniformsVS 0 "flags" + OpMemberName %defaultUniformsVS 1 "uquad" + OpMemberName %defaultUniformsVS 2 "umatrix" + OpName %__0 "" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %a_position "a_position" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %_arr_v2uint_uint_1 ArrayStride 16 + OpMemberDecorate %Struct 0 Offset 0 + OpDecorate %_arr_v2float_uint_4 ArrayStride 16 + OpMemberDecorate %defaultUniformsVS 0 Offset 0 + OpMemberDecorate %defaultUniformsVS 1 Offset 16 + OpMemberDecorate %defaultUniformsVS 2 ColMajor + OpMemberDecorate %defaultUniformsVS 2 Offset 80 + OpMemberDecorate %defaultUniformsVS 2 MatrixStride 16 + OpDecorate %defaultUniformsVS Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %a_position Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %v2uint = OpTypeVector %uint 2 +%_arr_v2uint_uint_1 = OpTypeArray %v2uint %uint_1 + %Struct = OpTypeStruct %_arr_v2uint_uint_1 + %v2float = OpTypeVector %float 2 + %uint_4 = OpConstant %uint 4 +%_arr_v2float_uint_4 = OpTypeArray %v2float %uint_4 +%mat4v4float = OpTypeMatrix %v4float 4 +%defaultUniformsVS = OpTypeStruct %Struct %_arr_v2float_uint_4 %mat4v4float +%_ptr_Uniform_defaultUniformsVS = OpTypePointer Uniform %defaultUniformsVS + %__0 = OpVariable %_ptr_Uniform_defaultUniformsVS Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float + %int_1 = OpConstant %int 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %a_position = OpVariable %_ptr_Input_v4float Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_float = OpTypePointer Input %float + %uint_3 = OpConstant %uint 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %float_0 = OpConstant %float 0 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %28 = OpAccessChain %_ptr_Uniform_mat4v4float %__0 %int_2 + %29 = OpLoad %mat4v4float %28 + %33 = OpLoad %int %gl_VertexIndex + %35 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_1 %33 + %36 = OpLoad %v2float %35 + %41 = OpAccessChain %_ptr_Input_float %a_position %uint_2 + %42 = OpLoad %float %41 + %44 = OpAccessChain %_ptr_Input_float %a_position %uint_3 + %45 = OpLoad %float %44 + %46 = OpCompositeExtract %float %36 0 + %47 = OpCompositeExtract %float %36 1 + %48 = OpCompositeConstruct %v4float %46 %47 %42 %45 + %49 = OpMatrixTimesVector %v4float %29 %48 + %51 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %51 %49 + %56 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %int_0 %int_0 %uint_0 + %57 = OpLoad %uint %56 + %58 = OpINotEqual %bool %57 %uint_0 + OpSelectionMerge %60 None + OpBranchConditional %58 %59 %60 + %59 = OpLabel + %63 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_2 + OpStore %63 %float_0 + OpBranch %60 + %60 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/packing-test.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/packing-test.asm.vert new file mode 100644 index 0000000000..8acdebc7d3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/packing-test.asm.vert @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 18 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource HLSL 500 + OpName %main "main" + OpName %TestStruct "TestStruct" + OpMemberName %TestStruct 0 "transforms" + OpName %CB0 "CB0" + OpMemberName %CB0 0 "CB0" + OpName %_ "" + OpDecorate %_arr_mat4v4float_uint_6 ArrayStride 64 + OpMemberDecorate %TestStruct 0 RowMajor + OpMemberDecorate %TestStruct 0 Offset 0 + OpMemberDecorate %TestStruct 0 MatrixStride 16 + OpDecorate %_arr_TestStruct_uint_16 ArrayStride 384 + OpMemberDecorate %CB0 0 Offset 0 + OpDecorate %CB0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 +%_arr_mat4v4float_uint_6 = OpTypeArray %mat4v4float %uint_6 + %TestStruct = OpTypeStruct %_arr_mat4v4float_uint_6 + %uint_16 = OpConstant %uint 16 +%_arr_TestStruct_uint_16 = OpTypeArray %TestStruct %uint_16 + %CB0 = OpTypeStruct %_arr_TestStruct_uint_16 +%_ptr_Uniform_CB0 = OpTypePointer Uniform %CB0 + %_ = OpVariable %_ptr_Uniform_CB0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert new file mode 100644 index 0000000000..64f6c92ce9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability ClipDistance + OpCapability CullDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %52 %output + OpSource GLSL 450 + OpName %4 "main" + OpName %9 "pos" + OpName %50 "gl_PerVertex" + OpMemberName %50 0 "gl_Position" + OpMemberName %50 1 "gl_PointSize" + OpMemberName %50 2 "gl_ClipDistance" + OpMemberName %50 3 "gl_CullDistance" + OpName %52 "" + OpDecorate %13 SpecId 201 + OpDecorate %24 SpecId 202 + OpMemberDecorate %50 0 BuiltIn Position + OpMemberDecorate %50 1 BuiltIn PointSize + OpMemberDecorate %50 2 BuiltIn ClipDistance + OpMemberDecorate %50 3 BuiltIn CullDistance + OpDecorate %50 Block + OpDecorate %57 SpecId 200 + OpDecorate %output Flat + OpDecorate %output Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %int_ptr = OpTypePointer Output %12 + %13 = OpSpecConstant %12 -10 + %14 = OpConstant %12 2 + %15 = OpSpecConstantOp %12 IAdd %13 %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Function %6 + %24 = OpSpecConstant %17 100 + %25 = OpConstant %17 5 + %26 = OpSpecConstantOp %17 UMod %24 %25 + %28 = OpConstant %17 2 + %33 = OpConstant %12 20 + %34 = OpConstant %12 30 + %int_3 = OpConstant %12 -3 + %bar = OpSpecConstantOp %12 SRem %13 %int_3 + %35 = OpTypeVector %12 4 + %36 = OpSpecConstantComposite %35 %33 %34 %15 %bar + %40 = OpTypeVector %12 2 + %41 = OpSpecConstantOp %40 VectorShuffle %36 %36 1 0 + %foo = OpSpecConstantOp %12 CompositeExtract %36 1 + %42 = OpTypeVector %6 2 + %49 = OpTypeArray %6 %18 + %50 = OpTypeStruct %7 %6 %49 %49 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %output = OpVariable %int_ptr Output + %53 = OpConstant %12 0 + %55 = OpTypePointer Output %7 + %57 = OpSpecConstant %6 3.14159 + %baz = OpSpecConstantOp %6 QuantizeToF16 %57 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + OpStore %9 %11 + %16 = OpConvertSToF %6 %15 + %20 = OpAccessChain %19 %9 %18 + %21 = OpLoad %6 %20 + %22 = OpFAdd %6 %21 %16 + %23 = OpAccessChain %19 %9 %18 + OpStore %23 %22 + %27 = OpConvertUToF %6 %26 + %29 = OpAccessChain %19 %9 %28 + %30 = OpLoad %6 %29 + %31 = OpFAdd %6 %30 %27 + %32 = OpAccessChain %19 %9 %28 + OpStore %32 %31 + %37 = OpConvertSToF %7 %36 + %38 = OpLoad %7 %9 + %39 = OpFAdd %7 %38 %37 + OpStore %9 %39 + %43 = OpConvertSToF %42 %41 + %44 = OpLoad %7 %9 + %45 = OpVectorShuffle %42 %44 %44 0 1 + %46 = OpFAdd %42 %45 %43 + %47 = OpLoad %7 %9 + %48 = OpVectorShuffle %7 %47 %46 4 5 2 3 + OpStore %9 %48 + %54 = OpLoad %7 %9 + %56 = OpAccessChain %55 %52 %53 + OpStore %56 %54 + OpStore %output %foo + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..29b0076a1e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %vid_1 %iid_1 %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_u1_u1_ "@main(u1;u1;" + OpName %vid "vid" + OpName %iid "iid" + OpName %vid_0 "vid" + OpName %vid_1 "vid" + OpName %iid_0 "iid" + OpName %iid_1 "iid" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %vid_1 BuiltIn VertexIndex + OpDecorate %iid_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_uint %_ptr_Function_uint +%_ptr_Input_uint = OpTypePointer Input %uint + %vid_1 = OpVariable %_ptr_Input_uint Input + %iid_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %vid_0 = OpVariable %_ptr_Function_uint Function + %iid_0 = OpVariable %_ptr_Function_uint Function + %param = OpVariable %_ptr_Function_uint Function + %param_0 = OpVariable %_ptr_Function_uint Function + %25 = OpLoad %uint %vid_1 + OpStore %vid_0 %25 + %28 = OpLoad %uint %iid_1 + OpStore %iid_0 %28 + %32 = OpLoad %uint %vid_0 + OpStore %param %32 + %34 = OpLoad %uint %iid_0 + OpStore %param_0 %34 + %35 = OpFunctionCall %v4float %_main_u1_u1_ %param %param_0 + OpStore %_entryPointOutput %35 + OpReturn + OpFunctionEnd +%_main_u1_u1_ = OpFunction %v4float None %10 + %vid = OpFunctionParameter %_ptr_Function_uint + %iid = OpFunctionParameter %_ptr_Function_uint + %14 = OpLabel + %15 = OpLoad %uint %vid + %16 = OpLoad %uint %iid + %17 = OpIAdd %uint %15 %16 + %18 = OpConvertUToF %float %17 + %19 = OpCompositeConstruct %v4float %18 %18 %18 %18 + OpReturnValue %19 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/comp/access-private-workgroup-in-function.comp b/third_party/spirv-cross/shaders-msl/comp/access-private-workgroup-in-function.comp new file mode 100644 index 0000000000..7cb1e6f131 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/access-private-workgroup-in-function.comp @@ -0,0 +1,31 @@ +#version 450 +layout(local_size_x = 1) in; + +int f; +shared int u; + +void set_f() +{ + f = 40; +} + +void set_shared_u() +{ + u = 50; +} + +void main() +{ + set_f(); + set_shared_u(); + if (gl_LocalInvocationIndex == 0u) + { + f = 10; + } + else + { + f = 30; + u = 20; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp new file mode 100644 index 0000000000..883f0019fe --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-discrete.msl2.argument.discrete.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) readonly buffer SSBO0 +{ + vec4 v; +} ssbo0; + +layout(set = 1, binding = 0) readonly buffer SSBO1 +{ + vec4 v; +} ssbo1; + +layout(set = 2, binding = 5) readonly buffer SSBO2 +{ + vec4 v; +} ssbo2; + +layout(set = 3, binding = 6) writeonly buffer SSBO3 +{ + vec4 v; +} ssbo3; + +void main() +{ + ssbo3.v = ssbo0.v + ssbo1.v + ssbo2.v; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp new file mode 100644 index 0000000000..72ca8899ad --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.ios.msl2.argument.comp @@ -0,0 +1,10 @@ +#version 450 + +layout(set = 0, binding = 1, r32f) writeonly uniform image2D uImage; +layout(set = 0, binding = 2, r32f) readonly uniform image2D uImageRead; + +void main() +{ + ivec2 coord = ivec2(gl_GlobalInvocationID.xy); + imageStore(uImage, coord, imageLoad(uImageRead, coord)); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp new file mode 100644 index 0000000000..72ca8899ad --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/argument-buffers-image-load-store.msl2.argument.comp @@ -0,0 +1,10 @@ +#version 450 + +layout(set = 0, binding = 1, r32f) writeonly uniform image2D uImage; +layout(set = 0, binding = 2, r32f) readonly uniform image2D uImageRead; + +void main() +{ + ivec2 coord = ivec2(gl_GlobalInvocationID.xy); + imageStore(uImage, coord, imageLoad(uImageRead, coord)); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/array-length.comp b/third_party/spirv-cross/shaders-msl/comp/array-length.comp new file mode 100644 index 0000000000..6189d35602 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/array-length.comp @@ -0,0 +1,22 @@ +#version 450 +layout(local_size_x = 1) in; +layout(set = 0, binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +}; + +layout(set = 0, binding = 2, std430) buffer SSBO1 +{ + float bz[]; +} ssbos[2]; + +uint get_size() +{ + return v.length() + ssbos[1].bz.length(); +} + +void main() +{ + size = get_size(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/array-length.msl2.argument.discrete.comp b/third_party/spirv-cross/shaders-msl/comp/array-length.msl2.argument.discrete.comp new file mode 100644 index 0000000000..61e61916bf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/array-length.msl2.argument.discrete.comp @@ -0,0 +1,38 @@ +#version 450 +layout(local_size_x = 1) in; +layout(set = 0, binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +}; + +layout(set = 1, binding = 2, std430) buffer SSBO1 +{ + float bz[]; +} ssbos[2]; + +layout(set = 2, binding = 5, std140) buffer SSBO2 +{ + uint size2; + float w[]; +}; + +layout(set = 3, binding = 2, std430) buffer SSBO3 +{ + float bz[]; +} ssbos2[2]; + + +uint get_size() +{ + uint len = v.length(); + len += ssbos[1].bz.length(); + len += w.length(); + len += ssbos2[0].bz.length(); + return len; +} + +void main() +{ + size = get_size(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/atomic-float.msl3.comp b/third_party/spirv-cross/shaders-msl/comp/atomic-float.msl3.comp new file mode 100644 index 0000000000..4391e4754a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/atomic-float.msl3.comp @@ -0,0 +1,15 @@ +#version 450 +#extension GL_EXT_shader_atomic_float : require +layout(local_size_x = 1) in; + +layout(binding = 2, std430) buffer SSBO +{ + float f32; +} ssbo; + +void main() +{ + // note: only works on ssbo targets + atomicAdd(ssbo.f32, 1.0); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/atomic.comp b/third_party/spirv-cross/shaders-msl/comp/atomic.comp new file mode 100644 index 0000000000..e25c4f6d24 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/atomic.comp @@ -0,0 +1,56 @@ +#version 310 es +#extension GL_OES_shader_image_atomic : require +layout(local_size_x = 1) in; + +layout(r32ui, binding = 0) uniform highp uimage2D uImage; +layout(r32i, binding = 1) uniform highp iimage2D iImage; +layout(binding = 2, std430) buffer SSBO +{ + uint u32; + int i32; +} ssbo; + +shared uint shared_u32; +shared int shared_i32; + +void main() +{ + atomicAdd(ssbo.u32, 1u); + atomicOr(ssbo.u32, 1u); + atomicXor(ssbo.u32, 1u); + atomicAnd(ssbo.u32, 1u); + atomicMin(ssbo.u32, 1u); + atomicMax(ssbo.u32, 1u); + atomicExchange(ssbo.u32, 1u); + atomicCompSwap(ssbo.u32, 10u, 2u); + + atomicAdd(ssbo.i32, 1); + atomicOr(ssbo.i32, 1); + atomicXor(ssbo.i32, 1); + atomicAnd(ssbo.i32, 1); + atomicMin(ssbo.i32, 1); + atomicMax(ssbo.i32, 1); + atomicExchange(ssbo.i32, 1); + atomicCompSwap(ssbo.i32, 10, 2); + + shared_u32 = 10u; + shared_i32 = 10; + atomicAdd(shared_u32, 1u); + atomicOr(shared_u32, 1u); + atomicXor(shared_u32, 1u); + atomicAnd(shared_u32, 1u); + atomicMin(shared_u32, 1u); + atomicMax(shared_u32, 1u); + atomicExchange(shared_u32, 1u); + atomicCompSwap(shared_u32, 10u, 2u); + + atomicAdd(shared_i32, 1); + atomicOr(shared_i32, 1); + atomicXor(shared_i32, 1); + atomicAnd(shared_i32, 1); + atomicMin(shared_i32, 1); + atomicMax(shared_i32, 1); + atomicExchange(shared_i32, 1); + atomicCompSwap(shared_i32, 10, 2); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/barriers.comp b/third_party/spirv-cross/shaders-msl/comp/barriers.comp new file mode 100644 index 0000000000..7e0ea42d4e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/barriers.comp @@ -0,0 +1,79 @@ +#version 310 es +layout(local_size_x = 4) in; + +void barrier_shared() +{ + memoryBarrierShared(); +} + +void full_barrier() +{ + memoryBarrier(); +} + +void image_barrier() +{ + memoryBarrierImage(); +} + +void buffer_barrier() +{ + memoryBarrierBuffer(); +} + +void group_barrier() +{ + groupMemoryBarrier(); +} + +void barrier_shared_exec() +{ + memoryBarrierShared(); + barrier(); +} + +void full_barrier_exec() +{ + memoryBarrier(); + barrier(); +} + +void image_barrier_exec() +{ + memoryBarrierImage(); + barrier(); +} + +void buffer_barrier_exec() +{ + memoryBarrierBuffer(); + barrier(); +} + +void group_barrier_exec() +{ + groupMemoryBarrier(); + barrier(); +} + +void exec_barrier() +{ + barrier(); +} + +void main() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + + exec_barrier(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/basic.comp b/third_party/spirv-cross/shaders-msl/comp/basic.comp new file mode 100644 index 0000000000..f9bf55670f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/basic.comp @@ -0,0 +1,28 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint counter; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idata = in_data[ident]; + if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.2) + { + out_data[atomicAdd(counter, 1u)] = idata; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.comp b/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.comp new file mode 100644 index 0000000000..2c873468cc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x_id = 10) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint counter; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + uint workgroup = gl_WorkGroupID.x; + vec4 idata = in_data[ident]; + if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.2) + { + out_data[atomicAdd(counter, 1u)] = idata; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.msl11.comp b/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.msl11.comp new file mode 100644 index 0000000000..91453332aa --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/basic.dispatchbase.msl11.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint counter; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + uint workgroup = gl_WorkGroupID.x; + vec4 idata = in_data[ident]; + if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.2) + { + out_data[atomicAdd(counter, 1u)] = idata; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/basic.inline-block.msl2.comp b/third_party/spirv-cross/shaders-msl/comp/basic.inline-block.msl2.comp new file mode 100644 index 0000000000..8e1144a98e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/basic.inline-block.msl2.comp @@ -0,0 +1,37 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require +layout(local_size_x = 3, local_size_y = 3, local_size_z = 2) in; + +struct X +{ + int x; + int y; + float z; +}; + +layout(set = 0, binding = 0, scalar) uniform Foo +{ + int a; + int b; + mat4 c; + X x[2]; +}; + +layout(set = 0, binding = 1) uniform Bar +{ + int d; + int e; +}; + +layout(set = 1, binding = 2) buffer Baz +{ + int f; + int g; +} baz[3]; + +void main() +{ + uvec3 coords = gl_GlobalInvocationID; + baz[coords.x].f = a + d; + baz[coords.x].g = b * e; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp new file mode 100644 index 0000000000..9212e04c1a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-packed-vec-and-cast-to-and-from-uvec2.msl23.comp @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require + +layout(buffer_reference, buffer_reference_align = 4) buffer SSBO +{ + vec3 a1; // Will be 12-byte packed + float a2; +}; + +layout(push_constant) uniform UBO +{ + uvec2 b; +}; + +void main() +{ + SSBO(b).a1 = vec3(1.0, 2.0, 3.0); // uvec2 -> buff ref and assign to packed + uvec2 v2 = uvec2(SSBO(b + 32)); // uvec2 -> buff ref -> uvec2 + vec3 v3 = SSBO(v2).a1; // uvec2 -> buff ref and assign from packed + SSBO(v2).a1 = v3 + 1.0; // uvec2 -> buff ref and assign to packed +} diff --git a/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp new file mode 100644 index 0000000000..2bb19eedad --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address-recursive-struct-pointers.msl23.comp @@ -0,0 +1,64 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(buffer_reference) buffer t21; +layout(buffer_reference, buffer_reference_align = 16, std140) buffer t21 +{ + int m0[2]; + int m1; + layout(row_major) t21 m2[2]; + layout(row_major) t21 m3; + layout(row_major) mat2 m4; +}; + +layout(set = 0, binding = 1, std140) uniform t24 +{ + int m0[2]; + int m1; + layout(row_major) t21 m2[2]; + layout(row_major) t21 m3; + layout(row_major) mat2 m4; +} u24; + +layout(push_constant, std430) uniform t35 +{ + int m0[32]; +} u35; + +layout(set = 0, binding = 0, r32ui) uniform writeonly uimage2D v295; + +void main() +{ + int v8 = 0; + v8 |= (u24.m0[0] - 0); + v8 |= (u24.m0[u35.m0[1]] - 1); + v8 |= (u24.m1 - 2); + v8 |= int(u24.m4[0].x - 3.0); + v8 |= int(u24.m4[0].y - 5.0); + v8 |= int(u24.m4[1].x - 4.0); + v8 |= int(u24.m4[1].y - 6.0); + v8 |= (u24.m2[0].m0[0] - 3); + v8 |= (u24.m2[0].m0[u35.m0[1]] - 4); + v8 |= (u24.m2[0].m1 - 5); + v8 |= int(u24.m2[0].m4[0].x - 6.0); + v8 |= int(u24.m2[0].m4[0].y - 8.0); + v8 |= int(u24.m2[0].m4[1].x - 7.0); + v8 |= int(u24.m2[0].m4[1].y - 9.0); + v8 |= (u24.m2[u35.m0[1]].m0[0] - 6); + v8 |= (u24.m2[u35.m0[1]].m0[u35.m0[1]] - 7); + v8 |= (u24.m2[u35.m0[1]].m1 - 8); + v8 |= int(u24.m2[u35.m0[1]].m4[0].x - 9.0); + v8 |= int(u24.m2[u35.m0[1]].m4[0].y - 11.0); + v8 |= int(u24.m2[u35.m0[1]].m4[1].x - 10.0); + v8 |= int(u24.m2[u35.m0[1]].m4[1].y - 12.0); + v8 |= (u24.m3.m0[0] - 9); + v8 |= (u24.m3.m0[u35.m0[1]] - 10); + v8 |= (u24.m3.m1 - 11); + v8 |= int(u24.m3.m4[0].x - 12.0); + v8 |= int(u24.m3.m4[0].y - 14.0); + v8 |= int(u24.m3.m4[1].x - 13.0); + v8 |= int(u24.m3.m4[1].y - 15.0); + uvec4 v284 = mix(uvec4(1u, 0u, 0u, 1u), uvec4(0u), bvec4(v8 != 0)); + imageStore(v295, ivec2(gl_GlobalInvocationID.xy), v284); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/buffer_device_address.msl2.comp b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address.msl2.comp new file mode 100644 index 0000000000..14ac1ef9dc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/buffer_device_address.msl2.comp @@ -0,0 +1,86 @@ +/* Copyright (c) 2021, Arm Limited and Contributors + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 the "License"; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#version 450 + +// Allows buffer_reference. +#extension GL_EXT_buffer_reference : require + +layout(local_size_x = 8, local_size_y = 8) in; + +// If we mark a buffer as buffer_reference, this is treated as a pointer type. +// A variable with the type Position is a 64-bit pointer to the data within. +// We can freely cast between pointer types if we wish, but that is not necessary in this sample. +// buffer_reference_align is used to let the underlying implementation know which alignment to expect. +// The pointer can have scalar alignment, which is something the compiler cannot know unless you tell it. +// It is best to use vector alignment when you can for optimal performance, but scalar alignment is sometimes useful. +// With SSBOs, the API has a minimum offset alignment which guarantees a minimum level of alignment from API side. + +// It is possible to forward reference a pointer, so you can contain a pointer to yourself inside a struct. +// Useful if you need something like a linked list on the GPU. +// Here it's not particularly useful, but something to know about. +layout(buffer_reference) buffer Position; + +layout(std430, buffer_reference, buffer_reference_align = 8) writeonly buffer Position +{ + vec2 positions[]; +}; + +layout(std430, buffer_reference, buffer_reference_align = 8) readonly buffer PositionReferences +{ + // This buffer contains an array of pointers to other buffers. + Position buffers[]; +}; + +// In push constant we place a pointer to VBO pointers, spicy! +// This way we don't need any descriptor sets, but there's nothing wrong with combining use of descriptor sets and buffer device addresses. +// It is mostly done for convenience here. +layout(push_constant) uniform Registers +{ + PositionReferences references; + // A buffer reference is 64-bit, so offset of fract_time is 8 bytes. + float fract_time; +} registers; + +void main() +{ + // Every slice is a 8x8 grid of vertices which we update here in compute. + uvec2 local_offset = gl_GlobalInvocationID.xy; + uint local_index = local_offset.y * gl_WorkGroupSize.x * gl_NumWorkGroups.x + local_offset.x; + uint slice = gl_WorkGroupID.z; + + restrict Position positions = registers.references.buffers[slice]; + + // This is a trivial wave-like function. Arbitrary for demonstration purposes. + const float TWO_PI = 3.1415628 * 2.0; + float offset = TWO_PI * fract(registers.fract_time + float(slice) * 0.1); + + // Simple grid. + vec2 pos = vec2(local_offset); + + // Wobble, wobble. + pos.x += 0.2 * sin(2.2 * pos.x + offset); + pos.y += 0.2 * sin(2.25 * pos.y + 2.0 * offset); + pos.x += 0.2 * cos(1.8 * pos.y + 3.0 * offset); + pos.y += 0.2 * cos(2.85 * pos.x + 4.0 * offset); + pos.x += 0.5 * sin(offset); + pos.y += 0.5 * sin(offset + 0.3); + + // Center the mesh in [-0.5, 0.5] range. + // Here we write to a raw pointer. + // Be aware, there is no robustness support for buffer_device_address since we don't have a complete descriptor! + positions.positions[local_index] = pos / (vec2(gl_WorkGroupSize.xy) * vec2(gl_NumWorkGroups.xy) - 1.0) - 0.5; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/builtins.comp b/third_party/spirv-cross/shaders-msl/comp/builtins.comp new file mode 100644 index 0000000000..88bb5951e4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/builtins.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 8, local_size_y = 4, local_size_z = 2) in; + +void main() +{ + uvec3 local_id = gl_LocalInvocationID; + uvec3 global_id = gl_GlobalInvocationID; + uint local_index = gl_LocalInvocationIndex; + uvec3 work_group_size = gl_WorkGroupSize; + uvec3 num_work_groups = gl_NumWorkGroups; + uvec3 work_group_id = gl_WorkGroupID; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/shaders-msl/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..9ef9092005 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/cfg-preserve-parameter.comp @@ -0,0 +1,54 @@ +#version 310 es + +// We write in all paths (and no reads), so should just be out. +void out_test_0(int cond, inout int i) +{ + if (cond == 0) + i = 40; + else + i = 60; +} + +// We write in all paths (and no reads), so should just be out. +void out_test_1(int cond, inout int i) +{ + switch (cond) + { + case 40: + i = 40; + break; + + default: + i = 70; + break; + } +} + +// We don't write in all paths, so should be inout. +void inout_test_0(int cond, inout int i) +{ + if (cond == 0) + i = 40; +} + +void inout_test_1(int cond, inout int i) +{ + switch (cond) + { + case 40: + i = 40; + break; + } +} + + +void main() +{ + int cond = 40; + int i = 50; + + out_test_0(cond, i); + out_test_1(cond, i); + inout_test_0(cond, i); + inout_test_1(cond, i); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/coherent-block.comp b/third_party/spirv-cross/shaders-msl/comp/coherent-block.comp new file mode 100644 index 0000000000..0a174e8ef0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/coherent-block.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 1) coherent restrict writeonly buffer SSBO +{ + vec4 value; +}; + +void main() +{ + value = vec4(20.0); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/coherent-image.comp b/third_party/spirv-cross/shaders-msl/comp/coherent-image.comp new file mode 100644 index 0000000000..fd6e280182 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/coherent-image.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 1) coherent restrict writeonly buffer SSBO +{ + ivec4 value; +}; + +layout(r32i, binding = 3) coherent readonly restrict uniform mediump iimage2D uImage; + +void main() +{ + value = imageLoad(uImage, ivec2(10)); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/complex-composite-constant-array.comp b/third_party/spirv-cross/shaders-msl/comp/complex-composite-constant-array.comp new file mode 100644 index 0000000000..96a3f8951d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/complex-composite-constant-array.comp @@ -0,0 +1,19 @@ +#version 450 + +layout(std430, set = 0, binding = 0) buffer SSBO +{ + mat4 a; + uint index; +}; + +const mat4 as[] = mat4[](mat4(1.0), mat4(2.0)); + +void write_global() +{ + a = as[index]; +} + +void main() +{ + write_global(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/complex-type-alias.comp b/third_party/spirv-cross/shaders-msl/comp/complex-type-alias.comp new file mode 100644 index 0000000000..4b9b6eddb9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/complex-type-alias.comp @@ -0,0 +1,41 @@ +#version 450 +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +struct Foo0 +{ + float a; +}; + +struct Foo1 +{ + Foo0 a; +}; + +void Zero(out Foo0 v) +{ + v.a = 0.0; +} + +struct Foo2 +{ + Foo1 a; + float weight; +}; + +layout(std430, binding = 0) buffer SSBO +{ + Foo2 outputs[]; +}; + +shared Foo2 coeffs[64]; + +void main() +{ + Foo2 data; + data.weight = 0.0; + Zero(data.a.a); + coeffs[gl_LocalInvocationIndex] = data; + barrier(); + if (gl_LocalInvocationIndex == 0u) + outputs[gl_WorkGroupID.x] = coeffs[0]; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.comp b/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..1ecf4bcd40 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.comp @@ -0,0 +1,28 @@ +#version 450 +layout(local_size_x = 2) in; + +struct Data +{ + float a; + float b; +}; + +layout(std430, binding = 0) buffer SSBO +{ + Data outdata[]; +}; + +layout(constant_id = 0) const float X = 4.0; + +Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); +Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); + +Data combine(Data a, Data b) +{ + return Data(a.a + b.a, a.b + b.b); +} + +void main() +{ + outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.force-native-array.comp b/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.force-native-array.comp new file mode 100644 index 0000000000..1ecf4bcd40 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/composite-array-initialization.force-native-array.comp @@ -0,0 +1,28 @@ +#version 450 +layout(local_size_x = 2) in; + +struct Data +{ + float a; + float b; +}; + +layout(std430, binding = 0) buffer SSBO +{ + Data outdata[]; +}; + +layout(constant_id = 0) const float X = 4.0; + +Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); +Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); + +Data combine(Data a, Data b) +{ + return Data(a.a + b.a, a.b + b.b); +} + +void main() +{ + outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/composite-construct.comp b/third_party/spirv-cross/shaders-msl/comp/composite-construct.comp new file mode 100644 index 0000000000..3054775325 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/composite-construct.comp @@ -0,0 +1,31 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO0 +{ + vec4 as[]; +}; + +layout(std430, binding = 1) buffer SSBO1 +{ + vec4 bs[]; +}; + +struct Composite +{ + vec4 a; + vec4 b; +}; + +const vec4 const_values[2] = vec4[](vec4(20.0), vec4(40.0)); + +void main() +{ + vec4 values[2] = vec4[](as[gl_GlobalInvocationID.x], bs[gl_GlobalInvocationID.x]); + vec4 copy_values[2]; + copy_values = const_values; + Composite c = Composite(values[0], copy_values[1]); + + as[0] = values[gl_LocalInvocationIndex]; + bs[1] = c.b; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.comp b/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.comp new file mode 100644 index 0000000000..edf87195b8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, std430) buffer BUF +{ + int a; + float b; + float c; +} o; + +void main() +{ + const float a[2][2][2] = float[][][](float[][](float[](1.0, 2.0), float[](3.0, 4.0)), float[][](float[](1.0, 2.0), float[](3.0, 4.0))); + float b[2][2][2] = a; + float c[2][2][2] = b; + o.a = int(c[1][1][1]); + + float d[2][2][2] = float[][][](float[][](float[](o.b, o.c), float[](o.b, o.b)), float[][](float[](o.c, o.c), float[](o.c, o.b))); + float e[2][2][2] = d; + o.b = e[1][0][1]; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp b/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp new file mode 100644 index 0000000000..edf87195b8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/copy-array-of-arrays.force-native-array.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, std430) buffer BUF +{ + int a; + float b; + float c; +} o; + +void main() +{ + const float a[2][2][2] = float[][][](float[][](float[](1.0, 2.0), float[](3.0, 4.0)), float[][](float[](1.0, 2.0), float[](3.0, 4.0))); + float b[2][2][2] = a; + float c[2][2][2] = b; + o.a = int(c[1][1][1]); + + float d[2][2][2] = float[][][](float[][](float[](o.b, o.c), float[](o.b, o.b)), float[][](float[](o.c, o.c), float[](o.c, o.b))); + float e[2][2][2] = d; + o.b = e[1][0][1]; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/culling.comp b/third_party/spirv-cross/shaders-msl/comp/culling.comp new file mode 100644 index 0000000000..9f8331b10b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/culling.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 4) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + float in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + float out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint count; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = in_data[ident]; + if (idata > 12.0) + out_data[atomicAdd(count, 1u)] = idata; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/defer-parens.comp b/third_party/spirv-cross/shaders-msl/comp/defer-parens.comp new file mode 100644 index 0000000000..4e8ea6b399 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/defer-parens.comp @@ -0,0 +1,30 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data; + int index; +}; + +void main() +{ + // Tests defer-parens behavior where a binary expression is OpCompositeExtracted chained together + // with an OpCompositeConstruct optimization. + vec4 d = data; + data = vec4(d.x, d.yz + 10.0, d.w); + + // Verify binary ops. + data = d + d + d; + + // Verify swizzles. + data = (d.yz + 10.0).xxyy; + + // OpCompositeExtract + float t = (d.yz + 10.0).y; + data = vec4(t); + + // OpVectorExtractDynamic + t = (d.zw + 10.0)[index]; + data = vec4(t); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/dowhile.comp b/third_party/spirv-cross/shaders-msl/comp/dowhile.comp new file mode 100644 index 0000000000..709db75a17 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/dowhile.comp @@ -0,0 +1,31 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +int i; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + + i = 0; + vec4 idat = in_data[ident]; + do + { + idat = mvp * idat; + i++; + } while(i < 16); + + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/force-recompile-hooks.swizzle.comp b/third_party/spirv-cross/shaders-msl/comp/force-recompile-hooks.swizzle.comp new file mode 100644 index 0000000000..2752d30512 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/force-recompile-hooks.swizzle.comp @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 0) uniform sampler2D foo; +layout(binding = 1, rgba8) uniform image2D bar; + +void main() { + vec4 a = texture(foo, vec2(1, 1)); + imageStore(bar, ivec2(0, 0), a); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/functions.comp b/third_party/spirv-cross/shaders-msl/comp/functions.comp new file mode 100644 index 0000000000..478c8ebe83 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/functions.comp @@ -0,0 +1,12 @@ +#version 450 +shared int foo[1337]; + +void myfunc() +{ + foo[0]=13; +} + +void main() +{ + myfunc(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp b/third_party/spirv-cross/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp new file mode 100644 index 0000000000..2fe074df7c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp @@ -0,0 +1,12 @@ +#version 450 +layout(set = 0, binding = 0) buffer myBlock { + int a; + float b[1]; +} myStorage; +float getB() { + return myStorage.b[gl_GlobalInvocationID.x]; +} +void main() { + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod((getB() + 0.02), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/global-invocation-id.comp b/third_party/spirv-cross/shaders-msl/comp/global-invocation-id.comp new file mode 100644 index 0000000000..f484637e1f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/global-invocation-id.comp @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) buffer myBlock { + int a; + float b[1]; +} myStorage; +void main() { + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_GlobalInvocationID.x] = mod((myStorage.b[gl_GlobalInvocationID.x] + 0.02), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp b/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp new file mode 100644 index 0000000000..862cd21297 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.argument.msl2.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, r32ui) uniform uimage2D uImage; +layout(set = 0, binding = 1) uniform sampler2D uTexture; + +layout(set = 0, binding = 2) buffer SSBO +{ + vec4 outdata; +}; + +void main() +{ + uint ret = imageAtomicAdd(uImage, ivec2(gl_GlobalInvocationID.xy), 10u); + outdata = textureLod(uTexture, vec2(gl_GlobalInvocationID.xy), 0.0) + float(ret); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.comp b/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.comp new file mode 100644 index 0000000000..862cd21297 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/image-atomic-automatic-bindings.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, r32ui) uniform uimage2D uImage; +layout(set = 0, binding = 1) uniform sampler2D uTexture; + +layout(set = 0, binding = 2) buffer SSBO +{ + vec4 outdata; +}; + +void main() +{ + uint ret = imageAtomicAdd(uImage, ivec2(gl_GlobalInvocationID.xy), 10u); + outdata = textureLod(uTexture, vec2(gl_GlobalInvocationID.xy), 0.0) + float(ret); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/image-cube-array-load-store.comp b/third_party/spirv-cross/shaders-msl/comp/image-cube-array-load-store.comp new file mode 100644 index 0000000000..36a9ffd8ef --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/image-cube-array-load-store.comp @@ -0,0 +1,13 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(r32f, binding = 0) uniform readonly imageCubeArray uImageIn; +layout(r32f, binding = 1) uniform writeonly imageCubeArray uImageOut; + +void main() +{ + ivec3 coord = ivec3(9, 7, 11); + vec4 indata = imageLoad(uImageIn, coord); + imageStore(uImageOut, coord, indata); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/image.comp b/third_party/spirv-cross/shaders-msl/comp/image.comp new file mode 100644 index 0000000000..e375534a51 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/image.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(rgba8, binding = 0) uniform readonly mediump image2D uImageIn; +layout(rgba8, binding = 1) uniform writeonly mediump image2D uImageOut; + +void main() +{ + vec4 v = imageLoad(uImageIn, ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn)); + imageStore(uImageOut, ivec2(gl_GlobalInvocationID.xy), v); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/insert.comp b/third_party/spirv-cross/shaders-msl/comp/insert.comp new file mode 100644 index 0000000000..07c1f8d7aa --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/insert.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) writeonly buffer SSBO +{ + vec4 out_data[]; +}; + +void main() +{ + vec4 v; + v.x = 10.0; + v.y = 30.0; + v.z = 70.0; + v.w = 90.0; + out_data[gl_GlobalInvocationID.x] = v; + out_data[gl_GlobalInvocationID.x].y = 20.0; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/inverse.comp b/third_party/spirv-cross/shaders-msl/comp/inverse.comp new file mode 100644 index 0000000000..03b06d6464 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/inverse.comp @@ -0,0 +1,23 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std430, binding = 0) writeonly buffer MatrixOut +{ + mat2 m2out; + mat3 m3out; + mat4 m4out; +}; + +layout(std430, binding = 1) readonly buffer MatrixIn +{ + mat2 m2in; + mat3 m3in; + mat4 m4in; +}; + +void main() +{ + m2out = inverse(m2in); + m3out = inverse(m3in); + m4out = inverse(m4in); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/local-invocation-id.comp b/third_party/spirv-cross/shaders-msl/comp/local-invocation-id.comp new file mode 100644 index 0000000000..281700f197 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/local-invocation-id.comp @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) buffer myBlock { + int a; + float b[1]; +} myStorage; +void main() { + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationID.x] = mod((myStorage.b[gl_LocalInvocationID.x] + 0.02), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/local-invocation-index.comp b/third_party/spirv-cross/shaders-msl/comp/local-invocation-index.comp new file mode 100644 index 0000000000..68942da8e1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/local-invocation-index.comp @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) buffer myBlock { + int a; + float b[1]; +} myStorage; +void main() { + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b[gl_LocalInvocationIndex.x] = mod((myStorage.b[gl_LocalInvocationIndex.x] + 0.02), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/local-size-duplicate-spec-id.comp b/third_party/spirv-cross/shaders-msl/comp/local-size-duplicate-spec-id.comp new file mode 100644 index 0000000000..060858b97b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/local-size-duplicate-spec-id.comp @@ -0,0 +1,15 @@ +#version 450 + +layout(constant_id=0) const int local_size_x_val = 1; +layout(constant_id=1) const int local_size_y_val = 1; +layout(constant_id=2) const int local_size_z_val = 1; + +layout(local_size_x_id=0, local_size_y_id=1, local_size_z_id=2) in; + +layout(set=0, binding=0) buffer StorageBuffer { + uint values[]; +} ssbo; + +void main() { + ssbo.values[gl_LocalInvocationIndex] = 1u; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/mat3-row-maj-read-write-const.comp b/third_party/spirv-cross/shaders-msl/comp/mat3-row-maj-read-write-const.comp new file mode 100644 index 0000000000..068ad79721 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/mat3-row-maj-read-write-const.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(set = 0, binding = 1, std430) buffer model_t +{ + layout(row_major) mediump mat3 mtx_rm; +} model; + +void main() +{ + mat3 mtx_cm = model.mtx_rm; + mat3 mtx1 = mtx_cm * mat3(vec3(4.0, -3.0, 1.0), vec3(-7.0, 7.0, -7.0), vec3(-5.0, 6.0, -8.0)); + if (mtx1[0][0] != 0.0) + { + model.mtx_rm = mat3(vec3(-5.0, -3.0, -5.0), vec3(-2.0, 2.0, -5.0), vec3(6.0, 3.0, -8.0)); + } +} diff --git a/third_party/spirv-cross/shaders-msl/comp/mat3.comp b/third_party/spirv-cross/shaders-msl/comp/mat3.comp new file mode 100644 index 0000000000..7c5bb1e4f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/mat3.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + mat3 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + out_data[ident] = mat3(vec3(10.0), vec3(20.0), vec3(40.0)); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/mod.comp b/third_party/spirv-cross/shaders-msl/comp/mod.comp new file mode 100644 index 0000000000..1631456e30 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/mod.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 v = mod(in_data[ident], out_data[ident]); + out_data[ident] = v; + + uvec4 vu = floatBitsToUint(in_data[ident]) % floatBitsToUint(out_data[ident]); + out_data[ident] = uintBitsToFloat(vu); + + ivec4 vi = floatBitsToInt(in_data[ident]) % floatBitsToInt(out_data[ident]); + out_data[ident] = intBitsToFloat(vi); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/modf.comp b/third_party/spirv-cross/shaders-msl/comp/modf.comp new file mode 100644 index 0000000000..edadefcf05 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/modf.comp @@ -0,0 +1,23 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 i; + //vec4 v = frexp(in_data[ident], i); + //out_data[ident] = ldexp(v, i); + vec4 v = modf(in_data[ident], i); + out_data[ident] = v; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/outer-product.comp b/third_party/spirv-cross/shaders-msl/comp/outer-product.comp new file mode 100644 index 0000000000..9aba2a54b7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/outer-product.comp @@ -0,0 +1,37 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, std430) writeonly buffer SSBO +{ + mat2 m22; + mat2x3 m23; + mat2x4 m24; + mat3x2 m32; + mat3 m33; + mat3x4 m34; + mat4x2 m42; + mat4x3 m43; + mat4 m44; +}; + +layout(set = 0, binding = 1, std430) readonly buffer ReadSSBO +{ + vec2 v2; + vec3 v3; + vec4 v4; +}; + +void main() +{ + m22 = outerProduct(v2, v2); + m23 = outerProduct(v3, v2); + m24 = outerProduct(v4, v2); + + m32 = outerProduct(v2, v3); + m33 = outerProduct(v3, v3); + m34 = outerProduct(v4, v3); + + m42 = outerProduct(v2, v4); + m43 = outerProduct(v3, v4); + m44 = outerProduct(v4, v4); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/packing-test-1.comp b/third_party/spirv-cross/shaders-msl/comp/packing-test-1.comp new file mode 100644 index 0000000000..1a8a39e219 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/packing-test-1.comp @@ -0,0 +1,18 @@ +#version 450 +struct T1 +{ + vec3 a; + float b; +}; + +layout(std430, binding = 1) buffer Buffer0 { T1 buf0[]; }; +layout(std430, binding = 2) buffer Buffer1 { float buf1[]; }; + +layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in; +void main() +{ + // broken case in Metal! + T1 v = buf0[0]; + float x = v.b; + buf1[gl_GlobalInvocationID.x] = x; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/packing-test-2.comp b/third_party/spirv-cross/shaders-msl/comp/packing-test-2.comp new file mode 100644 index 0000000000..73268beec4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/packing-test-2.comp @@ -0,0 +1,16 @@ +#version 450 +struct T1 +{ + vec3 a; + float b; +}; + +layout(std430, binding = 1) buffer Buffer0 { T1 buf0[]; }; +layout(std430, binding = 2) buffer Buffer1 { float buf1[]; }; + +layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in; +void main() +{ + float x = buf0[0].b; + buf1[gl_GlobalInvocationID.x] = x; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp b/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp new file mode 100644 index 0000000000..eea6a3df46 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.device-argument-buffer.msl2.comp @@ -0,0 +1,114 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0) buffer SSBO_A +{ + float data[]; +} ssbo_a; + +layout(set = 0, binding = 0) buffer SSBO_B +{ + uvec2 data[]; +} ssbo_b; + +layout(set = 0, binding = 0) readonly buffer SSBO_BRO +{ + uvec2 data[]; +} ssbo_b_readonly; + +layout(set = 0, binding = 1) uniform UBO_C +{ + float data[1024]; +} ubo_c; + +layout(set = 0, binding = 1) uniform UBO_D +{ + uvec2 data[1024]; +} ubo_d; + +layout(set = 0, binding = 2) buffer SSBO_As +{ + float data[]; +} ssbo_as[4]; + +layout(set = 0, binding = 2) buffer SSBO_Bs +{ + uvec2 data[1024]; +} ssbo_bs[4]; + +layout(set = 0, binding = 2) readonly buffer SSBO_BsRO +{ + uvec2 data[1024]; +} ssbo_bs_readonly[4]; + +layout(set = 0, binding = 3) uniform UBO_Cs +{ + float data[1024]; +} ubo_cs[4]; + +layout(set = 0, binding = 3) uniform UBO_Ds +{ + uvec2 data[1024]; +} ubo_ds[4]; + +layout(set = 2, binding = 0) buffer SSBO_E +{ + float data[]; +} ssbo_e; + +layout(set = 2, binding = 0) buffer SSBO_F +{ + uvec2 data[]; +} ssbo_f; + +layout(set = 2, binding = 1) uniform UBO_G +{ + float data[1024]; +} ubo_g; + +layout(set = 2, binding = 1) uniform UBO_H +{ + uvec2 data[1024]; +} ubo_h; + +layout(set = 2, binding = 0) readonly buffer SSBO_I +{ + uvec2 data[]; +} ssbo_i; + +layout(push_constant) uniform Registers +{ + float reg; +}; + +void func0() +{ + ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x] + reg; + ssbo_b.data[gl_GlobalInvocationID.x] = + ubo_d.data[gl_WorkGroupID.y] + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; +} + +void func1() +{ + ssbo_as[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x] = ubo_cs[gl_WorkGroupID.x].data[0]; +} + +void func2() +{ + ssbo_bs[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x] = + ubo_ds[gl_WorkGroupID.x].data[0] + ssbo_bs_readonly[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x]; +} + +void func3() +{ + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x]; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y] + ssbo_i.data[gl_GlobalInvocationID.x]; +} + +void main() +{ + func0(); + func1(); + func2(); + func3(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp b/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp new file mode 100644 index 0000000000..eea6a3df46 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/raw-buffer-descriptor-aliasing.argument.discrete.msl2.comp @@ -0,0 +1,114 @@ +#version 450 +layout(local_size_x = 64) in; + +layout(set = 0, binding = 0) buffer SSBO_A +{ + float data[]; +} ssbo_a; + +layout(set = 0, binding = 0) buffer SSBO_B +{ + uvec2 data[]; +} ssbo_b; + +layout(set = 0, binding = 0) readonly buffer SSBO_BRO +{ + uvec2 data[]; +} ssbo_b_readonly; + +layout(set = 0, binding = 1) uniform UBO_C +{ + float data[1024]; +} ubo_c; + +layout(set = 0, binding = 1) uniform UBO_D +{ + uvec2 data[1024]; +} ubo_d; + +layout(set = 0, binding = 2) buffer SSBO_As +{ + float data[]; +} ssbo_as[4]; + +layout(set = 0, binding = 2) buffer SSBO_Bs +{ + uvec2 data[1024]; +} ssbo_bs[4]; + +layout(set = 0, binding = 2) readonly buffer SSBO_BsRO +{ + uvec2 data[1024]; +} ssbo_bs_readonly[4]; + +layout(set = 0, binding = 3) uniform UBO_Cs +{ + float data[1024]; +} ubo_cs[4]; + +layout(set = 0, binding = 3) uniform UBO_Ds +{ + uvec2 data[1024]; +} ubo_ds[4]; + +layout(set = 2, binding = 0) buffer SSBO_E +{ + float data[]; +} ssbo_e; + +layout(set = 2, binding = 0) buffer SSBO_F +{ + uvec2 data[]; +} ssbo_f; + +layout(set = 2, binding = 1) uniform UBO_G +{ + float data[1024]; +} ubo_g; + +layout(set = 2, binding = 1) uniform UBO_H +{ + uvec2 data[1024]; +} ubo_h; + +layout(set = 2, binding = 0) readonly buffer SSBO_I +{ + uvec2 data[]; +} ssbo_i; + +layout(push_constant) uniform Registers +{ + float reg; +}; + +void func0() +{ + ssbo_a.data[gl_GlobalInvocationID.x] = ubo_c.data[gl_WorkGroupID.x] + reg; + ssbo_b.data[gl_GlobalInvocationID.x] = + ubo_d.data[gl_WorkGroupID.y] + ssbo_b_readonly.data[gl_GlobalInvocationID.x]; +} + +void func1() +{ + ssbo_as[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x] = ubo_cs[gl_WorkGroupID.x].data[0]; +} + +void func2() +{ + ssbo_bs[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x] = + ubo_ds[gl_WorkGroupID.x].data[0] + ssbo_bs_readonly[gl_WorkGroupID.x].data[gl_GlobalInvocationID.x]; +} + +void func3() +{ + ssbo_e.data[gl_GlobalInvocationID.x] = ubo_g.data[gl_WorkGroupID.x]; + ssbo_f.data[gl_GlobalInvocationID.x] = ubo_h.data[gl_WorkGroupID.y] + ssbo_i.data[gl_GlobalInvocationID.x]; +} + +void main() +{ + func0(); + func1(); + func2(); + func3(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp b/third_party/spirv-cross/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp new file mode 100644 index 0000000000..fba72ad0d2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/ray-query.spv14.vk.ios.msl24..invalid.comp @@ -0,0 +1,58 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_ray_flags_primitive_culling : require +layout(primitive_culling); + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS0; +layout(set = 0, binding = 1) uniform accelerationStructureEXT AS1; + +layout(set = 0, binding = 2) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; + float thit; +}; + +rayQueryEXT q2[2]; + +void main() +{ + rayQueryEXT q; + bool res; + uint type; + float fval; + vec3 fvals; + int ival; + mat4x3 matrices; + + rayQueryInitializeEXT(q, AS0, ray_flags, cull_mask, origin, tmin, dir, tmax); + rayQueryInitializeEXT(q2[1], AS1, ray_flags, cull_mask, origin, tmin, dir, tmax); + + res = rayQueryProceedEXT(q); + rayQueryTerminateEXT(q2[0]); + rayQueryGenerateIntersectionEXT(q, thit); + rayQueryConfirmIntersectionEXT(q2[1]); + fval = rayQueryGetRayTMinEXT(q); + fvals = rayQueryGetWorldRayDirectionEXT(q); + fvals = rayQueryGetWorldRayOriginEXT(q); + type = rayQueryGetIntersectionTypeEXT(q2[1], true); + type = rayQueryGetIntersectionTypeEXT(q2[0], false); + res = rayQueryGetIntersectionCandidateAABBOpaqueEXT(q2[1]); + fval = rayQueryGetIntersectionTEXT(q2[1], true); + fval = rayQueryGetIntersectionTEXT(q2[1], false); + ival = rayQueryGetIntersectionInstanceCustomIndexEXT(q, true); + ival = rayQueryGetIntersectionInstanceIdEXT(q2[0], false); + ival = rayQueryGetIntersectionGeometryIndexEXT(q2[1], false); + ival = rayQueryGetIntersectionPrimitiveIndexEXT(q, true); + fvals.xy = rayQueryGetIntersectionBarycentricsEXT(q2[0], false); + res = rayQueryGetIntersectionFrontFaceEXT(q, true); + fvals = rayQueryGetIntersectionObjectRayDirectionEXT(q, false); + fvals = rayQueryGetIntersectionObjectRayOriginEXT(q2[0], true); + matrices = rayQueryGetIntersectionObjectToWorldEXT(q, false); + matrices = rayQueryGetIntersectionWorldToObjectEXT(q2[1], true); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/read-write-only.comp b/third_party/spirv-cross/shaders-msl/comp/read-write-only.comp new file mode 100644 index 0000000000..b224b6f121 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/read-write-only.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO0 +{ + vec4 data0; + vec4 data1; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + vec4 data2; + vec4 data3; +}; + +layout(binding = 2, std430) restrict writeonly buffer SSBO2 +{ + vec4 data4; + vec4 data5; +}; + +void main() +{ + data4 = data0 + data2; + data5 = data1 + data3; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/rmw-matrix.comp b/third_party/spirv-cross/shaders-msl/comp/rmw-matrix.comp new file mode 100644 index 0000000000..c158ab4ddd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/rmw-matrix.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float a; + vec4 b; + mat4 c; + + float a1; + vec4 b1; + mat4 c1; +}; + +void main() +{ + a *= a1; + b *= b1; + c *= c1; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/rmw-opt.comp b/third_party/spirv-cross/shaders-msl/comp/rmw-opt.comp new file mode 100644 index 0000000000..a6e1e7fe75 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/rmw-opt.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + int a; +}; + +void main() +{ + a += 10; + a -= 10; + a *= 10; + a /= 10; + a <<= 2; + a >>= 3; + a &= 40; + a ^= 10; + a %= 40; + a |= 1; + + bool c = false; + bool d = true; + c = c && d; + d = d || c; + a = c && d ? 1 : 0; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/shaders-msl/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..6354632298 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,20 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std430, set = 0, binding = 0) buffer SSBO +{ + float a; + float b; + float c; + float d; + float e; + float f; +}; + +void main() +{ + c = distance(a, b); + d = length(a); + e = normalize(a); + f = distance(a-1, b-2); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-array-of-arrays.comp b/third_party/spirv-cross/shaders-msl/comp/shared-array-of-arrays.comp new file mode 100644 index 0000000000..009b4e41d4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-array-of-arrays.comp @@ -0,0 +1,29 @@ +#version 310 es +layout(local_size_x = 4, local_size_y = 4) in; + +shared float foo[4][4]; + +layout(binding = 0, std430) buffer SSBO +{ + float out_data[]; +}; + +void work() +{ + foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); + memoryBarrierShared(); + barrier(); + + float x = 0.0; + x += foo[gl_LocalInvocationID.x][0]; + x += foo[gl_LocalInvocationID.x][1]; + x += foo[gl_LocalInvocationID.x][2]; + x += foo[gl_LocalInvocationID.x][3]; + out_data[gl_GlobalInvocationID.x] = x; +} + +void main() +{ + work(); +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-matrix-array-of-array.comp b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-array-of-array.comp new file mode 100644 index 0000000000..3bbd4c0f0c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-array-of-array.comp @@ -0,0 +1,65 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer block { highp uint passed; }; +struct S1 { + mediump mat4x3 a[2]; + lowp float b; + lowp vec2 c[3]; +}; +struct S2 { + highp ivec4 a; + bool b[3][1][3]; +}; + +bool compare_float (highp float a, highp float b) { return abs(a - b) < 0.05; } +bool compare_vec2 (highp vec2 a, highp vec2 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y); } +bool compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y)&&compare_float(a.z, b.z); } +bool compare_mat4x3 (highp mat4x3 a, highp mat4x3 b){ return compare_vec3(a[0], b[0])&&compare_vec3(a[1], b[1])&&compare_vec3(a[2], b[2])&&compare_vec3(a[3], b[3]); } +bool compare_ivec4 (highp ivec4 a, highp ivec4 b) { return a == b; } +bool compare_bool (bool a, bool b) { return a == b; } + +shared S1 s1; +shared S2 s2; + +void main (void) { + s1.a[0] = mat4x3(0.0, 2.0, -8.0, 6.0, 7.0, 5.0, -6.0, 1.0, 9.0, -4.0, -3.0, 4.0); + s1.a[1] = mat4x3(4.0, 9.0, -9.0, -8.0, -9.0, 8.0, 0.0, 4.0, -4.0, 7.0, 2.0, -1.0); + s1.b = 7.0; + s1.c[0] = vec2(-5.0, -4.0); + s1.c[1] = vec2(3.0, -5.0); + s1.c[2] = vec2(-3.0, -1.0); + s2.a = ivec4(1, 0, -3, 1); + s2.b[0][0][0] = true; + s2.b[0][0][1] = false; + s2.b[0][0][2] = false; + s2.b[1][0][0] = true; + s2.b[1][0][1] = false; + s2.b[1][0][2] = true; + s2.b[2][0][0] = false; + s2.b[2][0][1] = true; + s2.b[2][0][2] = true; + + barrier(); + memoryBarrier(); + bool allOk = true; + allOk = allOk && compare_mat4x3(mat4x3(0.0, 2.0, -8.0, 6.0, 7.0, 5.0, -6.0, 1.0, 9.0, -4.0, -3.0, 4.0), s1.a[0]); + allOk = allOk && compare_mat4x3(mat4x3(4.0, 9.0, -9.0, -8.0, -9.0, 8.0, 0.0, 4.0, -4.0, 7.0, 2.0, -1.0), s1.a[1]); + allOk = allOk && compare_float(7.0, s1.b); + allOk = allOk && compare_vec2(vec2(-5.0, -4.0), s1.c[0]); + allOk = allOk && compare_vec2(vec2(3.0, -5.0), s1.c[1]); + allOk = allOk && compare_vec2(vec2(-3.0, -1.0), s1.c[2]); + allOk = allOk && compare_ivec4(ivec4(1, 0, -3, 1), s2.a); + allOk = allOk && compare_bool(true, s2.b[0][0][0]); + allOk = allOk && compare_bool(false, s2.b[0][0][1]); + allOk = allOk && compare_bool(false, s2.b[0][0][2]); + allOk = allOk && compare_bool(true, s2.b[1][0][0]); + allOk = allOk && compare_bool(false, s2.b[1][0][1]); + allOk = allOk && compare_bool(true, s2.b[1][0][2]); + allOk = allOk && compare_bool(false, s2.b[2][0][0]); + allOk = allOk && compare_bool(true, s2.b[2][0][1]); + allOk = allOk && compare_bool(true, s2.b[2][0][2]); + if (allOk) + passed++; + +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-matrix-cast.comp b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-cast.comp new file mode 100644 index 0000000000..7e46fed7ae --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-cast.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer block { highp uint passed; }; +struct S1 { + mediump vec4 a; + highp mat3x2 b; + bvec4 c; +}; + +bool compare_float (highp float a, highp float b) { return abs(a - b) < 0.05; } +bool compare_vec2 (highp vec2 a, highp vec2 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y); } +bool compare_vec4 (highp vec4 a, highp vec4 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y)&&compare_float(a.z, b.z)&&compare_float(a.w, b.w); } +bool compare_mat3x2 (highp mat3x2 a, highp mat3x2 b){ return compare_vec2(a[0], b[0])&&compare_vec2(a[1], b[1])&&compare_vec2(a[2], b[2]); } +bool compare_bvec4 (bvec4 a, bvec4 b) { return a == b; } + +shared S1 s1; + +void main (void) { + s1.a = vec4(1.0, -5.0, -9.0, -5.0); + s1.b = mat3x2(1.0, -7.0, 1.0, 2.0, 8.0, 7.0); + s1.c = bvec4(false, true, false, false); + + barrier(); + memoryBarrier(); + bool allOk = true; + allOk = allOk && compare_vec4(vec4(1.0, -5.0, -9.0, -5.0), s1.a); + allOk = allOk && compare_mat3x2(mat3x2(1.0, -7.0, 1.0, 2.0, 8.0, 7.0), s1.b); + allOk = allOk && compare_bvec4(bvec4(false, true, false, false), s1.c); + if (allOk) + passed++; + +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct-array.comp b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct-array.comp new file mode 100644 index 0000000000..59ab24d848 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct-array.comp @@ -0,0 +1,87 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer block { highp uint passed; }; +struct sA +{ + mediump mat2x3 mA; +}; +struct sB +{ + mediump mat2 mA; + mediump mat3x2 mB; + highp uvec3 mC; +}; +struct sC +{ + sA mA; + sB mB; +}; +struct sD +{ + sC mA; +}; +struct sE +{ + lowp mat3x2 mA; + lowp mat4x3 mB; +}; +struct sF +{ + sE mA; +}; +struct sG +{ + sF mA; +}; +struct sH +{ + bvec3 mA[2]; +}; +struct S1 { + sD a; + sG b; + sH c[2]; +}; + +bool compare_float (highp float a, highp float b) { return abs(a - b) < 0.05; } +bool compare_vec2 (highp vec2 a, highp vec2 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y); } +bool compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y)&&compare_float(a.z, b.z); } +bool compare_mat2 (highp mat2 a, highp mat2 b) { return compare_vec2(a[0], b[0])&&compare_vec2(a[1], b[1]); } +bool compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])&&compare_vec3(a[1], b[1]); } +bool compare_mat3x2 (highp mat3x2 a, highp mat3x2 b){ return compare_vec2(a[0], b[0])&&compare_vec2(a[1], b[1])&&compare_vec2(a[2], b[2]); } +bool compare_mat4x3 (highp mat4x3 a, highp mat4x3 b){ return compare_vec3(a[0], b[0])&&compare_vec3(a[1], b[1])&&compare_vec3(a[2], b[2])&&compare_vec3(a[3], b[3]); } +bool compare_uvec3 (highp uvec3 a, highp uvec3 b) { return a == b; } +bool compare_bvec3 (bvec3 a, bvec3 b) { return a == b; } + +shared S1 s1; + +void main (void) { + s1.a.mA.mA.mA = mat2x3(6.0, 8.0, 8.0, 0.0, -4.0, -5.0); + s1.a.mA.mB.mA = mat2(9.0, -4.0, -6.0, -1.0); + s1.a.mA.mB.mB = mat3x2(-1.0, -2.0, 1.0, 6.0, 5.0, 7.0); + s1.a.mA.mB.mC = uvec3(3u, 1u, 5u); + s1.b.mA.mA.mA = mat3x2(8.0, 3.0, 0.0, 2.0, 1.0, 8.0); + s1.b.mA.mA.mB = mat4x3(0.0, 9.0, -1.0, -1.0, -7.0, 7.0, -4.0, -3.0, 1.0, -4.0, -9.0, 1.0); + s1.c[0].mA[0] = bvec3(true, false, false); + s1.c[0].mA[1] = bvec3(true, false, false); + s1.c[1].mA[0] = bvec3(false, false, false); + s1.c[1].mA[1] = bvec3(false, false, false); + + barrier(); + memoryBarrier(); + bool allOk = true; + allOk = allOk && compare_mat2x3(mat2x3(6.0, 8.0, 8.0, 0.0, -4.0, -5.0), s1.a.mA.mA.mA); + allOk = allOk && compare_mat2(mat2(9.0, -4.0, -6.0, -1.0), s1.a.mA.mB.mA); + allOk = allOk && compare_mat3x2(mat3x2(-1.0, -2.0, 1.0, 6.0, 5.0, 7.0), s1.a.mA.mB.mB); + allOk = allOk && compare_uvec3(uvec3(3u, 1u, 5u), s1.a.mA.mB.mC); + allOk = allOk && compare_mat3x2(mat3x2(8.0, 3.0, 0.0, 2.0, 1.0, 8.0), s1.b.mA.mA.mA); + allOk = allOk && compare_mat4x3(mat4x3(0.0, 9.0, -1.0, -1.0, -7.0, 7.0, -4.0, -3.0, 1.0, -4.0, -9.0, 1.0), s1.b.mA.mA.mB); + allOk = allOk && compare_bvec3(bvec3(true, false, false), s1.c[0].mA[0]); + allOk = allOk && compare_bvec3(bvec3(true, false, false), s1.c[0].mA[1]); + allOk = allOk && compare_bvec3(bvec3(false, false, false), s1.c[1].mA[0]); + allOk = allOk && compare_bvec3(bvec3(false, false, false), s1.c[1].mA[1]); + if (allOk) + passed++; + +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct.comp b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct.comp new file mode 100644 index 0000000000..c481f54a86 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-matrix-nested-struct.comp @@ -0,0 +1,141 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer block { highp uint passed; }; +struct sA +{ + highp mat4 mA; + bvec3 mB; + bvec4 mC; +}; +struct sB +{ + bvec2 mA; +}; +struct sC +{ + highp float mA; + mediump uvec4 mB; + mediump float mC; +}; +struct sD +{ + sA mA; + sB mB; + sC mC; +}; +struct sE +{ + sD mA; +}; +struct sF +{ + lowp uvec3 mA; + bool mB; +}; +struct sG +{ + sF mA; + highp mat3x2 mB; +}; +struct sH +{ + sG mA; + mediump vec2 mB; +}; +struct sI +{ + mediump mat2 mA; + bvec3 mB; + bvec4 mC; +}; +struct sJ +{ + sI mA; + bvec3 mB; +}; +struct sK +{ + bvec2 mA; + sJ mB; + mediump ivec2 mC; +}; +struct S1 { + lowp uint a; + mediump vec4 b; +}; +struct S2 { + sE a; + highp ivec3 b; + sH c; + sK d; +}; + +bool compare_float (highp float a, highp float b) { return abs(a - b) < 0.05; } +bool compare_vec2 (highp vec2 a, highp vec2 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y); } +bool compare_vec4 (highp vec4 a, highp vec4 b) { return compare_float(a.x, b.x)&&compare_float(a.y, b.y)&&compare_float(a.z, b.z)&&compare_float(a.w, b.w); } +bool compare_mat2 (highp mat2 a, highp mat2 b) { return compare_vec2(a[0], b[0])&&compare_vec2(a[1], b[1]); } +bool compare_mat3x2 (highp mat3x2 a, highp mat3x2 b){ return compare_vec2(a[0], b[0])&&compare_vec2(a[1], b[1])&&compare_vec2(a[2], b[2]); } +bool compare_mat4 (highp mat4 a, highp mat4 b) { return compare_vec4(a[0], b[0])&&compare_vec4(a[1], b[1])&&compare_vec4(a[2], b[2])&&compare_vec4(a[3], b[3]); } +bool compare_ivec2 (highp ivec2 a, highp ivec2 b) { return a == b; } +bool compare_ivec3 (highp ivec3 a, highp ivec3 b) { return a == b; } +bool compare_uint (highp uint a, highp uint b) { return a == b; } +bool compare_uvec3 (highp uvec3 a, highp uvec3 b) { return a == b; } +bool compare_uvec4 (highp uvec4 a, highp uvec4 b) { return a == b; } +bool compare_bool (bool a, bool b) { return a == b; } +bool compare_bvec2 (bvec2 a, bvec2 b) { return a == b; } +bool compare_bvec3 (bvec3 a, bvec3 b) { return a == b; } +bool compare_bvec4 (bvec4 a, bvec4 b) { return a == b; } + +shared S1 s1; +shared S2 s2; + +void main (void) { + s1.a = 0u; + s1.b = vec4(8.0, 8.0, 0.0, -4.0); + s2.a.mA.mA.mA = mat4(-5.0, 9.0, -4.0, -6.0, -1.0, -1.0, -2.0, 1.0, 6.0, 5.0, 7.0, -2.0, -4.0, -9.0, 8.0, 3.0); + s2.a.mA.mA.mB = bvec3(true, false, false); + s2.a.mA.mA.mC = bvec4(true, true, true, false); + s2.a.mA.mB.mA = bvec2(true, true); + s2.a.mA.mC.mA = 7.0; + s2.a.mA.mC.mB = uvec4(8u, 6u, 2u, 0u); + s2.a.mA.mC.mC = -9.0; + s2.b = ivec3(1, -4, 0); + s2.c.mA.mA.mA = uvec3(4u, 9u, 1u); + s2.c.mA.mA.mB = false; + s2.c.mA.mB = mat3x2(3.0, -5.0, -1.0, -5.0, -1.0, -9.0); + s2.c.mB = vec2(-6.0, -9.0); + s2.d.mA = bvec2(true, false); + s2.d.mB.mA.mA = mat2(-2.0, 3.0, 7.0, 2.0); + s2.d.mB.mA.mB = bvec3(false, false, false); + s2.d.mB.mA.mC = bvec4(false, false, false, true); + s2.d.mB.mB = bvec3(true, false, false); + s2.d.mC = ivec2(-9, 0); + + barrier(); + memoryBarrier(); + bool allOk = true; + allOk = allOk && compare_uint(0u, s1.a); + allOk = allOk && compare_vec4(vec4(8.0, 8.0, 0.0, -4.0), s1.b); + allOk = allOk && compare_mat4(mat4(-5.0, 9.0, -4.0, -6.0, -1.0, -1.0, -2.0, 1.0, 6.0, 5.0, 7.0, -2.0, -4.0, -9.0, 8.0, 3.0), s2.a.mA.mA.mA); + allOk = allOk && compare_bvec3(bvec3(true, false, false), s2.a.mA.mA.mB); + allOk = allOk && compare_bvec4(bvec4(true, true, true, false), s2.a.mA.mA.mC); + allOk = allOk && compare_bvec2(bvec2(true, true), s2.a.mA.mB.mA); + allOk = allOk && compare_float(7.0, s2.a.mA.mC.mA); + allOk = allOk && compare_uvec4(uvec4(8u, 6u, 2u, 0u), s2.a.mA.mC.mB); + allOk = allOk && compare_float(-9.0, s2.a.mA.mC.mC); + allOk = allOk && compare_ivec3(ivec3(1, -4, 0), s2.b); + allOk = allOk && compare_uvec3(uvec3(4u, 9u, 1u), s2.c.mA.mA.mA); + allOk = allOk && compare_bool(false, s2.c.mA.mA.mB); + allOk = allOk && compare_mat3x2(mat3x2(3.0, -5.0, -1.0, -5.0, -1.0, -9.0), s2.c.mA.mB); + allOk = allOk && compare_vec2(vec2(-6.0, -9.0), s2.c.mB); + allOk = allOk && compare_bvec2(bvec2(true, false), s2.d.mA); + allOk = allOk && compare_mat2(mat2(-2.0, 3.0, 7.0, 2.0), s2.d.mB.mA.mA); + allOk = allOk && compare_bvec3(bvec3(false, false, false), s2.d.mB.mA.mB); + allOk = allOk && compare_bvec4(bvec4(false, false, false, true), s2.d.mB.mA.mC); + allOk = allOk && compare_bvec3(bvec3(true, false, false), s2.d.mB.mB); + allOk = allOk && compare_ivec2(ivec2(-9, 0), s2.d.mC); + if (allOk) + passed++; + +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared-struct-bool-cast.comp b/third_party/spirv-cross/shaders-msl/comp/shared-struct-bool-cast.comp new file mode 100644 index 0000000000..d6479b3e44 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared-struct-bool-cast.comp @@ -0,0 +1,35 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, binding = 0) buffer block { highp uint passed; }; +struct S1 { + mediump ivec3 a; + highp uvec2 b; + bvec4 c; + mediump uint d; +}; + +bool compare_ivec3 (highp ivec3 a, highp ivec3 b) { return a == b; } +bool compare_uint (highp uint a, highp uint b) { return a == b; } +bool compare_uvec2 (highp uvec2 a, highp uvec2 b) { return a == b; } +bool compare_bvec4 (bvec4 a, bvec4 b) { return a == b; } + +shared S1 s1; + +void main (void) { + s1.a = ivec3(6, 8, 8); + s1.b = uvec2(4u, 4u); + s1.c = bvec4(false, false, false, true); + s1.d = 6u; + + barrier(); + memoryBarrier(); + bool allOk = true; + allOk = allOk && compare_ivec3(ivec3(6, 8, 8), s1.a); + allOk = allOk && compare_uvec2(uvec2(4u, 4u), s1.b); + allOk = allOk && compare_bvec4(bvec4(false, false, false, true), s1.c); + allOk = allOk && compare_uint(6u, s1.d); + if (allOk) + passed++; + +} diff --git a/third_party/spirv-cross/shaders-msl/comp/shared.comp b/third_party/spirv-cross/shaders-msl/comp/shared.comp new file mode 100644 index 0000000000..4deff93597 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/shared.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 4) in; + +shared float sShared[gl_WorkGroupSize.x]; + +layout(std430, binding = 0) readonly buffer SSBO +{ + float in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + float out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = in_data[ident]; + + sShared[gl_LocalInvocationIndex] = idata; + memoryBarrierShared(); + barrier(); + + out_data[ident] = sShared[gl_WorkGroupSize.x - gl_LocalInvocationIndex - 1u]; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/spec-constant-op-member-array.comp b/third_party/spirv-cross/shaders-msl/comp/spec-constant-op-member-array.comp new file mode 100644 index 0000000000..0b428eb0cf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/spec-constant-op-member-array.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; +layout(constant_id = 2) const int c = 300; +const int d = c + 50; +layout(constant_id = 3) const int e = 400; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(set = 1, binding = 0) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +void main() +{ + w[gl_GlobalInvocationID.x] += v[gl_GlobalInvocationID.x] + e; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/spec-constant-work-group-size.comp b/third_party/spirv-cross/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 0000000000..09b65dc99f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y] = b + spec_const_array_size[1 - a]; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/storage-buffer-std140-vector-array.comp b/third_party/spirv-cross/shaders-msl/comp/storage-buffer-std140-vector-array.comp new file mode 100644 index 0000000000..7e786ec6c1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/storage-buffer-std140-vector-array.comp @@ -0,0 +1,30 @@ +#version 450 +layout(local_size_x = 1) in; + +struct Sub +{ + float f[2]; + vec2 f2[2]; + vec3 f3[2]; + vec4 f4[2]; +}; + +layout(std140, binding = 0) buffer SSBO +{ + Sub sub[2]; +}; + +void main() +{ + Sub foo = sub[gl_WorkGroupID.x]; + + foo.f[gl_GlobalInvocationID.x] += 1.0; + foo.f2[gl_GlobalInvocationID.x] += 2.0; + foo.f3[gl_GlobalInvocationID.x] += 3.0; + foo.f4[gl_GlobalInvocationID.x] += 4.0; + sub[gl_WorkGroupID.x] = foo; + + sub[0].f[0] += 5.0; + sub[0].f2[1] += 5.0; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/struct-layout.comp b/third_party/spirv-cross/shaders-msl/comp/struct-layout.comp new file mode 100644 index 0000000000..5a2b7802df --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/struct-layout.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct Foo +{ + mat4 m; +}; + +layout(std430, binding = 0) readonly buffer SSBO +{ + Foo in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + Foo out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + out_data[ident].m = in_data[ident].m * in_data[ident].m; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/struct-nested.comp b/third_party/spirv-cross/shaders-msl/comp/struct-nested.comp new file mode 100644 index 0000000000..d9645cbc4c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/struct-nested.comp @@ -0,0 +1,20 @@ +#version 450 + +struct s1 +{ + int a; +}; + +struct s2 +{ + s1 b; +}; + +layout(std430, binding = 1) buffer dstbuffer{ s2 test[]; }; +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() +{ + s2 testVal; + testVal.b.a = 0; + test[0] = testVal; +} \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-msl/comp/struct-packing.comp b/third_party/spirv-cross/shaders-msl/comp/struct-packing.comp new file mode 100644 index 0000000000..5baf45cb3c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/struct-packing.comp @@ -0,0 +1,77 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + + S4 m3s[8]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content = ssbo_140.content; + ssbo_430.content.m1.a = ssbo_430.m6[1][1] * ssbo_430.content.m3.a; // test packed matrix access +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/threadgroup-boolean-workaround.comp b/third_party/spirv-cross/shaders-msl/comp/threadgroup-boolean-workaround.comp new file mode 100644 index 0000000000..8dce77a252 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/threadgroup-boolean-workaround.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x = 4) in; + +shared bvec4 foo[4]; + +layout(binding = 0) buffer SSBO +{ + vec4 values[]; +}; + +void in_function() +{ + foo[gl_LocalInvocationIndex] = notEqual(values[gl_GlobalInvocationID.x], vec4(10.0)); + barrier(); + values[gl_GlobalInvocationID.x] = mix(vec4(40.0), vec4(30.0), foo[gl_LocalInvocationIndex ^ 3]); +} + +void main() +{ + in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/torture-loop.comp b/third_party/spirv-cross/shaders-msl/comp/torture-loop.comp new file mode 100644 index 0000000000..54a1221a15 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/torture-loop.comp @@ -0,0 +1,40 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = in_data[ident]; + + int k = 0; + + // Continue with side effects. + while (++k < 10) + { + idat *= 2.0; + k++; + } + + // Again used here ... + for (uint i = 0u; i < 16u; i++, k++) + for (uint j = 0u; j < 30u; j++) + idat = mvp * idat; + + do + { + k++; + } while (k > 10); + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/type-alias.comp b/third_party/spirv-cross/shaders-msl/comp/type-alias.comp new file mode 100644 index 0000000000..343d350a2f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/type-alias.comp @@ -0,0 +1,45 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct S0 +{ + vec4 a; +}; + +struct S1 +{ + vec4 a; +}; + +vec4 overload(S0 s0) +{ + return s0.a; +} + +vec4 overload(S1 s1) +{ + return s1.a; +} + +layout(std430, binding = 0) buffer SSBO0 +{ + S0 s0s[]; +}; + +layout(std430, binding = 1) buffer SSBO1 +{ + S1 s1s[]; +}; + +layout(std430, binding = 2) buffer SSBO2 +{ + vec4 outputs[]; +}; + + +void main() +{ + S0 s0 = s0s[gl_GlobalInvocationID.x]; + S1 s1 = s1s[gl_GlobalInvocationID.x]; + outputs[gl_GlobalInvocationID.x] = overload(s0) + overload(s1); +} diff --git a/third_party/spirv-cross/shaders-msl/comp/type_casting_i64.msl22.comp b/third_party/spirv-cross/shaders-msl/comp/type_casting_i64.msl22.comp new file mode 100644 index 0000000000..45e682e586 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/type_casting_i64.msl22.comp @@ -0,0 +1,23 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(constant_id = 0) const int base_val = 0; +layout(constant_id = 1) const int64_t shift_val = 0; +const int offset = base_val >> shift_val; + +layout(set = 0, binding = 0, std430) buffer src_buff_t +{ + int m0[]; +} src_buff; + +layout(set = 0, binding = 1, std430) buffer dst_buff_t +{ + int m0[]; +} dst_buff; + +void main() +{ + dst_buff.m0[gl_GlobalInvocationID.x] = src_buff.m0[gl_GlobalInvocationID.x] + offset; +} + diff --git a/third_party/spirv-cross/shaders-msl/comp/udiv.comp b/third_party/spirv-cross/shaders-msl/comp/udiv.comp new file mode 100644 index 0000000000..d4e1133bc1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/udiv.comp @@ -0,0 +1,17 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + uint inputs[]; +}; + +layout(std430, binding = 1) buffer SSBO2 +{ + uint outputs[]; +}; + +void main() +{ + outputs[gl_GlobalInvocationID.x] = inputs[gl_GlobalInvocationID.x] / 29u; +} diff --git a/third_party/spirv-cross/shaders-msl/comp/writable-ssbo.comp b/third_party/spirv-cross/shaders-msl/comp/writable-ssbo.comp new file mode 100644 index 0000000000..1d5128ce8a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/comp/writable-ssbo.comp @@ -0,0 +1,9 @@ +#version 450 +layout(set = 0, binding = 0) buffer myBlock { + int a; + float b; +} myStorage; +void main() { + myStorage.a = (myStorage.a + 1) % 256; + myStorage.b = mod((myStorage.b + 0.02), 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..9623751b61 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,41 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBOUint +{ + uint a, b, c, d; + uvec2 a2, b2, c2, d2; + uvec3 a3, b3, c3, d3; + uvec4 a4, b4, c4, d4; +} u; + +layout(binding = 1, std430) buffer SSBOInt +{ + int a, b, c, d; + ivec2 a2, b2, c2, d2; + ivec3 a3, b3, c3, d3; + ivec4 a4, b4, c4, d4; +} i; + +void main() +{ + u.c = uaddCarry(u.a, u.b, u.d); + u.c2 = uaddCarry(u.a2, u.b2, u.d2); + u.c3 = uaddCarry(u.a3, u.b3, u.d3); + u.c4 = uaddCarry(u.a4, u.b4, u.d4); + + u.c = usubBorrow(u.a, u.b, u.d); + u.c2 = usubBorrow(u.a2, u.b2, u.d2); + u.c3 = usubBorrow(u.a3, u.b3, u.d3); + u.c4 = usubBorrow(u.a4, u.b4, u.d4); + + umulExtended(u.a, u.b, u.c, u.d); + umulExtended(u.a2, u.b2, u.c2, u.d2); + umulExtended(u.a3, u.b3, u.c3, u.d3); + umulExtended(u.a4, u.b4, u.c4, u.d4); + + imulExtended(i.a, i.b, i.c, i.d); + imulExtended(i.a2, i.b2, i.c2, i.d2); + imulExtended(i.a3, i.b3, i.c3, i.d3); + imulExtended(i.a4, i.b4, i.c4, i.d4); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/shaders-msl/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..e145cb8f00 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(rgba8, binding = 0) uniform image2D uImage; +layout(rgba8, binding = 1) uniform image2DArray uImageArray; +layout(rgba8, binding = 2) uniform image2DMS uImageMS; + +void main() +{ + vec4 a = imageLoad(uImageMS, ivec2(1, 2), 2); + vec4 b = imageLoad(uImageArray, ivec3(1, 2, 4)); + imageStore(uImage, ivec2(2, 3), a); + imageStore(uImageArray, ivec3(2, 3, 7), b); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/shaders-msl/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..4a80cbf81f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(textureQueryLevels(uSampler))); +} + diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..4c8dcf9764 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(binding = 0) uniform sampler2DMS uSampler; +layout(binding = 2, rgba8) uniform readonly writeonly image2DMS uImage; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(textureSamples(uSampler) + imageSamples(uImage))); +} + diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc new file mode 100644 index 0000000000..e6941a314c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc @@ -0,0 +1,27 @@ +#version 450 + +layout(vertices = 4) out; +layout(location = 0) patch out vec3 vPatch[2]; +layout(location = 2) out vec3 vVertex[]; +layout(location = 0) in vec3 vInput[]; + +void main() +{ + vVertex[gl_InvocationID] = + vInput[gl_InvocationID] + + vInput[gl_InvocationID ^ 1]; + + barrier(); + + if (gl_InvocationID == 0) + { + vPatch[0] = vec3(10.0); + vPatch[1] = vec3(20.0); + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 2.0; + gl_TessLevelOuter[2] = 3.0; + gl_TessLevelOuter[3] = 4.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 2.0; + } +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..a258afb367 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.multi-patch.tesc @@ -0,0 +1,32 @@ +#version 450 +layout(vertices = 1) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[gl_MaxPatchVertices]; + +out gl_PerVertex +{ + vec4 gl_Position; +} gl_out[1]; + +layout(location = 0) patch out vec3 vFoo; + +void set_position() +{ + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); + + set_position(); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..a258afb367 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,32 @@ +#version 450 +layout(vertices = 1) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[gl_MaxPatchVertices]; + +out gl_PerVertex +{ + vec4 gl_Position; +} gl_out[1]; + +layout(location = 0) patch out vec3 vFoo; + +void set_position() +{ + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); + + set_position(); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc new file mode 100644 index 0000000000..78d0d00cb6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.multi-patch.tesc @@ -0,0 +1,22 @@ +#version 450 + +struct Boo +{ + vec3 a; + uvec3 b; +}; + +layout(vertices = 4) out; +layout(location = 0) out Boo vVertex[]; +layout(location = 0) in Boo vInput[]; + +void main() +{ + vVertex[gl_InvocationID] = vInput[gl_InvocationID]; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 2.0; + gl_TessLevelOuter[2] = 3.0; + gl_TessLevelOuter[3] = 4.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 2.0; +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc new file mode 100644 index 0000000000..df2cddbc28 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc @@ -0,0 +1,22 @@ +#version 450 + +struct Boo +{ + vec3 a; + vec3 b; +}; + +layout(vertices = 4) out; +layout(location = 0) out Boo vVertex[]; +layout(location = 0) in Boo vInput[]; + +void main() +{ + vVertex[gl_InvocationID] = vInput[gl_InvocationID]; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 2.0; + gl_TessLevelOuter[2] = 3.0; + gl_TessLevelOuter[3] = 4.0; + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 2.0; +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..c964fbe263 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,22 @@ +#version 450 + +layout(cw, triangles, fractional_even_spacing) in; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[gl_MaxPatchVertices]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = + gl_in[0].gl_Position * gl_TessCoord.x + + gl_in[1].gl_Position * gl_TessCoord.y + + gl_in[2].gl_Position * gl_TessCoord.z; +} + diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/shaders-msl/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..9ddab08cda --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; +}; +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert b/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert new file mode 100644 index 0000000000..9c0f1d5f36 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance..no-user-varying.desktop.vert @@ -0,0 +1,10 @@ +#version 450 + +void main() +{ + gl_Position = vec4(10.0); + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 4.0; + //gl_CullDistance[0] = 4.0; + //gl_CullDistance[1] = 9.0; +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..9c0f1d5f36 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,10 @@ +#version 450 + +void main() +{ + gl_Position = vec4(10.0); + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 4.0; + //gl_CullDistance[0] = 4.0; + //gl_CullDistance[1] = 9.0; +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert b/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert new file mode 100644 index 0000000000..fadd1e73bf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.for-tess.vert @@ -0,0 +1,11 @@ +#version 460 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(gl_BaseVertex, gl_BaseInstance, 0, 1); +} diff --git a/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert b/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert new file mode 100644 index 0000000000..fadd1e73bf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert @@ -0,0 +1,11 @@ +#version 460 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(gl_BaseVertex, gl_BaseInstance, 0, 1); +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/basic.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/basic.flatten.vert new file mode 100644 index 0000000000..e60a9067b1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/basic.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/multiindex.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..0b471d86e0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/multiindex.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +layout(std140) uniform UBO +{ + vec4 Data[3][5]; +}; + +layout(location = 0) in ivec2 aIndex; + +void main() +{ + gl_Position = Data[aIndex.x][aIndex.y]; +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/push-constant.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..c7b1b42e1b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/push-constant.flatten.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(push_constant, std430) uniform PushMe +{ + mat4 MVP; + mat2 Rot; // The MatrixStride will be 8 here. + float Arr[4]; +} registers; + +layout(location = 0) in vec2 Rot; +layout(location = 1) in vec4 Pos; +layout(location = 0) out vec2 vRot; +void main() +{ + gl_Position = registers.MVP * Pos; + vRot = registers.Rot * Rot + registers.Arr[2]; // Constant access should work even if array stride is just 4 here. +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..88c468c8f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/rowmajor.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + layout(column_major) mat4 uMVPR; + layout(row_major) mat4 uMVPC; + layout(row_major) mat2x4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec2 v = aVertex * uMVP; + gl_Position = uMVPR * aVertex + uMVPC * aVertex; +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/struct.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/struct.flatten.vert new file mode 100644 index 0000000000..936bb41b85 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/struct.flatten.vert @@ -0,0 +1,30 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light light; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * light.Color); +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/swizzle.flatten.vert b/third_party/spirv-cross/shaders-msl/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..e310cdf336 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/swizzle.flatten.vert @@ -0,0 +1,47 @@ +#version 310 es + +// comments note the 16b alignment boundaries (see GL spec 7.6.2.2 Standard Uniform Block Layout) +layout(std140) uniform UBO +{ + // 16b boundary + vec4 A; + // 16b boundary + vec2 B0; + vec2 B1; + // 16b boundary + float C0; + // 16b boundary (vec3 is aligned to 16b) + vec3 C1; + // 16b boundary + vec3 D0; + float D1; + // 16b boundary + float E0; + float E1; + float E2; + float E3; + // 16b boundary + float F0; + vec2 F1; + // 16b boundary (vec2 before us is aligned to 8b) + float F2; +}; + +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; +layout(location = 5) out vec4 oF; + +void main() +{ + gl_Position = vec4(0.0); + + oA = A; + oB = vec4(B0, B1); + oC = vec4(C0, C1) + vec4(C1.xy, C1.z, C0); // not packed + oD = vec4(D0, D1) + vec4(D0.xy, D0.z, D1); // packed - must convert for swizzle + oE = vec4(E0, E1, E2, E3); + oF = vec4(F0, F1, F2); +} diff --git a/third_party/spirv-cross/shaders-msl/flatten/types.flatten.frag b/third_party/spirv-cross/shaders-msl/flatten/types.flatten.frag new file mode 100644 index 0000000000..c1231445fc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/flatten/types.flatten.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(std140, binding = 0) uniform UBO0 +{ + vec4 a; + vec4 b; +}; + +layout(std140, binding = 1) uniform UBO1 +{ + ivec4 c; + ivec4 d; +}; + +layout(std140, binding = 2) uniform UBO2 +{ + uvec4 e; + uvec4 f; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(c) + vec4(d) + vec4(e) + vec4(f) + a + b; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/argument-buffers.msl2.argument.frag b/third_party/spirv-cross/shaders-msl/frag/argument-buffers.msl2.argument.frag new file mode 100644 index 0000000000..0d9f6cdb43 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -0,0 +1,61 @@ +#version 450 + +layout(std430, push_constant) uniform Push +{ + vec4 push; +} registers; + +layout(std140, set = 0, binding = 5) uniform UBO +{ + vec4 ubo; +}; + +layout(std430, set = 1, binding = 7) buffer SSBO +{ + vec4 ssbo; +}; + +layout(std430, set = 1, binding = 8) readonly buffer SSBOs +{ + vec4 ssbo; +} ssbos[2]; + +layout(std140, set = 2, binding = 4) uniform UBOs +{ + vec4 ubo; +} ubos[4]; + +layout(set = 0, binding = 2) uniform sampler2D uTexture; +layout(set = 0, binding = 6) uniform sampler2D uTextures[2]; +layout(set = 1, binding = 3) uniform texture2D uTexture2[4]; +layout(set = 1, binding = 10) uniform sampler uSampler[2]; +layout(location = 0) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +vec4 sample_in_function2() +{ + vec4 ret = texture(uTexture, vUV); + ret += texture(sampler2D(uTexture2[2], uSampler[1]), vUV); + ret += texture(uTextures[1], vUV); + ret += ssbo; + ret += ssbos[0].ssbo; + ret += registers.push; + return ret; +} + +vec4 sample_in_function() +{ + vec4 ret = sample_in_function2(); + ret += ubo; + ret += ubos[0].ubo; + return ret; +} + +void main() +{ + FragColor = sample_in_function(); + FragColor += ubo; + FragColor += ssbo; + FragColor += ubos[1].ubo; + FragColor += registers.push; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-component-io.frag b/third_party/spirv-cross/shaders-msl/frag/array-component-io.frag new file mode 100644 index 0000000000..8d88249e78 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-component-io.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 1, component = 0) out float A[2]; +layout(location = 1, component = 2) out vec2 B[2]; +layout(location = 0, component = 1) out float C[3]; +layout(location = 0, component = 3) out float D; + +layout(location = 1, component = 0) flat in float InA[2]; +layout(location = 1, component = 2) flat in vec2 InB[2]; +layout(location = 0, component = 1) flat in float InC[3]; +layout(location = 3, component = 1) sample in float InD; +layout(location = 4, component = 2) noperspective in float InE; +layout(location = 5, component = 3) centroid in float InF; + +void main() +{ + A = InA; + B = InB; + C = InC; + D = InD + InE + InF; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/shaders-msl/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..3493e0cccc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 v0; + +void main() +{ + float lut[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); + for (int i = 0; i < 4; i++, FragColor += lut[i]) + { + } +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-of-array-lut.frag b/third_party/spirv-cross/shaders-msl/frag/array-of-array-lut.frag new file mode 100644 index 0000000000..c401a3fe37 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-of-array-lut.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out float vOutput; +layout(location = 0) flat in int vIndex1; +layout(location = 1) flat in int vIndex2; + +const float FOO[2][3] = float[][](float[](1.0, 2.0, 3.0), float[](4.0, 5.0, 6.0)); + +void main() +{ + vOutput = FOO[vIndex1][vIndex2]; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..ec25ceb1c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D uSampler[4]; +layout(set = 0, binding = 1) uniform sampler2D uSamp; + +layout(set = 0, binding = 2) uniform UBO +{ + uint index; +} uUBO; + +layout(set = 0, binding = 3) uniform UBO2 +{ + uint index2; +}; + +layout(location = 0) in vec2 vUV; + +layout(location = 0) out vec4 FragColor; + +vec4 sample_in_func() +{ + return texture(uSampler[uUBO.index], vUV); +} + +vec4 sample_single_in_func(sampler2D s) +{ + return texture(s, vUV); +} + +void main() +{ + FragColor = sample_in_func(); + FragColor += sample_single_in_func(uSampler[index2]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag new file mode 100644 index 0000000000..ec25ceb1c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D uSampler[4]; +layout(set = 0, binding = 1) uniform sampler2D uSamp; + +layout(set = 0, binding = 2) uniform UBO +{ + uint index; +} uUBO; + +layout(set = 0, binding = 3) uniform UBO2 +{ + uint index2; +}; + +layout(location = 0) in vec2 vUV; + +layout(location = 0) out vec4 FragColor; + +vec4 sample_in_func() +{ + return texture(uSampler[uUBO.index], vUV); +} + +vec4 sample_single_in_func(sampler2D s) +{ + return texture(s, vUV); +} + +void main() +{ + FragColor = sample_in_func(); + FragColor += sample_single_in_func(uSampler[index2]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag new file mode 100644 index 0000000000..556cc9ca32 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag @@ -0,0 +1,31 @@ +#version 450 + +layout(set = 0, binding = 1) uniform sampler2D uSampler0[4]; +layout(set = 2, binding = 0) uniform sampler2D uSampler1; +layout(set = 1, binding = 4) uniform sampler2D uSamp; +layout(location = 0) in vec2 vUV; + +layout(location = 0) out vec4 FragColor; + +vec4 sample_in_func_1() +{ + return texture(uSampler0[2], vUV); +} + +vec4 sample_in_func_2() +{ + return texture(uSampler1, vUV); +} + +vec4 sample_single_in_func(sampler2D s) +{ + return texture(s, vUV); +} + +void main() +{ + FragColor = sample_in_func_1(); + FragColor += sample_in_func_2(); + FragColor += sample_single_in_func(uSampler0[1]); + FragColor += sample_single_in_func(uSampler1); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag new file mode 100644 index 0000000000..4694aa3ea2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag @@ -0,0 +1,23 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D uSampler[4]; +layout(set = 0, binding = 1) uniform sampler2D uSamp; +layout(location = 0) in vec2 vUV; + +layout(location = 0) out vec4 FragColor; + +vec4 sample_in_func() +{ + return texture(uSampler[2], vUV); +} + +vec4 sample_single_in_func(sampler2D s) +{ + return texture(s, vUV); +} + +void main() +{ + FragColor = sample_in_func(); + FragColor += sample_single_in_func(uSampler[1]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag b/third_party/spirv-cross/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag new file mode 100644 index 0000000000..24edb1a292 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/barycentric-nv-nopersp.msl22.frag @@ -0,0 +1,17 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; + +layout(set = 0, binding = 0) readonly buffer Vertices +{ + vec2 uvs[]; +}; + +void main () { + int prim = gl_PrimitiveID; + vec2 uv0 = uvs[3 * prim + 0]; + vec2 uv1 = uvs[3 * prim + 1]; + vec2 uv2 = uvs[3 * prim + 2]; + value = gl_BaryCoordNoPerspNV.x * uv0 + gl_BaryCoordNoPerspNV.y * uv1 + gl_BaryCoordNoPerspNV.z * uv2; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/barycentric-nv.msl22.frag b/third_party/spirv-cross/shaders-msl/frag/barycentric-nv.msl22.frag new file mode 100644 index 0000000000..7aec19fba4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/barycentric-nv.msl22.frag @@ -0,0 +1,17 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; + +layout(set = 0, binding = 0) readonly buffer Vertices +{ + vec2 uvs[]; +}; + +void main () { + int prim = gl_PrimitiveID; + vec2 uv0 = uvs[3 * prim + 0]; + vec2 uv1 = uvs[3 * prim + 1]; + vec2 uv2 = uvs[3 * prim + 2]; + value = gl_BaryCoordNV.x * uv0 + gl_BaryCoordNV.y * uv1 + gl_BaryCoordNV.z * uv2; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/basic.force-sample.frag b/third_party/spirv-cross/shaders-msl/frag/basic.force-sample.frag new file mode 100644 index 0000000000..dd9a8f8507 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/basic.force-sample.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/basic.frag b/third_party/spirv-cross/shaders-msl/frag/basic.frag new file mode 100644 index 0000000000..dd9a8f8507 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/basic.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/binary-func-unpack-pack-arguments.frag b/third_party/spirv-cross/shaders-msl/frag/binary-func-unpack-pack-arguments.frag new file mode 100644 index 0000000000..c0e5dabd2b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/binary-func-unpack-pack-arguments.frag @@ -0,0 +1,15 @@ +#version 450 +layout(location = 0) out float FragColor; + +layout(binding = 0, std140) uniform UBO +{ + vec3 color; + float v; +}; + +layout(location = 0) in vec3 vIn; + +void main() +{ + FragColor = dot(vIn, color); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/binary-unpack-pack-arguments.frag b/third_party/spirv-cross/shaders-msl/frag/binary-unpack-pack-arguments.frag new file mode 100644 index 0000000000..be30f84df7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/binary-unpack-pack-arguments.frag @@ -0,0 +1,15 @@ +#version 450 +layout(location = 0) out vec3 FragColor; + +layout(binding = 0, std140) uniform UBO +{ + vec3 color; + float v; +}; + +layout(location = 0) in vec3 vIn; + +void main() +{ + FragColor = cross(vIn, color - vIn); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/bitcasting.1d-as-2d.frag b/third_party/spirv-cross/shaders-msl/frag/bitcasting.1d-as-2d.frag new file mode 100644 index 0000000000..adaa749f75 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/bitcasting.1d-as-2d.frag @@ -0,0 +1,23 @@ +#version 450 + +layout(binding = 0) uniform sampler1D TextureBase; +layout(binding = 1) uniform sampler1D TextureDetail; + +layout(location = 0) in vec4 VertGeom; + +layout(location = 0) out vec4 FragColor0; +layout(location = 1) out vec4 FragColor1; + +void main() +{ + vec4 texSample0 = texture(TextureBase, VertGeom.x); + vec4 texSample1 = textureOffset(TextureDetail, VertGeom.x, 3); + + ivec4 iResult0 = floatBitsToInt(texSample0); + ivec4 iResult1 = floatBitsToInt(texSample1); + FragColor0 = (intBitsToFloat(iResult0) * intBitsToFloat(iResult1)); + + uvec4 uResult0 = floatBitsToUint(texSample0); + uvec4 uResult1 = floatBitsToUint(texSample1); + FragColor1 = (uintBitsToFloat(uResult0) * uintBitsToFloat(uResult1)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/bitcasting.frag b/third_party/spirv-cross/shaders-msl/frag/bitcasting.frag new file mode 100644 index 0000000000..5dac78ef33 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/bitcasting.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(binding = 0) uniform sampler2D TextureBase; +layout(binding = 1) uniform sampler2D TextureDetail; + +layout(location = 0) in vec4 VertGeom; + +layout(location = 0) out vec4 FragColor0; +layout(location = 1) out vec4 FragColor1; + +void main() +{ + vec4 texSample0 = texture(TextureBase, VertGeom.xy); + vec4 texSample1 = textureOffset(TextureDetail, VertGeom.xy, ivec2(3, 2)); + + ivec4 iResult0 = floatBitsToInt(texSample0); + ivec4 iResult1 = floatBitsToInt(texSample1); + FragColor0 = (intBitsToFloat(iResult0) * intBitsToFloat(iResult1)); + + uvec4 uResult0 = floatBitsToUint(texSample0); + uvec4 uResult1 = floatBitsToUint(texSample1); + FragColor1 = (uintBitsToFloat(uResult0) * uintBitsToFloat(uResult1)); +} \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.frag b/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.frag new file mode 100644 index 0000000000..70af7d3843 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(rgba8, binding = 0) uniform readonly imageBuffer buf; +layout(rgba8, binding = 1) uniform writeonly imageBuffer bufOut; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = imageLoad(buf, 0); + imageStore(bufOut, int(gl_FragCoord.x), FragColor); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag new file mode 100644 index 0000000000..70af7d3843 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/buffer-read-write.texture-buffer-native.msl21.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(rgba8, binding = 0) uniform readonly imageBuffer buf; +layout(rgba8, binding = 1) uniform writeonly imageBuffer bufOut; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = imageLoad(buf, 0); + imageStore(bufOut, int(gl_FragCoord.x), FragColor); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/builtins.frag b/third_party/spirv-cross/shaders-msl/frag/builtins.frag new file mode 100644 index 0000000000..99e6e2df5b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/builtins.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = gl_FragCoord + vColor; + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/clip-distance-varying.frag b/third_party/spirv-cross/shaders-msl/frag/clip-distance-varying.frag new file mode 100644 index 0000000000..df49bd515c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/clip-distance-varying.frag @@ -0,0 +1,10 @@ +#version 450 + +in float gl_ClipDistance[2]; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0 - gl_ClipDistance[0] - gl_ClipDistance[1]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/shaders-msl/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..47f93931ce --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +struct Foo +{ + vec4 a; + vec4 b; +}; + +layout(binding = 0) buffer UBO +{ + vec4 results[1024]; +}; + +layout(binding = 1) uniform highp isampler2D Buf; +layout(location = 0) flat in int vIn; +layout(location = 1) flat in int vIn2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec4 coords = texelFetch(Buf, ivec2(gl_FragCoord.xy), 0); + vec4 foo = results[coords.x % 16]; + + int c = vIn * vIn; + int d = vIn2 * vIn2; + FragColor = foo + foo + results[c + d]; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/shaders-msl/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..35fdbe8624 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +layout(binding = 0) uniform sampler2D Texture; +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTexCoord; + +void main() +{ + float f = texture(Texture, vTexCoord).x; + FragColor = vec4(f * f); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/constant-array.frag b/third_party/spirv-cross/shaders-msl/frag/constant-array.frag new file mode 100644 index 0000000000..b862cb1dbf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/constant-array.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; + +layout(location = 0) flat in int index; + +struct Foobar { float a; float b; }; + +vec4 resolve(Foobar f) +{ + return vec4(f.a + f.b); +} + +void main() +{ + const vec4 foo[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0)); + const vec4 foobars[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0))); + const Foobar foos[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0)); + + FragColor = foo[index] + foobars[index][index + 1] + resolve(Foobar(10.0, 20.0)) + resolve(foos[index]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/constant-composites.frag b/third_party/spirv-cross/shaders-msl/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/shaders-msl/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..1f21bef8c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,34 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) in vec4 vInput; + +void main() +{ + FragColor = vInput; + vec4 t = texture(uSampler, vInput.xy); + vec4 d0 = dFdx(vInput); + vec4 d1 = dFdy(vInput); + vec4 d2 = fwidth(vInput); + vec4 d3 = dFdxCoarse(vInput); + vec4 d4 = dFdyCoarse(vInput); + vec4 d5 = fwidthCoarse(vInput); + vec4 d6 = dFdxFine(vInput); + vec4 d7 = dFdyFine(vInput); + vec4 d8 = fwidthFine(vInput); + if (vInput.y > 10.0) + { + FragColor += t; + FragColor += d0; + FragColor += d1; + FragColor += d2; + FragColor += d3; + FragColor += d4; + FragColor += d5; + FragColor += d6; + FragColor += d7; + FragColor += d8; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/cull-distance-varying.frag b/third_party/spirv-cross/shaders-msl/frag/cull-distance-varying.frag new file mode 100644 index 0000000000..8bade07e1d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/cull-distance-varying.frag @@ -0,0 +1,10 @@ +#version 450 + +in float gl_CullDistance[2]; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0 - gl_CullDistance[0] - gl_CullDistance[1]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag new file mode 100644 index 0000000000..8f8c115b23 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/depth-array-texture-lod.lod-as-grad.1d-as-2d.msl23.frag @@ -0,0 +1,12 @@ +#version 450 core +layout(location = 0) out mediump vec4 o_color; +layout(location = 0) in highp vec3 v_texCoord; +layout(location = 1) in highp float v_lodBias; +layout(set = 0, binding = 0) uniform highp sampler1DArrayShadow u_sampler; +layout(set = 0, binding = 1) uniform buf0 { highp vec4 u_scale; }; +layout(set = 0, binding = 2) uniform buf1 { highp vec4 u_bias; }; + +void main() +{ + o_color = vec4(textureLod(u_sampler, v_texCoord, v_lodBias), 0.0, 0.0, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/depth-greater-than.frag b/third_party/spirv-cross/shaders-msl/frag/depth-greater-than.frag new file mode 100644 index 0000000000..8dcbcfdb4a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/depth-greater-than.frag @@ -0,0 +1,7 @@ +#version 450 +layout(depth_greater) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/depth-less-than.frag b/third_party/spirv-cross/shaders-msl/frag/depth-less-than.frag new file mode 100644 index 0000000000..cdcb80f778 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/depth-less-than.frag @@ -0,0 +1,7 @@ +#version 450 +layout(depth_less) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/depth-out-early-frag-tests.frag b/third_party/spirv-cross/shaders-msl/frag/depth-out-early-frag-tests.frag new file mode 100644 index 0000000000..4208d79a06 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/depth-out-early-frag-tests.frag @@ -0,0 +1,11 @@ +#version 430 +layout(depth_less) out float gl_FragDepth; +layout(early_fragment_tests) in; + +layout(location = 0) out vec4 color_out; + +void main() +{ + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988079071044921875; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/depth-out-no-early-frag-tests.frag b/third_party/spirv-cross/shaders-msl/frag/depth-out-no-early-frag-tests.frag new file mode 100644 index 0000000000..8450207998 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/depth-out-no-early-frag-tests.frag @@ -0,0 +1,10 @@ +#version 430 +layout(depth_less) out float gl_FragDepth; + +layout(location = 0) out vec4 color_out; + +void main() +{ + color_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_FragDepth = 0.699999988079071044921875; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/disable-frag-output.frag-output.frag b/third_party/spirv-cross/shaders-msl/frag/disable-frag-output.frag-output.frag new file mode 100644 index 0000000000..7e149b8640 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/disable-frag-output.frag-output.frag @@ -0,0 +1,25 @@ +#version 450 +#extension GL_ARB_shader_stencil_export : require + +layout(location = 0) out vec4 buf0; +layout(location = 1) out vec4 buf1; +layout(location = 2) out vec4 buf2; +layout(location = 3) out vec4 buf3; +layout(location = 4) out vec4 buf4; +layout(location = 5) out vec4 buf5; +layout(location = 6) out vec4 buf6; +layout(location = 7) out vec4 buf7; + +void main() { + buf0 = vec4(0, 0, 0, 1); + buf1 = vec4(1, 0, 0, 1); + buf2 = vec4(0, 1, 0, 1); + buf3 = vec4(0, 0, 1, 1); + buf4 = vec4(1, 0, 1, 0.5); + buf5 = vec4(0.25, 0.25, 0.25, 0.25); + buf6 = vec4(0.75, 0.75, 0.75, 0.75); + buf7 = vec4(1, 1, 1, 1); + gl_FragDepth = 0.9; + gl_FragStencilRefARB = 127; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/dual-source-blending.frag b/third_party/spirv-cross/shaders-msl/frag/dual-source-blending.frag new file mode 100644 index 0000000000..f322cf4c38 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/dual-source-blending.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0, index = 0) out vec4 FragColor0; +layout(location = 0, index = 1) out vec4 FragColor1; + +void main() +{ + FragColor0 = vec4(1.0); + FragColor1 = vec4(2.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/early-fragment-tests.frag b/third_party/spirv-cross/shaders-msl/frag/early-fragment-tests.frag new file mode 100644 index 0000000000..1a0acb950a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/early-fragment-tests.frag @@ -0,0 +1,9 @@ +#version 450 +layout(early_fragment_tests) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/false-loop-init.frag b/third_party/spirv-cross/shaders-msl/frag/false-loop-init.frag new file mode 100644 index 0000000000..7ce5b52bd7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/false-loop-init.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 accum; +layout(location = 0) out vec4 result; + +void main() +{ + result = vec4(0.0); + uint j; + for (int i = 0; i < 4; i += int(j)) + { + if (accum.y > 10.0) + j = 40u; + else + j = 30u; + result += accum; + } +} diff --git a/third_party/spirv-cross/shaders-msl/frag/flush_params.frag b/third_party/spirv-cross/shaders-msl/frag/flush_params.frag new file mode 100644 index 0000000000..8a26ad3a28 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/flush_params.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; + +struct Structy +{ + vec4 c; +}; + +void foo2(out Structy f) +{ + f.c = vec4(10.0); +} + +Structy foo() +{ + Structy f; + foo2(f); + return f; +} + +void main() +{ + Structy s = foo(); + FragColor = s.c; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/shaders-msl/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..1f91cca2a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +void main() +{ + FragColor = vec4(0.0); + for (int i = 0; i < 3; (0 > 1) ? 1 : i ++) + { + int a = i; + FragColor[a] += float(i); + } +} diff --git a/third_party/spirv-cross/shaders-msl/frag/for-loop-init.frag b/third_party/spirv-cross/shaders-msl/frag/for-loop-init.frag new file mode 100644 index 0000000000..0cde26765e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/for-loop-init.frag @@ -0,0 +1,52 @@ +#version 310 es +precision mediump float; +layout(location = 0) out int FragColor; + +void main() +{ + FragColor = 16; + + // Basic loop variable. + for (int i = 0; i < 25; i++) + FragColor += 10; + + // Multiple loop variables. + for (int i = 1, j = 4; i < 30; i++, j += 4) + FragColor += 11; + + // A potential loop variables, but we access it outside the loop, + // so cannot be one. + int k = 0; + for (; k < 20; k++) + FragColor += 12; + k += 3; + FragColor += k; + + // Potential loop variables, but the dominator is not trivial. + int l; + if (k == 40) + { + for (l = 0; l < 40; l++) + FragColor += 13; + return; + } + else + { + l = k; + FragColor += l; + } + + // Vectors cannot be loop variables + for (ivec2 i = ivec2(0); i.x < 10; i.x += 4) + { + FragColor += i.y; + } + + // Check that static expressions can be used before the loop header. + int m = 0; + m = k; + int o = m; + for (; m < 40; m++) + FragColor += m; + FragColor += o; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/fp16-packing.frag b/third_party/spirv-cross/shaders-msl/frag/fp16-packing.frag new file mode 100644 index 0000000000..98ca24e2f8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/fp16-packing.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) flat in uint FP16; +layout(location = 1) flat in vec2 FP32; +layout(location = 0) out vec2 FP32Out; +layout(location = 1) out uint FP16Out; + +void main() +{ + FP32Out = unpackHalf2x16(FP16); + FP16Out = packHalf2x16(FP32); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..9799a1392f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/frag-demote-checks.discard-checks.msl23.frag @@ -0,0 +1,33 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : enable + +layout(set=0, binding=0, std430) buffer foo_t +{ + float x; + uint y; +} foo; + +layout(r32ui, set=0, binding=1) uniform uimage2D bar; + +layout(location=0) out vec4 fragColor; + +vec4 frag_body() { + foo.x = 1.0f; + atomicExchange(foo.y, 0); + if (int(gl_FragCoord.x) == 3) + demote; + imageStore(bar, ivec2(gl_FragCoord.xy), uvec4(1)); + atomicAdd(foo.y, 42); + imageAtomicOr(bar, ivec2(gl_FragCoord.xy), 0x3e); + atomicAnd(foo.y, 0xffff); + atomicXor(foo.y, 0xffffff00); + atomicMin(foo.y, 1); + imageAtomicMax(bar, ivec2(gl_FragCoord.xy), 100); + imageAtomicCompSwap(bar, ivec2(gl_FragCoord.xy), 100, 42); + return vec4(1.0f, float(helperInvocationEXT()), 0.0f, 1.0f); +} + +void main() { + fragColor = frag_body(); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag new file mode 100644 index 0000000000..a7f37a5a70 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks-continue-block.discard-checks.msl23.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(binding=0, set=0, std430) buffer foo +{ + int x; +}; + +layout(location=0) out vec4 fragColor; + +void main(void) +{ + if (gl_FragCoord.y == 7) + discard; + for (x = 0; x < gl_FragCoord.x; ++x) + ; + fragColor = vec4(x, 0, 0, 1); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag new file mode 100644 index 0000000000..8b40e60c19 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/frag-discard-checks.discard-checks.msl23.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(set=0, binding=0, std430) buffer foo_t +{ + float x; + uint y; +} foo; + +layout(r32ui, set=0, binding=1) uniform uimage2D bar; + +layout(location=0) out vec4 fragColor; + +vec4 frag_body() { + foo.x = 1.0f; + atomicExchange(foo.y, 0); + if (int(gl_FragCoord.x) == 3) + discard; + imageStore(bar, ivec2(gl_FragCoord.xy), uvec4(1)); + atomicAdd(foo.y, 42); + imageAtomicOr(bar, ivec2(gl_FragCoord.xy), 0x3e); + atomicAnd(foo.y, 0xffff); + atomicXor(foo.y, 0xffffff00); + atomicMin(foo.y, 1); + imageAtomicMax(bar, ivec2(gl_FragCoord.xy), 100); + imageAtomicCompSwap(bar, ivec2(gl_FragCoord.xy), 100, 42); + return vec4(1.0f, 0.0f, 0.0f, 1.0f); +} + +void main() { + fragColor = frag_body(); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/fragment-component-padding.pad-fragment.frag b/third_party/spirv-cross/shaders-msl/frag/fragment-component-padding.pad-fragment.frag new file mode 100644 index 0000000000..240c59b9bb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/fragment-component-padding.pad-fragment.frag @@ -0,0 +1,18 @@ +#version 450 +layout(location = 0) out float FragColors[2]; +layout(location = 2) out vec2 FragColor2; +layout(location = 3) out vec3 FragColor3; +layout(location = 0) in vec3 vColor; + +void set_globals() +{ + FragColors[0] = vColor.x; + FragColors[1] = vColor.y; + FragColor2 = vColor.xz; + FragColor3 = vColor.zzz; +} + +void main() +{ + set_globals(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/front-facing.frag b/third_party/spirv-cross/shaders-msl/frag/front-facing.frag new file mode 100644 index 0000000000..90ca1abf4e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/front-facing.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + if (gl_FrontFacing) + FragColor = vA; + else + FragColor = vB; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/gather-dref.frag b/third_party/spirv-cross/shaders-msl/frag/gather-dref.frag new file mode 100644 index 0000000000..a8aac56cb5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/gather-dref.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(binding = 0) uniform mediump sampler2DShadow uT; +layout(location = 0) in vec3 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureGather(uT, vUV.xy, vUV.z); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/gather-offset.frag b/third_party/spirv-cross/shaders-msl/frag/gather-offset.frag new file mode 100644 index 0000000000..409317ab56 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/gather-offset.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uT; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureGather(uT, vec2(0.5), 3); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/helper-invocation.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/helper-invocation.msl21.frag new file mode 100644 index 0000000000..1da8c57631 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/helper-invocation.msl21.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(binding = 0) uniform sampler2D uSampler; + +vec4 foo() +{ + vec4 color; + if (!gl_HelperInvocation) + color = textureLod(uSampler, vUV, 0.0); + else + color = vec4(1.0); + return color; +} + +void main() +{ + FragColor = foo(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag b/third_party/spirv-cross/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag new file mode 100644 index 0000000000..28d2b4ae8d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag @@ -0,0 +1,26 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(set = 0, binding = 0) uniform sampler2D uSamplers[10000]; +layout(set = 2, binding = 0) uniform sampler2D uSampler; + +layout(set = 1, binding = 0) uniform UBO +{ + vec4 v; +} vs[10000]; + +vec4 samp_array() +{ + return texture(uSamplers[9999], vUV) + vs[5000].v; +} + +vec4 samp_single() +{ + return texture(uSampler, vUV); +} + +void main() +{ + FragColor = samp_array() + samp_single(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/illegal-name-test-0.frag b/third_party/spirv-cross/shaders-msl/frag/illegal-name-test-0.frag new file mode 100644 index 0000000000..8e6c11d1d3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/illegal-name-test-0.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 fragment = vec4(10.0); + vec4 compute = vec4(10.0); + vec4 kernel = vec4(10.0); + vec4 vertex = vec4(10.0); + FragColor = fragment + compute + kernel + vertex; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/image-query-lod.msl22.frag b/third_party/spirv-cross/shaders-msl/frag/image-query-lod.msl22.frag new file mode 100644 index 0000000000..33d5630e62 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/image-query-lod.msl22.frag @@ -0,0 +1,33 @@ +#version 450 + +layout(location = 0) out vec2 FragColor; +layout(set = 0, binding = 0) uniform sampler2D uSampler2D; +layout(set = 0, binding = 1) uniform sampler3D uSampler3D; +layout(set = 0, binding = 2) uniform samplerCube uSamplerCube; +layout(set = 0, binding = 3) uniform sampler uSampler; +layout(set = 0, binding = 4) uniform texture2D uTexture2D; +layout(set = 0, binding = 5) uniform texture3D uTexture3D; +layout(set = 0, binding = 6) uniform textureCube uTextureCube; +layout(location = 0) in vec3 vUV; + +void from_function() +{ + FragColor += textureQueryLod(uSampler2D, vUV.xy); + FragColor += textureQueryLod(uSampler3D, vUV); + FragColor += textureQueryLod(uSamplerCube, vUV); + FragColor += textureQueryLod(sampler2D(uTexture2D, uSampler), vUV.xy); + FragColor += textureQueryLod(sampler3D(uTexture3D, uSampler), vUV); + FragColor += textureQueryLod(samplerCube(uTextureCube, uSampler), vUV); +} + +void main() +{ + FragColor = vec2(0.0); + FragColor += textureQueryLod(uSampler2D, vUV.xy); + FragColor += textureQueryLod(uSampler3D, vUV); + FragColor += textureQueryLod(uSamplerCube, vUV); + FragColor += textureQueryLod(sampler2D(uTexture2D, uSampler), vUV.xy); + FragColor += textureQueryLod(sampler3D(uTexture3D, uSampler), vUV); + FragColor += textureQueryLod(samplerCube(uTextureCube, uSampler), vUV); + from_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/in_block.frag b/third_party/spirv-cross/shaders-msl/frag/in_block.frag new file mode 100644 index 0000000000..59b97074ec --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/in_block.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(location = 2) in VertexOut +{ + vec4 color; + vec4 color2; +} inputs; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = inputs.color + inputs.color2; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag b/third_party/spirv-cross/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag new file mode 100644 index 0000000000..a7529b1883 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag @@ -0,0 +1,19 @@ +#version 450 + +struct Foo +{ + float a; + float b; +}; + +layout(location = 1) in Foo foos[4]; +layout(location = 10) in Foo bars[4]; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor.x = foos[0].a; + FragColor.y = foos[1].b; + FragColor.z = foos[2].a; + FragColor.w = bars[3].b.x; +} \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-msl/frag/in_mat.frag b/third_party/spirv-cross/shaders-msl/frag/in_mat.frag new file mode 100644 index 0000000000..dd0b5d0350 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/in_mat.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(binding = 1) uniform samplerCube samplerColor; + +layout(location = 0) in vec3 inPos; +layout(location = 1) in vec3 inNormal; +layout(location = 2) in mat4 inInvModelView; +layout(location = 6) in float inLodBias; +layout(location = 0) out vec4 outFragColor; + +void main() +{ + vec3 cI = normalize(inPos); + vec3 cR = reflect(cI, normalize(inNormal)); + cR = vec3((inInvModelView * vec4(cR, 0.0)).xyz); + cR.x *= (-1.0); + outFragColor = texture(samplerColor, cR, inLodBias); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag new file mode 100644 index 0000000000..b3d44c9436 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInputMS uInput) +{ + return subpassLoad(uInput, gl_SampleID); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + load_subpasses(uSubpass0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.frag new file mode 100644 index 0000000000..b3d44c9436 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInputMS uInput) +{ + return subpassLoad(uInput, gl_SampleID); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + load_subpasses(uSubpass0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag new file mode 100644 index 0000000000..b3d44c9436 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInputMS uInput) +{ + return subpassLoad(uInput, gl_SampleID); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + load_subpasses(uSubpass0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment.arrayed-subpass.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment.arrayed-subpass.frag new file mode 100644 index 0000000000..877d0525a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment.arrayed-subpass.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInput uInput) +{ + return subpassLoad(uInput); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0) + load_subpasses(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment.frag new file mode 100644 index 0000000000..877d0525a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInput uInput) +{ + return subpassLoad(uInput); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0) + load_subpasses(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/input-attachment.multiview.frag b/third_party/spirv-cross/shaders-msl/frag/input-attachment.multiview.frag new file mode 100644 index 0000000000..877d0525a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/input-attachment.multiview.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +vec4 load_subpasses(mediump subpassInput uInput) +{ + return subpassLoad(uInput); +} + +void main() +{ + FragColor = subpassLoad(uSubpass0) + load_subpasses(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers-block.frag b/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers-block.frag new file mode 100644 index 0000000000..4842089324 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers-block.frag @@ -0,0 +1,19 @@ +#version 450 + +struct Input { + vec2 v0; + vec2 v1; + vec3 v2; + vec4 v3; + float v4; + float v5; + float v6; +}; + +layout(location=0) in centroid noperspective Input inp; + +layout(location=0) out vec4 FragColor; + +void main() { + FragColor = vec4(inp.v0.x + inp.v1.y, inp.v2.xy, inp.v3.w * inp.v4 + inp.v5 - inp.v6); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers.frag b/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers.frag new file mode 100644 index 0000000000..ef8a4807fe --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/interpolation-qualifiers.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location=0) in vec2 v0; +layout(location=1) in noperspective vec2 v1; +layout(location=2) in centroid vec3 v2; +layout(location=3) in centroid noperspective vec4 v3; +layout(location=4) in sample float v4; +layout(location=5) in sample noperspective float v5; +layout(location=6) in flat float v6; + +layout(location=0) out vec4 FragColor; + +void main() { + FragColor = vec4(v0.x + v1.y, v2.xy, v3.w * v4 + v5 - v6); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/lut-promotion.frag b/third_party/spirv-cross/shaders-msl/frag/lut-promotion.frag new file mode 100644 index 0000000000..0cdc8148f9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/lut-promotion.frag @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; +layout(location = 0) out float FragColor; +layout(location = 0) flat in int index; + +const float LUT[16] = float[]( + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0); + +void main() +{ + // Try reading LUTs, both in branches and not branch. + FragColor = LUT[index]; + if (index < 10) + FragColor += LUT[index ^ 1]; + else + FragColor += LUT[index & 1]; + + // Not declared as a LUT, but can be promoted to one. + vec4 foo[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + FragColor += foo[index & 3].y; + } + else + { + FragColor += foo[index & 1].x; + } + + // Not declared as a LUT, but this cannot be promoted, because we have a partial write. + vec4 foobar[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + foobar[1].z = 20.0; + } + FragColor += foobar[index & 3].z; + + // Not declared as a LUT, but this cannot be promoted, because we have two complete writes. + vec4 baz[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[index & 3].z; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/mix.frag b/third_party/spirv-cross/shaders-msl/frag/mix.frag new file mode 100644 index 0000000000..a5d589dd08 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/mix.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vIn0; +layout(location = 1) in vec4 vIn1; +layout(location = 2) in float vIn2; +layout(location = 3) in float vIn3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + bvec4 l = bvec4(false, true, false, false); + FragColor = mix(vIn0, vIn1, l); + + bool f = true; + FragColor = vec4(mix(vIn2, vIn3, f)); + + FragColor = f ? vIn0 : vIn1; + FragColor = vec4(f ? vIn2 : vIn3); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/modf-access-tracking-function.frag b/third_party/spirv-cross/shaders-msl/frag/modf-access-tracking-function.frag new file mode 100644 index 0000000000..c1f1a1266f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/modf-access-tracking-function.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +vec4 modf_inner() +{ + return modf(v, vo1); +} + +void main() +{ + vo0 = modf_inner(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/mrt-array.frag b/third_party/spirv-cross/shaders-msl/frag/mrt-array.frag new file mode 100644 index 0000000000..0460c72ab9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/mrt-array.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor[4]; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void write_deeper_in_function() +{ + FragColor[3] = vA * vB; +} + +void write_in_function() +{ + FragColor[2] = vA - vB; + write_deeper_in_function(); +} + +void main() +{ + FragColor[0] = mod(vA, vB); + FragColor[1] = vA + vB; + write_in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/nonuniform-qualifier.msl2.frag b/third_party/spirv-cross/shaders-msl/frag/nonuniform-qualifier.msl2.frag new file mode 100644 index 0000000000..ba9dd7fb2c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/nonuniform-qualifier.msl2.frag @@ -0,0 +1,28 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(binding = 0) uniform texture2D uSamplers[8]; +layout(binding = 8) uniform sampler2D uCombinedSamplers[8]; +layout(binding = 1) uniform sampler uSamps[7]; +layout(location = 0) flat in int vIndex; +layout(location = 1) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform UBO +{ + vec4 v[64]; +} ubos[2]; + +layout(set = 0, binding = 2) readonly buffer SSBO +{ + vec4 v[]; +} ssbos[2]; + +void main() +{ + int i = vIndex; + FragColor = texture(sampler2D(uSamplers[nonuniformEXT(i + 10)], uSamps[nonuniformEXT(i + 40)]), vUV); + FragColor = texture(uCombinedSamplers[nonuniformEXT(i + 10)], vUV); + FragColor += ubos[nonuniformEXT(i + 20)].v[nonuniformEXT(i + 40)]; + FragColor += ssbos[nonuniformEXT(i + 50)].v[nonuniformEXT(i + 60)]; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/packed-expression-vector-shuffle.frag b/third_party/spirv-cross/shaders-msl/frag/packed-expression-vector-shuffle.frag new file mode 100644 index 0000000000..9958443813 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/packed-expression-vector-shuffle.frag @@ -0,0 +1,15 @@ +#version 450 +layout(location = 0) out vec4 FragColor; + +layout(binding = 0, std140) uniform UBO +{ + vec3 color; + float v; +}; + +void main() +{ + vec4 f = vec4(1.0); + f.rgb = color; + FragColor = f; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/packing-test-3.frag b/third_party/spirv-cross/shaders-msl/frag/packing-test-3.frag new file mode 100644 index 0000000000..56ad6f5f1b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/packing-test-3.frag @@ -0,0 +1,36 @@ +#version 450 + +struct VertexOutput +{ + vec4 HPosition; +}; + +struct TestStruct +{ + vec3 position; + float radius; +}; + +layout(binding = 0, std140) uniform CB0 +{ + TestStruct CB0[16]; +} _24; + +layout(location = 0) out vec4 _entryPointOutput; + +vec4 _main(VertexOutput IN) +{ + TestStruct st; + st.position = _24.CB0[1].position; + st.radius = _24.CB0[1].radius; + vec4 col = vec4(st.position, st.radius); + return col; +} + +void main() +{ + VertexOutput IN; + IN.HPosition = gl_FragCoord; + VertexOutput param = IN; + _entryPointOutput = _main(param); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag b/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag new file mode 100644 index 0000000000..ceac8cc50e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.argument.frag @@ -0,0 +1,36 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(pixel_interlock_ordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2, rgba8) uniform readonly image2D img3; +layout(binding = 3) coherent buffer Buffer +{ + int foo; + uint bar; +}; +layout(binding = 4) buffer Buffer2 +{ + uint quux; +}; + +layout(binding = 5, rgba8) uniform writeonly image2D img4; +layout(binding = 6) buffer Buffer3 +{ + int baz; +}; + +void main() +{ + // Deliberately outside the critical section to test usage tracking. + baz = 0; + imageStore(img4, ivec2(1, 1), vec4(1.0, 0.0, 0.0, 1.0)); + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), imageLoad(img3, ivec2(0, 0))); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, quux); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.frag b/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.frag new file mode 100644 index 0000000000..ceac8cc50e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/pixel-interlock-ordered.msl2.frag @@ -0,0 +1,36 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(pixel_interlock_ordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2, rgba8) uniform readonly image2D img3; +layout(binding = 3) coherent buffer Buffer +{ + int foo; + uint bar; +}; +layout(binding = 4) buffer Buffer2 +{ + uint quux; +}; + +layout(binding = 5, rgba8) uniform writeonly image2D img4; +layout(binding = 6) buffer Buffer3 +{ + int baz; +}; + +void main() +{ + // Deliberately outside the critical section to test usage tracking. + baz = 0; + imageStore(img4, ivec2(1, 1), vec4(1.0, 0.0, 0.0, 1.0)); + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), imageLoad(img3, ivec2(0, 0))); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, quux); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/pls.frag b/third_party/spirv-cross/shaders-msl/frag/pls.frag new file mode 100644 index 0000000000..e3863e4e0e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/pls.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 PLSIn0; +layout(location = 1) in vec4 PLSIn1; +layout(location = 2) in vec4 PLSIn2; +layout(location = 3) in vec4 PLSIn3; + +layout(location = 0) out vec4 PLSOut0; +layout(location = 1) out vec4 PLSOut1; +layout(location = 2) out vec4 PLSOut2; +layout(location = 3) out vec4 PLSOut3; + +void main() +{ + PLSOut0 = 2.0 * PLSIn0; + PLSOut1 = 6.0 * PLSIn1; + PLSOut2 = 7.0 * PLSIn2; + PLSOut3 = 4.0 * PLSIn3; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.ios.msl2.frag b/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.ios.msl2.frag new file mode 100644 index 0000000000..4f134b4f3b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.ios.msl2.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_ARB_post_depth_coverage : require + +layout(post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SampleMaskIn[0]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.msl23.frag new file mode 100644 index 0000000000..4f134b4f3b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/post-depth-coverage.msl23.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_ARB_post_depth_coverage : require + +layout(post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SampleMaskIn[0]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/private-variable-prototype-declaration.frag b/third_party/spirv-cross/shaders-msl/frag/private-variable-prototype-declaration.frag new file mode 100644 index 0000000000..7d2bba5aa0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/private-variable-prototype-declaration.frag @@ -0,0 +1,20 @@ +#version 450 + +struct AStruct { vec4 foobar; }; + +void someFunction(out AStruct s) { s.foobar = vec4(1.0); } + +highp vec3 global_variable; + +void otherFunction() { + global_variable = vec3(1.0); +} + +layout(location = 0) out vec3 FragColor; + +void main() { + AStruct inputs; + someFunction(inputs); + otherFunction(); + FragColor = global_variable; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag b/third_party/spirv-cross/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag new file mode 100644 index 0000000000..d2d94fcbd9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/ray-query-object-in-function.spv14.vk.msl24.frag @@ -0,0 +1,31 @@ +#version 460 + +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_ray_query : enable + +layout(location = 0) in vec4 inPos; +layout(location = 0) out vec4 outColor; + +layout(binding = 0) uniform accelerationStructureEXT topLevelAS; + +uint doRay(vec3 rayOrigin, vec3 rayDirection, float rayDistance) { + rayQueryEXT rayQuery; + rayQueryInitializeEXT(rayQuery, topLevelAS, gl_RayFlagsTerminateOnFirstHitEXT, 0xFF, + rayOrigin, 0.001, rayDirection, rayDistance); + + while(rayQueryProceedEXT(rayQuery)) + ; + + return rayQueryGetIntersectionTypeEXT(rayQuery, true); +} + +void main() { + vec3 rayOrigin = vec3(inPos.xy*4.0-vec2(2.0),1.0); + vec3 rayDirection = vec3(0,0,-1); + float rayDistance = 2.0; + + if(doRay(rayOrigin,rayDirection,rayDistance) == gl_RayQueryCommittedIntersectionNoneEXT) + discard; + + outColor = inPos; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/read-cull-clip-distance-in-function.frag b/third_party/spirv-cross/shaders-msl/frag/read-cull-clip-distance-in-function.frag new file mode 100644 index 0000000000..0b82dc2df9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/read-cull-clip-distance-in-function.frag @@ -0,0 +1,20 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +in float gl_CullDistance[2]; +in float gl_ClipDistance[2]; + +vec4 read_in_func() +{ + return vec4( + gl_CullDistance[0], + gl_CullDistance[1], + gl_ClipDistance[0], + gl_ClipDistance[1]); +} + +void main() +{ + FragColor = read_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/readonly-ssbo.frag b/third_party/spirv-cross/shaders-msl/frag/readonly-ssbo.frag new file mode 100644 index 0000000000..9d7cff66fd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/readonly-ssbo.frag @@ -0,0 +1,16 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +layout(binding = 0, std430) readonly buffer SSBO +{ + vec4 v; +}; + +vec4 read_from_function() +{ + return v; +} + +void main() +{ + FragColor = v + read_from_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/return-value-after-discard-terminator.frag b/third_party/spirv-cross/shaders-msl/frag/return-value-after-discard-terminator.frag new file mode 100644 index 0000000000..2ab410cb1b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/return-value-after-discard-terminator.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(set = 0, binding = 0, std430) buffer buff_t +{ + int m0[1024]; +} buff; + +layout(location = 0) out vec4 frag_clr; + +void main() +{ + ivec2 frag_coord = ivec2(ivec4(gl_FragCoord).xy); + int buff_idx = (frag_coord.y * 32) + frag_coord.x; + frag_clr = vec4(0.0, 0.0, 1.0, 1.0); + buff.m0[buff_idx] = 1; + discard; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag b/third_party/spirv-cross/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag new file mode 100644 index 0000000000..9a855ac7a8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag @@ -0,0 +1,29 @@ +#version 450 + +layout(set = 0, binding = 0) uniform texture2D uTexture; +layout(set = 0, binding = 1) uniform sampler uSampler; +layout(set = 0, binding = 2) uniform samplerShadow uSamplerShadow; + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vUV; + +float sample_normal2(texture2D tex) +{ + return texture(sampler2D(tex, uSampler), vUV.xy).x; +} + +float sample_normal(texture2D tex) +{ + return sample_normal2(tex); +} + +float sample_comp(texture2D tex) +{ + return texture(sampler2DShadow(tex, uSamplerShadow), vUV); +} + +void main() +{ + FragColor = sample_normal(uTexture); + FragColor += sample_comp(uTexture); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-depth-separate-image-sampler.frag b/third_party/spirv-cross/shaders-msl/frag/sample-depth-separate-image-sampler.frag new file mode 100644 index 0000000000..db1f5e983a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-depth-separate-image-sampler.frag @@ -0,0 +1,22 @@ +#version 450 + +layout(set = 0, binding = 0) uniform texture2D uDepth; +layout(set = 0, binding = 1) uniform texture2D uColor; +layout(set = 0, binding = 2) uniform sampler uSampler; +layout(set = 0, binding = 3) uniform samplerShadow uSamplerShadow; +layout(location = 0) out float FragColor; + +float sample_depth_from_function(texture2D uT, samplerShadow uS) +{ + return texture(sampler2DShadow(uT, uS), vec3(0.5)); +} + +float sample_color_from_function(texture2D uT, sampler uS) +{ + return texture(sampler2D(uT, uS), vec2(0.5)).x; +} + +void main() +{ + FragColor = sample_depth_from_function(uDepth, uSamplerShadow) + sample_color_from_function(uColor, uSampler); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag b/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag new file mode 100644 index 0000000000..b78ee61e81 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.force-sample.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = gl_SampleMaskIn[0]; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag b/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag new file mode 100644 index 0000000000..b78ee61e81 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = gl_SampleMaskIn[0]; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag b/third_party/spirv-cross/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag new file mode 100644 index 0000000000..c3eaf5e19f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-mask-not-used.fixed-sample-mask.frag @@ -0,0 +1,8 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-mask.fixed-sample-mask.frag b/third_party/spirv-cross/shaders-msl/frag/sample-mask.fixed-sample-mask.frag new file mode 100644 index 0000000000..33ff0b2e69 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-mask.fixed-sample-mask.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = 0; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-mask.frag b/third_party/spirv-cross/shaders-msl/frag/sample-mask.frag new file mode 100644 index 0000000000..33ff0b2e69 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-mask.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(1.0); + gl_SampleMask[0] = 0; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-position-func.frag b/third_party/spirv-cross/shaders-msl/frag/sample-position-func.frag new file mode 100644 index 0000000000..d34b8968d2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-position-func.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in flat int index; + +layout(location = 0) out vec4 FragColor; + +vec4 getColor(int i) +{ + return vec4(gl_SamplePosition, i, 1.0); +} + +void main() +{ + FragColor = getColor(index); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-position.frag b/third_party/spirv-cross/shaders-msl/frag/sample-position.frag new file mode 100644 index 0000000000..6f7502814d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-position.frag @@ -0,0 +1,8 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SamplePosition, gl_SampleID, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag new file mode 100644 index 0000000000..202dba0bdf --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-id.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2DArray tex; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(tex, vec3(gl_FragCoord.xy, float(gl_SampleID))); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag new file mode 100644 index 0000000000..b131fb032c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-input.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2DArray tex; + +layout(location = 0) sample in float foo; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(tex, vec3(gl_FragCoord.xy, foo)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag new file mode 100644 index 0000000000..c8c3be96df --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord-sample-pos.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D tex; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(tex, gl_FragCoord.xy - gl_SamplePosition); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag new file mode 100644 index 0000000000..a6b47e4bbe --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sample-rate-frag-coord.force-sample.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler2D tex; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = texture(tex, gl_FragCoord.xy); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag new file mode 100644 index 0000000000..f4526f39d0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.1d-as-2d.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in float vTex; +layout(binding = 0) uniform sampler1D uSampler; + +void main() +{ + FragColor += texture(uSampler, vTex, 2.0) + + textureLod(uSampler, vTex, 3.0) + + textureGrad(uSampler, vTex, 5.0, 8.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.frag new file mode 100644 index 0000000000..f4526f39d0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-1d-lod.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in float vTex; +layout(binding = 0) uniform sampler1D uSampler; + +void main() +{ + FragColor += texture(uSampler, vTex, 2.0) + + textureLod(uSampler, vTex, 3.0) + + textureGrad(uSampler, vTex, 5.0, 8.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag new file mode 100644 index 0000000000..158c760031 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-bias.msl23.1d-as-2d.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform texture1DArray uTex; +layout(binding = 1) uniform samplerShadow uShadow; +layout(location = 0) in vec3 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = texture(sampler1DArrayShadow(uTex, uShadow), vUV, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.frag new file mode 100644 index 0000000000..9fd9e3ca09 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform texture2DArray uTex; +layout(binding = 1) uniform samplerShadow uShadow; +layout(location = 0) in vec4 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = textureGrad(sampler2DArrayShadow(uTex, uShadow), vUV, vec2(0.0), vec2(0.0)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag new file mode 100644 index 0000000000..9fd9e3ca09 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.ios.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform texture2DArray uTex; +layout(binding = 1) uniform samplerShadow uShadow; +layout(location = 0) in vec4 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = textureGrad(sampler2DArrayShadow(uTex, uShadow), vUV, vec2(0.0), vec2(0.0)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag new file mode 100644 index 0000000000..5c1c8937fb --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-compare-cascade-gradient.msl23.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(binding = 0) uniform texture2DArray uTex; +layout(binding = 1) uniform samplerShadow uShadow; +layout(location = 0) in vec4 vUV; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = textureGrad(sampler2DArrayShadow(uTex, uShadow), vUV, vec2(0.0), vec2(0.0)) + textureGrad(sampler2DArrayShadow(uTex, uShadow), vUV, vec2(1.0), vec2(1.0)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-image-arrays.msl2.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-image-arrays.msl2.frag new file mode 100644 index 0000000000..42370d9728 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-image-arrays.msl2.frag @@ -0,0 +1,33 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in vec2 vTex; +layout(location = 1) flat in int vIndex; +layout(binding = 0) uniform sampler2D uSampler[4]; +layout(binding = 4) uniform sampler uSamplers[4]; +layout(binding = 8) uniform texture2D uTextures[4]; + +vec4 sample_from_argument(sampler2D samplers[4]) +{ + return texture(samplers[vIndex], vTex + 0.2); +} + +vec4 sample_single_from_argument(sampler2D samp) +{ + return texture(samp, vTex + 0.3); +} + +vec4 sample_from_global() +{ + return texture(uSampler[vIndex], vTex + 0.1); +} + +void main() +{ + FragColor = vec4(0.0); + FragColor += texture(sampler2D(uTextures[2], uSamplers[1]), vTex); + FragColor += texture(uSampler[vIndex], vTex); + FragColor += sample_from_global(); + FragColor += sample_from_argument(uSampler); + FragColor += sample_single_from_argument(uSampler[3]); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler-ms.frag b/third_party/spirv-cross/shaders-msl/frag/sampler-ms.frag new file mode 100644 index 0000000000..6593928271 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler-ms.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DMS uSampler; +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + FragColor = + texelFetch(uSampler, coord, 0) + + texelFetch(uSampler, coord, 1) + + texelFetch(uSampler, coord, 2) + + texelFetch(uSampler, coord, 3); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/sampler.frag b/third_party/spirv-cross/shaders-msl/frag/sampler.frag new file mode 100644 index 0000000000..e38f76886a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/sampler.frag @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +vec4 sample_texture(sampler2D tex, vec2 uv) +{ + return texture(tex, uv); +} + +void main() +{ + FragColor = vColor * sample_texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/shaders-msl/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..486ed90bd5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/scalar-refract-reflect.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vRefract; + +void main() +{ + FragColor = refract(vRefract.x, vRefract.y, vRefract.z); + FragColor += reflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/separate-image-sampler-argument.frag b/third_party/spirv-cross/shaders-msl/frag/separate-image-sampler-argument.frag new file mode 100644 index 0000000000..0475b019d2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/separate-image-sampler-argument.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 1) uniform mediump texture2D uDepth; +layout(location = 0) out vec4 FragColor; + +vec4 samp(texture2D t, mediump sampler s) +{ + return texture(sampler2D(t, s), vec2(0.5)); +} + +void main() +{ + FragColor = samp(uDepth, uSampler); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/shader-arithmetic-8bit.frag b/third_party/spirv-cross/shaders-msl/frag/shader-arithmetic-8bit.frag new file mode 100644 index 0000000000..9416f5ba21 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/shader-arithmetic-8bit.frag @@ -0,0 +1,88 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require + +layout(location = 0) flat in ivec4 vColor; +layout(location = 0) out ivec4 FragColorInt; +layout(location = 1) out uvec4 FragColorUint; + +layout(push_constant, std140) uniform Push +{ + int8_t i8; + uint8_t u8; +} registers; + +layout(binding = 1, std140) uniform UBO +{ + int8_t i8; + uint8_t u8; +} ubo; + +layout(binding = 2, std430) buffer SSBO +{ + int8_t i8[16]; + uint8_t u8[16]; +} ssbo; + +void packing_int8() +{ + int16_t i16 = 10s; + int i32 = 20; + + i8vec2 i8_2 = unpack8(i16); + i8vec4 i8_4 = unpack8(i32); + i16 = pack16(i8_2); + i32 = pack32(i8_4); + ssbo.i8[0] = i8_4.x; + ssbo.i8[1] = i8_4.y; + ssbo.i8[2] = i8_4.z; + ssbo.i8[3] = i8_4.w; +} + +void packing_uint8() +{ + uint16_t u16 = 10us; + uint u32 = 20u; + + u8vec2 u8_2 = unpack8(u16); + u8vec4 u8_4 = unpack8(u32); + u16 = pack16(u8_2); + u32 = pack32(u8_4); + + ssbo.u8[0] = u8_4.x; + ssbo.u8[1] = u8_4.y; + ssbo.u8[2] = u8_4.z; + ssbo.u8[3] = u8_4.w; +} + +void compute_int8() +{ + i8vec4 tmp = i8vec4(vColor); + tmp += registers.i8; + tmp += int8_t(-40); + tmp += i8vec4(-50); + tmp += i8vec4(10, 20, 30, 40); + tmp += ssbo.i8[4]; + tmp += ubo.i8; + FragColorInt = ivec4(tmp); +} + +void compute_uint8() +{ + u8vec4 tmp = u8vec4(vColor); + tmp += registers.u8; + tmp += uint8_t(-40); + tmp += u8vec4(-50); + tmp += u8vec4(10, 20, 30, 40); + tmp += ssbo.u8[4]; + tmp += ubo.u8; + FragColorUint = uvec4(tmp); +} + +void main() +{ + packing_int8(); + packing_uint8(); + compute_int8(); + compute_uint8(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/spec-constant-block-size.frag b/third_party/spirv-cross/shaders-msl/frag/spec-constant-block-size.frag new file mode 100644 index 0000000000..8d2b1f326f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/spec-constant-block-size.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +layout(constant_id = 10) const int Value = 2; +layout(binding = 0) uniform SpecConstArray +{ + vec4 samples[Value]; +}; + +layout(location = 0) flat in int Index; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = samples[Index]; +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/spec-constant-ternary.frag b/third_party/spirv-cross/shaders-msl/frag/spec-constant-ternary.frag new file mode 100644 index 0000000000..78dccbf044 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/spec-constant-ternary.frag @@ -0,0 +1,9 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(constant_id = 0) const uint s = 10u; +const uint f = s > 20u ? 30u : 50u; + +void main() +{ + FragColor = float(f); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/stencil-export.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/stencil-export.msl21.frag new file mode 100644 index 0000000000..73b7e53383 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/stencil-export.msl21.frag @@ -0,0 +1,17 @@ +#version 450 +#extension GL_ARB_shader_stencil_export : require + +layout(location = 0) out vec4 MRT0; +layout(location = 1) out vec4 MRT1; +void update_stencil() +{ + gl_FragStencilRefARB += 10; +} + +void main() +{ + MRT0 = vec4(1.0); + MRT1 = vec4(1.0, 0.0, 1.0, 1.0); + gl_FragStencilRefARB = 100; + update_stencil(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/subgroup-builtins.msl22.frag b/third_party/spirv-cross/shaders-msl/frag/subgroup-builtins.msl22.frag new file mode 100644 index 0000000000..746438f00f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/subgroup-builtins.msl22.frag @@ -0,0 +1,10 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require + +layout(location = 0) out uvec2 FragColor; + +void main() +{ + FragColor.x = gl_SubgroupSize; + FragColor.y = gl_SubgroupInvocationID; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/subgroup-globals-extract.msl22.frag b/third_party/spirv-cross/shaders-msl/frag/subgroup-globals-extract.msl22.frag new file mode 100644 index 0000000000..f763163dc2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/subgroup-globals-extract.msl22.frag @@ -0,0 +1,30 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require + +layout(location = 0) out uvec2 FragColor; + +uint sub1() { + return subgroupBallotFindLSB(uvec4(1,2,3,4)); +} + +uint sub2() { + return subgroupBallotFindMSB(uvec4(1,2,3,4)); +} + +uint sub3() { + return subgroupBallotBitCount(uvec4(1,2,3,4)); +} + +uint sub4() { + return subgroupBallotInclusiveBitCount(uvec4(1,2,3,4)); +} + +uint sub5() { + return subgroupBallotExclusiveBitCount(uvec4(1,2,3,4)); +} + +void main() +{ + FragColor.x = sub1() + sub2() + sub3() + sub4() + sub5(); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/switch-unreachable-break.frag b/third_party/spirv-cross/shaders-msl/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..4be90f86b5 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/switch-unreachable-break.frag @@ -0,0 +1,30 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vInput; + +layout(set = 0, binding = 0) uniform UBO +{ + int cond; + int cond2; +}; + +void main() +{ + FragColor = vec4(10.0); + switch (cond) + { + case 1: + if (cond2 < 50) + break; + else + discard; + + break; + + default: + FragColor = vec4(20.0); + break; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/switch-unsigned-case.frag b/third_party/spirv-cross/shaders-msl/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..d8aee43a6c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/switch-unsigned-case.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; + +#define ENUM_0 0u +#define ENUM_1 1u + +layout(set = 0, binding = 0) uniform Buff +{ + uint TestVal; +}; + +layout(location = 0) out vec4 fsout_Color; + +void main() +{ + fsout_Color = vec4(1.0); + switch (TestVal) + { + case ENUM_0: + fsout_Color = vec4(0.1); + break; + case ENUM_1: + fsout_Color = vec4(0.2); + break; + } +} diff --git a/third_party/spirv-cross/shaders-msl/frag/swizzle.frag b/third_party/spirv-cross/shaders-msl/frag/swizzle.frag new file mode 100644 index 0000000000..af22dd655d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/swizzle.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +layout(binding = 0) uniform sampler2D samp; +layout(location = 0) out vec4 FragColor; +layout(location = 1) in vec3 vNormal; +layout(location = 2) in vec2 vUV; + +void main() +{ + FragColor = vec4(texture(samp, vUV).xyz, 1.0); + FragColor = vec4(texture(samp, vUV).xz, 1.0, 4.0); + FragColor = vec4(texture(samp, vUV).xx, texture(samp, vUV + vec2(0.1)).yy); + FragColor = vec4(vNormal, 1.0); + FragColor = vec4(vNormal + 1.8, 1.0); + FragColor = vec4(vUV, vUV + 1.8); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag new file mode 100644 index 0000000000..8e15e36e35 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.1d-as-2d.frag @@ -0,0 +1,10 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; +layout(binding = 1) uniform sampler1D uTexture2; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture2, int(gl_FragCoord.x), 0, int(-1)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.frag b/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.frag new file mode 100644 index 0000000000..91a55f933b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(set = 0, binding = 0) uniform samplerCube cubeSampler; +layout(set = 0, binding = 1) uniform samplerCubeArray cubeArraySampler; +layout(set = 0, binding = 2) uniform sampler2DArray texArraySampler; + +layout(location = 0) in vec4 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 a = texture(cubeSampler, vUV.xyz); + vec4 b = texture(cubeArraySampler, vUV); + vec4 c = texture(texArraySampler, vUV.xyz); + FragColor = a + b + c; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag b/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag new file mode 100644 index 0000000000..91a55f933b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(set = 0, binding = 0) uniform samplerCube cubeSampler; +layout(set = 0, binding = 1) uniform samplerCubeArray cubeArraySampler; +layout(set = 0, binding = 2) uniform sampler2DArray texArraySampler; + +layout(location = 0) in vec4 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + vec4 a = texture(cubeSampler, vUV.xyz); + vec4 b = texture(cubeArraySampler, vUV); + vec4 c = texture(texArraySampler, vUV.xyz); + FragColor = a + b + c; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texture-multisample-array.msl21.frag b/third_party/spirv-cross/shaders-msl/frag/texture-multisample-array.msl21.frag new file mode 100644 index 0000000000..ede809bd7f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texture-multisample-array.msl21.frag @@ -0,0 +1,10 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2DMSArray uTexture; +layout(location = 0) flat in ivec3 vCoord; +layout(location = 1) flat in int vSample; + +void main() +{ + FragColor = texelFetch(uTexture, vCoord, vSample); +} diff --git a/third_party/spirv-cross/shaders-msl/frag/texture-proj-shadow.frag b/third_party/spirv-cross/shaders-msl/frag/texture-proj-shadow.frag new file mode 100644 index 0000000000..547532e648 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/texture-proj-shadow.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(binding = 1) uniform sampler2DShadow uShadow2D; +layout(binding = 2) uniform sampler1D uSampler1D; +layout(binding = 3) uniform sampler2D uSampler2D; +layout(binding = 4) uniform sampler3D uSampler3D; + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vClip3; +layout(location = 1) in vec4 vClip4; +layout(location = 2) in vec2 vClip2; + +void main() +{ + FragColor = textureProj(uShadow2D, vClip4); + FragColor = textureProj(uSampler1D, vClip2).x; + FragColor = textureProj(uSampler2D, vClip3).x; + FragColor = textureProj(uSampler3D, vClip4).x; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/ubo_layout.frag b/third_party/spirv-cross/shaders-msl/frag/ubo_layout.frag new file mode 100644 index 0000000000..80f9f16d3d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/ubo_layout.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; + +struct Str +{ + mat4 foo; +}; + +layout(binding = 0, std140) uniform UBO1 +{ + layout(row_major) Str foo; +} ubo1; + +layout(binding = 1, std140) uniform UBO2 +{ + layout(column_major) Str foo; +} ubo0; + +void main() +{ + FragColor = ubo1.foo.foo[0] + ubo0.foo.foo[0]; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/unary-enclose.frag b/third_party/spirv-cross/shaders-msl/frag/unary-enclose.frag new file mode 100644 index 0000000000..ea502e1de8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/unary-enclose.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn; +layout(location = 1) flat in ivec4 vIn1; + +void main() +{ + FragColor = +(-(-vIn)); + ivec4 a = ~(~vIn1); + + bool b = false; + b = !!b; +} diff --git a/third_party/spirv-cross/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag b/third_party/spirv-cross/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag new file mode 100644 index 0000000000..900c5b006c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/vecsize-mismatch.shader-inputs.frag @@ -0,0 +1,17 @@ +#version 450 + +#extension GL_AMD_gpu_shader_int16 : require + +layout(location = 0) flat in int16_t a; +layout(location = 1) flat in ivec2 b; +layout(location = 2) flat in uint16_t c[2]; +layout(location = 4) flat in uvec4 e[2]; +layout(location = 6) in vec2 d; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(int(a)), float(b.x), vec2(uint(c[1]), float(e[0].w)) + d); +} + diff --git a/third_party/spirv-cross/shaders-msl/frag/write-depth-in-function.frag b/third_party/spirv-cross/shaders-msl/frag/write-depth-in-function.frag new file mode 100644 index 0000000000..1af7f5d9bd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/frag/write-depth-in-function.frag @@ -0,0 +1,14 @@ +#version 450 +layout(location = 0) in float v; +layout(location = 0) out float FragColor; + +void set_output_depth() +{ + gl_FragDepth = 0.2; +} + +void main() +{ + FragColor = 1.0; + set_output_depth(); +} diff --git a/third_party/spirv-cross/shaders-msl/intel/shader-integer-functions2.asm.comp b/third_party/spirv-cross/shaders-msl/intel/shader-integer-functions2.asm.comp new file mode 100644 index 0000000000..9189794ef7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/intel/shader-integer-functions2.asm.comp @@ -0,0 +1,137 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 97 +; Schema: 0 + OpCapability Shader + OpCapability IntegerFunctions2INTEL + OpExtension "SPV_INTEL_shader_integer_functions2" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %foo "foo" + OpMemberName %foo 0 "a" + OpMemberName %foo 1 "b" + OpMemberName %foo 2 "c" + OpMemberName %foo 3 "d" + OpName %_ "" + OpMemberDecorate %foo 0 Offset 0 + OpMemberDecorate %foo 1 Offset 4 + OpMemberDecorate %foo 2 Offset 8 + OpMemberDecorate %foo 3 Offset 12 + OpDecorate %foo Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %foo = OpTypeStruct %uint %uint %int %int +%_ptr_StorageBuffer_foo = OpTypePointer StorageBuffer %foo + %_ = OpVariable %_ptr_StorageBuffer_foo StorageBuffer + %int_0 = OpConstant %int 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 +%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int + %int_3 = OpConstant %int 3 + %main = OpFunction %void None %6 + %15 = OpLabel + %16 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %17 = OpLoad %uint %16 + %18 = OpUCountLeadingZerosINTEL %uint %17 + %19 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %19 %18 + %20 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %21 = OpLoad %uint %20 + %22 = OpUCountTrailingZerosINTEL %uint %21 + %23 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %23 %22 + %24 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %25 = OpLoad %int %24 + %26 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %27 = OpLoad %int %26 + %28 = OpAbsISubINTEL %uint %25 %27 + %29 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %29 %28 + %30 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %31 = OpLoad %uint %30 + %32 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %33 = OpLoad %uint %32 + %34 = OpAbsUSubINTEL %uint %31 %33 + %35 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %35 %34 + %37 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %38 = OpLoad %int %37 + %39 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %40 = OpLoad %int %39 + %41 = OpIAddSatINTEL %int %38 %40 + %42 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %42 %41 + %43 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %44 = OpLoad %uint %43 + %45 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %46 = OpLoad %uint %45 + %47 = OpUAddSatINTEL %uint %44 %46 + %48 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %48 %47 + %49 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %50 = OpLoad %int %49 + %51 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %52 = OpLoad %int %51 + %53 = OpIAverageINTEL %int %50 %52 + %54 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %54 %53 + %55 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %56 = OpLoad %uint %55 + %57 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %58 = OpLoad %uint %57 + %59 = OpUAverageINTEL %uint %56 %58 + %60 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %62 = OpLoad %int %61 + %63 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %64 = OpLoad %int %63 + %65 = OpIAverageRoundedINTEL %int %62 %64 + %66 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %66 %65 + %67 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %68 = OpLoad %uint %67 + %69 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %70 = OpLoad %uint %69 + %71 = OpUAverageRoundedINTEL %uint %68 %70 + %72 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %72 %71 + %73 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %74 = OpLoad %int %73 + %75 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %76 = OpLoad %int %75 + %77 = OpISubSatINTEL %int %74 %76 + %78 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %78 %77 + %79 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %80 = OpLoad %uint %79 + %81 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %82 = OpLoad %uint %81 + %83 = OpUSubSatINTEL %uint %80 %82 + %84 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %84 %83 + %85 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + %86 = OpLoad %int %85 + %87 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_3 + %88 = OpLoad %int %87 + %89 = OpIMul32x16INTEL %int %86 %88 + %90 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2 + OpStore %90 %89 + %91 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + %92 = OpLoad %uint %91 + %93 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_1 + %94 = OpLoad %uint %93 + %95 = OpUMul32x16INTEL %uint %92 %94 + %96 = OpAccessChain %_ptr_StorageBuffer_uint %_ %int_0 + OpStore %96 %95 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/shaders-msl/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..84f618262a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/legacy/vert/transpose.legacy.vert @@ -0,0 +1,20 @@ +#version 310 es + +uniform Buffer +{ + layout(row_major) mat4 MVPRowMajor; + layout(column_major) mat4 MVPColMajor; + mat4 M; +}; + +layout(location = 0) in vec4 Position; + +void main() +{ + vec4 c0 = M * (MVPRowMajor * Position); + vec4 c1 = M * (MVPColMajor * Position); + vec4 c2 = M * (Position * MVPRowMajor); + vec4 c3 = M * (Position * MVPColMajor); + gl_Position = c0 + c1 + c2 + c3; +} + diff --git a/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc new file mode 100644 index 0000000000..e69a7a1697 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.multi-patch.tesc @@ -0,0 +1,17 @@ +#version 450 + +layout(vertices = 4) out; +layout(location = 0) out vec4 Foo[][2]; +layout(location = 0) in vec4 iFoo[][2]; +layout(location = 2) patch out vec4 pFoo[2]; +layout(location = 2) in vec4 ipFoo[]; + +void main() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + Foo[gl_InvocationID] = iFoo[gl_InvocationID]; + if (gl_InvocationID == 0) + { + pFoo = vec4[](ipFoo[0], ipFoo[1]); + } +} diff --git a/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..e69a7a1697 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-0.msl2.tesc @@ -0,0 +1,17 @@ +#version 450 + +layout(vertices = 4) out; +layout(location = 0) out vec4 Foo[][2]; +layout(location = 0) in vec4 iFoo[][2]; +layout(location = 2) patch out vec4 pFoo[2]; +layout(location = 2) in vec4 ipFoo[]; + +void main() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + Foo[gl_InvocationID] = iFoo[gl_InvocationID]; + if (gl_InvocationID == 0) + { + pFoo = vec4[](ipFoo[0], ipFoo[1]); + } +} diff --git a/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc new file mode 100644 index 0000000000..e69a7a1697 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.multi-patch.tesc @@ -0,0 +1,17 @@ +#version 450 + +layout(vertices = 4) out; +layout(location = 0) out vec4 Foo[][2]; +layout(location = 0) in vec4 iFoo[][2]; +layout(location = 2) patch out vec4 pFoo[2]; +layout(location = 2) in vec4 ipFoo[]; + +void main() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + Foo[gl_InvocationID] = iFoo[gl_InvocationID]; + if (gl_InvocationID == 0) + { + pFoo = vec4[](ipFoo[0], ipFoo[1]); + } +} diff --git a/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..e69a7a1697 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/copy-arrays.mask-location-1.msl2.tesc @@ -0,0 +1,17 @@ +#version 450 + +layout(vertices = 4) out; +layout(location = 0) out vec4 Foo[][2]; +layout(location = 0) in vec4 iFoo[][2]; +layout(location = 2) patch out vec4 pFoo[2]; +layout(location = 2) in vec4 ipFoo[]; + +void main() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + Foo[gl_InvocationID] = iFoo[gl_InvocationID]; + if (gl_InvocationID == 0) + { + pFoo = vec4[](ipFoo[0], ipFoo[1]); + } +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..2d8fdf19a2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.for-tess.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out V +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +void main() +{ + gl_Position = vec4(1.0); + a = vec4(2.0); + b = vec4(3.0); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..955f2c4187 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.msl2.tesc @@ -0,0 +1,28 @@ +#version 450 + +layout(vertices = 4) out; +patch out P +{ + layout(location = 0) float a; + layout(location = 2) float b; +}; + +out C +{ + layout(location = 1) float a; + layout(location = 3) float b; +} c[]; + +void write_in_function() +{ + a = 1.0; + b = 2.0; + c[gl_InvocationID].a = 3.0; + c[gl_InvocationID].b = 4.0; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} + +void main() +{ + write_in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc new file mode 100644 index 0000000000..955f2c4187 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.multi-patch.msl2.tesc @@ -0,0 +1,28 @@ +#version 450 + +layout(vertices = 4) out; +patch out P +{ + layout(location = 0) float a; + layout(location = 2) float b; +}; + +out C +{ + layout(location = 1) float a; + layout(location = 3) float b; +} c[]; + +void write_in_function() +{ + a = 1.0; + b = 2.0; + c[gl_InvocationID].a = 3.0; + c[gl_InvocationID].b = 4.0; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} + +void main() +{ + write_in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.vert new file mode 100644 index 0000000000..2d8fdf19a2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-0.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out V +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +void main() +{ + gl_Position = vec4(1.0); + a = vec4(2.0); + b = vec4(3.0); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..2d8fdf19a2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.for-tess.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out V +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +void main() +{ + gl_Position = vec4(1.0); + a = vec4(2.0); + b = vec4(3.0); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..955f2c4187 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.msl2.tesc @@ -0,0 +1,28 @@ +#version 450 + +layout(vertices = 4) out; +patch out P +{ + layout(location = 0) float a; + layout(location = 2) float b; +}; + +out C +{ + layout(location = 1) float a; + layout(location = 3) float b; +} c[]; + +void write_in_function() +{ + a = 1.0; + b = 2.0; + c[gl_InvocationID].a = 3.0; + c[gl_InvocationID].b = 4.0; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} + +void main() +{ + write_in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc new file mode 100644 index 0000000000..955f2c4187 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.multi-patch.msl2.tesc @@ -0,0 +1,28 @@ +#version 450 + +layout(vertices = 4) out; +patch out P +{ + layout(location = 0) float a; + layout(location = 2) float b; +}; + +out C +{ + layout(location = 1) float a; + layout(location = 3) float b; +} c[]; + +void write_in_function() +{ + a = 1.0; + b = 2.0; + c[gl_InvocationID].a = 3.0; + c[gl_InvocationID].b = 4.0; + gl_out[gl_InvocationID].gl_Position = vec4(1.0); +} + +void main() +{ + write_in_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.vert new file mode 100644 index 0000000000..2d8fdf19a2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs-block.mask-location-1.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out V +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +void main() +{ + gl_Position = vec4(1.0); + a = vec4(2.0); + b = vec4(3.0); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-clip-distance.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-clip-distance.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-clip-distance.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.for-tess.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc new file mode 100644 index 0000000000..c291fef03a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.msl2.tesc @@ -0,0 +1,26 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID][0] = 2.0; + if (gl_InvocationID == 0) + { + v1 = vec4(2.0); + v1[3] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = vec4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position[2] = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.multi-patch.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-0.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.for-tess.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc new file mode 100644 index 0000000000..c291fef03a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.msl2.tesc @@ -0,0 +1,26 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID][0] = 2.0; + if (gl_InvocationID == 0) + { + v1 = vec4(2.0); + v1[3] = 4.0; + } + gl_out[gl_InvocationID].gl_Position = vec4(3.0); + gl_out[gl_InvocationID].gl_PointSize = 4.0; + gl_out[gl_InvocationID].gl_Position[2] = 5.0; + gl_out[gl_InvocationID].gl_PointSize = 4.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.multi-patch.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-location-1.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.for-tess.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.multi-patch.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.vert b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.vert new file mode 100644 index 0000000000..35b462fdf8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-point-size.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 v0; +layout(location = 1) out vec4 v1; + +out float gl_ClipDistance[2]; + +void write_in_func() +{ + v0 = vec4(1.0); + v1 = vec4(2.0); + gl_Position = vec4(3.0); + gl_PointSize = 4.0; + gl_ClipDistance[0] = 1.0; + gl_ClipDistance[1] = 0.5; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.multi-patch.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.tesc b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.tesc new file mode 100644 index 0000000000..9f3ca9fcff --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/masking/write-outputs.mask-position.tesc @@ -0,0 +1,29 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) out vec4 v0[]; +layout(location = 1) patch out vec4 v1[2]; +layout(location = 3) patch out vec4 v3; + +void write_in_func() +{ + v0[gl_InvocationID] = vec4(1.0); + v0[gl_InvocationID].z = 3.0; + if (gl_InvocationID == 0) + { + v1[0] = vec4(2.0); + v1[0].x = 3.0; + v1[1] = vec4(2.0); + v1[1].x = 5.0; + } + v3 = vec4(5.0); + gl_out[gl_InvocationID].gl_Position = vec4(10.0); + gl_out[gl_InvocationID].gl_Position.z = 20.0; + gl_out[gl_InvocationID].gl_PointSize = 40.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc new file mode 100644 index 0000000000..0fc300d688 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/arrayed-block-io.multi-patch.tesc @@ -0,0 +1,64 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 5) out; + +layout(location = 0) patch out highp vec2 in_te_positionScale; +layout(location = 1) patch out highp vec2 in_te_positionOffset; + +struct S +{ + highp int x; + highp vec4 y; + highp float z[2]; +}; +layout(location = 2) patch out TheBlock +{ + highp float blockFa[3]; + S blockSa[2]; + highp float blockF; +} tcBlock[2]; + +layout(location = 0) in highp float in_tc_attr[]; + +void main (void) +{ + { + highp float v = 1.3; + + // Assign values to output tcBlock + for (int i0 = 0; i0 < 2; ++i0) + { + for (int i1 = 0; i1 < 3; ++i1) + { + tcBlock[i0].blockFa[i1] = v; + v += 0.4; + } + for (int i1 = 0; i1 < 2; ++i1) + { + tcBlock[i0].blockSa[i1].x = int(v); + v += 0.4; + tcBlock[i0].blockSa[i1].y = vec4(v, v+0.8, v+1.6, v+2.4); + v += 0.4; + for (int i2 = 0; i2 < 2; ++i2) + { + tcBlock[i0].blockSa[i1].z[i2] = v; + v += 0.4; + } + } + tcBlock[i0].blockF = v; + v += 0.4; + } + } + + gl_TessLevelInner[0] = in_tc_attr[0]; + gl_TessLevelInner[1] = in_tc_attr[1]; + + gl_TessLevelOuter[0] = in_tc_attr[2]; + gl_TessLevelOuter[1] = in_tc_attr[3]; + gl_TessLevelOuter[2] = in_tc_attr[4]; + gl_TessLevelOuter[3] = in_tc_attr[5]; + + in_te_positionScale = vec2(in_tc_attr[6], in_tc_attr[7]); + in_te_positionOffset = vec2(in_tc_attr[8], in_tc_attr[9]); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/basic.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/basic.multi-patch.tesc new file mode 100644 index 0000000000..0a41f98c83 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/basic.multi-patch.tesc @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(location = 0) patch out vec3 vFoo; + +layout(vertices = 1) out; + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/basic.tesc b/third_party/spirv-cross/shaders-msl/tesc/basic.tesc new file mode 100644 index 0000000000..0a41f98c83 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/basic.tesc @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(location = 0) patch out vec3 vFoo; + +layout(vertices = 1) out; + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc new file mode 100644 index 0000000000..aec8db7fac --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.multi-patch.tesc @@ -0,0 +1,70 @@ +#version 450 +layout(vertices = 4) out; + +struct Meep +{ + float a; + float b; +}; + +layout(location = 0) out float a[][2]; +layout(location = 2) out float b[]; +layout(location = 3) out mat2 m[]; +layout(location = 5) out Meep meep[]; +layout(location = 7) out Meep meeps[][2]; + +layout(location = 11) out Block +{ + float a[2]; + float b; + mat2 m; + Meep meep; + Meep meeps[2]; +} B[]; + +layout(location = 0) in float in_a[][2]; +layout(location = 2) in float in_b[]; +layout(location = 3) in mat2 in_m[]; +layout(location = 5) in Meep in_meep[]; +layout(location = 7) in Meep in_meeps[][2]; + +layout(location = 11) in Block +{ + float a[2]; + float b; + mat2 m; + Meep meep; + Meep meeps[2]; +} in_B[]; + +void write_in_func() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + + a[gl_InvocationID][0] = in_a[gl_InvocationID][0]; + a[gl_InvocationID][1] = in_a[gl_InvocationID][1]; + b[gl_InvocationID] = in_b[gl_InvocationID]; + m[gl_InvocationID] = in_m[gl_InvocationID]; + meep[gl_InvocationID].a = in_meep[gl_InvocationID].a; + meep[gl_InvocationID].b = in_meep[gl_InvocationID].b; + meeps[gl_InvocationID][0].a = in_meeps[gl_InvocationID][0].a; + meeps[gl_InvocationID][0].b = in_meeps[gl_InvocationID][0].b; + meeps[gl_InvocationID][1].a = in_meeps[gl_InvocationID][1].a; + meeps[gl_InvocationID][1].b = in_meeps[gl_InvocationID][1].b; + + B[gl_InvocationID].a[0] = in_B[gl_InvocationID].a[0]; + B[gl_InvocationID].a[1] = in_B[gl_InvocationID].a[1]; + B[gl_InvocationID].b = in_B[gl_InvocationID].b; + B[gl_InvocationID].m = in_B[gl_InvocationID].m; + B[gl_InvocationID].meep.a = in_B[gl_InvocationID].meep.a; + B[gl_InvocationID].meep.b = in_B[gl_InvocationID].meep.b; + B[gl_InvocationID].meeps[0].a = in_B[gl_InvocationID].meeps[0].a; + B[gl_InvocationID].meeps[0].b = in_B[gl_InvocationID].meeps[0].b; + B[gl_InvocationID].meeps[1].a = in_B[gl_InvocationID].meeps[1].a; + B[gl_InvocationID].meeps[1].b = in_B[gl_InvocationID].meeps[1].b; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.tesc b/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.tesc new file mode 100644 index 0000000000..b7bb21d6b3 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/complex-control-point-inout-types.tesc @@ -0,0 +1,68 @@ +#version 450 +layout(vertices = 4) out; + +struct Meep +{ + float a; + float b; +}; + +layout(location = 0) out float a[][2]; +layout(location = 2) out float b[]; +layout(location = 3) out mat2 m[]; +layout(location = 5) out Meep meep[]; +layout(location = 7) out Meep meeps[][2]; + +layout(location = 11) out Block +{ + float a[2]; + float b; + mat2 m; + Meep meep; + Meep meeps[2]; +} B[]; + +layout(location = 0) in float in_a[][2]; +layout(location = 2) in float in_b[]; +layout(location = 3) in mat2 in_m[]; +layout(location = 5) in Meep in_meep[]; + +layout(location = 11) in Block +{ + float a[2]; + float b; + mat2 m; + // Non-multi-patch path cannot support structs inside structs. +} in_B[]; + +void write_in_func() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + + a[gl_InvocationID][0] = in_a[gl_InvocationID][0]; + a[gl_InvocationID][1] = in_a[gl_InvocationID][1]; + b[gl_InvocationID] = in_b[gl_InvocationID]; + m[gl_InvocationID] = in_m[gl_InvocationID]; + meep[gl_InvocationID].a = in_meep[gl_InvocationID].a; + meep[gl_InvocationID].b = in_meep[gl_InvocationID].b; + meeps[gl_InvocationID][0].a = 1.0; + meeps[gl_InvocationID][0].b = 2.0; + meeps[gl_InvocationID][1].a = 3.0; + meeps[gl_InvocationID][1].b = 4.0; + + B[gl_InvocationID].a[0] = in_B[gl_InvocationID].a[0]; + B[gl_InvocationID].a[1] = in_B[gl_InvocationID].a[1]; + B[gl_InvocationID].b = in_B[gl_InvocationID].b; + B[gl_InvocationID].m = in_B[gl_InvocationID].m; + B[gl_InvocationID].meep.a = 10.0; + B[gl_InvocationID].meep.b = 20.0; + B[gl_InvocationID].meeps[0].a = 5.0; + B[gl_InvocationID].meeps[0].b = 6.0; + B[gl_InvocationID].meeps[1].a = 7.0; + B[gl_InvocationID].meeps[1].b = 8.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/complex-patch-out-types.tesc b/third_party/spirv-cross/shaders-msl/tesc/complex-patch-out-types.tesc new file mode 100644 index 0000000000..fd56ae46bd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/complex-patch-out-types.tesc @@ -0,0 +1,55 @@ +#version 450 +layout(vertices = 4) out; + +struct Meep +{ + float a; + float b; +}; + +layout(location = 0) patch out float a[2]; +layout(location = 2) patch out float b; +layout(location = 3) patch out mat2 m; +layout(location = 5) patch out Meep meep; +layout(location = 7) patch out Meep meeps[2]; + +layout(location = 11) patch out Block +{ + float a[2]; + float b; + mat2 m; + Meep meep; + Meep meeps[2]; +} B; + +void write_in_func() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + + a[0] = 1.0; + a[1] = 2.0; + b = 3.0; + m = mat2(2.0); + meep.a = 4.0; + meep.b = 5.0; + meeps[0].a = 6.0; + meeps[0].b = 7.0; + meeps[1].a = 8.0; + meeps[1].b = 9.0; + + B.a[0] = 1.0; + B.a[1] = 2.0; + B.b = 3.0; + B.m = mat2(4.0); + B.meep.a = 4.0; + B.meep.b = 5.0; + B.meeps[0].a = 6.0; + B.meeps[0].b = 7.0; + B.meeps[1].a = 8.0; + B.meeps[1].b = 9.0; +} + +void main() +{ + write_in_func(); +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc new file mode 100644 index 0000000000..36b16681e2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.multi-patch.tesc @@ -0,0 +1,12 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) in mat4 vInputs[gl_MaxPatchVertices]; +layout(location = 0) out mat4 vOutputs[4]; + +void main() +{ + mat4 tmp[gl_MaxPatchVertices] = vInputs; + vOutputs[gl_InvocationID] = tmp[gl_InvocationID]; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.tesc new file mode 100644 index 0000000000..36b16681e2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-matrix.tesc @@ -0,0 +1,12 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) in mat4 vInputs[gl_MaxPatchVertices]; +layout(location = 0) out mat4 vOutputs[4]; + +void main() +{ + mat4 tmp[gl_MaxPatchVertices] = vInputs; + vOutputs[gl_InvocationID] = tmp[gl_InvocationID]; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc new file mode 100644 index 0000000000..4b4d5bfcd1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.multi-patch.tesc @@ -0,0 +1,21 @@ +#version 450 + +layout(vertices = 4) out; + +struct VertexData +{ + mat4 a; + vec4 b[2]; + vec4 c; +}; + +layout(location = 0) in VertexData vInputs[gl_MaxPatchVertices]; +layout(location = 0) out vec4 vOutputs[4]; + +void main() +{ + VertexData tmp[gl_MaxPatchVertices] = vInputs; + VertexData tmp_single = vInputs[gl_InvocationID ^ 1]; + + vOutputs[gl_InvocationID] = tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1] + tmp[gl_InvocationID].c + tmp_single.c; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.tesc new file mode 100644 index 0000000000..4b4d5bfcd1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array-of-struct.tesc @@ -0,0 +1,21 @@ +#version 450 + +layout(vertices = 4) out; + +struct VertexData +{ + mat4 a; + vec4 b[2]; + vec4 c; +}; + +layout(location = 0) in VertexData vInputs[gl_MaxPatchVertices]; +layout(location = 0) out vec4 vOutputs[4]; + +void main() +{ + VertexData tmp[gl_MaxPatchVertices] = vInputs; + VertexData tmp_single = vInputs[gl_InvocationID ^ 1]; + + vOutputs[gl_InvocationID] = tmp[gl_InvocationID].a[1] + tmp[gl_InvocationID].b[1] + tmp[gl_InvocationID].c + tmp_single.c; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.multi-patch.tesc new file mode 100644 index 0000000000..1a5924b895 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.multi-patch.tesc @@ -0,0 +1,12 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) in vec4 vInputs[gl_MaxPatchVertices]; +layout(location = 0) out vec4 vOutputs[4]; + +void main() +{ + vec4 tmp[gl_MaxPatchVertices] = vInputs; + vOutputs[gl_InvocationID] = tmp[gl_InvocationID]; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.tesc b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.tesc new file mode 100644 index 0000000000..1a5924b895 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/load-control-point-array.tesc @@ -0,0 +1,12 @@ +#version 450 + +layout(vertices = 4) out; + +layout(location = 0) in vec4 vInputs[gl_MaxPatchVertices]; +layout(location = 0) out vec4 vOutputs[4]; + +void main() +{ + vec4 tmp[gl_MaxPatchVertices] = vInputs; + vOutputs[gl_InvocationID] = tmp[gl_InvocationID]; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/matrix-output.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/matrix-output.multi-patch.tesc new file mode 100644 index 0000000000..0d23861980 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/matrix-output.multi-patch.tesc @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 3) out; + +layout(location = 0) in highp float in_tc_attr[]; +layout(location = 0) out highp float in_te_attr[]; + +layout(location = 1) out mediump mat4x3 in_te_data0[]; +layout(location = 5) out mediump mat4x3 in_te_data1[]; + +void main (void) +{ + mat4x3 d = mat4x3(gl_InvocationID); + in_te_data0[gl_InvocationID] = d; + barrier(); + in_te_data1[gl_InvocationID] = d + in_te_data0[(gl_InvocationID + 1) % 3]; + + in_te_attr[gl_InvocationID] = in_tc_attr[gl_InvocationID]; + + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelOuter[3] = 1.0; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.multi-patch.tesc new file mode 100644 index 0000000000..c3f0195cc7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.multi-patch.tesc @@ -0,0 +1,17 @@ +#version 450 +layout(vertices = 4) out; + +void main() +{ + if (gl_InvocationID == 0) + { + gl_TessLevelOuter[0] = 2.0; + gl_TessLevelOuter[1] = 3.0; + gl_TessLevelOuter[2] = 4.0; + gl_TessLevelOuter[3] = 5.0; + gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5); + gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5); + } + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.tesc b/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.tesc new file mode 100644 index 0000000000..c3f0195cc7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/reload-tess-level.tesc @@ -0,0 +1,17 @@ +#version 450 +layout(vertices = 4) out; + +void main() +{ + if (gl_InvocationID == 0) + { + gl_TessLevelOuter[0] = 2.0; + gl_TessLevelOuter[1] = 3.0; + gl_TessLevelOuter[2] = 4.0; + gl_TessLevelOuter[3] = 5.0; + gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5); + gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5); + } + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/struct-output.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/struct-output.multi-patch.tesc new file mode 100644 index 0000000000..a1511a475a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/struct-output.multi-patch.tesc @@ -0,0 +1,36 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 3) out; + +layout(location = 0) in highp float in_tc_attr[]; +layout(location = 0) out highp float in_te_attr[]; + +struct te_data +{ + mediump float a; + mediump float b; + mediump uint c; +}; + +layout(location = 1) out te_data in_te_data0[]; +layout(location = 4) out te_data in_te_data1[]; + +void main (void) +{ + te_data d = te_data(float(gl_InvocationID), float(gl_InvocationID + 1), uint(gl_InvocationID)); + in_te_data0[gl_InvocationID] = d; + barrier(); + te_data e = in_te_data0[(gl_InvocationID + 1) % 3]; + in_te_data1[gl_InvocationID] = te_data(d.a + e.a, d.b + e.b, d.c + e.c); + + in_te_attr[gl_InvocationID] = in_tc_attr[gl_InvocationID]; + + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelOuter[3] = 1.0; +} diff --git a/third_party/spirv-cross/shaders-msl/tesc/water_tess.multi-patch.tesc b/third_party/spirv-cross/shaders-msl/tesc/water_tess.multi-patch.tesc new file mode 100644 index 0000000000..3ecdc3d1a9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/water_tess.multi-patch.tesc @@ -0,0 +1,115 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 1) out; +layout(location = 0) in vec2 vPatchPosBase[]; + +layout(std140) uniform UBO +{ + vec4 uScale; + highp vec3 uCamPos; + vec2 uPatchSize; + vec2 uMaxTessLevel; + float uDistanceMod; + vec4 uFrustum[6]; +}; + +layout(location = 1) patch out vec2 vOutPatchPosBase; +layout(location = 2) patch out vec4 vPatchLods; + +float lod_factor(vec2 pos_) +{ + vec2 pos = pos_ * uScale.xy; + vec3 dist_to_cam = uCamPos - vec3(pos.x, 0.0, pos.y); + float level = log2((length(dist_to_cam) + 0.0001) * uDistanceMod); + return clamp(level, 0.0, uMaxTessLevel.x); +} + +float tess_level(float lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +vec4 tess_level(vec4 lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +// Guard band for vertex displacement. +#define GUARD_BAND 10.0 +bool frustum_cull(vec2 p0) +{ + vec2 min_xz = (p0 - GUARD_BAND) * uScale.xy; + vec2 max_xz = (p0 + uPatchSize + GUARD_BAND) * uScale.xy; + + vec3 bb_min = vec3(min_xz.x, -GUARD_BAND, min_xz.y); + vec3 bb_max = vec3(max_xz.x, +GUARD_BAND, max_xz.y); + vec3 center = 0.5 * (bb_min + bb_max); + float radius = 0.5 * length(bb_max - bb_min); + + vec3 f0 = vec3( + dot(uFrustum[0], vec4(center, 1.0)), + dot(uFrustum[1], vec4(center, 1.0)), + dot(uFrustum[2], vec4(center, 1.0))); + + vec3 f1 = vec3( + dot(uFrustum[3], vec4(center, 1.0)), + dot(uFrustum[4], vec4(center, 1.0)), + dot(uFrustum[5], vec4(center, 1.0))); + + return !(any(lessThanEqual(f0, vec3(-radius))) || any(lessThanEqual(f1, vec3(-radius)))); +} + +void compute_tess_levels(vec2 p0) +{ + vOutPatchPosBase = p0; + + float l00 = lod_factor(p0 + vec2(-0.5, -0.5) * uPatchSize); + float l10 = lod_factor(p0 + vec2(+0.5, -0.5) * uPatchSize); + float l20 = lod_factor(p0 + vec2(+1.5, -0.5) * uPatchSize); + float l01 = lod_factor(p0 + vec2(-0.5, +0.5) * uPatchSize); + float l11 = lod_factor(p0 + vec2(+0.5, +0.5) * uPatchSize); + float l21 = lod_factor(p0 + vec2(+1.5, +0.5) * uPatchSize); + float l02 = lod_factor(p0 + vec2(-0.5, +1.5) * uPatchSize); + float l12 = lod_factor(p0 + vec2(+0.5, +1.5) * uPatchSize); + float l22 = lod_factor(p0 + vec2(+1.5, +1.5) * uPatchSize); + + vec4 lods = vec4( + dot(vec4(l01, l11, l02, l12), vec4(0.25)), + dot(vec4(l00, l10, l01, l11), vec4(0.25)), + dot(vec4(l10, l20, l11, l21), vec4(0.25)), + dot(vec4(l11, l21, l12, l22), vec4(0.25))); + + vPatchLods = lods; + + vec4 outer_lods = min(lods.xyzw, lods.yzwx); + vec4 levels = tess_level(outer_lods); + gl_TessLevelOuter[0] = levels.x; + gl_TessLevelOuter[1] = levels.y; + gl_TessLevelOuter[2] = levels.z; + gl_TessLevelOuter[3] = levels.w; + + float min_lod = min(min(lods.x, lods.y), min(lods.z, lods.w)); + float inner = tess_level(min(min_lod, l11)); + gl_TessLevelInner[0] = inner; + gl_TessLevelInner[1] = inner; +} + +void main() +{ + vec2 p0 = vPatchPosBase[0]; + if (!frustum_cull(p0)) + { + gl_TessLevelOuter[0] = -1.0; + gl_TessLevelOuter[1] = -1.0; + gl_TessLevelOuter[2] = -1.0; + gl_TessLevelOuter[3] = -1.0; + gl_TessLevelInner[0] = -1.0; + gl_TessLevelInner[1] = -1.0; + } + else + { + compute_tess_levels(p0); + } +} + diff --git a/third_party/spirv-cross/shaders-msl/tesc/water_tess.tesc b/third_party/spirv-cross/shaders-msl/tesc/water_tess.tesc new file mode 100644 index 0000000000..3ecdc3d1a9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tesc/water_tess.tesc @@ -0,0 +1,115 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 1) out; +layout(location = 0) in vec2 vPatchPosBase[]; + +layout(std140) uniform UBO +{ + vec4 uScale; + highp vec3 uCamPos; + vec2 uPatchSize; + vec2 uMaxTessLevel; + float uDistanceMod; + vec4 uFrustum[6]; +}; + +layout(location = 1) patch out vec2 vOutPatchPosBase; +layout(location = 2) patch out vec4 vPatchLods; + +float lod_factor(vec2 pos_) +{ + vec2 pos = pos_ * uScale.xy; + vec3 dist_to_cam = uCamPos - vec3(pos.x, 0.0, pos.y); + float level = log2((length(dist_to_cam) + 0.0001) * uDistanceMod); + return clamp(level, 0.0, uMaxTessLevel.x); +} + +float tess_level(float lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +vec4 tess_level(vec4 lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +// Guard band for vertex displacement. +#define GUARD_BAND 10.0 +bool frustum_cull(vec2 p0) +{ + vec2 min_xz = (p0 - GUARD_BAND) * uScale.xy; + vec2 max_xz = (p0 + uPatchSize + GUARD_BAND) * uScale.xy; + + vec3 bb_min = vec3(min_xz.x, -GUARD_BAND, min_xz.y); + vec3 bb_max = vec3(max_xz.x, +GUARD_BAND, max_xz.y); + vec3 center = 0.5 * (bb_min + bb_max); + float radius = 0.5 * length(bb_max - bb_min); + + vec3 f0 = vec3( + dot(uFrustum[0], vec4(center, 1.0)), + dot(uFrustum[1], vec4(center, 1.0)), + dot(uFrustum[2], vec4(center, 1.0))); + + vec3 f1 = vec3( + dot(uFrustum[3], vec4(center, 1.0)), + dot(uFrustum[4], vec4(center, 1.0)), + dot(uFrustum[5], vec4(center, 1.0))); + + return !(any(lessThanEqual(f0, vec3(-radius))) || any(lessThanEqual(f1, vec3(-radius)))); +} + +void compute_tess_levels(vec2 p0) +{ + vOutPatchPosBase = p0; + + float l00 = lod_factor(p0 + vec2(-0.5, -0.5) * uPatchSize); + float l10 = lod_factor(p0 + vec2(+0.5, -0.5) * uPatchSize); + float l20 = lod_factor(p0 + vec2(+1.5, -0.5) * uPatchSize); + float l01 = lod_factor(p0 + vec2(-0.5, +0.5) * uPatchSize); + float l11 = lod_factor(p0 + vec2(+0.5, +0.5) * uPatchSize); + float l21 = lod_factor(p0 + vec2(+1.5, +0.5) * uPatchSize); + float l02 = lod_factor(p0 + vec2(-0.5, +1.5) * uPatchSize); + float l12 = lod_factor(p0 + vec2(+0.5, +1.5) * uPatchSize); + float l22 = lod_factor(p0 + vec2(+1.5, +1.5) * uPatchSize); + + vec4 lods = vec4( + dot(vec4(l01, l11, l02, l12), vec4(0.25)), + dot(vec4(l00, l10, l01, l11), vec4(0.25)), + dot(vec4(l10, l20, l11, l21), vec4(0.25)), + dot(vec4(l11, l21, l12, l22), vec4(0.25))); + + vPatchLods = lods; + + vec4 outer_lods = min(lods.xyzw, lods.yzwx); + vec4 levels = tess_level(outer_lods); + gl_TessLevelOuter[0] = levels.x; + gl_TessLevelOuter[1] = levels.y; + gl_TessLevelOuter[2] = levels.z; + gl_TessLevelOuter[3] = levels.w; + + float min_lod = min(min(lods.x, lods.y), min(lods.z, lods.w)); + float inner = tess_level(min(min_lod, l11)); + gl_TessLevelInner[0] = inner; + gl_TessLevelInner[1] = inner; +} + +void main() +{ + vec2 p0 = vPatchPosBase[0]; + if (!frustum_cull(p0)) + { + gl_TessLevelOuter[0] = -1.0; + gl_TessLevelOuter[1] = -1.0; + gl_TessLevelOuter[2] = -1.0; + gl_TessLevelOuter[3] = -1.0; + gl_TessLevelInner[0] = -1.0; + gl_TessLevelInner[1] = -1.0; + } + else + { + compute_tess_levels(p0); + } +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese b/third_party/spirv-cross/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese new file mode 100644 index 0000000000..a32c13096a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/in-array-of-struct.raw-tess-in.tese @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_tessellation_shader : require + +layout(triangles) in; +layout(location = 0) in struct { + float dummy; + vec4 variableInStruct; +} testStructArray[][3]; +layout(location = 0) out float outResult; +void main(void) +{ + gl_Position = vec4(gl_TessCoord.xy * 2.0 - 1.0, 0.0, 1.0); + float result; + result = float(abs(testStructArray[0][2].variableInStruct.x - -4.0) < 0.001) * + float(abs(testStructArray[0][2].variableInStruct.y - -9.0) < 0.001) * + float(abs(testStructArray[0][2].variableInStruct.z - 3.0) < 0.001) * + float(abs(testStructArray[0][2].variableInStruct.w - 7.0) < 0.001); + outResult = result; +} diff --git a/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese b/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese new file mode 100644 index 0000000000..629415a873 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.raw-tess-in.tese @@ -0,0 +1,31 @@ +#version 450 +layout(triangles, ccw, equal_spacing) in; + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +struct t35 +{ + vec2 m0; + vec4 m1; +}; + +layout(location = 0) in t36 +{ + vec2 m0; + t35 m1; +} v40[32]; + +layout(location = 0) out float v80; + +void main() +{ + gl_Position = vec4((gl_TessCoord.xy * 2.0) - vec2(1.0), 0.0, 1.0); + float v34 = ((float(abs(v40[0].m1.m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(v40[0].m1.m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(v40[0].m1.m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(v40[0].m1.m1.w - 7.0) < 0.001000000047497451305389404296875); + v80 = v34; +} diff --git a/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.tese b/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.tese new file mode 100644 index 0000000000..629415a873 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/in-block-with-nested-struct.tese @@ -0,0 +1,31 @@ +#version 450 +layout(triangles, ccw, equal_spacing) in; + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +struct t35 +{ + vec2 m0; + vec4 m1; +}; + +layout(location = 0) in t36 +{ + vec2 m0; + t35 m1; +} v40[32]; + +layout(location = 0) out float v80; + +void main() +{ + gl_Position = vec4((gl_TessCoord.xy * 2.0) - vec2(1.0), 0.0, 1.0); + float v34 = ((float(abs(v40[0].m1.m1.x - (-4.0)) < 0.001000000047497451305389404296875) * float(abs(v40[0].m1.m1.y - (-9.0)) < 0.001000000047497451305389404296875)) * float(abs(v40[0].m1.m1.z - 3.0) < 0.001000000047497451305389404296875)) * float(abs(v40[0].m1.m1.w - 7.0) < 0.001000000047497451305389404296875); + v80 = v34; +} diff --git a/third_party/spirv-cross/shaders-msl/tese/input-array.tese b/third_party/spirv-cross/shaders-msl/tese/input-array.tese new file mode 100644 index 0000000000..8efa480e3b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/input-array.tese @@ -0,0 +1,15 @@ +#version 450 + +layout(ccw, quads, fractional_odd_spacing) in; +layout(location = 0) in vec4 Floats[]; +layout(location = 2) in vec4 Floats2[gl_MaxPatchVertices]; + +void set_position() +{ + gl_Position = Floats[0] * gl_TessCoord.x + Floats2[1] * gl_TessCoord.y; +} + +void main() +{ + set_position(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/input-types.raw-tess-in.tese b/third_party/spirv-cross/shaders-msl/tese/input-types.raw-tess-in.tese new file mode 100644 index 0000000000..3157953fdd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/input-types.raw-tess-in.tese @@ -0,0 +1,75 @@ +#version 450 + +layout(ccw, quads, fractional_even_spacing) in; + +// Try to use the whole taxonomy of input methods. + +// Per-vertex vector. +layout(location = 0) in vec4 vColor[]; +// Per-patch vector. +layout(location = 1) patch in vec4 vColors; +// Per-patch vector array. +layout(location = 2) patch in vec4 vColorsArray[2]; + +// I/O blocks, per patch and per control point. +layout(location = 4) in Block +{ + vec4 a; + vec4 b; +} blocks[]; + +layout(location = 6) patch in PatchBlock +{ + vec4 a; + vec4 b; +} patch_block; + +// Composites. +struct Foo +{ + vec4 a; + vec4 b; +}; +layout(location = 8) patch in Foo vFoo; +//layout(location = 10) patch in Foo vFooArray[2]; // FIXME: Handling of array-of-struct input is broken! + +// Per-control point struct. +layout(location = 14) in Foo vFoos[]; + +void set_from_function() +{ + gl_Position = blocks[0].a; + gl_Position += blocks[0].b; + gl_Position += blocks[1].a; + gl_Position += blocks[1].b; + gl_Position += patch_block.a; + gl_Position += patch_block.b; + gl_Position += vColor[0]; + gl_Position += vColor[1]; + gl_Position += vColors; + + Foo foo = vFoo; + gl_Position += foo.a; + gl_Position += foo.b; + + /*foo = vFooArray[0]; + gl_Position += foo.a; + gl_Position += foo.b; + + foo = vFooArray[1]; + gl_Position += foo.a; + gl_Position += foo.b;*/ + + foo = vFoos[0]; + gl_Position += foo.a; + gl_Position += foo.b; + + foo = vFoos[1]; + gl_Position += foo.a; + gl_Position += foo.b; +} + +void main() +{ + set_from_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/input-types.tese b/third_party/spirv-cross/shaders-msl/tese/input-types.tese new file mode 100644 index 0000000000..3157953fdd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/input-types.tese @@ -0,0 +1,75 @@ +#version 450 + +layout(ccw, quads, fractional_even_spacing) in; + +// Try to use the whole taxonomy of input methods. + +// Per-vertex vector. +layout(location = 0) in vec4 vColor[]; +// Per-patch vector. +layout(location = 1) patch in vec4 vColors; +// Per-patch vector array. +layout(location = 2) patch in vec4 vColorsArray[2]; + +// I/O blocks, per patch and per control point. +layout(location = 4) in Block +{ + vec4 a; + vec4 b; +} blocks[]; + +layout(location = 6) patch in PatchBlock +{ + vec4 a; + vec4 b; +} patch_block; + +// Composites. +struct Foo +{ + vec4 a; + vec4 b; +}; +layout(location = 8) patch in Foo vFoo; +//layout(location = 10) patch in Foo vFooArray[2]; // FIXME: Handling of array-of-struct input is broken! + +// Per-control point struct. +layout(location = 14) in Foo vFoos[]; + +void set_from_function() +{ + gl_Position = blocks[0].a; + gl_Position += blocks[0].b; + gl_Position += blocks[1].a; + gl_Position += blocks[1].b; + gl_Position += patch_block.a; + gl_Position += patch_block.b; + gl_Position += vColor[0]; + gl_Position += vColor[1]; + gl_Position += vColors; + + Foo foo = vFoo; + gl_Position += foo.a; + gl_Position += foo.b; + + /*foo = vFooArray[0]; + gl_Position += foo.a; + gl_Position += foo.b; + + foo = vFooArray[1]; + gl_Position += foo.a; + gl_Position += foo.b;*/ + + foo = vFoos[0]; + gl_Position += foo.a; + gl_Position += foo.b; + + foo = vFoos[1]; + gl_Position += foo.a; + gl_Position += foo.b; +} + +void main() +{ + set_from_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/load-control-point-array-of-matrix.tese b/third_party/spirv-cross/shaders-msl/tese/load-control-point-array-of-matrix.tese new file mode 100644 index 0000000000..479b3e651b --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/load-control-point-array-of-matrix.tese @@ -0,0 +1,13 @@ +#version 450 + +layout(cw, quads) in; +layout(location = 0) in mat4 vInputs[gl_MaxPatchVertices]; +layout(location = 4) patch in vec4 vBoo[4]; +layout(location = 8) patch in int vIndex; + +void main() +{ + mat4 tmp[gl_MaxPatchVertices] = vInputs; + gl_Position = tmp[0][vIndex] + tmp[1][vIndex] + vBoo[vIndex]; + +} diff --git a/third_party/spirv-cross/shaders-msl/tese/load-control-point-array.tese b/third_party/spirv-cross/shaders-msl/tese/load-control-point-array.tese new file mode 100644 index 0000000000..4fa0bb1242 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/load-control-point-array.tese @@ -0,0 +1,13 @@ +#version 450 + +layout(cw, quads) in; +layout(location = 0) in vec4 vInputs[gl_MaxPatchVertices]; +layout(location = 1) patch in vec4 vBoo[4]; +layout(location = 5) patch in int vIndex; + +void main() +{ + vec4 tmp[gl_MaxPatchVertices] = vInputs; + gl_Position = tmp[0] + tmp[1] + vBoo[vIndex]; + +} diff --git a/third_party/spirv-cross/shaders-msl/tese/quad.domain.tese b/third_party/spirv-cross/shaders-msl/tese/quad.domain.tese new file mode 100644 index 0000000000..83d4b0e613 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/quad.domain.tese @@ -0,0 +1,12 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, quads, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(gl_TessCoord.x * gl_TessLevelInner[0] * gl_TessLevelOuter[0] + (1.0 - gl_TessCoord.x) * gl_TessLevelInner[0] * gl_TessLevelOuter[2], + gl_TessCoord.y * gl_TessLevelInner[1] * gl_TessLevelOuter[3] + (1.0 - gl_TessCoord.y) * gl_TessLevelInner[1] * gl_TessLevelOuter[1], + 0, 1); +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/quad.tese b/third_party/spirv-cross/shaders-msl/tese/quad.tese new file mode 100644 index 0000000000..4fdb9960bc --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/quad.tese @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, quads, fractional_even_spacing) in; + +void set_position() +{ + gl_Position = vec4(gl_TessCoord.x * gl_TessLevelInner[0] * gl_TessLevelOuter[0] + (1.0 - gl_TessCoord.x) * gl_TessLevelInner[0] * gl_TessLevelOuter[2], + gl_TessCoord.y * gl_TessLevelInner[1] * gl_TessLevelOuter[1] + (1.0 - gl_TessCoord.y) * gl_TessLevelInner[1] * gl_TessLevelOuter[3], + 0, 1); +} + +void main() +{ + set_position(); +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese new file mode 100644 index 0000000000..0c289ac5bd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.msl2.tese @@ -0,0 +1,17 @@ +#version 450 +layout(quads) in; + +vec4 read_tess_levels() +{ + return vec4( + gl_TessLevelOuter[0], + gl_TessLevelOuter[1], + gl_TessLevelOuter[2], + gl_TessLevelOuter[3]) + + vec2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +void main() +{ + gl_Position = read_tess_levels(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..0c289ac5bd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func-quad.raw-tess-in.msl2.tese @@ -0,0 +1,17 @@ +#version 450 +layout(quads) in; + +vec4 read_tess_levels() +{ + return vec4( + gl_TessLevelOuter[0], + gl_TessLevelOuter[1], + gl_TessLevelOuter[2], + gl_TessLevelOuter[3]) + + vec2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +void main() +{ + gl_Position = read_tess_levels(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.msl2.tese b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.msl2.tese new file mode 100644 index 0000000000..8cf1f1a8f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.msl2.tese @@ -0,0 +1,17 @@ +#version 450 +layout(triangles) in; + +vec4 read_tess_levels() +{ + return vec4( + gl_TessLevelOuter[0], + gl_TessLevelOuter[1], + gl_TessLevelOuter[2], + gl_TessLevelOuter[3]) + + vec2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +void main() +{ + gl_Position = read_tess_levels(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese new file mode 100644 index 0000000000..8cf1f1a8f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/read-tess-level-in-func.raw-tess-in.msl2.tese @@ -0,0 +1,17 @@ +#version 450 +layout(triangles) in; + +vec4 read_tess_levels() +{ + return vec4( + gl_TessLevelOuter[0], + gl_TessLevelOuter[1], + gl_TessLevelOuter[2], + gl_TessLevelOuter[3]) + + vec2(gl_TessLevelInner[0], gl_TessLevelInner[1]).xyxy; +} + +void main() +{ + gl_Position = read_tess_levels(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/set-from-function.tese b/third_party/spirv-cross/shaders-msl/tese/set-from-function.tese new file mode 100644 index 0000000000..6cbab9e50e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/set-from-function.tese @@ -0,0 +1,36 @@ +#version 450 + +layout(ccw, quads, fractional_even_spacing) in; + +layout(location = 0) in vec4 vColor[]; +layout(location = 1) patch in vec4 vColors; +layout(location = 2) in Block +{ + vec4 a; + vec4 b; +} blocks[]; + +struct Foo +{ + vec4 a; + vec4 b; +}; +layout(location = 4) patch in Foo vFoo; + +void set_from_function() +{ + gl_Position = blocks[0].a; + gl_Position += blocks[0].b; + gl_Position += blocks[1].a; + gl_Position += blocks[1].b; + gl_Position += vColor[0]; + gl_Position += vColor[1]; + gl_Position += vColors; + gl_Position += vFoo.a; + gl_Position += vFoo.b; +} + +void main() +{ + set_from_function(); +} diff --git a/third_party/spirv-cross/shaders-msl/tese/triangle-tess-level.tese b/third_party/spirv-cross/shaders-msl/tese/triangle-tess-level.tese new file mode 100644 index 0000000000..5ea55af152 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/triangle-tess-level.tese @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(gl_TessCoord.x * gl_TessLevelInner[0] * gl_TessLevelOuter[0], + gl_TessCoord.y * gl_TessLevelInner[0] * gl_TessLevelOuter[1], + gl_TessCoord.z * gl_TessLevelInner[0] * gl_TessLevelOuter[2], + 1); +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/triangle.tese b/third_party/spirv-cross/shaders-msl/tese/triangle.tese new file mode 100644 index 0000000000..6ce7c2d6d9 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/triangle.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/water_tess.raw-tess-in.tese b/third_party/spirv-cross/shaders-msl/tese/water_tess.raw-tess-in.tese new file mode 100644 index 0000000000..32d6bc9391 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/water_tess.raw-tess-in.tese @@ -0,0 +1,65 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +precision highp int; + +layout(cw, quads, fractional_even_spacing) in; + +layout(location = 0) patch in vec2 vOutPatchPosBase; +layout(location = 1) patch in vec4 vPatchLods; + +layout(binding = 1, std140) uniform UBO +{ + mat4 uMVP; + vec4 uScale; + vec2 uInvScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uInvHeightmapSize; +}; +layout(binding = 0) uniform mediump sampler2D uHeightmapDisplacement; + +layout(location = 0) highp out vec3 vWorld; +layout(location = 1) highp out vec4 vGradNormalTex; + +vec2 lerp_vertex(vec2 tess_coord) +{ + return vOutPatchPosBase + tess_coord * uPatchSize; +} + +mediump vec2 lod_factor(vec2 tess_coord) +{ + mediump vec2 x = mix(vPatchLods.yx, vPatchLods.zw, tess_coord.x); + mediump float level = mix(x.x, x.y, tess_coord.y); + mediump float floor_level = floor(level); + mediump float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod) +{ + return mix( + textureLod(uHeightmapDisplacement, uv + 0.5 * off, lod.x).xyz, + textureLod(uHeightmapDisplacement, uv + 1.0 * off, lod.x + 1.0).xyz, + lod.y); +} + +void main() +{ + vec2 tess_coord = gl_TessCoord.xy; + vec2 pos = lerp_vertex(tess_coord); + mediump vec2 lod = lod_factor(tess_coord); + + vec2 tex = pos * uInvHeightmapSize.xy; + pos *= uScale.xy; + + mediump float delta_mod = exp2(lod.x); + vec2 off = uInvHeightmapSize.xy * delta_mod; + + vGradNormalTex = vec4(tex + 0.5 * uInvHeightmapSize.xy, tex * uScale.zw); + vec3 height_displacement = sample_height_displacement(tex, off, lod); + + pos += height_displacement.yz; + vWorld = vec3(pos.x, height_displacement.x, pos.y); + gl_Position = uMVP * vec4(vWorld, 1.0); +} + diff --git a/third_party/spirv-cross/shaders-msl/tese/water_tess.tese b/third_party/spirv-cross/shaders-msl/tese/water_tess.tese new file mode 100644 index 0000000000..32d6bc9391 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/tese/water_tess.tese @@ -0,0 +1,65 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +precision highp int; + +layout(cw, quads, fractional_even_spacing) in; + +layout(location = 0) patch in vec2 vOutPatchPosBase; +layout(location = 1) patch in vec4 vPatchLods; + +layout(binding = 1, std140) uniform UBO +{ + mat4 uMVP; + vec4 uScale; + vec2 uInvScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uInvHeightmapSize; +}; +layout(binding = 0) uniform mediump sampler2D uHeightmapDisplacement; + +layout(location = 0) highp out vec3 vWorld; +layout(location = 1) highp out vec4 vGradNormalTex; + +vec2 lerp_vertex(vec2 tess_coord) +{ + return vOutPatchPosBase + tess_coord * uPatchSize; +} + +mediump vec2 lod_factor(vec2 tess_coord) +{ + mediump vec2 x = mix(vPatchLods.yx, vPatchLods.zw, tess_coord.x); + mediump float level = mix(x.x, x.y, tess_coord.y); + mediump float floor_level = floor(level); + mediump float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod) +{ + return mix( + textureLod(uHeightmapDisplacement, uv + 0.5 * off, lod.x).xyz, + textureLod(uHeightmapDisplacement, uv + 1.0 * off, lod.x + 1.0).xyz, + lod.y); +} + +void main() +{ + vec2 tess_coord = gl_TessCoord.xy; + vec2 pos = lerp_vertex(tess_coord); + mediump vec2 lod = lod_factor(tess_coord); + + vec2 tex = pos * uInvHeightmapSize.xy; + pos *= uScale.xy; + + mediump float delta_mod = exp2(lod.x); + vec2 off = uInvHeightmapSize.xy * delta_mod; + + vGradNormalTex = vec4(tex + 0.5 * uInvHeightmapSize.xy, tex * uScale.zw); + vec3 height_displacement = sample_height_displacement(tex, off, lod); + + pos += height_displacement.yz; + vWorld = vec3(pos.x, height_displacement.x, pos.y); + gl_Position = uMVP * vec4(vWorld, 1.0); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/array-component-io.for-tess.vert b/third_party/spirv-cross/shaders-msl/vert/array-component-io.for-tess.vert new file mode 100644 index 0000000000..257ac848d1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/array-component-io.for-tess.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 1, component = 0) out float A[2]; +layout(location = 1, component = 2) out vec2 B[2]; +layout(location = 0, component = 1) out float C[3]; +layout(location = 0, component = 3) out float D; + +layout(location = 1, component = 0) in float InA[2]; +layout(location = 1, component = 2) in vec2 InB[2]; +layout(location = 0, component = 1) in float InC[3]; +layout(location = 0, component = 3) in float InD; +layout(location = 4) in vec4 Pos; + +void main() +{ + gl_Position = Pos; + A = InA; + B = InB; + C = InC; + D = InD; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/array-component-io.vert b/third_party/spirv-cross/shaders-msl/vert/array-component-io.vert new file mode 100644 index 0000000000..257ac848d1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/array-component-io.vert @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 1, component = 0) out float A[2]; +layout(location = 1, component = 2) out vec2 B[2]; +layout(location = 0, component = 1) out float C[3]; +layout(location = 0, component = 3) out float D; + +layout(location = 1, component = 0) in float InA[2]; +layout(location = 1, component = 2) in vec2 InB[2]; +layout(location = 0, component = 1) in float InC[3]; +layout(location = 0, component = 3) in float InD; +layout(location = 4) in vec4 Pos; + +void main() +{ + gl_Position = Pos; + A = InA; + B = InB; + C = InC; + D = InD; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/basic.capture.vert b/third_party/spirv-cross/shaders-msl/vert/basic.capture.vert new file mode 100644 index 0000000000..8191dc2d0f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/basic.capture.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/basic.for-tess.vert b/third_party/spirv-cross/shaders-msl/vert/basic.for-tess.vert new file mode 100644 index 0000000000..8191dc2d0f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/basic.for-tess.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/basic.vert b/third_party/spirv-cross/shaders-msl/vert/basic.vert new file mode 100644 index 0000000000..8191dc2d0f --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/basic.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/buffer_device_address.msl2.vert b/third_party/spirv-cross/shaders-msl/vert/buffer_device_address.msl2.vert new file mode 100644 index 0000000000..ffc8871306 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/buffer_device_address.msl2.vert @@ -0,0 +1,83 @@ +/* Copyright (c) 2021, Arm Limited and Contributors + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 the "License"; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#version 450 + +// Allows buffer_reference. +#extension GL_EXT_buffer_reference : require + +// Since we did not enable vertexPipelineStoresAndAtomics, we must mark everything readonly. +layout(std430, buffer_reference, buffer_reference_align = 8) readonly buffer Position +{ + vec2 positions[]; +}; + +layout(std430, buffer_reference, buffer_reference_align = 8) readonly buffer PositionReferences +{ + // Represents an array of pointers, where each pointer points to its own VBO (Position). + // The size of a pointer (VkDeviceAddress) is always 8 in Vulkan. + Position buffers[]; +}; + +layout(push_constant) uniform Registers +{ + mat4 view_projection; + + // This is a pointer to an array of pointers, essentially: + // const VBO * const *vbos + PositionReferences references; +} registers; + +// Flat shading looks a little cooler here :) +layout(location = 0) flat out vec4 out_color; + +void main() +{ + int slice = gl_InstanceIndex; + + // One VBO per instance, load the VBO pointer. + // The cool thing here is that a compute shader could hypothetically + // write the pointer list where vertices are stored. + // With vertex attributes we do not have the luxury to modify VBO bindings on the GPU. + // The best we can do is to just modify the vertexOffset in an indirect draw call, + // but that's not always flexible enough, and enforces a very specific engine design to work. + // We can even modify the attribute layout per slice here, since we can just cast the pointer + // to something else if we want. + restrict Position positions = registers.references.buffers[slice]; + + // Load the vertex based on VertexIndex instead of an attribute. Fully flexible. + // Only downside is that we do not get format conversion for free like we do with normal vertex attributes. + vec2 pos = positions.positions[gl_VertexIndex] * 2.5; + + // Place the quad meshes on screen and center it. + pos += 3.0 * (vec2(slice % 8, slice / 8) - 3.5); + + // Normal projection. + gl_Position = registers.view_projection * vec4(pos, 0.0, 1.0); + + // Color the vertex. Use a combination of a wave and checkerboard, completely arbitrary. + int index_x = gl_VertexIndex % 16; + int index_y = gl_VertexIndex / 16; + + float r = 0.5 + 0.3 * sin(float(index_x)); + float g = 0.5 + 0.3 * sin(float(index_y)); + + int checkerboard = (index_x ^ index_y) & 1; + r *= float(checkerboard) * 0.8 + 0.2; + g *= float(checkerboard) * 0.8 + 0.2; + + out_color = vec4(r, g, 0.15, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.no-user-varying.vert b/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.no-user-varying.vert new file mode 100644 index 0000000000..93ed31150c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.no-user-varying.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 Position; +out gl_PerVertex +{ + vec4 gl_Position; + float gl_ClipDistance[2]; +}; + +void main() +{ + gl_Position = Position; + gl_ClipDistance[0] = Position.x; + gl_ClipDistance[1] = Position.y; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.vert b/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.vert new file mode 100644 index 0000000000..93ed31150c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/clip-distance-block.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 Position; +out gl_PerVertex +{ + vec4 gl_Position; + float gl_ClipDistance[2]; +}; + +void main() +{ + gl_Position = Position; + gl_ClipDistance[0] = Position.x; + gl_ClipDistance[1] = Position.y; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/copy.flatten.vert b/third_party/spirv-cross/shaders-msl/vert/copy.flatten.vert new file mode 100644 index 0000000000..4f1b8805e7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/copy.flatten.vert @@ -0,0 +1,34 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + Light light = lights[i]; + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders-msl/vert/dynamic.flatten.vert b/third_party/spirv-cross/shaders-msl/vert/dynamic.flatten.vert new file mode 100644 index 0000000000..a341d45288 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/dynamic.flatten.vert @@ -0,0 +1,33 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + vec3 L = aVertex.xyz - lights[i].Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / lights[i].Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders-msl/vert/float-math.invariant-float-math.vert b/third_party/spirv-cross/shaders-msl/vert/float-math.invariant-float-math.vert new file mode 100644 index 0000000000..caa8639a89 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/float-math.invariant-float-math.vert @@ -0,0 +1,25 @@ +#version 450 + +layout(set = 0, binding = 0) uniform Matrices +{ + mat4 vpMatrix; + mat4 wMatrix; + mat4x3 wMatrix4x3; + mat3x4 wMatrix3x4; +}; + +layout(location = 0) in vec3 InPos; +layout(location = 1) in vec3 InNormal; + +layout(location = 0) out vec3 OutNormal; +layout(location = 1) out vec4 OutWorldPos[4]; + +void main() +{ + gl_Position = vpMatrix * wMatrix * vec4(InPos, 1); + OutWorldPos[0] = wMatrix * vec4(InPos, 1); + OutWorldPos[1] = vec4(InPos, 1) * wMatrix; + OutWorldPos[2] = wMatrix3x4 * InPos; + OutWorldPos[3] = InPos * wMatrix4x3; + OutNormal = (wMatrix * vec4(InNormal, 0)).xyz; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/float-math.vert b/third_party/spirv-cross/shaders-msl/vert/float-math.vert new file mode 100644 index 0000000000..caa8639a89 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/float-math.vert @@ -0,0 +1,25 @@ +#version 450 + +layout(set = 0, binding = 0) uniform Matrices +{ + mat4 vpMatrix; + mat4 wMatrix; + mat4x3 wMatrix4x3; + mat3x4 wMatrix3x4; +}; + +layout(location = 0) in vec3 InPos; +layout(location = 1) in vec3 InNormal; + +layout(location = 0) out vec3 OutNormal; +layout(location = 1) out vec4 OutWorldPos[4]; + +void main() +{ + gl_Position = vpMatrix * wMatrix * vec4(InPos, 1); + OutWorldPos[0] = wMatrix * vec4(InPos, 1); + OutWorldPos[1] = vec4(InPos, 1) * wMatrix; + OutWorldPos[2] = wMatrix3x4 * InPos; + OutWorldPos[3] = InPos * wMatrix4x3; + OutNormal = (wMatrix * vec4(InNormal, 0)).xyz; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/functions.vert b/third_party/spirv-cross/shaders-msl/vert/functions.vert new file mode 100644 index 0000000000..b92074f465 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/functions.vert @@ -0,0 +1,28 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; + uniform vec3 rotDeg; + uniform vec3 rotRad; + uniform ivec2 bits; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; +layout(location = 1) out vec3 vRotDeg; +layout(location = 2) out vec3 vRotRad; +layout(location = 3) out ivec2 vLSB; +layout(location = 4) out ivec2 vMSB; + +void main() +{ + gl_Position = inverse(uMVP) * aVertex; + vNormal = aNormal; + vRotDeg = degrees(rotRad); + vRotRad = radians(rotDeg); + vLSB = findLSB(bits); + vMSB = findMSB(bits); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/implicit-position-1.vert b/third_party/spirv-cross/shaders-msl/vert/implicit-position-1.vert new file mode 100644 index 0000000000..54300d8daa --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/implicit-position-1.vert @@ -0,0 +1,6 @@ +#version 450 +layout(location = 0) out vec4 V; +void main() +{ + V = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/implicit-position-2.vert b/third_party/spirv-cross/shaders-msl/vert/implicit-position-2.vert new file mode 100644 index 0000000000..9996ddaad2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/implicit-position-2.vert @@ -0,0 +1,4 @@ +#version 450 +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-msl/vert/in_out_array_mat.vert b/third_party/spirv-cross/shaders-msl/vert/in_out_array_mat.vert new file mode 100644 index 0000000000..bdff3d2802 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/in_out_array_mat.vert @@ -0,0 +1,41 @@ +#version 450 + +layout(binding = 0, std140) uniform UBO +{ + mat4 projection; + mat4 model; + float lodBias; +} ubo; + +layout(location = 0) in vec3 inPos; +layout(location = 1) in vec4 colors[3]; +layout(location = 4) in vec3 inNormal; +layout(location = 5) in mat4 inViewMat; +layout(location = 0) out vec3 outPos; +layout(location = 1) out vec3 outNormal; +layout(location = 2) out mat4 outTransModel; +layout(location = 6) out float outLodBias; +layout(location = 7) out vec4 color; + +void write_deeper_in_function() +{ + outTransModel[1][1] = ubo.lodBias; + color = colors[2]; +} + +void write_in_function() +{ + outTransModel[2] = vec4(inNormal, 1.0); + write_deeper_in_function(); +} + +void main() +{ + gl_Position = (ubo.projection * ubo.model) * vec4(inPos, 1.0); + outPos = vec3((ubo.model * vec4(inPos, 1.0)).xyz); + outNormal = mat3(vec3(ubo.model[0].x, ubo.model[0].y, ubo.model[0].z), vec3(ubo.model[1].x, ubo.model[1].y, ubo.model[1].z), vec3(ubo.model[2].x, ubo.model[2].y, ubo.model[2].z)) * inNormal; + outLodBias = ubo.lodBias; + outTransModel = transpose(ubo.model) * inViewMat; + write_in_function(); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.frag b/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.frag new file mode 100644 index 0000000000..a0fb7c975a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.frag @@ -0,0 +1,17 @@ +#version 450 +layout(location = 0) in mat3 vMatrix; +layout(location = 4) in Vert +{ + mat3 wMatrix; + vec4 wTmp; + float arr[4]; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = wMatrix[0].xxyy + wTmp + vMatrix[1].yyzz; + for (int i = 0; i < 4; i++) + FragColor += arr[i]; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.vert b/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.vert new file mode 100644 index 0000000000..899a852216 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/interface-block-block-composites.vert @@ -0,0 +1,22 @@ +#version 450 +layout(location = 0) out mat3 vMatrix; +layout(location = 0) in mat3 Matrix; +layout(location = 4) in vec4 Pos; + +layout(location = 4) out Vert +{ + float arr[3]; + mat3 wMatrix; + vec4 wTmp; +}; + +void main() +{ + vMatrix = Matrix; + wMatrix = Matrix; + arr[0] = 1.0; + arr[1] = 2.0; + arr[2] = 3.0; + wTmp = Pos; + gl_Position = Pos; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/interface-block-single-element-array.vert b/third_party/spirv-cross/shaders-msl/vert/interface-block-single-element-array.vert new file mode 100644 index 0000000000..993484fba8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/interface-block-single-element-array.vert @@ -0,0 +1,17 @@ +#version 460 + +layout(location = 0) out TDPickVertex +{ +vec4 c; +vec3 uv[1]; +} oTDVert; + +layout(location = 0) in vec3 P; +layout(location = 1) in vec3 uv[1]; + +void main() +{ +gl_Position = vec4(P, 1.0); +oTDVert.uv[0] = uv[0]; +oTDVert.c = vec4(1.); +} \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers-block.vert b/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers-block.vert new file mode 100644 index 0000000000..73d6cbbd09 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers-block.vert @@ -0,0 +1,26 @@ +#version 450 + +layout(location=0) in vec4 Position; + +struct Output { + vec2 v0; + vec2 v1; + vec3 v2; + vec4 v3; + float v4; + float v5; + float v6; +}; + +layout(location=0) out centroid noperspective Output outp; + +void main() { + outp.v0 = Position.xy; + outp.v1 = Position.zw; + outp.v2 = vec3(Position.x, Position.z * Position.y, Position.x); + outp.v3 = Position.xxyy; + outp.v4 = Position.w; + outp.v5 = Position.y; + outp.v6 = Position.x * Position.w; + gl_Position = Position; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers.vert b/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers.vert new file mode 100644 index 0000000000..541285f2c1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/interpolation-qualifiers.vert @@ -0,0 +1,22 @@ +#version 450 + +layout(location=0) in vec4 Position; + +layout(location=0) out vec2 v0; +layout(location=1) out noperspective vec2 v1; +layout(location=2) out centroid vec3 v2; +layout(location=3) out centroid noperspective vec4 v3; +layout(location=4) out sample float v4; +layout(location=5) out sample noperspective float v5; +layout(location=6) out flat float v6; + +void main() { + v0 = Position.xy; + v1 = Position.zw; + v2 = vec3(Position.x, Position.z * Position.y, Position.x); + v3 = Position.xxyy; + v4 = Position.w; + v5 = Position.y; + v6 = Position.x * Position.w; + gl_Position = Position; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/invariant.msl21.vert b/third_party/spirv-cross/shaders-msl/vert/invariant.msl21.vert new file mode 100644 index 0000000000..f090db5e91 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/invariant.msl21.vert @@ -0,0 +1,11 @@ +#version 310 es + +invariant gl_Position; +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; +layout(location = 2) in vec4 vInput2; + +void main() +{ + gl_Position = vInput0 + vInput1 * vInput2; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/leaf-function.capture.vert b/third_party/spirv-cross/shaders-msl/vert/leaf-function.capture.vert new file mode 100644 index 0000000000..cdb60fae31 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/leaf-function.capture.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; + +void set_output() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} + +void main() +{ + set_output(); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/leaf-function.for-tess.vert b/third_party/spirv-cross/shaders-msl/vert/leaf-function.for-tess.vert new file mode 100644 index 0000000000..cdb60fae31 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/leaf-function.for-tess.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; + +layout(location = 0) out vec3 vNormal; + +void set_output() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} + +void main() +{ + set_output(); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/no-contraction.vert b/third_party/spirv-cross/shaders-msl/vert/no-contraction.vert new file mode 100644 index 0000000000..206fbf0de8 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no-contraction.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; + +void main() +{ + precise vec4 mul = vA * vB; + precise vec4 add = vA + vB; + precise vec4 sub = vA - vB; + precise vec4 mad = vA * vB + vC; + precise vec4 summed = mul + add + sub + mad; + gl_Position = summed; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/no-disable-vertex-out.frag-output.vert b/third_party/spirv-cross/shaders-msl/vert/no-disable-vertex-out.frag-output.vert new file mode 100644 index 0000000000..7ea3790a02 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no-disable-vertex-out.frag-output.vert @@ -0,0 +1,16 @@ +#version 400 +#extension GL_ARB_separate_shader_objects : enable +#extension GL_ARB_shading_language_420pack : enable +layout(std140, binding = 0) uniform buf { + mat4 MVP; + vec4 position[12*3]; + vec4 attr[12*3]; +} ubuf; +layout (location = 0) out vec4 texcoord; +layout (location = 1) out vec3 frag_pos; +void main() +{ + texcoord = ubuf.attr[gl_VertexIndex]; + gl_Position = ubuf.MVP * ubuf.position[gl_VertexIndex]; + frag_pos = gl_Position.xyz; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.for-tess.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.for-tess.vert new file mode 100644 index 0000000000..3c2573a628 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.for-tess.vert @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0, std430) writeonly buffer _10_12 +{ + uvec4 _m0[1024]; +} _12; + +layout(location = 0) in uvec4 _19; + +void main() +{ + _12._m0[gl_VertexIndex] = _19; +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert new file mode 100644 index 0000000000..3c2573a628 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.vert @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0, std430) writeonly buffer _10_12 +{ + uvec4 _m0[1024]; +} _12; + +layout(location = 0) in uvec4 _19; + +void main() +{ + _12._m0[gl_VertexIndex] = _19; +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert new file mode 100644 index 0000000000..96ed2bd1fd --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff.vert @@ -0,0 +1,23 @@ +#version 450 + +layout(binding = 1, std430) writeonly buffer _33_35 +{ + uvec4 _m0[1024]; +} _35; + +layout(binding = 0, std140) uniform _38_40 +{ + uvec4 _m0[1024]; +} _40; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + for (int _19 = 0; _19 < 1024; _19++) + { + _35._m0[_19] = _40._m0[_19]; + } +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert new file mode 100644 index 0000000000..607ac9f342 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_buff_atomic.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(binding = 0, std430) coherent buffer _19_21 +{ + uint _m0; +} _21; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + uint _26 = atomicAdd(_21._m0, 1u); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert new file mode 100644 index 0000000000..19c667391d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/no_stage_out.write_tex.vert @@ -0,0 +1,16 @@ +#version 450 + +layout(binding = 1, r32ui) uniform writeonly uimage1D _32; +layout(binding = 0, r32ui) uniform readonly uimage1D _35; + +layout(location = 0) in vec4 _14; + +void main() +{ + gl_Position = _14; + for (int _19 = 0; _19 < 128; _19++) + { + imageStore(_32, _19, imageLoad(_35, _19)); + } +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/out-block-with-nested-struct-array.vert b/third_party/spirv-cross/shaders-msl/vert/out-block-with-nested-struct-array.vert new file mode 100644 index 0000000000..444e7ca973 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/out-block-with-nested-struct-array.vert @@ -0,0 +1,28 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +struct t21 +{ + vec4 m0; + vec4 m1; +}; + +layout(location = 0) in vec4 v17; +layout(location = 0) out t24 +{ + t21 m0[3]; +} v26; + + +void main() +{ + gl_Position = v17; + v26.m0[1].m1 = vec4(-4.0, -9.0, 3.0, 7.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/out-block-with-struct-array.vert b/third_party/spirv-cross/shaders-msl/vert/out-block-with-struct-array.vert new file mode 100644 index 0000000000..2cb13b3095 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/out-block-with-struct-array.vert @@ -0,0 +1,24 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +struct t21 +{ + float m0; + vec4 m1; +}; + +layout(location = 0) in vec4 v17; +layout(location = 0) out t21 v25[3]; + +void main() +{ + gl_Position = v17; + v25[2].m1 = vec4(-4.0, -9.0, 3.0, 7.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/out_block.vert b/third_party/spirv-cross/shaders-msl/vert/out_block.vert new file mode 100644 index 0000000000..d7a50c783d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/out_block.vert @@ -0,0 +1,22 @@ +#version 450 + +uniform Transform +{ + mat4 transform; +} block; + +layout(location = 0) in vec3 position; +layout(location = 1) in vec4 color; + +layout(location = 2) out VertexOut +{ + vec4 color; + vec4 color2; +} outputs; + +void main() +{ + gl_Position = block.transform * vec4(position, 1.0); + outputs.color = color; + outputs.color2 = color + vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/packed-bool-to-uint.vert b/third_party/spirv-cross/shaders-msl/vert/packed-bool-to-uint.vert new file mode 100644 index 0000000000..933a15e621 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/packed-bool-to-uint.vert @@ -0,0 +1,22 @@ +#version 450 core + +struct Struct +{ + bool flags[1]; +}; + +layout(set=0, binding=0, std140) uniform defaultUniformsVS +{ + Struct flags; + vec2 uquad[4]; + mat4 umatrix; +}; + +layout (location = 0) in vec4 a_position; + +void main() +{ + gl_Position = umatrix * vec4(uquad[gl_VertexIndex], a_position.z, a_position.w); + if (flags.flags[0]) + gl_Position.z = 0.0; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/packed-bool2-to-packed_uint2.vert b/third_party/spirv-cross/shaders-msl/vert/packed-bool2-to-packed_uint2.vert new file mode 100644 index 0000000000..e3939a4519 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/packed-bool2-to-packed_uint2.vert @@ -0,0 +1,22 @@ +#version 450 core + +struct Struct +{ + bvec2 flags[1]; +}; + +layout(set=0, binding=0, std140) uniform defaultUniformsVS +{ + Struct flags; + vec2 uquad[4]; + mat4 umatrix; +}; + +layout (location = 0) in vec4 a_position; + +void main() +{ + gl_Position = umatrix * vec4(uquad[gl_VertexIndex], a_position.z, a_position.w); + if (flags.flags[0].x) + gl_Position.z = 0.0; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/packed_matrix.vert b/third_party/spirv-cross/shaders-msl/vert/packed_matrix.vert new file mode 100644 index 0000000000..4d99d2190a --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/packed_matrix.vert @@ -0,0 +1,41 @@ +#version 450 + +layout(binding = 13, std140) uniform _1365_18812 +{ + layout(row_major) mat4x3 _m0; + layout(row_major) mat4x3 _m1; +} _18812; + +layout(binding = 12, std140) uniform _1126_22044 +{ + layout(row_major) mat4 _m0; + layout(row_major) mat4 _m1; + float _m9; + vec3 _m10; + float _m11; + vec3 _m12; + float _m17; + float _m18; + float _m19; + vec2 _m20; +} _22044; + +layout(location = 0) out vec3 _3976; +layout(location = 0) in vec4 _5275; + +vec3 _2; + +void main() +{ + vec3 _23783; + do + { + _23783 = normalize(_18812._m1 * vec4(_5275.xyz, 0.0)); + break; + } while (false); + vec4 _14995 = vec4(_22044._m10 + (_5275.xyz * (_22044._m17 + _22044._m18)), 1.0) * _22044._m0; + _3976 = _23783; + vec4 _6282 = _14995; + _6282.y = -_14995.y; + gl_Position = _6282; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/pointsize.vert b/third_party/spirv-cross/shaders-msl/vert/pointsize.vert new file mode 100644 index 0000000000..0fc7136387 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/pointsize.vert @@ -0,0 +1,15 @@ +#version 450 +uniform params { + mat4 mvp; + float psize; +}; + +layout(location = 0) in vec4 position; +layout(location = 1) in vec4 color0; +layout(location = 0) out vec4 color; + +void main() { + gl_Position = mvp * position; + gl_PointSize = psize; + color = color0; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/read-from-row-major-array.vert b/third_party/spirv-cross/shaders-msl/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..792fb8e36c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/read-from-row-major-array.vert @@ -0,0 +1,20 @@ +#version 310 es +layout(location = 0) in highp vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +layout(set = 0, binding = 0, std140, row_major) uniform Block +{ + highp mat2x3 var[3][4]; +}; + +mediump float compare_float (highp float a, highp float b) { return abs(a - b) < 0.05 ? 1.0 : 0.0; } +mediump float compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)*compare_float(a.y, b.y)*compare_float(a.z, b.z); } +mediump float compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])*compare_vec3(a[1], b[1]); } + +void main (void) +{ + gl_Position = a_position; + mediump float result = 1.0; + result *= compare_mat2x3(var[0][0], mat2x3(2.0, 6.0, -6.0, 0.0, 5.0, 5.0)); + v_vtxResult = result; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/resource-arrays-leaf.ios.vert b/third_party/spirv-cross/shaders-msl/vert/resource-arrays-leaf.ios.vert new file mode 100644 index 0000000000..b35c410f5c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/resource-arrays-leaf.ios.vert @@ -0,0 +1,27 @@ +#version 450 + +layout(constant_id = 0) const int arraySize = 3; + +layout(binding = 0, rgba32i) uniform iimage2D images[arraySize]; +layout(binding = 4) uniform constant_block +{ + vec4 foo; + int bar; +} constants[4]; + +layout(binding = 8) buffer storage_block +{ + uvec4 baz; + ivec2 quux; +} storage[2]; + +void doWork() +{ + storage[0].baz = uvec4(constants[3].foo); + storage[1].quux = imageLoad(images[2], ivec2(constants[1].bar)).xy; +} + +void main() +{ + doWork(); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/resource-arrays.ios.vert b/third_party/spirv-cross/shaders-msl/vert/resource-arrays.ios.vert new file mode 100644 index 0000000000..cddc06ae27 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/resource-arrays.ios.vert @@ -0,0 +1,23 @@ +#version 450 + +layout(constant_id = 0) const int arraySize = 3; + +layout(binding = 0, rgba32i) uniform iimage2D images[arraySize]; + +layout(binding = 4) uniform constant_block +{ + vec4 foo; + int bar; +} constants[4]; + +layout(binding = 8) buffer storage_block +{ + uvec4 baz; + ivec2 quux; +} storage[2]; + +void main() +{ + storage[0].baz = uvec4(constants[3].foo); + storage[1].quux = imageLoad(images[2], ivec2(constants[1].bar)).xy; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/return-array.force-native-array.vert b/third_party/spirv-cross/shaders-msl/vert/return-array.force-native-array.vert new file mode 100644 index 0000000000..708460114e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/return-array.force-native-array.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; + +vec4[2] test() +{ + return vec4[](vec4(10.0), vec4(20.0)); +} + +vec4[2] test2() +{ + vec4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +void main() +{ + gl_Position = test()[0] + test2()[1]; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/return-array.vert b/third_party/spirv-cross/shaders-msl/vert/return-array.vert new file mode 100644 index 0000000000..708460114e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/return-array.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; + +vec4[2] test() +{ + return vec4[](vec4(10.0), vec4(20.0)); +} + +vec4[2] test2() +{ + vec4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +void main() +{ + gl_Position = test()[0] + test2()[1]; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/set_builtin_in_func.vert b/third_party/spirv-cross/shaders-msl/vert/set_builtin_in_func.vert new file mode 100644 index 0000000000..dd991e3545 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/set_builtin_in_func.vert @@ -0,0 +1,12 @@ +#version 450 + +void write_outblock() +{ + gl_PointSize = 1.0; + gl_Position = vec4(gl_PointSize); +} + +void main() +{ + write_outblock(); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/sign-int-types.vert b/third_party/spirv-cross/shaders-msl/vert/sign-int-types.vert new file mode 100644 index 0000000000..f8530a466d --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/sign-int-types.vert @@ -0,0 +1,38 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; + uniform vec4 uFloatVec4; + uniform vec3 uFloatVec3; + uniform vec2 uFloatVec2; + uniform float uFloat; + uniform ivec4 uIntVec4; + uniform ivec3 uIntVec3; + uniform ivec2 uIntVec2; + uniform int uInt; +}; + +layout(location = 0) in vec4 aVertex; + +layout(location = 0) out vec4 vFloatVec4; +layout(location = 1) out vec3 vFloatVec3; +layout(location = 2) out vec2 vFloatVec2; +layout(location = 3) out float vFloat; +layout(location = 4) flat out ivec4 vIntVec4; +layout(location = 5) flat out ivec3 vIntVec3; +layout(location = 6) flat out ivec2 vIntVec2; +layout(location = 7) flat out int vInt; + +void main() +{ + gl_Position = uMVP * aVertex; + vFloatVec4 = sign(uFloatVec4); + vFloatVec3 = sign(uFloatVec3); + vFloatVec2 = sign(uFloatVec2); + vFloat = sign(uFloat); + vIntVec4 = sign(uIntVec4); + vIntVec3 = sign(uIntVec3); + vIntVec2 = sign(uIntVec2); + vInt = sign(uInt); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/signedness-mismatch.shader-inputs.vert b/third_party/spirv-cross/shaders-msl/vert/signedness-mismatch.shader-inputs.vert new file mode 100644 index 0000000000..dc0f7e6b52 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/signedness-mismatch.shader-inputs.vert @@ -0,0 +1,14 @@ +#version 450 + +#extension GL_AMD_gpu_shader_int16 : require + +layout(location = 0) in int16_t a; +layout(location = 1) in ivec2 b; +layout(location = 2) in uint16_t c[2]; +layout(location = 4) in uvec4 d[2]; + +void main() +{ + gl_Position = vec4(float(int(a)), float(b.x), float(uint(c[1])), float(d[0].w)); +} + diff --git a/third_party/spirv-cross/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert b/third_party/spirv-cross/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert new file mode 100644 index 0000000000..6bc7ddfae2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/texture_buffer.texture-buffer-native.msl21.vert @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_OES_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(rgba32f, binding = 5) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/texture_buffer.vert b/third_party/spirv-cross/shaders-msl/vert/texture_buffer.vert new file mode 100644 index 0000000000..6bc7ddfae2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/texture_buffer.vert @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_OES_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(rgba32f, binding = 5) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} diff --git a/third_party/spirv-cross/shaders-msl/vert/ubo.alignment.vert b/third_party/spirv-cross/shaders-msl/vert/ubo.alignment.vert new file mode 100644 index 0000000000..2e9d16df43 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/ubo.alignment.vert @@ -0,0 +1,23 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 mvp; + vec2 targSize; + vec3 color; // vec3 following vec2 should cause MSL to add pad if float3 is packed + float opacity; // Single float following vec3 should cause MSL float3 to pack +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; +layout(location = 1) out vec3 vColor; +layout(location = 2) out vec2 vSize; + +void main() +{ + gl_Position = mvp * aVertex; + vNormal = aNormal; + vColor = color * opacity; + vSize = targSize * opacity; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/ubo.vert b/third_party/spirv-cross/shaders-msl/vert/ubo.vert new file mode 100644 index 0000000000..82e4626e12 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/ubo.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 mvp; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = mvp * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders-msl/vert/uniform-struct-out-of-order-offests.vert b/third_party/spirv-cross/shaders-msl/vert/uniform-struct-out-of-order-offests.vert new file mode 100644 index 0000000000..21234f9416 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/uniform-struct-out-of-order-offests.vert @@ -0,0 +1,31 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +layout(set = 0, binding = 0, std140) uniform data_u_t +{ + layout(offset = 80) mediump int m0[8]; + layout(offset = 0) mediump ivec4 m1[3]; + layout(offset = 64) uvec3 m2; + layout(offset = 48) mediump uint m3; +} data_u; + +layout(location = 0) in vec4 vtx_posn; +layout(location = 0) out mediump float foo; + +void main() +{ + gl_Position = vtx_posn; + ivec4 a = data_u.m1[1]; + uvec3 b = data_u.m2; + int c = data_u.m0[4]; + foo = (a.xyz + b).y * c; +} + + diff --git a/third_party/spirv-cross/shaders-msl/vert/uniform-struct-packing-nested.vert b/third_party/spirv-cross/shaders-msl/vert/uniform-struct-packing-nested.vert new file mode 100644 index 0000000000..6744b78362 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/uniform-struct-packing-nested.vert @@ -0,0 +1,50 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[1]; +}; + +struct s0 +{ + mediump mat2x3 m0; + ivec4 m1; + mat4 m2; + uvec2 m3; +}; + +struct s1 +{ + mediump mat3x4 m0; + mediump int m1; + uvec3 m2; + s0 m3; +}; + +layout(set = 0, binding = 0, std140) uniform data_u_t +{ + layout(row_major, offset = 368) mediump mat2x3 m0; + layout(offset = 0) vec2 m1[5]; + layout(row_major, offset = 128) s1 m2; + layout(row_major, offset = 80) mediump mat4x2 m3; + layout(offset = 112) ivec4 m4; +} data_u; + +layout(location = 0) in vec4 vtx_posn; +layout(location = 0) out mediump float foo; + +void main() +{ + gl_Position = vtx_posn; + vec2 a = data_u.m1[3]; + ivec4 b = data_u.m4; + mat2x3 c = data_u.m0; + mat3x4 d = data_u.m2.m0; + mat4 e = data_u.m2.m3.m2; + foo = (a.y + b.z) * c[1][2] * d[2][3] * e[3][3]; +} + + diff --git a/third_party/spirv-cross/shaders-msl/vert/unused-position.vert b/third_party/spirv-cross/shaders-msl/vert/unused-position.vert new file mode 100644 index 0000000000..61e30b431c --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vert/unused-position.vert @@ -0,0 +1,13 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; +}; + +void main() +{ + gl_PointSize = 1.0; +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag new file mode 100644 index 0000000000..963493b871 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.no-layered.nocompat.vk.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex[4]; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex[gl_ViewIndex]); +} + diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag new file mode 100644 index 0000000000..963493b871 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex[4]; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex[gl_ViewIndex]); +} + diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..ba57b8c5af --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.msl23.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability DemoteToHelperInvocationEXT + OpExtension "SPV_EXT_demote_to_helper_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_demote_to_helper_invocation" + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %9 = OpIsHelperInvocationEXT %bool + OpDemoteToHelperInvocationEXT + %10 = OpLogicalNot %bool %9 + OpSelectionMerge %12 None + OpBranchConditional %10 %11 %12 + %11 = OpLabel + OpStore %FragColor %19 + OpBranch %12 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag new file mode 100644 index 0000000000..18407988db --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.frag @@ -0,0 +1,18 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void foo() +{ + demote; +} + +void bar() +{ + bool helper = helperInvocationEXT(); +} + +void main() +{ + foo(); + bar(); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag new file mode 100644 index 0000000000..8b8bb61ff7 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/demote-to-helper.vk.nocompat.msl23.ios.frag @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + demote; + bool helper = helperInvocationEXT(); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..6180faba31 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(push_constant, std430) uniform PushConstants +{ + vec4 value0; + vec4 value1; +} push; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor + push.value0 + push.value1; +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag new file mode 100644 index 0000000000..3cb75da5c0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.msl11.vk.frag @@ -0,0 +1,67 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; +// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. + +void main() +{ + float t0 = a; + float t1 = b; + + uint c0 = uint(c); // OpIAdd with different types. + // FConvert, float-to-double. + int c1 = -c; // SNegate + int c2 = ~c; // OpNot + int c3 = c + d; // OpIAdd + int c4 = c - d; // OpISub + int c5 = c * d; // OpIMul + int c6 = c / d; // OpSDiv + uint c7 = e / f; // OpUDiv + int c8 = c % d; // OpSMod + uint c9 = e % f; // OpUMod + // TODO: OpSRem, any way to access this in GLSL? + int c10 = c >> d; // OpShiftRightArithmetic + uint c11 = e >> f; // OpShiftRightLogical + int c12 = c << d; // OpShiftLeftLogical + int c13 = c | d; // OpBitwiseOr + int c14 = c ^ d; // OpBitwiseXor + int c15 = c & d; // OpBitwiseAnd + // VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. + bool c16 = g || h; // OpLogicalOr + bool c17 = g && h; // OpLogicalAnd + bool c18 = !g; // OpLogicalNot + bool c19 = g == h; // OpLogicalEqual + bool c20 = g != h; // OpLogicalNotEqual + // OpSelect not testable atm. + bool c21 = c == d; // OpIEqual + bool c22 = c != d; // OpINotEqual + bool c23 = c < d; // OpSLessThan + bool c24 = e < f; // OpULessThan + bool c25 = c > d; // OpSGreaterThan + bool c26 = e > f; // OpUGreaterThan + bool c27 = c <= d; // OpSLessThanEqual + bool c28 = e <= f; // OpULessThanEqual + bool c29 = c >= d; // OpSGreaterThanEqual + bool c30 = e >= f; // OpUGreaterThanEqual + // OpQuantizeToF16 not testable atm. + + int c31 = c8 + c3; + + int c32 = int(e); // OpIAdd with different types. + bool c33 = bool(c); // int -> bool + bool c34 = bool(e); // uint -> bool + int c35 = int(g); // bool -> int + uint c36 = uint(g); // bool -> uint + float c37 = float(g); // bool -> float + + FragColor = vec4(t0 + t1); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.vk.frag b/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..3cb75da5c0 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/frag/spec-constant.vk.frag @@ -0,0 +1,67 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; +// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. + +void main() +{ + float t0 = a; + float t1 = b; + + uint c0 = uint(c); // OpIAdd with different types. + // FConvert, float-to-double. + int c1 = -c; // SNegate + int c2 = ~c; // OpNot + int c3 = c + d; // OpIAdd + int c4 = c - d; // OpISub + int c5 = c * d; // OpIMul + int c6 = c / d; // OpSDiv + uint c7 = e / f; // OpUDiv + int c8 = c % d; // OpSMod + uint c9 = e % f; // OpUMod + // TODO: OpSRem, any way to access this in GLSL? + int c10 = c >> d; // OpShiftRightArithmetic + uint c11 = e >> f; // OpShiftRightLogical + int c12 = c << d; // OpShiftLeftLogical + int c13 = c | d; // OpBitwiseOr + int c14 = c ^ d; // OpBitwiseXor + int c15 = c & d; // OpBitwiseAnd + // VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. + bool c16 = g || h; // OpLogicalOr + bool c17 = g && h; // OpLogicalAnd + bool c18 = !g; // OpLogicalNot + bool c19 = g == h; // OpLogicalEqual + bool c20 = g != h; // OpLogicalNotEqual + // OpSelect not testable atm. + bool c21 = c == d; // OpIEqual + bool c22 = c != d; // OpINotEqual + bool c23 = c < d; // OpSLessThan + bool c24 = e < f; // OpULessThan + bool c25 = c > d; // OpSGreaterThan + bool c26 = e > f; // OpUGreaterThan + bool c27 = c <= d; // OpSLessThanEqual + bool c28 = e <= f; // OpULessThanEqual + bool c29 = c >= d; // OpSGreaterThanEqual + bool c30 = e >= f; // OpUGreaterThanEqual + // OpQuantizeToF16 not testable atm. + + int c31 = c8 + c3; + + int c32 = int(e); // OpIAdd with different types. + bool c33 = bool(c); // int -> bool + bool c34 = bool(e); // uint -> bool + int c35 = int(g); // bool -> int + uint c36 = uint(g); // bool -> uint + float c37 = float(g); // bool -> float + + FragColor = vec4(t0 + t1); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert new file mode 100644 index 0000000000..d54931a6de --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.multiview.viewfromdev.nocompat.vk.vert @@ -0,0 +1,8 @@ +#version 450 core +#extension GL_EXT_device_group : require +#extension GL_EXT_multiview : require + +void main() +{ + gl_Position = vec4(gl_DeviceIndex, gl_ViewIndex, 0.0, 1.0); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert new file mode 100644 index 0000000000..16ed51b15e --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/device-group.nocompat.vk.vert @@ -0,0 +1,7 @@ +#version 450 core +#extension GL_EXT_device_group : require + +void main() +{ + gl_Position = vec4(gl_DeviceIndex); +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert new file mode 100644 index 0000000000..eb1bc766f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.no-layered.nocompat.vk.vert @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(std140, binding = 0) uniform MVPs +{ + mat4 MVP[2]; +}; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = MVP[gl_ViewIndex] * Position; +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert new file mode 100644 index 0000000000..eb1bc766f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.multiview.nocompat.vk.vert @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(std140, binding = 0) uniform MVPs +{ + mat4 MVP[2]; +}; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = MVP[gl_ViewIndex] * Position; +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert new file mode 100644 index 0000000000..eb1bc766f2 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/multiview.nocompat.vk.vert @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(std140, binding = 0) uniform MVPs +{ + mat4 MVP[2]; +}; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = MVP[gl_ViewIndex] * Position; +} diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..0ca8144ce1 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,38 @@ +#version 450 core + +// GL_EXT_shader_16bit_storage doesn't support input/output. +#extension GL_EXT_shader_8bit_storage : require +#extension GL_AMD_gpu_shader_int16 : require +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) in int16_t foo; +layout(location = 1) in uint16_t bar; +layout(location = 2) in float16_t baz; + +layout(binding = 0) uniform block { + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +}; + +layout(binding = 1) readonly buffer storage { + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +}; + +layout(location = 0) out i16vec4 p; +layout(location = 1) out u16vec4 q; +layout(location = 2) out f16vec4 r; + +void main() { + p = i16vec4(int(foo) + ivec4(ivec2(a), ivec2(c)) - ivec4(ivec3(f) / ivec3(h), 1)); + q = u16vec4(uint(bar) + uvec4(uvec2(b), uvec2(d)) - uvec4(uvec3(g) / uvec3(i), 1)); + r = f16vec4(float(baz) + vec4(vec2(e), 0, 1) - vec4(vec3(j), 1)); + gl_Position = vec4(0, 0, 0, 1); +} + diff --git a/third_party/spirv-cross/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..4d0438ace6 --- /dev/null +++ b/third_party/spirv-cross/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,6 @@ +#version 310 es + +void main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex) * vec4(1.0, 2.0, 3.0, 4.0); +} diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp new file mode 100644 index 0000000000..8f4c95783d --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %32 + %32 = OpLabel + %51 = OpPhi %int %int_0 %5 %49 %loop_continue + %38 = OpSLessThan %bool %51 %int_100 + OpLoopMerge %loop_merge %loop_continue None + OpBranchConditional %38 %loop_body %loop_merge + %loop_body = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %51 + OpBranch %loop_continue + %loop_continue = OpLabel + %41 = OpLoad %int %40 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %41 + OpStore %44 %51 + %47 = OpIAdd %int %41 %int_1 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %47 + %49 = OpLoad %int %48 + OpStore %40 %49 + OpBranch %32 + %loop_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp new file mode 100644 index 0000000000..b1ddd7cc8f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body.asm.comp @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_100 = OpConstant %int 100 + %bool = OpTypeBool +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %32 + %32 = OpLabel + %51 = OpPhi %int %int_0 %5 %49 %loop_continue + %38 = OpSLessThan %bool %51 %int_100 + OpLoopMerge %loop_merge %loop_continue None + OpBranchConditional %38 %loop_body %loop_merge + %loop_body = OpLabel + %40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %51 + OpBranch %loop_continue + %loop_continue = OpLabel + %41 = OpLoad %int %40 + %44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %41 + OpStore %44 %51 + %47 = OpIAdd %int %41 %int_1 + %48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %47 + %49 = OpLoad %int %48 + OpBranch %32 + %loop_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp new file mode 100644 index 0000000000..c11d4cdd0a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/access-tracking-function-call-result.asm.comp @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpName %main "main" + OpName %foo_ "foo(" + OpName %Output "Output" + OpMemberName %Output 0 "myout" + OpName %_ "" + OpMemberDecorate %Output 0 Offset 0 + OpDecorate %Output BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %9 = OpTypeFunction %int + %int_12 = OpConstant %int 12 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %Output = OpTypeStruct %int +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %_ = OpVariable %_ptr_Uniform_Output Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %7 + %16 = OpLabel + %17 = OpFunctionCall %int %foo_ + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranchConditional %true %21 %19 + %21 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %22 %17 + OpReturn + %20 = OpLabel + OpBranch %18 + %19 = OpLabel + %23 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %23 %17 + OpReturn + OpFunctionEnd + %foo_ = OpFunction %int None %9 + %24 = OpLabel + OpReturnValue %int_12 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp new file mode 100644 index 0000000000..87aee2db54 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/aliased-struct-divergent-member-name.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %T "T" + OpMemberName %T 0 "a" + OpName %v "v" + OpName %T_0 "T" + OpMemberName %T_0 0 "b" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "foo" + OpName %_ "" + OpName %T_1 "T" + OpMemberName %T_1 0 "c" + OpName %SSBO2 "SSBO2" + OpMemberName %SSBO2 0 "bar" + OpName %__0 "" + OpMemberDecorate %T_0 0 Offset 0 + OpDecorate %_runtimearr_T_0 ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %T_1 0 Offset 0 + OpDecorate %_runtimearr_T_1 ArrayStride 16 + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %T = OpTypeStruct %float +%_ptr_Function_T = OpTypePointer Function %T + %float_40 = OpConstant %float 40 + %11 = OpConstantComposite %T %float_40 + %T_0 = OpTypeStruct %float +%_runtimearr_T_0 = OpTypeRuntimeArray %T_0 + %SSBO1 = OpTypeStruct %_runtimearr_T_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_T_0 = OpTypePointer Uniform %T_0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %T_1 = OpTypeStruct %float +%_runtimearr_T_1 = OpTypeRuntimeArray %T_1 + %SSBO2 = OpTypeStruct %_runtimearr_T_1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %__0 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int_30 = OpConstant %int 30 +%_ptr_Uniform_T_1 = OpTypePointer Uniform %T_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_T Function + OpStore %v %11 + %20 = OpLoad %T %v + %22 = OpAccessChain %_ptr_Uniform_T_0 %_ %int_0 %int_10 + %23 = OpCompositeExtract %float %20 0 + %25 = OpAccessChain %_ptr_Uniform_float %22 %int_0 + OpStore %25 %23 + %32 = OpLoad %T %v + %34 = OpAccessChain %_ptr_Uniform_T_1 %__0 %int_0 %int_30 + %35 = OpCompositeExtract %float %32 0 + %36 = OpAccessChain %_ptr_Uniform_float %34 %int_0 + OpStore %36 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp new file mode 100644 index 0000000000..504a9546c5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/arithmetic-conversion-signs.asm.nocompat.vk.comp @@ -0,0 +1,143 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 76 +; Schema: 0 + OpCapability Shader + OpCapability Int16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_int16" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "s32" + OpMemberName %SSBO 1 "u32" + OpMemberName %SSBO 2 "s16" + OpMemberName %SSBO 3 "u16" + OpMemberName %SSBO 4 "f32" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpMemberDecorate %SSBO 3 Offset 10 + OpMemberDecorate %SSBO 4 Offset 12 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %short = OpTypeInt 16 1 + %ushort = OpTypeInt 16 0 + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %int %uint %short %ushort %float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_short = OpTypePointer Uniform %short + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_3 = OpConstant %int 3 +%_ptr_Uniform_ushort = OpTypePointer Uniform %ushort + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr_s32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %ptr_u32 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %ptr_s16 = OpAccessChain %_ptr_Uniform_short %_ %int_2 + %ptr_u16 = OpAccessChain %_ptr_Uniform_ushort %_ %int_3 + %ptr_f32 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %s32 = OpLoad %int %ptr_s32 + %u32 = OpLoad %uint %ptr_u32 + %s16 = OpLoad %short %ptr_s16 + %u16 = OpLoad %ushort %ptr_u16 + %f32 = OpLoad %float %ptr_f32 + + ; Sign-extend + %s16_to_s32_signed = OpSConvert %int %s16 + OpStore %ptr_s32 %s16_to_s32_signed + %s16_to_u32_signed = OpSConvert %uint %s16 + OpStore %ptr_u32 %s16_to_u32_signed + + %u16_to_s32_signed = OpSConvert %int %u16 + OpStore %ptr_s32 %u16_to_s32_signed + %u16_to_u32_signed = OpSConvert %uint %u16 + OpStore %ptr_u32 %u16_to_u32_signed + + ; Zero-extend + ; Result must be unsigned for OpUConvert. + ;%s16_to_s32_unsigned = OpUConvert %int %s16 + ;OpStore %ptr_s32 %s16_to_s32_unsigned + %s16_to_u32_unsigned = OpUConvert %uint %s16 + OpStore %ptr_u32 %s16_to_u32_unsigned + + ;%u16_to_s32_unsigned = OpUConvert %int %u16 + ;OpStore %ptr_s32 %u16_to_s32_unsigned + %u16_to_u32_unsigned = OpUConvert %uint %u16 + OpStore %ptr_u32 %u16_to_u32_unsigned + + ; Truncate (SConvert == UConvert) + %s32_to_s16_signed = OpSConvert %short %s32 + OpStore %ptr_s16 %s32_to_s16_signed + %s32_to_u16_signed = OpSConvert %ushort %s32 + OpStore %ptr_u16 %s32_to_u16_signed + + %u32_to_s16_signed = OpSConvert %short %u32 + OpStore %ptr_s16 %u32_to_s16_signed + %u32_to_u16_signed = OpSConvert %ushort %u32 + OpStore %ptr_u16 %u32_to_u16_signed + + ;%s32_to_s16_unsigned = OpUConvert %short %s32 + ;OpStore %ptr_s16 %s32_to_s16_unsigned + %s32_to_u16_unsigned = OpUConvert %ushort %s32 + OpStore %ptr_u16 %s32_to_u16_unsigned + + ;%u32_to_s16_unsigned = OpUConvert %short %u32 + ;OpStore %ptr_s16 %u32_to_s16_unsigned + %u32_to_u16_unsigned = OpUConvert %ushort %u32 + OpStore %ptr_u16 %u32_to_u16_unsigned + + ; SToF + %s16_to_f32_signed = OpConvertSToF %float %s16 + OpStore %ptr_f32 %s16_to_f32_signed + %u16_to_f32_signed = OpConvertSToF %float %u16 + OpStore %ptr_f32 %u16_to_f32_signed + + %s32_to_f32_signed = OpConvertSToF %float %s32 + OpStore %ptr_f32 %s32_to_f32_signed + %u32_to_f32_signed = OpConvertSToF %float %u32 + OpStore %ptr_f32 %u32_to_f32_signed + + ; UToF + %s16_to_f32_unsigned = OpConvertUToF %float %s16 + OpStore %ptr_f32 %s16_to_f32_unsigned + %u16_to_f32_unsigned = OpConvertUToF %float %u16 + OpStore %ptr_f32 %u16_to_f32_unsigned + + %s32_to_f32_unsigned = OpConvertUToF %float %s32 + OpStore %ptr_f32 %s32_to_f32_unsigned + %u32_to_f32_unsigned = OpConvertUToF %float %u32 + OpStore %ptr_f32 %u32_to_f32_unsigned + + ; FToS + %f32_to_s16_signed = OpConvertFToS %short %f32 + OpStore %ptr_s16 %f32_to_s16_signed + %f32_to_u16_signed = OpConvertFToS %ushort %f32 + OpStore %ptr_u16 %f32_to_u16_signed + + ; FToU + %f32_to_u16_unsigned = OpConvertFToU %ushort %f32 + OpStore %ptr_u16 %f32_to_u16_unsigned + ; Result must be unsigned for FToU, so don't bother testing that. + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-load-store.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-load-store.asm.comp new file mode 100644 index 0000000000..3f2d141a1f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-load-store.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %c "c" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %SSBO = OpTypeStruct %uint %uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_0 = OpConstant %int 0 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_uint Function + %15 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %16 = OpAtomicLoad %uint %15 %int_1 %int_0 + OpStore %c %16 + %18 = OpLoad %uint %c + %19 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + OpAtomicStore %19 %int_1 %int_0 %18 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp new file mode 100644 index 0000000000..a323841596 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "count" + OpMemberName %SSBO 1 "data" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO = OpTypeStruct %uint %_runtimearr_uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %uint_1024 = OpConstant %uint 1024 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 + %19 = OpAtomicIAdd %uint %16 %uint_1 %uint_0 %uint_1 + %23 = OpULessThan %bool %19 %uint_1024 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %34 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %19 + OpStore %34 %33 + OpBranch %25 + %25 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/basic.spv16.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/basic.spv16.asm.comp new file mode 100644 index 0000000000..4675c50e13 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/basic.spv16.asm.comp @@ -0,0 +1,48 @@ + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %SSBO = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %23 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0 %20 + %24 = OpLoad %float %23 + %25 = OpFAdd %float %24 %float_2 + %26 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0 %20 + OpStore %26 %25 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp new file mode 100644 index 0000000000..0cca78f6a5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/bda-to-array-in-buffer.asm.spv16.nocompat.vk.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos; 35 +; Bound: 5550 +; Schema: 0 + OpCapability Int8 + OpCapability Int64 + OpCapability Int64 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_physical_storage_buffer" + OpMemoryModel PhysicalStorageBuffer64 Simple + OpEntryPoint GLCompute %main "main" %globals + OpExecutionMode %main LocalSize 16 16 1 + + OpDecorate %ptr_uchar ArrayStride 8 + OpDecorate %ptr_uint ArrayStride 8 + OpDecorate %ptr_array_t ArrayStride 8 + OpDecorate %array_t ArrayStride 1 + OpDecorate %struct_t Block + OpMemberDecorate %struct_t 0 Offset 0 + OpMemberDecorate %struct_t 1 Offset 8 + OpDecorate %ptr_struct ArrayStride 32 + OpDecorate %globals DescriptorSet 0 + OpDecorate %globals Binding 0 + + %void = OpTypeVoid + %uchar = OpTypeInt 8 0 + %uint = OpTypeInt 32 0 + %ulong = OpTypeInt 64 0 + %bool = OpTypeBool + + %ulong_12 = OpConstant %ulong 12 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uchar_69 = OpConstant %uchar 69 + %ulong_16 = OpConstant %ulong 16 + + %ptr_uint = OpTypePointer PhysicalStorageBuffer %uint + %ptr_uchar = OpTypePointer PhysicalStorageBuffer %uchar + + %array_t = OpTypeArray %uchar %ulong_12 +%ptr_array_t = OpTypePointer PhysicalStorageBuffer %array_t + + %struct_t = OpTypeStruct %ptr_uchar %ptr_array_t + %ptr_struct = OpTypePointer StorageBuffer %struct_t + + %void_fn = OpTypeFunction %void + %foo_t = OpTypeFunction %ptr_uint + +%ptr_uchararr_sb = OpTypePointer StorageBuffer %ptr_array_t + + %globals = OpVariable %ptr_struct StorageBuffer + + %foo = OpFunction %ptr_uint None %foo_t + %foo_entry = OpLabel + %lea2 = OpAccessChain %ptr_uchararr_sb %globals %uint_1 + %loaded2 = OpLoad %ptr_array_t %lea2 + %cast = OpConvertPtrToU %ulong %loaded2 + %adjusted = OpIAdd %ulong %cast %ulong_16 + %cast2 = OpConvertUToPtr %ptr_uint %adjusted + OpStore %cast2 %uint_1 Aligned 4 ; eliminating this store generates different code and the problem disappears + OpReturnValue %cast2 + OpFunctionEnd + + %main = OpFunction %void None %void_fn + %main_entry = OpLabel + %nothing = OpFunctionCall %ptr_uint %foo + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp new file mode 100644 index 0000000000..3651a4de52 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitcast-fp16-fp32.asm.vk.comp @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability Float16 + OpCapability StorageBuffer16BitAccess + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpMemberName %SSBO 1 "b" + OpMemberName %SSBO 2 "c" + OpMemberName %SSBO 3 "d" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpMemberDecorate %SSBO 3 Offset 12 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %half = OpTypeFloat 16 + %v2half = OpTypeVector %half 2 + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %v2half %float %float %v2half +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2half = OpTypePointer Uniform %v2half + %uint = OpTypeInt 32 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Uniform_v2half %_ %int_0 + %17 = OpLoad %v2half %16 + %20 = OpBitcast %float %17 + %22 = OpAccessChain %_ptr_Uniform_float %_ %int_1 + OpStore %22 %20 + %25 = OpAccessChain %_ptr_Uniform_float %_ %int_2 + %26 = OpLoad %float %25 + %28 = OpBitcast %v2half %26 + %29 = OpAccessChain %_ptr_Uniform_v2half %_ %int_3 + OpStore %29 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 0000000000..435fa32221 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/bitscan.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitscan.asm.comp new file mode 100644 index 0000000000..e3b785cd52 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/bitscan.asm.comp @@ -0,0 +1,72 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "u" + OpMemberName %SSBO 1 "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %uvec4 %ivec4 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uvec4 = OpTypePointer Uniform %uvec4 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_ivec4 = OpTypePointer Uniform %ivec4 + %main = OpFunction %void None %3 + %5 = OpLabel + %uptr = OpAccessChain %_ptr_Uniform_uvec4 %_ %int_0 + %iptr = OpAccessChain %_ptr_Uniform_ivec4 %_ %int_1 + %uvalue = OpLoad %uvec4 %uptr + %ivalue = OpLoad %ivec4 %iptr + + %lsb_uint_to_uint = OpExtInst %uvec4 %1 FindILsb %uvalue + %lsb_uint_to_int = OpExtInst %ivec4 %1 FindILsb %uvalue + %lsb_int_to_uint = OpExtInst %uvec4 %1 FindILsb %ivalue + %lsb_int_to_int = OpExtInst %ivec4 %1 FindILsb %ivalue + + %umsb_uint_to_uint = OpExtInst %uvec4 %1 FindUMsb %uvalue + %umsb_uint_to_int = OpExtInst %ivec4 %1 FindUMsb %uvalue + %umsb_int_to_uint = OpExtInst %uvec4 %1 FindUMsb %ivalue + %umsb_int_to_int = OpExtInst %ivec4 %1 FindUMsb %ivalue + + %smsb_uint_to_uint = OpExtInst %uvec4 %1 FindSMsb %uvalue + %smsb_uint_to_int = OpExtInst %ivec4 %1 FindSMsb %uvalue + %smsb_int_to_uint = OpExtInst %uvec4 %1 FindSMsb %ivalue + %smsb_int_to_int = OpExtInst %ivec4 %1 FindSMsb %ivalue + + OpStore %uptr %lsb_uint_to_uint + OpStore %iptr %lsb_uint_to_int + OpStore %uptr %lsb_int_to_uint + OpStore %iptr %lsb_int_to_int + + OpStore %uptr %umsb_uint_to_uint + OpStore %iptr %umsb_uint_to_int + OpStore %uptr %umsb_int_to_uint + OpStore %iptr %umsb_int_to_int + + OpStore %uptr %smsb_uint_to_uint + OpStore %iptr %smsb_uint_to_int + OpStore %uptr %smsb_int_to_uint + OpStore %iptr %smsb_int_to_int + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp new file mode 100644 index 0000000000..132f38bf72 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-atomic-nonuniform.vk.nocompat.asm.comp @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageBufferArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbos "ssbos" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %22 NonUniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %SSBO = OpTypeStruct %uint +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %17 = OpLoad %uint %16 + %18 = OpCopyObject %uint %17 + %22 = OpAccessChain %_ptr_Uniform_uint %ssbos %18 %int_0 + %25 = OpAtomicIAdd %uint %22 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp new file mode 100644 index 0000000000..ed8d0ba6f5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-device-address-ptr-casting.vk.nocompat.asm.comp @@ -0,0 +1,106 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_KHR_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpSourceExtension "GL_EXT_buffer_reference" + OpSourceExtension "GL_EXT_buffer_reference_uvec2" + OpName %main "main" + OpName %SomeBuffer "SomeBuffer" + OpMemberName %SomeBuffer 0 "v" + OpMemberName %SomeBuffer 1 "a" + OpMemberName %SomeBuffer 2 "b" + OpName %Registers "Registers" + OpMemberName %Registers 0 "address" + OpMemberName %Registers 1 "address2" + OpName %registers "registers" + OpName %a "a" + OpName %b "b" + OpMemberDecorate %SomeBuffer 0 Offset 0 + OpMemberDecorate %SomeBuffer 1 Offset 16 + OpMemberDecorate %SomeBuffer 2 Offset 24 + OpDecorate %SomeBuffer Block + OpMemberDecorate %Registers 0 Offset 0 + OpMemberDecorate %Registers 1 Offset 8 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_SomeBuffer PhysicalStorageBuffer + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %ulong = OpTypeInt 64 0 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %SomeBuffer = OpTypeStruct %v4float %ulong %v2uint +%_ptr_PhysicalStorageBuffer_SomeBuffer = OpTypePointer PhysicalStorageBuffer %SomeBuffer +%_ptr_Function__ptr_PhysicalStorageBuffer_SomeBuffer = OpTypePointer Function %_ptr_PhysicalStorageBuffer_SomeBuffer + %Registers = OpTypeStruct %ulong %v2uint +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_ulong = OpTypePointer PushConstant %ulong + %int_1 = OpConstant %int 1 +%_ptr_PushConstant_v2uint = OpTypePointer PushConstant %v2uint + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %35 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 +%_ptr_PhysicalStorageBuffer_v4float = OpTypePointer PhysicalStorageBuffer %v4float + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %43 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 +%_ptr_Function_ulong = OpTypePointer Function %ulong +%_ptr_Function_v2uint = OpTypePointer Function %v2uint +%_ptr_PhysicalStorageBuffer_ulong = OpTypePointer PhysicalStorageBuffer %ulong + %int_2 = OpConstant %int 2 +%_ptr_PhysicalStorageBuffer_v2uint = OpTypePointer PhysicalStorageBuffer %v2uint + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_ulong Function + %b = OpVariable %_ptr_Function_v2uint Function + %21 = OpAccessChain %_ptr_PushConstant_ulong %registers %int_0 + %27 = OpAccessChain %_ptr_PushConstant_v2uint %registers %int_1 + %uint_ptr0 = OpLoad %ulong %21 + %uint_ptr1 = OpLoad %v2uint %27 + + ; ConvertUToPtr and vice versa do not accept vectors. + %ulong_ptr0 = OpConvertUToPtr %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr0 + %ulong_ptr1 = OpBitcast %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr0 + %uvec2_ptr0 = OpBitcast %_ptr_PhysicalStorageBuffer_SomeBuffer %uint_ptr1 + + %vec4_write0 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %ulong_ptr0 %int_0 + %vec4_write1 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %ulong_ptr1 %int_0 + %vec4_write2 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %uvec2_ptr0 %int_0 + + OpStore %vec4_write0 %35 Aligned 16 + OpStore %vec4_write1 %35 Aligned 16 + OpStore %vec4_write2 %35 Aligned 16 + + %ulong_from_ptr0 = OpConvertPtrToU %ulong %ulong_ptr0 + %ulong_from_ptr1 = OpBitcast %ulong %ulong_ptr1 + %uvec2_from_ptr0 = OpBitcast %v2uint %uvec2_ptr0 + + %ptr0 = OpAccessChain %_ptr_PhysicalStorageBuffer_ulong %ulong_ptr0 %int_1 + %ptr1 = OpAccessChain %_ptr_PhysicalStorageBuffer_ulong %ulong_ptr1 %int_1 + %ptr2 = OpAccessChain %_ptr_PhysicalStorageBuffer_v2uint %uvec2_ptr0 %int_2 + + OpStore %ptr0 %ulong_from_ptr0 Aligned 8 + OpStore %ptr1 %ulong_from_ptr1 Aligned 8 + OpStore %ptr2 %uvec2_from_ptr0 Aligned 8 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp new file mode 100644 index 0000000000..816985a108 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-aliased-block-name.nocompat.vk.asm.comp @@ -0,0 +1,110 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_buffer_reference" + OpName %main "main" + OpName %Registers "Registers" + OpMemberName %Registers 0 "ro" + OpMemberName %Registers 1 "rw" + OpMemberName %Registers 2 "wo" + OpName %RO "Alias" + OpMemberName %RO 0 "v" + OpName %RW "Alias" + OpMemberName %RW 0 "v" + OpName %WO "Alias" + OpMemberName %WO 0 "v" + OpName %registers "registers" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpMemberDecorate %Registers 0 Offset 0 + OpMemberDecorate %Registers 1 Offset 8 + OpMemberDecorate %Registers 2 Offset 16 + OpDecorate %Registers Block + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %RO 0 NonWritable + OpMemberDecorate %RO 0 Offset 0 + OpDecorate %RO Block + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpMemberDecorate %RW 0 Restrict + OpMemberDecorate %RW 0 Offset 0 + OpDecorate %RW Block + OpDecorate %_runtimearr_v4float_1 ArrayStride 16 + OpMemberDecorate %WO 0 Coherent + OpMemberDecorate %WO 0 NonReadable + OpMemberDecorate %WO 0 Offset 0 + OpDecorate %WO Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_RO PhysicalStorageBuffer + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_RW PhysicalStorageBuffer + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_WO PhysicalStorageBuffer + %Registers = OpTypeStruct %_ptr_PhysicalStorageBuffer_RO %_ptr_PhysicalStorageBuffer_RW %_ptr_PhysicalStorageBuffer_WO + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %RO = OpTypeStruct %_runtimearr_v4float +%_ptr_PhysicalStorageBuffer_RO = OpTypePointer PhysicalStorageBuffer %RO +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %RW = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_PhysicalStorageBuffer_RW = OpTypePointer PhysicalStorageBuffer %RW +%_runtimearr_v4float_1 = OpTypeRuntimeArray %v4float + %WO = OpTypeStruct %_runtimearr_v4float_1 +%_ptr_PhysicalStorageBuffer_WO = OpTypePointer PhysicalStorageBuffer %WO +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_PushConstant__ptr_PhysicalStorageBuffer_RW = OpTypePointer PushConstant %_ptr_PhysicalStorageBuffer_RW + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_PushConstant__ptr_PhysicalStorageBuffer_RO = OpTypePointer PushConstant %_ptr_PhysicalStorageBuffer_RO +%_ptr_PhysicalStorageBuffer_v4float = OpTypePointer PhysicalStorageBuffer %v4float + %int_2 = OpConstant %int 2 +%_ptr_PushConstant__ptr_PhysicalStorageBuffer_WO = OpTypePointer PushConstant %_ptr_PhysicalStorageBuffer_WO + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %23 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_RW %registers %int_1 + %24 = OpLoad %_ptr_PhysicalStorageBuffer_RW %23 + %32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %33 = OpLoad %uint %32 + %35 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_RO %registers %int_0 + %36 = OpLoad %_ptr_PhysicalStorageBuffer_RO %35 + %37 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %38 = OpLoad %uint %37 + %40 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %36 %int_0 %38 + %41 = OpLoad %v4float %40 Aligned 16 + %42 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %24 %int_0 %33 + OpStore %42 %41 Aligned 16 + %45 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_WO %registers %int_2 + %46 = OpLoad %_ptr_PhysicalStorageBuffer_WO %45 + %47 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %48 = OpLoad %uint %47 + %49 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_RO %registers %int_0 + %50 = OpLoad %_ptr_PhysicalStorageBuffer_RO %49 + %51 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %52 = OpLoad %uint %51 + %53 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %50 %int_0 %52 + %54 = OpLoad %v4float %53 Aligned 16 + %55 = OpAccessChain %_ptr_PhysicalStorageBuffer_v4float %46 %int_0 %48 + OpStore %55 %54 Aligned 16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp new file mode 100644 index 0000000000..8fda30e109 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-pod-in-buffer.asm.nocompat.vk.comp @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_buffer_reference" + OpName %main "main" + OpName %Push "Push" + OpMemberName %Push 0 "ptr" + OpName %_ "" + OpMemberDecorate %Push 0 Offset 0 + OpDecorate %Push Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_PhysicalStorageBuffer_uintPtr = OpTypePointer PhysicalStorageBuffer %v4uint + %Push = OpTypeStruct %_ptr_PhysicalStorageBuffer_uintPtr +%_ptr_PushConstant_Push = OpTypePointer PushConstant %Push + %_ = OpVariable %_ptr_PushConstant_Push PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant__ptr_PhysicalStorageBuffer_uintPtr = OpTypePointer PushConstant %_ptr_PhysicalStorageBuffer_uintPtr + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %22 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4 +%_ptr_PhysicalStorageBuffer_v4uint = OpTypePointer PhysicalStorageBuffer %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_uintPtr %_ %int_0 + %17 = OpLoad %_ptr_PhysicalStorageBuffer_uintPtr %16 + OpStore %17 %22 Aligned 8 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp new file mode 100644 index 0000000000..d7ca03f663 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-pointer-to-unused-pod-in-buffer.asm.nocompat.vk.comp @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_buffer_reference" + OpName %main "main" + OpName %Push "Push" + OpMemberName %Push 0 "ptr" + OpName %_ "" + OpMemberDecorate %Push 0 Offset 0 + OpDecorate %Push Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_PhysicalStorageBuffer_uintPtr = OpTypePointer PhysicalStorageBuffer %v4uint + %Push = OpTypeStruct %_ptr_PhysicalStorageBuffer_uintPtr +%_ptr_PushConstant_Push = OpTypePointer PushConstant %Push + %_ = OpVariable %_ptr_PushConstant_Push PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant__ptr_PhysicalStorageBuffer_uintPtr = OpTypePointer PushConstant %_ptr_PhysicalStorageBuffer_uintPtr + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 + %22 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4 +%_ptr_PhysicalStorageBuffer_v4uint = OpTypePointer PhysicalStorageBuffer %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + ;%16 = OpAccessChain %_ptr_PushConstant__ptr_PhysicalStorageBuffer_uintPtr %_ %int_0 + ;%17 = OpLoad %_ptr_PhysicalStorageBuffer_uintPtr %16 + ; OpStore %17 %22 Aligned 8 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp new file mode 100644 index 0000000000..76894aa8c2 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer-2.asm.nocompat.vk.comp @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + OpCapability PhysicalStorageBufferAddressesEXT + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64EXT GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpSourceExtension "GL_EXT_buffer_reference" + OpDecorate %ptr AliasedPointerEXT + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_PhysicalStorageBufferEXT_uint = OpTypePointer PhysicalStorageBufferEXT %uint +%_ptr_Function__ptr_PhysicalStorageBufferEXT_uint = OpTypePointer Function %_ptr_PhysicalStorageBufferEXT_uint + %ulong = OpTypeInt 64 0 + %Registers = OpTypeStruct %ulong +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_ulong = OpTypePointer PushConstant %ulong + %int_10 = OpConstant %int 10 + %uint_20 = OpConstant %uint 20 + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr = OpVariable %_ptr_Function__ptr_PhysicalStorageBufferEXT_uint Function + %19 = OpAccessChain %_ptr_PushConstant_ulong %registers %int_0 + %20 = OpLoad %ulong %19 + %21 = OpConvertUToPtr %_ptr_PhysicalStorageBufferEXT_uint %20 + OpStore %ptr %21 + %22 = OpLoad %_ptr_PhysicalStorageBufferEXT_uint %ptr + OpStore %22 %uint_20 Aligned 4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp new file mode 100644 index 0000000000..d1270d4f2a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/buffer-reference-synthesized-pointer.asm.nocompat.vk.comp @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 27 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + OpCapability PhysicalStorageBufferAddressesEXT + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64EXT GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpSourceExtension "GL_EXT_buffer_reference" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %uintPtr 0 Offset 0 + OpDecorate %uintPtr Block + OpDecorate %ptr AliasedPointerEXT + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %uintPtr = OpTypeStruct %_runtimearr_uint +%_ptr_PhysicalStorageBufferEXT_uint_array = OpTypePointer PhysicalStorageBufferEXT %_runtimearr_uint +%_ptr_Function__ptr_PhysicalStorageBufferEXT_uint_array = OpTypePointer Function %_ptr_PhysicalStorageBufferEXT_uint_array + %ulong = OpTypeInt 64 0 + %Registers = OpTypeStruct %ulong +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_ulong = OpTypePointer PushConstant %ulong + %int_10 = OpConstant %int 10 + %uint_20 = OpConstant %uint 20 +%_ptr_PhysicalStorageBufferEXT_uint = OpTypePointer PhysicalStorageBufferEXT %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ptr = OpVariable %_ptr_Function__ptr_PhysicalStorageBufferEXT_uint_array Function + %19 = OpAccessChain %_ptr_PushConstant_ulong %registers %int_0 + %20 = OpLoad %ulong %19 + %21 = OpConvertUToPtr %_ptr_PhysicalStorageBufferEXT_uint_array %20 + OpStore %ptr %21 + %22 = OpLoad %_ptr_PhysicalStorageBufferEXT_uint_array %ptr + %26 = OpAccessChain %_ptr_PhysicalStorageBufferEXT_uint %22 %int_10 + OpStore %26 %uint_20 Aligned 4 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp new file mode 100644 index 0000000000..8997d0aaf9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-composite-undef.asm.comp @@ -0,0 +1,40 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Block "Block" + OpMemberName %Block 0 "f" + OpName %block "block" + OpMemberDecorate %Block 0 Offset 0 + OpDecorate %Block BufferBlock + OpDecorate %block DescriptorSet 0 + OpDecorate %block Binding 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Block = OpTypeStruct %v4float +%_ptr_Uniform_Block = OpTypePointer Uniform %Block + %block = OpVariable %_ptr_Uniform_Block Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%float_0_100000001 = OpConstant %float 0.100000001 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %15 = OpUndef %float + %16 = OpConstantComposite %v4float %float_0_100000001 %float_0_200000003 %float_0_300000012 %15 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %6 + %18 = OpLabel + %19 = OpAccessChain %_ptr_Uniform_v4float %block %int_0 + OpStore %19 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp new file mode 100644 index 0000000000..e1dcb0ef8e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/constant-lut-name-aliasing.asm.comp @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 49 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %gl_LocalInvocationID + OpExecutionMode %main LocalSize 4 4 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %gl_LocalInvocationID "gl_LocalInvocationID" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %25 "indexable" + OpName %38 "indexable" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 +%_arr_int_uint_4 = OpTypeArray %int %uint_4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %25 = OpConstantComposite %_arr_int_uint_4 %int_0 %int_1 %int_2 %int_3 +%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %38 = OpConstantComposite %_arr_int_uint_4 %int_4 %int_5 %int_6 %int_7 + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function +%indexable_0 = OpVariable %_ptr_Function__arr_int_uint_4 Function + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %27 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_0 + %28 = OpLoad %uint %27 + OpStore %indexable %25 + %32 = OpAccessChain %_ptr_Function_int %indexable %28 + %33 = OpLoad %int %32 + %40 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationID %uint_1 + %41 = OpLoad %uint %40 + OpStore %indexable_0 %38 + %43 = OpAccessChain %_ptr_Function_int %indexable_0 %41 + %44 = OpLoad %int %43 + %45 = OpIAdd %int %33 %44 + %47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %47 %45 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp new file mode 100644 index 0000000000..20fa0b099b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/copy-logical.spv14.asm.comp @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %ssbo + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %B1 "B1" + OpName %A "A" + OpName %C "C" + OpName %B2 "B2" + OpMemberName %A 0 "a" + OpMemberName %A 1 "b1" + OpMemberName %A 2 "b1_array" + OpMemberName %C 0 "c" + OpMemberName %C 1 "b2" + OpMemberName %C 2 "b2_array" + OpMemberName %B1 0 "elem1" + OpMemberName %B2 0 "elem2" + OpMemberName %SSBO 0 "a_block" + OpMemberName %SSBO 1 "c_block" + OpDecorate %B1Array ArrayStride 16 + OpDecorate %B2Array ArrayStride 16 + OpMemberDecorate %B1 0 Offset 0 + OpMemberDecorate %A 0 Offset 0 + OpMemberDecorate %A 1 Offset 16 + OpMemberDecorate %A 2 Offset 32 + OpMemberDecorate %B2 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %C 1 Offset 16 + OpMemberDecorate %C 2 Offset 32 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 96 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 + %v4float = OpTypeVector %float 4 + %B2 = OpTypeStruct %v4float + %B2Array = OpTypeArray %B2 %uint_4 + %C = OpTypeStruct %v4float %B2 %B2Array + %B1 = OpTypeStruct %v4float + %B1Array = OpTypeArray %B1 %uint_4 + %A = OpTypeStruct %v4float %B1 %B1Array + %SSBO = OpTypeStruct %A %C +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_C = OpTypePointer StorageBuffer %C + %int_0 = OpConstant %int 0 +%_ptr_Uniform_A = OpTypePointer StorageBuffer %A + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_C %ssbo %int_1 + %39 = OpAccessChain %_ptr_Uniform_A %ssbo %int_0 + %23 = OpLoad %C %22 + %24 = OpCopyLogical %A %23 + OpStore %39 %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp new file mode 100644 index 0000000000..73f3ceee1a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/eliminate-globals-not-in-entry-point.noeliminate.spv14.asm.comp @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + ;OpEntryPoint GLCompute %main "main" %Samp %ubo %ssbo %v %w + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Samp "Samp" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %ubo "ubo" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbo "ssbo" + OpName %v "v" + OpName %w "w" + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %Samp DescriptorSet 0 + OpDecorate %Samp Binding 0 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubo DescriptorSet 0 + OpDecorate %ubo Binding 1 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %ssbo DescriptorSet 0 + OpDecorate %ssbo Binding 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_64 = OpConstant %uint 64 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 + %float = OpTypeFloat 32 + %12 = OpTypeImage %float 2D 0 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %Samp = OpVariable %_ptr_UniformConstant_13 UniformConstant + %UBO = OpTypeStruct %float +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %ubo = OpVariable %_ptr_Uniform_UBO Uniform + %SSBO = OpTypeStruct %float +%_ptr_StorageBuffer_SSBO = OpTypePointer StorageBuffer %SSBO + %ssbo = OpVariable %_ptr_StorageBuffer_SSBO StorageBuffer +%_ptr_Private_float = OpTypePointer Private %float + %v = OpVariable %_ptr_Private_float Private +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %w = OpVariable %_ptr_Workgroup_float Workgroup + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp new file mode 100644 index 0000000000..e5ca1cbb50 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/expression-nesting-limits.asm.comp @@ -0,0 +1,288 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 10117 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_GlobalInvocationID + OpExecutionMode %1 LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_uint_int_16 ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 BufferBlock + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + OpDecorate %6 DescriptorSet 0 + OpDecorate %6 Binding 1 + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 2 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v2int = OpTypeVector %int 2 + %v2uint = OpTypeVector %uint 2 + %v2float = OpTypeVector %float 2 + %v3int = OpTypeVector %int 3 + %v3uint = OpTypeVector %uint 3 + %v3float = OpTypeVector %float 3 + %v4int = OpTypeVector %int 4 + %v4uint = OpTypeVector %uint 4 + %v4float = OpTypeVector %float 4 + %v4bool = OpTypeVector %bool 4 + %23 = OpTypeFunction %v4float %v4float + %24 = OpTypeFunction %bool + %25 = OpTypeFunction %void +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Input_v2int = OpTypePointer Input %v2int +%_ptr_Input_v2uint = OpTypePointer Input %v2uint +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_v4int = OpTypePointer Input %v4int +%_ptr_Input_v4uint = OpTypePointer Input %v4uint +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_ptr_Output_v2int = OpTypePointer Output %v2int +%_ptr_Output_v2uint = OpTypePointer Output %v2uint +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_v4int = OpTypePointer Output %v4int +%_ptr_Output_v4uint = OpTypePointer Output %v4uint +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %float_0_5 = OpConstant %float 0.5 + %float_n1 = OpConstant %float -1 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %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 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_32 = OpConstant %uint 32 + %uint_4 = OpConstant %uint 4 +%uint_2147483647 = OpConstant %uint 2147483647 + %66 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %67 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %68 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %int_16 = OpConstant %int 16 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_uint_int_16 = OpTypeArray %uint %int_16 + %_struct_4 = OpTypeStruct %_arr_uint_int_16 +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %6 = OpVariable %_ptr_Uniform__struct_4 Uniform + %7 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %25 + %83 = OpLabel + %84 = OpLoad %v3uint %gl_GlobalInvocationID + %85 = OpCompositeConstruct %v4uint %84 %uint_0 + %86 = OpConvertUToF %v4float %85 + %87 = OpFunctionCall %v4float %88 %86 + OpReturn + OpFunctionEnd + %88 = OpFunction %v4float None %23 + %89 = OpFunctionParameter %v4float + %92 = OpLabel + %93 = OpVariable %_ptr_Function_int Function + OpStore %93 %int_0 + OpBranch %94 + %94 = OpLabel + %95 = OpLoad %int %93 + %96 = OpSLessThan %bool %95 %int_16 + OpLoopMerge %97 %10100 None + OpBranchConditional %96 %10101 %97 + %10101 = OpLabel + %10102 = OpLoad %int %93 + %90 = OpAccessChain %_ptr_Uniform_uint %6 %int_0 %10102 + %91 = OpLoad %uint %90 + %98 = OpAccessChain %_ptr_Uniform_uint %5 %int_0 %10102 + %99 = OpLoad %uint %98 + %100 = OpIAdd %uint %91 %99 + %101 = OpIAdd %uint %91 %100 + %102 = OpIAdd %uint %91 %101 + %103 = OpIAdd %uint %91 %102 + %104 = OpIAdd %uint %91 %103 + %105 = OpIAdd %uint %91 %104 + %106 = OpIAdd %uint %91 %105 + %107 = OpIAdd %uint %91 %106 + %108 = OpIAdd %uint %91 %107 + %109 = OpIAdd %uint %91 %108 + %110 = OpIAdd %uint %91 %109 + %111 = OpIAdd %uint %91 %110 + %112 = OpIAdd %uint %91 %111 + %113 = OpIAdd %uint %91 %112 + %114 = OpIAdd %uint %91 %113 + %115 = OpIAdd %uint %91 %114 + %116 = OpIAdd %uint %91 %115 + %117 = OpIAdd %uint %91 %116 + %118 = OpIAdd %uint %91 %117 + %119 = OpIAdd %uint %91 %118 + %120 = OpIAdd %uint %91 %119 + %121 = OpIAdd %uint %91 %120 + %122 = OpIAdd %uint %91 %121 + %123 = OpIAdd %uint %91 %122 + %124 = OpIAdd %uint %91 %123 + %125 = OpIAdd %uint %91 %124 + %126 = OpIAdd %uint %91 %125 + %127 = OpIAdd %uint %91 %126 + %128 = OpIAdd %uint %91 %127 + %129 = OpIAdd %uint %91 %128 + %130 = OpIAdd %uint %91 %129 + %131 = OpIAdd %uint %91 %130 + %132 = OpIAdd %uint %91 %131 + %133 = OpIAdd %uint %91 %132 + %134 = OpIAdd %uint %91 %133 + %135 = OpIAdd %uint %91 %134 + %136 = OpIAdd %uint %91 %135 + %137 = OpIAdd %uint %91 %136 + %138 = OpIAdd %uint %91 %137 + %139 = OpIAdd %uint %91 %138 + %140 = OpIAdd %uint %91 %139 + %141 = OpIAdd %uint %91 %140 + %142 = OpIAdd %uint %91 %141 + %143 = OpIAdd %uint %91 %142 + %144 = OpIAdd %uint %91 %143 + %145 = OpIAdd %uint %91 %144 + %146 = OpIAdd %uint %91 %145 + %147 = OpIAdd %uint %91 %146 + %148 = OpIAdd %uint %91 %147 + %149 = OpIAdd %uint %91 %148 + %150 = OpIAdd %uint %91 %149 + %151 = OpIAdd %uint %91 %150 + %152 = OpIAdd %uint %91 %151 + %153 = OpIAdd %uint %91 %152 + %154 = OpIAdd %uint %91 %153 + %155 = OpIAdd %uint %91 %154 + %156 = OpIAdd %uint %91 %155 + %157 = OpIAdd %uint %91 %156 + %158 = OpIAdd %uint %91 %157 + %159 = OpIAdd %uint %91 %158 + %160 = OpIAdd %uint %91 %159 + %161 = OpIAdd %uint %91 %160 + %162 = OpIAdd %uint %91 %161 + %163 = OpIAdd %uint %91 %162 + %164 = OpIAdd %uint %91 %163 + %165 = OpIAdd %uint %91 %164 + %166 = OpIAdd %uint %91 %165 + %167 = OpIAdd %uint %91 %166 + %168 = OpIAdd %uint %91 %167 + %169 = OpIAdd %uint %91 %168 + %170 = OpIAdd %uint %91 %169 + %171 = OpIAdd %uint %91 %170 + %172 = OpIAdd %uint %91 %171 + %173 = OpIAdd %uint %91 %172 + %174 = OpIAdd %uint %91 %173 + %175 = OpIAdd %uint %91 %174 + %176 = OpIAdd %uint %91 %175 + %177 = OpIAdd %uint %91 %176 + %178 = OpIAdd %uint %91 %177 + %179 = OpIAdd %uint %91 %178 + %180 = OpIAdd %uint %91 %179 + %181 = OpIAdd %uint %91 %180 + %182 = OpIAdd %uint %91 %181 + %183 = OpIAdd %uint %91 %182 + %184 = OpIAdd %uint %91 %183 + %185 = OpIAdd %uint %91 %184 + %186 = OpIAdd %uint %91 %185 + %187 = OpIAdd %uint %91 %186 + %188 = OpIAdd %uint %91 %187 + %189 = OpIAdd %uint %91 %188 + %190 = OpIAdd %uint %91 %189 + %191 = OpIAdd %uint %91 %190 + %192 = OpIAdd %uint %91 %191 + %193 = OpIAdd %uint %91 %192 + %194 = OpIAdd %uint %91 %193 + %195 = OpIAdd %uint %91 %194 + %196 = OpIAdd %uint %91 %195 + %197 = OpIAdd %uint %91 %196 + %198 = OpIAdd %uint %91 %197 + %199 = OpIAdd %uint %91 %198 + %200 = OpIAdd %uint %91 %199 + %201 = OpIAdd %uint %91 %200 + %202 = OpIAdd %uint %91 %201 + %203 = OpIAdd %uint %91 %202 + %204 = OpIAdd %uint %91 %203 + %205 = OpIAdd %uint %91 %204 + %206 = OpIAdd %uint %91 %205 + %207 = OpIAdd %uint %91 %206 + %208 = OpIAdd %uint %91 %207 + %209 = OpIAdd %uint %91 %208 + %210 = OpIAdd %uint %91 %209 + %211 = OpIAdd %uint %91 %210 + %212 = OpIAdd %uint %91 %211 + %213 = OpIAdd %uint %91 %212 + %214 = OpIAdd %uint %91 %213 + %215 = OpIAdd %uint %91 %214 + %216 = OpIAdd %uint %91 %215 + %217 = OpIAdd %uint %91 %216 + %218 = OpIAdd %uint %91 %217 + %219 = OpIAdd %uint %91 %218 + %220 = OpIAdd %uint %91 %219 + %221 = OpIAdd %uint %91 %220 + %222 = OpIAdd %uint %91 %221 + %223 = OpIAdd %uint %91 %222 + %224 = OpIAdd %uint %91 %223 + %225 = OpIAdd %uint %91 %224 + %226 = OpIAdd %uint %91 %225 + %227 = OpIAdd %uint %91 %226 + %228 = OpIAdd %uint %91 %227 + %229 = OpIAdd %uint %91 %228 + %230 = OpIAdd %uint %91 %229 + %231 = OpIAdd %uint %91 %230 + %232 = OpIAdd %uint %91 %231 + %233 = OpIAdd %uint %91 %232 + %234 = OpIAdd %uint %91 %233 + %235 = OpIAdd %uint %91 %234 + %236 = OpIAdd %uint %91 %235 + %result = OpIAdd %uint %91 %236 + %10103 = OpAccessChain %_ptr_Uniform_uint %7 %int_0 %10102 + OpStore %10103 %result + OpBranch %10100 + %10100 = OpLabel + %10104 = OpLoad %int %93 + %10105 = OpIAdd %int %10104 %int_1 + OpStore %93 %10105 + OpBranch %94 + %97 = OpLabel + OpReturnValue %89 + OpFunctionEnd + %10106 = OpFunction %bool None %24 + %10107 = OpLabel + %10108 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %10109 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %10110 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %10111 = OpLoad %uint %10108 + %10112 = OpLoad %uint %10109 + %10113 = OpLoad %uint %10110 + %10114 = OpBitwiseOr %uint %10111 %10112 + %10115 = OpBitwiseOr %uint %10113 %10114 + %10116 = OpIEqual %bool %10115 %uint_0 + OpReturnValue %10116 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp new file mode 100644 index 0000000000..5b6a189a71 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/extended-debug-extinst.invalid.asm.comp @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "DebugInfo" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 + OpExecutionMode %2 LocalSize 1 1 1 + %4 = OpString "negateInputs.comp" + %5 = OpString "negateInputs" + %6 = OpString "main" + %7 = OpString "" + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "gl_GlobalInvocationID" + OpDecorate %3 BuiltIn GlobalInvocationId + OpDecorate %8 BufferBlock + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 1 + OpDecorate %11 ArrayStride 4 + OpMemberDecorate %8 0 Offset 0 + OpLine %4 0 0 + %12 = OpTypeBool + %13 = OpTypeVoid + %14 = OpTypeFunction %13 + %15 = OpTypeInt 32 0 + %16 = OpTypeInt 32 1 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %15 3 + %19 = OpTypeVector %17 3 + %20 = OpTypePointer Input %18 + %21 = OpTypePointer Uniform %16 + %22 = OpTypePointer Uniform %17 + %23 = OpTypeRuntimeArray %16 + %11 = OpTypeRuntimeArray %17 + %8 = OpTypeStruct %11 + %24 = OpTypePointer Uniform %8 + %9 = OpVariable %24 Uniform + %10 = OpVariable %24 Uniform + OpLine %4 0 1 + OpLine %5 1 0 + OpLine %4 1000 100000 + %3 = OpVariable %20 Input + %25 = OpConstant %16 0 + OpNoLine + OpLine %4 1 1 + %26 = OpExtInst %13 %1 DebugInfoNone + %27 = OpExtInst %13 %1 DebugTypeFunction %13 + %28 = OpExtInst %13 %1 DebugFunction %6 %27 %4 1 1 %4 %7 FlagIsDefinition|FlagPrototyped|FlagIsOptimized 1 %26 %26 + %2 = OpFunction %13 None %14 + %29 = OpLabel + %30 = OpExtInst %13 %1 DebugScope %28 + OpLine %4 1 1 + %31 = OpLoad %18 %3 + %32 = OpCompositeExtract %15 %31 0 + %33 = OpAccessChain %22 %9 %25 %32 + %34 = OpLoad %17 %33 + %35 = OpFNegate %17 %34 + %36 = OpAccessChain %22 %10 %25 %32 + OpStore %36 %35 + OpNoLine + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp new file mode 100644 index 0000000000..e1efd564cb --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-collapse-degenerate-loop.asm.comp @@ -0,0 +1,118 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %_struct_2 BufferBlock + OpMemberDecorate %_struct_2 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + OpDecorate %_struct_4 BufferBlock + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_arr_uint_uint_3 ArrayStride 4 + OpDecorate %_struct_6 BufferBlock + OpMemberDecorate %_struct_6 0 Offset 0 + OpDecorate %_arr_uint_uint_11 ArrayStride 4 + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 1 + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 2 + %void = OpTypeVoid + %12 = OpTypeFunction %void + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 + %uint_0_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_8 = OpConstant %uint 8 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %uint_12 = OpConstant %uint 12 + %uint_13 = OpConstant %uint 13 + %uint_14 = OpConstant %uint 14 +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %_struct_2 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2 + %9 = OpVariable %_ptr_Uniform__struct_2 Uniform +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 + %_struct_4 = OpTypeStruct %_arr_uint_uint_3 +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %8 = OpVariable %_ptr_Uniform__struct_4 Uniform +%_arr_uint_uint_11 = OpTypeArray %uint %uint_11 + %_struct_6 = OpTypeStruct %_arr_uint_uint_11 +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 + %10 = OpVariable %_ptr_Uniform__struct_6 Uniform +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %1 = OpFunction %void None %12 + %33 = OpLabel + %34 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %35 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %36 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %37 = OpLoad %uint %34 + %38 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %37 + OpStore %38 %uint_8 + %39 = OpIAdd %uint %37 %uint_1 + OpStore %34 %39 + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %uint %34 + %42 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %41 + OpStore %42 %uint_9 + %43 = OpIAdd %uint %41 %uint_1 + OpStore %34 %43 + %44 = OpLoad %uint %35 + %45 = OpAccessChain %_ptr_Uniform_uint %8 %uint_0_0 %44 + %46 = OpLoad %uint %45 + %47 = OpIEqual %bool %46 %uint_1 + %48 = OpIAdd %uint %44 %uint_1 + OpStore %35 %48 + OpLoopMerge %49 %50 None + OpBranchConditional %47 %51 %49 + %51 = OpLabel + %52 = OpLoad %uint %34 + %53 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %52 + OpStore %53 %uint_12 + %54 = OpIAdd %uint %52 %uint_1 + OpStore %34 %54 + %55 = OpLoad %uint %36 + %56 = OpAccessChain %_ptr_Uniform_uint %9 %uint_0_0 %55 + %57 = OpLoad %uint %56 + %58 = OpIEqual %bool %57 %uint_1 + %59 = OpIAdd %uint %55 %uint_1 + OpStore %36 %59 + OpLoopMerge %60 %61 None + OpBranchConditional %58 %60 %60 + %49 = OpLabel + %62 = OpLoad %uint %34 + %63 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %62 + OpStore %63 %uint_10 + %64 = OpIAdd %uint %62 %uint_1 + OpStore %34 %64 + OpReturn + %60 = OpLabel + %65 = OpLoad %uint %34 + %66 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %65 + OpStore %66 %uint_13 + %67 = OpIAdd %uint %65 %uint_1 + OpStore %34 %67 + OpBranch %50 + %61 = OpLabel + OpBranch %51 + %50 = OpLabel + %68 = OpLoad %uint %34 + %69 = OpAccessChain %_ptr_Uniform_uint %10 %uint_0_0 %68 + OpStore %69 %uint_11 + %70 = OpIAdd %uint %68 %uint_1 + OpStore %34 %70 + OpBranch %40 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp new file mode 100644 index 0000000000..7fb41ed3f8 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/fuzz-loop-variable-dominator-with-unreachable-continue-block.asm.comp @@ -0,0 +1,376 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 257 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %gl_LocalInvocationIndex %gl_WorkGroupID + OpExecutionMode %1 LocalSize 1 1 1 + OpDecorate %_struct_4 BufferBlock + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_struct_6 BufferBlock + OpMemberDecorate %_struct_6 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + OpDecorate %_struct_8 BufferBlock + OpMemberDecorate %_struct_8 0 Offset 0 + OpDecorate %_arr_uint_uint_3 ArrayStride 4 + OpDecorate %_struct_10 BufferBlock + OpMemberDecorate %_struct_10 0 Offset 0 + OpDecorate %_arr_uint_uint_37 ArrayStride 4 + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 1 + OpDecorate %14 DescriptorSet 0 + OpDecorate %14 Binding 2 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 3 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 4 + OpDecorate %17 DescriptorSet 0 + OpDecorate %17 Binding 5 + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 6 + OpDecorate %19 DescriptorSet 0 + OpDecorate %19 Binding 7 + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 8 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 9 + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + %void = OpTypeVoid + %23 = OpTypeFunction %void + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 + %uint_666 = OpConstant %uint 666 + %uint_0_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %uint_8 = OpConstant %uint 8 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %uint_12 = OpConstant %uint 12 + %uint_13 = OpConstant %uint 13 + %uint_14 = OpConstant %uint 14 + %uint_15 = OpConstant %uint 15 + %uint_16 = OpConstant %uint 16 + %uint_17 = OpConstant %uint 17 + %uint_18 = OpConstant %uint 18 + %uint_19 = OpConstant %uint 19 + %uint_20 = OpConstant %uint 20 + %uint_21 = OpConstant %uint 21 + %uint_22 = OpConstant %uint 22 + %uint_23 = OpConstant %uint 23 + %uint_24 = OpConstant %uint 24 + %uint_25 = OpConstant %uint 25 + %uint_26 = OpConstant %uint 26 + %uint_27 = OpConstant %uint 27 + %uint_28 = OpConstant %uint 28 + %uint_29 = OpConstant %uint 29 + %uint_30 = OpConstant %uint 30 + %uint_31 = OpConstant %uint 31 + %uint_32 = OpConstant %uint 32 + %uint_33 = OpConstant %uint 33 + %uint_37 = OpConstant %uint 37 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %_struct_4 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %12 = OpVariable %_ptr_Uniform__struct_4 Uniform + %13 = OpVariable %_ptr_Uniform__struct_4 Uniform + %19 = OpVariable %_ptr_Uniform__struct_4 Uniform +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %_struct_6 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 + %14 = OpVariable %_ptr_Uniform__struct_6 Uniform + %15 = OpVariable %_ptr_Uniform__struct_6 Uniform + %16 = OpVariable %_ptr_Uniform__struct_6 Uniform + %17 = OpVariable %_ptr_Uniform__struct_6 Uniform + %18 = OpVariable %_ptr_Uniform__struct_6 Uniform +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 + %_struct_8 = OpTypeStruct %_arr_uint_uint_3 +%_ptr_Uniform__struct_8 = OpTypePointer Uniform %_struct_8 + %20 = OpVariable %_ptr_Uniform__struct_8 Uniform +%_arr_uint_uint_37 = OpTypeArray %uint %uint_37 + %_struct_10 = OpTypeStruct %_arr_uint_uint_37 +%_ptr_Uniform__struct_10 = OpTypePointer Uniform %_struct_10 + %21 = OpVariable %_ptr_Uniform__struct_10 Uniform +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %1 = OpFunction %void None %23 + %69 = OpLabel + %70 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %71 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %72 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %73 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %74 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %75 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %76 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %77 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %78 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %79 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %80 = OpLoad %uint %gl_LocalInvocationIndex + %81 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0_0 + %82 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_1 + %83 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_2 + %84 = OpLoad %uint %81 + %85 = OpLoad %uint %82 + %86 = OpLoad %uint %83 + %87 = OpIMul %uint %86 %uint_1 + %88 = OpIMul %uint %85 %uint_1 + %89 = OpIAdd %uint %88 %87 + %90 = OpIAdd %uint %89 %84 + %91 = OpIMul %uint %80 %uint_1 + %92 = OpIMul %uint %80 %uint_1 + %93 = OpIMul %uint %80 %uint_2 + %94 = OpIMul %uint %80 %uint_2 + %95 = OpIMul %uint %80 %uint_2 + %96 = OpIMul %uint %80 %uint_2 + %97 = OpIMul %uint %80 %uint_2 + %98 = OpIMul %uint %80 %uint_1 + %99 = OpIMul %uint %80 %uint_3 + %100 = OpIMul %uint %90 %uint_1 + %101 = OpIMul %uint %90 %uint_1 + %102 = OpIMul %uint %90 %uint_2 + %103 = OpIMul %uint %90 %uint_2 + %104 = OpIMul %uint %90 %uint_2 + %105 = OpIMul %uint %90 %uint_2 + %106 = OpIMul %uint %90 %uint_2 + %107 = OpIMul %uint %90 %uint_1 + %108 = OpIMul %uint %90 %uint_3 + %109 = OpIAdd %uint %100 %91 + %110 = OpIAdd %uint %101 %92 + %111 = OpIAdd %uint %102 %93 + %112 = OpIAdd %uint %103 %94 + %113 = OpIAdd %uint %104 %95 + %114 = OpIAdd %uint %105 %96 + %115 = OpIAdd %uint %106 %97 + %116 = OpIAdd %uint %107 %98 + %117 = OpIAdd %uint %108 %99 + %118 = OpIMul %uint %80 %uint_37 + %119 = OpIMul %uint %90 %uint_37 + %120 = OpIAdd %uint %119 %118 + OpStore %71 %109 + OpStore %72 %110 + OpStore %73 %111 + OpStore %74 %112 + OpStore %75 %113 + OpStore %76 %114 + OpStore %77 %115 + OpStore %78 %116 + OpStore %79 %117 + OpStore %70 %120 + %121 = OpLoad %uint %70 + %122 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %121 + OpStore %122 %uint_8 + %123 = OpIAdd %uint %121 %uint_1 + %124 = OpLoad %uint %71 + %125 = OpAccessChain %_ptr_Uniform_uint %12 %uint_0_0 %124 + %126 = OpLoad %uint %125 + %127 = OpIAdd %uint %124 %uint_1 + OpStore %71 %127 + OpSelectionMerge %128 None + OpSwitch %126 %128 + %128 = OpLabel + %129 = OpPhi %uint %130 %131 %123 %69 + %132 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %129 + OpStore %132 %uint_9 + %133 = OpIAdd %uint %129 %uint_1 + OpLoopMerge %134 %131 None + OpBranch %135 + %135 = OpLabel + %136 = OpPhi %uint %uint_666 %137 %133 %128 + %138 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %136 + OpStore %138 %uint_12 + %139 = OpIAdd %uint %136 %uint_1 + OpLoopMerge %140 %137 None + OpBranch %140 + %140 = OpLabel + %141 = OpPhi %uint %139 %135 %uint_666 %142 + %143 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %141 + OpStore %143 %uint_13 + %144 = OpIAdd %uint %141 %uint_1 + %145 = OpLoad %uint %75 + OpLoopMerge %146 %142 None + OpBranch %147 + %137 = OpLabel + OpBranch %135 + %147 = OpLabel + %148 = OpPhi %uint %144 %140 + %149 = OpPhi %uint %145 %140 + %150 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %148 + OpStore %150 %uint_17 + %151 = OpIAdd %uint %148 %uint_1 + %152 = OpAccessChain %_ptr_Uniform_uint %16 %uint_0_0 %149 + %153 = OpLoad %uint %152 + %154 = OpIEqual %bool %153 %uint_1 + %155 = OpIAdd %uint %149 %uint_1 + OpStore %75 %155 + OpSelectionMerge %156 None + OpBranchConditional %154 %157 %156 + %157 = OpLabel + %158 = OpPhi %uint %151 %147 + %159 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %158 + OpStore %159 %uint_19 + %160 = OpIAdd %uint %158 %uint_1 + %161 = OpLoad %uint %74 + OpBranch %146 + %156 = OpLabel + OpBranch %142 + %142 = OpLabel + OpBranchConditional %true %140 %146 + %146 = OpLabel + %162 = OpPhi %uint %160 %157 %uint_666 %142 + %163 = OpPhi %uint %161 %157 %uint_666 %142 + %164 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %162 + OpStore %164 %uint_15 + %165 = OpIAdd %uint %162 %uint_1 + %166 = OpAccessChain %_ptr_Uniform_uint %15 %uint_0_0 %163 + %167 = OpLoad %uint %166 + %168 = OpIEqual %bool %167 %uint_1 + %169 = OpIAdd %uint %163 %uint_1 + OpStore %74 %169 + %170 = OpLoad %uint %76 + OpSelectionMerge %171 None + OpBranchConditional %168 %172 %173 + %173 = OpLabel + %174 = OpPhi %uint %165 %146 + %175 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %174 + OpStore %175 %uint_22 + %176 = OpIAdd %uint %174 %uint_1 + %177 = OpLoad %uint %76 + OpBranch %172 + %172 = OpLabel + %178 = OpPhi %uint %176 %173 %165 %146 + %179 = OpPhi %uint %177 %173 %170 %146 + %180 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %178 + OpStore %180 %uint_21 + %181 = OpIAdd %uint %178 %uint_1 + %182 = OpAccessChain %_ptr_Uniform_uint %17 %uint_0_0 %179 + %183 = OpLoad %uint %182 + %184 = OpIAdd %uint %179 %uint_1 + OpStore %76 %184 + OpSelectionMerge %185 None + OpSwitch %183 %185 + %185 = OpLabel + %186 = OpPhi %uint %uint_666 %187 %181 %172 + %188 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %186 + OpStore %188 %uint_23 + %189 = OpIAdd %uint %186 %uint_1 + OpLoopMerge %190 %187 None + OpBranch %190 + %190 = OpLabel + %191 = OpPhi %uint %189 %185 %192 %193 + %194 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %191 + OpStore %194 %uint_24 + %195 = OpIAdd %uint %191 %uint_1 + %196 = OpLoad %uint %79 + OpLoopMerge %197 %193 None + OpBranch %198 + %187 = OpLabel + OpBranch %185 + %198 = OpLabel + %199 = OpPhi %uint %195 %190 + %200 = OpPhi %uint %196 %190 + %201 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %199 + OpStore %201 %uint_28 + %202 = OpIAdd %uint %199 %uint_1 + %203 = OpAccessChain %_ptr_Uniform_uint %20 %uint_0_0 %200 + %204 = OpLoad %uint %203 + %205 = OpIAdd %uint %200 %uint_1 + OpStore %79 %205 + OpSelectionMerge %206 None + OpSwitch %204 %207 1 %206 + %207 = OpLabel + %208 = OpPhi %uint %202 %198 + %209 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %208 + OpStore %209 %uint_30 + %210 = OpIAdd %uint %208 %uint_1 + %211 = OpLoad %uint %77 + OpBranch %197 + %206 = OpLabel + %212 = OpPhi %uint %202 %198 + %213 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %212 + OpStore %213 %uint_29 + %214 = OpIAdd %uint %212 %uint_1 + %215 = OpLoad %uint %78 + OpBranch %193 + %193 = OpLabel + %216 = OpPhi %uint %214 %206 + %217 = OpPhi %uint %215 %206 + %218 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %216 + OpStore %218 %uint_27 + %192 = OpIAdd %uint %216 %uint_1 + %219 = OpAccessChain %_ptr_Uniform_uint %19 %uint_0_0 %217 + %220 = OpLoad %uint %219 + %221 = OpIEqual %bool %220 %uint_1 + %222 = OpIAdd %uint %217 %uint_1 + OpStore %78 %222 + %223 = OpLoad %uint %77 + OpBranchConditional %221 %190 %197 + %197 = OpLabel + %224 = OpPhi %uint %210 %207 %192 %193 + %225 = OpPhi %uint %211 %207 %223 %193 + %226 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %224 + OpStore %226 %uint_26 + %227 = OpIAdd %uint %224 %uint_1 + %228 = OpAccessChain %_ptr_Uniform_uint %18 %uint_0_0 %225 + %229 = OpLoad %uint %228 + %230 = OpIEqual %bool %229 %uint_1 + %231 = OpIAdd %uint %225 %uint_1 + OpStore %77 %231 + %232 = OpLoad %uint %73 + OpBranchConditional %230 %131 %171 + %171 = OpLabel + OpBranch %131 + %131 = OpLabel + %233 = OpPhi %uint %uint_666 %171 %227 %197 + %234 = OpPhi %uint %uint_666 %171 %232 %197 + %235 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %233 + OpStore %235 %uint_11 + %130 = OpIAdd %uint %233 %uint_1 + %236 = OpAccessChain %_ptr_Uniform_uint %14 %uint_0_0 %234 + %237 = OpLoad %uint %236 + %238 = OpIEqual %bool %237 %uint_1 + %239 = OpIAdd %uint %234 %uint_1 + OpStore %73 %239 + %240 = OpLoad %uint %72 + OpBranchConditional %238 %128 %134 + %134 = OpLabel + %241 = OpPhi %uint %130 %131 + %242 = OpPhi %uint %240 %131 + %243 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %241 + OpStore %243 %uint_10 + %244 = OpIAdd %uint %241 %uint_1 + %245 = OpAccessChain %_ptr_Uniform_uint %13 %uint_0_0 %242 + %246 = OpLoad %uint %245 + %247 = OpIAdd %uint %242 %uint_1 + OpStore %72 %247 + OpSelectionMerge %248 None + OpSwitch %246 %249 1 %250 + %249 = OpLabel + %251 = OpPhi %uint %244 %134 + %252 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %251 + OpStore %252 %uint_32 + %253 = OpIAdd %uint %251 %uint_1 + OpBranch %248 + %250 = OpLabel + OpBranch %248 + %248 = OpLabel + %254 = OpPhi %uint %253 %249 %uint_666 %250 + %255 = OpAccessChain %_ptr_Uniform_uint %21 %uint_0_0 %254 + OpStore %255 %uint_31 + %256 = OpIAdd %uint %254 %uint_2 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp new file mode 100644 index 0000000000..7da9f95b9e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -0,0 +1,123 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %int_to_int_sabs = OpExtInst %v4int %1 SAbs %ints + %int_to_uint_sabs = OpExtInst %v4uint %1 SAbs %ints + %uint_to_int_sabs = OpExtInst %v4int %1 SAbs %uints + %uint_to_uint_sabs = OpExtInst %v4uint %1 SAbs %uints + + %int_to_int_ssign = OpExtInst %v4int %1 SSign %ints + %int_to_uint_ssign = OpExtInst %v4uint %1 SSign %ints + %uint_to_int_ssign = OpExtInst %v4int %1 SSign %uints + %uint_to_uint_ssign = OpExtInst %v4uint %1 SSign %uints + + %int_to_int_smsb = OpExtInst %v4int %1 FindSMsb %uints + %int_to_uint_smsb = OpExtInst %v4uint %1 FindSMsb %uints + %uint_to_int_umsb = OpExtInst %v4int %1 FindUMsb %ints + %uint_to_uint_umsb = OpExtInst %v4uint %1 FindUMsb %ints + + %int_to_int_smin = OpExtInst %v4int %1 SMin %ints %ints + %int_to_uint_smin = OpExtInst %v4uint %1 SMin %ints %uints + %uint_to_int_smin = OpExtInst %v4int %1 SMin %uints %uints + %uint_to_uint_smin = OpExtInst %v4uint %1 SMin %uints %ints + + %int_to_int_umin = OpExtInst %v4int %1 UMin %ints %uints + %int_to_uint_umin = OpExtInst %v4uint %1 UMin %ints %uints + %uint_to_int_umin = OpExtInst %v4int %1 UMin %uints %ints + %uint_to_uint_umin = OpExtInst %v4uint %1 UMin %uints %ints + + %int_to_int_smax = OpExtInst %v4int %1 SMax %ints %ints + %int_to_uint_smax = OpExtInst %v4uint %1 SMax %ints %ints + %uint_to_int_smax = OpExtInst %v4int %1 SMax %uints %ints + %uint_to_uint_smax = OpExtInst %v4uint %1 SMax %uints %ints + + %int_to_int_umax = OpExtInst %v4int %1 UMax %ints %uints + %int_to_uint_umax = OpExtInst %v4uint %1 UMax %ints %ints + %uint_to_int_umax = OpExtInst %v4int %1 UMax %uints %ints + %uint_to_uint_umax = OpExtInst %v4uint %1 UMax %uints %ints + + %int_to_int_sclamp = OpExtInst %v4int %1 SClamp %uints %uints %uints + %int_to_uint_sclamp = OpExtInst %v4uint %1 SClamp %uints %uints %uints + %uint_to_int_uclamp = OpExtInst %v4int %1 UClamp %ints %ints %ints + %uint_to_uint_uclamp = OpExtInst %v4uint %1 UClamp %ints %ints %ints + + OpStore %ints_ptr %int_to_int_sabs + OpStore %uints_ptr %int_to_uint_sabs + OpStore %ints_ptr %uint_to_int_sabs + OpStore %uints_ptr %uint_to_uint_sabs + + OpStore %ints_ptr %int_to_int_ssign + OpStore %uints_ptr %int_to_uint_ssign + OpStore %ints_ptr %uint_to_int_ssign + OpStore %uints_ptr %uint_to_uint_ssign + + OpStore %ints_ptr %int_to_int_smsb + OpStore %uints_ptr %int_to_uint_smsb + OpStore %ints_ptr %uint_to_int_umsb + OpStore %uints_ptr %uint_to_uint_umsb + + OpStore %ints_ptr %int_to_int_smin + OpStore %uints_ptr %int_to_uint_smin + OpStore %ints_ptr %uint_to_int_smin + OpStore %uints_ptr %uint_to_uint_smin + + OpStore %ints_ptr %int_to_int_umin + OpStore %uints_ptr %int_to_uint_umin + OpStore %ints_ptr %uint_to_int_umin + OpStore %uints_ptr %uint_to_uint_umin + + OpStore %ints_ptr %int_to_int_smax + OpStore %uints_ptr %int_to_uint_smax + OpStore %ints_ptr %uint_to_int_smax + OpStore %uints_ptr %uint_to_uint_smax + + OpStore %ints_ptr %int_to_int_umax + OpStore %uints_ptr %int_to_uint_umax + OpStore %ints_ptr %uint_to_int_umax + OpStore %uints_ptr %uint_to_uint_umax + + OpStore %ints_ptr %int_to_int_sclamp + OpStore %uints_ptr %int_to_uint_sclamp + OpStore %ints_ptr %uint_to_int_uclamp + OpStore %uints_ptr %uint_to_uint_uclamp + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp new file mode 100644 index 0000000000..30db11d45b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/glsl.std450.frexp-modf-struct.asm.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %ResTypeMod = OpTypeStruct %float %float +%_ptr_Function_ResTypeMod = OpTypePointer Function %ResTypeMod + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_20 = OpConstant %float 20 + %int_1 = OpConstant %int 1 +%_ptr_Function_float = OpTypePointer Function %float +%ResTypeFrexp = OpTypeStruct %float %int +%_ptr_Function_ResTypeFrexp = OpTypePointer Function %ResTypeFrexp + %float_40 = OpConstant %float 40 +%_ptr_Function_int = OpTypePointer Function %int + %SSBO = OpTypeStruct %float %int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %3 + %5 = OpLabel + %modres = OpExtInst %ResTypeMod %1 ModfStruct %float_20 + %frexpres = OpExtInst %ResTypeFrexp %1 FrexpStruct %float_40 + + %modres_f = OpCompositeExtract %float %modres 0 + %modres_i = OpCompositeExtract %float %modres 1 + %frexpres_f = OpCompositeExtract %float %frexpres 0 + %frexpres_i = OpCompositeExtract %int %frexpres 1 + + %float_ptr = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %int_ptr = OpAccessChain %_ptr_Uniform_int %_ %int_1 + + OpStore %float_ptr %modres_f + OpStore %float_ptr %modres_i + OpStore %float_ptr %frexpres_f + OpStore %int_ptr %frexpres_i + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp new file mode 100644 index 0000000000..5dad9dd5ed --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/image-atomic-nonuniform.vk.nocompat.asm.comp @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageImageArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %uImage "uImage" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %uImage DescriptorSet 0 + OpDecorate %uImage Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %30 NonUniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %7 = OpTypeImage %uint 2D 0 0 0 2 R32ui +%_runtimearr_7 = OpTypeRuntimeArray %7 +%_ptr_UniformConstant__runtimearr_7 = OpTypePointer UniformConstant %_runtimearr_7 + %uImage = OpVariable %_ptr_UniformConstant__runtimearr_7 UniformConstant + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_2 = OpConstant %uint 2 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %v2uint = OpTypeVector %uint 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Image_uint = OpTypePointer Image %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %16 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %17 = OpLoad %uint %16 + %18 = OpCopyObject %uint %17 + %20 = OpAccessChain %_ptr_UniformConstant_7 %uImage %18 + %22 = OpLoad %v3uint %gl_GlobalInvocationID + %23 = OpVectorShuffle %v2uint %22 %22 0 1 + %26 = OpBitcast %v2int %23 + %30 = OpImageTexelPointer %_ptr_Image_uint %20 %26 %uint_0 + %31 = OpAtomicIAdd %uint %30 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp new file mode 100644 index 0000000000..2eaef4bdbe --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id-override.vk.asm.comp @@ -0,0 +1,60 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + %spec_1 = OpSpecConstant %uint 11 + %spec_2 = OpSpecConstant %uint 12 + %spec_3 = OpSpecConstant %uint 13 + %spec_4 = OpSpecConstant %uint 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %uint_3 %spec_1 %spec_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp new file mode 100644 index 0000000000..3031f4bb8a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/local-size-id.vk.asm.comp @@ -0,0 +1,76 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionModeId %main LocalSizeId %spec_3 %spec_4 %uint_2 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %spec_1 SpecId 1 + OpDecorate %spec_2 SpecId 2 + OpDecorate %spec_3 SpecId 3 + OpDecorate %spec_4 SpecId 4 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO = OpTypePointer StorageBuffer %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_2 = OpConstant %float 2 +%_ptr_Uniform_v4float = OpTypePointer StorageBuffer %v4float + ; Test that we can declare the spec constant as signed. + ; Needs implicit bitcast since WorkGroupSize is uint. + %spec_1 = OpSpecConstant %int 11 + %spec_2 = OpSpecConstant %int 12 + %spec_3 = OpSpecConstant %int 13 + %spec_4 = OpSpecConstant %int 14 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + ; Test that we can build spec constant composites out of local size id values. + ; Needs special case handling. + %spec_3_op = OpSpecConstantOp %uint IAdd %spec_3 %uint_3 +%WorkGroupSize = OpSpecConstantComposite %v3uint %spec_3_op %spec_4 %uint_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %24 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + %25 = OpLoad %v4float %24 + %26 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %27 = OpFAdd %v4float %25 %26 + %wg_f = OpConvertUToF %v3float %WorkGroupSize + %wg_f4 = OpVectorShuffle %v4float %wg_f %wg_f 0 1 2 2 + ; Test that we can use the spec constants directly which needs to translate to gl_WorkGroupSize.elem. + ; Needs special case handling. + %res = OpFAdd %v4float %27 %wg_f4 + %f0 = OpConvertSToF %float %spec_3 + %f1 = OpConvertSToF %float %spec_4 + %f2 = OpConvertSToF %float %uint_2 + %res1 = OpVectorTimesScalar %v4float %res %f0 + %res2 = OpVectorTimesScalar %v4float %res1 %f1 + %res3 = OpVectorTimesScalar %v4float %res2 %f2 + %28 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %28 %res3 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp new file mode 100644 index 0000000000..b928099db8 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-initializer.asm.comp @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %7 "main" + OpExecutionMode %7 LocalSize 1 1 1 + OpDecorate %_struct_21 BufferBlock + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_struct_23 BufferBlock + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + OpDecorate %_struct_25 BufferBlock + OpMemberDecorate %_struct_25 0 Offset 0 + OpDecorate %_arr_uint_uint_11 ArrayStride 4 + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 2 + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 3 + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 4 + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 5 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 + %uint_0_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_8 = OpConstant %uint 8 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %uint_12 = OpConstant %uint 12 + %uint_13 = OpConstant %uint 13 + %uint_14 = OpConstant %uint 14 + %uint_15 = OpConstant %uint 15 + %uint_16 = OpConstant %uint 16 + %uint_17 = OpConstant %uint 17 + %uint_18 = OpConstant %uint 18 + %uint_19 = OpConstant %uint 19 + %uint_20 = OpConstant %uint 20 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %_struct_21 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform__struct_21 = OpTypePointer Uniform %_struct_21 + %31 = OpVariable %_ptr_Uniform__struct_21 Uniform + %28 = OpVariable %_ptr_Uniform__struct_21 Uniform + %29 = OpVariable %_ptr_Uniform__struct_21 Uniform + %30 = OpVariable %_ptr_Uniform__struct_21 Uniform +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %_struct_23 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform__struct_23 = OpTypePointer Uniform %_struct_23 + %27 = OpVariable %_ptr_Uniform__struct_23 Uniform +%_arr_uint_uint_11 = OpTypeArray %uint %uint_11 + %_struct_25 = OpTypeStruct %_arr_uint_uint_11 +%_ptr_Uniform__struct_25 = OpTypePointer Uniform %_struct_25 + %32 = OpVariable %_ptr_Uniform__struct_25 Uniform +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %7 = OpFunction %void None %2 + %8 = OpLabel + %54 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %55 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %56 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %57 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %58 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %59 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %60 = OpLoad %uint %54 + %61 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %60 + OpStore %61 %uint_8 + %62 = OpIAdd %uint %60 %uint_1 + OpStore %54 %62 + OpBranch %9 + %9 = OpLabel + %63 = OpLoad %uint %54 + %64 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %63 + OpStore %64 %uint_9 + %65 = OpIAdd %uint %63 %uint_1 + OpStore %54 %65 + %66 = OpLoad %uint %55 + %67 = OpAccessChain %_ptr_Uniform_uint %27 %uint_0_0 %66 + %68 = OpLoad %uint %67 + %69 = OpIEqual %bool %68 %uint_1 + %70 = OpIAdd %uint %66 %uint_1 + OpStore %55 %70 + OpLoopMerge %10 %11 None + OpBranchConditional %69 %12 %13 + %12 = OpLabel + %71 = OpLoad %uint %54 + %72 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %71 + OpStore %72 %uint_12 + %73 = OpIAdd %uint %71 %uint_1 + OpStore %54 %73 + OpReturn + %13 = OpLabel + %74 = OpLoad %uint %54 + %75 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %74 + OpStore %75 %uint_13 + %76 = OpIAdd %uint %74 %uint_1 + OpStore %54 %76 + %77 = OpLoad %uint %56 + %78 = OpAccessChain %_ptr_Uniform_uint %28 %uint_0_0 %77 + %79 = OpLoad %uint %78 + %80 = OpIEqual %bool %79 %uint_1 + %81 = OpIAdd %uint %77 %uint_1 + OpStore %56 %81 + OpBranchConditional %80 %11 %10 + %11 = OpLabel + %82 = OpLoad %uint %54 + %83 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %82 + OpStore %83 %uint_11 + %84 = OpIAdd %uint %82 %uint_1 + OpStore %54 %84 + OpBranch %14 + %14 = OpLabel + %85 = OpLoad %uint %54 + %86 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %85 + OpStore %86 %uint_14 + %87 = OpIAdd %uint %85 %uint_1 + OpStore %54 %87 + %88 = OpLoad %uint %57 + %89 = OpAccessChain %_ptr_Uniform_uint %29 %uint_0_0 %88 + %90 = OpLoad %uint %89 + %91 = OpIAdd %uint %88 %uint_1 + OpStore %57 %91 + OpSelectionMerge %15 None + OpSwitch %90 %16 + %16 = OpLabel + %92 = OpLoad %uint %54 + %93 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %92 + OpStore %93 %uint_16 + %94 = OpIAdd %uint %92 %uint_1 + OpStore %54 %94 + OpBranch %15 + %15 = OpLabel + %95 = OpLoad %uint %54 + %96 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %95 + OpStore %96 %uint_15 + %97 = OpIAdd %uint %95 %uint_1 + OpStore %54 %97 + %98 = OpLoad %uint %58 + %99 = OpAccessChain %_ptr_Uniform_uint %30 %uint_0_0 %98 + %100 = OpLoad %uint %99 + %101 = OpIEqual %bool %100 %uint_1 + %102 = OpIAdd %uint %98 %uint_1 + OpStore %58 %102 + OpSelectionMerge %17 None + OpBranchConditional %101 %18 %19 + %18 = OpLabel + OpBranch %17 + %19 = OpLabel + %103 = OpLoad %uint %54 + %104 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %103 + OpStore %104 %uint_19 + %105 = OpIAdd %uint %103 %uint_1 + OpStore %54 %105 + OpBranch %17 + %17 = OpLabel + %106 = OpLoad %uint %54 + %107 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %106 + OpStore %107 %uint_17 + %108 = OpIAdd %uint %106 %uint_1 + OpStore %54 %108 + %109 = OpLoad %uint %59 + %110 = OpAccessChain %_ptr_Uniform_uint %31 %uint_0_0 %109 + %111 = OpLoad %uint %110 + %112 = OpIEqual %bool %111 %uint_1 + %113 = OpIAdd %uint %109 %uint_1 + OpStore %59 %113 + OpBranchConditional %112 %9 %10 + %10 = OpLabel + OpBranch %20 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp new file mode 100644 index 0000000000..ebee277b7f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-early-read-with-undef.asm.comp @@ -0,0 +1,185 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 114 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %7 "main" + OpExecutionMode %7 LocalSize 1 1 1 + OpDecorate %_struct_21 BufferBlock + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_arr_uint_uint_1 ArrayStride 4 + OpDecorate %_struct_23 BufferBlock + OpMemberDecorate %_struct_23 0 Offset 0 + OpDecorate %_arr_uint_uint_2 ArrayStride 4 + OpDecorate %_struct_25 BufferBlock + OpMemberDecorate %_struct_25 0 Offset 0 + OpDecorate %_arr_uint_uint_11 ArrayStride 4 + OpDecorate %27 DescriptorSet 0 + OpDecorate %27 Binding 0 + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + OpDecorate %29 DescriptorSet 0 + OpDecorate %29 Binding 2 + OpDecorate %30 DescriptorSet 0 + OpDecorate %30 Binding 3 + OpDecorate %31 DescriptorSet 0 + OpDecorate %31 Binding 4 + OpDecorate %32 DescriptorSet 0 + OpDecorate %32 Binding 5 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %true = OpConstantTrue %bool + %uint_0 = OpConstant %uint 0 + %uint_0_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_8 = OpConstant %uint 8 + %uint_9 = OpConstant %uint 9 + %uint_10 = OpConstant %uint 10 + %uint_11 = OpConstant %uint 11 + %uint_12 = OpConstant %uint 12 + %uint_13 = OpConstant %uint 13 + %uint_14 = OpConstant %uint 14 + %uint_15 = OpConstant %uint 15 + %uint_16 = OpConstant %uint 16 + %uint_17 = OpConstant %uint 17 + %uint_18 = OpConstant %uint 18 + %uint_19 = OpConstant %uint 19 + %uint_20 = OpConstant %uint 20 +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 + %_struct_21 = OpTypeStruct %_arr_uint_uint_1 +%_ptr_Uniform__struct_21 = OpTypePointer Uniform %_struct_21 + %31 = OpVariable %_ptr_Uniform__struct_21 Uniform + %28 = OpVariable %_ptr_Uniform__struct_21 Uniform + %29 = OpVariable %_ptr_Uniform__struct_21 Uniform + %30 = OpVariable %_ptr_Uniform__struct_21 Uniform +%_arr_uint_uint_2 = OpTypeArray %uint %uint_2 + %_struct_23 = OpTypeStruct %_arr_uint_uint_2 +%_ptr_Uniform__struct_23 = OpTypePointer Uniform %_struct_23 + %27 = OpVariable %_ptr_Uniform__struct_23 Uniform +%_arr_uint_uint_11 = OpTypeArray %uint %uint_11 + %_struct_25 = OpTypeStruct %_arr_uint_uint_11 +%_ptr_Uniform__struct_25 = OpTypePointer Uniform %_struct_25 + %32 = OpVariable %_ptr_Uniform__struct_25 Uniform +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %7 = OpFunction %void None %2 + %8 = OpLabel + %54 = OpVariable %_ptr_Function_uint Function + %55 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %56 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %57 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %58 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %59 = OpVariable %_ptr_Function_uint Function %uint_0_0 + %60 = OpLoad %uint %54 + %61 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %60 + OpStore %61 %uint_8 + %62 = OpIAdd %uint %60 %uint_1 + OpStore %54 %62 + OpBranch %9 + %9 = OpLabel + %63 = OpLoad %uint %54 + %64 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %63 + OpStore %64 %uint_9 + %65 = OpIAdd %uint %63 %uint_1 + OpStore %54 %65 + %66 = OpLoad %uint %55 + %67 = OpAccessChain %_ptr_Uniform_uint %27 %uint_0_0 %66 + %68 = OpLoad %uint %67 + %69 = OpIEqual %bool %68 %uint_1 + %70 = OpIAdd %uint %66 %uint_1 + OpStore %55 %70 + OpLoopMerge %10 %11 None + OpBranchConditional %69 %12 %13 + %12 = OpLabel + %71 = OpLoad %uint %54 + %72 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %71 + OpStore %72 %uint_12 + %73 = OpIAdd %uint %71 %uint_1 + OpStore %54 %73 + OpReturn + %13 = OpLabel + %74 = OpLoad %uint %54 + %75 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %74 + OpStore %75 %uint_13 + %76 = OpIAdd %uint %74 %uint_1 + OpStore %54 %76 + %77 = OpLoad %uint %56 + %78 = OpAccessChain %_ptr_Uniform_uint %28 %uint_0_0 %77 + %79 = OpLoad %uint %78 + %80 = OpIEqual %bool %79 %uint_1 + %81 = OpIAdd %uint %77 %uint_1 + OpStore %56 %81 + OpBranchConditional %80 %11 %10 + %11 = OpLabel + %82 = OpLoad %uint %54 + %83 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %82 + OpStore %83 %uint_11 + %84 = OpIAdd %uint %82 %uint_1 + OpStore %54 %84 + OpBranch %14 + %14 = OpLabel + %85 = OpLoad %uint %54 + %86 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %85 + OpStore %86 %uint_14 + %87 = OpIAdd %uint %85 %uint_1 + OpStore %54 %87 + %88 = OpLoad %uint %57 + %89 = OpAccessChain %_ptr_Uniform_uint %29 %uint_0_0 %88 + %90 = OpLoad %uint %89 + %91 = OpIAdd %uint %88 %uint_1 + OpStore %57 %91 + OpSelectionMerge %15 None + OpSwitch %90 %16 + %16 = OpLabel + %92 = OpLoad %uint %54 + %93 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %92 + OpStore %93 %uint_16 + %94 = OpIAdd %uint %92 %uint_1 + OpStore %54 %94 + OpBranch %15 + %15 = OpLabel + %95 = OpLoad %uint %54 + %96 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %95 + OpStore %96 %uint_15 + %97 = OpIAdd %uint %95 %uint_1 + OpStore %54 %97 + %98 = OpLoad %uint %58 + %99 = OpAccessChain %_ptr_Uniform_uint %30 %uint_0_0 %98 + %100 = OpLoad %uint %99 + %101 = OpIEqual %bool %100 %uint_1 + %102 = OpIAdd %uint %98 %uint_1 + OpStore %58 %102 + OpSelectionMerge %17 None + OpBranchConditional %101 %18 %19 + %18 = OpLabel + OpBranch %17 + %19 = OpLabel + %103 = OpLoad %uint %54 + %104 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %103 + OpStore %104 %uint_19 + %105 = OpIAdd %uint %103 %uint_1 + OpStore %54 %105 + OpBranch %17 + %17 = OpLabel + %106 = OpLoad %uint %54 + %107 = OpAccessChain %_ptr_Uniform_uint %32 %uint_0_0 %106 + OpStore %107 %uint_17 + %108 = OpIAdd %uint %106 %uint_1 + OpStore %54 %108 + %109 = OpLoad %uint %59 + %110 = OpAccessChain %_ptr_Uniform_uint %31 %uint_0_0 %109 + %111 = OpLoad %uint %110 + %112 = OpIEqual %bool %111 %uint_1 + %113 = OpIAdd %uint %109 %uint_1 + OpStore %59 %113 + OpBranchConditional %112 %9 %10 + %10 = OpLabel + OpBranch %20 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp new file mode 100644 index 0000000000..f40377b118 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/loop-variable-with-initializer.asm.comp @@ -0,0 +1,31 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos; 0 +; Bound: 62 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %i "i" + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %31 = OpConstantNull %uint + %main = OpFunction %void None %11 + %14 = OpLabel + %i = OpVariable %_ptr_Function_uint Function %31 + OpStore %i %uint_0 + OpBranch %32 + %32 = OpLabel + OpLoopMerge %33 %34 None + OpBranch %33 + %34 = OpLabel + %57 = OpLoad %uint %i + OpBranch %32 + %33 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp new file mode 100644 index 0000000000..821370379e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/multi-break-switch-out-of-loop.asm.comp @@ -0,0 +1,94 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 53 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %count "count" + OpName %i "i" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %_ "" + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %UBO = OpTypeStruct %int +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %_ = OpVariable %_ptr_Uniform_UBO Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_20 = OpConstant %int 20 + %int_1 = OpConstant %int 1 + %v3uint = OpTypeVector %uint 3 + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %count = OpVariable %_ptr_Function_uint Function + %i = OpVariable %_ptr_Function_int Function + OpStore %count %uint_0 + OpStore %i %int_0 + OpBranch %14 + %14 = OpLabel + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %19 = OpLoad %int %i + %22 = OpSLessThan %bool %19 %int_4 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + OpSelectionMerge %24 None + OpSwitch %int_0 %23 + %23 = OpLabel + OpSelectionMerge %26 None + OpSwitch %int_0 %25 + %25 = OpLabel + OpSelectionMerge %28 None + OpSwitch %int_0 %27 + %27 = OpLabel + %33 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %34 = OpLoad %int %33 + %36 = OpIEqual %bool %34 %int_20 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + OpBranch %16 + %38 = OpLabel + OpBranch %28 + %28 = OpLabel + OpBranch %26 + %26 = OpLabel + %42 = OpLoad %uint %count + %44 = OpIAdd %uint %42 %int_1 + OpStore %count %44 + OpBranch %24 + %24 = OpLabel + %46 = OpLoad %uint %count + %47 = OpIAdd %uint %46 %int_1 + OpStore %count %47 + OpBranch %17 + %17 = OpLabel + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_1 + OpStore %i %49 + OpBranch %14 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp new file mode 100644 index 0000000000..5d5fac622a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/nonuniform-bracket-handling.vk.nocompat.asm.comp @@ -0,0 +1,299 @@ +; SPIR-V +; Version: 1.3 +; Generator: Unknown(30017); 21022 +; Bound: 233 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpCapability ImageQuery + OpCapability StorageImageWriteWithoutFormat + OpCapability GroupNonUniformBallot + OpCapability RuntimeDescriptorArray + OpCapability UniformTexelBufferArrayDynamicIndexing + OpCapability StorageTexelBufferArrayDynamicIndexing + OpCapability UniformTexelBufferArrayNonUniformIndexing + OpCapability StorageTexelBufferArrayNonUniformIndexing + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_EXT_descriptor_indexing" + OpExtension "SPV_KHR_physical_storage_buffer" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %RootConstants "RootConstants" + OpName %registers "registers" + OpName %SSBO_Offsets "SSBO_Offsets" + OpDecorate %RootConstants Block + OpMemberDecorate %RootConstants 0 Offset 0 + OpMemberDecorate %RootConstants 1 Offset 4 + OpMemberDecorate %RootConstants 2 Offset 8 + OpMemberDecorate %RootConstants 3 Offset 12 + OpMemberDecorate %RootConstants 4 Offset 16 + OpMemberDecorate %RootConstants 5 Offset 20 + OpMemberDecorate %RootConstants 6 Offset 24 + OpMemberDecorate %RootConstants 7 Offset 28 + OpDecorate %_runtimearr_v2uint ArrayStride 8 + OpMemberDecorate %SSBO_Offsets 0 Offset 0 + OpDecorate %SSBO_Offsets Block + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 Binding 0 + OpDecorate %13 NonWritable + OpDecorate %13 Restrict + OpDecorate %18 DescriptorSet 1 + OpDecorate %18 Binding 0 + OpDecorate %22 DescriptorSet 4 + OpDecorate %22 Binding 0 + OpDecorate %26 DescriptorSet 4 + OpDecorate %26 Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %148 NonUniform + OpDecorate %149 NonUniform + OpDecorate %172 NonUniform + OpDecorate %173 NonUniform + OpDecorate %196 NonUniform + OpDecorate %197 NonUniform + OpDecorate %205 NonUniform + OpDecorate %212 NonUniform + %void = OpTypeVoid + %2 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%RootConstants = OpTypeStruct %uint %uint %uint %uint %uint %uint %uint %uint +%_ptr_PushConstant_RootConstants = OpTypePointer PushConstant %RootConstants + %registers = OpVariable %_ptr_PushConstant_RootConstants PushConstant + %v2uint = OpTypeVector %uint 2 +%_runtimearr_v2uint = OpTypeRuntimeArray %v2uint +%SSBO_Offsets = OpTypeStruct %_runtimearr_v2uint +%_ptr_StorageBuffer_SSBO_Offsets = OpTypePointer StorageBuffer %SSBO_Offsets + %13 = OpVariable %_ptr_StorageBuffer_SSBO_Offsets StorageBuffer + %float = OpTypeFloat 32 + %15 = OpTypeImage %float Buffer 0 0 0 1 Unknown +%_runtimearr_15 = OpTypeRuntimeArray %15 +%_ptr_UniformConstant__runtimearr_15 = OpTypePointer UniformConstant %_runtimearr_15 + %18 = OpVariable %_ptr_UniformConstant__runtimearr_15 UniformConstant + %19 = OpTypeImage %float Buffer 0 0 0 2 R32f +%_runtimearr_19 = OpTypeRuntimeArray %19 +%_ptr_UniformConstant__runtimearr_19 = OpTypePointer UniformConstant %_runtimearr_19 + %22 = OpVariable %_ptr_UniformConstant__runtimearr_19 UniformConstant + %23 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_runtimearr_23 = OpTypeRuntimeArray %23 +%_ptr_UniformConstant__runtimearr_23 = OpTypePointer UniformConstant %_runtimearr_23 + %26 = OpVariable %_ptr_UniformConstant__runtimearr_23 UniformConstant +%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23 +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint + %uint_4 = OpConstant %uint 4 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 +%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint + %uint_0 = OpConstant %uint 0 +%_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19 +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %bool = OpTypeBool +%uint_4294967295 = OpConstant %uint 4294967295 + %v4float = OpTypeVector %float 4 + %uint_1024 = OpConstant %uint 1024 + %uint_2048 = OpConstant %uint 2048 +%_ptr_Image_uint = OpTypePointer Image %uint + %uint_40 = OpConstant %uint 40 + %uint_50 = OpConstant %uint 50 + %uint_70 = OpConstant %uint 70 + %main = OpFunction %void None %2 + %4 = OpLabel + OpBranch %231 + %231 = OpLabel + %30 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_4 + %32 = OpLoad %uint %30 + %33 = OpIAdd %uint %32 %uint_2 + %28 = OpAccessChain %_ptr_UniformConstant_23 %26 %33 + %35 = OpLoad %23 %28 + %36 = OpGroupNonUniformBroadcastFirst %uint %uint_3 %33 + %39 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %36 + %41 = OpLoad %v2uint %39 + %44 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_4 + %45 = OpLoad %uint %44 + %43 = OpAccessChain %_ptr_UniformConstant_19 %22 %45 + %46 = OpLoad %19 %43 + %47 = OpGroupNonUniformBroadcastFirst %uint %uint_3 %45 + %48 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %47 + %49 = OpLoad %v2uint %48 + %52 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_1 + %54 = OpLoad %uint %52 + %55 = OpIAdd %uint %54 %uint_1 + %51 = OpAccessChain %_ptr_UniformConstant_15 %18 %55 + %56 = OpLoad %15 %51 + %57 = OpGroupNonUniformBroadcastFirst %uint %uint_3 %55 + %58 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %57 + %59 = OpLoad %v2uint %58 + %64 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %65 = OpLoad %uint %64 + %66 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_1 + %67 = OpLoad %uint %66 + %68 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 + %69 = OpLoad %uint %68 + %70 = OpIAdd %uint %65 %uint_4 + %71 = OpCompositeExtract %uint %49 0 + %72 = OpCompositeExtract %uint %49 1 + %73 = OpIAdd %uint %70 %71 + %75 = OpULessThan %bool %70 %72 + %76 = OpSelect %uint %75 %73 %uint_4294967295 + %79 = OpImageRead %v4float %46 %76 + %80 = OpCompositeExtract %float %79 0 + %81 = OpCompositeExtract %float %79 1 + %82 = OpCompositeExtract %float %79 2 + %83 = OpCompositeExtract %float %79 3 + %84 = OpIAdd %uint %65 %uint_1024 + %86 = OpCompositeExtract %uint %49 0 + %87 = OpCompositeExtract %uint %49 1 + %88 = OpIAdd %uint %84 %86 + %89 = OpULessThan %bool %84 %87 + %90 = OpSelect %uint %89 %88 %uint_4294967295 + %91 = OpCompositeConstruct %v4float %80 %81 %82 %83 + OpImageWrite %46 %90 %91 + %92 = OpIAdd %uint %65 %uint_2 + %93 = OpCompositeExtract %uint %59 0 + %94 = OpCompositeExtract %uint %59 1 + %95 = OpIAdd %uint %92 %93 + %96 = OpULessThan %bool %92 %94 + %97 = OpSelect %uint %96 %95 %uint_4294967295 + %98 = OpImageFetch %v4float %56 %97 + %99 = OpCompositeExtract %float %98 0 + %100 = OpCompositeExtract %float %98 1 + %101 = OpCompositeExtract %float %98 2 + %102 = OpCompositeExtract %float %98 3 + %103 = OpIAdd %uint %65 %uint_2048 + %105 = OpCompositeExtract %uint %49 0 + %106 = OpCompositeExtract %uint %49 1 + %107 = OpIAdd %uint %103 %105 + %108 = OpULessThan %bool %103 %106 + %109 = OpSelect %uint %108 %107 %uint_4294967295 + %110 = OpCompositeConstruct %v4float %99 %100 %101 %102 + OpImageWrite %46 %109 %110 + %111 = OpCompositeExtract %uint %41 0 + %112 = OpCompositeExtract %uint %41 1 + %113 = OpIAdd %uint %65 %111 + %114 = OpULessThan %bool %65 %112 + %115 = OpSelect %uint %114 %113 %uint_4294967295 + %117 = OpImageTexelPointer %_ptr_Image_uint %28 %115 %uint_0 + %118 = OpAtomicIAdd %uint %117 %uint_1 %uint_0 %uint_40 + %120 = OpCompositeExtract %uint %41 0 + %121 = OpCompositeExtract %uint %41 1 + %122 = OpIAdd %uint %67 %120 + %123 = OpULessThan %bool %67 %121 + %124 = OpSelect %uint %123 %122 %uint_4294967295 + %125 = OpImageTexelPointer %_ptr_Image_uint %28 %124 %uint_0 + %126 = OpAtomicCompareExchange %uint %125 %uint_1 %uint_0 %uint_0 %uint_50 %uint_40 + %128 = OpCompositeExtract %uint %49 1 + %129 = OpConvertUToF %float %128 + %130 = OpCompositeExtract %uint %49 0 + %131 = OpCompositeExtract %uint %49 1 + %132 = OpIAdd %uint %uint_0 %130 + %133 = OpULessThan %bool %uint_0 %131 + %134 = OpSelect %uint %133 %132 %uint_4294967295 + %135 = OpCompositeConstruct %v4float %129 %129 %129 %129 + OpImageWrite %46 %134 %135 + %136 = OpCompositeExtract %uint %59 1 + %137 = OpConvertUToF %float %136 + %138 = OpCompositeExtract %uint %49 0 + %139 = OpCompositeExtract %uint %49 1 + %140 = OpIAdd %uint %uint_1 %138 + %141 = OpULessThan %bool %uint_1 %139 + %142 = OpSelect %uint %141 %140 %uint_4294967295 + %143 = OpCompositeConstruct %v4float %137 %137 %137 %137 + OpImageWrite %46 %142 %143 + %144 = OpIAdd %uint %69 %uint_0 + %146 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_4 + %147 = OpLoad %uint %146 + %148 = OpIAdd %uint %147 %144 + %145 = OpAccessChain %_ptr_UniformConstant_19 %22 %148 + %149 = OpLoad %19 %145 + %150 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %148 + %151 = OpLoad %v2uint %150 + %152 = OpCompositeExtract %uint %151 0 + %153 = OpCompositeExtract %uint %151 1 + %154 = OpIAdd %uint %70 %152 + %155 = OpULessThan %bool %70 %153 + %156 = OpSelect %uint %155 %154 %uint_4294967295 + %157 = OpImageRead %v4float %149 %156 + %158 = OpCompositeExtract %float %157 0 + %159 = OpCompositeExtract %float %157 1 + %160 = OpCompositeExtract %float %157 2 + %161 = OpCompositeExtract %float %157 3 + %162 = OpCompositeExtract %uint %151 0 + %163 = OpCompositeExtract %uint %151 1 + %164 = OpIAdd %uint %84 %162 + %165 = OpULessThan %bool %84 %163 + %166 = OpSelect %uint %165 %164 %uint_4294967295 + %167 = OpCompositeConstruct %v4float %158 %159 %160 %161 + OpImageWrite %149 %166 %167 + %168 = OpIAdd %uint %69 %uint_0 + %170 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_1 + %171 = OpLoad %uint %170 + %172 = OpIAdd %uint %171 %168 + %169 = OpAccessChain %_ptr_UniformConstant_15 %18 %172 + %173 = OpLoad %15 %169 + %174 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %172 + %175 = OpLoad %v2uint %174 + %176 = OpCompositeExtract %uint %175 0 + %177 = OpCompositeExtract %uint %175 1 + %178 = OpIAdd %uint %70 %176 + %179 = OpULessThan %bool %70 %177 + %180 = OpSelect %uint %179 %178 %uint_4294967295 + %181 = OpImageFetch %v4float %173 %180 + %182 = OpCompositeExtract %float %181 0 + %183 = OpCompositeExtract %float %181 1 + %184 = OpCompositeExtract %float %181 2 + %185 = OpCompositeExtract %float %181 3 + %186 = OpCompositeExtract %uint %151 0 + %187 = OpCompositeExtract %uint %151 1 + %188 = OpIAdd %uint %103 %186 + %189 = OpULessThan %bool %103 %187 + %190 = OpSelect %uint %189 %188 %uint_4294967295 + %191 = OpCompositeConstruct %v4float %182 %183 %184 %185 + OpImageWrite %149 %190 %191 + %192 = OpIAdd %uint %69 %uint_0 + %194 = OpAccessChain %_ptr_PushConstant_uint %registers %uint_4 + %195 = OpLoad %uint %194 + %196 = OpIAdd %uint %195 %192 + %193 = OpAccessChain %_ptr_UniformConstant_23 %26 %196 + %197 = OpLoad %23 %193 + %198 = OpAccessChain %_ptr_StorageBuffer_v2uint %13 %uint_0 %196 + %199 = OpLoad %v2uint %198 + %200 = OpCompositeExtract %uint %199 0 + %201 = OpCompositeExtract %uint %199 1 + %202 = OpIAdd %uint %67 %200 + %203 = OpULessThan %bool %67 %201 + %204 = OpSelect %uint %203 %202 %uint_4294967295 + %205 = OpImageTexelPointer %_ptr_Image_uint %193 %204 %uint_0 + %206 = OpAtomicIAdd %uint %205 %uint_1 %uint_0 %uint_40 + %207 = OpCompositeExtract %uint %199 0 + %208 = OpCompositeExtract %uint %199 1 + %209 = OpIAdd %uint %67 %207 + %210 = OpULessThan %bool %67 %208 + %211 = OpSelect %uint %210 %209 %uint_4294967295 + %212 = OpImageTexelPointer %_ptr_Image_uint %193 %211 %uint_0 + %213 = OpAtomicCompareExchange %uint %212 %uint_1 %uint_0 %uint_0 %uint_70 %uint_40 + %215 = OpCompositeExtract %uint %151 1 + %216 = OpConvertUToF %float %215 + %217 = OpCompositeExtract %uint %49 0 + %218 = OpCompositeExtract %uint %49 1 + %219 = OpIAdd %uint %uint_2 %217 + %220 = OpULessThan %bool %uint_2 %218 + %221 = OpSelect %uint %220 %219 %uint_4294967295 + %222 = OpCompositeConstruct %v4float %216 %216 %216 %216 + OpImageWrite %46 %221 %222 + %223 = OpCompositeExtract %uint %175 1 + %224 = OpConvertUToF %float %223 + %225 = OpCompositeExtract %uint %49 0 + %226 = OpCompositeExtract %uint %49 1 + %227 = OpIAdd %uint %uint_3 %225 + %228 = OpULessThan %bool %uint_3 %226 + %229 = OpSelect %uint %228 %227 %uint_4294967295 + %230 = OpCompositeConstruct %v4float %224 %224 %224 %224 + OpImageWrite %46 %229 %230 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp new file mode 100644 index 0000000000..611591246c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/phi-temporary-copy-loop-variable.asm.invalid.comp @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 42 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %cs_test "main" %gl_GlobalInvocationID %gl_LocalInvocationIndex + OpExecutionMode %cs_test LocalSize 8 8 1 + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %outImageTexture "outImageTexture" + OpName %cs_test "cs_test" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %outImageTexture DescriptorSet 0 + OpDecorate %outImageTexture Binding 1 + %float = OpTypeFloat 32 + %float_5 = OpConstant %float 5 + %float_1 = OpConstant %float 1 + %int = OpTypeInt 32 1 + %int_7 = OpConstant %int 7 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%type_2d_image = OpTypeImage %float 2D 2 0 0 2 Rgba32f +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint + %void = OpTypeVoid + %19 = OpTypeFunction %void + %v2uint = OpTypeVector %uint 2 + %v4float = OpTypeVector %float 4 + %bool = OpTypeBool +%outImageTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %cs_test = OpFunction %void None %19 + %23 = OpLabel + %24 = OpLoad %v3uint %gl_GlobalInvocationID + %25 = OpVectorShuffle %v2uint %24 %24 0 1 + OpBranch %26 + %26 = OpLabel + %27 = OpPhi %int %int_7 %23 %28 %29 + %30 = OpPhi %int %int_7 %23 %27 %29 + %31 = OpSGreaterThanEqual %bool %27 %int_0 + OpLoopMerge %32 %29 None + OpBranchConditional %31 %33 %32 + %33 = OpLabel + %34 = OpConvertSToF %float %27 + %35 = OpFOrdGreaterThan %bool %float_5 %34 + OpSelectionMerge %29 None + OpBranchConditional %35 %36 %29 + %36 = OpLabel + OpBranch %32 + %29 = OpLabel + %28 = OpISub %int %27 %int_1 + OpBranch %26 + %32 = OpLabel + %37 = OpISub %int %30 %int_1 + %38 = OpConvertSToF %float %37 + %39 = OpConvertSToF %float %30 + %40 = OpCompositeConstruct %v4float %38 %39 %float_1 %float_1 + %41 = OpLoad %type_2d_image %outImageTexture + OpImageWrite %41 %25 %40 None + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp new file mode 100644 index 0000000000..d3b746a6ec --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-force-temporary-rtas.spv14.asm.vk.nocompat.comp @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability RayQueryKHR + OpExtension "SPV_KHR_ray_query" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %_ %__0 %rq + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_ray_query" + OpSourceExtension "GL_EXT_ray_tracing" + OpName %main "main" + OpName %va "va" + OpName %Buf "Buf" + OpMemberName %Buf 0 "vas" + OpName %_ "" + OpName %Registers "Registers" + OpMemberName %Registers 0 "index" + OpName %__0 "" + OpName %rq "rq" + OpDecorate %_arr_v2uint_uint_1024 ArrayStride 8 + OpMemberDecorate %Buf 0 NonWritable + OpMemberDecorate %Buf 0 Offset 0 + OpDecorate %Buf Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %uint_1024 = OpConstant %uint 1024 +%_arr_v2uint_uint_1024 = OpTypeArray %v2uint %uint_1024 + %Buf = OpTypeStruct %_arr_v2uint_uint_1024 +%_ptr_StorageBuffer_Buf = OpTypePointer StorageBuffer %Buf + %_ = OpVariable %_ptr_StorageBuffer_Buf StorageBuffer + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %Registers = OpTypeStruct %uint +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %__0 = OpVariable %_ptr_PushConstant_Registers PushConstant +%_ptr_PushConstant_uint = OpTypePointer PushConstant %uint +%_ptr_StorageBuffer_v2uint = OpTypePointer StorageBuffer %v2uint + %bool = OpTypeBool + %false = OpConstantFalse %bool + %32 = OpTypeRayQueryKHR +%_ptr_Private_32 = OpTypePointer Private %32 + %rq = OpVariable %_ptr_Private_32 Private + %36 = OpTypeAccelerationStructureKHR + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %42 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %main = OpFunction %void None %3 + %5 = OpLabel + %va = OpVariable %_ptr_Function_v2uint Function + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %9 None + OpBranch %7 + %7 = OpLabel + %25 = OpAccessChain %_ptr_PushConstant_uint %__0 %int_0 + %26 = OpLoad %uint %25 + %28 = OpAccessChain %_ptr_StorageBuffer_v2uint %_ %int_0 %26 + %29 = OpLoad %v2uint %28 + OpStore %va %29 + %37 = OpConvertUToAccelerationStructureKHR %36 %29 + OpBranch %9 + %9 = OpLabel + OpBranchConditional %false %6 %8 + %8 = OpLabel + OpRayQueryInitializeKHR %rq %37 %uint_0 %uint_0 %42 %float_0 %42 %float_0 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp new file mode 100644 index 0000000000..6f4538a9a3 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/ray-query-function-object.spv14.asm.vk.nocompat.comp @@ -0,0 +1,39 @@ + OpCapability Shader + OpCapability RayTracingKHR + OpCapability RayQueryKHR + OpExtension "SPV_KHR_ray_tracing" + OpExtension "SPV_KHR_ray_query" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %RTAS %gl_LocalInvocationIndex + OpExecutionMode %main LocalSize 64 1 1 + OpSource GLSL 460 + OpName %accelerationStructureNV "accelerationStructureNV" + OpName %RTAS "RTAS" + OpName %main "main" + OpName %rayQueryKHR "rayQueryKHR" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %RTAS DescriptorSet 0 + OpDecorate %RTAS Binding 0 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_255 = OpConstant %uint 255 +%accelerationStructureNV = OpTypeAccelerationStructureKHR +%_ptr_UniformConstant_accelerationStructureNV = OpTypePointer UniformConstant %accelerationStructureNV +%_ptr_Input_uint = OpTypePointer Input %uint + %void = OpTypeVoid + %12 = OpTypeFunction %void +%rayQueryKHR = OpTypeRayQueryKHR +%_ptr_Function_rayQueryKHR = OpTypePointer Function %rayQueryKHR + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %RTAS = OpVariable %_ptr_UniformConstant_accelerationStructureNV UniformConstant +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %16 = OpUndef %float + %17 = OpUndef %v3float + %main = OpFunction %void None %12 + %18 = OpLabel + %19 = OpVariable %_ptr_Function_rayQueryKHR Function + %20 = OpLoad %accelerationStructureNV %RTAS + OpRayQueryInitializeKHR %19 %20 %uint_2 %uint_255 %17 %16 %17 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp new file mode 100644 index 0000000000..b4e622bace --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-name-aliasing.vk.asm.comp @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 35 +; Schema: 0 + 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 %SSBO "SSBO" + OpMemberName %SSBO 0 "values" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %A "A" + OpName %B "A" + OpName %C "A" + OpName %D "A" + OpName %E "A" + OpName %F "A" + OpName %G "A" + OpName %H "A" + OpName %I "A" + OpName %J "A" + OpName %K "A" + OpName %L "A" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %A SpecId 0 + OpDecorate %B SpecId 1 + OpDecorate %C SpecId 2 + OpDecorate %D SpecId 3 + OpDecorate %E SpecId 4 + OpDecorate %F SpecId 5 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %SSBO = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %A = OpSpecConstant %int 0 + %B = OpSpecConstant %int 1 + %C = OpSpecConstant %int 2 + %D = OpSpecConstant %int 3 + %E = OpSpecConstant %int 4 + %F = OpSpecConstant %int 5 + %G = OpSpecConstantOp %int ISub %A %B + %H = OpSpecConstantOp %int ISub %G %C + %I = OpSpecConstantOp %int ISub %H %D + %J = OpSpecConstantOp %int ISub %I %E + %K = OpSpecConstantOp %int ISub %J %F + %L = OpSpecConstantOp %int IAdd %K %F +%_ptr_Uniform_int = OpTypePointer Uniform %int + %uint_1 = OpConstant %uint 1 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %19 = OpLoad %uint %18 + %32 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %32 %L + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp new file mode 100644 index 0000000000..b7ca1143c5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/spec-constant-op-convert-sign.asm.comp @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "s64" + OpMemberName %SSBO 1 "u64" + OpName %_ "" + OpName %ConstantInt "ConstantInt" + OpName %ConstantInt64_1 "ConstantInt64_1" + OpName %ConstantUint "ConstantUint" + OpName %ConstantInt64_2 "ConstantInt64_2" + OpName %ConstantUint64_1 "ConstantUint64_1" + OpName %ConstantUint64_2 "ConstantUint64_2" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %ConstantInt SpecId 0 + OpDecorate %ConstantUint SpecId 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %long = OpTypeInt 64 1 + %ulong = OpTypeInt 64 0 + %SSBO = OpTypeStruct %int %uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 + %ulong_0 = OpConstant %ulong 0 +%ConstantInt = OpSpecConstant %int 1 +%ConstantUint = OpSpecConstant %uint 2 +%ConstantInt64_1 = OpSpecConstantOp %long SConvert %ConstantInt +%ConstantInt64_2 = OpSpecConstantOp %long SConvert %ConstantUint +%ConstantUint64_1 = OpSpecConstantOp %ulong SConvert %ConstantInt +%ConstantUint64_2 = OpSpecConstantOp %ulong SConvert %ConstantUint + %added_long = OpSpecConstantOp %long IAdd %ConstantInt64_1 %ConstantInt64_2 + %added_ulong = OpSpecConstantOp %ulong IAdd %ConstantUint64_1 %ConstantUint64_2 + %trunc_long = OpSpecConstantOp %int SConvert %added_long + %trunc_ulong = OpSpecConstantOp %uint SConvert %added_ulong +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + OpStore %22 %trunc_long + %29 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + OpStore %29 %trunc_ulong + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp new file mode 100644 index 0000000000..db9a8490df --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/storage-buffer-basic.asm.comp @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Codeplay; 0 +; Bound: 31 +; Schema: 0 + OpCapability Shader + ;OpCapability VariablePointers + OpExtension "SPV_KHR_storage_buffer_storage_class" + ;OpExtension "SPV_KHR_variable_pointers" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %22 "main" %gl_WorkGroupID + OpSource OpenCL_C 120 + OpDecorate %15 SpecId 0 + ;OpDecorate %16 SpecId 1 + OpDecorate %17 SpecId 2 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_4 0 Offset 0 + OpDecorate %_struct_4 Block + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %21 DescriptorSet 0 + OpDecorate %21 Binding 1 + %float = OpTypeFloat 32 +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_4 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %uint_0 = OpConstant %uint 0 +%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input + %15 = OpSpecConstant %uint 1 + %16 = OpConstant %uint 2 + %17 = OpSpecConstant %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %15 %16 %17 + %19 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %20 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %21 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer + %22 = OpFunction %void None %8 + %23 = OpLabel + %24 = OpAccessChain %_ptr_Input_uint %gl_WorkGroupID %uint_0 + %25 = OpLoad %uint %24 + %26 = OpAccessChain %_ptr_StorageBuffer_float %21 %uint_0 %25 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_StorageBuffer_float %20 %uint_0 %25 + %29 = OpLoad %float %28 + %30 = OpFAdd %float %27 %29 + OpStore %28 %30 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp new file mode 100644 index 0000000000..deaae421fd --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/comp/temorary-access-terminator.vk.nocompat.asm.comp @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Unknown(30017); 21022 +; Bound: 55 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpCapability GroupNonUniform + OpCapability GroupNonUniformBallot + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 64 1 1 + OpName %main "main" + OpName %WaveMatch "WaveMatch" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpDecorate %11 DescriptorSet 0 + OpDecorate %11 Binding 0 + OpDecorate %11 NonReadable + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %2 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %6 = OpTypeImage %uint Buffer 0 0 0 1 Unknown +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 + %8 = OpVariable %_ptr_UniformConstant_6 UniformConstant + %9 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9 + %11 = OpVariable %_ptr_UniformConstant_9 UniformConstant + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_0 = OpConstant %uint 0 + %v4uint = OpTypeVector %uint 4 + %24 = OpTypeFunction %v4uint %uint + %uint_3 = OpConstant %uint 3 + %bool = OpTypeBool + %uint_4 = OpConstant %uint 4 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %main = OpFunction %void None %2 + %4 = OpLabel + OpBranch %53 + %53 = OpLabel + %12 = OpLoad %9 %11 + %13 = OpLoad %6 %8 + %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %18 + %22 = OpImageFetch %v4uint %13 %20 + %23 = OpCompositeExtract %uint %22 0 + %37 = OpFunctionCall %v4uint %WaveMatch %23 + %38 = OpCompositeExtract %uint %37 0 + %39 = OpCompositeExtract %uint %37 1 + %40 = OpCompositeExtract %uint %37 2 + %41 = OpCompositeExtract %uint %37 3 + %42 = OpIMul %uint %20 %uint_4 + %44 = OpCompositeConstruct %v4uint %38 %38 %38 %38 + OpImageWrite %12 %42 %44 + %45 = OpCompositeConstruct %v4uint %39 %39 %39 %39 + %46 = OpIAdd %uint %42 %uint_1 + OpImageWrite %12 %46 %45 + %48 = OpCompositeConstruct %v4uint %40 %40 %40 %40 + %49 = OpIAdd %uint %42 %uint_2 + OpImageWrite %12 %49 %48 + %51 = OpCompositeConstruct %v4uint %41 %41 %41 %41 + %52 = OpIAdd %uint %42 %uint_3 + OpImageWrite %12 %52 %51 + OpReturn + OpFunctionEnd + %WaveMatch = OpFunction %v4uint None %24 + %25 = OpFunctionParameter %uint + %27 = OpLabel + OpBranch %28 + %28 = OpLabel + OpLoopMerge %30 %29 None + OpBranch %29 + %29 = OpLabel + %31 = OpGroupNonUniformBroadcastFirst %uint %uint_3 %25 + %34 = OpIEqual %bool %25 %31 + %35 = OpGroupNonUniformBallot %v4uint %uint_3 %34 + OpBranchConditional %34 %30 %28 + %30 = OpLabel + OpReturnValue %35 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag new file mode 100644 index 0000000000..eac8fadf74 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/degenerate-selection-constructs.asm.frag @@ -0,0 +1,310 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 816 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %checkSwap_f1_f1_ "checkSwap(f1;f1;" + OpName %a "a" + OpName %b "b" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf1 "buf1" + OpMemberName %buf1 0 "resolution" + OpName %_ "" + OpName %i "i" + OpName %data "data" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "injectionSwitch" + OpName %__0 "" + OpName %i_0 "i" + OpName %j "j" + OpName %doSwap "doSwap" + OpName %param "param" + OpName %param_0 "param" + OpName %temp "temp" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf1 0 Offset 0 + OpDecorate %buf1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %9 = OpTypeFunction %bool %_ptr_Function_float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %v2float = OpTypeVector %float 2 + %buf1 = OpTypeStruct %v2float +%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1 + %_ = OpVariable %_ptr_Uniform_buf1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_2 = OpConstant %float 2 +%_ptr_Function_bool = OpTypePointer Function %bool +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %__0 = OpVariable %_ptr_Uniform_buf0 Uniform + %int_1 = OpConstant %int 1 + %int_9 = OpConstant %int 9 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_10 = OpConstant %float 10 + %int_5 = OpConstant %int 5 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %data = OpVariable %_ptr_Function__arr_float_uint_10 Function + %i_0 = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %doSwap = OpVariable %_ptr_Function_bool Function + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_float Function + %temp = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %52 %53 None + OpBranch %54 + %54 = OpLabel + %55 = OpLoad %int %i + %57 = OpSLessThan %bool %55 %int_10 + OpBranchConditional %57 %51 %52 + %51 = OpLabel + %62 = OpLoad %int %i + %63 = OpLoad %int %i + %64 = OpISub %int %int_10 %63 + %65 = OpConvertSToF %float %64 + %69 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %uint_1 + %70 = OpLoad %float %69 + %71 = OpFMul %float %65 %70 + %72 = OpAccessChain %_ptr_Function_float %data %62 + OpStore %72 %71 + OpBranch %53 + %53 = OpLabel + %73 = OpLoad %int %i + %75 = OpIAdd %int %73 %int_1 + OpStore %i %75 + OpBranch %50 + %52 = OpLabel + OpStore %i_0 %int_0 + OpBranch %77 + %77 = OpLabel + OpLoopMerge %79 %80 None + OpBranch %81 + %81 = OpLabel + %82 = OpLoad %int %i_0 + %84 = OpSLessThan %bool %82 %int_9 + OpBranchConditional %84 %78 %79 + %78 = OpLabel + OpStore %j %int_0 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %int %j + %92 = OpSLessThan %bool %91 %int_10 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + %93 = OpLoad %int %j + %94 = OpLoad %int %i_0 + %95 = OpIAdd %int %94 %int_1 + %96 = OpSLessThan %bool %93 %95 + OpSelectionMerge %98 None + OpBranchConditional %96 %97 %98 + %97 = OpLabel + OpBranch %89 + %98 = OpLabel + %101 = OpLoad %int %i_0 + %102 = OpLoad %int %j + %104 = OpAccessChain %_ptr_Function_float %data %101 + %105 = OpLoad %float %104 + OpStore %param %105 + %107 = OpAccessChain %_ptr_Function_float %data %102 + %108 = OpLoad %float %107 + OpStore %param_0 %108 + %109 = OpFunctionCall %bool %checkSwap_f1_f1_ %param %param_0 + OpStore %doSwap %109 + %110 = OpLoad %bool %doSwap + OpSelectionMerge %112 None + OpBranchConditional %110 %111 %112 + %111 = OpLabel + %114 = OpLoad %int %i_0 + %115 = OpAccessChain %_ptr_Function_float %data %114 + %116 = OpLoad %float %115 + OpStore %temp %116 + %117 = OpLoad %int %i_0 + %118 = OpLoad %int %j + %119 = OpAccessChain %_ptr_Function_float %data %118 + %120 = OpLoad %float %119 + %121 = OpAccessChain %_ptr_Function_float %data %117 + OpStore %121 %120 + %122 = OpLoad %int %j + %123 = OpLoad %float %temp + %124 = OpAccessChain %_ptr_Function_float %data %122 + OpStore %124 %123 + OpBranch %112 + %112 = OpLabel + OpBranch %89 + %89 = OpLabel + %125 = OpLoad %int %j + %126 = OpIAdd %int %125 %int_1 + OpStore %j %126 + OpBranch %86 + %88 = OpLabel + OpBranch %80 + %80 = OpLabel + %127 = OpLoad %int %i_0 + %128 = OpIAdd %int %127 %int_1 + OpStore %i_0 %128 + OpBranch %77 + %79 = OpLabel + %130 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0 + %133 = OpLoad %float %132 + %134 = OpFDiv %float %133 %float_2 + %135 = OpFOrdLessThan %bool %131 %134 + OpSelectionMerge %137 None + OpBranchConditional %135 %136 %153 + %136 = OpLabel + %140 = OpAccessChain %_ptr_Function_float %data %int_0 + %141 = OpLoad %float %140 + %143 = OpFDiv %float %141 %float_10 + %145 = OpAccessChain %_ptr_Function_float %data %int_5 + %146 = OpLoad %float %145 + %147 = OpFDiv %float %146 %float_10 + %148 = OpAccessChain %_ptr_Function_float %data %int_9 + %149 = OpLoad %float %148 + %150 = OpFDiv %float %149 %float_10 + %152 = OpCompositeConstruct %v4float %143 %147 %150 %float_1 + OpStore %_GLF_color %152 + OpBranch %137 + %153 = OpLabel + %154 = OpAccessChain %_ptr_Function_float %data %int_5 + %155 = OpLoad %float %154 + %156 = OpFDiv %float %155 %float_10 + %157 = OpAccessChain %_ptr_Function_float %data %int_9 + %158 = OpLoad %float %157 + %159 = OpFDiv %float %158 %float_10 + %160 = OpAccessChain %_ptr_Function_float %data %int_0 + %161 = OpLoad %float %160 + %162 = OpFDiv %float %161 %float_10 + %163 = OpCompositeConstruct %v4float %156 %159 %162 %float_1 + OpStore %_GLF_color %163 + OpBranch %137 + %137 = OpLabel + OpReturn + OpFunctionEnd +%checkSwap_f1_f1_ = OpFunction %bool None %9 + %a = OpFunctionParameter %_ptr_Function_float + %b = OpFunctionParameter %_ptr_Function_float + %13 = OpLabel + %35 = OpVariable %_ptr_Function_bool Function + %20 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %21 = OpLoad %float %20 + %29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1 + %30 = OpLoad %float %29 + %32 = OpFDiv %float %30 %float_2 + %33 = OpFOrdLessThan %bool %21 %32 + OpBranch %36 + %36 = OpLabel + OpSelectionMerge %351 None + OpBranchConditional %33 %352 %354 + %352 = OpLabel + %353 = OpLoad %float %a + OpBranch %351 + %354 = OpLabel + %355 = OpCopyObject %float %float_0 + OpBranch %351 + %351 = OpLabel + %38 = OpPhi %float %353 %352 %355 %354 + OpSelectionMerge %386 None + OpBranchConditional %false %385 %385 + %385 = OpLabel + OpSelectionMerge %356 None + OpBranchConditional %33 %357 %359 + %357 = OpLabel + %358 = OpLoad %float %b + OpBranch %356 + %359 = OpLabel + %360 = OpCopyObject %float %float_0 + OpBranch %356 + %356 = OpLabel + %39 = OpPhi %float %358 %357 %360 %359 + %40 = OpFOrdGreaterThan %bool %38 %39 + OpBranch %362 + %362 = OpLabel + OpSelectionMerge %479 None + OpBranchConditional %33 %480 %479 + %480 = OpLabel + OpStore %35 %40 + OpBranch %479 + %479 = OpLabel + OpBranchConditional %true %361 %386 + %361 = OpLabel + OpBranch %386 + %386 = OpLabel + OpBranch %41 + %41 = OpLabel + OpSelectionMerge %363 None + OpBranchConditional %33 %366 %364 + %364 = OpLabel + %365 = OpLoad %float %a + OpBranch %363 + %366 = OpLabel + %367 = OpCopyObject %float %float_0 + OpBranch %363 + %363 = OpLabel + %42 = OpPhi %float %365 %364 %367 %366 + OpSelectionMerge %368 None + OpBranchConditional %33 %371 %369 + %369 = OpLabel + %370 = OpLoad %float %b + OpBranch %368 + %371 = OpLabel + %372 = OpCopyObject %float %float_0 + OpBranch %368 + %368 = OpLabel + %43 = OpPhi %float %370 %369 %372 %371 + %44 = OpFOrdLessThan %bool %42 %43 + OpSelectionMerge %373 None + OpBranchConditional %33 %373 %374 + %374 = OpLabel + OpStore %35 %44 + OpBranch %373 + %373 = OpLabel + OpBranch %37 + %37 = OpLabel + %45 = OpLoad %bool %35 + OpReturnValue %45 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag new file mode 100644 index 0000000000..6782b12473 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/anonymous-inner-struct-names.asm.frag @@ -0,0 +1,83 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_ + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpMemberName %AA 0 "foo" + OpMemberName %AB 0 "foo" + OpMemberName %A 0 "_aa" + OpMemberName %A 1 "ab" + OpMemberName %BA 0 "foo" + OpMemberName %BB 0 "foo" + OpMemberName %B 0 "_ba" + OpMemberName %B 1 "bb" + OpName %VertexData "VertexData" + OpMemberName %VertexData 0 "_a" + OpMemberName %VertexData 1 "b" + OpName %_ "" + OpMemberName %CA 0 "foo" + OpMemberName %C 0 "_ca" + OpMemberName %DA 0 "foo" + OpMemberName %D 0 "da" + OpName %UBO "UBO" + OpMemberName %UBO 0 "_c" + OpMemberName %UBO 1 "d" + OpName %__0 "" + OpMemberName %E 0 "a" + OpName %SSBO "SSBO" + ;OpMemberName %SSBO 0 "e" Test that we don't try to assign bogus aliases. + OpMemberName %SSBO 1 "_e" + OpMemberName %SSBO 2 "f" + OpName %__1 "" + OpDecorate %VertexData Block + OpDecorate %_ Location 0 + OpMemberDecorate %CA 0 Offset 0 + OpMemberDecorate %C 0 Offset 0 + OpMemberDecorate %DA 0 Offset 0 + OpMemberDecorate %D 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + OpMemberDecorate %E 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpMemberDecorate %SSBO 2 Offset 8 + OpDecorate %SSBO BufferBlock + OpDecorate %__1 DescriptorSet 0 + OpDecorate %__1 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %AA = OpTypeStruct %int + %AB = OpTypeStruct %int + %A = OpTypeStruct %AA %AB + %BA = OpTypeStruct %int + %BB = OpTypeStruct %int + %B = OpTypeStruct %BA %BB + %VertexData = OpTypeStruct %A %B +%_ptr_Input_VertexData = OpTypePointer Input %VertexData + %_ = OpVariable %_ptr_Input_VertexData Input + %CA = OpTypeStruct %int + %C = OpTypeStruct %CA + %DA = OpTypeStruct %int + %D = OpTypeStruct %DA + %UBO = OpTypeStruct %C %D +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %__0 = OpVariable %_ptr_Uniform_UBO Uniform + %E = OpTypeStruct %int + %SSBO = OpTypeStruct %E %E %E +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %__1 = OpVariable %_ptr_Uniform_SSBO Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag new file mode 100644 index 0000000000..387764c92c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/array-builtin-bitcast-load-store.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %fragColor %gl_SampleMask + OpExecutionMode %main OriginUpperLeft + OpName %fragColor "fragColor" + OpName %uBuffer "uBuffer" + OpMemberName %uBuffer 0 "color" + OpName %x_12 "x_12" + OpName %gl_SampleMask "gl_SampleMask" + OpName %main "main" + OpDecorate %fragColor Location 0 + OpDecorate %uBuffer Block + OpMemberDecorate %uBuffer 0 Offset 0 + OpDecorate %x_12 DescriptorSet 0 + OpDecorate %x_12 Binding 0 + OpDecorate %gl_SampleMask BuiltIn SampleMask + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %_ptr_Output_v4float = OpTypePointer Output %v4float + %5 = OpConstantNull %v4float + %fragColor = OpVariable %_ptr_Output_v4float Output %5 + %uBuffer = OpTypeStruct %v4float + %_ptr_Uniform_uBuffer = OpTypePointer Uniform %uBuffer + %x_12 = OpVariable %_ptr_Uniform_uBuffer Uniform + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %_arr_uint_uint_1 = OpTypeArray %uint %uint_1 +%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1 + %14 = OpConstantNull %_arr_uint_uint_1 + %gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output %14 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %_ptr_Output_uint = OpTypePointer Output %uint + %int_6 = OpConstant %int 6 + %main = OpFunction %void None %15 + %18 = OpLabel + %21 = OpAccessChain %_ptr_Uniform_v4float %x_12 %uint_0 + %22 = OpLoad %v4float %21 + OpStore %fragColor %22 + %26 = OpAccessChain %_ptr_Output_uint %gl_SampleMask %int_0 + %27 = OpBitcast %uint %int_6 + OpStore %26 %27 + %loaded_scalar = OpLoad %uint %26 + OpStore %26 %loaded_scalar + %loaded = OpLoad %_arr_uint_uint_1 %gl_SampleMask + OpStore %gl_SampleMask %loaded + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag new file mode 100644 index 0000000000..d5a07b5497 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/collapsed-switch-phi-flush.asm.frag @@ -0,0 +1,38 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vIndex + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vIndex "vIndex" + OpDecorate %FragColor Location 0 + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %main = OpFunction %void None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpSwitch %int_0 %9 + %9 = OpLabel + %tmp = OpPhi %v4float %15 %5 + OpStore %FragColor %tmp + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag new file mode 100644 index 0000000000..dda2f0279c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.invalid.frag @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %PSMain "main" %in_var_COLOR %in_var_TEXCOORD0 %out_var_SV_TARGET + OpExecutionMode %PSMain OriginUpperLeft + ; Not actually ESSL, but makes testing easier. + OpSource ESSL 310 + OpName %type_2d_image "type.2d.image" + OpName %tex "tex" + OpName %type_sampler "type.sampler" + OpName %Samp "Samp" + OpName %in_var_COLOR "in.var.COLOR" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_TARGET "out.var.SV_TARGET" + OpName %PSMain "PSMain" + OpName %PSInput "PSInput" + OpMemberName %PSInput 0 "color" + OpMemberName %PSInput 1 "uv" + OpName %param_var_input "param.var.input" + OpName %src_PSMain "src.PSMain" + OpName %input "input" + OpName %bb_entry "bb.entry" + OpName %a "a" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_COLOR Location 0 + OpDecorate %in_var_TEXCOORD0 Location 1 + OpDecorate %out_var_SV_TARGET Location 0 + OpDecorate %tex DescriptorSet 0 + OpDecorate %tex Binding 0 + OpDecorate %Samp DescriptorSet 0 + OpDecorate %Samp Binding 1 + OpDecorate %tex RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %21 = OpTypeFunction %void + %PSInput = OpTypeStruct %v4float %v2float +%_ptr_Function_PSInput = OpTypePointer Function %PSInput + %31 = OpTypeFunction %v4float %_ptr_Function_PSInput +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %Samp = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_COLOR = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output + %PSMain = OpFunction %void None %21 + %22 = OpLabel +%param_var_input = OpVariable %_ptr_Function_PSInput Function + %26 = OpLoad %v4float %in_var_COLOR + %27 = OpLoad %v2float %in_var_TEXCOORD0 + %28 = OpCompositeConstruct %PSInput %26 %27 + OpStore %param_var_input %28 + %29 = OpFunctionCall %v4float %src_PSMain %param_var_input + OpStore %out_var_SV_TARGET %29 + OpReturn + OpFunctionEnd + %src_PSMain = OpFunction %v4float None %31 + %input = OpFunctionParameter %_ptr_Function_PSInput + %bb_entry = OpLabel + %a = OpVariable %_ptr_Function_v4float Function + %36 = OpAccessChain %_ptr_Function_v4float %input %int_0 + %37 = OpLoad %v4float %36 + %38 = OpLoad %type_2d_image %tex + %39 = OpLoad %type_sampler %Samp + %41 = OpAccessChain %_ptr_Function_v2float %input %int_1 + %42 = OpLoad %v2float %41 + %44 = OpSampledImage %type_sampled_image %38 %39 + %45 = OpImageSampleImplicitLod %v4float %44 %42 None + %46 = OpFMul %v4float %37 %45 + OpStore %a %46 + %47 = OpLoad %v4float %a + OpReturnValue %47 + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag new file mode 100644 index 0000000000..ccb7a60fe7 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/complex-opaque-handle-reuse-in-loop.asm.frag @@ -0,0 +1,120 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 71 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %ps_main "main" %out_var_SV_TARGET1 + OpExecutionMode %ps_main OriginUpperLeft + OpSource HLSL 600 + OpName %type_scene "type.scene" + OpMemberName %type_scene 0 "myConsts" + OpName %MyConsts "MyConsts" + OpMemberName %MyConsts 0 "opt" + OpName %scene "scene" + OpName %type_sampler "type.sampler" + OpName %mySampler "mySampler" + OpName %type_2d_image "type.2d.image" + OpName %texTable "texTable" + OpName %out_var_SV_TARGET1 "out.var.SV_TARGET1" + OpName %ps_main "ps_main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %out_var_SV_TARGET1 Location 1 + OpDecorate %scene DescriptorSet 0 + OpDecorate %scene Binding 3 + OpDecorate %mySampler DescriptorSet 0 + OpDecorate %mySampler Binding 2 + OpDecorate %texTable DescriptorSet 0 + OpDecorate %texTable Binding 0 + OpMemberDecorate %MyConsts 0 Offset 0 + OpMemberDecorate %type_scene 0 Offset 0 + OpDecorate %type_scene Block + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 +%uint_16777215 = OpConstant %uint 16777215 + %uint_0 = OpConstant %uint 0 + %float_0 = OpConstant %float 0 + %21 = OpConstantComposite %v2float %float_0 %float_0 + %MyConsts = OpTypeStruct %uint + %type_scene = OpTypeStruct %MyConsts +%_ptr_Uniform_type_scene = OpTypePointer Uniform %type_scene +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %uint_1 = OpConstant %uint 1 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_arr_type_2d_image_uint_1 = OpTypeArray %type_2d_image %uint_1 +%_ptr_UniformConstant__arr_type_2d_image_uint_1 = OpTypePointer UniformConstant %_arr_type_2d_image_uint_1 +%_ptr_Output_uint = OpTypePointer Output %uint + %void = OpTypeVoid + %29 = OpTypeFunction %void + %v4uint = OpTypeVector %uint 4 + %v3float = OpTypeVector %float 3 +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool +%type_sampled_image = OpTypeSampledImage %type_2d_image + %v4float = OpTypeVector %float 4 + %scene = OpVariable %_ptr_Uniform_type_scene Uniform + %mySampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %texTable = OpVariable %_ptr_UniformConstant__arr_type_2d_image_uint_1 UniformConstant +%out_var_SV_TARGET1 = OpVariable %_ptr_Output_uint Output + %float_n1 = OpConstant %float -1 + %37 = OpUndef %v4uint + %ps_main = OpFunction %void None %29 + %38 = OpLabel + OpSelectionMerge %39 None + OpSwitch %uint_0 %40 + %40 = OpLabel + %41 = OpCompositeExtract %uint %37 1 + %42 = OpBitwiseAnd %uint %41 %uint_16777215 + %43 = OpAccessChain %_ptr_UniformConstant_type_2d_image %texTable %42 + %44 = OpLoad %type_2d_image %43 + %45 = OpAccessChain %_ptr_Uniform_uint %scene %int_0 %int_0 + %46 = OpLoad %uint %45 + %47 = OpINotEqual %bool %46 %uint_0 + OpSelectionMerge %48 DontFlatten + OpBranchConditional %47 %49 %50 + %50 = OpLabel + %51 = OpLoad %type_sampler %mySampler + %52 = OpSampledImage %type_sampled_image %44 %51 + %53 = OpImageSampleExplicitLod %v4float %52 %21 Lod %float_0 + %54 = OpCompositeExtract %float %53 0 + OpBranch %39 + %49 = OpLabel + OpBranch %39 + %48 = OpLabel + OpUnreachable + %39 = OpLabel + %55 = OpPhi %float %54 %50 %float_1 %49 + %56 = OpCompositeConstruct %v3float %float_n1 %float_n1 %55 + OpSelectionMerge %57 None + OpSwitch %uint_0 %58 + %58 = OpLabel + OpSelectionMerge %59 DontFlatten + OpBranchConditional %47 %60 %61 + %61 = OpLabel + %62 = OpLoad %type_sampler %mySampler + %63 = OpSampledImage %type_sampled_image %44 %62 + %64 = OpImageSampleExplicitLod %v4float %63 %21 Lod %float_0 + %65 = OpCompositeExtract %float %64 0 + OpBranch %57 + %60 = OpLabel + OpBranch %57 + %59 = OpLabel + OpUnreachable + %57 = OpLabel + %66 = OpPhi %float %65 %61 %float_1 %60 + %67 = OpCompositeConstruct %v3float %float_1 %float_1 %66 + %68 = OpExtInst %v3float %1 Cross %56 %67 + %69 = OpCompositeExtract %float %68 0 + %70 = OpConvertFToU %uint %69 + OpStore %out_var_SV_TARGET1 %70 + OpReturn + OpFunctionEnd + diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag new file mode 100644 index 0000000000..050a338530 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-1.asm.frag @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values0" + OpName %_ "" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %__0 "" + OpName %FragColor "FragColor" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpMemberDecorate %SSBO1 0 NonWritable + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v2float %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool +%_runtimearr_float = OpTypeRuntimeArray %float + %SSBO = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_runtimearr_float_0 = OpTypeRuntimeArray %float + %SSBO1 = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %__0 = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %FragColor = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %17 + %17 = OpLabel + %61 = OpPhi %v2float %11 %5 %d %18 + %60 = OpPhi %int %int_0 %5 %49 %18 + %25 = OpSLessThan %bool %60 %int_16 + OpLoopMerge %19 %18 None + OpBranchConditional %25 %pre18 %19 + %pre18 = OpLabel + OpBranch %18 + %18 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %60 + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %60 + %33 = OpLoad %float %32 + %44 = OpLoad %float %43 + %a = OpFMul %v2float %61 %61 + %b = OpCompositeInsert %v2float %33 %a 0 + %c = OpCompositeInsert %v2float %44 %b 1 + %d = OpFAdd %v2float %61 %c + %49 = OpIAdd %int %60 %int_1 + OpBranch %17 + %19 = OpLabel + OpStore %FragColor %61 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag new file mode 100644 index 0000000000..14f1f6efd9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-hoisted-temporaries-2.asm.frag @@ -0,0 +1,82 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "values0" + OpName %_ "" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %__0 "" + OpName %FragColor "FragColor" + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_runtimearr_float_0 ArrayStride 4 + OpMemberDecorate %SSBO1 0 NonWritable + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v2float %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool +%_runtimearr_float = OpTypeRuntimeArray %float + %SSBO = OpTypeStruct %_runtimearr_float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_runtimearr_float_0 = OpTypeRuntimeArray %float + %SSBO1 = OpTypeStruct %_runtimearr_float_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %__0 = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int_1 = OpConstant %int 1 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %FragColor = OpVariable %_ptr_Output_v2float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %17 + %17 = OpLabel + %61 = OpPhi %v2float %11 %5 %d %cont + %60 = OpPhi %int %int_0 %5 %49 %cont + %25 = OpSLessThan %bool %60 %int_16 + OpLoopMerge %19 %cont None + OpBranchConditional %25 %pre18 %19 + %pre18 = OpLabel + OpBranch %18 + %18 = OpLabel + %32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %60 + %43 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %60 + %33 = OpLoad %float %32 + %44 = OpLoad %float %43 + %a = OpFMul %v2float %61 %61 + %b = OpCompositeInsert %v2float %33 %a 0 + %c = OpCompositeInsert %v2float %44 %b 1 + OpBranch %cont + %cont = OpLabel + %d = OpFAdd %v2float %61 %c + %49 = OpIAdd %int %60 %int_1 + OpBranch %17 + %19 = OpLabel + OpStore %FragColor %61 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag new file mode 100644 index 0000000000..9408e69ac0 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/composite-insert-inheritance.asm.frag @@ -0,0 +1,127 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vInput %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %vInput "vInput" + OpName %FragColor "FragColor" + OpName %phi "PHI" + OpDecorate %vInput RelaxedPrecision + OpDecorate %vInput Location 0 + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %b0 RelaxedPrecision + OpDecorate %b1 RelaxedPrecision + OpDecorate %b2 RelaxedPrecision + OpDecorate %b3 RelaxedPrecision + OpDecorate %c1 RelaxedPrecision + OpDecorate %c3 RelaxedPrecision + OpDecorate %d4_mp RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vInput = OpVariable %_ptr_Input_v4float Input + %float_1 = OpConstant %float 1 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %uint_1 = OpConstant %uint 1 + %float_3 = OpConstant %float 3 + %uint_2 = OpConstant %uint 2 + %float_4 = OpConstant %float 4 + %uint_3 = OpConstant %uint 3 + %v4float_arr2 = OpTypeArray %v4float %uint_2 + %v44float = OpTypeMatrix %v4float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %v4undef = OpUndef %v4float + %v4const = OpConstantNull %v4float + %v4arrconst = OpConstantNull %v4float_arr2 + %v44const = OpConstantNull %v44float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + + %loaded0 = OpLoad %v4float %vInput + + ; Basic case (highp). + %a0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %a1 = OpCompositeInsert %v4float %float_2 %a0 1 + %a2 = OpCompositeInsert %v4float %float_3 %a1 2 + %a3 = OpCompositeInsert %v4float %float_4 %a2 3 + OpStore %FragColor %a3 + + ; Basic case (mediump). + %b0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %b1 = OpCompositeInsert %v4float %float_2 %b0 1 + %b2 = OpCompositeInsert %v4float %float_3 %b1 2 + %b3 = OpCompositeInsert %v4float %float_4 %b2 3 + OpStore %FragColor %b3 + + ; Mix relaxed precision. + %c0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %c1 = OpCompositeInsert %v4float %float_2 %c0 1 + %c2 = OpCompositeInsert %v4float %float_3 %c1 2 + %c3 = OpCompositeInsert %v4float %float_4 %c2 3 + OpStore %FragColor %c3 + + ; SSA use after insert + %d0 = OpCompositeInsert %v4float %float_1 %loaded0 0 + %d1 = OpCompositeInsert %v4float %float_2 %d0 1 + %d2 = OpCompositeInsert %v4float %float_3 %d1 2 + %d3 = OpCompositeInsert %v4float %float_4 %d2 3 + %d4 = OpFAdd %v4float %d3 %d0 + OpStore %FragColor %d4 + %d4_mp = OpFAdd %v4float %d3 %d1 + OpStore %FragColor %d4_mp + + ; Verify Insert behavior on Undef. + %e0 = OpCompositeInsert %v4float %float_1 %v4undef 0 + %e1 = OpCompositeInsert %v4float %float_2 %e0 1 + %e2 = OpCompositeInsert %v4float %float_3 %e1 2 + %e3 = OpCompositeInsert %v4float %float_4 %e2 3 + OpStore %FragColor %e3 + + ; Verify Insert behavior on Constant. + %f0 = OpCompositeInsert %v4float %float_1 %v4const 0 + OpStore %FragColor %f0 + + ; Verify Insert behavior on Array. + %g0 = OpCompositeInsert %v4float_arr2 %float_1 %v4arrconst 1 2 + %g1 = OpCompositeInsert %v4float_arr2 %float_2 %g0 0 3 + %g2 = OpCompositeExtract %v4float %g1 0 + OpStore %FragColor %g2 + %g3 = OpCompositeExtract %v4float %g1 1 + OpStore %FragColor %g3 + + ; Verify Insert behavior on Matrix. + %h0 = OpCompositeInsert %v44float %float_1 %v44const 1 2 + %h1 = OpCompositeInsert %v44float %float_2 %h0 2 3 + %h2 = OpCompositeExtract %v4float %h1 0 + OpStore %FragColor %h2 + %h3 = OpCompositeExtract %v4float %h1 1 + OpStore %FragColor %h3 + %h4 = OpCompositeExtract %v4float %h1 2 + OpStore %FragColor %h4 + %h5 = OpCompositeExtract %v4float %h1 3 + OpStore %FragColor %h5 + + ; Verify that we cannot RMW PHI variables. + OpBranch %next + %next = OpLabel + %phi = OpPhi %v4float %d2 %5 + %i0 = OpCompositeInsert %v4float %float_4 %phi 3 + OpStore %FragColor %i0 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag new file mode 100644 index 0000000000..9f1a4573dd --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/demote-impure-function-call.vk.nocompat.asm.frag @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 33 +; Schema: 0 + OpCapability Shader + OpCapability DemoteToHelperInvocationEXT + OpExtension "SPV_EXT_demote_to_helper_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vA %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_demote_to_helper_invocation" + OpName %main "main" + OpName %foobar_i1_ "foobar(i1;" + OpName %a "a" + OpName %a_0 "a" + OpName %vA "vA" + OpName %param "param" + OpName %FragColor "FragColor" + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %21 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_0 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_int Function + %29 = OpLoad %int %vA + OpStore %param %29 + %30 = OpFunctionCall %v4float %foobar_i1_ %param + OpStore %FragColor %21 + OpReturn + OpFunctionEnd + %foobar_i1_ = OpFunction %v4float None %10 + %a = OpFunctionParameter %_ptr_Function_int + %13 = OpLabel + %14 = OpLoad %int %a + %17 = OpSLessThan %bool %14 %int_0 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %19 + %18 = OpLabel + OpDemoteToHelperInvocationEXT + OpBranch %19 + %19 = OpLabel + OpReturnValue %21 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag new file mode 100644 index 0000000000..0f039166b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/discard-impure-function-call.asm.frag @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vA %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %foobar_i1_ "foobar(i1;" + OpName %a "a" + OpName %a_0 "a" + OpName %vA "vA" + OpName %param "param" + OpName %FragColor "FragColor" + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %22 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_0 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_int Function + %30 = OpLoad %int %vA + OpStore %param %30 + %31 = OpFunctionCall %v4float %foobar_i1_ %param + OpStore %FragColor %22 + OpReturn + OpFunctionEnd + %foobar_i1_ = OpFunction %v4float None %10 + %a = OpFunctionParameter %_ptr_Function_int + %13 = OpLabel + %14 = OpLoad %int %a + %17 = OpSLessThan %bool %14 %int_0 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %19 + %18 = OpLabel + OpKill + %19 = OpLabel + OpReturnValue %22 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag new file mode 100644 index 0000000000..97400dfb16 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-continue-phi.asm.invalid.frag @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 42 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %31 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %true = OpConstantTrue %bool + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %33 + %33 = OpLabel + OpLoopMerge %32 %35 None + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %24 None + OpBranch %7 + %7 = OpLabel + %17 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %18 = OpLoad %float %17 + %22 = OpFOrdNotEqual %bool %18 %18 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpBranch %8 + %24 = OpLabel + OpBranchConditional %false %6 %8 + %8 = OpLabel + %41 = OpPhi %bool %true %23 %false %24 + OpSelectionMerge %39 None + OpBranchConditional %41 %32 %39 + %39 = OpLabel + OpStore %_GLF_color %31 + OpBranch %32 + %35 = OpLabel + OpBranch %33 + %32 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..93a39cfe12 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/do-while-loop-inverted-test.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + 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_1 = OpConstant %int 1 + %int_20 = OpConstant %int 20 + %bool = OpTypeBool + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpStore %j %int_0 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %12 + %12 = OpLabel + %15 = OpLoad %int %j + %16 = OpLoad %int %i + %17 = OpIAdd %int %15 %16 + %19 = OpIAdd %int %17 %int_1 + %20 = OpLoad %int %j + %21 = OpIMul %int %19 %20 + OpStore %j %21 + %22 = OpLoad %int %i + %23 = OpIAdd %int %22 %int_1 + OpStore %i %23 + OpBranch %14 + %14 = OpLabel + %24 = OpLoad %int %i + %27 = OpIEqual %bool %24 %int_20 + OpBranchConditional %27 %13 %11 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag new file mode 100644 index 0000000000..d789ce36b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/early-conditional-return-switch.asm.frag @@ -0,0 +1,133 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google spiregg; 0 +; Bound: 81 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + OpCapability Image1D + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %PsTextureLoadArray "main" %gl_FragCoord %out_var_SV_TARGET + OpExecutionMode %PsTextureLoadArray OriginUpperLeft + OpSource HLSL 500 + OpName %type_2d_image "type.2d.image" + OpName %type_gCBuffarrayIndex "type.gCBuffarrayIndex" + OpMemberName %type_gCBuffarrayIndex 0 "gArrayIndex" + OpName %gCBuffarrayIndex "gCBuffarrayIndex" + OpName %g_textureArray0 "g_textureArray0" + OpName %g_textureArray1 "g_textureArray1" + OpName %g_textureArray2 "g_textureArray2" + OpName %g_textureArray3 "g_textureArray3" + OpName %out_var_SV_TARGET "out.var.SV_TARGET" + OpName %PsTextureLoadArray "PsTextureLoadArray" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %out_var_SV_TARGET Location 0 + OpDecorate %gCBuffarrayIndex DescriptorSet 0 + OpDecorate %gCBuffarrayIndex Binding 0 + OpDecorate %g_textureArray0 DescriptorSet 0 + OpDecorate %g_textureArray0 Binding 0 + OpDecorate %g_textureArray1 DescriptorSet 0 + OpDecorate %g_textureArray1 Binding 1 + OpDecorate %g_textureArray2 DescriptorSet 0 + OpDecorate %g_textureArray2 Binding 2 + OpDecorate %g_textureArray3 DescriptorSet 0 + OpDecorate %g_textureArray3 Binding 3 + OpMemberDecorate %type_gCBuffarrayIndex 0 Offset 0 + OpDecorate %type_gCBuffarrayIndex Block + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %v4float = OpTypeVector %float 4 + %18 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_gCBuffarrayIndex = OpTypeStruct %uint +%_ptr_Uniform_type_gCBuffarrayIndex = OpTypePointer Uniform %type_gCBuffarrayIndex +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %24 = OpTypeFunction %void +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %v3int = OpTypeVector %int 3 + %v2int = OpTypeVector %int 2 +%gCBuffarrayIndex = OpVariable %_ptr_Uniform_type_gCBuffarrayIndex Uniform +%g_textureArray0 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%g_textureArray1 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%g_textureArray2 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%g_textureArray3 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %32 = OpUndef %v4float +%PsTextureLoadArray = OpFunction %void None %24 + %33 = OpLabel + %34 = OpLoad %v4float %gl_FragCoord + OpSelectionMerge %35 None + OpSwitch %uint_0 %36 + %36 = OpLabel + %37 = OpAccessChain %_ptr_Uniform_uint %gCBuffarrayIndex %int_0 + %38 = OpLoad %uint %37 + OpSelectionMerge %39 None + OpSwitch %38 %40 0 %41 1 %42 2 %43 3 %44 + %41 = OpLabel + %45 = OpCompositeExtract %float %34 0 + %46 = OpCompositeExtract %float %34 1 + %47 = OpConvertFToS %int %45 + %48 = OpConvertFToS %int %46 + %49 = OpCompositeConstruct %v3int %47 %48 %int_0 + %50 = OpVectorShuffle %v2int %49 %49 0 1 + %51 = OpLoad %type_2d_image %g_textureArray0 + %52 = OpImageFetch %v4float %51 %50 Lod %int_0 + OpBranch %39 + %42 = OpLabel + %53 = OpCompositeExtract %float %34 0 + %54 = OpCompositeExtract %float %34 1 + %55 = OpConvertFToS %int %53 + %56 = OpConvertFToS %int %54 + %57 = OpCompositeConstruct %v3int %55 %56 %int_0 + %58 = OpVectorShuffle %v2int %57 %57 0 1 + %59 = OpLoad %type_2d_image %g_textureArray1 + %60 = OpImageFetch %v4float %59 %58 Lod %int_0 + OpBranch %39 + %43 = OpLabel + %61 = OpCompositeExtract %float %34 0 + %62 = OpCompositeExtract %float %34 1 + %63 = OpConvertFToS %int %61 + %64 = OpConvertFToS %int %62 + %65 = OpCompositeConstruct %v3int %63 %64 %int_0 + %66 = OpVectorShuffle %v2int %65 %65 0 1 + %67 = OpLoad %type_2d_image %g_textureArray2 + %68 = OpImageFetch %v4float %67 %66 Lod %int_0 + OpBranch %39 + %44 = OpLabel + %69 = OpCompositeExtract %float %34 0 + %70 = OpCompositeExtract %float %34 1 + %71 = OpConvertFToS %int %69 + %72 = OpConvertFToS %int %70 + %73 = OpCompositeConstruct %v3int %71 %72 %int_0 + %74 = OpVectorShuffle %v2int %73 %73 0 1 + %75 = OpLoad %type_2d_image %g_textureArray3 + %76 = OpImageFetch %v4float %75 %74 Lod %int_0 + OpBranch %39 + %40 = OpLabel + OpBranch %39 + %39 = OpLabel + %77 = OpPhi %v4float %52 %41 %60 %42 %68 %43 %76 %44 %32 %40 + %78 = OpPhi %bool %true %41 %true %42 %true %43 %true %44 %false %40 + OpSelectionMerge %79 None + OpBranchConditional %78 %35 %79 + %79 = OpLabel + OpBranch %35 + %35 = OpLabel + %80 = OpPhi %v4float %77 %39 %18 %79 + OpStore %out_var_SV_TARGET %80 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag new file mode 100644 index 0000000000..a9650ddbb6 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/empty-struct-in-struct.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %EmptyStruct2Test "EmptyStruct2Test" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%EmptyStruct2Test = OpTypeStruct %EmptyStructTest +%_ptr_Function_EmptyStruct2Test = OpTypePointer Function %EmptyStruct2Test + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStruct2Test + %6 = OpTypeFunction %float %EmptyStruct2Test + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStruct2Test + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + %value4 = OpConstantNull %EmptyStruct2Test + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStruct2Test + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStruct2Test + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStruct2Test Function + %18 = OpVariable %_ptr_Function_EmptyStruct2Test Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %value3 = OpCompositeConstruct %EmptyStruct2Test %value2 + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value3 + %24 = OpFunctionCall %float %GetValue2 %value4 + OpStore %value %22 + OpStore %value %23 + OpStore %value %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag new file mode 100644 index 0000000000..1e67b381e2 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-inverted.asm.invalid.frag @@ -0,0 +1,37 @@ + 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 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %8 + %8 = OpLabel + %10 = OpPhi %int %12 %7 %int_0 %5 + OpLoopMerge %6 %7 None + OpBranch %11 + %11 = OpLabel + %16 = OpIEqual %bool %10 %int_16 + OpBranchConditional %16 %18 %19 + %18 = OpLabel + OpBranch %6 + %19 = OpLabel + OpBranch %17 + %17 = OpLabel + %21 = OpIAdd %int %10 %int_1 + OpBranch %7 + %7 = OpLabel + %12 = OpPhi %int %21 %17 + OpBranch %8 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag new file mode 100644 index 0000000000..22c6e55c42 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-dedicated-merge-block-non-inverted.asm.invalid.frag @@ -0,0 +1,37 @@ + 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 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %8 + %8 = OpLabel + %10 = OpPhi %int %12 %7 %int_0 %5 + OpLoopMerge %6 %7 None + OpBranch %11 + %11 = OpLabel + %16 = OpINotEqual %bool %10 %int_16 + OpBranchConditional %16 %19 %18 + %18 = OpLabel + OpBranch %6 + %19 = OpLabel + OpBranch %17 + %17 = OpLabel + %21 = OpIAdd %int %10 %int_1 + OpBranch %7 + %7 = OpLabel + %12 = OpPhi %int %21 %17 + OpBranch %8 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..a87ceee182 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/for-loop-inverted-test.asm.frag @@ -0,0 +1,35 @@ + 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 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %8 + %8 = OpLabel + %10 = OpPhi %int %12 %7 %int_0 %5 + OpLoopMerge %6 %7 None + OpBranch %11 + %11 = OpLabel + %16 = OpIEqual %bool %10 %int_16 + OpBranchConditional %16 %6 %19 + %19 = OpLabel + OpBranch %17 + %17 = OpLabel + %21 = OpIAdd %int %10 %int_1 + OpBranch %7 + %7 = OpLabel + %12 = OpPhi %int %21 %17 + OpBranch %8 + %6 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag new file mode 100644 index 0000000000..ca8022d4bb --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/image-fetch-uint-coord.asm.frag @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 29 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target0 + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %Tex "Tex" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %main "main" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %Tex DescriptorSet 0 + OpDecorate %Tex Binding 0 + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 + %float = OpTypeFloat 32 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %16 = OpTypeFunction %void + %Tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v3uint Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %16 + %19 = OpLabel + %20 = OpLoad %v3uint %in_var_TEXCOORD0 + %21 = OpCompositeExtract %uint %20 2 + %27 = OpLoad %type_2d_image %Tex + %28 = OpImageFetch %v4float %27 %20 Lod %21 + OpStore %out_var_SV_Target0 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag new file mode 100644 index 0000000000..8b09e5b68f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag @@ -0,0 +1,646 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 1532 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %IN_HPosition %IN_Uv_EdgeDistance1 %IN_UvStuds_EdgeDistance2 %IN_Color %IN_LightPosition_Fog %IN_View_Depth %IN_Normal_SpecPower %IN_Tangent %IN_PosLightSpace_Reflectance %IN_studIndex %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %VertexOutput "VertexOutput" + OpMemberName %VertexOutput 0 "HPosition" + OpMemberName %VertexOutput 1 "Uv_EdgeDistance1" + OpMemberName %VertexOutput 2 "UvStuds_EdgeDistance2" + OpMemberName %VertexOutput 3 "Color" + OpMemberName %VertexOutput 4 "LightPosition_Fog" + OpMemberName %VertexOutput 5 "View_Depth" + OpMemberName %VertexOutput 6 "Normal_SpecPower" + OpMemberName %VertexOutput 7 "Tangent" + OpMemberName %VertexOutput 8 "PosLightSpace_Reflectance" + OpMemberName %VertexOutput 9 "studIndex" + OpName %Surface "Surface" + OpMemberName %Surface 0 "albedo" + OpMemberName %Surface 1 "normal" + OpMemberName %Surface 2 "specular" + OpMemberName %Surface 3 "gloss" + OpMemberName %Surface 4 "reflectance" + OpMemberName %Surface 5 "opacity" + OpName %SurfaceInput "SurfaceInput" + OpMemberName %SurfaceInput 0 "Color" + OpMemberName %SurfaceInput 1 "Uv" + OpMemberName %SurfaceInput 2 "UvStuds" + OpName %Globals "Globals" + OpMemberName %Globals 0 "ViewProjection" + OpMemberName %Globals 1 "ViewRight" + OpMemberName %Globals 2 "ViewUp" + OpMemberName %Globals 3 "ViewDir" + OpMemberName %Globals 4 "CameraPosition" + OpMemberName %Globals 5 "AmbientColor" + OpMemberName %Globals 6 "Lamp0Color" + OpMemberName %Globals 7 "Lamp0Dir" + OpMemberName %Globals 8 "Lamp1Color" + OpMemberName %Globals 9 "FogParams" + OpMemberName %Globals 10 "FogColor" + OpMemberName %Globals 11 "LightBorder" + OpMemberName %Globals 12 "LightConfig0" + OpMemberName %Globals 13 "LightConfig1" + OpMemberName %Globals 14 "LightConfig2" + OpMemberName %Globals 15 "LightConfig3" + OpMemberName %Globals 16 "RefractionBias_FadeDistance_GlowFactor" + OpMemberName %Globals 17 "OutlineBrightness_ShadowInfo" + OpMemberName %Globals 18 "ShadowMatrix0" + OpMemberName %Globals 19 "ShadowMatrix1" + OpMemberName %Globals 20 "ShadowMatrix2" + OpName %CB0 "CB0" + OpMemberName %CB0 0 "CB0" + OpName %_ "" + OpName %LightMapTexture "LightMapTexture" + OpName %LightMapSampler "LightMapSampler" + OpName %ShadowMapSampler "ShadowMapSampler" + OpName %ShadowMapTexture "ShadowMapTexture" + OpName %EnvironmentMapTexture "EnvironmentMapTexture" + OpName %EnvironmentMapSampler "EnvironmentMapSampler" + OpName %IN_HPosition "IN.HPosition" + OpName %IN_Uv_EdgeDistance1 "IN.Uv_EdgeDistance1" + OpName %IN_UvStuds_EdgeDistance2 "IN.UvStuds_EdgeDistance2" + OpName %IN_Color "IN.Color" + OpName %IN_LightPosition_Fog "IN.LightPosition_Fog" + OpName %IN_View_Depth "IN.View_Depth" + OpName %IN_Normal_SpecPower "IN.Normal_SpecPower" + OpName %IN_Tangent "IN.Tangent" + OpName %IN_PosLightSpace_Reflectance "IN.PosLightSpace_Reflectance" + OpName %IN_studIndex "IN.studIndex" + OpName %_entryPointOutput "@entryPointOutput" + OpName %DiffuseMapSampler "DiffuseMapSampler" + OpName %DiffuseMapTexture "DiffuseMapTexture" + OpName %NormalMapSampler "NormalMapSampler" + OpName %NormalMapTexture "NormalMapTexture" + OpName %NormalDetailMapTexture "NormalDetailMapTexture" + OpName %NormalDetailMapSampler "NormalDetailMapSampler" + OpName %StudsMapTexture "StudsMapTexture" + OpName %StudsMapSampler "StudsMapSampler" + OpName %SpecularMapSampler "SpecularMapSampler" + OpName %SpecularMapTexture "SpecularMapTexture" + OpName %Params "Params" + OpMemberName %Params 0 "LqmatFarTilingFactor" + OpName %CB2 "CB2" + OpMemberName %CB2 0 "CB2" + OpMemberDecorate %Globals 0 ColMajor + OpMemberDecorate %Globals 0 Offset 0 + OpMemberDecorate %Globals 0 MatrixStride 16 + OpMemberDecorate %Globals 1 Offset 64 + OpMemberDecorate %Globals 2 Offset 80 + OpMemberDecorate %Globals 3 Offset 96 + OpMemberDecorate %Globals 4 Offset 112 + OpMemberDecorate %Globals 5 Offset 128 + OpMemberDecorate %Globals 6 Offset 144 + OpMemberDecorate %Globals 7 Offset 160 + OpMemberDecorate %Globals 8 Offset 176 + OpMemberDecorate %Globals 9 Offset 192 + OpMemberDecorate %Globals 10 Offset 208 + OpMemberDecorate %Globals 11 Offset 224 + OpMemberDecorate %Globals 12 Offset 240 + OpMemberDecorate %Globals 13 Offset 256 + OpMemberDecorate %Globals 14 Offset 272 + OpMemberDecorate %Globals 15 Offset 288 + OpMemberDecorate %Globals 16 Offset 304 + OpMemberDecorate %Globals 17 Offset 320 + OpMemberDecorate %Globals 18 Offset 336 + OpMemberDecorate %Globals 19 Offset 352 + OpMemberDecorate %Globals 20 Offset 368 + OpMemberDecorate %CB0 0 Offset 0 + OpDecorate %CB0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %LightMapTexture DescriptorSet 1 + OpDecorate %LightMapTexture Binding 6 + OpDecorate %LightMapSampler DescriptorSet 1 + OpDecorate %LightMapSampler Binding 6 + OpDecorate %ShadowMapSampler DescriptorSet 1 + OpDecorate %ShadowMapSampler Binding 1 + OpDecorate %ShadowMapTexture DescriptorSet 1 + OpDecorate %ShadowMapTexture Binding 1 + OpDecorate %EnvironmentMapTexture DescriptorSet 1 + OpDecorate %EnvironmentMapTexture Binding 2 + OpDecorate %EnvironmentMapSampler DescriptorSet 1 + OpDecorate %EnvironmentMapSampler Binding 2 + OpDecorate %IN_HPosition BuiltIn FragCoord + OpDecorate %IN_Uv_EdgeDistance1 Location 0 + OpDecorate %IN_UvStuds_EdgeDistance2 Location 1 + OpDecorate %IN_Color Location 2 + OpDecorate %IN_LightPosition_Fog Location 3 + OpDecorate %IN_View_Depth Location 4 + OpDecorate %IN_Normal_SpecPower Location 5 + OpDecorate %IN_Tangent Location 6 + OpDecorate %IN_PosLightSpace_Reflectance Location 7 + OpDecorate %IN_studIndex Location 8 + OpDecorate %_entryPointOutput Location 0 + OpDecorate %DiffuseMapSampler DescriptorSet 1 + OpDecorate %DiffuseMapSampler Binding 3 + OpDecorate %DiffuseMapTexture DescriptorSet 1 + OpDecorate %DiffuseMapTexture Binding 3 + OpDecorate %NormalMapSampler DescriptorSet 1 + OpDecorate %NormalMapSampler Binding 4 + OpDecorate %NormalMapTexture DescriptorSet 1 + OpDecorate %NormalMapTexture Binding 4 + OpDecorate %NormalDetailMapTexture DescriptorSet 1 + OpDecorate %NormalDetailMapTexture Binding 8 + OpDecorate %NormalDetailMapSampler DescriptorSet 1 + OpDecorate %NormalDetailMapSampler Binding 8 + OpDecorate %StudsMapTexture DescriptorSet 1 + OpDecorate %StudsMapTexture Binding 0 + OpDecorate %StudsMapSampler DescriptorSet 1 + OpDecorate %StudsMapSampler Binding 0 + OpDecorate %SpecularMapSampler DescriptorSet 1 + OpDecorate %SpecularMapSampler Binding 5 + OpDecorate %SpecularMapTexture DescriptorSet 1 + OpDecorate %SpecularMapTexture Binding 5 + OpMemberDecorate %Params 0 Offset 0 + OpMemberDecorate %CB2 0 Offset 0 + OpDecorate %CB2 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %_ptr_Function_float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %v3float = OpTypeVector %float 3 + %18 = OpTypeFunction %v3float %_ptr_Function_v4float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %23 = OpTypeFunction %v4float %_ptr_Function_v3float + %27 = OpTypeFunction %float %_ptr_Function_v3float + %31 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float + %36 = OpTypeSampler +%_ptr_Function_36 = OpTypePointer Function %36 + %38 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_Function_38 = OpTypePointer Function %38 + %40 = OpTypeFunction %float %_ptr_Function_36 %_ptr_Function_38 %_ptr_Function_v3float %_ptr_Function_float +%VertexOutput = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v3float %v4float %float +%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput + %Surface = OpTypeStruct %v3float %v3float %float %float %float %float + %50 = OpTypeFunction %Surface %_ptr_Function_VertexOutput + %54 = OpTypeFunction %v4float %_ptr_Function_VertexOutput + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %60 = OpTypeFunction %v4float %_ptr_Function_36 %_ptr_Function_38 %_ptr_Function_v2float %_ptr_Function_float %_ptr_Function_float +%SurfaceInput = OpTypeStruct %v4float %v2float %v2float +%_ptr_Function_SurfaceInput = OpTypePointer Function %SurfaceInput + %70 = OpTypeFunction %Surface %_ptr_Function_SurfaceInput %_ptr_Function_v2float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 +%mat4v4float = OpTypeMatrix %v4float 4 + %Globals = OpTypeStruct %mat4v4float %v4float %v4float %v4float %v3float %v3float %v3float %v3float %v3float %v4float %v3float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float + %CB0 = OpTypeStruct %Globals +%_ptr_Uniform_CB0 = OpTypePointer Uniform %CB0 + %_ = OpVariable %_ptr_Uniform_CB0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_15 = OpConstant %int 15 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_14 = OpConstant %int 14 + %128 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %133 = OpTypeImage %float 3D 0 0 0 1 Unknown +%_ptr_UniformConstant_133 = OpTypePointer UniformConstant %133 +%LightMapTexture = OpVariable %_ptr_UniformConstant_133 UniformConstant +%_ptr_UniformConstant_36 = OpTypePointer UniformConstant %36 +%LightMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant + %140 = OpTypeSampledImage %133 + %int_11 = OpConstant %int 11 + %uint = OpTypeInt 32 0 + %float_9 = OpConstant %float 9 + %float_20 = OpConstant %float 20 + %float_0_5 = OpConstant %float 0.5 + %183 = OpTypeSampledImage %38 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %int_17 = OpConstant %int 17 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_0_25 = OpConstant %float 0.25 + %int_5 = OpConstant %int 5 +%float_0_00333333 = OpConstant %float 0.00333333 + %int_16 = OpConstant %int 16 +%_ptr_Function_Surface = OpTypePointer Function %Surface + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_8 = OpConstant %int 8 +%ShadowMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant +%_ptr_UniformConstant_38 = OpTypePointer UniformConstant %38 +%ShadowMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant + %367 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_367 = OpTypePointer UniformConstant %367 +%EnvironmentMapTexture = OpVariable %_ptr_UniformConstant_367 UniformConstant +%EnvironmentMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant + %373 = OpTypeSampledImage %367 + %float_1_5 = OpConstant %float 1.5 + %int_10 = OpConstant %int 10 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%IN_HPosition = OpVariable %_ptr_Input_v4float Input +%IN_Uv_EdgeDistance1 = OpVariable %_ptr_Input_v4float Input +%IN_UvStuds_EdgeDistance2 = OpVariable %_ptr_Input_v4float Input + %IN_Color = OpVariable %_ptr_Input_v4float Input +%IN_LightPosition_Fog = OpVariable %_ptr_Input_v4float Input +%IN_View_Depth = OpVariable %_ptr_Input_v4float Input +%IN_Normal_SpecPower = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_v3float = OpTypePointer Input %v3float + %IN_Tangent = OpVariable %_ptr_Input_v3float Input +%IN_PosLightSpace_Reflectance = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%IN_studIndex = OpVariable %_ptr_Input_float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %bool = OpTypeBool +%DiffuseMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant +%DiffuseMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant +%NormalMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant +%NormalMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant +%NormalDetailMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant +%NormalDetailMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant + %float_0_3 = OpConstant %float 0.3 +%StudsMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant +%StudsMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant +%SpecularMapSampler = OpVariable %_ptr_UniformConstant_36 UniformConstant +%SpecularMapTexture = OpVariable %_ptr_UniformConstant_38 UniformConstant + %float_0_75 = OpConstant %float 0.75 + %float_256 = OpConstant %float 256 + %689 = OpConstantComposite %v2float %float_2 %float_256 + %float_0_01 = OpConstant %float 0.01 + %692 = OpConstantComposite %v2float %float_0 %float_0_01 + %float_0_8 = OpConstant %float 0.8 + %float_120 = OpConstant %float 120 + %697 = OpConstantComposite %v2float %float_0_8 %float_120 + %Params = OpTypeStruct %v4float + %CB2 = OpTypeStruct %Params +%_ptr_Uniform_CB2 = OpTypePointer Uniform %CB2 + %false = OpConstantFalse %bool + %1509 = OpUndef %VertexOutput + %1510 = OpUndef %SurfaceInput + %1511 = OpUndef %v2float + %1512 = OpUndef %v4float + %1531 = OpUndef %Surface + %main = OpFunction %void None %3 + %5 = OpLabel + %501 = OpLoad %v4float %IN_HPosition + %1378 = OpCompositeInsert %VertexOutput %501 %1509 0 + %504 = OpLoad %v4float %IN_Uv_EdgeDistance1 + %1380 = OpCompositeInsert %VertexOutput %504 %1378 1 + %507 = OpLoad %v4float %IN_UvStuds_EdgeDistance2 + %1382 = OpCompositeInsert %VertexOutput %507 %1380 2 + %510 = OpLoad %v4float %IN_Color + %1384 = OpCompositeInsert %VertexOutput %510 %1382 3 + %513 = OpLoad %v4float %IN_LightPosition_Fog + %1386 = OpCompositeInsert %VertexOutput %513 %1384 4 + %516 = OpLoad %v4float %IN_View_Depth + %1388 = OpCompositeInsert %VertexOutput %516 %1386 5 + %519 = OpLoad %v4float %IN_Normal_SpecPower + %1390 = OpCompositeInsert %VertexOutput %519 %1388 6 + %523 = OpLoad %v3float %IN_Tangent + %1392 = OpCompositeInsert %VertexOutput %523 %1390 7 + %526 = OpLoad %v4float %IN_PosLightSpace_Reflectance + %1394 = OpCompositeInsert %VertexOutput %526 %1392 8 + %530 = OpLoad %float %IN_studIndex + %1396 = OpCompositeInsert %VertexOutput %530 %1394 9 + %1400 = OpCompositeInsert %SurfaceInput %510 %1510 0 + %954 = OpVectorShuffle %v2float %504 %504 0 1 + %1404 = OpCompositeInsert %SurfaceInput %954 %1400 1 + %958 = OpVectorShuffle %v2float %507 %507 0 1 + %1408 = OpCompositeInsert %SurfaceInput %958 %1404 2 + %1410 = OpCompositeExtract %float %1408 2 1 + %962 = OpExtInst %float %1 Fract %1410 + %965 = OpFAdd %float %962 %530 + %966 = OpFMul %float %965 %float_0_25 + %1414 = OpCompositeInsert %SurfaceInput %966 %1408 2 1 + %1416 = OpCompositeExtract %float %1396 5 3 + %970 = OpFMul %float %1416 %float_0_00333333 + %971 = OpFSub %float %float_1 %970 + %987 = OpExtInst %float %1 FClamp %971 %float_0 %float_1 + %976 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_16 %uint_1 + %977 = OpLoad %float %976 + %978 = OpFMul %float %1416 %977 + %979 = OpFSub %float %float_1 %978 + %990 = OpExtInst %float %1 FClamp %979 %float_0 %float_1 + %1024 = OpVectorTimesScalar %v2float %954 %float_1 + %1029 = OpLoad %36 %DiffuseMapSampler + %1030 = OpLoad %38 %DiffuseMapTexture + OpBranch %1119 + %1119 = OpLabel + OpLoopMerge %1120 %1121 None + OpBranch %1122 + %1122 = OpLabel + %1124 = OpFOrdEqual %bool %float_0 %float_0 + OpSelectionMerge %1125 None + OpBranchConditional %1124 %1126 %1127 + %1126 = OpLabel + %1130 = OpSampledImage %183 %1030 %1029 + %1132 = OpImageSampleImplicitLod %v4float %1130 %1024 + OpBranch %1120 + %1127 = OpLabel + %1134 = OpFSub %float %float_1 %float_0 + %1135 = OpFDiv %float %float_1 %1134 + %1138 = OpSampledImage %183 %1030 %1029 + %1140 = OpVectorTimesScalar %v2float %1024 %float_0_25 + %1141 = OpImageSampleImplicitLod %v4float %1138 %1140 + %1144 = OpSampledImage %183 %1030 %1029 + %1146 = OpImageSampleImplicitLod %v4float %1144 %1024 + %1149 = OpFMul %float %987 %1135 + %1152 = OpFMul %float %float_0 %1135 + %1153 = OpFSub %float %1149 %1152 + %1161 = OpExtInst %float %1 FClamp %1153 %float_0 %float_1 + %1155 = OpCompositeConstruct %v4float %1161 %1161 %1161 %1161 + %1156 = OpExtInst %v4float %1 FMix %1141 %1146 %1155 + OpBranch %1120 + %1125 = OpLabel + %1157 = OpUndef %v4float + OpBranch %1120 + %1121 = OpLabel + OpBranchConditional %false %1119 %1120 + %1120 = OpLabel + %1517 = OpPhi %v4float %1132 %1126 %1156 %1127 %1157 %1125 %1512 %1121 + %1035 = OpVectorTimesScalar %v4float %1517 %float_1 + %1036 = OpLoad %36 %NormalMapSampler + %1037 = OpLoad %38 %NormalMapTexture + OpBranch %1165 + %1165 = OpLabel + OpLoopMerge %1166 %1167 None + OpBranch %1168 + %1168 = OpLabel + OpSelectionMerge %1171 None + OpBranchConditional %1124 %1172 %1173 + %1172 = OpLabel + %1176 = OpSampledImage %183 %1037 %1036 + %1178 = OpImageSampleImplicitLod %v4float %1176 %1024 + OpBranch %1166 + %1173 = OpLabel + %1180 = OpFSub %float %float_1 %float_0 + %1181 = OpFDiv %float %float_1 %1180 + %1184 = OpSampledImage %183 %1037 %1036 + %1186 = OpVectorTimesScalar %v2float %1024 %float_0_25 + %1187 = OpImageSampleImplicitLod %v4float %1184 %1186 + %1190 = OpSampledImage %183 %1037 %1036 + %1192 = OpImageSampleImplicitLod %v4float %1190 %1024 + %1195 = OpFMul %float %990 %1181 + %1198 = OpFMul %float %float_0 %1181 + %1199 = OpFSub %float %1195 %1198 + %1206 = OpExtInst %float %1 FClamp %1199 %float_0 %float_1 + %1201 = OpCompositeConstruct %v4float %1206 %1206 %1206 %1206 + %1202 = OpExtInst %v4float %1 FMix %1187 %1192 %1201 + OpBranch %1166 + %1171 = OpLabel + %1203 = OpUndef %v4float + OpBranch %1166 + %1167 = OpLabel + OpBranchConditional %false %1165 %1166 + %1166 = OpLabel + %1523 = OpPhi %v4float %1178 %1172 %1202 %1173 %1203 %1171 %1512 %1167 + %1210 = OpVectorShuffle %v2float %1523 %1523 3 1 + %1211 = OpVectorTimesScalar %v2float %1210 %float_2 + %1212 = OpCompositeConstruct %v2float %float_1 %float_1 + %1213 = OpFSub %v2float %1211 %1212 + %1216 = OpFNegate %v2float %1213 + %1218 = OpDot %float %1216 %1213 + %1219 = OpFAdd %float %float_1 %1218 + %1220 = OpExtInst %float %1 FClamp %1219 %float_0 %float_1 + %1221 = OpExtInst %float %1 Sqrt %1220 + %1222 = OpCompositeExtract %float %1213 0 + %1223 = OpCompositeExtract %float %1213 1 + %1224 = OpCompositeConstruct %v3float %1222 %1223 %1221 + %1042 = OpLoad %38 %NormalDetailMapTexture + %1043 = OpLoad %36 %NormalDetailMapSampler + %1044 = OpSampledImage %183 %1042 %1043 + %1046 = OpVectorTimesScalar %v2float %1024 %float_0 + %1047 = OpImageSampleImplicitLod %v4float %1044 %1046 + %1228 = OpVectorShuffle %v2float %1047 %1047 3 1 + %1229 = OpVectorTimesScalar %v2float %1228 %float_2 + %1231 = OpFSub %v2float %1229 %1212 + %1234 = OpFNegate %v2float %1231 + %1236 = OpDot %float %1234 %1231 + %1237 = OpFAdd %float %float_1 %1236 + %1238 = OpExtInst %float %1 FClamp %1237 %float_0 %float_1 + %1239 = OpExtInst %float %1 Sqrt %1238 + %1240 = OpCompositeExtract %float %1231 0 + %1241 = OpCompositeExtract %float %1231 1 + %1242 = OpCompositeConstruct %v3float %1240 %1241 %1239 + %1050 = OpVectorShuffle %v2float %1242 %1242 0 1 + %1051 = OpVectorTimesScalar %v2float %1050 %float_0 + %1053 = OpVectorShuffle %v2float %1224 %1224 0 1 + %1054 = OpFAdd %v2float %1053 %1051 + %1056 = OpVectorShuffle %v3float %1224 %1054 3 4 2 + %1059 = OpVectorShuffle %v2float %1056 %1056 0 1 + %1060 = OpVectorTimesScalar %v2float %1059 %990 + %1062 = OpVectorShuffle %v3float %1056 %1060 3 4 2 + %1430 = OpCompositeExtract %float %1062 0 + %1065 = OpFMul %float %1430 %float_0_3 + %1066 = OpFAdd %float %float_1 %1065 + %1069 = OpVectorShuffle %v3float %510 %510 0 1 2 + %1071 = OpVectorShuffle %v3float %1035 %1035 0 1 2 + %1072 = OpFMul %v3float %1069 %1071 + %1074 = OpVectorTimesScalar %v3float %1072 %1066 + %1075 = OpLoad %38 %StudsMapTexture + %1076 = OpLoad %36 %StudsMapSampler + %1077 = OpSampledImage %183 %1075 %1076 + %1434 = OpCompositeExtract %v2float %1414 2 + %1080 = OpImageSampleImplicitLod %v4float %1077 %1434 + %1436 = OpCompositeExtract %float %1080 0 + %1083 = OpFMul %float %1436 %float_2 + %1085 = OpVectorTimesScalar %v3float %1074 %1083 + %1086 = OpLoad %36 %SpecularMapSampler + %1087 = OpLoad %38 %SpecularMapTexture + OpBranch %1246 + %1246 = OpLabel + OpLoopMerge %1247 %1248 None + OpBranch %1249 + %1249 = OpLabel + %1251 = OpFOrdEqual %bool %float_0_75 %float_0 + OpSelectionMerge %1252 None + OpBranchConditional %1251 %1253 %1254 + %1253 = OpLabel + %1257 = OpSampledImage %183 %1087 %1086 + %1259 = OpImageSampleImplicitLod %v4float %1257 %1024 + OpBranch %1247 + %1254 = OpLabel + %1261 = OpFSub %float %float_1 %float_0_75 + %1262 = OpFDiv %float %float_1 %1261 + %1265 = OpSampledImage %183 %1087 %1086 + %1267 = OpVectorTimesScalar %v2float %1024 %float_0_25 + %1268 = OpImageSampleImplicitLod %v4float %1265 %1267 + %1271 = OpSampledImage %183 %1087 %1086 + %1273 = OpImageSampleImplicitLod %v4float %1271 %1024 + %1276 = OpFMul %float %990 %1262 + %1279 = OpFMul %float %float_0_75 %1262 + %1280 = OpFSub %float %1276 %1279 + %1287 = OpExtInst %float %1 FClamp %1280 %float_0 %float_1 + %1282 = OpCompositeConstruct %v4float %1287 %1287 %1287 %1287 + %1283 = OpExtInst %v4float %1 FMix %1268 %1273 %1282 + OpBranch %1247 + %1252 = OpLabel + %1284 = OpUndef %v4float + OpBranch %1247 + %1248 = OpLabel + OpBranchConditional %false %1246 %1247 + %1247 = OpLabel + %1530 = OpPhi %v4float %1259 %1253 %1283 %1254 %1284 %1252 %1512 %1248 + %1091 = OpVectorShuffle %v2float %1530 %1530 0 1 + %1093 = OpFMul %v2float %1091 %689 + %1094 = OpFAdd %v2float %1093 %692 + %1097 = OpCompositeConstruct %v2float %990 %990 + %1098 = OpExtInst %v2float %1 FMix %697 %1094 %1097 + %1438 = OpCompositeInsert %Surface %1085 %1531 0 + %1440 = OpCompositeInsert %Surface %1062 %1438 1 + %1442 = OpCompositeExtract %float %1098 0 + %1444 = OpCompositeInsert %Surface %1442 %1440 2 + %1446 = OpCompositeExtract %float %1098 1 + %1448 = OpCompositeInsert %Surface %1446 %1444 3 + %1450 = OpCompositeExtract %float %1091 1 + %1112 = OpFMul %float %1450 %990 + %1113 = OpFMul %float %1112 %float_0 + %1452 = OpCompositeInsert %Surface %1113 %1448 4 + %1456 = OpCompositeExtract %float %1396 3 3 + %764 = OpCompositeExtract %float %1085 0 + %765 = OpCompositeExtract %float %1085 1 + %766 = OpCompositeExtract %float %1085 2 + %767 = OpCompositeConstruct %v4float %764 %765 %766 %1456 + %770 = OpVectorShuffle %v3float %519 %519 0 1 2 + %773 = OpExtInst %v3float %1 Cross %770 %523 + %1462 = OpCompositeExtract %float %1452 1 0 + %778 = OpVectorTimesScalar %v3float %523 %1462 + %1466 = OpCompositeExtract %float %1452 1 1 + %782 = OpVectorTimesScalar %v3float %773 %1466 + %783 = OpFAdd %v3float %778 %782 + %1468 = OpCompositeExtract %float %1452 1 2 + %789 = OpVectorTimesScalar %v3float %770 %1468 + %790 = OpFAdd %v3float %783 %789 + %791 = OpExtInst %v3float %1 Normalize %790 + %793 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 %int_7 + %794 = OpLoad %v3float %793 + %795 = OpFNegate %v3float %794 + %796 = OpDot %float %791 %795 + %1290 = OpExtInst %float %1 FClamp %796 %float_0 %float_1 + %799 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 %int_6 + %800 = OpLoad %v3float %799 + %801 = OpVectorTimesScalar %v3float %800 %1290 + %803 = OpFNegate %float %796 + %804 = OpExtInst %float %1 FMax %803 %float_0 + %805 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 %int_8 + %806 = OpLoad %v3float %805 + %807 = OpVectorTimesScalar %v3float %806 %804 + %808 = OpFAdd %v3float %801 %807 + %810 = OpExtInst %float %1 Step %float_0 %796 + %813 = OpFMul %float %810 %1442 + %820 = OpVectorShuffle %v3float %513 %513 0 1 2 + %1296 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_15 + %1297 = OpLoad %v4float %1296 + %1298 = OpVectorShuffle %v3float %1297 %1297 0 1 2 + %1300 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_14 + %1301 = OpLoad %v4float %1300 + %1302 = OpVectorShuffle %v3float %1301 %1301 0 1 2 + %1303 = OpFSub %v3float %820 %1302 + %1304 = OpExtInst %v3float %1 FAbs %1303 + %1305 = OpExtInst %v3float %1 Step %1298 %1304 + %1307 = OpDot %float %1305 %128 + %1328 = OpExtInst %float %1 FClamp %1307 %float_0 %float_1 + %1309 = OpLoad %133 %LightMapTexture + %1310 = OpLoad %36 %LightMapSampler + %1311 = OpSampledImage %140 %1309 %1310 + %1313 = OpVectorShuffle %v3float %820 %820 1 2 0 + %1317 = OpVectorTimesScalar %v3float %1313 %1328 + %1318 = OpFSub %v3float %1313 %1317 + %1319 = OpImageSampleImplicitLod %v4float %1311 %1318 + %1321 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_11 + %1322 = OpLoad %v4float %1321 + %1324 = OpCompositeConstruct %v4float %1328 %1328 %1328 %1328 + %1325 = OpExtInst %v4float %1 FMix %1319 %1322 %1324 + %822 = OpLoad %36 %ShadowMapSampler + %823 = OpLoad %38 %ShadowMapTexture + %826 = OpVectorShuffle %v3float %526 %526 0 1 2 + %1482 = OpCompositeExtract %float %1325 3 + %1337 = OpSampledImage %183 %823 %822 + %1339 = OpVectorShuffle %v2float %826 %826 0 1 + %1340 = OpImageSampleImplicitLod %v4float %1337 %1339 + %1341 = OpVectorShuffle %v2float %1340 %1340 0 1 + %1484 = OpCompositeExtract %float %826 2 + %1486 = OpCompositeExtract %float %1341 0 + %1363 = OpExtInst %float %1 Step %1486 %1484 + %1365 = OpFSub %float %1484 %float_0_5 + %1366 = OpExtInst %float %1 FAbs %1365 + %1367 = OpFMul %float %float_20 %1366 + %1368 = OpFSub %float %float_9 %1367 + %1369 = OpExtInst %float %1 FClamp %1368 %float_0 %float_1 + %1370 = OpFMul %float %1363 %1369 + %1488 = OpCompositeExtract %float %1341 1 + %1350 = OpFMul %float %1370 %1488 + %1351 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_17 %uint_3 + %1352 = OpLoad %float %1351 + %1353 = OpFMul %float %1350 %1352 + %1354 = OpFSub %float %float_1 %1353 + %1356 = OpFMul %float %1354 %1482 + %830 = OpLoad %367 %EnvironmentMapTexture + %831 = OpLoad %36 %EnvironmentMapSampler + %832 = OpSampledImage %373 %830 %831 + %835 = OpVectorShuffle %v3float %516 %516 0 1 2 + %836 = OpFNegate %v3float %835 + %838 = OpExtInst %v3float %1 Reflect %836 %791 + %839 = OpImageSampleImplicitLod %v4float %832 %838 + %840 = OpVectorShuffle %v3float %839 %839 0 1 2 + %842 = OpVectorShuffle %v3float %767 %767 0 1 2 + %845 = OpCompositeConstruct %v3float %1113 %1113 %1113 + %846 = OpExtInst %v3float %1 FMix %842 %840 %845 + %848 = OpVectorShuffle %v4float %767 %846 4 5 6 3 + %849 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 %int_5 + %850 = OpLoad %v3float %849 + %853 = OpVectorTimesScalar %v3float %808 %1356 + %854 = OpFAdd %v3float %850 %853 + %856 = OpVectorShuffle %v3float %1325 %1325 0 1 2 + %857 = OpFAdd %v3float %854 %856 + %859 = OpVectorShuffle %v3float %848 %848 0 1 2 + %860 = OpFMul %v3float %857 %859 + %865 = OpFMul %float %813 %1356 + %873 = OpExtInst %v3float %1 Normalize %835 + %874 = OpFAdd %v3float %795 %873 + %875 = OpExtInst %v3float %1 Normalize %874 + %876 = OpDot %float %791 %875 + %877 = OpExtInst %float %1 FClamp %876 %float_0 %float_1 + %879 = OpExtInst %float %1 Pow %877 %1446 + %880 = OpFMul %float %865 %879 + %881 = OpVectorTimesScalar %v3float %800 %880 + %884 = OpFAdd %v3float %860 %881 + %886 = OpVectorShuffle %v4float %1512 %884 4 5 6 3 + %1494 = OpCompositeExtract %float %848 3 + %1496 = OpCompositeInsert %v4float %1494 %886 3 + %896 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_17 %uint_0 + %897 = OpLoad %float %896 + %898 = OpFMul %float %978 %897 + %899 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_17 %uint_1 + %900 = OpLoad %float %899 + %901 = OpFAdd %float %898 %900 + %1373 = OpExtInst %float %1 FClamp %901 %float_0 %float_1 + %905 = OpVectorShuffle %v2float %504 %504 3 2 + %908 = OpVectorShuffle %v2float %507 %507 3 2 + %909 = OpExtInst %v2float %1 FMin %905 %908 + %1504 = OpCompositeExtract %float %909 0 + %1506 = OpCompositeExtract %float %909 1 + %914 = OpExtInst %float %1 FMin %1504 %1506 + %916 = OpFDiv %float %914 %978 + %919 = OpFSub %float %float_1_5 %916 + %920 = OpFMul %float %1373 %919 + %922 = OpFAdd %float %920 %916 + %1376 = OpExtInst %float %1 FClamp %922 %float_0 %float_1 + %925 = OpVectorShuffle %v3float %1496 %1496 0 1 2 + %926 = OpVectorTimesScalar %v3float %925 %1376 + %928 = OpVectorShuffle %v4float %1496 %926 4 5 6 3 + %1508 = OpCompositeExtract %float %1396 4 3 + %931 = OpExtInst %float %1 FClamp %1508 %float_0 %float_1 + %932 = OpAccessChain %_ptr_Uniform_v3float %_ %int_0 %int_10 + %933 = OpLoad %v3float %932 + %935 = OpVectorShuffle %v3float %928 %928 0 1 2 + %937 = OpCompositeConstruct %v3float %931 %931 %931 + %938 = OpExtInst %v3float %1 FMix %933 %935 %937 + %940 = OpVectorShuffle %v4float %928 %938 4 5 6 3 + OpStore %_entryPointOutput %940 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag new file mode 100644 index 0000000000..a10970e963 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation-2.asm.frag @@ -0,0 +1,625 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 761 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %pos "pos" + OpName %gl_FragCoord "gl_FragCoord" + OpName %buf0 "buf0" + OpMemberName %buf0 0 "resolution" + OpName %_ "" + OpName %ipos "ipos" + OpName %i "i" + OpName %map "map" + OpName %p "p" + OpName %canwalk "canwalk" + OpName %v "v" + OpName %directions "directions" + OpName %j "j" + OpName %d "d" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpMemberDecorate %buf0 0 Offset 0 + OpDecorate %buf0 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %buf0 = OpTypeStruct %v2float +%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0 + %_ = OpVariable %_ptr_Uniform_buf0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_16 = OpConstant %float 16 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_256 = OpConstant %int 256 + %bool = OpTypeBool + %uint_256 = OpConstant %uint 256 +%_arr_int_uint_256 = OpTypeArray %int %uint_256 +%_ptr_Private__arr_int_uint_256 = OpTypePointer Private %_arr_int_uint_256 + %map = OpVariable %_ptr_Private__arr_int_uint_256 Private +%_ptr_Private_int = OpTypePointer Private %int + %int_1 = OpConstant %int 1 + %63 = OpConstantComposite %v2int %int_0 %int_0 +%_ptr_Function_bool = OpTypePointer Function %bool + %true = OpConstantTrue %bool + %int_2 = OpConstant %int 2 + %int_16 = OpConstant %int 16 + %int_14 = OpConstant %int 14 + %false = OpConstantFalse %bool + %int_8 = OpConstant %int 8 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %437 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0 = OpConstant %float 0 + %441 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%mat2v4float = OpTypeMatrix %v4float 2 +%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float + %556 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %557 = OpConstantComposite %mat2v4float %556 %556 + %558 = OpVariable %_ptr_Private_mat2v4float Private %557 + %760 = OpConstantNull %bool + %main = OpFunction %void None %3 + %5 = OpLabel + %pos = OpVariable %_ptr_Function_v2float Function + %ipos = OpVariable %_ptr_Function_v2int Function + %i = OpVariable %_ptr_Function_int Function + %p = OpVariable %_ptr_Function_v2int Function + %canwalk = OpVariable %_ptr_Function_bool Function + %v = OpVariable %_ptr_Function_int Function + %directions = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %d = OpVariable %_ptr_Function_int Function + %13 = OpLoad %v4float %gl_FragCoord + %14 = OpVectorShuffle %v2float %13 %13 0 1 + %564 = OpISub %int %int_256 %int_14 + %21 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 + %22 = OpLoad %v2float %21 + %566 = OpSNegate %int %564 + %23 = OpFDiv %v2float %14 %22 + OpStore %pos %23 + %30 = OpAccessChain %_ptr_Function_float %pos %uint_0 + %31 = OpLoad %float %30 + %33 = OpFMul %float %31 %float_16 + %34 = OpConvertFToS %int %33 + %36 = OpAccessChain %_ptr_Function_float %pos %uint_1 + %37 = OpLoad %float %36 + %38 = OpFMul %float %37 %float_16 + %39 = OpConvertFToS %int %38 + %40 = OpCompositeConstruct %v2int %34 %39 + OpStore %ipos %40 + OpStore %i %int_0 + OpBranch %43 + %43 = OpLabel + OpLoopMerge %45 %46 None + OpBranch %47 + %47 = OpLabel + %48 = OpLoad %int %i + %51 = OpSLessThan %bool %48 %int_256 + OpBranchConditional %51 %44 %45 + %44 = OpLabel + %56 = OpLoad %int %i + %58 = OpAccessChain %_ptr_Private_int %map %56 + OpStore %58 %int_0 + OpBranch %46 + %46 = OpLabel + %59 = OpLoad %int %i + %61 = OpIAdd %int %59 %int_1 + OpStore %i %61 + OpBranch %43 + %45 = OpLabel + OpStore %p %63 + OpStore %canwalk %true + OpStore %v %int_0 + OpBranch %68 + %68 = OpLabel + OpLoopMerge %70 %71 None + OpBranch %69 + %69 = OpLabel + %72 = OpLoad %int %v + %73 = OpIAdd %int %72 %int_1 + OpStore %v %73 + OpStore %directions %int_0 + %75 = OpAccessChain %_ptr_Function_int %p %uint_0 + %76 = OpLoad %int %75 + %77 = OpSGreaterThan %bool %76 %int_0 + OpSelectionMerge %79 None + OpBranchConditional %77 %78 %79 + %78 = OpLabel + %80 = OpAccessChain %_ptr_Function_int %p %uint_0 + %81 = OpLoad %int %80 + %83 = OpISub %int %81 %int_2 + %84 = OpAccessChain %_ptr_Function_int %p %uint_1 + %85 = OpLoad %int %84 + %87 = OpIMul %int %85 %int_16 + %88 = OpIAdd %int %83 %87 + %89 = OpAccessChain %_ptr_Private_int %map %88 + %90 = OpLoad %int %89 + %91 = OpIEqual %bool %90 %int_0 + OpBranch %79 + %79 = OpLabel + %92 = OpPhi %bool %77 %69 %91 %78 + OpSelectionMerge %94 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %int %directions + %96 = OpIAdd %int %95 %int_1 + OpStore %directions %96 + OpBranch %94 + %94 = OpLabel + %97 = OpAccessChain %_ptr_Function_int %p %uint_1 + %98 = OpLoad %int %97 + %99 = OpSGreaterThan %bool %98 %int_0 + OpSelectionMerge %101 None + OpBranchConditional %99 %100 %101 + %100 = OpLabel + %102 = OpAccessChain %_ptr_Function_int %p %uint_0 + %103 = OpLoad %int %102 + %104 = OpAccessChain %_ptr_Function_int %p %uint_1 + %105 = OpLoad %int %104 + %106 = OpISub %int %105 %int_2 + %107 = OpIMul %int %106 %int_16 + %108 = OpIAdd %int %103 %107 + %109 = OpAccessChain %_ptr_Private_int %map %108 + %110 = OpLoad %int %109 + %111 = OpIEqual %bool %110 %int_0 + OpBranch %101 + %101 = OpLabel + %112 = OpPhi %bool %99 %94 %111 %100 + OpSelectionMerge %114 None + OpBranchConditional %112 %113 %114 + %113 = OpLabel + %115 = OpLoad %int %directions + %116 = OpIAdd %int %115 %int_1 + OpStore %directions %116 + OpBranch %114 + %114 = OpLabel + %117 = OpAccessChain %_ptr_Function_int %p %uint_0 + %118 = OpLoad %int %117 + %120 = OpSLessThan %bool %118 %int_14 + OpSelectionMerge %122 None + OpBranchConditional %120 %121 %122 + %121 = OpLabel + %123 = OpAccessChain %_ptr_Function_int %p %uint_0 + %124 = OpLoad %int %123 + %125 = OpIAdd %int %124 %int_2 + %126 = OpAccessChain %_ptr_Function_int %p %uint_1 + %127 = OpLoad %int %126 + %128 = OpIMul %int %127 %int_16 + %129 = OpIAdd %int %125 %128 + %130 = OpAccessChain %_ptr_Private_int %map %129 + %131 = OpLoad %int %130 + %132 = OpIEqual %bool %131 %int_0 + OpBranch %122 + %122 = OpLabel + %133 = OpPhi %bool %120 %114 %132 %121 + OpSelectionMerge %135 None + OpBranchConditional %133 %134 %135 + %134 = OpLabel + %136 = OpLoad %int %directions + %137 = OpIAdd %int %136 %int_1 + OpStore %directions %137 + OpBranch %135 + %135 = OpLabel + %594 = OpISub %int %int_256 %566 + %138 = OpAccessChain %_ptr_Function_int %p %uint_1 + %139 = OpLoad %int %138 + %140 = OpSLessThan %bool %139 %int_14 + OpSelectionMerge %142 None + OpBranchConditional %140 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %_ptr_Function_int %p %uint_0 + %144 = OpLoad %int %143 + %145 = OpAccessChain %_ptr_Function_int %p %uint_1 + %146 = OpLoad %int %145 + %147 = OpIAdd %int %146 %int_2 + %148 = OpIMul %int %147 %int_16 + %149 = OpIAdd %int %144 %148 + %150 = OpAccessChain %_ptr_Private_int %map %149 + %151 = OpLoad %int %150 + %152 = OpIEqual %bool %151 %int_0 + OpBranch %142 + %142 = OpLabel + %153 = OpPhi %bool %140 %135 %152 %141 + OpSelectionMerge %155 None + OpBranchConditional %153 %154 %155 + %154 = OpLabel + %156 = OpLoad %int %directions + %157 = OpIAdd %int %156 %int_1 + OpStore %directions %157 + OpBranch %155 + %155 = OpLabel + %158 = OpLoad %int %directions + %159 = OpIEqual %bool %158 %int_0 + OpSelectionMerge %161 None + OpBranchConditional %159 %160 %207 + %160 = OpLabel + OpStore %canwalk %false + OpStore %i %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %int %i + %170 = OpSLessThan %bool %168 %int_8 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %j %int_0 + %609 = OpISub %int %594 %168 + OpStore %558 %557 + OpBranchConditional %760 %166 %172 + %172 = OpLabel + OpLoopMerge %174 %175 Unroll + OpBranch %176 + %176 = OpLabel + %177 = OpLoad %int %j + %178 = OpSLessThan %bool %177 %int_8 + OpBranchConditional %178 %173 %174 + %173 = OpLabel + %179 = OpLoad %int %j + %180 = OpIMul %int %179 %int_2 + %181 = OpLoad %int %i + %182 = OpIMul %int %181 %int_2 + %183 = OpIMul %int %182 %int_16 + %184 = OpIAdd %int %180 %183 + %185 = OpAccessChain %_ptr_Private_int %map %184 + %186 = OpLoad %int %185 + %187 = OpIEqual %bool %186 %int_0 + OpSelectionMerge %189 None + OpBranchConditional %187 %188 %189 + %188 = OpLabel + %190 = OpLoad %int %j + %191 = OpIMul %int %190 %int_2 + %192 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %192 %191 + %193 = OpLoad %int %i + %194 = OpIMul %int %193 %int_2 + %195 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %195 %194 + OpStore %canwalk %true + OpBranch %189 + %189 = OpLabel + OpBranch %175 + %175 = OpLabel + %196 = OpLoad %int %j + %197 = OpIAdd %int %196 %int_1 + OpStore %j %197 + OpBranch %172 + %174 = OpLabel + OpBranch %166 + %166 = OpLabel + %198 = OpLoad %int %i + %199 = OpIAdd %int %198 %int_1 + OpStore %i %199 + OpBranch %163 + %165 = OpLabel + %200 = OpAccessChain %_ptr_Function_int %p %uint_0 + %201 = OpLoad %int %200 + %202 = OpAccessChain %_ptr_Function_int %p %uint_1 + %203 = OpLoad %int %202 + %204 = OpIMul %int %203 %int_16 + %205 = OpIAdd %int %201 %204 + %206 = OpAccessChain %_ptr_Private_int %map %205 + OpStore %206 %int_1 + OpBranch %161 + %207 = OpLabel + %209 = OpLoad %int %v + %210 = OpLoad %int %directions + %211 = OpSMod %int %209 %210 + OpStore %d %211 + %212 = OpLoad %int %directions + %213 = OpLoad %int %v + %214 = OpIAdd %int %213 %212 + OpStore %v %214 + %215 = OpLoad %int %d + %216 = OpSGreaterThanEqual %bool %215 %int_0 + OpSelectionMerge %218 None + OpBranchConditional %216 %217 %218 + %217 = OpLabel + %219 = OpAccessChain %_ptr_Function_int %p %uint_0 + %220 = OpLoad %int %219 + %221 = OpSGreaterThan %bool %220 %int_0 + OpBranch %218 + %218 = OpLabel + %222 = OpPhi %bool %216 %207 %221 %217 + OpSelectionMerge %224 None + OpBranchConditional %222 %223 %224 + %223 = OpLabel + %225 = OpAccessChain %_ptr_Function_int %p %uint_0 + %226 = OpLoad %int %225 + %227 = OpISub %int %226 %int_2 + %228 = OpAccessChain %_ptr_Function_int %p %uint_1 + %229 = OpLoad %int %228 + %230 = OpIMul %int %229 %int_16 + %231 = OpIAdd %int %227 %230 + %232 = OpAccessChain %_ptr_Private_int %map %231 + %233 = OpLoad %int %232 + %234 = OpIEqual %bool %233 %int_0 + OpBranch %224 + %224 = OpLabel + %235 = OpPhi %bool %222 %218 %234 %223 + OpSelectionMerge %237 None + OpBranchConditional %235 %236 %237 + %236 = OpLabel + %238 = OpLoad %int %d + %239 = OpISub %int %238 %int_1 + OpStore %d %239 + %240 = OpAccessChain %_ptr_Function_int %p %uint_0 + %241 = OpLoad %int %240 + %242 = OpAccessChain %_ptr_Function_int %p %uint_1 + %243 = OpLoad %int %242 + %244 = OpIMul %int %243 %int_16 + %245 = OpIAdd %int %241 %244 + %246 = OpAccessChain %_ptr_Private_int %map %245 + OpStore %246 %int_1 + %247 = OpAccessChain %_ptr_Function_int %p %uint_0 + %248 = OpLoad %int %247 + %249 = OpISub %int %248 %int_1 + %250 = OpAccessChain %_ptr_Function_int %p %uint_1 + %251 = OpLoad %int %250 + %252 = OpIMul %int %251 %int_16 + %253 = OpIAdd %int %249 %252 + %254 = OpAccessChain %_ptr_Private_int %map %253 + OpStore %254 %int_1 + %255 = OpAccessChain %_ptr_Function_int %p %uint_0 + %256 = OpLoad %int %255 + %257 = OpISub %int %256 %int_2 + %258 = OpAccessChain %_ptr_Function_int %p %uint_1 + %259 = OpLoad %int %258 + %260 = OpIMul %int %259 %int_16 + %261 = OpIAdd %int %257 %260 + %262 = OpAccessChain %_ptr_Private_int %map %261 + OpStore %262 %int_1 + %263 = OpAccessChain %_ptr_Function_int %p %uint_0 + %264 = OpLoad %int %263 + %265 = OpISub %int %264 %int_2 + %266 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %266 %265 + OpBranch %237 + %237 = OpLabel + %267 = OpLoad %int %d + %268 = OpSGreaterThanEqual %bool %267 %int_0 + OpSelectionMerge %270 None + OpBranchConditional %268 %269 %270 + %269 = OpLabel + %271 = OpAccessChain %_ptr_Function_int %p %uint_1 + %272 = OpLoad %int %271 + %273 = OpSGreaterThan %bool %272 %int_0 + OpBranch %270 + %270 = OpLabel + %274 = OpPhi %bool %268 %237 %273 %269 + OpSelectionMerge %276 None + OpBranchConditional %274 %275 %276 + %275 = OpLabel + %277 = OpAccessChain %_ptr_Function_int %p %uint_0 + %278 = OpLoad %int %277 + %279 = OpAccessChain %_ptr_Function_int %p %uint_1 + %280 = OpLoad %int %279 + %281 = OpISub %int %280 %int_2 + %282 = OpIMul %int %281 %int_16 + %283 = OpIAdd %int %278 %282 + %284 = OpAccessChain %_ptr_Private_int %map %283 + %285 = OpLoad %int %284 + %286 = OpIEqual %bool %285 %int_0 + OpBranch %276 + %276 = OpLabel + %287 = OpPhi %bool %274 %270 %286 %275 + OpSelectionMerge %289 None + OpBranchConditional %287 %288 %289 + %288 = OpLabel + %290 = OpLoad %int %d + %291 = OpISub %int %290 %int_1 + OpStore %d %291 + %292 = OpAccessChain %_ptr_Function_int %p %uint_0 + %293 = OpLoad %int %292 + %294 = OpAccessChain %_ptr_Function_int %p %uint_1 + %295 = OpLoad %int %294 + %296 = OpIMul %int %295 %int_16 + %297 = OpIAdd %int %293 %296 + %298 = OpAccessChain %_ptr_Private_int %map %297 + OpStore %298 %int_1 + %299 = OpAccessChain %_ptr_Function_int %p %uint_0 + %300 = OpLoad %int %299 + %301 = OpAccessChain %_ptr_Function_int %p %uint_1 + %302 = OpLoad %int %301 + %303 = OpISub %int %302 %int_1 + %304 = OpIMul %int %303 %int_16 + %305 = OpIAdd %int %300 %304 + %306 = OpAccessChain %_ptr_Private_int %map %305 + OpStore %306 %int_1 + %307 = OpAccessChain %_ptr_Function_int %p %uint_0 + %308 = OpLoad %int %307 + %309 = OpAccessChain %_ptr_Function_int %p %uint_1 + %310 = OpLoad %int %309 + %311 = OpISub %int %310 %int_2 + %312 = OpIMul %int %311 %int_16 + %313 = OpIAdd %int %308 %312 + %314 = OpAccessChain %_ptr_Private_int %map %313 + OpStore %314 %int_1 + %315 = OpAccessChain %_ptr_Function_int %p %uint_1 + %316 = OpLoad %int %315 + %317 = OpISub %int %316 %int_2 + %318 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %318 %317 + OpBranch %289 + %289 = OpLabel + %319 = OpLoad %int %d + %320 = OpSGreaterThanEqual %bool %319 %int_0 + OpSelectionMerge %322 None + OpBranchConditional %320 %321 %322 + %321 = OpLabel + %323 = OpAccessChain %_ptr_Function_int %p %uint_0 + %324 = OpLoad %int %323 + %325 = OpSLessThan %bool %324 %int_14 + OpBranch %322 + %322 = OpLabel + %326 = OpPhi %bool %320 %289 %325 %321 + OpSelectionMerge %328 None + OpBranchConditional %326 %327 %328 + %327 = OpLabel + %329 = OpAccessChain %_ptr_Function_int %p %uint_0 + %330 = OpLoad %int %329 + %331 = OpIAdd %int %330 %int_2 + %332 = OpAccessChain %_ptr_Function_int %p %uint_1 + %333 = OpLoad %int %332 + %334 = OpIMul %int %333 %int_16 + %335 = OpIAdd %int %331 %334 + %336 = OpAccessChain %_ptr_Private_int %map %335 + %337 = OpLoad %int %336 + %338 = OpIEqual %bool %337 %int_0 + OpBranch %328 + %328 = OpLabel + %339 = OpPhi %bool %326 %322 %338 %327 + OpSelectionMerge %341 None + OpBranchConditional %339 %340 %341 + %340 = OpLabel + %342 = OpLoad %int %d + %343 = OpISub %int %342 %int_1 + OpStore %d %343 + %344 = OpAccessChain %_ptr_Function_int %p %uint_0 + %345 = OpLoad %int %344 + %346 = OpAccessChain %_ptr_Function_int %p %uint_1 + %347 = OpLoad %int %346 + %348 = OpIMul %int %347 %int_16 + %349 = OpIAdd %int %345 %348 + %350 = OpAccessChain %_ptr_Private_int %map %349 + OpStore %350 %int_1 + %351 = OpAccessChain %_ptr_Function_int %p %uint_0 + %352 = OpLoad %int %351 + %353 = OpIAdd %int %352 %int_1 + %354 = OpAccessChain %_ptr_Function_int %p %uint_1 + %355 = OpLoad %int %354 + %356 = OpIMul %int %355 %int_16 + %357 = OpIAdd %int %353 %356 + %358 = OpAccessChain %_ptr_Private_int %map %357 + OpStore %358 %int_1 + %359 = OpAccessChain %_ptr_Function_int %p %uint_0 + %360 = OpLoad %int %359 + %361 = OpIAdd %int %360 %int_2 + %362 = OpAccessChain %_ptr_Function_int %p %uint_1 + %363 = OpLoad %int %362 + %364 = OpIMul %int %363 %int_16 + %365 = OpIAdd %int %361 %364 + %366 = OpAccessChain %_ptr_Private_int %map %365 + OpStore %366 %int_1 + %367 = OpAccessChain %_ptr_Function_int %p %uint_0 + %368 = OpLoad %int %367 + %369 = OpIAdd %int %368 %int_2 + %370 = OpAccessChain %_ptr_Function_int %p %uint_0 + OpStore %370 %369 + OpBranch %341 + %341 = OpLabel + %371 = OpLoad %int %d + %372 = OpSGreaterThanEqual %bool %371 %int_0 + OpSelectionMerge %374 None + OpBranchConditional %372 %373 %374 + %373 = OpLabel + %375 = OpAccessChain %_ptr_Function_int %p %uint_1 + %376 = OpLoad %int %375 + %377 = OpSLessThan %bool %376 %int_14 + OpBranch %374 + %374 = OpLabel + %378 = OpPhi %bool %372 %341 %377 %373 + OpSelectionMerge %380 None + OpBranchConditional %378 %379 %380 + %379 = OpLabel + %381 = OpAccessChain %_ptr_Function_int %p %uint_0 + %382 = OpLoad %int %381 + %383 = OpAccessChain %_ptr_Function_int %p %uint_1 + %384 = OpLoad %int %383 + %385 = OpIAdd %int %384 %int_2 + %386 = OpIMul %int %385 %int_16 + %387 = OpIAdd %int %382 %386 + %388 = OpAccessChain %_ptr_Private_int %map %387 + %389 = OpLoad %int %388 + %390 = OpIEqual %bool %389 %int_0 + OpBranch %380 + %380 = OpLabel + %391 = OpPhi %bool %378 %374 %390 %379 + OpSelectionMerge %393 None + OpBranchConditional %391 %392 %393 + %392 = OpLabel + %394 = OpLoad %int %d + %395 = OpISub %int %394 %int_1 + OpStore %d %395 + %396 = OpAccessChain %_ptr_Function_int %p %uint_0 + %397 = OpLoad %int %396 + %398 = OpAccessChain %_ptr_Function_int %p %uint_1 + %399 = OpLoad %int %398 + %400 = OpIMul %int %399 %int_16 + %401 = OpIAdd %int %397 %400 + %402 = OpAccessChain %_ptr_Private_int %map %401 + OpStore %402 %int_1 + %403 = OpAccessChain %_ptr_Function_int %p %uint_0 + %404 = OpLoad %int %403 + %405 = OpAccessChain %_ptr_Function_int %p %uint_1 + %406 = OpLoad %int %405 + %407 = OpIAdd %int %406 %int_1 + %408 = OpIMul %int %407 %int_16 + %409 = OpIAdd %int %404 %408 + %410 = OpAccessChain %_ptr_Private_int %map %409 + OpStore %410 %int_1 + %411 = OpAccessChain %_ptr_Function_int %p %uint_0 + %412 = OpLoad %int %411 + %413 = OpAccessChain %_ptr_Function_int %p %uint_1 + %414 = OpLoad %int %413 + %415 = OpIAdd %int %414 %int_2 + %416 = OpIMul %int %415 %int_16 + %417 = OpIAdd %int %412 %416 + %418 = OpAccessChain %_ptr_Private_int %map %417 + OpStore %418 %int_1 + %419 = OpAccessChain %_ptr_Function_int %p %uint_1 + %420 = OpLoad %int %419 + %421 = OpIAdd %int %420 %int_2 + %422 = OpAccessChain %_ptr_Function_int %p %uint_1 + OpStore %422 %421 + OpBranch %393 + %393 = OpLabel + OpBranch %161 + %161 = OpLabel + %423 = OpAccessChain %_ptr_Function_int %ipos %uint_1 + %424 = OpLoad %int %423 + %425 = OpIMul %int %424 %int_16 + %426 = OpAccessChain %_ptr_Function_int %ipos %uint_0 + %427 = OpLoad %int %426 + %428 = OpIAdd %int %425 %427 + %429 = OpAccessChain %_ptr_Private_int %map %428 + %430 = OpLoad %int %429 + %431 = OpIEqual %bool %430 %int_1 + OpSelectionMerge %433 None + OpBranchConditional %431 %432 %433 + %432 = OpLabel + OpStore %_GLF_color %437 + OpReturn + %433 = OpLabel + OpBranch %71 + %71 = OpLabel + %439 = OpLoad %bool %canwalk + OpBranchConditional %439 %68 %70 + %70 = OpLabel + OpStore %_GLF_color %441 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag new file mode 100644 index 0000000000..6f9192cd20 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/late-expression-invalidation.asm.frag @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 68 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpName %m "m" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_10 = OpConstant %float 10 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 +%mat4v4float = OpTypeMatrix %v4float 4 + %21 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %22 = OpConstantComposite %mat4v4float %21 %21 %21 %21 + %uint_4 = OpConstant %uint 4 +%_arr_mat4v4float_uint_4 = OpTypeArray %mat4v4float %uint_4 +%_ptr_Function__arr_mat4v4float_uint_4 = OpTypePointer Function %_arr_mat4v4float_uint_4 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %v2float = OpTypeVector %float 2 + %30 = OpConstantComposite %v2float %float_1 %float_1 + %int_1 = OpConstant %int 1 + %uint_3 = OpConstant %uint 3 +%_ptr_Function_float = OpTypePointer Function %float + %34 = OpConstantComposite %_arr_mat4v4float_uint_4 %22 %22 %22 %22 + %main = OpFunction %void None %7 + %35 = OpLabel + %m = OpVariable %_ptr_Function__arr_mat4v4float_uint_4 Function + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %41 = OpLoad %float %40 + %42 = OpFOrdLessThan %bool %41 %float_10 + OpSelectionMerge %43 None + OpBranchConditional %42 %44 %43 + %44 = OpLabel + OpStore %_GLF_color %19 + OpBranch %37 + %43 = OpLabel + OpStore %m %34 + OpBranch %45 + %45 = OpLabel + %46 = OpPhi %int %int_0 %43 %47 %48 + %49 = OpSLessThan %bool %46 %int_4 + OpLoopMerge %50 %48 None + OpBranchConditional %49 %51 %50 + %51 = OpLabel + OpBranch %52 + %52 = OpLabel + %53 = OpPhi %int %int_0 %51 %54 %55 + %56 = OpSLessThan %bool %53 %int_4 + OpLoopMerge %57 %55 None + OpBranchConditional %56 %58 %57 + %58 = OpLabel + %59 = OpSelect %int %56 %int_1 %int_0 + %60 = OpAccessChain %_ptr_Function_float %m %59 %46 %uint_3 + %61 = OpLoad %float %60 + %62 = OpCompositeConstruct %v2float %61 %61 + %63 = OpFDiv %v2float %30 %62 + %64 = OpExtInst %float %1 Distance %30 %63 + %65 = OpFOrdLessThan %bool %64 %float_1 + OpSelectionMerge %66 None + OpBranchConditional %65 %67 %55 + %67 = OpLabel + OpStore %_GLF_color %21 + OpBranch %55 + %66 = OpLabel + OpBranch %55 + %55 = OpLabel + %54 = OpIAdd %int %53 %int_1 + OpBranch %52 + %57 = OpLabel + OpBranch %48 + %48 = OpLabel + %47 = OpIAdd %int %46 %int_1 + OpBranch %45 + %50 = OpLabel + OpBranch %37 + %38 = OpLabel + OpBranch %36 + %37 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag new file mode 100644 index 0000000000..9baebc20f4 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + OpDecorate %18 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %15 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpBitCount %v4uint %15 + %19 = OpExtInst %v4float %1 Ldexp %11 %18 + OpStore %_GLF_color %19 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..f2acc43604 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/loop-merge-to-continue.asm.invalid.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %v0 + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %j "j" + OpName %v0 "v0" + OpDecorate %FragColor Location 0 + OpDecorate %v0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v0 = OpVariable %_ptr_Input_v4float Input + %int_3 = OpConstant %int 3 +%_ptr_Input_float = OpTypePointer Input %float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %FragColor %11 + OpStore %i %int_0 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %int %i + %24 = OpSLessThan %bool %21 %int_4 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + OpStore %j %int_0 + OpBranch %26 + %26 = OpLabel + OpLoopMerge %19 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %int %j + %32 = OpSLessThan %bool %31 %int_4 + OpBranchConditional %32 %27 %19 + %27 = OpLabel + %35 = OpLoad %int %i + %36 = OpLoad %int %j + %37 = OpIAdd %int %35 %36 + %39 = OpBitwiseAnd %int %37 %int_3 + %41 = OpAccessChain %_ptr_Input_float %v0 %39 + %42 = OpLoad %float %41 + %43 = OpLoad %v4float %FragColor + %44 = OpCompositeConstruct %v4float %42 %42 %42 %42 + %45 = OpFAdd %v4float %43 %44 + OpStore %FragColor %45 + OpBranch %29 + %29 = OpLabel + %46 = OpLoad %int %j + %48 = OpIAdd %int %46 %int_1 + OpStore %j %48 + OpBranch %26 + %19 = OpLabel + %49 = OpLoad %int %i + %50 = OpIAdd %int %49 %int_1 + OpStore %i %50 + OpBranch %16 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag new file mode 100644 index 0000000000..ea85ed0b96 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-bracket-handling-2.vk.nocompat.asm.frag @@ -0,0 +1,96 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 53 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability SampledImageArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamplers "uSamplers" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "indices" + OpName %_ "" + OpName %vUV "vUV" + OpName %uSampler "uSampler" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uSamplers DescriptorSet 0 + OpDecorate %uSamplers Binding 0 + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %26 NonUniform + OpDecorate %28 NonUniform + OpDecorate %29 NonUniform + OpDecorate %vUV Location 0 + OpDecorate %uSampler DescriptorSet 1 + OpDecorate %uSampler Binding 0 + OpDecorate %38 NonUniform + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_runtimearr_11 = OpTypeRuntimeArray %11 +%_ptr_UniformConstant__runtimearr_11 = OpTypePointer UniformConstant %_runtimearr_11 + %uSamplers = OpVariable %_ptr_UniformConstant__runtimearr_11 UniformConstant + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %float_0 = OpConstant %float 0 + %uSampler = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + %24 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %int_10 + %26 = OpLoad %uint %24 + %28 = OpAccessChain %_ptr_UniformConstant_11 %uSamplers %26 + %29 = OpLoad %11 %28 + %33 = OpLoad %v2float %vUV + %35 = OpImageSampleExplicitLod %v4float %29 %33 Lod %float_0 + OpStore %FragColor %35 + %37 = OpLoad %11 %uSampler + %38 = OpCopyObject %11 %37 + %39 = OpLoad %v2float %vUV + %44 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %45 = OpLoad %float %44 + %46 = OpConvertFToS %int %45 + %47 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %46 + %48 = OpLoad %uint %47 + %49 = OpConvertUToF %float %48 + %50 = OpImageSampleExplicitLod %v4float %38 %39 Lod %49 + %51 = OpLoad %v4float %FragColor + %52 = OpFAdd %v4float %51 %50 + OpStore %FragColor %52 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag new file mode 100644 index 0000000000..e2d4562a8a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-qualifier-propagation.vk.nocompat.asm.frag @@ -0,0 +1,159 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 93 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniformEXT + OpCapability RuntimeDescriptorArrayEXT + OpCapability UniformBufferArrayNonUniformIndexingEXT + OpCapability SampledImageArrayNonUniformIndexingEXT + OpCapability StorageBufferArrayNonUniformIndexingEXT + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %i "i" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpName %uSamplers "uSamplers" + OpName %uSamps "uSamps" + OpName %vUV "vUV" + OpName %uCombinedSamplers "uCombinedSamplers" + OpName %UBO "UBO" + OpMemberName %UBO 0 "v" + OpName %ubos "ubos" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "v" + OpName %ssbos "ssbos" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %FragColor Location 0 + OpDecorate %uSamplers DescriptorSet 0 + OpDecorate %uSamplers Binding 0 + + OpDecorate %sampled_image NonUniformEXT + OpDecorate %combined_sampler NonUniformEXT + OpDecorate %ubo_ptr_copy NonUniformEXT + OpDecorate %ssbo_ptr_copy NonUniformEXT + + OpDecorate %uSamps DescriptorSet 0 + OpDecorate %uSamps Binding 1 + OpDecorate %vUV Location 1 + OpDecorate %uCombinedSamplers DescriptorSet 0 + OpDecorate %uCombinedSamplers Binding 4 + OpDecorate %_arr_v4float_uint_64 ArrayStride 16 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %ubos DescriptorSet 0 + OpDecorate %ubos Binding 2 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 NonWritable + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %16 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_runtimearr_16 = OpTypeRuntimeArray %16 +%_ptr_UniformConstant__runtimearr_16 = OpTypePointer UniformConstant %_runtimearr_16 + %uSamplers = OpVariable %_ptr_UniformConstant__runtimearr_16 UniformConstant + %int_10 = OpConstant %int 10 +%_ptr_UniformConstant_16 = OpTypePointer UniformConstant %16 + %27 = OpTypeSampler +%_runtimearr_27 = OpTypeRuntimeArray %27 +%_ptr_UniformConstant__runtimearr_27 = OpTypePointer UniformConstant %_runtimearr_27 + %uSamps = OpVariable %_ptr_UniformConstant__runtimearr_27 UniformConstant + %int_40 = OpConstant %int 40 +%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27 + %38 = OpTypeSampledImage %16 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input +%_runtimearr_38 = OpTypeRuntimeArray %38 +%_ptr_UniformConstant__runtimearr_38 = OpTypePointer UniformConstant %_runtimearr_38 +%uCombinedSamplers = OpVariable %_ptr_UniformConstant__runtimearr_38 UniformConstant +%_ptr_UniformConstant_38 = OpTypePointer UniformConstant %38 + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_v4float_uint_64 = OpTypeArray %v4float %uint_64 + %UBO = OpTypeStruct %_arr_v4float_uint_64 +%_runtimearr_UBO = OpTypeRuntimeArray %UBO +%_ptr_Uniform__runtimearr_UBO = OpTypePointer Uniform %_runtimearr_UBO + %ubos = OpVariable %_ptr_Uniform__runtimearr_UBO Uniform + %int_20 = OpConstant %int 20 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %_runtimearr_v4float +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %int_50 = OpConstant %int 50 + %int_60 = OpConstant %int 60 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %11 = OpLoad %int %vIndex + OpStore %i %11 + %20 = OpLoad %int %i + %22 = OpIAdd %int %20 %int_10 + %23 = OpCopyObject %int %22 + %25 = OpAccessChain %_ptr_UniformConstant_16 %uSamplers %23 + %26 = OpLoad %16 %25 + %31 = OpLoad %int %i + %33 = OpIAdd %int %31 %int_40 + %34 = OpCopyObject %int %33 + %36 = OpAccessChain %_ptr_UniformConstant_27 %uSamps %34 + %37 = OpLoad %27 %36 + %sampled_image = OpSampledImage %38 %26 %37 + %43 = OpLoad %v2float %vUV + %44 = OpImageSampleImplicitLod %v4float %sampled_image %43 + OpStore %FragColor %44 + %48 = OpLoad %int %i + %49 = OpIAdd %int %48 %int_10 + %50 = OpCopyObject %int %49 + %52 = OpAccessChain %_ptr_UniformConstant_38 %uCombinedSamplers %50 + %combined_sampler = OpLoad %38 %52 + %54 = OpLoad %v2float %vUV + %55 = OpImageSampleImplicitLod %v4float %combined_sampler %54 + OpStore %FragColor %55 + %63 = OpLoad %int %i + %65 = OpIAdd %int %63 %int_20 + %66 = OpCopyObject %int %65 + %68 = OpLoad %int %i + %69 = OpIAdd %int %68 %int_40 + %70 = OpCopyObject %int %69 + %ubo_ptr = OpAccessChain %_ptr_Uniform_v4float %ubos %66 %int_0 %70 + %ubo_ptr_copy = OpCopyObject %_ptr_Uniform_v4float %ubo_ptr + %73 = OpLoad %v4float %ubo_ptr_copy + %74 = OpLoad %v4float %FragColor + %75 = OpFAdd %v4float %74 %73 + OpStore %FragColor %75 + %81 = OpLoad %int %i + %83 = OpIAdd %int %81 %int_50 + %84 = OpCopyObject %int %83 + %85 = OpLoad %int %i + %87 = OpIAdd %int %85 %int_60 + %88 = OpCopyObject %int %87 + %ssbo_ptr = OpAccessChain %_ptr_Uniform_v4float %ssbos %84 %int_0 %88 + %ssbo_ptr_copy = OpCopyObject %_ptr_Uniform_v4float %ssbo_ptr + %90 = OpLoad %v4float %ssbo_ptr_copy + %91 = OpLoad %v4float %FragColor + %92 = OpFAdd %v4float %91 %90 + OpStore %FragColor %92 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag new file mode 100644 index 0000000000..c5428a8bb9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/nonuniform-ssbo.nocompat.vk.asm.frag @@ -0,0 +1,99 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpCapability StorageBufferArrayNonUniformIndexing + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpSourceExtension "GL_EXT_samplerless_texture_functions" + OpName %main "main" + OpName %i "i" + OpName %vIndex "vIndex" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "counter" + OpMemberName %SSBO 1 "v" + OpName %ssbos "ssbos" + OpName %FragColor "FragColor" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %ssbos DescriptorSet 0 + OpDecorate %ssbos Binding 3 + OpDecorate %32 NonUniform + OpDecorate %39 NonUniform + OpDecorate %49 NonUniform + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO = OpTypeStruct %uint %_runtimearr_v4float +%_runtimearr_SSBO = OpTypeRuntimeArray %SSBO +%_ptr_Uniform__runtimearr_SSBO = OpTypePointer Uniform %_runtimearr_SSBO + %ssbos = OpVariable %_ptr_Uniform__runtimearr_SSBO Uniform + %int_60 = OpConstant %int 60 + %int_1 = OpConstant %int 1 + %int_70 = OpConstant %int 70 + %float_20 = OpConstant %float 20 + %30 = OpConstantComposite %v4float %float_20 %float_20 %float_20 %float_20 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_100 = OpConstant %int 100 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %uint_100 = OpConstant %uint 100 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %uint_2 = OpConstant %uint 2 +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %11 = OpLoad %int %vIndex + OpStore %i %11 + %20 = OpLoad %int %i + %22 = OpIAdd %int %20 %int_60 + %23 = OpCopyObject %int %22 + %25 = OpLoad %int %i + %27 = OpIAdd %int %25 %int_70 + %28 = OpCopyObject %int %27 + %32 = OpAccessChain %_ptr_Uniform_v4float %ssbos %23 %int_1 %28 + OpStore %32 %30 + %33 = OpLoad %int %i + %35 = OpIAdd %int %33 %int_100 + %36 = OpCopyObject %int %35 + %39 = OpAccessChain %_ptr_Uniform_uint %ssbos %36 %int_0 + %43 = OpAtomicIAdd %uint %39 %uint_1 %uint_0 %uint_100 + %46 = OpLoad %int %i + %47 = OpCopyObject %int %46 + %49 = OpAccessChain %_ptr_Uniform_SSBO %ssbos %47 + %50 = OpArrayLength %uint %49 1 + %51 = OpBitcast %int %50 + %52 = OpConvertSToF %float %51 + %55 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + %56 = OpLoad %float %55 + %57 = OpFAdd %float %56 %52 + %58 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %58 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag new file mode 100644 index 0000000000..17aab1d8f7 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/only-initializer-frag-depth.asm.frag @@ -0,0 +1,25 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 10 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragDepth + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource GLSL 450 + OpName %main "main" + OpName %gl_FragDepth "gl_FragDepth" + OpDecorate %gl_FragDepth BuiltIn FragDepth + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %float_0_5 = OpConstant %float 0.5 +%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0_5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag new file mode 100644 index 0000000000..c77c9a17c8 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/opaque-id-literal-alias.preserve.asm.frag @@ -0,0 +1,78 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %gl_FragCoord "gl_FragCoord" + OpName %uSampled "uSampled" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %uSampled DescriptorSet 0 + OpDecorate %uSampled Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_10 = OpConstant %float 10 + %bool = OpTypeBool + %24 = OpTypeImage %float 2D 0 0 1 1 Unknown + %25 = OpTypeSampledImage %24 +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25 + %uSampled = OpVariable %_ptr_UniformConstant_25 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %11 + %17 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %18 = OpLoad %float %17 + %21 = OpFOrdLessThan %bool %18 %float_10 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %41 + %22 = OpLabel + %28 = OpLoad %25 %uSampled + %32 = OpLoad %v2float %vUV + %35 = OpConvertFToS %v2int %32 + %64 = OpImage %24 %28 + %38 = OpImageFetch %v4float %64 %35 Sample %int_0 + %39 = OpLoad %v4float %FragColor + %40 = OpFAdd %v4float %39 %38 + OpStore %FragColor %40 + OpBranch %23 + %41 = OpLabel + %42 = OpLoad %25 %uSampled + %43 = OpLoad %v2float %vUV + %44 = OpConvertFToS %v2int %43 + %46 = OpImage %24 %42 + %47 = OpImageFetch %v4float %46 %44 Sample %int_1 + %48 = OpLoad %v4float %FragColor + %49 = OpFAdd %v4float %48 %47 + OpStore %FragColor %49 + OpBranch %23 + %23 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag new file mode 100644 index 0000000000..4a7885e5dc --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/out-of-order-struct-id.asm.frag @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %80 "Foo" + OpMemberName %80 0 "a" + OpName %79 "Bar" + OpMemberName %79 0 "foo" + OpMemberName %79 1 "foo2" + OpName %UBO "UBO" + OpMemberName %UBO 0 "bar" + OpName %_ "" + OpDecorate %FragColor Location 0 + OpMemberDecorate %80 0 Offset 0 + OpMemberDecorate %79 0 Offset 0 + OpMemberDecorate %79 1 Offset 16 + OpMemberDecorate %UBO 0 Offset 0 + OpDecorate %UBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %80 = OpTypeStruct %v4float + %79 = OpTypeStruct %80 %80 + %UBO = OpTypeStruct %79 +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %_ = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_0 %int_0 + %19 = OpLoad %v4float %18 + %21 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_1 %int_0 + %22 = OpLoad %v4float %21 + %23 = OpFAdd %v4float %19 %22 + OpStore %FragColor %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag new file mode 100644 index 0000000000..12b47d2360 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/phi-alternative-precision.asm..vk.nocompat.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 41 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %b %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %b "b" + OpName %FragColor "FragColor" + OpDecorate %b RelaxedPrecision + OpDecorate %b Location 0 + OpDecorate %21 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %39 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_float = OpTypePointer Input %float + %b = OpVariable %_ptr_Input_float Input + %int_1 = OpConstant %int 1 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %float_4 = OpConstant %float 4 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %14 + %14 = OpLabel + %40 = OpPhi %int %int_0 %5 %27 %14 + %39 = OpPhi %float %float_0 %5 %24 %14 + %21 = OpLoad %float %b + %24 = OpExtInst %float %1 Fma %39 %21 %21 + %27 = OpIAdd %int %40 %int_1 + %31 = OpSLessThan %bool %27 %int_4 + OpLoopMerge %16 %14 None + OpBranchConditional %31 %14 %16 + %16 = OpLabel + %38 = OpFMul %float %39 %float_4 + OpStore %FragColor %38 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag new file mode 100644 index 0000000000..3696660d36 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/phi.zero-initialize.asm.frag @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vColor %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vColor "vColor" + OpName %uninit_function_int "uninit_function_int" + OpName %FragColor "FragColor" + OpName %uninit_int "uninit_int" + OpName %uninit_vector "uninit_vector" + OpName %uninit_matrix "uninit_matrix" + OpName %Foo "Foo" + OpMemberName %Foo 0 "a" + OpName %uninit_foo "uninit_foo" + OpDecorate %vColor Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vColor = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_10 = OpConstant %float 10 + %bool = OpTypeBool + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_20 = OpConstant %int 20 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_int = OpTypePointer Private %int + %uninit_int = OpUndef %int + %v4int = OpTypeVector %int 4 +%_ptr_Private_v4int = OpTypePointer Private %v4int +%uninit_vector = OpUndef %v4int +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Private_mat4v4float = OpTypePointer Private %mat4v4float +%uninit_matrix = OpUndef %mat4v4float + %Foo = OpTypeStruct %int +%_ptr_Private_Foo = OpTypePointer Private %Foo + %uninit_foo = OpUndef %Foo + %main = OpFunction %void None %3 + %5 = OpLabel +%uninit_function_int = OpVariable %_ptr_Function_int Function + %13 = OpAccessChain %_ptr_Input_float %vColor %uint_0 + %14 = OpLoad %float %13 + %17 = OpFOrdGreaterThan %bool %14 %float_10 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %24 + %18 = OpLabel + OpBranch %19 + %24 = OpLabel + OpBranch %19 + %19 = OpLabel + %27 = OpPhi %int %int_10 %18 %int_20 %24 + %28 = OpLoad %v4float %vColor + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag new file mode 100644 index 0000000000..ebd8d6bab7 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-callstack.asm.frag @@ -0,0 +1,89 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + OpReturn + OpFunctionEnd + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + OpBeginInvocationInterlockEXT + %43 = OpFunctionCall %void %callee2_ + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag new file mode 100644 index 0000000000..69b8f91120 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-control-flow.asm.frag @@ -0,0 +1,121 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + + OpMemberDecorate %SSBO2 0 Offset 0 + OpDecorate %SSBO2 BufferBlock + OpDecorate %ssbo2 DescriptorSet 0 + OpDecorate %ssbo2 Binding 2 + + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint + %SSBO2 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 +%_ptr_Uniform_SSBO2 = OpTypePointer Uniform %SSBO2 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %ssbo2 = OpVariable %_ptr_Uniform_SSBO2 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_4 = OpConstant %uint 4 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %callee3_res = OpFunctionCall %void %callee3_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %calle3_block = OpLabel + %frag_coord_x_ptr = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %frag_coord_x = OpLoad %float %frag_coord_x_ptr + %frag_coord_int = OpConvertFToS %int %frag_coord_x + %ssbo_ptr = OpAccessChain %_ptr_Uniform_uint %ssbo2 %int_0 %frag_coord_int + OpStore %ssbo_ptr %uint_4 + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + + OpSelectionMerge %merged_block None + OpBranchConditional %true %dummy_block %merged_block + %dummy_block = OpLabel + OpBeginInvocationInterlockEXT + OpEndInvocationInterlockEXT + OpBranch %merged_block + + %merged_block = OpLabel + OpReturn + + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag new file mode 100644 index 0000000000..7c0fe9a2b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/pixel-interlock-split-functions.asm.frag @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 45 +; Schema: 0 + OpCapability Shader + OpCapability FragmentShaderPixelInterlockEXT + OpExtension "SPV_EXT_fragment_shader_interlock" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main PixelInterlockOrderedEXT + OpSource GLSL 450 + OpSourceExtension "GL_ARB_fragment_shader_interlock" + OpName %main "main" + OpName %callee2_ "callee2(" + OpName %callee_ "callee(" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "values1" + OpName %_ "" + OpName %gl_FragCoord "gl_FragCoord" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "values0" + OpName %__0 "" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_runtimearr_uint_0 ArrayStride 4 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %SSBO1 = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %_ = OpVariable %_ptr_Uniform_SSBO1 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_runtimearr_uint_0 = OpTypeRuntimeArray %uint + %SSBO0 = OpTypeStruct %_runtimearr_uint_0 +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %__0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %44 = OpFunctionCall %void %callee_ + %call3res = OpFunctionCall %void %callee3_ + %call4res = OpFunctionCall %void %callee4_ + OpReturn + OpFunctionEnd + + %callee3_ = OpFunction %void None %3 + %begin3 = OpLabel + OpBeginInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee4_ = OpFunction %void None %3 + %begin4 = OpLabel + OpEndInvocationInterlockEXT + OpReturn + OpFunctionEnd + + %callee2_ = OpFunction %void None %3 + %7 = OpLabel + %23 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %24 = OpLoad %float %23 + %25 = OpConvertFToS %int %24 + %28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + %29 = OpLoad %uint %28 + %30 = OpIAdd %uint %29 %uint_1 + %31 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 %25 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %callee_ = OpFunction %void None %3 + %9 = OpLabel + %36 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %37 = OpLoad %float %36 + %38 = OpConvertFToS %int %37 + %39 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpIAdd %uint %40 %uint_1 + %42 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 %38 + OpStore %42 %41 + %43 = OpFunctionCall %void %callee2_ + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag new file mode 100644 index 0000000000..bccea17b39 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporaries.asm.frag @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vColor %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %vColor "vColor" + OpName %b "b" + OpName %i "i" + OpName %FragColor "FragColor" + OpDecorate %a RelaxedPrecision + OpDecorate %vColor RelaxedPrecision + OpDecorate %vColor Location 0 + OpDecorate %16 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vColor = 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 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_float Function + %i = OpVariable %_ptr_Function_int Function + %15 = OpAccessChain %_ptr_Input_float %vColor %uint_0 + %16 = OpLoad %float %15 + OpStore %a %16 + %19 = OpAccessChain %_ptr_Input_float %vColor %uint_1 + %20 = OpLoad %float %19 + OpStore %b %20 + OpStore %i %int_0 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %int %i + %33 = OpSLessThan %bool %30 %int_4 + OpBranchConditional %33 %26 %27 + %26 = OpLabel + %37 = OpLoad %v4float %FragColor + %38 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %39 = OpFAdd %v4float %37 %38 + OpStore %FragColor %39 + OpBranch %28 + %28 = OpLabel + %40 = OpLoad %int %i + %42 = OpIAdd %int %40 %int_1 + OpStore %i %42 + %43 = OpLoad %float %a + %44 = OpLoad %float %a + %45 = OpFMul %float %43 %44 + %force_tmp = OpFMul %float %45 %44 + %46 = OpLoad %float %b + %47 = OpFAdd %float %46 %force_tmp + OpStore %b %47 + OpBranch %25 + %27 = OpLabel + %48 = OpLoad %float %b + %49 = OpLoad %v4float %FragColor + %50 = OpCompositeConstruct %v4float %48 %48 %48 %48 + %51 = OpFAdd %v4float %49 %50 + OpStore %FragColor %51 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag new file mode 100644 index 0000000000..42d72dc410 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules-hoisted-temporary.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vColor %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %b "b" + OpName %vColor "vColor" + OpName %FragColor "FragColor" + OpDecorate %b RelaxedPrecision + OpDecorate %vColor RelaxedPrecision + OpDecorate %vColor Location 0 + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float + %vColor = OpVariable %_ptr_Input_float Input + %bool = OpTypeBool + %false = OpConstantFalse %bool +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %9 None + OpBranch %7 + %7 = OpLabel + %15 = OpLoad %float %vColor + %b = OpFMul %float %15 %15 + OpBranch %9 + %9 = OpLabel + OpBranchConditional %false %6 %8 + %8 = OpLabel + %bb = OpFMul %float %b %b + OpStore %FragColor %bb + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag new file mode 100644 index 0000000000..ad526e5560 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/relaxed-precision-inheritance-rules.asm.frag @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 15 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor0 %FragColor1 %FragColor2 %FragColor3 %V4 + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpName %main "main" + OpName %FragColor0 "FragColor0" + OpName %FragColor1 "FragColor1" + OpName %FragColor2 "FragColor2" + OpName %FragColor3 "FragColor3" + OpName %V4 "V4" + OpName %V4_value0 "V4_value0" + OpName %V1_value0 "V1_value0" + OpName %V1_value1 "V1_value1" + OpName %V1_value2 "V1_value2" + OpName %float_0_weird "float_0_weird" + OpName %ubo "ubo" + OpName %ubo_mp0 "ubo_mp0" + OpName %ubo_hp0 "ubo_hp0" + OpName %block "UBO" + OpName %phi_mp "phi_mp" + OpName %phi_hp "phi_hp" + OpMemberName %block 0 "mediump_float" + OpMemberName %block 1 "highp_float" + OpDecorate %FragColor0 RelaxedPrecision + OpDecorate %FragColor0 Location 0 + OpDecorate %FragColor1 RelaxedPrecision + OpDecorate %FragColor1 Location 1 + OpDecorate %FragColor2 RelaxedPrecision + OpDecorate %FragColor2 Location 2 + OpDecorate %FragColor3 RelaxedPrecision + OpDecorate %FragColor3 Location 3 + OpDecorate %V4 RelaxedPrecision + OpDecorate %V4 Location 0 + OpDecorate %V4_add RelaxedPrecision + OpDecorate %V4_mul RelaxedPrecision + OpDecorate %V1_add RelaxedPrecision + OpDecorate %V1_mul RelaxedPrecision + OpDecorate %phi_mp RelaxedPrecision + OpDecorate %mp_to_mp RelaxedPrecision + OpDecorate %hp_to_mp RelaxedPrecision + OpDecorate %V1_add_composite RelaxedPrecision + OpDecorate %V1_mul_composite RelaxedPrecision + OpDecorate %V4_sin1 RelaxedPrecision + OpDecorate %float_0_weird RelaxedPrecision + OpDecorate %ubo Binding 0 + OpDecorate %ubo DescriptorSet 0 + OpDecorate %block Block + OpMemberDecorate %block 0 Offset 0 + OpMemberDecorate %block 1 Offset 4 + OpMemberDecorate %block 0 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %block = OpTypeStruct %float %float + %block_ptr = OpTypePointer Uniform %block + %ubo_float_ptr = OpTypePointer Uniform %float + %ubo = OpVariable %block_ptr Uniform + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %float_3 = OpConstant %float 3.0 + %v4float = OpTypeVector %float 4 + %float_3_splat = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor0 = OpVariable %_ptr_Output_v4float Output + %FragColor1 = OpVariable %_ptr_Output_v4float Output + %FragColor2 = OpVariable %_ptr_Output_v4float Output + %FragColor3 = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_float = OpTypePointer Input %float + %V4 = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + + ; Inherits precision in GLSL + %V4_value0 = OpLoad %v4float %V4 + + ; Inherits precision in GLSL + %ptr_V4x = OpAccessChain %_ptr_Input_float %V4 %uint_0 + + ; Inherits precision in GLSL + %V1_value0 = OpLoad %float %ptr_V4x + %V1_value1 = OpCompositeExtract %float %V4_value0 2 + %V1_value2 = OpCopyObject %float %V1_value1 + + %mp_ptr = OpAccessChain %ubo_float_ptr %ubo %uint_0 + %hp_ptr = OpAccessChain %ubo_float_ptr %ubo %uint_1 + %ubo_mp0 = OpLoad %float %mp_ptr + %ubo_hp0 = OpLoad %float %hp_ptr + + ; Stays mediump + %V4_add = OpFAdd %v4float %V4_value0 %float_3_splat + ; Must promote to highp + %V4_sub = OpFSub %v4float %V4_value0 %float_3_splat + ; Relaxed, truncate inputs. + %V4_mul = OpFMul %v4float %V4_sub %float_3_splat + OpStore %FragColor0 %V4_add + OpStore %FragColor1 %V4_sub + OpStore %FragColor2 %V4_mul + + ; Same as V4 tests. + %V1_add = OpFAdd %float %V1_value0 %float_3 + %float_0_weird = OpFSub %float %float_3 %ubo_hp0 + %V1_sub = OpFSub %float %V1_value0 %float_0_weird + %V1_mul = OpFMul %float %V1_sub %ubo_hp0 + %V1_result = OpCompositeConstruct %v4float %V1_add %V1_sub %V1_mul %float_3 + OpStore %FragColor3 %V1_result + + ; Same as V4 tests, but composite forwarding. + %V1_add_composite = OpFAdd %float %V1_value1 %ubo_mp0 + %V1_sub_composite = OpFSub %float %V1_value2 %ubo_mp0 + %V1_mul_composite = OpFMul %float %V1_sub_composite %ubo_hp0 + %V1_result_composite = OpCompositeConstruct %v4float %V1_add_composite %V1_sub_composite %V1_mul_composite %float_3 + OpStore %FragColor3 %V1_result_composite + + ; Must promote input to highp. + %V4_sin0 = OpExtInst %v4float %1 Sin %V4_value0 + OpStore %FragColor0 %V4_sin0 + ; Can keep mediump input. + %V4_sin1 = OpExtInst %v4float %1 Sin %V4_value0 + OpStore %FragColor1 %V4_sin1 + + OpBranch %next + %next = OpLabel + %phi_mp = OpPhi %float %V1_add %5 + %phi_hp = OpPhi %float %V1_sub %5 + + ; Consume PHIs in different precision contexts + %mp_to_mp = OpFAdd %float %phi_mp %phi_mp + %mp_to_hp = OpFAdd %float %phi_mp %phi_mp + %hp_to_mp = OpFAdd %float %phi_hp %phi_hp + %hp_to_hp = OpFAdd %float %phi_hp %phi_hp + %complete = OpCompositeConstruct %v4float %mp_to_mp %mp_to_hp %hp_to_mp %hp_to_hp + OpStore %FragColor2 %complete + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag new file mode 100644 index 0000000000..a5a16f2873 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-function-identifier.asm.frag @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %ACOS_f1_ "mat3" + OpName %a "a" + OpName %ACOS_i1_ "gl_Foo" + OpName %a_0 "a" + OpName %FragColor "FragColor" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %_ptr_Function_float + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %14 = OpTypeFunction %float %_ptr_Function_int + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_2 = OpConstant %float 2 + %int_4 = OpConstant %int 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %param = OpVariable %_ptr_Function_float Function + %param_0 = OpVariable %_ptr_Function_int Function + OpStore %param %float_2 + %32 = OpFunctionCall %float %ACOS_f1_ %param + OpStore %param_0 %int_4 + %35 = OpFunctionCall %float %ACOS_i1_ %param_0 + %36 = OpFAdd %float %32 %35 + OpStore %FragColor %36 + OpReturn + OpFunctionEnd + %ACOS_f1_ = OpFunction %float None %8 + %a = OpFunctionParameter %_ptr_Function_float + %11 = OpLabel + %18 = OpLoad %float %a + %20 = OpFAdd %float %18 %float_1 + OpReturnValue %20 + OpFunctionEnd + %ACOS_i1_ = OpFunction %float None %14 + %a_0 = OpFunctionParameter %_ptr_Function_int + %17 = OpLabel + %23 = OpLoad %int %a_0 + %24 = OpConvertSToF %float %23 + %25 = OpFAdd %float %24 %float_1 + OpReturnValue %25 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag new file mode 100644 index 0000000000..5015cef82a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/reserved-identifiers.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %spvFoo %SPIRV_Cross_blah %_40 %_m40 %_underscore_foo_bar_meep + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %spvFoo "spvFoo" + OpName %SPIRV_Cross_blah "SPIRV_Cross_blah" + OpName %_40 "_40Bar" + OpName %_m40 "_m40" + OpName %_underscore_foo_bar_meep "__underscore_foo__bar_meep__" + OpDecorate %spvFoo Location 0 + OpDecorate %SPIRV_Cross_blah Location 1 + OpDecorate %_40 Location 2 + OpDecorate %_m40 Location 3 + OpDecorate %_underscore_foo_bar_meep Location 4 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %spvFoo = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%SPIRV_Cross_blah = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %_40 = OpVariable %_ptr_Output_v4float Output + %float_2 = OpConstant %float 2 + %17 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %_m40 = OpVariable %_ptr_Output_v4float Output + %float_3 = OpConstant %float 3 + %20 = OpConstantComposite %v4float %float_3 %float_3 %float_3 %float_3 +%_underscore_foo_bar_meep = OpVariable %_ptr_Output_v4float Output + %float_4 = OpConstant %float 4 + %23 = OpConstantComposite %v4float %float_4 %float_4 %float_4 %float_4 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %spvFoo %11 + OpStore %SPIRV_Cross_blah %14 + OpStore %_40 %17 + OpStore %_m40 %20 + OpStore %_underscore_foo_bar_meep %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag new file mode 100644 index 0000000000..07450ee80b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/scalar-select.spv14.asm.frag @@ -0,0 +1,62 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool + %false = OpConstantFalse %bool + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %true = OpConstantTrue %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %s = OpTypeStruct %float + %arr = OpTypeArray %float %uint_2 +%_ptr_Function_s = OpTypePointer Function %s +%_ptr_Function_arr = OpTypePointer Function %arr + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 + %18 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %s0 = OpConstantComposite %s %float_0 + %s1 = OpConstantComposite %s %float_1 + %v4bool = OpTypeVector %bool 4 + %b4 = OpConstantComposite %v4bool %false %true %false %true + %arr1 = OpConstantComposite %arr %float_0 %float_1 + %arr2 = OpConstantComposite %arr %float_1 %float_0 + %main = OpFunction %void None %3 + %5 = OpLabel + %ss = OpVariable %_ptr_Function_s Function + %arrvar = OpVariable %_ptr_Function_arr Function + ; Not trivial + %21 = OpSelect %v4float %false %17 %18 + OpStore %FragColor %21 + ; Trivial + %22 = OpSelect %v4float %false %19 %20 + OpStore %FragColor %22 + ; Vector not trivial + %23 = OpSelect %v4float %b4 %17 %18 + OpStore %FragColor %23 + ; Vector trivial + %24 = OpSelect %v4float %b4 %19 %20 + OpStore %FragColor %24 + ; Struct selection + %sout = OpSelect %s %false %s0 %s1 + OpStore %ss %sout + ; Array selection + %arrout = OpSelect %arr %true %arr1 %arr2 + OpStore %arrvar %arrout + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..ecc491594f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/selection-merge-to-continue.asm.invalid.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %v0 + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %v0 "v0" + OpDecorate %FragColor Location 0 + OpDecorate %v0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v0 = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_20 = OpConstant %float 20 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %FragColor %11 + OpStore %i %int_0 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %int %i + %24 = OpSLessThan %bool %21 %int_4 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %30 = OpAccessChain %_ptr_Input_float %v0 %uint_0 + %31 = OpLoad %float %30 + %33 = OpFOrdEqual %bool %31 %float_20 + OpSelectionMerge %19 None + OpBranchConditional %33 %34 %44 + %34 = OpLabel + %36 = OpLoad %int %i + %38 = OpBitwiseAnd %int %36 %int_3 + %39 = OpAccessChain %_ptr_Input_float %v0 %38 + %40 = OpLoad %float %39 + %41 = OpLoad %v4float %FragColor + %42 = OpCompositeConstruct %v4float %40 %40 %40 %40 + %43 = OpFAdd %v4float %41 %42 + OpStore %FragColor %43 + OpBranch %19 + %44 = OpLabel + %45 = OpLoad %int %i + %47 = OpBitwiseAnd %int %45 %int_1 + %48 = OpAccessChain %_ptr_Input_float %v0 %47 + %49 = OpLoad %float %48 + %50 = OpLoad %v4float %FragColor + %51 = OpCompositeConstruct %v4float %49 %49 %49 %49 + %52 = OpFAdd %v4float %50 %51 + OpStore %FragColor %52 + OpBranch %19 + %19 = OpLabel + %53 = OpLoad %int %i + %54 = OpIAdd %int %53 %int_1 + OpStore %i %54 + OpBranch %16 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag new file mode 100644 index 0000000000..9b2eb72899 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/sparse-texture-feedback-uint-code.asm.desktop.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpCapability SparseResidency + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vUV %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_ARB_sparse_texture2" + OpSourceExtension "GL_ARB_sparse_texture_clamp" + OpName %main "main" + OpName %ret "ret" + OpName %uSamp "uSamp" + OpName %vUV "vUV" + OpName %texel "texel" + OpName %ResType "ResType" + OpName %FragColor "FragColor" + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %vUV Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 + %ResType = OpTypeStruct %uint %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %ret = OpVariable %_ptr_Function_bool Function + %texel = OpVariable %_ptr_Function_v4float Function + %14 = OpLoad %11 %uSamp + %18 = OpLoad %v2float %vUV + %24 = OpImageSparseSampleImplicitLod %ResType %14 %18 + %25 = OpCompositeExtract %v4float %24 1 + OpStore %texel %25 + %26 = OpCompositeExtract %uint %24 0 + %27 = OpImageSparseTexelsResident %bool %26 + OpStore %ret %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag new file mode 100644 index 0000000000..a47c6b785f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-arithmetic-cast.nocompat.vk.asm.frag @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 78 +; Schema: 0 + OpCapability Shader + OpCapability GroupNonUniform + OpCapability GroupNonUniformArithmetic + OpCapability GroupNonUniformClustered + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %index %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_KHR_shader_subgroup_arithmetic" + OpSourceExtension "GL_KHR_shader_subgroup_basic" + OpSourceExtension "GL_KHR_shader_subgroup_clustered" + OpName %main "main" + OpName %index "index" + OpName %FragColor "FragColor" + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input + %uint_3 = OpConstant %uint 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Output_uint = OpTypePointer Output %uint + %FragColor = OpVariable %_ptr_Output_uint Output + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpLoad %int %index + %u = OpBitcast %uint %i + %res0 = OpGroupNonUniformSMin %uint %uint_3 Reduce %i + %res1 = OpGroupNonUniformSMax %uint %uint_3 Reduce %u + %res2 = OpGroupNonUniformUMin %uint %uint_3 Reduce %i + %res3 = OpGroupNonUniformUMax %uint %uint_3 Reduce %u + %res4 = OpGroupNonUniformSMax %uint %uint_3 InclusiveScan %i + %res5 = OpGroupNonUniformSMin %uint %uint_3 InclusiveScan %u + %res6 = OpGroupNonUniformUMax %uint %uint_3 ExclusiveScan %i + %res7 = OpGroupNonUniformUMin %uint %uint_3 ExclusiveScan %u + %res8 = OpGroupNonUniformSMin %uint %uint_3 ClusteredReduce %i %uint_4 + %res9 = OpGroupNonUniformSMax %uint %uint_3 ClusteredReduce %u %uint_4 + %res10 = OpGroupNonUniformUMin %uint %uint_3 ClusteredReduce %i %uint_4 + %res11 = OpGroupNonUniformUMax %uint %uint_3 ClusteredReduce %u %uint_4 + OpStore %FragColor %res0 + OpStore %FragColor %res1 + OpStore %FragColor %res2 + OpStore %FragColor %res3 + OpStore %FragColor %res4 + OpStore %FragColor %res5 + OpStore %FragColor %res6 + OpStore %FragColor %res7 + OpStore %FragColor %res8 + OpStore %FragColor %res9 + OpStore %FragColor %res10 + OpStore %FragColor %res11 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag new file mode 100644 index 0000000000..39f4d066db --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/subgroup-ballot-only.vk.asm.frag @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.3 +; Generator: Unknown(30017); 21022 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpCapability GroupNonUniformBallot + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %INDEX %SV_Target + OpExecutionMode %main OriginUpperLeft + OpName %main "main" + OpName %INDEX "INDEX" + OpName %SV_Target "SV_Target" + OpDecorate %INDEX Flat + OpDecorate %INDEX Location 0 + OpDecorate %SV_Target Location 0 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %INDEX = OpVariable %_ptr_Input_uint Input + %v4uint = OpTypeVector %uint 4 +%_ptr_Output_v4uint = OpTypePointer Output %v4uint + %SV_Target = OpVariable %_ptr_Output_v4uint Output + %bool = OpTypeBool + %uint_100 = OpConstant %uint 100 + %uint_3 = OpConstant %uint 3 +%_ptr_Output_uint = OpTypePointer Output %uint + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %main = OpFunction %void None %2 + %4 = OpLabel + OpBranch %29 + %29 = OpLabel + %11 = OpLoad %uint %INDEX + %13 = OpULessThan %bool %11 %uint_100 + %15 = OpGroupNonUniformBallot %v4uint %uint_3 %13 + %17 = OpCompositeExtract %uint %15 0 + %18 = OpCompositeExtract %uint %15 1 + %19 = OpCompositeExtract %uint %15 2 + %20 = OpCompositeExtract %uint %15 3 + %22 = OpAccessChain %_ptr_Output_uint %SV_Target %uint_0 + OpStore %22 %17 + %24 = OpAccessChain %_ptr_Output_uint %SV_Target %uint_1 + OpStore %24 %18 + %26 = OpAccessChain %_ptr_Output_uint %SV_Target %uint_2 + OpStore %26 %19 + %28 = OpAccessChain %_ptr_Output_uint %SV_Target %uint_3 + OpStore %28 %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag new file mode 100644 index 0000000000..b154679510 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-block-case-fallthrough.asm.invalid.frag @@ -0,0 +1,80 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %j "j" + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %header = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + %9 = OpLoad %int %vIndex + OpSelectionMerge %switch_merge None + OpSwitch %9 %default_case 100 %default_case 0 %case_0 1 %case_1 11 %case_1 2 %case_2 3 %case_3 4 %case_4 5 %case_5 + + %case_0 = OpLabel + OpBranch %default_case + + %default_case = OpLabel + %default_case_phi = OpPhi %int %int_2 %header %int_3 %case_0 + ; Test what happens when a case block dominates access to a variable. + OpStore %j %default_case_phi + OpBranch %case_1 + + %case_1 = OpLabel + ; Test phi nodes between case labels. + %case_1_phi = OpPhi %int %int_0 %default_case %int_1 %header + OpStore %j %case_1_phi + OpBranch %case_2 + + %case_2 = OpLabel + OpBranch %switch_merge + + %case_3 = OpLabel + ; Conditionally branch to another case block. This is really dumb, but it is apparently legal. + %case_3_cond = OpSGreaterThan %bool %9 %int_3 + OpBranchConditional %case_3_cond %case_4 %switch_merge + + %case_4 = OpLabel + ; When emitted from case 3, we should *not* see fallthrough behavior. + OpBranch %case_5 + + %case_5 = OpLabel + OpStore %i %int_0 + OpBranch %switch_merge + + %switch_merge = OpLabel + %26 = OpLoad %int %i + %27 = OpConvertSToF %float %26 + %28 = OpCompositeConstruct %v4float %27 %27 %27 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag new file mode 100644 index 0000000000..94ef5f538f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-merge-to-continue.asm.invalid.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 57 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %v0 + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %v0 "v0" + OpDecorate %FragColor Location 0 + OpDecorate %v0 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %float_3 = OpConstant %float 3 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v0 = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %FragColor %11 + OpStore %i %int_0 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %21 = OpLoad %int %i + %24 = OpSLessThan %bool %21 %int_4 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %25 = OpLoad %int %i + OpSelectionMerge %19 None + OpSwitch %25 %28 0 %26 1 %27 + %28 = OpLabel + %46 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + %47 = OpLoad %float %46 + %48 = OpFAdd %float %47 %float_3 + %49 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %49 %48 + OpBranch %19 + %26 = OpLabel + %33 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + %34 = OpLoad %float %33 + %35 = OpFAdd %float %34 %float_1 + %36 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %36 %35 + OpBranch %19 + %27 = OpLabel + %40 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + %41 = OpLoad %float %40 + %42 = OpFAdd %float %41 %float_3 + %43 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + OpStore %43 %42 + OpBranch %19 + %19 = OpLabel + %52 = OpLoad %int %i + %54 = OpIAdd %int %52 %int_1 + OpStore %i %54 + OpBranch %16 + %18 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag new file mode 100644 index 0000000000..dd9a5a97b0 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-non-default-fallthrough-no-phi.asm.frag @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google rspirv; 0 +; Bound: 80 +; Schema: 0 + OpCapability Shader + OpCapability VulkanMemoryModel + OpExtension "SPV_KHR_vulkan_memory_model" + OpMemoryModel Logical Vulkan + OpEntryPoint Fragment %1 "main" %2 %3 + OpExecutionMode %1 OriginUpperLeft + OpMemberDecorate %_struct_14 0 Offset 0 + OpMemberDecorate %_struct_14 1 Offset 4 + OpMemberDecorate %_struct_15 0 Offset 0 + OpMemberDecorate %_struct_15 1 Offset 4 + OpDecorate %2 Location 0 + OpDecorate %3 Location 0 + OpDecorate %2 Flat + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %bool = OpTypeBool +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_int = OpTypePointer Output %int +%_ptr_Function_int = OpTypePointer Function %int + %void = OpTypeVoid + %_struct_14 = OpTypeStruct %uint %int + %_struct_15 = OpTypeStruct %int %int +%_ptr_Function__struct_15 = OpTypePointer Function %_struct_15 + %24 = OpTypeFunction %void + %2 = OpVariable %_ptr_Input_int Input + %3 = OpVariable %_ptr_Output_int Output + %uint_1 = OpConstant %uint 1 + %26 = OpUndef %_struct_14 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %true = OpConstantTrue %bool + %31 = OpUndef %int + %false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool + %1 = OpFunction %void None %24 + %32 = OpLabel + %76 = OpVariable %_ptr_Function_bool Function %false + %33 = OpVariable %_ptr_Function__struct_15 Function + %34 = OpVariable %_ptr_Function_int Function + %35 = OpVariable %_ptr_Function_int Function + OpSelectionMerge %72 None + OpSwitch %uint_0 %73 + %73 = OpLabel + %36 = OpLoad %int %2 + %37 = OpAccessChain %_ptr_Function_int %33 %uint_0 + OpStore %37 %int_0 + %38 = OpAccessChain %_ptr_Function_int %33 %uint_1 + OpStore %38 %int_10 + OpBranch %40 + %40 = OpLabel + %41 = OpPhi %_struct_14 %26 %73 %42 %43 + %44 = OpPhi %int %int_0 %73 %45 %43 + OpLoopMerge %48 %43 None + OpBranch %49 + %49 = OpLabel + %52 = OpLoad %int %37 + %53 = OpLoad %int %38 + %54 = OpSLessThan %bool %52 %53 + OpSelectionMerge %55 None + OpBranchConditional %54 %56 %57 + %57 = OpLabel + %65 = OpCompositeInsert %_struct_14 %uint_0 %41 0 + OpBranch %55 + %56 = OpLabel + %59 = OpLoad %int %37 + %60 = OpBitcast %int %uint_1 + %61 = OpIAdd %int %59 %60 + OpCopyMemory %34 %37 + %63 = OpLoad %int %34 + OpStore %35 %61 + OpCopyMemory %37 %35 + %64 = OpCompositeConstruct %_struct_14 %uint_1 %63 + OpBranch %55 + %55 = OpLabel + %42 = OpPhi %_struct_14 %64 %56 %65 %57 + %66 = OpCompositeExtract %uint %42 0 + %67 = OpBitcast %int %66 + OpSelectionMerge %71 None + OpSwitch %67 %69 0 %70 1 %71 + %71 = OpLabel + %45 = OpIAdd %int %44 %36 + OpBranch %43 + %70 = OpLabel + OpStore %3 %44 + OpStore %76 %true + OpBranch %48 + %69 = OpLabel + OpBranch %48 + %43 = OpLabel + OpBranch %40 + %48 = OpLabel + %79 = OpPhi %bool %false %69 %true %70 + OpSelectionMerge %77 None + OpBranchConditional %79 %72 %77 + %77 = OpLabel + OpBranch %72 + %72 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag new file mode 100644 index 0000000000..d2bd15a978 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %52 = OpUndef %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpSwitch %int_0 %8 + %8 = OpLabel + %17 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %18 = OpLoad %float %17 + %22 = OpFOrdNotEqual %bool %18 %18 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpBranch %9 + %24 = OpLabel + %33 = OpCompositeExtract %float %52 1 + %51 = OpCompositeInsert %v2float %33 %52 1 + OpBranch %9 + %9 = OpLabel + %53 = OpPhi %v2float %52 %23 %51 %24 + %42 = OpCompositeExtract %float %53 0 + %43 = OpCompositeExtract %float %53 1 + %48 = OpCompositeConstruct %v4float %42 %43 %float_1 %float_1 + OpStore %_GLF_color %48 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag new file mode 100644 index 0000000000..d596e4efe7 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/terminate-impure-function-call.spv16.asm.frag @@ -0,0 +1,59 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vA %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %foobar_i1_ "foobar(i1;" + OpName %a "a" + OpName %a_0 "a" + OpName %vA "vA" + OpName %param "param" + OpName %FragColor "FragColor" + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %22 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_0 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_int Function + %30 = OpLoad %int %vA + OpStore %param %30 + %31 = OpFunctionCall %v4float %foobar_i1_ %param + OpStore %FragColor %22 + OpReturn + OpFunctionEnd + %foobar_i1_ = OpFunction %v4float None %10 + %a = OpFunctionParameter %_ptr_Function_int + %13 = OpLabel + %14 = OpLoad %int %a + %17 = OpSLessThan %bool %14 %int_0 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %19 + %18 = OpLabel + OpTerminateInvocation + %19 = OpLabel + OpReturnValue %22 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag new file mode 100644 index 0000000000..6f198079ff --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/texel-fetch-ms-uint-sample.asm.frag @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamp "uSamp" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 1 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uSamp + %18 = OpLoad %v4float %gl_FragCoord + %19 = OpVectorShuffle %v2float %18 %18 0 1 + %22 = OpConvertFToS %v2int %19 + %24 = OpImage %10 %14 + %25 = OpImageFetch %v4float %24 %22 Sample %uint_0 + %28 = OpCompositeExtract %float %25 0 + %30 = OpAccessChain %_ptr_Output_float %FragColor %uint_0 + OpStore %30 %28 + %36 = OpImage %10 %14 + %37 = OpImageFetch %v4float %36 %22 Sample %uint_1 + %38 = OpCompositeExtract %float %37 0 + %40 = OpAccessChain %_ptr_Output_float %FragColor %uint_1 + OpStore %40 %38 + %46 = OpImage %10 %14 + %47 = OpImageFetch %v4float %46 %22 Sample %uint_2 + %48 = OpCompositeExtract %float %47 0 + %50 = OpAccessChain %_ptr_Output_float %FragColor %uint_2 + OpStore %50 %48 + %56 = OpImage %10 %14 + %57 = OpImageFetch %v4float %56 %22 Sample %uint_3 + %58 = OpCompositeExtract %float %57 0 + %60 = OpAccessChain %_ptr_Output_float %FragColor %uint_3 + OpStore %60 %58 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.asm.frag new file mode 100644 index 0000000000..15286e0897 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.asm.frag @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %A %B %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %test_vector_ "test_vector(" + OpName %test_scalar_ "test_scalar(" + OpName %le "le" + OpName %A "A" + OpName %B "B" + OpName %leq "leq" + OpName %ge "ge" + OpName %geq "geq" + OpName %eq "eq" + OpName %neq "neq" + OpName %le_0 "le" + OpName %leq_0 "leq" + OpName %ge_0 "ge" + OpName %geq_0 "geq" + OpName %eq_0 "eq" + OpName %neq_0 "neq" + OpName %FragColor "FragColor" + OpDecorate %A Location 0 + OpDecorate %B Location 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %11 = OpTypeFunction %float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %A = OpVariable %_ptr_Input_v4float Input + %B = OpVariable %_ptr_Input_v4float Input + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %128 = OpFunctionCall %v4float %test_vector_ + %129 = OpFunctionCall %float %test_scalar_ + %130 = OpCompositeConstruct %v4float %129 %129 %129 %129 + %131 = OpFAdd %v4float %128 %130 + OpStore %FragColor %131 + OpReturn + OpFunctionEnd +%test_vector_ = OpFunction %v4float None %8 + %10 = OpLabel + %le = OpVariable %_ptr_Function_v4bool Function + %leq = OpVariable %_ptr_Function_v4bool Function + %ge = OpVariable %_ptr_Function_v4bool Function + %geq = OpVariable %_ptr_Function_v4bool Function + %eq = OpVariable %_ptr_Function_v4bool Function + %neq = OpVariable %_ptr_Function_v4bool Function + %20 = OpLoad %v4float %A + %22 = OpLoad %v4float %B + %23 = OpFUnordLessThan %v4bool %20 %22 + OpStore %le %23 + %25 = OpLoad %v4float %A + %26 = OpLoad %v4float %B + %27 = OpFUnordLessThanEqual %v4bool %25 %26 + OpStore %leq %27 + %29 = OpLoad %v4float %A + %30 = OpLoad %v4float %B + %31 = OpFUnordGreaterThan %v4bool %29 %30 + OpStore %ge %31 + %33 = OpLoad %v4float %A + %34 = OpLoad %v4float %B + %35 = OpFUnordGreaterThanEqual %v4bool %33 %34 + OpStore %geq %35 + %37 = OpLoad %v4float %A + %38 = OpLoad %v4float %B + %39 = OpFUnordEqual %v4bool %37 %38 + OpStore %eq %39 + %41 = OpLoad %v4float %A + %42 = OpLoad %v4float %B + %43 = OpFUnordNotEqual %v4bool %41 %42 + OpStore %neq %43 + %ordered = OpFOrdNotEqual %v4bool %41 %42 + OpStore %neq %ordered + %44 = OpLoad %v4bool %le + %49 = OpSelect %v4float %44 %48 %47 + %50 = OpLoad %v4bool %leq + %51 = OpSelect %v4float %50 %48 %47 + %52 = OpFAdd %v4float %49 %51 + %53 = OpLoad %v4bool %ge + %54 = OpSelect %v4float %53 %48 %47 + %55 = OpFAdd %v4float %52 %54 + %56 = OpLoad %v4bool %geq + %57 = OpSelect %v4float %56 %48 %47 + %58 = OpFAdd %v4float %55 %57 + %59 = OpLoad %v4bool %eq + %60 = OpSelect %v4float %59 %48 %47 + %61 = OpFAdd %v4float %58 %60 + %62 = OpLoad %v4bool %neq + %63 = OpSelect %v4float %62 %48 %47 + %64 = OpFAdd %v4float %61 %63 + OpReturnValue %64 + OpFunctionEnd +%test_scalar_ = OpFunction %float None %11 + %13 = OpLabel + %le_0 = OpVariable %_ptr_Function_bool Function + %leq_0 = OpVariable %_ptr_Function_bool Function + %ge_0 = OpVariable %_ptr_Function_bool Function + %geq_0 = OpVariable %_ptr_Function_bool Function + %eq_0 = OpVariable %_ptr_Function_bool Function + %neq_0 = OpVariable %_ptr_Function_bool Function + %72 = OpAccessChain %_ptr_Input_float %A %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Input_float %B %uint_0 + %75 = OpLoad %float %74 + %76 = OpFUnordLessThan %bool %73 %75 + OpStore %le_0 %76 + %78 = OpAccessChain %_ptr_Input_float %A %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Input_float %B %uint_0 + %81 = OpLoad %float %80 + %82 = OpFUnordLessThanEqual %bool %79 %81 + OpStore %leq_0 %82 + %84 = OpAccessChain %_ptr_Input_float %A %uint_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Input_float %B %uint_0 + %87 = OpLoad %float %86 + %88 = OpFUnordGreaterThan %bool %85 %87 + OpStore %ge_0 %88 + %90 = OpAccessChain %_ptr_Input_float %A %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Input_float %B %uint_0 + %93 = OpLoad %float %92 + %94 = OpFUnordGreaterThanEqual %bool %91 %93 + OpStore %geq_0 %94 + %96 = OpAccessChain %_ptr_Input_float %A %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Input_float %B %uint_0 + %99 = OpLoad %float %98 + %100 = OpFUnordEqual %bool %97 %99 + OpStore %eq_0 %100 + %102 = OpAccessChain %_ptr_Input_float %A %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Input_float %B %uint_0 + %105 = OpLoad %float %104 + %106 = OpFUnordNotEqual %bool %103 %105 + OpStore %neq_0 %106 + %107 = OpLoad %bool %le_0 + %108 = OpSelect %float %107 %float_1 %float_0 + %109 = OpLoad %bool %leq_0 + %110 = OpSelect %float %109 %float_1 %float_0 + %111 = OpFAdd %float %108 %110 + %112 = OpLoad %bool %ge_0 + %113 = OpSelect %float %112 %float_1 %float_0 + %114 = OpFAdd %float %111 %113 + %115 = OpLoad %bool %geq_0 + %116 = OpSelect %float %115 %float_1 %float_0 + %117 = OpFAdd %float %114 %116 + %118 = OpLoad %bool %eq_0 + %119 = OpSelect %float %118 %float_1 %float_0 + %120 = OpFAdd %float %117 %119 + %121 = OpLoad %bool %neq_0 + %122 = OpSelect %float %121 %float_1 %float_0 + %123 = OpFAdd %float %120 %122 + OpReturnValue %123 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag new file mode 100644 index 0000000000..15286e0897 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/unordered-compare.relax-nan.asm.frag @@ -0,0 +1,179 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 132 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %A %B %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %test_vector_ "test_vector(" + OpName %test_scalar_ "test_scalar(" + OpName %le "le" + OpName %A "A" + OpName %B "B" + OpName %leq "leq" + OpName %ge "ge" + OpName %geq "geq" + OpName %eq "eq" + OpName %neq "neq" + OpName %le_0 "le" + OpName %leq_0 "leq" + OpName %ge_0 "ge" + OpName %geq_0 "geq" + OpName %eq_0 "eq" + OpName %neq_0 "neq" + OpName %FragColor "FragColor" + OpDecorate %A Location 0 + OpDecorate %B Location 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %11 = OpTypeFunction %float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool +%_ptr_Input_v4float = OpTypePointer Input %v4float + %A = OpVariable %_ptr_Input_v4float Input + %B = OpVariable %_ptr_Input_v4float Input + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %47 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_bool = OpTypePointer Function %bool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %128 = OpFunctionCall %v4float %test_vector_ + %129 = OpFunctionCall %float %test_scalar_ + %130 = OpCompositeConstruct %v4float %129 %129 %129 %129 + %131 = OpFAdd %v4float %128 %130 + OpStore %FragColor %131 + OpReturn + OpFunctionEnd +%test_vector_ = OpFunction %v4float None %8 + %10 = OpLabel + %le = OpVariable %_ptr_Function_v4bool Function + %leq = OpVariable %_ptr_Function_v4bool Function + %ge = OpVariable %_ptr_Function_v4bool Function + %geq = OpVariable %_ptr_Function_v4bool Function + %eq = OpVariable %_ptr_Function_v4bool Function + %neq = OpVariable %_ptr_Function_v4bool Function + %20 = OpLoad %v4float %A + %22 = OpLoad %v4float %B + %23 = OpFUnordLessThan %v4bool %20 %22 + OpStore %le %23 + %25 = OpLoad %v4float %A + %26 = OpLoad %v4float %B + %27 = OpFUnordLessThanEqual %v4bool %25 %26 + OpStore %leq %27 + %29 = OpLoad %v4float %A + %30 = OpLoad %v4float %B + %31 = OpFUnordGreaterThan %v4bool %29 %30 + OpStore %ge %31 + %33 = OpLoad %v4float %A + %34 = OpLoad %v4float %B + %35 = OpFUnordGreaterThanEqual %v4bool %33 %34 + OpStore %geq %35 + %37 = OpLoad %v4float %A + %38 = OpLoad %v4float %B + %39 = OpFUnordEqual %v4bool %37 %38 + OpStore %eq %39 + %41 = OpLoad %v4float %A + %42 = OpLoad %v4float %B + %43 = OpFUnordNotEqual %v4bool %41 %42 + OpStore %neq %43 + %ordered = OpFOrdNotEqual %v4bool %41 %42 + OpStore %neq %ordered + %44 = OpLoad %v4bool %le + %49 = OpSelect %v4float %44 %48 %47 + %50 = OpLoad %v4bool %leq + %51 = OpSelect %v4float %50 %48 %47 + %52 = OpFAdd %v4float %49 %51 + %53 = OpLoad %v4bool %ge + %54 = OpSelect %v4float %53 %48 %47 + %55 = OpFAdd %v4float %52 %54 + %56 = OpLoad %v4bool %geq + %57 = OpSelect %v4float %56 %48 %47 + %58 = OpFAdd %v4float %55 %57 + %59 = OpLoad %v4bool %eq + %60 = OpSelect %v4float %59 %48 %47 + %61 = OpFAdd %v4float %58 %60 + %62 = OpLoad %v4bool %neq + %63 = OpSelect %v4float %62 %48 %47 + %64 = OpFAdd %v4float %61 %63 + OpReturnValue %64 + OpFunctionEnd +%test_scalar_ = OpFunction %float None %11 + %13 = OpLabel + %le_0 = OpVariable %_ptr_Function_bool Function + %leq_0 = OpVariable %_ptr_Function_bool Function + %ge_0 = OpVariable %_ptr_Function_bool Function + %geq_0 = OpVariable %_ptr_Function_bool Function + %eq_0 = OpVariable %_ptr_Function_bool Function + %neq_0 = OpVariable %_ptr_Function_bool Function + %72 = OpAccessChain %_ptr_Input_float %A %uint_0 + %73 = OpLoad %float %72 + %74 = OpAccessChain %_ptr_Input_float %B %uint_0 + %75 = OpLoad %float %74 + %76 = OpFUnordLessThan %bool %73 %75 + OpStore %le_0 %76 + %78 = OpAccessChain %_ptr_Input_float %A %uint_0 + %79 = OpLoad %float %78 + %80 = OpAccessChain %_ptr_Input_float %B %uint_0 + %81 = OpLoad %float %80 + %82 = OpFUnordLessThanEqual %bool %79 %81 + OpStore %leq_0 %82 + %84 = OpAccessChain %_ptr_Input_float %A %uint_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Input_float %B %uint_0 + %87 = OpLoad %float %86 + %88 = OpFUnordGreaterThan %bool %85 %87 + OpStore %ge_0 %88 + %90 = OpAccessChain %_ptr_Input_float %A %uint_0 + %91 = OpLoad %float %90 + %92 = OpAccessChain %_ptr_Input_float %B %uint_0 + %93 = OpLoad %float %92 + %94 = OpFUnordGreaterThanEqual %bool %91 %93 + OpStore %geq_0 %94 + %96 = OpAccessChain %_ptr_Input_float %A %uint_0 + %97 = OpLoad %float %96 + %98 = OpAccessChain %_ptr_Input_float %B %uint_0 + %99 = OpLoad %float %98 + %100 = OpFUnordEqual %bool %97 %99 + OpStore %eq_0 %100 + %102 = OpAccessChain %_ptr_Input_float %A %uint_0 + %103 = OpLoad %float %102 + %104 = OpAccessChain %_ptr_Input_float %B %uint_0 + %105 = OpLoad %float %104 + %106 = OpFUnordNotEqual %bool %103 %105 + OpStore %neq_0 %106 + %107 = OpLoad %bool %le_0 + %108 = OpSelect %float %107 %float_1 %float_0 + %109 = OpLoad %bool %leq_0 + %110 = OpSelect %float %109 %float_1 %float_0 + %111 = OpFAdd %float %108 %110 + %112 = OpLoad %bool %ge_0 + %113 = OpSelect %float %112 %float_1 %float_0 + %114 = OpFAdd %float %111 %113 + %115 = OpLoad %bool %geq_0 + %116 = OpSelect %float %115 %float_1 %float_0 + %117 = OpFAdd %float %114 %116 + %118 = OpLoad %bool %eq_0 + %119 = OpSelect %float %118 %float_1 %float_0 + %120 = OpFAdd %float %117 %119 + %121 = OpLoad %bool %neq_0 + %122 = OpSelect %float %121 %float_1 %float_0 + %123 = OpFAdd %float %120 %122 + OpReturnValue %123 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag new file mode 100644 index 0000000000..dda5fc4034 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-extract-dynamic-spec-constant.asm.frag @@ -0,0 +1,49 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 27 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vColor "vColor" + OpName %omap_r "omap_r" + OpName %omap_g "omap_g" + OpName %omap_b "omap_b" + OpName %omap_a "omap_a" + OpDecorate %FragColor Location 0 + OpDecorate %vColor Location 0 + OpDecorate %omap_r SpecId 0 + OpDecorate %omap_g SpecId 1 + OpDecorate %omap_b SpecId 2 + OpDecorate %omap_a SpecId 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vColor = OpVariable %_ptr_Input_v4float Input + %int = OpTypeInt 32 1 + %omap_r = OpSpecConstant %int 0 +%_ptr_Input_float = OpTypePointer Input %float + %omap_g = OpSpecConstant %int 1 + %omap_b = OpSpecConstant %int 2 + %omap_a = OpSpecConstant %int 3 + %main = OpFunction %void None %3 + %5 = OpLabel + %loaded = OpLoad %v4float %vColor + %r = OpVectorExtractDynamic %float %loaded %omap_r + %g = OpVectorExtractDynamic %float %loaded %omap_g + %b = OpVectorExtractDynamic %float %loaded %omap_b + %a = OpVectorExtractDynamic %float %loaded %omap_a + %rgba = OpCompositeConstruct %v4float %r %g %b %a + OpStore %FragColor %rgba + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag new file mode 100644 index 0000000000..22c4efca93 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/vector-shuffle-undef-index.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vFloat + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vFloat "vFloat" + OpName %undef "undef" + OpDecorate %FragColor Location 0 + OpDecorate %vFloat Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vFloat = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %undef = OpUndef %v4float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Private_float = OpTypePointer Private %float + %uint_3 = OpConstant %uint 3 +%_ptr_Input_float = OpTypePointer Input %float + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %v4float %vFloat + %26 = OpVectorShuffle %v4float %13 %undef 4 1 0xffffffff 3 + %27 = OpVectorShuffle %v4float %13 %13 2 1 0xffffffff 3 + %28 = OpFAdd %v4float %26 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag new file mode 100644 index 0000000000..d4ae922909 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/frag/while-loop-inverted-test.asm.frag @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 29 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + 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_20 = OpConstant %int 20 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpStore %j %int_0 + OpBranch %11 + %11 = OpLabel + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %16 = OpLoad %int %i + %19 = OpIEqual %bool %16 %int_20 + OpBranchConditional %19 %13 %12 + %12 = OpLabel + %20 = OpLoad %int %j + %21 = OpLoad %int %i + %22 = OpIAdd %int %20 %21 + %24 = OpIAdd %int %22 %int_1 + %25 = OpLoad %int %j + %26 = OpIMul %int %24 %25 + OpStore %j %26 + %27 = OpLoad %int %i + %28 = OpIAdd %int %27 %int_1 + OpStore %i %28 + OpBranch %14 + %14 = OpLabel + OpBranch %11 + %13 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom b/third_party/spirv-cross/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom new file mode 100644 index 0000000000..550fc4e990 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/geom/store-uint-layer.invalid.asm.geom @@ -0,0 +1,130 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 74 +; Schema: 0 + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %stream_pos %stream_layer %input_pos + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource HLSL 500 + OpName %main "main" + OpName %VertexOutput "VertexOutput" + OpMemberName %VertexOutput 0 "pos" + OpName %GeometryOutput "GeometryOutput" + OpMemberName %GeometryOutput 0 "pos" + OpMemberName %GeometryOutput 1 "layer" + OpName %_main_struct_VertexOutput_vf41_3__struct_GeometryOutput_vf4_u11_ "@main(struct-VertexOutput-vf41[3];struct-GeometryOutput-vf4-u11;" + OpName %input "input" + OpName %stream "stream" + OpName %output "output" + OpName %v "v" + OpName %stream_pos "stream.pos" + OpName %stream_layer "stream.layer" + OpName %input_0 "input" + OpName %input_pos "input.pos" + OpName %stream_0 "stream" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %stream_pos BuiltIn Position + OpDecorate %stream_layer BuiltIn Layer + OpDecorate %input_pos BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%VertexOutput = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_VertexOutput_uint_3 = OpTypeArray %VertexOutput %uint_3 +%_ptr_Function__arr_VertexOutput_uint_3 = OpTypePointer Function %_arr_VertexOutput_uint_3 +%GeometryOutput = OpTypeStruct %v4float %uint +%_ptr_Function_GeometryOutput = OpTypePointer Function %GeometryOutput + %15 = OpTypeFunction %void %_ptr_Function__arr_VertexOutput_uint_3 %_ptr_Function_GeometryOutput + %int = OpTypeInt 32 1 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_ptr_Function_uint = OpTypePointer Function %uint +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %stream_pos = OpVariable %_ptr_Output_v4float Output +%_ptr_Output_uint = OpTypePointer Output %uint +%stream_layer = OpVariable %_ptr_Output_uint Output +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 + %input_pos = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %input_0 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %stream_0 = OpVariable %_ptr_Function_GeometryOutput Function + %param = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %param_0 = OpVariable %_ptr_Function_GeometryOutput Function + %58 = OpAccessChain %_ptr_Input_v4float %input_pos %int_0 + %59 = OpLoad %v4float %58 + %60 = OpAccessChain %_ptr_Function_v4float %input_0 %int_0 %int_0 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Input_v4float %input_pos %int_1 + %62 = OpLoad %v4float %61 + %63 = OpAccessChain %_ptr_Function_v4float %input_0 %int_1 %int_0 + OpStore %63 %62 + %65 = OpAccessChain %_ptr_Input_v4float %input_pos %int_2 + %66 = OpLoad %v4float %65 + %67 = OpAccessChain %_ptr_Function_v4float %input_0 %int_2 %int_0 + OpStore %67 %66 + %70 = OpLoad %_arr_VertexOutput_uint_3 %input_0 + OpStore %param %70 + %72 = OpFunctionCall %void %_main_struct_VertexOutput_vf41_3__struct_GeometryOutput_vf4_u11_ %param %param_0 + %73 = OpLoad %GeometryOutput %param_0 + OpStore %stream_0 %73 + OpReturn + OpFunctionEnd +%_main_struct_VertexOutput_vf41_3__struct_GeometryOutput_vf4_u11_ = OpFunction %void None %15 + %input = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %stream = OpFunctionParameter %_ptr_Function_GeometryOutput + %19 = OpLabel + %output = OpVariable %_ptr_Function_GeometryOutput Function + %v = OpVariable %_ptr_Function_int Function + %25 = OpAccessChain %_ptr_Function_uint %output %int_1 + OpStore %25 %uint_1 + OpStore %v %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %v + %37 = OpSLessThan %bool %34 %int_3 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %38 = OpLoad %int %v + %40 = OpAccessChain %_ptr_Function_v4float %input %38 %int_0 + %41 = OpLoad %v4float %40 + %42 = OpAccessChain %_ptr_Function_v4float %output %int_0 + OpStore %42 %41 + %45 = OpAccessChain %_ptr_Function_v4float %output %int_0 + %46 = OpLoad %v4float %45 + OpStore %stream_pos %46 + %49 = OpAccessChain %_ptr_Function_uint %output %int_1 + %50 = OpLoad %uint %49 + OpStore %stream_layer %50 + OpEmitVertex + OpBranch %32 + %32 = OpLabel + %51 = OpLoad %int %v + %52 = OpIAdd %int %51 %int_1 + OpStore %v %52 + OpBranch %29 + %31 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp b/third_party/spirv-cross/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp new file mode 100644 index 0000000000..a38b111235 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/loop-header-self-continue-break.asm.comp @@ -0,0 +1,109 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Clspv; 0 +; Bound: 83 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %19 "main" %gl_GlobalInvocationID + OpSource OpenCL_C 120 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + OpDecorate %_struct_3 Block + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 1 + OpDecorate %10 SpecId 0 + OpDecorate %11 SpecId 1 + OpDecorate %12 SpecId 2 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_3 = OpTypeStruct %_runtimearr_float +%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Private_v3uint = OpTypePointer Private %v3uint + %10 = OpSpecConstant %uint 1 + %11 = OpSpecConstant %uint 1 + %12 = OpSpecConstant %uint 1 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %10 %11 %12 + %void = OpTypeVoid + %18 = OpTypeFunction %void +%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_35 = OpConstant %uint 35 + %uint_1 = OpConstant %uint 1 + %float_3 = OpConstant %float 3 + %bool = OpTypeBool + %uint_34 = OpConstant %uint 34 + %uint_5 = OpConstant %uint 5 +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %14 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize + %15 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %16 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer + %19 = OpFunction %void None %18 + %20 = OpLabel + %23 = OpAccessChain %_ptr_StorageBuffer_float %15 %uint_0 %uint_0 + %25 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %26 = OpLoad %uint %25 + %27 = OpLoad %float %23 + %29 = OpAccessChain %_ptr_StorageBuffer_float %15 %uint_0 %uint_35 + OpBranch %31 + %31 = OpLabel + %32 = OpPhi %float %27 %20 %67 %58 + %33 = OpPhi %uint %uint_0 %20 %63 %58 + %34 = OpLoad %float %29 + OpLoopMerge %69 %58 None + OpBranch %37 + %37 = OpLabel + %38 = OpPhi %float %46 %37 %32 %31 + %39 = OpPhi %float %38 %37 %34 %31 + %40 = OpPhi %uint %44 %37 %uint_0 %31 + %41 = OpAccessChain %_ptr_StorageBuffer_float %15 %uint_0 %40 + %42 = OpFAdd %float %39 %38 + %44 = OpIAdd %uint %40 %uint_1 + %45 = OpAccessChain %_ptr_StorageBuffer_float %15 %uint_0 %44 + %46 = OpLoad %float %45 + %47 = OpFAdd %float %42 %46 + %49 = OpFDiv %float %47 %float_3 + OpStore %41 %49 + %52 = OpULessThan %bool %40 %uint_34 + %53 = OpLogicalNot %bool %52 + OpLoopMerge %56 %37 None + OpBranchConditional %53 %56 %37 + %56 = OpLabel + OpBranch %58 + %58 = OpLabel + %59 = OpLoad %float %29 + %60 = OpFAdd %float %38 %59 + %61 = OpFAdd %float %32 %60 + %62 = OpFDiv %float %61 %float_3 + OpStore %29 %62 + %63 = OpIAdd %uint %33 %uint_1 + %65 = OpULessThan %bool %33 %uint_5 + %66 = OpLogicalNot %bool %65 + %67 = OpLoad %float %23 + OpBranchConditional %66 %69 %31 + %69 = OpLabel + %70 = OpPhi %float %75 %69 %67 %58 + %71 = OpPhi %uint %76 %69 %uint_1 %58 + %72 = OpAccessChain %_ptr_StorageBuffer_float %15 %uint_0 %71 + %73 = OpLoad %float %72 + %74 = OpFOrdLessThan %bool %70 %73 + %75 = OpSelect %float %74 %73 %70 + %76 = OpIAdd %uint %71 %uint_1 + %77 = OpULessThan %bool %71 %uint_35 + %78 = OpLogicalNot %bool %77 + OpLoopMerge %81 %69 None + OpBranchConditional %78 %81 %69 + %81 = OpLabel + %82 = OpAccessChain %_ptr_StorageBuffer_float %16 %uint_0 %26 + OpStore %82 %75 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh b/third_party/spirv-cross/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh new file mode 100644 index 0000000000..7b38001d8d --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/mesh/mesh-shader-plain-builtin-outputs.spv14.asm.vk.nocompat.mesh @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.4 +; Generator: Unknown(30017); 21022 +; Bound: 89 +; Schema: 0 + OpCapability Shader + OpCapability Geometry + OpCapability ShaderViewportIndexLayerEXT + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + OpExtension "SPV_EXT_shader_viewport_index_layer" + OpMemoryModel Logical GLSL450 + OpEntryPoint MeshEXT %main "main" %SV_Position %B %SV_CullPrimitive %SV_RenderTargetArrayIndex %SV_PrimitiveID %C %indices %32 %gl_LocalInvocationIndex %38 + OpExecutionMode %main OutputVertices 24 + OpExecutionMode %main OutputPrimitivesNV 8 + OpExecutionMode %main OutputTrianglesNV + OpExecutionMode %main LocalSize 2 3 4 + OpName %main "main" + OpName %SV_Position "SV_Position" + OpName %B "B" + OpName %SV_CullPrimitive "SV_CullPrimitive" + OpName %SV_RenderTargetArrayIndex "SV_RenderTargetArrayIndex" + OpName %SV_PrimitiveID "SV_PrimitiveID" + OpName %C "C" + OpName %indices "indices" + OpName %_ "" + OpDecorate %SV_Position BuiltIn Position + OpDecorate %B Location 1 + OpDecorate %SV_CullPrimitive BuiltIn CullPrimitiveEXT + OpDecorate %SV_CullPrimitive PerPrimitiveNV + OpDecorate %SV_RenderTargetArrayIndex BuiltIn Layer + OpDecorate %SV_RenderTargetArrayIndex PerPrimitiveNV + OpDecorate %SV_PrimitiveID BuiltIn PrimitiveId + OpDecorate %SV_PrimitiveID PerPrimitiveNV + OpDecorate %C Location 3 + OpDecorate %C PerPrimitiveNV + OpDecorate %indices BuiltIn PrimitiveTriangleIndicesEXT + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_24 = OpConstant %uint 24 +%_arr_v4float_uint_24 = OpTypeArray %v4float %uint_24 +%_ptr_Output__arr_v4float_uint_24 = OpTypePointer Output %_arr_v4float_uint_24 +%SV_Position = OpVariable %_ptr_Output__arr_v4float_uint_24 Output + %B = OpVariable %_ptr_Output__arr_v4float_uint_24 Output + %bool = OpTypeBool + %uint_8 = OpConstant %uint 8 +%_arr_bool_uint_8 = OpTypeArray %bool %uint_8 +%_ptr_Output__arr_bool_uint_8 = OpTypePointer Output %_arr_bool_uint_8 +%SV_CullPrimitive = OpVariable %_ptr_Output__arr_bool_uint_8 Output +%_arr_uint_uint_8 = OpTypeArray %uint %uint_8 +%_ptr_Output__arr_uint_uint_8 = OpTypePointer Output %_arr_uint_uint_8 +%SV_RenderTargetArrayIndex = OpVariable %_ptr_Output__arr_uint_uint_8 Output +%SV_PrimitiveID = OpVariable %_ptr_Output__arr_uint_uint_8 Output +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%_ptr_Output__arr_v4float_uint_8 = OpTypePointer Output %_arr_v4float_uint_8 + %C = OpVariable %_ptr_Output__arr_v4float_uint_8 Output + %v3uint = OpTypeVector %uint 3 +%_arr_v3uint_uint_8 = OpTypeArray %v3uint %uint_8 +%_ptr_Output__arr_v3uint_uint_8 = OpTypePointer Output %_arr_v3uint_uint_8 + %indices = OpVariable %_ptr_Output__arr_v3uint_uint_8 Output + %uint_64 = OpConstant %uint 64 +%_arr_float_uint_64 = OpTypeArray %float %uint_64 +%_ptr_Workgroup__arr_float_uint_64 = OpTypePointer Workgroup %_arr_float_uint_64 + %32 = OpVariable %_ptr_Workgroup__arr_float_uint_64 Workgroup +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %_ = OpTypeStruct %float +%_ptr_TaskPayloadWorkgroupEXT__ = OpTypePointer TaskPayloadWorkgroupEXT %_ + %38 = OpVariable %_ptr_TaskPayloadWorkgroupEXT__ TaskPayloadWorkgroupEXT +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 +%_ptr_Output_float = OpTypePointer Output %float + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_ptr_TaskPayloadWorkgroupEXT_float = OpTypePointer TaskPayloadWorkgroupEXT %float +%_ptr_Output_v3uint = OpTypePointer Output %v3uint +%_ptr_Output_bool = OpTypePointer Output %bool +%_ptr_Output_uint = OpTypePointer Output %uint + %main = OpFunction %void None %2 + %4 = OpLabel + OpBranch %85 + %85 = OpLabel + %35 = OpLoad %uint %gl_LocalInvocationIndex + %39 = OpConvertUToF %float %35 + %41 = OpAccessChain %_ptr_Workgroup_float %32 %35 + OpStore %41 %39 + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpSetMeshOutputsEXT %uint_24 %uint_8 + %44 = OpLoad %float %41 + %46 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_0 + OpStore %46 %44 + %48 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_1 + OpStore %48 %44 + %50 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_2 + OpStore %50 %44 + %51 = OpAccessChain %_ptr_Output_float %SV_Position %35 %uint_3 + OpStore %51 %44 + %53 = OpBitwiseXor %uint %35 %uint_1 + %54 = OpAccessChain %_ptr_Workgroup_float %32 %53 + %55 = OpLoad %float %54 + %57 = OpInBoundsAccessChain %_ptr_TaskPayloadWorkgroupEXT_float %38 %uint_0 + %58 = OpLoad %float %57 + %59 = OpFAdd %float %58 %55 + %60 = OpAccessChain %_ptr_Output_float %B %35 %uint_0 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Output_float %B %35 %uint_1 + OpStore %61 %59 + %62 = OpAccessChain %_ptr_Output_float %B %35 %uint_2 + OpStore %62 %59 + %63 = OpAccessChain %_ptr_Output_float %B %35 %uint_3 + OpStore %63 %59 + %64 = OpULessThan %bool %35 %uint_8 + OpSelectionMerge %87 None + OpBranchConditional %64 %86 %87 + %86 = OpLabel + %65 = OpIMul %uint %35 %uint_3 + %66 = OpIAdd %uint %65 %uint_1 + %67 = OpIAdd %uint %65 %uint_2 + %68 = OpCompositeConstruct %v3uint %65 %66 %67 + %70 = OpAccessChain %_ptr_Output_v3uint %indices %35 + OpStore %70 %68 + %71 = OpBitwiseAnd %uint %35 %uint_1 + %72 = OpINotEqual %bool %71 %uint_0 + %74 = OpAccessChain %_ptr_Output_bool %SV_CullPrimitive %35 + OpStore %74 %72 + %76 = OpAccessChain %_ptr_Output_uint %SV_PrimitiveID %35 + OpStore %76 %35 + %77 = OpAccessChain %_ptr_Output_uint %SV_RenderTargetArrayIndex %35 + OpStore %77 %35 + %78 = OpBitwiseXor %uint %35 %uint_2 + %79 = OpAccessChain %_ptr_Workgroup_float %32 %78 + %80 = OpLoad %float %79 + %81 = OpAccessChain %_ptr_Output_float %C %35 %uint_0 + OpStore %81 %80 + %82 = OpAccessChain %_ptr_Output_float %C %35 %uint_1 + OpStore %82 %80 + %83 = OpAccessChain %_ptr_Output_float %C %35 %uint_2 + OpStore %83 %80 + %84 = OpAccessChain %_ptr_Output_float %C %35 %uint_3 + OpStore %84 %80 + OpBranch %87 + %87 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen b/third_party/spirv-cross/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen new file mode 100644 index 0000000000..2178c8af7a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/rgen/acceleration-nonuniform.spv14.vk.nocompat.asm.rgen @@ -0,0 +1,112 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 73 +; Schema: 0 + OpCapability RayTracingKHR + OpCapability ShaderNonUniform + OpCapability RuntimeDescriptorArray + OpExtension "SPV_EXT_descriptor_indexing" + OpExtension "SPV_KHR_ray_tracing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint RayGenerationNV %main "main" %gl_LaunchIDEXT %gl_LaunchSizeEXT %as %payload %image + OpSource GLSL 460 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpSourceExtension "GL_EXT_ray_tracing" + OpName %main "main" + OpName %col "col" + OpName %origin "origin" + OpName %gl_LaunchIDEXT "gl_LaunchIDEXT" + OpName %gl_LaunchSizeEXT "gl_LaunchSizeEXT" + OpName %direction "direction" + OpName %as "as" + OpName %payload "payload" + OpName %image "image" + OpDecorate %gl_LaunchIDEXT BuiltIn LaunchIdNV + OpDecorate %gl_LaunchSizeEXT BuiltIn LaunchSizeNV + OpDecorate %as DescriptorSet 0 + OpDecorate %as Binding 1 + OpDecorate %51 NonUniform + OpDecorate %payload Location 0 + OpDecorate %image DescriptorSet 0 + OpDecorate %image Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_LaunchIDEXT = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LaunchSizeEXT = OpVariable %_ptr_Input_v3uint Input + %uint_1 = OpConstant %uint 1 + %float_n1 = OpConstant %float -1 + %41 = OpConstantComposite %v3float %float_0 %float_0 %float_n1 + %42 = OpTypeAccelerationStructureKHR +%_runtimearr_42 = OpTypeRuntimeArray %42 +%_ptr_UniformConstant__runtimearr_42 = OpTypePointer UniformConstant %_runtimearr_42 + %as = OpVariable %_ptr_UniformConstant__runtimearr_42 UniformConstant +%_ptr_UniformConstant_42 = OpTypePointer UniformConstant %42 + %uint_255 = OpConstant %uint 255 + %float_1000 = OpConstant %float 1000 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_RayPayloadNV_float = OpTypePointer RayPayloadNV %float + %payload = OpVariable %_ptr_RayPayloadNV_float RayPayloadNV +%_ptr_Function_float = OpTypePointer Function %float + %63 = OpTypeImage %float 2D 0 0 0 2 Rgba8 +%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63 + %image = OpVariable %_ptr_UniformConstant_63 UniformConstant + %v2uint = OpTypeVector %uint 2 + %v2int = OpTypeVector %int 2 + %main = OpFunction %void None %3 + %5 = OpLabel + %col = OpVariable %_ptr_Function_v4float Function + %origin = OpVariable %_ptr_Function_v3float Function + %direction = OpVariable %_ptr_Function_v3float Function + OpStore %col %12 + %22 = OpAccessChain %_ptr_Input_uint %gl_LaunchIDEXT %uint_0 + %23 = OpLoad %uint %22 + %24 = OpConvertUToF %float %23 + %26 = OpAccessChain %_ptr_Input_uint %gl_LaunchSizeEXT %uint_0 + %27 = OpLoad %uint %26 + %28 = OpConvertUToF %float %27 + %29 = OpFDiv %float %24 %28 + %31 = OpAccessChain %_ptr_Input_uint %gl_LaunchIDEXT %uint_1 + %32 = OpLoad %uint %31 + %33 = OpConvertUToF %float %32 + %34 = OpAccessChain %_ptr_Input_uint %gl_LaunchSizeEXT %uint_1 + %35 = OpLoad %uint %34 + %36 = OpConvertUToF %float %35 + %37 = OpFDiv %float %33 %36 + %38 = OpCompositeConstruct %v3float %29 %37 %float_1 + OpStore %origin %38 + OpStore %direction %41 + %46 = OpAccessChain %_ptr_Input_uint %gl_LaunchIDEXT %uint_0 + %47 = OpLoad %uint %46 + %48 = OpCopyObject %uint %47 + %50 = OpAccessChain %_ptr_UniformConstant_42 %as %48 + %51 = OpLoad %42 %50 + %53 = OpLoad %v3float %origin + %54 = OpLoad %v3float %direction + OpTraceRayKHR %51 %uint_0 %uint_255 %uint_0 %uint_1 %uint_0 %53 %float_0 %54 %float_1000 %payload + %60 = OpLoad %float %payload + %62 = OpAccessChain %_ptr_Function_float %col %uint_1 + OpStore %62 %60 + %66 = OpLoad %63 %image + %68 = OpLoad %v3uint %gl_LaunchIDEXT + %69 = OpVectorShuffle %v2uint %68 %68 0 1 + %71 = OpBitcast %v2int %69 + %72 = OpLoad %v4float %col + OpImageWrite %66 %71 %72 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task b/third_party/spirv-cross/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task new file mode 100644 index 0000000000..cbef97ed1f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/task/task-shader.vk.nocompat.spv14.asm.task @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.4 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 93 +; Schema: 0 + OpCapability MeshShadingEXT + OpExtension "SPV_EXT_mesh_shader" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TaskEXT %main "main" %vs %gl_LocalInvocationIndex %p + OpExecutionMode %main LocalSize 4 3 2 + OpSource GLSL 450 + OpSourceExtension "GL_EXT_mesh_shader" + OpName %main "main" + OpName %vs "vs" + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" + OpName %Payload "Payload" + OpMemberName %Payload 0 "v" + OpName %p "p" + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_24 = OpConstant %uint 24 +%_arr_float_uint_24 = OpTypeArray %float %uint_24 +%_ptr_Workgroup__arr_float_uint_24 = OpTypePointer Workgroup %_arr_float_uint_24 + %vs = OpVariable %_ptr_Workgroup__arr_float_uint_24 Workgroup +%_ptr_Input_uint = OpTypePointer Input %uint +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input + %float_10 = OpConstant %float 10 +%_ptr_Workgroup_float = OpTypePointer Workgroup %float + %uint_2 = OpConstant %uint 2 + %uint_264 = OpConstant %uint 264 + %uint_12 = OpConstant %uint 12 + %bool = OpTypeBool + %uint_6 = OpConstant %uint 6 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %Payload = OpTypeStruct %_arr_float_uint_3 +%_ptr_TaskPayloadWorkgroupEXT_Payload = OpTypePointer TaskPayloadWorkgroupEXT %Payload + %p = OpVariable %_ptr_TaskPayloadWorkgroupEXT_Payload TaskPayloadWorkgroupEXT + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_TaskPayloadWorkgroupEXT_float = OpTypePointer TaskPayloadWorkgroupEXT %float + %int_4 = OpConstant %int 4 + %int_6 = OpConstant %int 6 + %int_8 = OpConstant %int 8 + %v3uint = OpTypeVector %uint 3 + %uint_4 = OpConstant %uint 4 +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_4 %uint_3 %uint_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %uint %gl_LocalInvocationIndex + %17 = OpAccessChain %_ptr_Workgroup_float %vs %14 + OpStore %17 %float_10 + OpControlBarrier %uint_2 %uint_2 %uint_264 + %20 = OpLoad %uint %gl_LocalInvocationIndex + %23 = OpULessThan %bool %20 %uint_12 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %26 = OpLoad %uint %gl_LocalInvocationIndex + %27 = OpLoad %uint %gl_LocalInvocationIndex + %28 = OpIAdd %uint %27 %uint_12 + %29 = OpAccessChain %_ptr_Workgroup_float %vs %28 + %30 = OpLoad %float %29 + %31 = OpAccessChain %_ptr_Workgroup_float %vs %26 + %32 = OpLoad %float %31 + %33 = OpFAdd %float %32 %30 + %34 = OpAccessChain %_ptr_Workgroup_float %vs %26 + OpStore %34 %33 + OpBranch %25 + %25 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %35 = OpLoad %uint %gl_LocalInvocationIndex + %37 = OpULessThan %bool %35 %uint_6 + OpSelectionMerge %39 None + OpBranchConditional %37 %38 %39 + %38 = OpLabel + %40 = OpLoad %uint %gl_LocalInvocationIndex + %41 = OpLoad %uint %gl_LocalInvocationIndex + %42 = OpIAdd %uint %41 %uint_6 + %43 = OpAccessChain %_ptr_Workgroup_float %vs %42 + %44 = OpLoad %float %43 + %45 = OpAccessChain %_ptr_Workgroup_float %vs %40 + %46 = OpLoad %float %45 + %47 = OpFAdd %float %46 %44 + %48 = OpAccessChain %_ptr_Workgroup_float %vs %40 + OpStore %48 %47 + OpBranch %39 + %39 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %49 = OpLoad %uint %gl_LocalInvocationIndex + %51 = OpULessThan %bool %49 %uint_3 + OpSelectionMerge %53 None + OpBranchConditional %51 %52 %53 + %52 = OpLabel + %54 = OpLoad %uint %gl_LocalInvocationIndex + %55 = OpLoad %uint %gl_LocalInvocationIndex + %56 = OpIAdd %uint %55 %uint_3 + %57 = OpAccessChain %_ptr_Workgroup_float %vs %56 + %58 = OpLoad %float %57 + %59 = OpAccessChain %_ptr_Workgroup_float %vs %54 + %60 = OpLoad %float %59 + %61 = OpFAdd %float %60 %58 + %62 = OpAccessChain %_ptr_Workgroup_float %vs %54 + OpStore %62 %61 + OpBranch %53 + %53 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + %69 = OpLoad %uint %gl_LocalInvocationIndex + %70 = OpLoad %uint %gl_LocalInvocationIndex + %71 = OpAccessChain %_ptr_Workgroup_float %vs %70 + %72 = OpLoad %float %71 + %74 = OpAccessChain %_ptr_TaskPayloadWorkgroupEXT_float %p %int_0 %69 + OpStore %74 %72 + %76 = OpAccessChain %_ptr_Workgroup_float %vs %int_4 + %77 = OpLoad %float %76 + %78 = OpConvertFToS %int %77 + %79 = OpBitcast %uint %78 + %81 = OpAccessChain %_ptr_Workgroup_float %vs %int_6 + %82 = OpLoad %float %81 + %83 = OpConvertFToS %int %82 + %84 = OpBitcast %uint %83 + %86 = OpAccessChain %_ptr_Workgroup_float %vs %int_8 + %87 = OpLoad %float %86 + %88 = OpConvertFToS %int %87 + %89 = OpBitcast %uint %88 + OpEmitMeshTasksEXT %79 %84 %89 %p + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/temporary.zero-initialize.asm.frag b/third_party/spirv-cross/shaders-no-opt/asm/temporary.zero-initialize.asm.frag new file mode 100644 index 0000000000..eccff08b33 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/temporary.zero-initialize.asm.frag @@ -0,0 +1,93 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 65 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %25 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Flat + OpDecorate %vB Location 1 + OpDecorate %38 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %57 RelaxedPrecision + OpDecorate %60 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int + %vA = OpVariable %_ptr_Input_int Input + %bool = OpTypeBool + %int_20 = OpConstant %int 20 + %int_50 = OpConstant %int 50 + %vB = OpVariable %_ptr_Input_int Input + %int_40 = OpConstant %int 40 + %int_60 = OpConstant %int 60 + %int_10 = OpConstant %int 10 + %float_1 = OpConstant %float 1 + %63 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %11 + OpBranch %17 + %17 = OpLabel + %60 = OpPhi %int %int_0 %5 %58 %20 + %57 = OpPhi %int %int_0 %5 %56 %20 + %25 = OpLoad %int %vA + %27 = OpSLessThan %bool %57 %25 + OpLoopMerge %19 %20 None + OpBranchConditional %27 %18 %19 + %18 = OpLabel + %30 = OpIAdd %int %25 %57 + %32 = OpIEqual %bool %30 %int_20 + OpSelectionMerge %34 None + OpBranchConditional %32 %33 %36 + %33 = OpLabel + OpBranch %34 + %36 = OpLabel + %38 = OpLoad %int %vB + %40 = OpIAdd %int %38 %57 + %42 = OpIEqual %bool %40 %int_40 + %64 = OpSelect %int %42 %int_60 %60 + OpBranch %34 + %34 = OpLabel + %58 = OpPhi %int %int_50 %33 %64 %36 + %49 = OpIAdd %int %58 %int_10 + %51 = OpLoad %v4float %FragColor + %53 = OpFAdd %v4float %51 %63 + OpStore %FragColor %53 + OpBranch %20 + %20 = OpLabel + %56 = OpIAdd %int %57 %49 + OpBranch %17 + %19 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc b/third_party/spirv-cross/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc new file mode 100644 index 0000000000..0ec5fa90a9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/tesc/array-of-block-output-initializer.asm.tesc @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 42 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %_ %patches %v2 %v3 %verts + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %vert "vert" + OpMemberName %vert 0 "v0" + OpMemberName %vert 1 "v1" + OpName %_ "" + OpName %vert_patch "vert_patch" + OpMemberName %vert_patch 0 "v2" + OpMemberName %vert_patch 1 "v3" + OpName %patches "patches" + OpName %v2 "v2" + OpName %v3 "v3" + OpName %vert2 "vert2" + OpMemberName %vert2 0 "v4" + OpMemberName %vert2 1 "v5" + OpName %verts "verts" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpMemberDecorate %vert 0 Patch + OpMemberDecorate %vert 1 Patch + OpDecorate %vert Block + OpDecorate %_ Location 0 + OpMemberDecorate %vert_patch 0 Patch + OpMemberDecorate %vert_patch 1 Patch + OpDecorate %vert_patch Block + OpDecorate %patches Location 2 + OpDecorate %v2 Patch + OpDecorate %v2 Location 6 + OpDecorate %v3 Location 7 + OpDecorate %vert2 Block + OpDecorate %verts Location 8 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out_zero = OpConstantNull %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output %gl_out_zero + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %vert = OpTypeStruct %float %float +%_ptr_Output_vert = OpTypePointer Output %vert + %__zero = OpConstantNull %vert + %_ = OpVariable %_ptr_Output_vert Output %__zero + %vert_patch = OpTypeStruct %float %float + %uint_2 = OpConstant %uint 2 +%_arr_vert_patch_uint_2 = OpTypeArray %vert_patch %uint_2 +%_ptr_Output__arr_vert_patch_uint_2 = OpTypePointer Output %_arr_vert_patch_uint_2 + %patches_zero = OpConstantNull %_arr_vert_patch_uint_2 + %patches = OpVariable %_ptr_Output__arr_vert_patch_uint_2 Output %patches_zero +%_ptr_Output_float = OpTypePointer Output %float + %v2_zero = OpConstantNull %float + %v2 = OpVariable %_ptr_Output_float Output %v2_zero +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %v3_zero = OpConstantNull %_arr_float_uint_4 + %v3 = OpVariable %_ptr_Output__arr_float_uint_4 Output %v3_zero + %vert2 = OpTypeStruct %float %float +%_arr_vert2_uint_4 = OpTypeArray %vert2 %uint_4 +%_ptr_Output__arr_vert2_uint_4 = OpTypePointer Output %_arr_vert2_uint_4 + %verts_zero = OpConstantNull %_arr_vert2_uint_4 + %verts = OpVariable %_ptr_Output__arr_vert2_uint_4 Output %verts_zero + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc b/third_party/spirv-cross/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc new file mode 100644 index 0000000000..7c0a638f98 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/tesc/copy-memory-control-point.asm.tesc @@ -0,0 +1,199 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 2 +; Bound: 126 +; Schema: 0 + OpCapability Tessellation + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %1 "main" %4 %30 %80 %101 %103 %108 %110 %115 %117 + OpExecutionMode %1 OutputVertices 3 + OpExecutionMode %1 Triangles + OpExecutionMode %1 SpacingEqual + OpExecutionMode %1 VertexOrderCw + OpName %1 "main" + OpName %11 "opc" + OpName %14 "cb1_struct" + OpName %16 "cb0_0" + OpName %22 "vicp" + OpName %23 "fork0" + OpName %26 "vForkInstanceId" + OpName %34 "r0" + OpName %32 "fork0_epilogue" + OpName %75 "fork1" + OpName %81 "fork1_epilogue" + OpName %101 "v0" + OpName %103 "v1" + OpName %108 "vicp0" + OpName %110 "vocp0" + OpName %115 "vicp1" + OpName %117 "vocp1" + OpDecorate %4 BuiltIn InvocationId + OpDecorate %13 ArrayStride 16 + OpDecorate %14 Block + OpMemberDecorate %14 0 Offset 0 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpDecorate %30 BuiltIn TessLevelOuter + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %30 Patch + OpDecorate %80 BuiltIn TessLevelInner + OpDecorate %80 Patch + OpDecorate %80 Patch + OpDecorate %101 Location 0 + OpDecorate %103 Location 1 + OpDecorate %108 Location 2 + OpDecorate %110 Location 3 + OpDecorate %115 Location 4 + OpDecorate %117 Location 5 + %2 = OpTypeInt 32 1 + %3 = OpTypePointer Input %2 + %4 = OpVariable %3 Input + %5 = OpTypeFloat 32 + %6 = OpTypeVector %5 4 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 4 + %9 = OpTypeArray %6 %8 + %10 = OpTypePointer Private %9 + %11 = OpVariable %10 Private + %12 = OpConstant %7 1 + %13 = OpTypeArray %6 %12 + %14 = OpTypeStruct %13 + %15 = OpTypePointer Uniform %14 + %16 = OpVariable %15 Uniform + %17 = OpConstant %7 3 + %18 = OpTypeArray %6 %17 + %19 = OpConstant %7 2 + %20 = OpTypeArray %18 %19 + %21 = OpTypePointer Private %20 + %22 = OpVariable %21 Private + %24 = OpTypeVoid + %25 = OpTypeFunction %24 %7 + %28 = OpTypeArray %5 %8 + %29 = OpTypePointer Output %28 + %30 = OpVariable %29 Output + %31 = OpConstant %7 0 + %33 = OpTypePointer Function %6 + %36 = OpTypePointer Function %5 + %38 = OpTypePointer Uniform %6 + %40 = OpTypePointer Uniform %5 + %46 = OpTypePointer Private %6 + %48 = OpTypePointer Private %5 + %52 = OpVariable %46 Private + %55 = OpVariable %46 Private + %58 = OpVariable %46 Private + %60 = OpTypeFunction %24 %46 %46 %46 + %69 = OpTypePointer Output %5 + %76 = OpTypeFunction %24 + %78 = OpTypeArray %5 %19 + %79 = OpTypePointer Output %78 + %80 = OpVariable %79 Output + %89 = OpVariable %46 Private + %91 = OpTypeFunction %24 %46 + %98 = OpTypePointer Private %18 + %100 = OpTypePointer Input %18 + %101 = OpVariable %100 Input + %103 = OpVariable %100 Input + %105 = OpTypeVector %5 3 + %106 = OpTypeArray %105 %17 + %107 = OpTypePointer Input %106 + %108 = OpVariable %107 Input + %109 = OpTypePointer Output %106 + %110 = OpVariable %109 Output + %111 = OpTypePointer Output %105 + %112 = OpTypePointer Input %105 + %115 = OpVariable %100 Input + %116 = OpTypePointer Output %18 + %117 = OpVariable %116 Output + %118 = OpTypePointer Output %6 + %119 = OpTypePointer Input %6 + %23 = OpFunction %24 None %25 + %26 = OpFunctionParameter %7 + %27 = OpLabel + %34 = OpVariable %33 Function + %35 = OpBitcast %5 %26 + %37 = OpInBoundsAccessChain %36 %34 %31 + OpStore %37 %35 + %39 = OpAccessChain %38 %16 %31 %31 + %41 = OpInBoundsAccessChain %40 %39 %31 + %42 = OpLoad %5 %41 + %43 = OpInBoundsAccessChain %36 %34 %31 + %44 = OpLoad %5 %43 + %45 = OpBitcast %2 %44 + %47 = OpAccessChain %46 %11 %45 + %49 = OpInBoundsAccessChain %48 %47 %31 + OpStore %49 %42 + %50 = OpAccessChain %46 %11 %31 + %51 = OpLoad %6 %50 + OpStore %52 %51 + %53 = OpAccessChain %46 %11 %12 + %54 = OpLoad %6 %53 + OpStore %55 %54 + %56 = OpAccessChain %46 %11 %19 + %57 = OpLoad %6 %56 + OpStore %58 %57 + %59 = OpFunctionCall %24 %32 %52 %55 %58 + OpReturn + OpFunctionEnd + %32 = OpFunction %24 None %60 + %61 = OpFunctionParameter %46 + %62 = OpFunctionParameter %46 + %63 = OpFunctionParameter %46 + %64 = OpLabel + %65 = OpLoad %6 %61 + %66 = OpLoad %6 %62 + %67 = OpLoad %6 %63 + %68 = OpCompositeExtract %5 %65 0 + %70 = OpAccessChain %69 %30 %31 + OpStore %70 %68 + %71 = OpCompositeExtract %5 %66 0 + %72 = OpAccessChain %69 %30 %12 + OpStore %72 %71 + %73 = OpCompositeExtract %5 %67 0 + %74 = OpAccessChain %69 %30 %19 + OpStore %74 %73 + OpReturn + OpFunctionEnd + %75 = OpFunction %24 None %76 + %77 = OpLabel + %82 = OpAccessChain %38 %16 %31 %31 + %83 = OpInBoundsAccessChain %40 %82 %31 + %84 = OpLoad %5 %83 + %85 = OpAccessChain %46 %11 %17 + %86 = OpInBoundsAccessChain %48 %85 %31 + OpStore %86 %84 + %87 = OpAccessChain %46 %11 %17 + %88 = OpLoad %6 %87 + OpStore %89 %88 + %90 = OpFunctionCall %24 %81 %89 + OpReturn + OpFunctionEnd + %81 = OpFunction %24 None %91 + %92 = OpFunctionParameter %46 + %93 = OpLabel + %94 = OpLoad %6 %92 + %95 = OpCompositeExtract %5 %94 0 + %96 = OpAccessChain %69 %80 %31 + OpStore %96 %95 + OpReturn + OpFunctionEnd + %1 = OpFunction %24 None %76 + %97 = OpLabel + %99 = OpInBoundsAccessChain %98 %22 %31 + OpCopyMemory %99 %101 + %102 = OpInBoundsAccessChain %98 %22 %12 + OpCopyMemory %102 %103 + %104 = OpLoad %2 %4 + %113 = OpAccessChain %111 %110 %104 + %114 = OpAccessChain %112 %108 %104 + OpCopyMemory %113 %114 + %120 = OpAccessChain %118 %117 %104 + %121 = OpAccessChain %119 %115 %104 + OpCopyMemory %120 %121 + %122 = OpFunctionCall %24 %23 %31 + %123 = OpFunctionCall %24 %23 %12 + %124 = OpFunctionCall %24 %23 %19 + %125 = OpFunctionCall %24 %75 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc new file mode 100644 index 0000000000..0fd4dce256 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -0,0 +1,248 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 162 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %hs_main "main" %p_pos %p_1 %i_1 %_entryPointOutput_pos %_entryPointOutput %_patchConstantOutput_EdgeTess %_patchConstantOutput_InsideTess + OpExecutionMode %hs_main OutputVertices 3 + OpExecutionMode %hs_main Triangles + OpExecutionMode %hs_main SpacingFractionalOdd + OpExecutionMode %hs_main VertexOrderCw + OpSource HLSL 500 + OpName %hs_main "hs_main" + OpName %VertexOutput "VertexOutput" + OpMemberName %VertexOutput 0 "pos" + OpMemberName %VertexOutput 1 "uv" + OpName %HSOut "HSOut" + OpMemberName %HSOut 0 "pos" + OpMemberName %HSOut 1 "uv" + OpName %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ "@hs_main(struct-VertexOutput-vf4-vf21[3];u1;" + OpName %p "p" + OpName %i "i" + OpName %HSConstantOut "HSConstantOut" + OpMemberName %HSConstantOut 0 "EdgeTess" + OpMemberName %HSConstantOut 1 "InsideTess" + OpName %PatchHS_struct_VertexOutput_vf4_vf21_3__ "PatchHS(struct-VertexOutput-vf4-vf21[3];" + OpName %patch "patch" + OpName %output "output" + OpName %p_0 "p" + OpName %p_pos "p.pos" + OpName %VertexOutput_0 "VertexOutput" + OpMemberName %VertexOutput_0 0 "uv" + OpName %p_1 "p" + OpName %i_0 "i" + OpName %i_1 "i" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %HSOut_0 "HSOut" + OpMemberName %HSOut_0 0 "uv" + OpName %_entryPointOutput "@entryPointOutput" + OpName %_patchConstantResult "@patchConstantResult" + OpName %param_1 "param" + OpName %_patchConstantOutput_EdgeTess "@patchConstantOutput.EdgeTess" + OpName %_patchConstantOutput_InsideTess "@patchConstantOutput.InsideTess" + OpName %output_0 "output" + OpDecorate %p_pos BuiltIn Position + OpDecorate %p_1 Location 0 + OpDecorate %i_1 BuiltIn InvocationId + OpDecorate %_entryPointOutput_pos BuiltIn Position + OpDecorate %_entryPointOutput Location 0 + OpDecorate %_patchConstantOutput_EdgeTess Patch + OpDecorate %_patchConstantOutput_EdgeTess BuiltIn TessLevelOuter + OpDecorate %_patchConstantOutput_InsideTess Patch + OpDecorate %_patchConstantOutput_InsideTess BuiltIn TessLevelInner + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%VertexOutput = OpTypeStruct %v4float %v2float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_VertexOutput_uint_3 = OpTypeArray %VertexOutput %uint_3 +%_ptr_Function__arr_VertexOutput_uint_3 = OpTypePointer Function %_arr_VertexOutput_uint_3 +%_ptr_Function_uint = OpTypePointer Function %uint + %HSOut = OpTypeStruct %v4float %v2float + %16 = OpTypeFunction %HSOut %_ptr_Function__arr_VertexOutput_uint_3 %_ptr_Function_uint +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%HSConstantOut = OpTypeStruct %_arr_float_uint_3 %float + %23 = OpTypeFunction %HSConstantOut %_ptr_Function__arr_VertexOutput_uint_3 +%_ptr_Function_HSOut = OpTypePointer Function %HSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 + %p_pos = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%VertexOutput_0 = OpTypeStruct %v2float +%_arr_VertexOutput_0_uint_3 = OpTypeArray %VertexOutput_0 %uint_3 +%_ptr_Input__arr_VertexOutput_0_uint_3 = OpTypePointer Input %_arr_VertexOutput_0_uint_3 + %p_1 = OpVariable %_ptr_Input__arr_VertexOutput_0_uint_3 Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %int_2 = OpConstant %int 2 +%_ptr_Input_uint = OpTypePointer Input %uint + %i_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_entryPointOutput_pos = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %HSOut_0 = OpTypeStruct %v2float +%_arr_HSOut_0_uint_3 = OpTypeArray %HSOut_0 %uint_3 +%_ptr_Output__arr_HSOut_0_uint_3 = OpTypePointer Output %_arr_HSOut_0_uint_3 +%_entryPointOutput = OpVariable %_ptr_Output__arr_HSOut_0_uint_3 Output +%_ptr_Output_v2float = OpTypePointer Output %v2float + %uint_2 = OpConstant %uint 2 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool +%_ptr_Function_HSConstantOut = OpTypePointer Function %HSConstantOut + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_patchConstantOutput_EdgeTess = OpVariable %_ptr_Output__arr_float_uint_4 Output +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_patchConstantOutput_InsideTess = OpVariable %_ptr_Output__arr_float_uint_2 Output + %float_1 = OpConstant %float 1 + %hs_main = OpFunction %void None %3 + %5 = OpLabel + %p_0 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %i_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_HSOut Function + %param = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %param_0 = OpVariable %_ptr_Function_uint Function +%_patchConstantResult = OpVariable %_ptr_Function_HSConstantOut Function + %param_1 = OpVariable %_ptr_Function__arr_VertexOutput_uint_3 Function + %50 = OpAccessChain %_ptr_Input_v4float %p_pos %int_0 + %51 = OpLoad %v4float %50 + %52 = OpAccessChain %_ptr_Function_v4float %p_0 %int_0 %int_0 + OpStore %52 %51 + %58 = OpAccessChain %_ptr_Input_v2float %p_1 %int_0 %int_0 + %59 = OpLoad %v2float %58 + %60 = OpAccessChain %_ptr_Function_v2float %p_0 %int_0 %int_1 + OpStore %60 %59 + %61 = OpAccessChain %_ptr_Input_v4float %p_pos %int_1 + %62 = OpLoad %v4float %61 + %63 = OpAccessChain %_ptr_Function_v4float %p_0 %int_1 %int_0 + OpStore %63 %62 + %64 = OpAccessChain %_ptr_Input_v2float %p_1 %int_1 %int_0 + %65 = OpLoad %v2float %64 + %66 = OpAccessChain %_ptr_Function_v2float %p_0 %int_1 %int_1 + OpStore %66 %65 + %68 = OpAccessChain %_ptr_Input_v4float %p_pos %int_2 + %69 = OpLoad %v4float %68 + %70 = OpAccessChain %_ptr_Function_v4float %p_0 %int_2 %int_0 + OpStore %70 %69 + %71 = OpAccessChain %_ptr_Input_v2float %p_1 %int_2 %int_0 + %72 = OpLoad %v2float %71 + %73 = OpAccessChain %_ptr_Function_v2float %p_0 %int_2 %int_1 + OpStore %73 %72 + %77 = OpLoad %uint %i_1 + OpStore %i_0 %77 + %80 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param %80 + %82 = OpLoad %uint %i_0 + OpStore %param_0 %82 + %83 = OpFunctionCall %HSOut %_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ %param %param_0 + OpStore %flattenTemp %83 + %86 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %87 = OpLoad %v4float %86 + %94 = OpLoad %uint %i_1 + %89 = OpAccessChain %_ptr_Output_v4float %_entryPointOutput_pos %94 + OpStore %89 %87 + %95 = OpAccessChain %_ptr_Function_v2float %flattenTemp %int_1 + %96 = OpLoad %v2float %95 + %98 = OpAccessChain %_ptr_Output_v2float %_entryPointOutput %94 %int_0 + OpStore %98 %96 + OpControlBarrier %uint_2 %uint_1 %uint_0 + %102 = OpLoad %uint %i_1 + %104 = OpIEqual %bool %102 %int_0 + OpSelectionMerge %106 None + OpBranchConditional %104 %105 %106 + %105 = OpLabel + %110 = OpLoad %_arr_VertexOutput_uint_3 %p_0 + OpStore %param_1 %110 + %111 = OpFunctionCall %HSConstantOut %PatchHS_struct_VertexOutput_vf4_vf21_3__ %param_1 + OpStore %_patchConstantResult %111 + %117 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_0 + %118 = OpLoad %float %117 + %120 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_0 + OpStore %120 %118 + %121 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_1 + %122 = OpLoad %float %121 + %123 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_1 + OpStore %123 %122 + %124 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_0 %int_2 + %125 = OpLoad %float %124 + %126 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_EdgeTess %int_2 + OpStore %126 %125 + %130 = OpAccessChain %_ptr_Function_float %_patchConstantResult %int_1 + %131 = OpLoad %float %130 + %132 = OpAccessChain %_ptr_Output_float %_patchConstantOutput_InsideTess %int_0 + OpStore %132 %131 + OpBranch %106 + %106 = OpLabel + OpReturn + OpFunctionEnd +%_hs_main_struct_VertexOutput_vf4_vf21_3__u1_ = OpFunction %HSOut None %16 + %p = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %i = OpFunctionParameter %_ptr_Function_uint + %20 = OpLabel + %output = OpVariable %_ptr_Function_HSOut Function + %31 = OpLoad %uint %i + %33 = OpAccessChain %_ptr_Function_v4float %p %31 %int_0 + %34 = OpLoad %v4float %33 + %35 = OpAccessChain %_ptr_Function_v4float %output %int_0 + OpStore %35 %34 + %37 = OpLoad %uint %i + %39 = OpAccessChain %_ptr_Function_v2float %p %37 %int_1 + %40 = OpLoad %v2float %39 + %41 = OpAccessChain %_ptr_Function_v2float %output %int_1 + OpStore %41 %40 + %42 = OpLoad %HSOut %output + OpReturnValue %42 + OpFunctionEnd +%PatchHS_struct_VertexOutput_vf4_vf21_3__ = OpFunction %HSConstantOut None %23 + %patch = OpFunctionParameter %_ptr_Function__arr_VertexOutput_uint_3 + %26 = OpLabel + %output_0 = OpVariable %_ptr_Function_HSConstantOut Function + %135 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %136 = OpLoad %v2float %135 + %137 = OpCompositeConstruct %v2float %float_1 %float_1 + %138 = OpFAdd %v2float %137 %136 + %139 = OpCompositeExtract %float %138 0 + %140 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_0 + OpStore %140 %139 + %141 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %142 = OpLoad %v2float %141 + %143 = OpCompositeConstruct %v2float %float_1 %float_1 + %144 = OpFAdd %v2float %143 %142 + %145 = OpCompositeExtract %float %144 0 + %146 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_1 + OpStore %146 %145 + %147 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %148 = OpLoad %v2float %147 + %149 = OpCompositeConstruct %v2float %float_1 %float_1 + %150 = OpFAdd %v2float %149 %148 + %151 = OpCompositeExtract %float %150 0 + %152 = OpAccessChain %_ptr_Function_float %output_0 %int_0 %int_2 + OpStore %152 %151 + %153 = OpAccessChain %_ptr_Function_v2float %patch %int_0 %int_1 + %154 = OpLoad %v2float %153 + %155 = OpCompositeConstruct %v2float %float_1 %float_1 + %156 = OpFAdd %v2float %155 %154 + %157 = OpCompositeExtract %float %156 0 + %158 = OpAccessChain %_ptr_Function_float %output_0 %int_1 + OpStore %158 %157 + %159 = OpLoad %HSConstantOut %output_0 + OpReturnValue %159 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc b/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc new file mode 100644 index 0000000000..95fd147e7b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/tesc/tess-level-initializer.asm.tesc @@ -0,0 +1,87 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 47 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %main "main" %gl_out %gl_InvocationID %gl_TessLevelInner %gl_TessLevelOuter + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %gl_out "gl_out" + OpName %gl_InvocationID "gl_InvocationID" + OpName %gl_TessLevelInner "gl_TessLevelInner" + OpName %gl_TessLevelOuter "gl_TessLevelOuter" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %gl_TessLevelInner Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 + %uint_4 = OpConstant %uint 4 +%_arr_gl_PerVertex_uint_4 = OpTypeArray %gl_PerVertex %uint_4 +%_ptr_Output__arr_gl_PerVertex_uint_4 = OpTypePointer Output %_arr_gl_PerVertex_uint_4 + %gl_out = OpVariable %_ptr_Output__arr_gl_PerVertex_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %22 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 + %inner_zero = OpConstantNull %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output %inner_zero +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %outer_zero = OpConstantNull %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output %outer_zero + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int_2 = OpConstant %int 2 + %float_5 = OpConstant %float 5 + %int_3 = OpConstant %int 3 + %float_6 = OpConstant %float 6 + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpLoad %int %gl_InvocationID + %24 = OpAccessChain %_ptr_Output_v4float %gl_out %19 %int_0 + OpStore %24 %22 + %30 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %30 %float_1 + %33 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %33 %float_2 + %38 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %38 %float_3 + %40 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %40 %float_4 + %43 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %43 %float_5 + %46 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %46 %float_6 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert new file mode 100644 index 0000000000..a431e6a717 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/block-struct-initializer.asm.vert @@ -0,0 +1,37 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 13 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %foo + OpSource GLSL 450 + OpName %main "main" + OpName %Vert "Vert" + OpMemberName %Vert 0 "a" + OpMemberName %Vert 1 "b" + OpName %_ "" + OpName %Foo "Foo" + OpMemberName %Foo 0 "c" + OpMemberName %Foo 1 "d" + OpName %foo "foo" + OpDecorate %Vert Block + OpDecorate %_ Location 0 + OpDecorate %foo Location 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Vert = OpTypeStruct %float %float +%_ptr_Output_Vert = OpTypePointer Output %Vert + %zero_vert = OpConstantNull %Vert + %_ = OpVariable %_ptr_Output_Vert Output %zero_vert + %Foo = OpTypeStruct %float %float +%_ptr_Output_Foo = OpTypePointer Output %Foo +%zero_foo = OpConstantNull %Foo + %foo = OpVariable %_ptr_Output_Foo Output %zero_foo + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert new file mode 100644 index 0000000000..aaa68662e5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/builtin-output-initializer.asm.vert @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %zero = OpConstantNull %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output %zero + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert new file mode 100644 index 0000000000..94a883c1ed --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.asm.vert @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %output_location_0 %output_location_2 %output_location_3 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Struct_vec4" + OpMemberName %Foo 0 "m0" + OpName %c "c" + OpName %Foo_0 "Struct_vec4" + OpMemberName %Foo_0 0 "m0" + OpName %Bar "Struct_vec4" + OpMemberName %Bar 0 "m0" + OpName %UBO "UBO" + OpMemberName %UBO 0 "m0" + OpMemberName %UBO 1 "m1" + OpName %ubo_binding_0 "ubo_binding_0" + OpName %Bar_0 "Struct_vec4" + OpMemberName %Bar_0 0 "m0" + OpName %b "b" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %VertexOut "VertexOut" + OpMemberName %VertexOut 0 "m0" + OpMemberName %VertexOut 1 "m1" + OpName %output_location_0 "output_location_0" + OpName %output_location_2 "output_location_2" + OpName %output_location_3 "output_location_3" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Bar 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %ubo_binding_0 DescriptorSet 0 + OpDecorate %ubo_binding_0 Binding 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %VertexOut Block + OpDecorate %output_location_0 Location 0 + OpDecorate %output_location_2 Location 2 + OpDecorate %output_location_3 Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Foo = OpTypeStruct %v4float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %v4float + %Bar = OpTypeStruct %v4float + %UBO = OpTypeStruct %Foo_0 %Bar +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO +%ubo_binding_0 = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %Bar_0 = OpTypeStruct %v4float +%_ptr_Function_Bar_0 = OpTypePointer Function %Bar_0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_Bar = OpTypePointer Uniform %Bar + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %VertexOut = OpTypeStruct %Foo %Bar_0 +%_ptr_Output_VertexOut = OpTypePointer Output %VertexOut +%output_location_0 = OpVariable %_ptr_Output_VertexOut Output +%_ptr_Output_Foo = OpTypePointer Output %Foo +%_ptr_Output_Bar_0 = OpTypePointer Output %Bar_0 +%output_location_2 = OpVariable %_ptr_Output_Foo Output +%output_location_3 = OpVariable %_ptr_Output_Bar_0 Output + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_Foo Function + %b = OpVariable %_ptr_Function_Bar_0 Function + %19 = OpAccessChain %_ptr_Uniform_Foo_0 %ubo_binding_0 %int_0 + %20 = OpLoad %Foo_0 %19 + %21 = OpCompositeExtract %v4float %20 0 + %23 = OpAccessChain %_ptr_Function_v4float %c %int_0 + OpStore %23 %21 + %29 = OpAccessChain %_ptr_Uniform_Bar %ubo_binding_0 %int_1 + %30 = OpLoad %Bar %29 + %31 = OpCompositeExtract %v4float %30 0 + %32 = OpAccessChain %_ptr_Function_v4float %b %int_0 + OpStore %32 %31 + %39 = OpAccessChain %_ptr_Function_v4float %c %int_0 + %40 = OpLoad %v4float %39 + %41 = OpAccessChain %_ptr_Function_v4float %b %int_0 + %42 = OpLoad %v4float %41 + %43 = OpFAdd %v4float %40 %42 + %45 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %45 %43 + %49 = OpLoad %Foo %c + %51 = OpAccessChain %_ptr_Output_Foo %output_location_0 %int_0 + OpStore %51 %49 + %52 = OpLoad %Bar_0 %b + %54 = OpAccessChain %_ptr_Output_Bar_0 %output_location_0 %int_1 + OpStore %54 %52 + %56 = OpLoad %Foo %c + OpStore %output_location_2 %56 + %58 = OpLoad %Bar_0 %b + OpStore %output_location_3 %58 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert new file mode 100644 index 0000000000..94a883c1ed --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/complex-link-by-name.force-flattened-io.legacy.asm.vert @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ %output_location_0 %output_location_2 %output_location_3 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Struct_vec4" + OpMemberName %Foo 0 "m0" + OpName %c "c" + OpName %Foo_0 "Struct_vec4" + OpMemberName %Foo_0 0 "m0" + OpName %Bar "Struct_vec4" + OpMemberName %Bar 0 "m0" + OpName %UBO "UBO" + OpMemberName %UBO 0 "m0" + OpMemberName %UBO 1 "m1" + OpName %ubo_binding_0 "ubo_binding_0" + OpName %Bar_0 "Struct_vec4" + OpMemberName %Bar_0 0 "m0" + OpName %b "b" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %VertexOut "VertexOut" + OpMemberName %VertexOut 0 "m0" + OpMemberName %VertexOut 1 "m1" + OpName %output_location_0 "output_location_0" + OpName %output_location_2 "output_location_2" + OpName %output_location_3 "output_location_3" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Bar 0 Offset 0 + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 16 + OpDecorate %UBO Block + OpDecorate %ubo_binding_0 DescriptorSet 0 + OpDecorate %ubo_binding_0 Binding 0 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpDecorate %VertexOut Block + OpDecorate %output_location_0 Location 0 + OpDecorate %output_location_2 Location 2 + OpDecorate %output_location_3 Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Foo = OpTypeStruct %v4float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %v4float + %Bar = OpTypeStruct %v4float + %UBO = OpTypeStruct %Foo_0 %Bar +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO +%ubo_binding_0 = OpVariable %_ptr_Uniform_UBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %Bar_0 = OpTypeStruct %v4float +%_ptr_Function_Bar_0 = OpTypePointer Function %Bar_0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_Bar = OpTypePointer Uniform %Bar + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %VertexOut = OpTypeStruct %Foo %Bar_0 +%_ptr_Output_VertexOut = OpTypePointer Output %VertexOut +%output_location_0 = OpVariable %_ptr_Output_VertexOut Output +%_ptr_Output_Foo = OpTypePointer Output %Foo +%_ptr_Output_Bar_0 = OpTypePointer Output %Bar_0 +%output_location_2 = OpVariable %_ptr_Output_Foo Output +%output_location_3 = OpVariable %_ptr_Output_Bar_0 Output + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_Foo Function + %b = OpVariable %_ptr_Function_Bar_0 Function + %19 = OpAccessChain %_ptr_Uniform_Foo_0 %ubo_binding_0 %int_0 + %20 = OpLoad %Foo_0 %19 + %21 = OpCompositeExtract %v4float %20 0 + %23 = OpAccessChain %_ptr_Function_v4float %c %int_0 + OpStore %23 %21 + %29 = OpAccessChain %_ptr_Uniform_Bar %ubo_binding_0 %int_1 + %30 = OpLoad %Bar %29 + %31 = OpCompositeExtract %v4float %30 0 + %32 = OpAccessChain %_ptr_Function_v4float %b %int_0 + OpStore %32 %31 + %39 = OpAccessChain %_ptr_Function_v4float %c %int_0 + %40 = OpLoad %v4float %39 + %41 = OpAccessChain %_ptr_Function_v4float %b %int_0 + %42 = OpLoad %v4float %41 + %43 = OpFAdd %v4float %40 %42 + %45 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %45 %43 + %49 = OpLoad %Foo %c + %51 = OpAccessChain %_ptr_Output_Foo %output_location_0 %int_0 + OpStore %51 %49 + %52 = OpLoad %Bar_0 %b + %54 = OpAccessChain %_ptr_Output_Bar_0 %output_location_0 %int_1 + OpStore %54 %52 + %56 = OpLoad %Foo %c + OpStore %output_location_2 %56 + %58 = OpLoad %Bar_0 %b + OpStore %output_location_3 %58 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert new file mode 100644 index 0000000000..d5a1b41146 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/constant-composite-extract.asm.vert @@ -0,0 +1,66 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %m4float = OpTypeMatrix %v4float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 + %float_6 = OpConstant %float 6 + %float_7 = OpConstant %float 7 + %float_8 = OpConstant %float 8 + %vec0 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %vec1 = OpConstantComposite %v4float %float_5 %float_6 %float_7 %float_8 + %cmat = OpConstantComposite %m4float %vec0 %vec1 %vec0 %vec1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + %e0 = OpCompositeExtract %float %vec0 0 + %e1 = OpCompositeExtract %float %vec0 1 + %e2 = OpCompositeExtract %float %vec0 2 + %e3 = OpCompositeExtract %float %vec0 3 + %m13 = OpCompositeExtract %float %cmat 1 3 + %m21 = OpCompositeExtract %float %cmat 2 1 + %e_front = OpCompositeConstruct %v4float %e0 %e1 %e2 %e3 + %e_back = OpCompositeConstruct %v4float %e3 %e2 %m13 %m21 + %m0 = OpCompositeExtract %v4float %cmat 2 + %m1 = OpCompositeExtract %v4float %cmat 3 + %sum0 = OpFAdd %v4float %m0 %m1 + %sum1 = OpFAdd %v4float %e_front %e_back + %sum = OpFAdd %v4float %sum0 %sum1 + OpStore %21 %sum + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert new file mode 100644 index 0000000000..38c3de909c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/debug-printf.asm.vk.nocompat.vert @@ -0,0 +1,29 @@ + OpCapability Shader + OpExtension "SPV_KHR_non_semantic_info" + %1 = OpExtInstImport "NonSemantic.DebugPrintf" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vert "main" %gl_Position + %4 = OpString "Foo %f %f" + OpSource HLSL 600 + OpName %vert "vert" + OpDecorate %gl_Position BuiltIn Position + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_0 = OpConstant %float 0 + %v4float = OpTypeVector %float 4 + %9 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %12 = OpTypeFunction %void + %13 = OpTypeFunction %v4float +%gl_Position = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %vert = OpFunction %void None %12 + %15 = OpLabel + %16 = OpVariable %_ptr_Function_v4float Function + %17 = OpExtInst %void %1 1 %4 %float_1 %float_2 + OpStore %16 %9 + OpStore %gl_Position %9 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert new file mode 100644 index 0000000000..038ecaa6e3 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/empty-struct-composite.asm.vert @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.1 +; Generator: Google rspirv; 0 +; Bound: 17 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" + OpName %Test "Test" + OpName %t "t" + OpName %retvar "retvar" + OpName %main "main" + OpName %retvar_0 "retvar" + %void = OpTypeVoid + %6 = OpTypeFunction %void + %Test = OpTypeStruct +%_ptr_Function_Test = OpTypePointer Function %Test +%_ptr_Function_void = OpTypePointer Function %void + %2 = OpFunction %void None %6 + %7 = OpLabel + %t = OpVariable %_ptr_Function_Test Function + %retvar = OpVariable %_ptr_Function_void Function + OpBranch %4 + %4 = OpLabel + %13 = OpCompositeConstruct %Test + OpStore %t %13 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %6 + %15 = OpLabel + %retvar_0 = OpVariable %_ptr_Function_void Function + OpBranch %14 + %14 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert new file mode 100644 index 0000000000..6ed06210ee --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/fma-legacy-fallback.asm.vert @@ -0,0 +1,24 @@ + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %a + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpDecorate %a Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %a = OpVariable %_ptr_Output_float Output + %float_5 = OpConstant %float 5 + %float_2 = OpConstant %float 2 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %a %float_5 + %10 = OpLoad %float %a + %14 = OpExtInst %float %1 Fma %10 %float_2 %float_1 + OpStore %a %14 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/asm/vert/semantic-decoration.asm.vert b/third_party/spirv-cross/shaders-no-opt/asm/vert/semantic-decoration.asm.vert new file mode 100644 index 0000000000..76007c30a3 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/asm/vert/semantic-decoration.asm.vert @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_decorate_string" + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_entryPointOutput_p %_entryPointOutput_c + OpSource HLSL 500 + OpName %main "main" + OpName %VOut "VOut" + OpMemberName %VOut 0 "p" + OpMemberName %VOut 1 "c" + OpName %_main_ "@main(" + OpName %v "v" + OpName %flattenTemp "flattenTemp" + OpName %_entryPointOutput_p "@entryPointOutput.p" + OpName %_entryPointOutput_c "@entryPointOutput.c" + OpMemberDecorateStringGOOGLE %VOut 0 HlslSemanticGOOGLE "SV_POSITION" + OpMemberDecorateStringGOOGLE %VOut 1 HlslSemanticGOOGLE "COLOR" + OpDecorate %_entryPointOutput_p BuiltIn Position + OpDecorateStringGOOGLE %_entryPointOutput_p HlslSemanticGOOGLE "SV_POSITION" + OpDecorate %_entryPointOutput_c Location 0 + OpDecorateStringGOOGLE %_entryPointOutput_c HlslSemanticGOOGLE "COLOR" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %VOut = OpTypeStruct %v4float %v4float + %9 = OpTypeFunction %VOut +%_ptr_Function_VOut = OpTypePointer Function %VOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 + %22 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_p = OpVariable %_ptr_Output_v4float Output +%_entryPointOutput_c = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel +%flattenTemp = OpVariable %_ptr_Function_VOut Function + %28 = OpFunctionCall %VOut %_main_ + OpStore %flattenTemp %28 + %31 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %32 = OpLoad %v4float %31 + OpStore %_entryPointOutput_p %32 + %34 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_1 + %35 = OpLoad %v4float %34 + OpStore %_entryPointOutput_c %35 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %VOut None %9 + %11 = OpLabel + %v = OpVariable %_ptr_Function_VOut Function + %19 = OpAccessChain %_ptr_Function_v4float %v %int_0 + OpStore %19 %17 + %23 = OpAccessChain %_ptr_Function_v4float %v %int_1 + OpStore %23 %22 + %24 = OpLoad %VOut %v + OpReturnValue %24 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp b/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp new file mode 100644 index 0000000000..0c21cda306 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-1.invalid.comp @@ -0,0 +1,23 @@ +#version 450 core +#extension GL_AMD_gpu_shader_half_float : require +#extension GL_AMD_gpu_shader_int16 : require +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + i16vec4 inputs[]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + f16vec2 a = int16BitsToFloat16(inputs[ident].xy); + outputs[ident].x = int(packFloat2x16(a + f16vec2(1, 1))); + outputs[ident].y = packInt2x16(inputs[ident].zw); + outputs[ident].z = int(packUint2x16(u16vec2(inputs[ident].xy))); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp b/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp new file mode 100644 index 0000000000..6bb662412c --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/bitcast-16bit-2.invalid.comp @@ -0,0 +1,26 @@ +#version 450 core +#extension GL_AMD_gpu_shader_half_float : require +#extension GL_AMD_gpu_shader_int16 : require +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + i16vec4 outputs[]; +}; + +layout(binding = 2) uniform UBO +{ + f16vec4 const0; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + outputs[ident].xy = unpackInt2x16(inputs[ident].x) + float16BitsToInt16(const0.xy); + outputs[ident].zw = i16vec2(unpackUint2x16(uint(inputs[ident].y)) - float16BitsToUint16(const0.zw)); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/bitfield.comp b/third_party/spirv-cross/shaders-no-opt/comp/bitfield.comp new file mode 100644 index 0000000000..d75b556b62 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/bitfield.comp @@ -0,0 +1,21 @@ +#version 310 es + +void main() +{ + int signed_value = 0; + uint unsigned_value = 0u; + + int s = bitfieldExtract(signed_value, 5, 20); + uint u = bitfieldExtract(unsigned_value, 6, 21); + s = bitfieldInsert(s, 40, 5, 4); + u = bitfieldInsert(u, 60u, 5, 4); + + u = bitfieldReverse(u); + s = bitfieldReverse(s); + + int v0 = bitCount(u); + int v1 = bitCount(s); + + int v2 = findMSB(u); + int v3 = findLSB(s); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/glsl.std450.comp b/third_party/spirv-cross/shaders-no-opt/comp/glsl.std450.comp new file mode 100644 index 0000000000..a17a82b82a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/glsl.std450.comp @@ -0,0 +1,129 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + float res; + int ires; + uint ures; + + vec4 f32; + ivec4 s32; + uvec4 u32; + + mat2 m2; + mat3 m3; + mat4 m4; +}; + +void main() +{ + float tmp; + vec2 v2; + vec3 v3; + vec4 v4; + int itmp; + + res = round(f32.x); + res = roundEven(f32.x); + res = trunc(f32.x); + res = abs(f32.x); + ires = abs(s32.x); + res = sign(f32.x); + ires = sign(s32.x); + res = floor(f32.x); + res = ceil(f32.x); + res = fract(f32.x); + res = radians(f32.x); + res = degrees(f32.x); + res = sin(f32.x); + res = cos(f32.x); + res = tan(f32.x); + res = asin(f32.x); + res = acos(f32.x); + res = atan(f32.x); + res = sinh(f32.x); + res = cosh(f32.x); + res = tanh(f32.x); + res = asinh(f32.x); + res = acosh(f32.x); + res = atanh(f32.x); + res = atan(f32.x, f32.y); + res = pow(f32.x, f32.y); + res = exp(f32.x); + res = log(f32.x); + res = exp2(f32.x); + res = log2(f32.x); + res = sqrt(f32.x); + res = inversesqrt(f32.x); + + res = length(f32.x); + res = distance(f32.x, f32.y); + res = normalize(f32.x); + res = faceforward(f32.x, f32.y, f32.z); + res = reflect(f32.x, f32.y); + res = refract(f32.x, f32.y, f32.z); + + res = length(f32.xy); + res = distance(f32.xy, f32.zw); + v2 = normalize(f32.xy); + v2 = faceforward(f32.xy, f32.yz, f32.zw); + v2 = reflect(f32.xy, f32.zw); + v2 = refract(f32.xy, f32.yz, f32.w); + + v3 = cross(f32.xyz, f32.yzw); + + res = determinant(m2); + res = determinant(m3); + res = determinant(m4); + m2 = inverse(m2); + m3 = inverse(m3); + m4 = inverse(m4); + + res = modf(f32.x, tmp); + // ModfStruct + + res = min(f32.x, f32.y); + ures = min(u32.x, u32.y); + ires = min(s32.x, s32.y); + res = max(f32.x, f32.y); + ures = max(u32.x, u32.y); + ires = max(s32.x, s32.y); + + res = clamp(f32.x, f32.y, f32.z); + ures = clamp(u32.x, u32.y, u32.z); + ires = clamp(s32.x, s32.y, s32.z); + + res = mix(f32.x, f32.y, f32.z); + res = step(f32.x, f32.y); + res = smoothstep(f32.x, f32.y, f32.z); + res = fma(f32.x, f32.y, f32.z); + + res = frexp(f32.x, itmp); + // FrexpStruct + res = ldexp(f32.x, itmp); + + ures = packSnorm4x8(f32); + ures = packUnorm4x8(f32); + ures = packSnorm2x16(f32.xy); + ures = packUnorm2x16(f32.xy); + ures = packHalf2x16(f32.xy); + // packDouble2x32 + + v2 = unpackSnorm2x16(u32.x); + v2 = unpackUnorm2x16(u32.x); + v2 = unpackHalf2x16(u32.x); + v4 = unpackSnorm4x8(u32.x); + v4 = unpackUnorm4x8(u32.x); + // unpackDouble2x32 + + s32 = findLSB(s32); + s32 = findLSB(u32); + s32 = findMSB(s32); + s32 = findMSB(u32); + + // interpolateAtSample + // interpolateAtOffset + + // NMin, NMax, NClamp +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/illegal-struct-name.asm.comp b/third_party/spirv-cross/shaders-no-opt/comp/illegal-struct-name.asm.comp new file mode 100644 index 0000000000..f7a8787d3d --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/illegal-struct-name.asm.comp @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 31 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %Foo "Foo" + OpMemberName %Foo 0 "abs" + OpName %f "f" + OpName %Foo_0 "Foo" + OpMemberName %Foo_0 0 "abs" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "foo" + OpMemberName %SSBO 1 "foo2" + OpName %_ "" + OpName %linear "abs" + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 4 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Foo = OpTypeStruct %float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %Foo_0 = OpTypeStruct %float + %SSBO = OpTypeStruct %Foo_0 %Foo_0 +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_Foo Function + %linear = OpVariable %_ptr_Function_int Function + %17 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_0 + %18 = OpLoad %Foo_0 %17 + %19 = OpCompositeExtract %float %18 0 + %21 = OpAccessChain %_ptr_Function_float %f %int_0 + OpStore %21 %19 + OpStore %linear %int_10 + %26 = OpLoad %Foo %f + %27 = OpAccessChain %_ptr_Uniform_Foo_0 %_ %int_1 + %28 = OpCompositeExtract %float %26 0 + %30 = OpAccessChain %_ptr_Uniform_float %27 %int_0 + OpStore %30 %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/comp/image-load-formatted.comp b/third_party/spirv-cross/shaders-no-opt/comp/image-load-formatted.comp new file mode 100644 index 0000000000..7fd587d99a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/image-load-formatted.comp @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_shader_image_load_formatted : require +layout(local_size_x = 8, local_size_y = 8) in; + +layout(binding = 0) uniform image2D img; + +void main() +{ + vec4 v = imageLoad(img, ivec2(gl_GlobalInvocationID.xy)); + imageStore(img, ivec2(gl_GlobalInvocationID.xy), v + 1.0); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/inout-struct.invalid.comp b/third_party/spirv-cross/shaders-no-opt/comp/inout-struct.invalid.comp new file mode 100644 index 0000000000..c1de959743 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/inout-struct.invalid.comp @@ -0,0 +1,55 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) writeonly buffer SSBO +{ + vec4 data[]; +} outdata; + +layout(std430, binding = 1) readonly buffer SSBO2 +{ + vec4 data[]; +} indata; + +struct Foo +{ + vec4 a; + vec4 b; + vec4 c; + vec4 d; +}; + +layout(std430, binding = 2) readonly buffer SSBO3 +{ + Foo foos[]; +} foobar; + +vec4 bar(Foo foo) +{ + return foo.a + foo.b + foo.c + foo.d; +} + +void baz(out Foo foo) +{ + uint ident = gl_GlobalInvocationID.x; + foo.a = indata.data[4u * ident + 0u]; + foo.b = indata.data[4u * ident + 1u]; + foo.c = indata.data[4u * ident + 2u]; + foo.d = indata.data[4u * ident + 3u]; +} + +void meow(inout Foo foo) +{ + foo.a += 10.0; + foo.b += 20.0; + foo.c += 30.0; + foo.d += 40.0; +} + +void main() +{ + Foo foo; + baz(foo); + meow(foo); + outdata.data[gl_GlobalInvocationID.x] = bar(foo) + bar(foobar.foos[gl_GlobalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/int16min-literal.comp b/third_party/spirv-cross/shaders-no-opt/comp/int16min-literal.comp new file mode 100644 index 0000000000..c1b345266d --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/int16min-literal.comp @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require +#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float16_t a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float16_t b; +}; + +void main() +{ + int16_t v = float16BitsToInt16(b); + v ^= 0x8000s; + a = int16BitsToFloat16(v); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/int64min-literal.comp b/third_party/spirv-cross/shaders-no-opt/comp/int64min-literal.comp new file mode 100644 index 0000000000..ac20389033 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/int64min-literal.comp @@ -0,0 +1,23 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float b; +}; + +void main() +{ + double b2 = b; + int64_t v = doubleBitsToInt64(b2); + v ^= 0x8000000000000000L; + double a2 = int64BitsToDouble(v); + a = float(a2); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/intmin-literal.comp b/third_party/spirv-cross/shaders-no-opt/comp/intmin-literal.comp new file mode 100644 index 0000000000..ee35cedabb --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/intmin-literal.comp @@ -0,0 +1,18 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 1) buffer SSBO +{ + float a; +}; + +layout(set = 0, binding = 0) uniform UBO +{ + float b; +}; + +void main() +{ + a = intBitsToFloat(floatBitsToInt(b) ^ 0x80000000); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp b/third_party/spirv-cross/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp new file mode 100644 index 0000000000..e916ab2408 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/loop-break-merge-after-inner-continue.comp @@ -0,0 +1,21 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout (binding = 0) buffer STO +{ + uint data[]; +} ssbo; + +void main() +{ + while(true) + { + ssbo.data[0] += 1; + if (bool(ssbo.data[2])) + { + ssbo.data[5] += 1; + continue; + } + break; + } +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp b/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp new file mode 100644 index 0000000000..7299847711 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.g.comp @@ -0,0 +1,16 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + int v[]; +}; + +void main() +{ + for (int i = 0; i < 4; i++) + { + v[i] += 10; + } +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp b/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp new file mode 100644 index 0000000000..7299847711 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/loop-resolve-debug-semantics.gV.comp @@ -0,0 +1,16 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer SSBO +{ + int v[]; +}; + +void main() +{ + for (int i = 0; i < 4; i++) + { + v[i] += 10; + } +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/loop.comp b/third_party/spirv-cross/shaders-no-opt/comp/loop.comp new file mode 100644 index 0000000000..6d6c324243 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/loop.comp @@ -0,0 +1,98 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = in_data[ident]; + + int k = 0; + uint i = 0u; + + if (idat.y == 20.0) + { + do + { + k = k * 2; + i++; + } while (i < ident); + } + + switch (k) + { + case 10: + for (;;) + { + i++; + if (i > 10u) + break; + } + break; + + default: + for (;;) + { + i += 2u; + if (i > 20u) + break; + } + break; + } + + while (k < 10) + { + idat *= 2.0; + k++; + } + + for (uint i = 0u; i < 16u; i++, k++) + for (uint j = 0u; j < 30u; j++) + idat = mvp * idat; + + k = 0; + for (;;) + { + k++; + if (k > 10) + { + k += 2; + } + else + { + k += 3; + continue; + } + + k += 10; + } + + k = 0; + do + { + k++; + } while (k > 10); + + int l = 0; + for (;; l++) + { + if (l == 5) + { + continue; + } + + idat += 1.0; + } + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders-no-opt/comp/return.comp b/third_party/spirv-cross/shaders-no-opt/comp/return.comp new file mode 100644 index 0000000000..617f437182 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/return.comp @@ -0,0 +1,33 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + + if (ident == 2u) + { + out_data[ident] = vec4(20.0); + } + else if (ident == 4u) + { + out_data[ident] = vec4(10.0); + return; + } + + for (int i = 0; i < 20; i++) + { + if (i == 10) + break; + + return; + } + + out_data[ident] = vec4(10.0); +} + diff --git a/third_party/spirv-cross/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp b/third_party/spirv-cross/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp new file mode 100644 index 0000000000..afcc31d99e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/shader_ballot_nonuniform_invocations.invalid.comp @@ -0,0 +1,9 @@ +#version 450 +#extension GL_AMD_shader_ballot : require + +void main () +{ + float addInvocations = addInvocationsNonUniformAMD(0.0); + int minInvocations = minInvocationsNonUniformAMD(1); + uint maxInvocations = maxInvocationsNonUniformAMD(4); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/specialization-constant-evaluation.comp b/third_party/spirv-cross/shaders-no-opt/comp/specialization-constant-evaluation.comp new file mode 100644 index 0000000000..d45d021ac5 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/specialization-constant-evaluation.comp @@ -0,0 +1,123 @@ +#version 450 + +layout(local_size_x = 1) in; + +layout(constant_id = 0) const bool TRUE = true; +layout(constant_id = 1) const bool FALSE = false; +layout(constant_id = 2) const int SONE = 1; +layout(constant_id = 3) const int STWO = 2; +layout(constant_id = 4) const int SNEG_TWO = -2; +layout(constant_id = 5) const uint UONE = 1; +layout(constant_id = 6) const uint UTWO = 2; +layout(constant_id = 7) const int SNEG_THREE = -3; + +const uint IADD = SONE + STWO + UONE + UTWO; // 6 +const uint ISUB = UTWO - SONE; // 1 +const uint IMUL = UTWO * UTWO; // 4 +const uint UDIV = UTWO / UTWO; // 1 +const int SDIV = STWO / SNEG_TWO; // -1 +//const int SREM = STWO % SNEG_THREE; // 1 +const int SREM = 1; +const int SMOD = STWO % SNEG_THREE; // -1 +const uint UMOD = IADD % IMUL; // 2 + +const uint LSHL = IADD << ISUB; // 12 +const uint RSHL = IADD >> ISUB; // 3 +const int RSHA = (-int(IADD)) >> (-SDIV); // -3 + +const bool IEQ = IADD == ISUB; // false +const bool INEQ = IADD != ISUB; // true +const bool ULT = IADD < ISUB; // false +const bool ULE = IADD <= ISUB; // false +const bool UGT = IADD > ISUB; // true +const bool UGE = IADD >= ISUB; // true + +const bool SLT = SMOD < SREM; // true +const bool SLE = SMOD <= SREM; // true +const bool SGT = SMOD > SREM; // false +const bool SGE = SMOD >= SREM; // false + +const bool LOR = IEQ || SLT; // true +const bool LAND = IEQ && SLT; // false +const bool LNOT = !LOR; // false + +const uint AND = IADD & IADD; // 6 +const uint OR = IADD | ISUB; // 7 +const uint XOR = IADD ^ IADD; // 0 +const uint NOT = ~XOR; // UINT_MAX + +const bool LEQ = LAND == LNOT; // true +const bool LNEQ = LAND != LNOT; // false + +const uint SEL = IEQ ? IADD : ISUB; // 1 + +#define DUMMY_SSBO(name, bind, size) layout(std430, set = 0, binding = bind) buffer SSBO_##name { float val[size]; float dummy; } name + +// Normalize all sizes to 1 element so that the default offsets in glslang matches up with what we should be computing. +// If we do it right, we should get no layout(offset = N) expressions. +DUMMY_SSBO(IAdd, 0, IADD - 5); +DUMMY_SSBO(ISub, 1, ISUB); +DUMMY_SSBO(IMul, 2, IMUL - 3); +DUMMY_SSBO(UDiv, 3, UDIV); +DUMMY_SSBO(SDiv, 4, SDIV + 2); +DUMMY_SSBO(SRem, 5, SREM); +DUMMY_SSBO(SMod, 6, SMOD + 2); +DUMMY_SSBO(UMod, 7, UMOD - 1); +DUMMY_SSBO(LShl, 8, LSHL - 11); +DUMMY_SSBO(RShl, 9, RSHL - 2); +DUMMY_SSBO(RSha, 10, RSHA + 4); +DUMMY_SSBO(IEq, 11, IEQ ? 2 : 1); +DUMMY_SSBO(INeq, 12, INEQ ? 1 : 2); +DUMMY_SSBO(Ult, 13, ULT ? 2 : 1); +DUMMY_SSBO(Ule, 14, ULE ? 2 : 1); +DUMMY_SSBO(Ugt, 15, UGT ? 1 : 2); +DUMMY_SSBO(Uge, 16, UGE ? 1 : 2); +DUMMY_SSBO(Slt, 17, SLT ? 1 : 2); +DUMMY_SSBO(Sle, 18, SLE ? 1 : 2); +DUMMY_SSBO(Sgt, 19, SGT ? 2 : 1); +DUMMY_SSBO(Sge, 20, SGE ? 2 : 1); +DUMMY_SSBO(Lor, 21, LOR ? 1 : 2); +DUMMY_SSBO(Land, 22, LAND ? 2 : 1); +DUMMY_SSBO(Lnot, 23, LNOT ? 2 : 1); +DUMMY_SSBO(And, 24, AND - 5); +DUMMY_SSBO(Or, 24, OR - 6); +DUMMY_SSBO(Xor, 24, XOR + 1); +DUMMY_SSBO(Not, 25, NOT - 0xfffffffeu); +DUMMY_SSBO(Leq, 26, LEQ ? 1 : 2); +DUMMY_SSBO(Lneq, 27, LNEQ ? 2 : 1); +DUMMY_SSBO(Sel, 28, SEL); + +void main() +{ + IAdd.val[0] = 0.0; + ISub.val[0] = 0.0; + IMul.val[0] = 0.0; + UDiv.val[0] = 0.0; + SDiv.val[0] = 0.0; + SRem.val[0] = 0.0; + SMod.val[0] = 0.0; + UMod.val[0] = 0.0; + LShl.val[0] = 0.0; + RShl.val[0] = 0.0; + RSha.val[0] = 0.0; + IEq.val[0] = 0.0; + INeq.val[0] = 0.0; + Ult.val[0] = 0.0; + Ule.val[0] = 0.0; + Ugt.val[0] = 0.0; + Uge.val[0] = 0.0; + Slt.val[0] = 0.0; + Sle.val[0] = 0.0; + Sgt.val[0] = 0.0; + Sge.val[0] = 0.0; + Lor.val[0] = 0.0; + Land.val[0] = 0.0; + Lnot.val[0] = 0.0; + And.val[0] = 0.0; + Or.val[0] = 0.0; + Xor.val[0] = 0.0; + Not.val[0] = 0.0; + Leq.val[0] = 0.0; + Lneq.val[0] = 0.0; + Sel.val[0] = 0.0; +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp new file mode 100644 index 0000000000..808403d963 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/struct-packing-scalar.nocompat.invalid.vk.comp @@ -0,0 +1,88 @@ +#version 310 es +#extension GL_EXT_scalar_block_layout : require + +layout(local_size_x = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + + S4 m3s[8]; +}; + +layout(binding = 1, scalar) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content = ssbo_140.content; +} + diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp new file mode 100644 index 0000000000..a73a231259 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups.nocompat.invalid.vk.comp @@ -0,0 +1,132 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require +#extension GL_KHR_shader_subgroup_shuffle : require +#extension GL_KHR_shader_subgroup_shuffle_relative : require +#extension GL_KHR_shader_subgroup_arithmetic : require +#extension GL_KHR_shader_subgroup_clustered : require +#extension GL_KHR_shader_subgroup_quad : require +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // shuffle + uint shuffled = subgroupShuffle(10u, 8u); + uint shuffled_xor = subgroupShuffleXor(30u, 8u); + + // shuffle relative + uint shuffled_up = subgroupShuffleUp(20u, 4u); + uint shuffled_down = subgroupShuffleDown(20u, 4u); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal = subgroupAllEqual(true); + + // arithmetic + vec4 added = subgroupAdd(vec4(20.0)); + ivec4 iadded = subgroupAdd(ivec4(20)); + vec4 multiplied = subgroupMul(vec4(20.0)); + ivec4 imultiplied = subgroupMul(ivec4(20)); + vec4 lo = subgroupMin(vec4(20.0)); + vec4 hi = subgroupMax(vec4(20.0)); + ivec4 slo = subgroupMin(ivec4(20)); + ivec4 shi = subgroupMax(ivec4(20)); + uvec4 ulo = subgroupMin(uvec4(20)); + uvec4 uhi = subgroupMax(uvec4(20)); + uvec4 anded = subgroupAnd(ballot_value); + uvec4 ored = subgroupOr(ballot_value); + uvec4 xored = subgroupXor(ballot_value); + bvec4 anded_b = subgroupAnd(equal(ballot_value, uvec4(42))); + bvec4 ored_b = subgroupOr(equal(ballot_value, uvec4(42))); + bvec4 xored_b = subgroupXor(equal(ballot_value, uvec4(42))); + + added = subgroupInclusiveAdd(added); + iadded = subgroupInclusiveAdd(iadded); + multiplied = subgroupInclusiveMul(multiplied); + imultiplied = subgroupInclusiveMul(imultiplied); + lo = subgroupInclusiveMin(lo); + hi = subgroupInclusiveMax(hi); + slo = subgroupInclusiveMin(slo); + shi = subgroupInclusiveMax(shi); + ulo = subgroupInclusiveMin(ulo); + uhi = subgroupInclusiveMax(uhi); + anded = subgroupInclusiveAnd(anded); + ored = subgroupInclusiveOr(ored); + xored = subgroupInclusiveXor(ored); + added = subgroupExclusiveAdd(lo); + + added = subgroupExclusiveAdd(multiplied); + multiplied = subgroupExclusiveMul(multiplied); + iadded = subgroupExclusiveAdd(imultiplied); + imultiplied = subgroupExclusiveMul(imultiplied); + lo = subgroupExclusiveMin(lo); + hi = subgroupExclusiveMax(hi); + ulo = subgroupExclusiveMin(ulo); + uhi = subgroupExclusiveMax(uhi); + slo = subgroupExclusiveMin(slo); + shi = subgroupExclusiveMax(shi); + anded = subgroupExclusiveAnd(anded); + ored = subgroupExclusiveOr(ored); + xored = subgroupExclusiveXor(ored); + + // clustered + added = subgroupClusteredAdd(added, 4u); + multiplied = subgroupClusteredMul(multiplied, 4u); + iadded = subgroupClusteredAdd(iadded, 4u); + imultiplied = subgroupClusteredMul(imultiplied, 4u); + lo = subgroupClusteredMin(lo, 4u); + hi = subgroupClusteredMax(hi, 4u); + ulo = subgroupClusteredMin(ulo, 4u); + uhi = subgroupClusteredMax(uhi, 4u); + slo = subgroupClusteredMin(slo, 4u); + shi = subgroupClusteredMax(shi, 4u); + anded = subgroupClusteredAnd(anded, 4u); + ored = subgroupClusteredOr(ored, 4u); + xored = subgroupClusteredXor(xored, 4u); + + anded_b = subgroupClusteredAnd(equal(anded, uvec4(2u)), 4u); + ored_b = subgroupClusteredOr(equal(ored, uvec4(3u)), 4u); + xored_b = subgroupClusteredXor(equal(xored, uvec4(4u)), 4u); + + // quad + vec4 swap_horiz = subgroupQuadSwapHorizontal(vec4(20.0)); + vec4 swap_vertical = subgroupQuadSwapVertical(vec4(20.0)); + vec4 swap_diagonal = subgroupQuadSwapDiagonal(vec4(20.0)); + vec4 quad_broadcast = subgroupQuadBroadcast(vec4(20.0), 3u); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp new file mode 100644 index 0000000000..421c767087 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fadd.vk.comp @@ -0,0 +1,61 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require + +layout(local_size_x = 128) in; + +layout(std430, binding = 0) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +}; + +layout(std430, binding = 1) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +}; + +void main() +{ + data_out_float = subgroupAdd(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupAdd(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupAdd(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupAdd(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupAdd(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupAdd(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupAdd(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupAdd(data_in_dvec4[gl_LocalInvocationID.x]); + + data_out_float = subgroupExclusiveAdd(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupExclusiveAdd(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupExclusiveAdd(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupExclusiveAdd(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupExclusiveAdd(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupExclusiveAdd(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupExclusiveAdd(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupExclusiveAdd(data_in_dvec4[gl_LocalInvocationID.x]); + + data_out_float = subgroupInclusiveAdd(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupInclusiveAdd(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupInclusiveAdd(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupInclusiveAdd(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupInclusiveAdd(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupInclusiveAdd(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupInclusiveAdd(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupInclusiveAdd(data_in_dvec4[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp new file mode 100644 index 0000000000..d1d9317438 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_fmul.vk.comp @@ -0,0 +1,61 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require + +layout(local_size_x = 128) in; + +layout(std430, binding = 0) buffer DATA_IN +{ + float data_in_float[128]; + vec2 data_in_vec2[128]; + vec3 data_in_vec3[128]; + vec4 data_in_vec4[128]; + double data_in_double[128]; + dvec2 data_in_dvec2[128]; + dvec3 data_in_dvec3[128]; + dvec4 data_in_dvec4[128]; +}; + +layout(std430, binding = 1) buffer DATA_OUT +{ + float data_out_float; + vec2 data_out_vec2; + vec3 data_out_vec3; + vec4 data_out_vec4; + double data_out_double; + dvec2 data_out_dvec2; + dvec3 data_out_dvec3; + dvec4 data_out_dvec4; +}; + +void main() +{ + data_out_float = subgroupMul(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupMul(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupMul(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupMul(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupMul(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupMul(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupMul(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupMul(data_in_dvec4[gl_LocalInvocationID.x]); + + data_out_float = subgroupExclusiveMul(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupExclusiveMul(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupExclusiveMul(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupExclusiveMul(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupExclusiveMul(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupExclusiveMul(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupExclusiveMul(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupExclusiveMul(data_in_dvec4[gl_LocalInvocationID.x]); + + data_out_float = subgroupInclusiveMul(data_in_float[gl_LocalInvocationID.x]); + data_out_vec2 = subgroupInclusiveMul(data_in_vec2[gl_LocalInvocationID.x]); + data_out_vec3 = subgroupInclusiveMul(data_in_vec3[gl_LocalInvocationID.x]); + data_out_vec4 = subgroupInclusiveMul(data_in_vec4[gl_LocalInvocationID.x]); + + data_out_double = subgroupInclusiveMul(data_in_double[gl_LocalInvocationID.x]); + data_out_dvec2 = subgroupInclusiveMul(data_in_dvec2[gl_LocalInvocationID.x]); + data_out_dvec3 = subgroupInclusiveMul(data_in_dvec3[gl_LocalInvocationID.x]); + data_out_dvec4 = subgroupInclusiveMul(data_in_dvec4[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp new file mode 100644 index 0000000000..eb62c66e8d --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_iadd.vk.comp @@ -0,0 +1,61 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require + +layout(local_size_x = 128) in; + +layout(std430, binding = 0) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +}; + +layout(std430, binding = 1) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +}; + +void main() +{ + data_out_int = subgroupAdd(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupAdd(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupAdd(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupAdd(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupAdd(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupAdd(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupAdd(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupAdd(data_in_uvec4[gl_LocalInvocationID.x]); + + data_out_int = subgroupExclusiveAdd(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupExclusiveAdd(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupExclusiveAdd(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupExclusiveAdd(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupExclusiveAdd(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupExclusiveAdd(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupExclusiveAdd(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupExclusiveAdd(data_in_uvec4[gl_LocalInvocationID.x]); + + data_out_int = subgroupInclusiveAdd(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupInclusiveAdd(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupInclusiveAdd(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupInclusiveAdd(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupInclusiveAdd(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupInclusiveAdd(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupInclusiveAdd(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupInclusiveAdd(data_in_uvec4[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp new file mode 100644 index 0000000000..b2cd0bcf8e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_arithmetic_imul.vk.comp @@ -0,0 +1,61 @@ +#version 450 +#extension GL_KHR_shader_subgroup_arithmetic : require + +layout(local_size_x = 128) in; + +layout(std430, binding = 0) buffer DATA_IN +{ + int data_in_int[128]; + ivec2 data_in_ivec2[128]; + ivec3 data_in_ivec3[128]; + ivec4 data_in_ivec4[128]; + uint data_in_uint[128]; + uvec2 data_in_uvec2[128]; + uvec3 data_in_uvec3[128]; + uvec4 data_in_uvec4[128]; +}; + +layout(std430, binding = 1) buffer DATA_OUT +{ + int data_out_int; + ivec2 data_out_ivec2; + ivec3 data_out_ivec3; + ivec4 data_out_ivec4; + uint data_out_uint; + uvec2 data_out_uvec2; + uvec3 data_out_uvec3; + uvec4 data_out_uvec4; +}; + +void main() +{ + data_out_int = subgroupMul(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupMul(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupMul(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupMul(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupMul(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupMul(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupMul(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupMul(data_in_uvec4[gl_LocalInvocationID.x]); + + data_out_int = subgroupExclusiveMul(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupExclusiveMul(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupExclusiveMul(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupExclusiveMul(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupExclusiveMul(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupExclusiveMul(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupExclusiveMul(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupExclusiveMul(data_in_uvec4[gl_LocalInvocationID.x]); + + data_out_int = subgroupInclusiveMul(data_in_int[gl_LocalInvocationID.x]); + data_out_ivec2 = subgroupInclusiveMul(data_in_ivec2[gl_LocalInvocationID.x]); + data_out_ivec3 = subgroupInclusiveMul(data_in_ivec3[gl_LocalInvocationID.x]); + data_out_ivec4 = subgroupInclusiveMul(data_in_ivec4[gl_LocalInvocationID.x]); + + data_out_uint = subgroupInclusiveMul(data_in_uint[gl_LocalInvocationID.x]); + data_out_uvec2 = subgroupInclusiveMul(data_in_uvec2[gl_LocalInvocationID.x]); + data_out_uvec3 = subgroupInclusiveMul(data_in_uvec3[gl_LocalInvocationID.x]); + data_out_uvec4 = subgroupInclusiveMul(data_in_uvec4[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp new file mode 100644 index 0000000000..833f43079b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/subgroups_basicvoteballot.vk.comp @@ -0,0 +1,49 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic : require +#extension GL_KHR_shader_subgroup_ballot : require +#extension GL_KHR_shader_subgroup_vote : require + +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float FragColor; +}; + +void main() +{ + // basic + FragColor = float(gl_NumSubgroups); + FragColor = float(gl_SubgroupID); + FragColor = float(gl_SubgroupSize); + FragColor = float(gl_SubgroupInvocationID); + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); + bool elected = subgroupElect(); + + // ballot + FragColor = float(gl_SubgroupEqMask); + FragColor = float(gl_SubgroupGeMask); + FragColor = float(gl_SubgroupGtMask); + FragColor = float(gl_SubgroupLeMask); + FragColor = float(gl_SubgroupLtMask); + vec4 broadcasted = subgroupBroadcast(vec4(10.0), 8u); + vec3 first = subgroupBroadcastFirst(vec3(20.0)); + uvec4 ballot_value = subgroupBallot(true); + bool inverse_ballot_value = subgroupInverseBallot(ballot_value); + bool bit_extracted = subgroupBallotBitExtract(uvec4(10u), 8u); + uint bit_count = subgroupBallotBitCount(ballot_value); + uint inclusive_bit_count = subgroupBallotInclusiveBitCount(ballot_value); + uint exclusive_bit_count = subgroupBallotExclusiveBitCount(ballot_value); + uint lsb = subgroupBallotFindLSB(ballot_value); + uint msb = subgroupBallotFindMSB(ballot_value); + + // vote + bool has_all = subgroupAll(true); + bool has_any = subgroupAny(true); + bool has_equal_bool = subgroupAllEqual(true); + bool has_equal_T = subgroupAllEqual(uvec3(5u)); +} \ No newline at end of file diff --git a/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-cast-vector.comp b/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-cast-vector.comp new file mode 100644 index 0000000000..c3e0922a16 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-cast-vector.comp @@ -0,0 +1,14 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + vec3 a; + vec3 b; +}; + +void main() +{ + bvec3 c = lessThan(b, vec3(1.0)); + a = mix(vec3(1, 0, 0), vec3(0, 0, 1), c); +} diff --git a/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-matrix.spv14.comp b/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-matrix.spv14.comp new file mode 100644 index 0000000000..5ffcc3f3a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/comp/trivial-select-matrix.spv14.comp @@ -0,0 +1,16 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0) buffer A +{ + mat3 a; + float b; +}; + +void main() +{ + // Scalar to Matrix + bool c = b < 1.0; + a = c ? mat3(vec3(1), vec3(1), vec3(1)) : mat3(vec3(0), vec3(0), vec3(0)); + a = c ? mat3(1) : mat3(0); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/16bit-constants.invalid.frag b/third_party/spirv-cross/shaders-no-opt/frag/16bit-constants.invalid.frag new file mode 100644 index 0000000000..c53091b5b9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/16bit-constants.invalid.frag @@ -0,0 +1,14 @@ +#version 450 core + +#extension GL_AMD_gpu_shader_int16 : require +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) out float16_t foo; +layout(location = 1) out int16_t bar; +layout(location = 2) out uint16_t baz; + +void main() { + foo = 1.0hf; + bar = 2s; + baz = 3us; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/fp16.invalid.desktop.frag b/third_party/spirv-cross/shaders-no-opt/frag/fp16.invalid.desktop.frag new file mode 100644 index 0000000000..f3517a92f8 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/fp16.invalid.desktop.frag @@ -0,0 +1,151 @@ +#version 450 +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0) in float16_t v1; +layout(location = 1) in f16vec2 v2; +layout(location = 2) in f16vec3 v3; +layout(location = 3) in f16vec4 v4; + +layout(location = 0) out float o1; +layout(location = 1) out vec2 o2; +layout(location = 2) out vec3 o3; +layout(location = 3) out vec4 o4; + +f16mat2 test_mat2(f16vec2 a, f16vec2 b, f16vec2 c, f16vec2 d) +{ + return f16mat2(a, b) * f16mat2(c, d); +} + +f16mat3 test_mat3(f16vec3 a, f16vec3 b, f16vec3 c, f16vec3 d, f16vec3 e, f16vec3 f) +{ + return f16mat3(a, b, c) * f16mat3(d, e, f); +} + +void test_constants() +{ + float16_t a = 1.0hf; + float16_t b = 1.5hf; + float16_t c = -1.5hf; // Negatives + float16_t d = (0.0hf / 0.0hf); // NaN + float16_t e = (1.0hf / 0.0hf); // +Inf + float16_t f = (-1.0hf / 0.0hf); // -Inf + float16_t g = 1014.0hf; // Large. + float16_t h = 0.000001hf; // Denormal +} + +float16_t test_result() +{ + return 1.0hf; +} + +void test_conversions() +{ + float16_t one = test_result(); + int a = int(one); + uint b = uint(one); + bool c = bool(one); + float d = float(one); + double e = double(one); + float16_t a2 = float16_t(a); + float16_t b2 = float16_t(b); + float16_t c2 = float16_t(c); + float16_t d2 = float16_t(d); + float16_t e2 = float16_t(e); +} + +void test_builtins() +{ + f16vec4 res; + res = radians(v4); + res = degrees(v4); + res = sin(v4); + res = cos(v4); + res = tan(v4); + res = asin(v4); + res = atan(v4, v3.xyzz); + res = atan(v4); + res = sinh(v4); + res = cosh(v4); + res = tanh(v4); + res = asinh(v4); + res = acosh(v4); + res = atanh(v4); + res = pow(v4, v4); + res = exp(v4); + res = log(v4); + res = exp2(v4); + res = log2(v4); + res = sqrt(v4); + res = inversesqrt(v4); + res = abs(v4); + res = sign(v4); + res = floor(v4); + res = trunc(v4); + res = round(v4); + res = roundEven(v4); + res = ceil(v4); + res = fract(v4); + res = mod(v4, v4); + f16vec4 tmp; + res = modf(v4, tmp); + res = min(v4, v4); + res = max(v4, v4); + res = clamp(v4, v4, v4); + res = mix(v4, v4, v4); + res = mix(v4, v4, lessThan(v4, v4)); + res = step(v4, v4); + res = smoothstep(v4, v4, v4); + + bvec4 btmp = isnan(v4); + btmp = isinf(v4); + res = fma(v4, v4, v4); + + ivec4 itmp; + res = frexp(v4, itmp); + res = ldexp(res, itmp); + + uint pack0 = packFloat2x16(v4.xy); + uint pack1 = packFloat2x16(v4.zw); + res = f16vec4(unpackFloat2x16(pack0), unpackFloat2x16(pack1)); + + float16_t t0 = length(v4); + t0 = distance(v4, v4); + t0 = dot(v4, v4); + f16vec3 res3 = cross(v3, v3); + res = normalize(v4); + res = faceforward(v4, v4, v4); + res = reflect(v4, v4); + res = refract(v4, v4, v1); + + btmp = lessThan(v4, v4); + btmp = lessThanEqual(v4, v4); + btmp = greaterThan(v4, v4); + btmp = greaterThanEqual(v4, v4); + btmp = equal(v4, v4); + btmp = notEqual(v4, v4); + + res = dFdx(v4); + res = dFdy(v4); + res = dFdxFine(v4); + res = dFdyFine(v4); + res = dFdxCoarse(v4); + res = dFdyCoarse(v4); + res = fwidth(v4); + res = fwidthFine(v4); + res = fwidthCoarse(v4); + + //res = interpolateAtCentroid(v4); + //res = interpolateAtSample(v4, 0); + //res = interpolateAtOffset(v4, f16vec2(0.1hf)); +} + +void main() +{ + // Basic matrix tests. + f16mat2 m0 = test_mat2(v2, v2, v3.xy, v3.xy); + f16mat3 m1 = test_mat3(v3, v3, v3, v4.xyz, v4.xyz, v4.yzw); + + test_constants(); + test_conversions(); + test_builtins(); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/frag-fully-covered.frag b/third_party/spirv-cross/shaders-no-opt/frag/frag-fully-covered.frag new file mode 100644 index 0000000000..95cc4fc975 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/frag-fully-covered.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_NV_conservative_raster_underestimation : require + +layout(location = 0) out vec4 FragColor; + +void main() +{ + if (!gl_FragFullyCoveredNV) + discard; + FragColor = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag b/third_party/spirv-cross/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag new file mode 100644 index 0000000000..a3f03664ca --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/fragmentMaskFetch_subpassInput.vk.nocompat.invalid.frag @@ -0,0 +1,10 @@ +#version 450 +#extension GL_AMD_shader_fragment_mask : require + +layout(input_attachment_index = 0, binding = 0) uniform subpassInputMS t; + +void main () +{ + vec4 test2 = fragmentFetchAMD(t, 4); + uint testi2 = fragmentMaskFetchAMD(t); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/fs.invalid.frag b/third_party/spirv-cross/shaders-no-opt/frag/fs.invalid.frag new file mode 100644 index 0000000000..1ff82de06e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/fs.invalid.frag @@ -0,0 +1,14 @@ +#version 450 +#extension GL_AMD_shader_fragment_mask : require +#extension GL_AMD_shader_explicit_vertex_parameter : require + +layout(binding = 0) uniform sampler2DMS texture1; +layout(location = 0) __explicitInterpAMD in vec4 vary; + +void main() +{ + uint testi1 = fragmentMaskFetchAMD(texture1, ivec2(0)); + vec4 test1 = fragmentFetchAMD(texture1, ivec2(1), 2); + + vec4 pos = interpolateAtVertexAMD(vary, 0u); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/image-gather.frag b/third_party/spirv-cross/shaders-no-opt/frag/image-gather.frag new file mode 100644 index 0000000000..b492cfbe90 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/image-gather.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(set = 0, binding = 1) uniform sampler2DShadow uSampShadow; +layout(location = 0) in vec3 vUV; + +void main() +{ + FragColor = textureGather(uSamp, vUV.xy, 0); + FragColor += textureGather(uSamp, vUV.xy, 1); + FragColor += textureGather(uSampShadow, vUV.xy, vUV.z); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/modf-non-function-purity-analysis.frag b/third_party/spirv-cross/shaders-no-opt/frag/modf-non-function-purity-analysis.frag new file mode 100644 index 0000000000..c1f1a1266f --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/modf-non-function-purity-analysis.frag @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +vec4 modf_inner() +{ + return modf(v, vo1); +} + +void main() +{ + vo0 = modf_inner(); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag b/third_party/spirv-cross/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag new file mode 100644 index 0000000000..24b2ff1d2a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/multi-dimensional.desktop.invalid.flatten_dim.frag @@ -0,0 +1,18 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTextures[2][3][1]; +layout(location = 0) flat in int vIndex; +layout(location = 1) in vec2 vUV; + +void main() +{ + vec4 values3[2][3][1]; + + for (int z = 0; z < 2; z++) + for (int y = 0; y < 3; y++) + for (int x = 0; x < 1; x++) + values3[z][y][x] = texture(uTextures[z][y][x], vUV); + + FragColor = values3[1][2][0] + values3[0][2][0] + values3[vIndex + 1][2][vIndex]; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag b/third_party/spirv-cross/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag new file mode 100644 index 0000000000..452aa953a4 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/nonuniform-constructor.vk.nocompat.frag @@ -0,0 +1,14 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(location = 1) flat in int vIndex; + +layout(set = 0, binding = 0) uniform texture2D uTex[]; +layout(set = 1, binding = 0) uniform sampler Immut; + +void main() +{ + FragColor = texture(nonuniformEXT(sampler2D(uTex[vIndex], Immut)), vUV); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag b/third_party/spirv-cross/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag new file mode 100644 index 0000000000..59079fe58b --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/pixel-interlock-simple-callstack.frag @@ -0,0 +1,31 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require +layout(pixel_interlock_ordered) in; + +layout(set = 0, binding = 0, std430) buffer SSBO0 +{ + uint values0[]; +}; + +layout(set = 0, binding = 1, std430) buffer SSBO1 +{ + uint values1[]; +}; + +void callee2() +{ + values1[int(gl_FragCoord.x)] += 1; +} + +void callee() +{ + values0[int(gl_FragCoord.x)] += 1; + callee2(); +} + +void main() +{ + beginInvocationInterlockARB(); + callee(); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag b/third_party/spirv-cross/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag new file mode 100644 index 0000000000..faa20fa658 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/scalar-block-layout-ubo-std430.vk.nocompat.invalid.frag @@ -0,0 +1,23 @@ +#version 450 +#extension GL_EXT_scalar_block_layout : require + +layout(std430, binding = 0) uniform UBO +{ + float a[1024]; + vec3 b[2]; +}; + +layout(std430, binding = 1) uniform UBOEnhancedLayout +{ + float c[1024]; + vec3 d[2]; + layout(offset = 10000) float e; +}; + +layout(location = 0) flat in int vIndex; +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = a[vIndex] + c[vIndex] + e; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag b/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag new file mode 100644 index 0000000000..880e67e5de --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-clamp.desktop.frag @@ -0,0 +1,23 @@ +#version 450 +#extension GL_ARB_sparse_texture2 : require +#extension GL_ARB_sparse_texture_clamp : require + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + vec4 texel; + int code; + + code = sparseTextureClampARB(uSamp, vUV, 1.0, texel, 2.0); + texel = textureClampARB(uSamp, vUV, 1.0, 2.0); + code = sparseTextureOffsetClampARB(uSamp, vUV, ivec2(1, 2), 1.0, texel, 2.0); + texel = textureOffsetClampARB(uSamp, vUV, ivec2(1, 2), 1.0, 2.0); + code = sparseTextureGradClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), 1.0, texel); + texel = textureGradClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), 1.0); + code = sparseTextureGradOffsetClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), ivec2(-1, -2), 1.0, texel); + texel = textureGradOffsetClampARB(uSamp, vUV, vec2(1.0), vec2(2.0), ivec2(-1, -2), 1.0); +} + diff --git a/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag b/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag new file mode 100644 index 0000000000..67cc5b42a9 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/sparse-texture-feedback.desktop.frag @@ -0,0 +1,31 @@ +#version 450 +#extension GL_ARB_sparse_texture2 : require +#extension GL_ARB_sparse_texture_clamp : require + +layout(set = 0, binding = 0) uniform sampler2D uSamp; +layout(set = 0, binding = 1) uniform sampler2DMS uSampMS; +layout(set = 0, binding = 2, rgba8) uniform image2D uImage; +layout(set = 0, binding = 3, rgba8) uniform image2DMS uImageMS; +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; + +void main() +{ + vec4 texel; + bool ret; + + ret = sparseTexelsResidentARB(sparseTextureARB(uSamp, vUV, texel)); + ret = sparseTexelsResidentARB(sparseTextureARB(uSamp, vUV, texel, 1.1)); + ret = sparseTexelsResidentARB(sparseTextureLodARB(uSamp, vUV, 1.0, texel)); + ret = sparseTexelsResidentARB(sparseTextureOffsetARB(uSamp, vUV, ivec2(1, 1), texel)); + ret = sparseTexelsResidentARB(sparseTextureOffsetARB(uSamp, vUV, ivec2(2, 2), texel, 0.5)); + ret = sparseTexelsResidentARB(sparseTexelFetchARB(uSamp, ivec2(vUV), 1, texel)); + ret = sparseTexelsResidentARB(sparseTexelFetchARB(uSampMS, ivec2(vUV), 2, texel)); + ret = sparseTexelsResidentARB(sparseTexelFetchOffsetARB(uSamp, ivec2(vUV), 1, ivec2(2, 3), texel)); + ret = sparseTexelsResidentARB(sparseTextureLodOffsetARB(uSamp, vUV, 1.5, ivec2(2, 3), texel)); + ret = sparseTexelsResidentARB(sparseTextureGradARB(uSamp, vUV, vec2(1.0), vec2(3.0), texel)); + ret = sparseTexelsResidentARB(sparseTextureGradOffsetARB(uSamp, vUV, vec2(1.0), vec2(3.0), ivec2(-2, -3), texel)); + ret = sparseTexelsResidentARB(sparseTextureClampARB(uSamp, vUV, 4.0, texel)); + ret = sparseTexelsResidentARB(sparseImageLoadARB(uImage, ivec2(vUV), texel)); + ret = sparseTexelsResidentARB(sparseImageLoadARB(uImageMS, ivec2(vUV), 1, texel)); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag new file mode 100644 index 0000000000..621457a14a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec3 FragColor; +layout(location = 1) out vec4 FragColor2; + +void main() +{ + FragColor.rgb = subpassLoad(uSubpass0).rgb + subpassLoad(uSubpass1).rgb; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag new file mode 100644 index 0000000000..621457a14a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.framebuffer-fetch-noncoherent.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec3 FragColor; +layout(location = 1) out vec4 FragColor2; + +void main() +{ + FragColor.rgb = subpassLoad(uSubpass0).rgb + subpassLoad(uSubpass1).rgb; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag new file mode 100644 index 0000000000..621457a14a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec3 FragColor; +layout(location = 1) out vec4 FragColor2; + +void main() +{ + FragColor.rgb = subpassLoad(uSubpass0).rgb + subpassLoad(uSubpass1).rgb; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag new file mode 100644 index 0000000000..621457a14a --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/subpass-input.framebuffer-fetch.nocompat.legacy.framebuffer-fetch-noncoherent.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec3 FragColor; +layout(location = 1) out vec4 FragColor2; + +void main() +{ + FragColor.rgb = subpassLoad(uSubpass0).rgb + subpassLoad(uSubpass1).rgb; +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-offsets.frag b/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-offsets.frag new file mode 100644 index 0000000000..52d7909746 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-offsets.frag @@ -0,0 +1,14 @@ +#version 460 core +#extension GL_ARB_separate_shader_objects : enable + +layout(location = 0) in vec2 inUv; + +layout(location = 0) out vec4 outColor; + +layout(set=0, binding=0) uniform sampler2D Image0; + +void main(void) +{ + const ivec2 offs[4] = {ivec2(0,0), ivec2(1,0), ivec2(1,1), ivec2(0,1)}; + outColor = textureGatherOffsets(Image0, inUv, offs); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-uint-component.asm.frag b/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-uint-component.asm.frag new file mode 100644 index 0000000000..b4d9509ab4 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/texture-gather-uint-component.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 10 +; Bound: 22 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSamp "uSamp" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uSamp DescriptorSet 0 + OpDecorate %uSamp Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSamp = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uSamp + %18 = OpLoad %v2float %vUV + %21 = OpImageGather %v4float %14 %18 %int_1 + OpStore %FragColor %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.es.frag b/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.es.frag new file mode 100644 index 0000000000..1ad99932b6 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.es.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler1D uSamp; +layout(set = 0, binding = 1) uniform sampler1DShadow uSampShadow; +layout(set = 0, binding = 2) uniform sampler1DArray uSampArray; +layout(set = 0, binding = 3) uniform sampler1DArrayShadow uSampArrayShadow; +layout(set = 0, binding = 4, r32f) uniform image1D uImage; +layout(location = 0) in vec4 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + // 1D + FragColor = texture(uSamp, vUV.x); + FragColor += textureProj(uSamp, vUV.xy); + FragColor += texelFetch(uSamp, int(vUV.x), 0); + + // 1D Shadow + FragColor += texture(uSampShadow, vUV.xyz); + FragColor += textureProj(uSampShadow, vUV); + + // 1D Array + FragColor = texture(uSampArray, vUV.xy); + FragColor += texelFetch(uSampArray, ivec2(vUV.xy), 0); + + // 1D Array Shadow + FragColor += texture(uSampArrayShadow, vUV.xyz); + + // 1D images + FragColor += imageLoad(uImage, int(vUV.x)); + imageStore(uImage, int(vUV.x), FragColor); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.legacy.frag b/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.legacy.frag new file mode 100644 index 0000000000..9ebd81e333 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/texture1d-emulation.legacy.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(set = 0, binding = 0) uniform sampler1D uSamp; +layout(set = 0, binding = 1) uniform sampler1DShadow uSampShadow; +layout(location = 0) in vec4 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + // 1D + FragColor = texture(uSamp, vUV.x); + FragColor += textureProj(uSamp, vUV.xy); + + // 1D Shadow + FragColor += texture(uSampShadow, vUV.xyz); + FragColor += textureProj(uSampShadow, vUV); +} diff --git a/third_party/spirv-cross/shaders-no-opt/frag/variables.zero-initialize.frag b/third_party/spirv-cross/shaders-no-opt/frag/variables.zero-initialize.frag new file mode 100644 index 0000000000..41da8001f4 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/frag/variables.zero-initialize.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +int uninit_int; +ivec4 uninit_vector; +mat4 uninit_matrix; + +struct Foo { int a; }; +Foo uninit_foo; + +void main() +{ + int uninit_function_int; + if (vColor.x > 10.0) + uninit_function_int = 10; + else + uninit_function_int = 20; + FragColor = vColor; +} diff --git a/third_party/spirv-cross/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag b/third_party/spirv-cross/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag new file mode 100644 index 0000000000..d2bd15a978 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/legacy/frag/switch-single-case-multiple-exit-cfg.legacy.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %52 = OpUndef %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpSwitch %int_0 %8 + %8 = OpLabel + %17 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %18 = OpLoad %float %17 + %22 = OpFOrdNotEqual %bool %18 %18 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpBranch %9 + %24 = OpLabel + %33 = OpCompositeExtract %float %52 1 + %51 = OpCompositeInsert %v2float %33 %52 1 + OpBranch %9 + %9 = OpLabel + %53 = OpPhi %v2float %52 %23 %51 %24 + %42 = OpCompositeExtract %float %53 0 + %43 = OpCompositeExtract %float %53 1 + %48 = OpCompositeConstruct %v4float %42 %43 %float_1 %float_1 + OpStore %_GLF_color %48 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task b/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task new file mode 100644 index 0000000000..3fcb714711 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic-2.vk.spv14.nocompat.task @@ -0,0 +1,35 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 4, local_size_y = 3, local_size_z = 2) in; + +struct Payload +{ + float v[3]; +}; +taskPayloadSharedEXT Payload p; +shared float vs[24]; + +void main() +{ + vs[gl_LocalInvocationIndex] = 10.0; + barrier(); + if (gl_LocalInvocationIndex < 12) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 12]; + barrier(); + if (gl_LocalInvocationIndex < 6) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 6]; + barrier(); + if (gl_LocalInvocationIndex < 3) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 3]; + barrier(); + + p.v[gl_LocalInvocationIndex] = vs[gl_LocalInvocationIndex]; + if (vs[5] > 20.0) + { + EmitMeshTasksEXT(int(vs[4]), int(vs[6]), int(vs[8])); + } + else + { + EmitMeshTasksEXT(int(vs[6]), 10, 50u); + } +} diff --git a/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task b/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task new file mode 100644 index 0000000000..6e97160309 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/task/task-shader-basic.vk.spv14.nocompat.task @@ -0,0 +1,28 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 4, local_size_y = 3, local_size_z = 2) in; + +struct Payload +{ + float v[3]; +}; +taskPayloadSharedEXT Payload p; +shared float vs[24]; + +void main() +{ + vs[gl_LocalInvocationIndex] = 10.0; + barrier(); + if (gl_LocalInvocationIndex < 12) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 12]; + barrier(); + if (gl_LocalInvocationIndex < 6) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 6]; + barrier(); + if (gl_LocalInvocationIndex < 3) + vs[gl_LocalInvocationIndex] += vs[gl_LocalInvocationIndex + 3]; + barrier(); + + p.v[gl_LocalInvocationIndex] = vs[gl_LocalInvocationIndex]; + EmitMeshTasksEXT(int(vs[4]), int(vs[6]), int(vs[8])); +} diff --git a/third_party/spirv-cross/shaders-no-opt/vert/io-blocks.force-flattened-io.vert b/third_party/spirv-cross/shaders-no-opt/vert/io-blocks.force-flattened-io.vert new file mode 100644 index 0000000000..e308a9f289 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vert/io-blocks.force-flattened-io.vert @@ -0,0 +1,25 @@ +#version 450 + +struct Foo +{ + vec4 bar[2]; + vec4 baz[2]; +}; + +layout(location = 0) out Vertex +{ + Foo foo; + Foo foo2; +}; + +layout(location = 8) out Foo foo3; + +void main() +{ + foo.bar[0] = vec4(1.0); + foo.baz[1] = vec4(2.0); + foo2.bar[0] = vec4(3.0); + foo2.baz[1] = vec4(4.0); + foo3.bar[0] = vec4(5.0); + foo3.baz[1] = vec4(6.0); +} diff --git a/third_party/spirv-cross/shaders-no-opt/vert/pass-array-by-value.vert b/third_party/spirv-cross/shaders-no-opt/vert/pass-array-by-value.vert new file mode 100644 index 0000000000..2c142a7810 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vert/pass-array-by-value.vert @@ -0,0 +1,26 @@ +#version 310 es + +layout(location = 0) in int Index1; +layout(location = 1) in int Index2; + +vec4 consume_constant_arrays2(const vec4 positions[4], const vec4 positions2[4]) +{ + return positions[Index1] + positions2[Index2]; +} + +vec4 consume_constant_arrays(const vec4 positions[4], const vec4 positions2[4]) +{ + return consume_constant_arrays2(positions, positions2); +} + +const vec4 LUT1[] = vec4[](vec4(0.0), vec4(1.0), vec4(2.0), vec4(3.0)); + +void main() +{ + vec4 LUT2[4]; + LUT2[0] = vec4(10.0); + LUT2[1] = vec4(11.0); + LUT2[2] = vec4(12.0); + LUT2[3] = vec4(13.0); + gl_Position = consume_constant_arrays(LUT1, LUT2); +} diff --git a/third_party/spirv-cross/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag new file mode 100644 index 0000000000..8aee6d3590 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/shading-rate.vk.nocompat.frag @@ -0,0 +1,9 @@ +#version 450 +#extension GL_EXT_fragment_shading_rate : require + +layout(location = 0) out uint FragColor; + +void main() +{ + FragColor = gl_ShadingRateEXT; +} diff --git a/third_party/spirv-cross/shaders-no-opt/vulkan/frag/spec-constant.vk.frag b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..2002c1272e --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/spec-constant.vk.frag @@ -0,0 +1,77 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(constant_id = 1) const float a = 1.0; +layout(constant_id = 2) const float b = 2.0; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; +// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. + +struct Foo +{ + float elems[d + 2]; +}; + +void main() +{ + float t0 = a; + float t1 = b; + + uint c0 = uint(c); // OpIAdd with different types. + // FConvert, float-to-double. + int c1 = -c; // SNegate + int c2 = ~c; // OpNot + int c3 = c + d; // OpIAdd + int c4 = c - d; // OpISub + int c5 = c * d; // OpIMul + int c6 = c / d; // OpSDiv + uint c7 = e / f; // OpUDiv + int c8 = c % d; // OpSMod + uint c9 = e % f; // OpUMod + // TODO: OpSRem, any way to access this in GLSL? + int c10 = c >> d; // OpShiftRightArithmetic + uint c11 = e >> f; // OpShiftRightLogical + int c12 = c << d; // OpShiftLeftLogical + int c13 = c | d; // OpBitwiseOr + int c14 = c ^ d; // OpBitwiseXor + int c15 = c & d; // OpBitwiseAnd + // VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. + bool c16 = g || h; // OpLogicalOr + bool c17 = g && h; // OpLogicalAnd + bool c18 = !g; // OpLogicalNot + bool c19 = g == h; // OpLogicalEqual + bool c20 = g != h; // OpLogicalNotEqual + // OpSelect not testable atm. + bool c21 = c == d; // OpIEqual + bool c22 = c != d; // OpINotEqual + bool c23 = c < d; // OpSLessThan + bool c24 = e < f; // OpULessThan + bool c25 = c > d; // OpSGreaterThan + bool c26 = e > f; // OpUGreaterThan + bool c27 = c <= d; // OpSLessThanEqual + bool c28 = e <= f; // OpULessThanEqual + bool c29 = c >= d; // OpSGreaterThanEqual + bool c30 = e >= f; // OpUGreaterThanEqual + // OpQuantizeToF16 not testable atm. + + int c31 = c8 + c3; + + int c32 = int(e); // OpIAdd with different types. + bool c33 = bool(c); // int -> bool + bool c34 = bool(e); // uint -> bool + int c35 = int(g); // bool -> int + uint c36 = uint(g); // bool -> uint + float c37 = float(g); // bool -> float + + // Flexible sized arrays with spec constants and spec constant ops. + float vec0[c + 3][8]; + float vec1[c + 2]; + + Foo foo; + FragColor = vec4(t0 + t1) + vec0[0][0] + vec1[0] + foo.elems[c]; +} diff --git a/third_party/spirv-cross/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag new file mode 100644 index 0000000000..6d3987a886 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/ubo-offset-out-of-order.vk.nocompat.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; + +layout(std140, binding = 0) uniform UBO +{ + layout(offset = 16) mat4 m; + layout(offset = 0) vec4 v; +}; + +layout(location = 0) in vec4 vColor; + +void main() +{ + FragColor = m * vColor + v; +} diff --git a/third_party/spirv-cross/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag new file mode 100644 index 0000000000..9a8d9d20b2 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vulkan/frag/volatile-helper-invocation.vk.nocompat.spv16.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = float(gl_HelperInvocation); + demote; + FragColor = float(gl_HelperInvocation); +} diff --git a/third_party/spirv-cross/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert b/third_party/spirv-cross/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert new file mode 100644 index 0000000000..95ac8d6445 --- /dev/null +++ b/third_party/spirv-cross/shaders-no-opt/vulkan/vert/primitive-shading-rate.vk.nocompat.vert @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_fragment_shading_rate : require + +void main() +{ + gl_PrimitiveShadingRateEXT = 3; + gl_Position = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders-other/README.md b/third_party/spirv-cross/shaders-other/README.md new file mode 100644 index 0000000000..6d454813eb --- /dev/null +++ b/third_party/spirv-cross/shaders-other/README.md @@ -0,0 +1,4 @@ +These shaders are not actually run yet as part of any test suite, +but are kept here because they have been used to manually test various aspects of SPIRV-Cross in the past. + +These would ideally be part of the test suite in some way. diff --git a/third_party/spirv-cross/shaders-other/aliased-entry-point-names.asm b/third_party/spirv-cross/shaders-other/aliased-entry-point-names.asm new file mode 100644 index 0000000000..d60cf3039c --- /dev/null +++ b/third_party/spirv-cross/shaders-other/aliased-entry-point-names.asm @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpEntryPoint Vertex %main2 "main2" %_ + OpEntryPoint Fragment %main3 "main" %FragColor + OpEntryPoint Fragment %main4 "main2" %FragColor + OpSource GLSL 450 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %FragColor Location 0 + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v4floatptr = OpTypePointer Output %v4float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %FragColor = OpVariable %v4floatptr Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_2 = OpConstant %float 2 + %18 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %6 = OpLabel + %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %20 %18 + OpReturn + OpFunctionEnd + %main3 = OpFunction %void None %3 + %7 = OpLabel + OpStore %FragColor %17 + OpReturn + OpFunctionEnd + %main4 = OpFunction %void None %3 + %8 = OpLabel + OpStore %FragColor %18 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/aliased-entry-point-names.asm.multi b/third_party/spirv-cross/shaders-reflection/asm/aliased-entry-point-names.asm.multi new file mode 100644 index 0000000000..4a8e60efdb --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/aliased-entry-point-names.asm.multi @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpEntryPoint Vertex %main2 "maim" %_ + OpEntryPoint Fragment %main3 "main" %FragColor + OpEntryPoint Fragment %main4 "maim" %FragColor + OpSource GLSL 450 + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %FragColor Location 0 + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v4floatptr = OpTypePointer Output %v4float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %FragColor = OpVariable %v4floatptr Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_2 = OpConstant %float 2 + %18 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %3 + %6 = OpLabel + %20 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %20 %18 + OpReturn + OpFunctionEnd + %main3 = OpFunction %void None %3 + %7 = OpLabel + OpStore %FragColor %17 + OpReturn + OpFunctionEnd + %main4 = OpFunction %void None %3 + %8 = OpLabel + OpStore %FragColor %18 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp new file mode 100644 index 0000000000..caca050ad3 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/comp/pointer-to-array-of-physical-pointer.asm.comp @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 8 +; Bound: 17 +; Schema: 0 + OpCapability Shader + OpCapability PhysicalStorageBufferAddresses + OpExtension "SPV_EXT_physical_storage_buffer" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel PhysicalStorageBuffer64 GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 460 + OpSourceExtension "GL_EXT_buffer_reference" + OpSourceExtension "GL_EXT_buffer_reference2" + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_int64" + OpName %main "main" + OpName %Params "Params" + OpMemberName %Params 0 "x" + OpMemberName %Params 1 "y" + OpName %IntBuf "IntBuf" + OpMemberName %IntBuf 0 "v" + OpName %_ "" + OpDecorate %_arr_7_uint_3 ArrayStride 16 + OpMemberDecorate %Params 0 Offset 0 + OpMemberDecorate %Params 1 Offset 16 + OpDecorate %Params Block + OpMemberDecorate %IntBuf 0 Offset 0 + OpDecorate %IntBuf Block + OpDecorate %_arr__ptr_PhysicalStorageBuffer_IntBuf_uint_3 ArrayStride 16 + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + OpTypeForwardPointer %_ptr_PhysicalStorageBuffer_IntBuf PhysicalStorageBuffer + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_7_uint_3 = OpTypeArray %_ptr_PhysicalStorageBuffer_IntBuf %uint_3 +%ptr_array_ptr = OpTypePointer PhysicalStorageBuffer %_arr_7_uint_3 + %Params = OpTypeStruct %float %ptr_array_ptr + %int = OpTypeInt 32 1 + %IntBuf = OpTypeStruct %int +%_ptr_PhysicalStorageBuffer_IntBuf = OpTypePointer PhysicalStorageBuffer %IntBuf +%_arr__ptr_PhysicalStorageBuffer_IntBuf_uint_3 = OpTypeArray %_ptr_PhysicalStorageBuffer_IntBuf %uint_3 +%_ptr_Uniform_Params = OpTypePointer Uniform %Params + %_ = OpVariable %_ptr_Uniform_Params Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp new file mode 100644 index 0000000000..5785320572 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-1.asm.comp @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + 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 %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "a" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %_ = OpVariable %_ptr_Uniform_SSBO0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %25 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %25 %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp new file mode 100644 index 0000000000..bfb627b5df --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-glsl-ssbo-2.asm.comp @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + 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 %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "a" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "b" + OpName %__0 "" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %_ = OpVariable %_ptr_Uniform_SSBO0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %SSBO1 = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %__0 = OpVariable %_ptr_Uniform_SSBO1 Uniform + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %25 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %25 %23 + %34 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %21 + OpStore %34 %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp new file mode 100644 index 0000000000..06d9f89651 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-1.asm.comp @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %threadId + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %UAV0 "UAV0" + OpMemberName %UAV0 0 "@data" + OpName %UAV0_0 "UAV0" + OpName %threadId "threadId" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %UAV0 0 Offset 0 + OpDecorate %UAV0 BufferBlock + OpDecorate %UAV0_0 DescriptorSet 0 + OpDecorate %UAV0_0 Binding 0 + OpDecorate %threadId BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %UAV0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_UAV0 = OpTypePointer Uniform %UAV0 + %UAV0_0 = OpVariable %_ptr_Uniform_UAV0 Uniform + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %threadId = OpVariable %_ptr_Input_v3int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %38 = OpLoad %v3int %threadId + %43 = OpCompositeExtract %int %38 0 + %44 = OpAccessChain %_ptr_Uniform_v4float %UAV0_0 %int_0 %43 + OpStore %44 %26 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp new file mode 100644 index 0000000000..510957c1b7 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-hlsl-uav-2.asm.comp @@ -0,0 +1,54 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %threadId + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %UAV0 "UAV0" + OpMemberName %UAV0 0 "@data" + OpName %UAV0_0 "UAV0" + OpName %UAV1 "UAV1" + OpName %threadId "threadId" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %UAV0 0 Offset 0 + OpDecorate %UAV0 BufferBlock + OpDecorate %UAV0_0 DescriptorSet 0 + OpDecorate %UAV0_0 Binding 0 + OpDecorate %UAV1 DescriptorSet 0 + OpDecorate %UAV1 Binding 1 + OpDecorate %threadId BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %UAV0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_UAV0 = OpTypePointer Uniform %UAV0 + %UAV0_0 = OpVariable %_ptr_Uniform_UAV0 Uniform + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %UAV1 = OpVariable %_ptr_Uniform_UAV0 Uniform + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %threadId = OpVariable %_ptr_Input_v3int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %38 = OpLoad %v3int %threadId + %43 = OpCompositeExtract %int %38 0 + %44 = OpAccessChain %_ptr_Uniform_v4float %UAV0_0 %int_0 %43 + OpStore %44 %26 + %47 = OpAccessChain %_ptr_Uniform_v4float %UAV1 %int_0 %43 + OpStore %47 %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp new file mode 100644 index 0000000000..8a6b6c63c6 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-1.asm.comp @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %_ + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "a" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %_ = OpVariable %_ptr_Uniform_SSBO0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %25 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %25 %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp new file mode 100644 index 0000000000..8eaffb3348 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-ssbo-2.asm.comp @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "a" + OpName %_ "" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "b" + OpName %__0 "" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %SSBO0 0 Offset 0 + OpDecorate %SSBO0 BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_runtimearr_v4float_0 ArrayStride 16 + OpMemberDecorate %SSBO1 0 Offset 0 + OpDecorate %SSBO1 BufferBlock + OpDecorate %__0 DescriptorSet 0 + OpDecorate %__0 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %SSBO0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %_ = OpVariable %_ptr_Uniform_SSBO0 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %float_1 = OpConstant %float 1 + %23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float + %SSBO1 = OpTypeStruct %_runtimearr_v4float_0 +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %__0 = OpVariable %_ptr_Uniform_SSBO1 Uniform + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %21 = OpLoad %uint %20 + %25 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %21 + OpStore %25 %23 + %34 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %21 + OpStore %34 %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-1.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-1.asm.comp new file mode 100644 index 0000000000..ef4fa8eb78 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-1.asm.comp @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %threadId + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %UAV0 "UAV0" + OpMemberName %UAV0 0 "@data" + OpName %UAV0_0 "UAV0" + OpName %threadId "threadId" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %UAV0 0 Offset 0 + OpDecorate %UAV0 BufferBlock + OpDecorate %UAV0_0 DescriptorSet 0 + OpDecorate %UAV0_0 Binding 0 + OpDecorate %threadId BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %UAV0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_UAV0 = OpTypePointer Uniform %UAV0 + %UAV0_0 = OpVariable %_ptr_Uniform_UAV0 Uniform + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %threadId = OpVariable %_ptr_Input_v3int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %38 = OpLoad %v3int %threadId + %43 = OpCompositeExtract %int %38 0 + %44 = OpAccessChain %_ptr_Uniform_v4float %UAV0_0 %int_0 %43 + OpStore %44 %26 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-2.asm.comp b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-2.asm.comp new file mode 100644 index 0000000000..3b8d9fdf3d --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/asm/op-source-none-uav-2.asm.comp @@ -0,0 +1,53 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 48 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %threadId + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %UAV0 "UAV0" + OpMemberName %UAV0 0 "@data" + OpName %UAV0_0 "UAV0" + OpName %UAV1 "UAV1" + OpName %threadId "threadId" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %UAV0 0 Offset 0 + OpDecorate %UAV0 BufferBlock + OpDecorate %UAV0_0 DescriptorSet 0 + OpDecorate %UAV0_0 Binding 0 + OpDecorate %UAV1 DescriptorSet 0 + OpDecorate %UAV1 Binding 1 + OpDecorate %threadId BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %UAV0 = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_UAV0 = OpTypePointer Uniform %UAV0 + %UAV0_0 = OpVariable %_ptr_Uniform_UAV0 Uniform + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %UAV1 = OpVariable %_ptr_Uniform_UAV0 Uniform + %float_2 = OpConstant %float 2 + %33 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %threadId = OpVariable %_ptr_Input_v3int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %38 = OpLoad %v3int %threadId + %43 = OpCompositeExtract %int %38 0 + %44 = OpAccessChain %_ptr_Uniform_v4float %UAV0_0 %int_0 %43 + OpStore %44 %26 + %47 = OpAccessChain %_ptr_Uniform_v4float %UAV1 %int_0 %43 + OpStore %47 %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/comp/array-of-physical-pointer.comp b/third_party/spirv-cross/shaders-reflection/comp/array-of-physical-pointer.comp new file mode 100644 index 0000000000..992f6f9089 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/array-of-physical-pointer.comp @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable +#extension GL_EXT_buffer_reference2 : enable +layout(buffer_reference, std430, buffer_reference_align = 4) buffer IntBuf +{ + int v; +}; +layout(std140, binding = 0) uniform Params +{ + float x; + IntBuf y[3]; +}; +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-reflection/comp/function-pointer.invalid.asm.comp b/third_party/spirv-cross/shaders-reflection/comp/function-pointer.invalid.asm.comp new file mode 100644 index 0000000000..440f3311ef --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/function-pointer.invalid.asm.comp @@ -0,0 +1,19 @@ +; SPIR-V +; Version: 1.5 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 7 +; Schema: 0 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "main" +OpExecutionMode %2 LocalSize 1 1 1 +OpSource GLSL 450 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypePointer Private %4 +%2 = OpFunction %3 None %4 +%6 = OpLabel +OpReturn +OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/comp/out-of-order-block-offsets.comp b/third_party/spirv-cross/shaders-reflection/comp/out-of-order-block-offsets.comp new file mode 100644 index 0000000000..da5c86eef4 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/out-of-order-block-offsets.comp @@ -0,0 +1,12 @@ +#version 450 + +layout(set = 0, binding = 0) buffer SSBO +{ + layout(offset = 8) uint foo; + layout(offset = 4) uint bar; +}; + +void main() +{ + bar = foo; +} diff --git a/third_party/spirv-cross/shaders-reflection/comp/physical-pointer.comp b/third_party/spirv-cross/shaders-reflection/comp/physical-pointer.comp new file mode 100644 index 0000000000..ecd1e287d2 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/physical-pointer.comp @@ -0,0 +1,15 @@ +#version 460 +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable +#extension GL_EXT_buffer_reference2 : enable +layout(buffer_reference, std430, buffer_reference_align = 4) buffer IntBuf +{ + int v; +}; +layout(std140, binding = 0) uniform Params +{ + float x; + IntBuf y; +}; +void main() +{ +} diff --git a/third_party/spirv-cross/shaders-reflection/comp/struct-layout.comp b/third_party/spirv-cross/shaders-reflection/comp/struct-layout.comp new file mode 100644 index 0000000000..5a2b7802df --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/struct-layout.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct Foo +{ + mat4 m; +}; + +layout(std430, binding = 0) readonly buffer SSBO +{ + Foo in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + Foo out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + out_data[ident].m = in_data[ident].m * in_data[ident].m; +} + diff --git a/third_party/spirv-cross/shaders-reflection/comp/struct-packing.comp b/third_party/spirv-cross/shaders-reflection/comp/struct-packing.comp new file mode 100644 index 0000000000..d2ffbaef50 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/struct-packing.comp @@ -0,0 +1,87 @@ +#version 450 + +layout(local_size_x = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + + S4 m3s[8]; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content = ssbo_140.content; +} + diff --git a/third_party/spirv-cross/shaders-reflection/comp/workgroup-size-spec-constant.comp b/third_party/spirv-cross/shaders-reflection/comp/workgroup-size-spec-constant.comp new file mode 100644 index 0000000000..376a351622 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/comp/workgroup-size-spec-constant.comp @@ -0,0 +1,13 @@ +#version 450 + +layout(local_size_x_id = 10, local_size_y_id = 40, local_size_z_id = 60) in; + +layout(std430, set = 0, binding = 0) buffer SSBO +{ + vec4 v; +}; + +void main() +{ + v = vec4(10.0); +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag new file mode 100644 index 0000000000..2fabb5ea8a --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler-shadow.vk.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump samplerShadow uSampler; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; +layout(set = 0, binding = 2) uniform texture2D uDepth; +layout(location = 0) out float FragColor; + +float samp2(texture2D t, mediump samplerShadow s) +{ + return texture(sampler2DShadow(t, s), vec3(1.0)); +} + +float samp3(texture2D t, mediump sampler s) +{ + return texture(sampler2D(t, s), vec2(1.0)).x; +} + +float samp(texture2D t, mediump samplerShadow s, mediump sampler s1) +{ + float r0 = samp2(t, s); + float r1 = samp3(t, s1); + return r0 + r1; +} + +void main() +{ + FragColor = samp(uDepth, uSampler, uSampler1); +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler.vk.frag new file mode 100644 index 0000000000..b7de8d47e9 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/combined-texture-sampler.vk.frag @@ -0,0 +1,47 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler0; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; +layout(set = 0, binding = 2) uniform mediump texture2D uTexture0; +layout(set = 0, binding = 3) uniform mediump texture2D uTexture1; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; + +vec4 sample_dual(mediump sampler samp, mediump texture2D tex) +{ + return texture(sampler2D(tex, samp), vTex); +} + +vec4 sample_global_tex(mediump sampler samp) +{ + vec4 a = texture(sampler2D(uTexture0, samp), vTex); + vec4 b = sample_dual(samp, uTexture1); + return a + b; +} + +vec4 sample_global_sampler(mediump texture2D tex) +{ + vec4 a = texture(sampler2D(tex, uSampler0), vTex); + vec4 b = sample_dual(uSampler1, tex); + return a + b; +} + +vec4 sample_duals() +{ + vec4 a = sample_dual(uSampler0, uTexture0); + vec4 b = sample_dual(uSampler1, uTexture1); + return a + b; +} + +void main() +{ + vec4 c0 = sample_duals(); + vec4 c1 = sample_global_tex(uSampler0); + vec4 c2 = sample_global_tex(uSampler1); + vec4 c3 = sample_global_sampler(uTexture0); + vec4 c4 = sample_global_sampler(uTexture1); + + FragColor = c0 + c1 + c2 + c3 + c4; +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/image-load-store-uint-coord.asm.frag b/third_party/spirv-cross/shaders-reflection/frag/image-load-store-uint-coord.asm.frag new file mode 100644 index 0000000000..a9bf1a7497 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/image-load-store-uint-coord.asm.frag @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %storeTemp "storeTemp" + OpName %RWIm "RWIm" + OpName %v "v" + OpName %RWBuf "RWBuf" + OpName %ROIm "ROIm" + OpName %ROBuf "ROBuf" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %RWIm DescriptorSet 0 + OpDecorate %RWIm Binding 1 + OpDecorate %RWBuf DescriptorSet 0 + OpDecorate %RWBuf Binding 0 + OpDecorate %ROIm DescriptorSet 0 + OpDecorate %ROIm Binding 1 + OpDecorate %ROBuf DescriptorSet 0 + OpDecorate %ROBuf Binding 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_10 = OpConstant %float 10 + %float_0_5 = OpConstant %float 0.5 + %float_8 = OpConstant %float 8 + %float_2 = OpConstant %float 2 + %17 = OpConstantComposite %v4float %float_10 %float_0_5 %float_8 %float_2 + %18 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 + %RWIm = OpVariable %_ptr_UniformConstant_18 UniformConstant + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_10 = OpConstant %uint 10 + %25 = OpConstantComposite %v2uint %uint_10 %uint_10 + %uint_30 = OpConstant %uint 30 + %30 = OpConstantComposite %v2uint %uint_30 %uint_30 + %32 = OpTypeImage %float Buffer 0 0 0 2 Rgba32f +%_ptr_UniformConstant_32 = OpTypePointer UniformConstant %32 + %RWBuf = OpVariable %_ptr_UniformConstant_32 UniformConstant + %uint_80 = OpConstant %uint 80 + %38 = OpTypeImage %float 2D 0 0 0 1 Unknown + %SampledImage = OpTypeSampledImage %38 +%_ptr_UniformConstant_38 = OpTypePointer UniformConstant %SampledImage + %ROIm = OpVariable %_ptr_UniformConstant_38 UniformConstant + %uint_50 = OpConstant %uint 50 + %uint_60 = OpConstant %uint 60 + %44 = OpConstantComposite %v2uint %uint_50 %uint_60 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %50 = OpTypeImage %float Buffer 0 0 0 1 Rgba32f +%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50 + %ROBuf = OpVariable %_ptr_UniformConstant_50 UniformConstant +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %62 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %62 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + %storeTemp = OpVariable %_ptr_Function_v4float Function + %v = OpVariable %_ptr_Function_v4float Function + OpStore %storeTemp %17 + %21 = OpLoad %18 %RWIm + %26 = OpLoad %v4float %storeTemp + OpImageWrite %21 %25 %26 + %28 = OpLoad %18 %RWIm + %31 = OpImageRead %v4float %28 %30 + OpStore %v %31 + %35 = OpLoad %32 %RWBuf + %37 = OpLoad %v4float %v + OpImageWrite %35 %uint_80 %37 + %41 = OpLoad %SampledImage %ROIm + %ROImage = OpImage %38 %41 + %47 = OpImageFetch %v4float %ROImage %44 Lod %int_0 + %48 = OpLoad %v4float %v + %49 = OpFAdd %v4float %48 %47 + OpStore %v %49 + %53 = OpLoad %50 %ROBuf + %54 = OpImageFetch %v4float %53 %uint_80 + %55 = OpLoad %v4float %v + %56 = OpFAdd %v4float %55 %54 + OpStore %v %56 + %57 = OpLoad %v4float %v + OpReturnValue %57 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-reflection/frag/input-attachment-ms.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/input-attachment-ms.vk.frag new file mode 100644 index 0000000000..e060738846 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/input-attachment-ms.vk.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + subpassLoad(uSubpass0, gl_SampleID); +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/input-attachment.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/input-attachment.vk.frag new file mode 100644 index 0000000000..f082d15b2a --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/input-attachment.vk.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0) + subpassLoad(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/push-constant.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/push-constant.vk.frag new file mode 100644 index 0000000000..6180faba31 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/push-constant.vk.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(push_constant, std430) uniform PushConstants +{ + vec4 value0; + vec4 value1; +} push; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor + push.value0 + push.value1; +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/separate-sampler-texture-array.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/separate-sampler-texture-array.vk.frag new file mode 100644 index 0000000000..b3501c1d8d --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/separate-sampler-texture-array.vk.frag @@ -0,0 +1,42 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 1) uniform mediump texture2D uTexture[4]; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D[4]; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube[4]; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray[4]; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; + +vec4 sample_func(mediump sampler samp, vec2 uv) +{ + return texture(sampler2D(uTexture[2], samp), uv); +} + +vec4 sample_func_dual(mediump sampler samp, mediump texture2D tex, vec2 uv) +{ + return texture(sampler2D(tex, samp), uv); +} + +vec4 sample_func_dual_array(mediump sampler samp, mediump texture2D tex[4], vec2 uv) +{ + return texture(sampler2D(tex[1], samp), uv); +} + +void main() +{ + vec2 off = 1.0 / vec2(textureSize(sampler2D(uTexture[1], uSampler), 0)); + vec2 off2 = 1.0 / vec2(textureSize(sampler2D(uTexture[2], uSampler), 1)); + + vec4 c0 = sample_func(uSampler, vTex + off + off2); + vec4 c1 = sample_func_dual(uSampler, uTexture[1], vTex + off + off2); + vec4 c2 = sample_func_dual_array(uSampler, uTexture, vTex + off + off2); + vec4 c3 = texture(sampler2DArray(uTextureArray[3], uSampler), vTex3); + vec4 c4 = texture(samplerCube(uTextureCube[1], uSampler), vTex3); + vec4 c5 = texture(sampler3D(uTexture3D[2], uSampler), vTex3); + + FragColor = c0 + c1 + c2 + c3 + c4 + c5; +} diff --git a/third_party/spirv-cross/shaders-reflection/frag/spec-constant.vk.frag b/third_party/spirv-cross/shaders-reflection/frag/spec-constant.vk.frag new file mode 100644 index 0000000000..e62a26059b --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/frag/spec-constant.vk.frag @@ -0,0 +1,78 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(constant_id = 1) const float a = 1.5; +layout(constant_id = 2) const float b = 2.5; +layout(constant_id = 3) const int c = 3; +layout(constant_id = 4) const int d = 4; +layout(constant_id = 5) const uint e = 5u; +layout(constant_id = 6) const uint f = 6u; +layout(constant_id = 7) const bool g = false; +layout(constant_id = 8) const bool h = true; + +// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. + +struct Foo +{ + float elems[d + 2]; +}; + +void main() +{ + float t0 = a; + float t1 = b; + + uint c0 = uint(c); // OpIAdd with different types. + // FConvert, float-to-double. + int c1 = -c; // SNegate + int c2 = ~c; // OpNot + int c3 = c + d; // OpIAdd + int c4 = c - d; // OpISub + int c5 = c * d; // OpIMul + int c6 = c / d; // OpSDiv + uint c7 = e / f; // OpUDiv + int c8 = c % d; // OpSMod + uint c9 = e % f; // OpUMod + // TODO: OpSRem, any way to access this in GLSL? + int c10 = c >> d; // OpShiftRightArithmetic + uint c11 = e >> f; // OpShiftRightLogical + int c12 = c << d; // OpShiftLeftLogical + int c13 = c | d; // OpBitwiseOr + int c14 = c ^ d; // OpBitwiseXor + int c15 = c & d; // OpBitwiseAnd + // VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. + bool c16 = g || h; // OpLogicalOr + bool c17 = g && h; // OpLogicalAnd + bool c18 = !g; // OpLogicalNot + bool c19 = g == h; // OpLogicalEqual + bool c20 = g != h; // OpLogicalNotEqual + // OpSelect not testable atm. + bool c21 = c == d; // OpIEqual + bool c22 = c != d; // OpINotEqual + bool c23 = c < d; // OpSLessThan + bool c24 = e < f; // OpULessThan + bool c25 = c > d; // OpSGreaterThan + bool c26 = e > f; // OpUGreaterThan + bool c27 = c <= d; // OpSLessThanEqual + bool c28 = e <= f; // OpULessThanEqual + bool c29 = c >= d; // OpSGreaterThanEqual + bool c30 = e >= f; // OpUGreaterThanEqual + // OpQuantizeToF16 not testable atm. + + int c31 = c8 + c3; + + int c32 = int(e); // OpIAdd with different types. + bool c33 = bool(c); // int -> bool + bool c34 = bool(e); // uint -> bool + int c35 = int(g); // bool -> int + uint c36 = uint(g); // bool -> uint + float c37 = float(g); // bool -> float + + // Flexible sized arrays with spec constants and spec constant ops. + float vec0[c + 3][8]; + float vec1[c + 2]; + + Foo foo; + FragColor = vec4(t0 + t1) + vec0[0][0] + vec1[0] + foo.elems[c]; +} diff --git a/third_party/spirv-cross/shaders-reflection/rgen/acceleration_structure.vk.rgen b/third_party/spirv-cross/shaders-reflection/rgen/acceleration_structure.vk.rgen new file mode 100644 index 0000000000..568c1a28d0 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/rgen/acceleration_structure.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, vec3(1.0), 1000.0, 0); +} diff --git a/third_party/spirv-cross/shaders-reflection/vert/array-size-reflection.vert b/third_party/spirv-cross/shaders-reflection/vert/array-size-reflection.vert new file mode 100644 index 0000000000..24a4a43831 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/vert/array-size-reflection.vert @@ -0,0 +1,13 @@ +#version 450 +layout(constant_id = 0) const int ARR_SIZE = 1; + +layout(binding = 0, set = 1, std140) uniform u_ +{ + vec4 u_0[ARR_SIZE]; +}; + +void main() +{ + gl_Position = u_0[0]; +} + diff --git a/third_party/spirv-cross/shaders-reflection/vert/read-from-row-major-array.vert b/third_party/spirv-cross/shaders-reflection/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..792fb8e36c --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/vert/read-from-row-major-array.vert @@ -0,0 +1,20 @@ +#version 310 es +layout(location = 0) in highp vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +layout(set = 0, binding = 0, std140, row_major) uniform Block +{ + highp mat2x3 var[3][4]; +}; + +mediump float compare_float (highp float a, highp float b) { return abs(a - b) < 0.05 ? 1.0 : 0.0; } +mediump float compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)*compare_float(a.y, b.y)*compare_float(a.z, b.z); } +mediump float compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])*compare_vec3(a[1], b[1]); } + +void main (void) +{ + gl_Position = a_position; + mediump float result = 1.0; + result *= compare_mat2x3(var[0][0], mat2x3(2.0, 6.0, -6.0, 0.0, 5.0, 5.0)); + v_vtxResult = result; +} diff --git a/third_party/spirv-cross/shaders-reflection/vert/stride-reflection.vert b/third_party/spirv-cross/shaders-reflection/vert/stride-reflection.vert new file mode 100644 index 0000000000..6e7d96df44 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/vert/stride-reflection.vert @@ -0,0 +1,14 @@ +#version 450 + +layout(binding = 0, set = 0, std140) uniform U +{ + vec4 v[4]; + mat4 c[4]; + layout(row_major) mat4 r[4]; +}; + +void main() +{ + gl_Position = v[0]; +} + diff --git a/third_party/spirv-cross/shaders-reflection/vert/texture_buffer.vert b/third_party/spirv-cross/shaders-reflection/vert/texture_buffer.vert new file mode 100644 index 0000000000..6bc7ddfae2 --- /dev/null +++ b/third_party/spirv-cross/shaders-reflection/vert/texture_buffer.vert @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_OES_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(rgba32f, binding = 5) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} diff --git a/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag new file mode 100644 index 0000000000..fae211f278 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/accesschain-invalid-expression.asm.invalid.frag @@ -0,0 +1,1087 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 572 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %Main "main" %in_var_TEXCOORD0 %in_var_TEXCOORD7 %in_var_TEXCOORD8 %gl_FragCoord %gl_FrontFacing %out_var_SV_Target0 + OpExecutionMode %Main OriginUpperLeft + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_MobileDirectionalLight "type.MobileDirectionalLight" + OpMemberName %type_MobileDirectionalLight 0 "MobileDirectionalLight_DirectionalLightColor" + OpMemberName %type_MobileDirectionalLight 1 "MobileDirectionalLight_DirectionalLightDirectionAndShadowTransition" + OpMemberName %type_MobileDirectionalLight 2 "MobileDirectionalLight_DirectionalLightShadowSize" + OpMemberName %type_MobileDirectionalLight 3 "MobileDirectionalLight_DirectionalLightDistanceFadeMAD" + OpMemberName %type_MobileDirectionalLight 4 "MobileDirectionalLight_DirectionalLightShadowDistances" + OpMemberName %type_MobileDirectionalLight 5 "MobileDirectionalLight_DirectionalLightScreenToShadow" + OpName %MobileDirectionalLight "MobileDirectionalLight" + OpName %type_2d_image "type.2d.image" + OpName %MobileDirectionalLight_DirectionalLightShadowTexture "MobileDirectionalLight_DirectionalLightShadowTexture" + OpName %type_sampler "type.sampler" + OpName %MobileDirectionalLight_DirectionalLightShadowSampler "MobileDirectionalLight_DirectionalLightShadowSampler" + OpName %Material_Texture2D_0 "Material_Texture2D_0" + OpName %Material_Texture2D_0Sampler "Material_Texture2D_0Sampler" + OpName %Material_Texture2D_1 "Material_Texture2D_1" + OpName %Material_Texture2D_1Sampler "Material_Texture2D_1Sampler" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "NumDynamicPointLights" + OpMemberName %type__Globals 1 "LightPositionAndInvRadius" + OpMemberName %type__Globals 2 "LightColorAndFalloffExponent" + OpMemberName %type__Globals 3 "MobileReflectionParams" + OpName %_Globals "$Globals" + OpName %type_cube_image "type.cube.image" + OpName %ReflectionCubemap "ReflectionCubemap" + OpName %ReflectionCubemapSampler "ReflectionCubemapSampler" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_TEXCOORD7 "in.var.TEXCOORD7" + OpName %in_var_TEXCOORD8 "in.var.TEXCOORD8" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %Main "Main" + OpName %type_sampled_image "type.sampled.image" + OpName %type_sampled_image_0 "type.sampled.image" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorateString %in_var_TEXCOORD8 UserSemantic "TEXCOORD8" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorate %gl_FrontFacing BuiltIn FrontFacing + OpDecorateString %gl_FrontFacing UserSemantic "SV_IsFrontFace" + OpDecorate %gl_FrontFacing Flat + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %in_var_TEXCOORD7 Location 1 + OpDecorate %in_var_TEXCOORD8 Location 2 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %MobileDirectionalLight DescriptorSet 0 + OpDecorate %MobileDirectionalLight Binding 1 + OpDecorate %MobileDirectionalLight_DirectionalLightShadowTexture DescriptorSet 0 + OpDecorate %MobileDirectionalLight_DirectionalLightShadowTexture Binding 0 + OpDecorate %MobileDirectionalLight_DirectionalLightShadowSampler DescriptorSet 0 + OpDecorate %MobileDirectionalLight_DirectionalLightShadowSampler Binding 0 + OpDecorate %Material_Texture2D_0 DescriptorSet 0 + OpDecorate %Material_Texture2D_0 Binding 1 + OpDecorate %Material_Texture2D_0Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_0Sampler Binding 1 + OpDecorate %Material_Texture2D_1 DescriptorSet 0 + OpDecorate %Material_Texture2D_1 Binding 2 + OpDecorate %Material_Texture2D_1Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_1Sampler Binding 2 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 2 + OpDecorate %ReflectionCubemap DescriptorSet 0 + OpDecorate %ReflectionCubemap Binding 3 + OpDecorate %ReflectionCubemapSampler DescriptorSet 0 + OpDecorate %ReflectionCubemapSampler Binding 3 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpDecorate %_arr_mat4v4float_uint_4 ArrayStride 64 + OpMemberDecorate %type_MobileDirectionalLight 0 Offset 0 + OpMemberDecorate %type_MobileDirectionalLight 1 Offset 16 + OpMemberDecorate %type_MobileDirectionalLight 2 Offset 32 + OpMemberDecorate %type_MobileDirectionalLight 3 Offset 48 + OpMemberDecorate %type_MobileDirectionalLight 4 Offset 64 + OpMemberDecorate %type_MobileDirectionalLight 5 Offset 80 + OpMemberDecorate %type_MobileDirectionalLight 5 MatrixStride 16 + OpMemberDecorate %type_MobileDirectionalLight 5 ColMajor + OpDecorate %type_MobileDirectionalLight Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 80 + OpMemberDecorate %type__Globals 3 Offset 144 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_4 = OpConstant %int 4 + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %47 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_5 = OpConstant %int 5 + %52 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_999989986 = OpConstant %float 0.999989986 +%float_65000 = OpConstant %float 65000 + %55 = OpConstantComposite %v3float %float_65000 %float_65000 %float_65000 +%float_0_318309873 = OpConstant %float 0.318309873 + %57 = OpConstantComposite %v3float %float_0_318309873 %float_0_318309873 %float_0_318309873 +%float_65500 = OpConstant %float 65500 + %float_0_5 = OpConstant %float 0.5 + %60 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %float_2 = OpConstant %float 2 + %float_n2 = OpConstant %float -2 + %63 = OpConstantComposite %v2float %float_2 %float_n2 + %64 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%float_0_119999997 = OpConstant %float 0.119999997 + %float_n1 = OpConstant %float -1 +%float_n0_0274999999 = OpConstant %float -0.0274999999 + %68 = OpConstantComposite %v2float %float_n1 %float_n0_0274999999 +%float_0_0425000004 = OpConstant %float 0.0425000004 + %70 = OpConstantComposite %v2float %float_1 %float_0_0425000004 +%float_n9_27999973 = OpConstant %float -9.27999973 + %72 = OpConstantComposite %v2float %float_1 %float_1 + %float_0_25 = OpConstant %float 0.25 + %float_16 = OpConstant %float 16 + %int_31 = OpConstant %int 31 + %int_56 = OpConstant %int 56 + %int_57 = OpConstant %int 57 + %int_64 = OpConstant %int 64 + %int_65 = OpConstant %int 65 + %int_66 = OpConstant %int 66 + %int_67 = OpConstant %int 67 + %int_88 = OpConstant %int 88 + %int_135 = OpConstant %int 135 + %int_139 = OpConstant %int 139 +%mat3v3float = OpTypeMatrix %v3float 3 + %86 = OpConstantComposite %v2float %float_2 %float_2 +%float_0_300000012 = OpConstant %float 0.300000012 + %88 = OpConstantComposite %v3float %float_0_300000012 %float_0_300000012 %float_1 + %float_20 = OpConstant %float 20 + %90 = OpConstantComposite %v2float %float_20 %float_20 +%float_0_400000006 = OpConstant %float 0.400000006 + %float_24 = OpConstant %float 24 +%float_0_294999987 = OpConstant %float 0.294999987 +%float_0_660000026 = OpConstant %float 0.660000026 +%float_0_699999988 = OpConstant %float 0.699999988 +%float_65504 = OpConstant %float 65504 +%float_1_20000005 = OpConstant %float 1.20000005 + %98 = OpConstantComposite %v3float %float_2 %float_2 %float_2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%_arr_mat4v4float_uint_4 = OpTypeArray %mat4v4float %uint_4 +%type_MobileDirectionalLight = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %_arr_mat4v4float_uint_4 +%_ptr_Uniform_type_MobileDirectionalLight = OpTypePointer Uniform %type_MobileDirectionalLight +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type__Globals = OpTypeStruct %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %v4float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_cube_image = OpTypeImage %float Cube 2 0 0 1 Unknown +%_ptr_UniformConstant_type_cube_image = OpTypePointer UniformConstant %type_cube_image +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_bool = OpTypePointer Input %bool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %110 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_int = OpTypePointer Uniform %int +%type_sampled_image = OpTypeSampledImage %type_cube_image +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%type_sampled_image_0 = OpTypeSampledImage %type_2d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%MobileDirectionalLight = OpVariable %_ptr_Uniform_type_MobileDirectionalLight Uniform +%MobileDirectionalLight_DirectionalLightShadowTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%MobileDirectionalLight_DirectionalLightShadowSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%Material_Texture2D_0 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_0Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%Material_Texture2D_1 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_1Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%ReflectionCubemap = OpVariable %_ptr_UniformConstant_type_cube_image UniformConstant +%ReflectionCubemapSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%in_var_TEXCOORD7 = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD8 = OpVariable %_ptr_Input_v4float Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%gl_FrontFacing = OpVariable %_ptr_Input_bool Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %117 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %118 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %119 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %120 = OpConstantComposite %mat3v3float %117 %118 %119 + %float_10 = OpConstant %float 10 + %122 = OpConstantComposite %v2float %float_10 %float_10 + %float_5 = OpConstant %float 5 + %124 = OpConstantComposite %v2float %float_5 %float_5 +%float_0_00066666666 = OpConstant %float 0.00066666666 + %float_n0_5 = OpConstant %float -0.5 + %127 = OpConstantComposite %v2float %float_n0_5 %float_n0_5 + %128 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %float_1_5 = OpConstant %float 1.5 + %130 = OpConstantComposite %v2float %float_1_5 %float_n0_5 + %131 = OpConstantComposite %v2float %float_n0_5 %float_0_5 + %132 = OpConstantComposite %v2float %float_1_5 %float_0_5 + %133 = OpConstantComposite %v2float %float_n0_5 %float_1_5 + %134 = OpConstantComposite %v2float %float_0_5 %float_1_5 + %135 = OpConstantComposite %v2float %float_1_5 %float_1_5 + %136 = OpUndef %v3float + %137 = OpUndef %v4float + %138 = OpUndef %float + %139 = OpUndef %v3float + %Main = OpFunction %void None %110 + %140 = OpLabel + %141 = OpLoad %v2float %in_var_TEXCOORD0 + %142 = OpLoad %v4float %in_var_TEXCOORD7 + %143 = OpLoad %v4float %in_var_TEXCOORD8 + %144 = OpLoad %v4float %gl_FragCoord + %145 = OpAccessChain %_ptr_Uniform_v3float %View %int_31 + %146 = OpLoad %v3float %145 + %147 = OpAccessChain %_ptr_Uniform_v4float %View %int_56 + %148 = OpLoad %v4float %147 + %149 = OpAccessChain %_ptr_Uniform_v4float %View %int_57 + %150 = OpLoad %v4float %149 + %151 = OpAccessChain %_ptr_Uniform_v4float %View %int_64 + %152 = OpLoad %v4float %151 + %153 = OpAccessChain %_ptr_Uniform_v4float %View %int_65 + %154 = OpLoad %v4float %153 + %155 = OpAccessChain %_ptr_Uniform_v4float %View %int_66 + %156 = OpLoad %v4float %155 + %157 = OpAccessChain %_ptr_Uniform_v2float %View %int_67 + %158 = OpLoad %v2float %157 + %159 = OpAccessChain %_ptr_Uniform_float %View %int_88 + %160 = OpLoad %float %159 + %161 = OpAccessChain %_ptr_Uniform_v4float %View %int_135 + %162 = OpLoad %v4float %161 + %163 = OpAccessChain %_ptr_Uniform_float %View %int_139 + %164 = OpLoad %float %163 + %165 = OpVectorShuffle %v2float %144 %144 0 1 + %166 = OpVectorShuffle %v2float %148 %148 0 1 + %167 = OpFSub %v2float %165 %166 + %168 = OpVectorShuffle %v2float %150 %150 2 3 + %169 = OpFMul %v2float %167 %168 + %170 = OpFSub %v2float %169 %60 + %171 = OpFMul %v2float %170 %63 + %172 = OpCompositeExtract %float %171 0 + %173 = OpCompositeExtract %float %171 1 + %174 = OpCompositeConstruct %v4float %172 %173 %138 %float_1 + %175 = OpCompositeExtract %float %144 3 + %176 = OpCompositeConstruct %v4float %175 %175 %175 %175 + %177 = OpFMul %v4float %174 %176 + %178 = OpVectorShuffle %v3float %143 %143 0 1 2 + %179 = OpFSub %v3float %178 %146 + %180 = OpFNegate %v3float %178 + %181 = OpExtInst %v3float %1 Normalize %180 + %182 = OpFMul %v2float %141 %60 + %183 = OpFMul %v2float %141 %122 + %184 = OpLoad %type_2d_image %Material_Texture2D_0 + %185 = OpLoad %type_sampler %Material_Texture2D_0Sampler + %186 = OpSampledImage %type_sampled_image_0 %184 %185 + %187 = OpImageSampleImplicitLod %v4float %186 %183 None + %188 = OpVectorShuffle %v2float %187 %187 0 1 + %189 = OpFMul %v2float %188 %86 + %190 = OpFSub %v2float %189 %72 + %191 = OpDot %float %190 %190 + %192 = OpFSub %float %float_1 %191 + %193 = OpExtInst %float %1 FClamp %192 %float_0 %float_1 + %194 = OpExtInst %float %1 Sqrt %193 + %195 = OpCompositeExtract %float %190 0 + %196 = OpCompositeExtract %float %190 1 + %197 = OpCompositeConstruct %v4float %195 %196 %194 %float_1 + %198 = OpVectorShuffle %v3float %197 %197 0 1 2 + %199 = OpFMul %v3float %198 %88 + %200 = OpVectorShuffle %v3float %156 %156 0 1 2 + %201 = OpCompositeExtract %float %156 3 + %202 = OpCompositeConstruct %v3float %201 %201 %201 + %203 = OpFMul %v3float %199 %202 + %204 = OpFAdd %v3float %203 %200 + %205 = OpMatrixTimesVector %v3float %120 %204 + %206 = OpExtInst %v3float %1 Normalize %205 + %207 = OpFNegate %v3float %181 + %208 = OpDot %float %206 %181 + %209 = OpCompositeConstruct %v3float %208 %208 %208 + %210 = OpFMul %v3float %206 %209 + %211 = OpFMul %v3float %210 %98 + %212 = OpFAdd %v3float %207 %211 + %213 = OpFMul %v2float %141 %90 + %214 = OpLoad %type_2d_image %Material_Texture2D_1 + %215 = OpLoad %type_sampler %Material_Texture2D_1Sampler + %216 = OpSampledImage %type_sampled_image_0 %214 %215 + %217 = OpImageSampleImplicitLod %v4float %216 %213 None + %218 = OpCompositeExtract %float %217 0 + %219 = OpExtInst %float %1 FMix %float_0_400000006 %float_1 %218 + %220 = OpFSub %float %float_1 %219 + %221 = OpFMul %v2float %141 %124 + %222 = OpSampledImage %type_sampled_image_0 %214 %215 + %223 = OpImageSampleImplicitLod %v4float %222 %221 None + %224 = OpCompositeExtract %float %177 3 + %225 = OpFSub %float %224 %float_24 + %226 = OpFMul %float %225 %float_0_00066666666 + %227 = OpExtInst %float %1 FMax %226 %float_0 + %228 = OpExtInst %float %1 FMin %227 %float_1 + %229 = OpCompositeExtract %float %223 1 + %230 = OpExtInst %float %1 FMix %229 %float_1 %228 + %231 = OpExtInst %float %1 FMix %219 %220 %230 + %232 = OpSampledImage %type_sampled_image_0 %214 %215 + %233 = OpImageSampleImplicitLod %v4float %232 %182 None + %234 = OpExtInst %float %1 FMix %229 %float_0 %228 + %235 = OpCompositeExtract %float %233 1 + %236 = OpFAdd %float %235 %234 + %237 = OpExtInst %float %1 FMix %236 %float_0_5 %float_0_5 + %238 = OpExtInst %float %1 FMix %float_0_294999987 %float_0_660000026 %237 + %239 = OpFMul %float %238 %float_0_5 + %240 = OpFMul %float %231 %239 + %241 = OpExtInst %float %1 FMix %float_0 %float_0_5 %235 + %242 = OpExtInst %float %1 FMix %float_0_699999988 %float_1 %229 + %243 = OpExtInst %float %1 FMix %242 %float_1 %228 + %244 = OpFAdd %float %241 %243 + %245 = OpExtInst %float %1 FMax %244 %float_0 + %246 = OpExtInst %float %1 FMin %245 %float_1 + %247 = OpCompositeConstruct %v3float %240 %240 %240 + %248 = OpExtInst %v3float %1 FClamp %247 %47 %64 + %249 = OpCompositeExtract %float %158 1 + %250 = OpFMul %float %246 %249 + %251 = OpCompositeExtract %float %158 0 + %252 = OpFAdd %float %250 %251 + %253 = OpExtInst %float %1 FClamp %252 %float_0_119999997 %float_1 + %254 = OpExtInst %float %1 FMax %208 %float_0 + %255 = OpCompositeConstruct %v2float %253 %253 + %256 = OpFMul %v2float %255 %68 + %257 = OpFAdd %v2float %256 %70 + %258 = OpCompositeExtract %float %257 0 + %259 = OpFMul %float %258 %258 + %260 = OpFMul %float %float_n9_27999973 %254 + %261 = OpExtInst %float %1 Exp2 %260 + %262 = OpExtInst %float %1 FMin %259 %261 + %263 = OpFMul %float %262 %258 + %264 = OpCompositeExtract %float %257 1 + %265 = OpFAdd %float %263 %264 + %266 = OpCompositeExtract %float %152 3 + %267 = OpCompositeConstruct %v3float %266 %266 %266 + %268 = OpFMul %v3float %248 %267 + %269 = OpVectorShuffle %v3float %152 %152 0 1 2 + %270 = OpFAdd %v3float %268 %269 + %271 = OpCompositeExtract %float %154 3 + %272 = OpFMul %float %265 %271 + %273 = OpCompositeConstruct %v3float %272 %272 %272 + %274 = OpVectorShuffle %v3float %154 %154 0 1 2 + %275 = OpFAdd %v3float %273 %274 + %276 = OpCompositeExtract %float %275 0 + %277 = OpExtInst %float %1 FClamp %float_1 %float_0 %float_1 + %278 = OpLoad %type_2d_image %MobileDirectionalLight_DirectionalLightShadowTexture + %279 = OpLoad %type_sampler %MobileDirectionalLight_DirectionalLightShadowSampler + %280 = OpAccessChain %_ptr_Uniform_v4float %MobileDirectionalLight %int_1 + %281 = OpAccessChain %_ptr_Uniform_float %MobileDirectionalLight %int_1 %int_3 + %282 = OpLoad %float %281 + %283 = OpAccessChain %_ptr_Uniform_v4float %MobileDirectionalLight %int_2 + %284 = OpLoad %v4float %283 + OpBranch %285 + %285 = OpLabel + %286 = OpPhi %int %int_0 %140 %287 %288 + %289 = OpSLessThan %bool %286 %int_2 + OpLoopMerge %290 %288 None + OpBranchConditional %289 %291 %290 + %291 = OpLabel + %292 = OpBitcast %uint %286 + %293 = OpAccessChain %_ptr_Uniform_float %MobileDirectionalLight %int_4 %292 + %294 = OpLoad %float %293 + %295 = OpFOrdLessThan %bool %224 %294 + OpSelectionMerge %288 None + OpBranchConditional %295 %296 %288 + %296 = OpLabel + %297 = OpCompositeExtract %float %177 0 + %298 = OpCompositeExtract %float %177 1 + %299 = OpCompositeConstruct %v4float %297 %298 %224 %float_1 + %300 = OpAccessChain %_ptr_Uniform_mat4v4float %MobileDirectionalLight %int_5 %286 + %301 = OpLoad %mat4v4float %300 + %302 = OpMatrixTimesVector %v4float %301 %299 + OpBranch %290 + %288 = OpLabel + %287 = OpIAdd %int %286 %int_1 + OpBranch %285 + %290 = OpLabel + %303 = OpPhi %v4float %52 %285 %302 %296 + %304 = OpCompositeExtract %float %303 2 + %305 = OpFOrdGreaterThan %bool %304 %float_0 + OpSelectionMerge %306 None + OpBranchConditional %305 %307 %306 + %307 = OpLabel + %308 = OpExtInst %float %1 FMin %304 %float_0_999989986 + %309 = OpVectorShuffle %v2float %303 %303 0 1 + %310 = OpVectorShuffle %v2float %284 %284 0 1 + %311 = OpFMul %v2float %309 %310 + %312 = OpExtInst %v2float %1 Fract %311 + %313 = OpExtInst %v2float %1 Floor %311 + %314 = OpFAdd %v2float %313 %127 + %315 = OpVectorShuffle %v2float %284 %284 2 3 + %316 = OpFMul %v2float %314 %315 + %317 = OpSampledImage %type_sampled_image_0 %278 %279 + %318 = OpImageSampleExplicitLod %v4float %317 %316 Lod %float_0 + %319 = OpCompositeExtract %float %318 0 + %320 = OpCompositeInsert %v3float %319 %139 0 + %321 = OpFAdd %v2float %313 %128 + %322 = OpFMul %v2float %321 %315 + %323 = OpSampledImage %type_sampled_image_0 %278 %279 + %324 = OpImageSampleExplicitLod %v4float %323 %322 Lod %float_0 + %325 = OpCompositeExtract %float %324 0 + %326 = OpCompositeInsert %v3float %325 %320 1 + %327 = OpFAdd %v2float %313 %130 + %328 = OpFMul %v2float %327 %315 + %329 = OpSampledImage %type_sampled_image_0 %278 %279 + %330 = OpImageSampleExplicitLod %v4float %329 %328 Lod %float_0 + %331 = OpCompositeExtract %float %330 0 + %332 = OpCompositeInsert %v3float %331 %326 2 + %333 = OpFMul %float %308 %282 + %334 = OpFSub %float %333 %float_1 + %335 = OpCompositeConstruct %v3float %282 %282 %282 + %336 = OpFMul %v3float %332 %335 + %337 = OpCompositeConstruct %v3float %334 %334 %334 + %338 = OpFSub %v3float %336 %337 + %339 = OpExtInst %v3float %1 FClamp %338 %47 %64 + %340 = OpFAdd %v2float %313 %131 + %341 = OpFMul %v2float %340 %315 + %342 = OpSampledImage %type_sampled_image_0 %278 %279 + %343 = OpImageSampleExplicitLod %v4float %342 %341 Lod %float_0 + %344 = OpCompositeExtract %float %343 0 + %345 = OpCompositeInsert %v3float %344 %139 0 + %346 = OpFAdd %v2float %313 %60 + %347 = OpFMul %v2float %346 %315 + %348 = OpSampledImage %type_sampled_image_0 %278 %279 + %349 = OpImageSampleExplicitLod %v4float %348 %347 Lod %float_0 + %350 = OpCompositeExtract %float %349 0 + %351 = OpCompositeInsert %v3float %350 %345 1 + %352 = OpFAdd %v2float %313 %132 + %353 = OpFMul %v2float %352 %315 + %354 = OpSampledImage %type_sampled_image_0 %278 %279 + %355 = OpImageSampleExplicitLod %v4float %354 %353 Lod %float_0 + %356 = OpCompositeExtract %float %355 0 + %357 = OpCompositeInsert %v3float %356 %351 2 + %358 = OpFMul %v3float %357 %335 + %359 = OpFSub %v3float %358 %337 + %360 = OpExtInst %v3float %1 FClamp %359 %47 %64 + %361 = OpFAdd %v2float %313 %133 + %362 = OpFMul %v2float %361 %315 + %363 = OpSampledImage %type_sampled_image_0 %278 %279 + %364 = OpImageSampleExplicitLod %v4float %363 %362 Lod %float_0 + %365 = OpCompositeExtract %float %364 0 + %366 = OpCompositeInsert %v3float %365 %139 0 + %367 = OpFAdd %v2float %313 %134 + %368 = OpFMul %v2float %367 %315 + %369 = OpSampledImage %type_sampled_image_0 %278 %279 + %370 = OpImageSampleExplicitLod %v4float %369 %368 Lod %float_0 + %371 = OpCompositeExtract %float %370 0 + %372 = OpCompositeInsert %v3float %371 %366 1 + %373 = OpFAdd %v2float %313 %135 + %374 = OpFMul %v2float %373 %315 + %375 = OpSampledImage %type_sampled_image_0 %278 %279 + %376 = OpImageSampleExplicitLod %v4float %375 %374 Lod %float_0 + %377 = OpCompositeExtract %float %376 0 + %378 = OpCompositeInsert %v3float %377 %372 2 + %379 = OpFMul %v3float %378 %335 + %380 = OpFSub %v3float %379 %337 + %381 = OpExtInst %v3float %1 FClamp %380 %47 %64 + %382 = OpCompositeExtract %float %339 0 + %383 = OpCompositeExtract %float %312 0 + %384 = OpFSub %float %float_1 %383 + %385 = OpFMul %float %382 %384 + %386 = OpCompositeExtract %float %360 0 + %387 = OpFMul %float %386 %384 + %388 = OpCompositeExtract %float %381 0 + %389 = OpFMul %float %388 %384 + %390 = OpCompositeExtract %float %339 1 + %391 = OpFAdd %float %385 %390 + %392 = OpCompositeExtract %float %360 1 + %393 = OpFAdd %float %387 %392 + %394 = OpCompositeExtract %float %381 1 + %395 = OpFAdd %float %389 %394 + %396 = OpCompositeExtract %float %339 2 + %397 = OpFMul %float %396 %383 + %398 = OpFAdd %float %391 %397 + %399 = OpCompositeInsert %v3float %398 %136 0 + %400 = OpCompositeExtract %float %360 2 + %401 = OpFMul %float %400 %383 + %402 = OpFAdd %float %393 %401 + %403 = OpCompositeInsert %v3float %402 %399 1 + %404 = OpCompositeExtract %float %381 2 + %405 = OpFMul %float %404 %383 + %406 = OpFAdd %float %395 %405 + %407 = OpCompositeInsert %v3float %406 %403 2 + %408 = OpCompositeExtract %float %312 1 + %409 = OpFSub %float %float_1 %408 + %410 = OpCompositeConstruct %v3float %409 %float_1 %408 + %411 = OpDot %float %407 %410 + %412 = OpFMul %float %float_0_25 %411 + %413 = OpExtInst %float %1 FClamp %412 %float_0 %float_1 + %414 = OpAccessChain %_ptr_Uniform_float %MobileDirectionalLight %int_3 %int_0 + %415 = OpLoad %float %414 + %416 = OpFMul %float %224 %415 + %417 = OpAccessChain %_ptr_Uniform_float %MobileDirectionalLight %int_3 %int_1 + %418 = OpLoad %float %417 + %419 = OpFAdd %float %416 %418 + %420 = OpExtInst %float %1 FClamp %419 %float_0 %float_1 + %421 = OpFMul %float %420 %420 + %422 = OpExtInst %float %1 FMix %413 %float_1 %421 + OpBranch %306 + %306 = OpLabel + %423 = OpPhi %float %float_1 %290 %422 %307 + %424 = OpLoad %v4float %280 + %425 = OpVectorShuffle %v3float %424 %424 0 1 2 + %426 = OpDot %float %206 %425 + %427 = OpExtInst %float %1 FMax %float_0 %426 + %428 = OpFAdd %v3float %181 %425 + %429 = OpExtInst %v3float %1 Normalize %428 + %430 = OpDot %float %206 %429 + %431 = OpExtInst %float %1 FMax %float_0 %430 + %432 = OpFMul %float %423 %427 + %433 = OpCompositeConstruct %v3float %432 %432 %432 + %434 = OpAccessChain %_ptr_Uniform_v4float %MobileDirectionalLight %int_0 + %435 = OpLoad %v4float %434 + %436 = OpVectorShuffle %v3float %435 %435 0 1 2 + %437 = OpFMul %v3float %433 %436 + %438 = OpFMul %float %253 %float_0_25 + %439 = OpFAdd %float %438 %float_0_25 + %440 = OpExtInst %v3float %1 Cross %206 %429 + %441 = OpDot %float %440 %440 + %442 = OpFMul %float %253 %253 + %443 = OpFMul %float %431 %442 + %444 = OpFMul %float %443 %443 + %445 = OpFAdd %float %441 %444 + %446 = OpFDiv %float %442 %445 + %447 = OpFMul %float %446 %446 + %448 = OpExtInst %float %1 FMin %447 %float_65504 + %449 = OpFMul %float %439 %448 + %450 = OpFMul %float %276 %449 + %451 = OpCompositeConstruct %v3float %450 %450 %450 + %452 = OpFAdd %v3float %270 %451 + %453 = OpFMul %v3float %437 %452 + %454 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3 %int_3 + %455 = OpLoad %float %454 + %456 = OpFOrdGreaterThan %bool %455 %float_0 + %457 = OpSelect %float %456 %float_1 %float_0 + %458 = OpFOrdNotEqual %bool %457 %float_0 + %459 = OpSelect %float %458 %455 %164 + %460 = OpExtInst %float %1 Log2 %253 + %461 = OpFMul %float %float_1_20000005 %460 + %462 = OpFSub %float %float_1 %461 + %463 = OpFSub %float %459 %float_1 + %464 = OpFSub %float %463 %462 + %465 = OpLoad %type_cube_image %ReflectionCubemap + %466 = OpLoad %type_sampler %ReflectionCubemapSampler + %467 = OpSampledImage %type_sampled_image %465 %466 + %468 = OpImageSampleExplicitLod %v4float %467 %212 Lod %464 + OpSelectionMerge %469 None + OpBranchConditional %458 %470 %471 + %471 = OpLabel + %472 = OpVectorShuffle %v3float %468 %468 0 1 2 + %473 = OpCompositeExtract %float %468 3 + %474 = OpFMul %float %473 %float_16 + %475 = OpCompositeConstruct %v3float %474 %474 %474 + %476 = OpFMul %v3float %472 %475 + %477 = OpFMul %v3float %476 %476 + OpBranch %469 + %470 = OpLabel + %478 = OpVectorShuffle %v3float %468 %468 0 1 2 + %479 = OpVectorShuffle %v3float %162 %162 0 1 2 + %480 = OpFMul %v3float %478 %479 + OpBranch %469 + %469 = OpLabel + %481 = OpPhi %v3float %477 %471 %480 %470 + %482 = OpCompositeConstruct %v3float %277 %277 %277 + %483 = OpFMul %v3float %481 %482 + %484 = OpCompositeConstruct %v3float %276 %276 %276 + %485 = OpFMul %v3float %483 %484 + %486 = OpFAdd %v3float %453 %485 + OpBranch %487 + %487 = OpLabel + %488 = OpPhi %v3float %486 %469 %489 %490 + %491 = OpPhi %int %int_0 %469 %492 %490 + %493 = OpAccessChain %_ptr_Uniform_int %_Globals %int_0 + %494 = OpLoad %int %493 + %495 = OpSLessThan %bool %491 %494 + OpLoopMerge %496 %490 None + OpBranchConditional %495 %497 %496 + %497 = OpLabel + %498 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_1 %491 + %499 = OpLoad %v4float %498 + %500 = OpVectorShuffle %v3float %499 %499 0 1 2 + %501 = OpFSub %v3float %500 %179 + %502 = OpDot %float %501 %501 + %503 = OpExtInst %float %1 InverseSqrt %502 + %504 = OpCompositeConstruct %v3float %503 %503 %503 + %505 = OpFMul %v3float %501 %504 + %506 = OpFAdd %v3float %181 %505 + %507 = OpExtInst %v3float %1 Normalize %506 + %508 = OpDot %float %206 %505 + %509 = OpExtInst %float %1 FMax %float_0 %508 + %510 = OpDot %float %206 %507 + %511 = OpExtInst %float %1 FMax %float_0 %510 + %512 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_2 %491 + %513 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 %491 %int_3 + %514 = OpLoad %float %513 + %515 = OpFOrdEqual %bool %514 %float_0 + OpSelectionMerge %490 None + OpBranchConditional %515 %516 %517 + %517 = OpLabel + %518 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %491 %int_3 + %519 = OpLoad %float %518 + %520 = OpCompositeConstruct %v3float %519 %519 %519 + %521 = OpFMul %v3float %501 %520 + %522 = OpDot %float %521 %521 + %523 = OpExtInst %float %1 FClamp %522 %float_0 %float_1 + %524 = OpFSub %float %float_1 %523 + %525 = OpExtInst %float %1 Pow %524 %514 + OpBranch %490 + %516 = OpLabel + %526 = OpFAdd %float %502 %float_1 + %527 = OpFDiv %float %float_1 %526 + %528 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %491 %int_3 + %529 = OpLoad %float %528 + %530 = OpFMul %float %529 %529 + %531 = OpFMul %float %502 %530 + %532 = OpFMul %float %531 %531 + %533 = OpFSub %float %float_1 %532 + %534 = OpExtInst %float %1 FClamp %533 %float_0 %float_1 + %535 = OpFMul %float %534 %534 + %536 = OpFMul %float %527 %535 + OpBranch %490 + %490 = OpLabel + %537 = OpPhi %float %525 %517 %536 %516 + %538 = OpFMul %float %537 %509 + %539 = OpCompositeConstruct %v3float %538 %538 %538 + %540 = OpLoad %v4float %512 + %541 = OpVectorShuffle %v3float %540 %540 0 1 2 + %542 = OpFMul %v3float %539 %541 + %543 = OpFMul %v3float %542 %57 + %544 = OpExtInst %v3float %1 Cross %206 %507 + %545 = OpDot %float %544 %544 + %546 = OpFMul %float %511 %442 + %547 = OpFMul %float %546 %546 + %548 = OpFAdd %float %545 %547 + %549 = OpFDiv %float %442 %548 + %550 = OpFMul %float %549 %549 + %551 = OpExtInst %float %1 FMin %550 %float_65504 + %552 = OpFMul %float %439 %551 + %553 = OpFMul %float %276 %552 + %554 = OpCompositeConstruct %v3float %553 %553 %553 + %555 = OpFAdd %v3float %270 %554 + %556 = OpFMul %v3float %543 %555 + %557 = OpExtInst %v3float %1 FMin %55 %556 + %489 = OpFAdd %v3float %488 %557 + %492 = OpIAdd %int %491 %int_1 + OpBranch %487 + %496 = OpLabel + %558 = OpExtInst %v3float %1 FMax %47 %47 + %559 = OpFAdd %v3float %488 %558 + %560 = OpFAdd %v3float %270 %484 + %561 = OpCompositeConstruct %v3float %160 %160 %160 + %562 = OpExtInst %v3float %1 FMix %559 %560 %561 + %563 = OpCompositeExtract %float %142 3 + %564 = OpCompositeConstruct %v3float %563 %563 %563 + %565 = OpFMul %v3float %562 %564 + %566 = OpVectorShuffle %v3float %142 %142 0 1 2 + %567 = OpFAdd %v3float %565 %566 + %568 = OpVectorShuffle %v4float %137 %567 4 5 6 3 + %569 = OpCompositeExtract %float %143 3 + %570 = OpExtInst %float %1 FMin %569 %float_65500 + %571 = OpCompositeInsert %v4float %570 %568 3 + OpStore %out_var_SV_Target0 %571 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag new file mode 100644 index 0000000000..eba220ba4e --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/array-copy-error.asm.invalid.frag @@ -0,0 +1,878 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 353 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainPixelShader "main" %gl_FragCoord %in_var_TEXCOORD6 %in_var_TEXCOORD7 %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_TEXCOORD0 %in_var_PRIMITIVE_ID %gl_FrontFacing %gl_FragDepth %out_var_SV_Target0 + OpExecutionMode %MainPixelShader OriginUpperLeft + OpExecutionMode %MainPixelShader DepthReplacing + OpExecutionMode %MainPixelShader DepthLess + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_PrimitiveDither "type.PrimitiveDither" + OpMemberName %type_PrimitiveDither 0 "PrimitiveDither_LODFactor" + OpName %PrimitiveDither "PrimitiveDither" + OpName %type_PrimitiveFade "type.PrimitiveFade" + OpMemberName %type_PrimitiveFade 0 "PrimitiveFade_FadeTimeScaleBias" + OpName %PrimitiveFade "PrimitiveFade" + OpName %type_Material "type.Material" + OpMemberName %type_Material 0 "Material_VectorExpressions" + OpMemberName %type_Material 1 "Material_ScalarExpressions" + OpName %Material "Material" + OpName %type_2d_image "type.2d.image" + OpName %Material_Texture2D_0 "Material_Texture2D_0" + OpName %type_sampler "type.sampler" + OpName %Material_Texture2D_0Sampler "Material_Texture2D_0Sampler" + OpName %Material_Texture2D_3 "Material_Texture2D_3" + OpName %Material_Texture2D_3Sampler "Material_Texture2D_3Sampler" + OpName %in_var_TEXCOORD6 "in.var.TEXCOORD6" + OpName %in_var_TEXCOORD7 "in.var.TEXCOORD7" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_PRIMITIVE_ID "in.var.PRIMITIVE_ID" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainPixelShader "MainPixelShader" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorateString %in_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %in_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorate %in_var_PRIMITIVE_ID Flat + OpDecorate %gl_FrontFacing BuiltIn FrontFacing + OpDecorateString %gl_FrontFacing UserSemantic "SV_IsFrontFace" + OpDecorate %gl_FrontFacing Flat + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorateString %gl_FragDepth UserSemantic "SV_DepthLessEqual" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD6 Location 0 + OpDecorate %in_var_TEXCOORD7 Location 1 + OpDecorate %in_var_TEXCOORD10_centroid Location 2 + OpDecorate %in_var_TEXCOORD11_centroid Location 3 + OpDecorate %in_var_TEXCOORD0 Location 4 + OpDecorate %in_var_PRIMITIVE_ID Location 5 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %PrimitiveDither DescriptorSet 0 + OpDecorate %PrimitiveDither Binding 1 + OpDecorate %PrimitiveFade DescriptorSet 0 + OpDecorate %PrimitiveFade Binding 2 + OpDecorate %Material DescriptorSet 0 + OpDecorate %Material Binding 3 + OpDecorate %Material_Texture2D_0 DescriptorSet 0 + OpDecorate %Material_Texture2D_0 Binding 0 + OpDecorate %Material_Texture2D_0Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_0Sampler Binding 0 + OpDecorate %Material_Texture2D_3 DescriptorSet 0 + OpDecorate %Material_Texture2D_3 Binding 1 + OpDecorate %Material_Texture2D_3Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_3Sampler Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpDecorate %type_View Block + OpMemberDecorate %type_PrimitiveDither 0 Offset 0 + OpDecorate %type_PrimitiveDither Block + OpMemberDecorate %type_PrimitiveFade 0 Offset 0 + OpDecorate %type_PrimitiveFade Block + OpDecorate %_arr_v4float_uint_9 ArrayStride 16 + OpDecorate %_arr_v4float_uint_3 ArrayStride 16 + OpMemberDecorate %type_Material 0 Offset 0 + OpMemberDecorate %type_Material 1 Offset 144 + OpDecorate %type_Material Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 +%float_0_00100000005 = OpConstant %float 0.00100000005 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %49 = OpConstantComposite %v2float %float_0 %float_0 + %float_1 = OpConstant %float 1 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 +%float_0_249500006 = OpConstant %float 0.249500006 + %54 = OpConstantComposite %v2float %float_0_249500006 %float_0_249500006 +%float_0_499992371 = OpConstant %float 0.499992371 + %56 = OpConstantComposite %v2float %float_0_499992371 %float_0_499992371 + %int_32 = OpConstant %int 32 + %int_53 = OpConstant %int 53 + %int_57 = OpConstant %int 57 + %int_80 = OpConstant %int 80 + %int_82 = OpConstant %int 82 + %int_98 = OpConstant %int 98 + %uint_1 = OpConstant %uint 1 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_2 = OpConstant %float 2 + %float_n1 = OpConstant %float -1 + %67 = OpConstantComposite %v2float %float_n1 %float_n1 + %bool = OpTypeBool + %float_n0_5 = OpConstant %float -0.5 + %70 = OpConstantComposite %v3float %float_0 %float_0 %float_1 +%float_0_333299994 = OpConstant %float 0.333299994 + %uint_5 = OpConstant %uint 5 +%float_347_834503 = OpConstant %float 347.834503 +%float_3343_28369 = OpConstant %float 3343.28369 + %75 = OpConstantComposite %v2float %float_347_834503 %float_3343_28369 + %float_1000 = OpConstant %float 1000 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_PrimitiveDither = OpTypeStruct %float +%_ptr_Uniform_type_PrimitiveDither = OpTypePointer Uniform %type_PrimitiveDither +%type_PrimitiveFade = OpTypeStruct %v2float +%_ptr_Uniform_type_PrimitiveFade = OpTypePointer Uniform %type_PrimitiveFade + %uint_9 = OpConstant %uint 9 +%_arr_v4float_uint_9 = OpTypeArray %v4float %uint_9 + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%type_Material = OpTypeStruct %_arr_v4float_uint_9 %_arr_v4float_uint_3 +%_ptr_Uniform_type_Material = OpTypePointer Uniform %type_Material +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_ptr_Input__arr_v4float_uint_1 = OpTypePointer Input %_arr_v4float_uint_1 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_bool = OpTypePointer Input %bool +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %93 = OpTypeFunction %void +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%PrimitiveDither = OpVariable %_ptr_Uniform_type_PrimitiveDither Uniform +%PrimitiveFade = OpVariable %_ptr_Uniform_type_PrimitiveFade Uniform + %Material = OpVariable %_ptr_Uniform_type_Material Uniform +%Material_Texture2D_0 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_0Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%Material_Texture2D_3 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_3Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD6 = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD7 = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr_v4float_uint_1 Input +%in_var_PRIMITIVE_ID = OpVariable %_ptr_Input_uint Input +%gl_FrontFacing = OpVariable %_ptr_Input_bool Input +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %98 = OpUndef %float + %99 = OpConstantNull %v2float +%float_0_015625 = OpConstant %float 0.015625 + %101 = OpConstantComposite %v2float %float_0_015625 %float_0_015625 +%float_0_166666672 = OpConstant %float 0.166666672 + %103 = OpUndef %float + %104 = OpConstantNull %v3float +%MainPixelShader = OpFunction %void None %93 + %105 = OpLabel + %106 = OpLoad %v4float %gl_FragCoord + %107 = OpLoad %v4float %in_var_TEXCOORD6 + %108 = OpLoad %v4float %in_var_TEXCOORD7 + %109 = OpLoad %v4float %in_var_TEXCOORD10_centroid + %110 = OpLoad %v4float %in_var_TEXCOORD11_centroid + %111 = OpLoad %_arr_v4float_uint_1 %in_var_TEXCOORD0 + %112 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_4 + %113 = OpLoad %mat4v4float %112 + %114 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_11 + %115 = OpLoad %mat4v4float %114 + %116 = OpAccessChain %_ptr_Uniform_v3float %View %int_32 + %117 = OpLoad %v3float %116 + %118 = OpAccessChain %_ptr_Uniform_v4float %View %int_53 + %119 = OpLoad %v4float %118 + %120 = OpAccessChain %_ptr_Uniform_v4float %View %int_57 + %121 = OpLoad %v4float %120 + %122 = OpAccessChain %_ptr_Uniform_float %View %int_80 + %123 = OpLoad %float %122 + %124 = OpCompositeExtract %v4float %111 0 + %125 = OpVectorShuffle %v2float %99 %124 2 3 + %126 = OpVectorShuffle %v3float %109 %109 0 1 2 + %127 = OpVectorShuffle %v3float %110 %110 0 1 2 + %128 = OpExtInst %v3float %1 Cross %127 %126 + %129 = OpCompositeExtract %float %110 3 + %130 = OpCompositeConstruct %v3float %129 %129 %129 + %131 = OpFMul %v3float %128 %130 + %132 = OpCompositeConstruct %mat3v3float %126 %131 %127 + %133 = OpVectorShuffle %v2float %106 %106 0 1 + %134 = OpVectorShuffle %v2float %121 %121 0 1 + %135 = OpFSub %v2float %133 %134 + %136 = OpCompositeExtract %float %106 2 + %137 = OpCompositeConstruct %v4float %103 %103 %136 %float_1 + %138 = OpCompositeExtract %float %106 3 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + %140 = OpFMul %v4float %137 %139 + %141 = OpCompositeExtract %float %106 0 + %142 = OpCompositeExtract %float %106 1 + %143 = OpCompositeConstruct %v4float %141 %142 %136 %float_1 + %144 = OpMatrixTimesVector %v4float %115 %143 + %145 = OpVectorShuffle %v3float %144 %144 0 1 2 + %146 = OpCompositeExtract %float %144 3 + %147 = OpCompositeConstruct %v3float %146 %146 %146 + %148 = OpFDiv %v3float %145 %147 + %149 = OpFSub %v3float %148 %117 + %150 = OpFNegate %v3float %148 + %151 = OpExtInst %v3float %1 Normalize %150 + %152 = OpVectorTimesMatrix %v3float %151 %132 + %153 = OpVectorShuffle %v2float %152 %152 0 1 + %154 = OpFMul %v2float %153 %67 + %155 = OpCompositeExtract %float %152 2 + %156 = OpCompositeConstruct %v2float %155 %155 + %157 = OpFDiv %v2float %154 %156 + %158 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_0 + %159 = OpLoad %float %158 + %160 = OpCompositeConstruct %v2float %159 %159 + %161 = OpFMul %v2float %160 %157 + %162 = OpDot %float %151 %127 + %163 = OpExtInst %float %1 FAbs %162 + %164 = OpExtInst %float %1 FMax %163 %float_0 + %165 = OpExtInst %float %1 FMin %164 %float_1 + %166 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_1 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_2 + %169 = OpLoad %float %168 + %170 = OpExtInst %float %1 FMix %167 %169 %165 + %171 = OpExtInst %float %1 Floor %170 + %172 = OpFDiv %float %float_1 %170 + %173 = OpCompositeConstruct %v2float %172 %172 + %174 = OpFMul %v2float %161 %173 + %175 = OpDPdx %v2float %125 + %176 = OpDPdy %v2float %125 + %177 = OpLoad %type_2d_image %Material_Texture2D_0 + %178 = OpLoad %type_sampler %Material_Texture2D_0Sampler + OpBranch %179 + %179 = OpLabel + %180 = OpPhi %float %float_1 %105 %181 %182 + %183 = OpPhi %v2float %49 %105 %184 %182 + %185 = OpPhi %int %int_0 %105 %186 %182 + %187 = OpPhi %float %float_1 %105 %188 %182 + %189 = OpPhi %float %float_1 %105 %180 %182 + %190 = OpConvertSToF %float %185 + %191 = OpFAdd %float %171 %float_2 + %192 = OpFOrdLessThan %bool %190 %191 + OpLoopMerge %193 %182 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + %195 = OpFAdd %v2float %125 %183 + %196 = OpSampledImage %type_sampled_image %177 %178 + %197 = OpImageSampleExplicitLod %v4float %196 %195 Grad %175 %176 + %188 = OpCompositeExtract %float %197 1 + %198 = OpFOrdLessThan %bool %180 %188 + OpSelectionMerge %182 None + OpBranchConditional %198 %199 %182 + %199 = OpLabel + %200 = OpFSub %float %189 %187 + %201 = OpFSub %float %188 %180 + %202 = OpFAdd %float %200 %201 + %203 = OpFDiv %float %201 %202 + %204 = OpFMul %float %189 %203 + %205 = OpFSub %float %float_1 %203 + %206 = OpFMul %float %180 %205 + %207 = OpFAdd %float %204 %206 + %208 = OpCompositeConstruct %v2float %203 %203 + %209 = OpFMul %v2float %208 %174 + %210 = OpFSub %v2float %183 %209 + OpBranch %193 + %182 = OpLabel + %181 = OpFSub %float %180 %172 + %184 = OpFAdd %v2float %183 %174 + %186 = OpIAdd %int %185 %int_1 + OpBranch %179 + %193 = OpLabel + %211 = OpPhi %float %98 %179 %207 %199 + %212 = OpPhi %v2float %183 %179 %210 %199 + %213 = OpVectorShuffle %v2float %212 %104 0 1 + %214 = OpFAdd %v2float %125 %213 + %215 = OpAccessChain %_ptr_Uniform_float %View %int_82 + %216 = OpLoad %float %215 + %217 = OpSampledImage %type_sampled_image %177 %178 + %218 = OpImageSampleImplicitLod %v4float %217 %214 Bias %216 + %219 = OpCompositeExtract %float %218 0 + %220 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_2 %int_1 + %221 = OpLoad %float %220 + %222 = OpFMul %float %219 %221 + %223 = OpFSub %float %float_1 %222 + %224 = OpExtInst %float %1 FMax %223 %float_0 + %225 = OpExtInst %float %1 FMin %224 %float_1 + %226 = OpAccessChain %_ptr_Uniform_float %View %int_98 %int_0 + %227 = OpLoad %float %226 + %228 = OpCompositeConstruct %v2float %227 %227 + %229 = OpFAdd %v2float %135 %228 + %230 = OpCompositeExtract %float %229 0 + %231 = OpConvertFToU %uint %230 + %232 = OpCompositeExtract %float %229 1 + %233 = OpConvertFToU %uint %232 + %234 = OpIMul %uint %uint_2 %233 + %235 = OpIAdd %uint %231 %234 + %236 = OpUMod %uint %235 %uint_5 + %237 = OpConvertUToF %float %236 + %238 = OpFMul %v2float %135 %101 + %239 = OpLoad %type_2d_image %Material_Texture2D_3 + %240 = OpLoad %type_sampler %Material_Texture2D_3Sampler + %241 = OpSampledImage %type_sampled_image %239 %240 + %242 = OpImageSampleImplicitLod %v4float %241 %238 Bias %216 + %243 = OpCompositeExtract %float %242 0 + %244 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_2 %int_2 + %245 = OpLoad %float %244 + %246 = OpFMul %float %243 %245 + %247 = OpFAdd %float %237 %246 + %248 = OpFMul %float %247 %float_0_166666672 + %249 = OpFAdd %float %225 %248 + %250 = OpFAdd %float %249 %float_n0_5 + %251 = OpCompositeExtract %float %218 2 + %252 = OpFAdd %float %251 %250 + %253 = OpSampledImage %type_sampled_image %239 %240 + %254 = OpImageSampleImplicitLod %v4float %253 %238 Bias %216 + %255 = OpCompositeExtract %float %254 0 + %256 = OpFAdd %float %237 %255 + %257 = OpFMul %float %256 %float_0_166666672 + %258 = OpAccessChain %_ptr_Uniform_float %PrimitiveFade %int_0 %int_0 + %259 = OpLoad %float %258 + %260 = OpFMul %float %123 %259 + %261 = OpAccessChain %_ptr_Uniform_float %PrimitiveFade %int_0 %int_1 + %262 = OpLoad %float %261 + %263 = OpFAdd %float %260 %262 + %264 = OpExtInst %float %1 FClamp %263 %float_0 %float_1 + %265 = OpFAdd %float %264 %257 + %266 = OpFAdd %float %265 %float_n0_5 + %267 = OpFMul %float %252 %266 + %268 = OpFSub %float %float_1 %211 + %269 = OpFMul %float %268 %159 + %270 = OpCompositeExtract %float %212 0 + %271 = OpCompositeExtract %float %212 1 + %272 = OpCompositeConstruct %v3float %270 %271 %269 + %273 = OpDot %float %272 %272 + %274 = OpExtInst %float %1 Sqrt %273 + %275 = OpDPdx %v2float %125 + %276 = OpExtInst %v2float %1 FAbs %275 + %277 = OpDot %float %276 %276 + %278 = OpExtInst %float %1 Sqrt %277 + %279 = OpDPdx %v3float %149 + %280 = OpDot %float %279 %279 + %281 = OpExtInst %float %1 Sqrt %280 + %282 = OpFDiv %float %278 %281 + %283 = OpDPdy %v2float %125 + %284 = OpExtInst %v2float %1 FAbs %283 + %285 = OpDot %float %284 %284 + %286 = OpExtInst %float %1 Sqrt %285 + %287 = OpDPdy %v3float %149 + %288 = OpDot %float %287 %287 + %289 = OpExtInst %float %1 Sqrt %288 + %290 = OpFDiv %float %286 %289 + %291 = OpExtInst %float %1 FMax %282 %290 + %292 = OpCompositeExtract %v4float %113 0 + %293 = OpVectorShuffle %v3float %292 %292 0 1 2 + %294 = OpCompositeExtract %v4float %113 1 + %295 = OpVectorShuffle %v3float %294 %294 0 1 2 + %296 = OpCompositeExtract %v4float %113 2 + %297 = OpVectorShuffle %v3float %296 %296 0 1 2 + %298 = OpCompositeConstruct %mat3v3float %293 %295 %297 + %299 = OpMatrixTimesVector %v3float %298 %70 + %300 = OpDot %float %299 %151 + %301 = OpExtInst %float %1 FAbs %300 + %302 = OpFDiv %float %291 %301 + %303 = OpFDiv %float %274 %302 + %304 = OpAccessChain %_ptr_Uniform_float %PrimitiveDither %int_0 + %305 = OpLoad %float %304 + %306 = OpFOrdNotEqual %bool %305 %float_0 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %309 = OpExtInst %float %1 FAbs %305 + %310 = OpFOrdGreaterThan %bool %309 %float_0_00100000005 + OpSelectionMerge %311 None + OpBranchConditional %310 %312 %311 + %312 = OpLabel + %313 = OpExtInst %v2float %1 Floor %133 + %314 = OpDot %float %313 %75 + %315 = OpExtInst %float %1 Cos %314 + %316 = OpFMul %float %315 %float_1000 + %317 = OpExtInst %float %1 Fract %316 + %318 = OpFOrdLessThan %bool %305 %float_0 + %319 = OpFAdd %float %305 %float_1 + %320 = OpFOrdGreaterThan %bool %319 %317 + %321 = OpFOrdLessThan %bool %305 %317 + %322 = OpSelect %bool %318 %320 %321 + %323 = OpSelect %float %322 %float_1 %float_0 + %324 = OpFSub %float %323 %float_0_00100000005 + %325 = OpFOrdLessThan %bool %324 %float_0 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + OpKill + %326 = OpLabel + OpBranch %311 + %311 = OpLabel + OpBranch %307 + %307 = OpLabel + %328 = OpFSub %float %267 %float_0_333299994 + %329 = OpFOrdLessThan %bool %328 %float_0 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %330 + %331 = OpLabel + OpKill + %330 = OpLabel + %332 = OpCompositeExtract %float %140 2 + %333 = OpCompositeExtract %float %140 3 + %334 = OpFAdd %float %333 %303 + %335 = OpFDiv %float %332 %334 + %336 = OpExtInst %float %1 FMin %335 %136 + %337 = OpVectorShuffle %v2float %107 %107 0 1 + %338 = OpCompositeExtract %float %107 3 + %339 = OpCompositeConstruct %v2float %338 %338 + %340 = OpFDiv %v2float %337 %339 + %341 = OpVectorShuffle %v2float %119 %119 0 1 + %342 = OpFSub %v2float %340 %341 + %343 = OpVectorShuffle %v2float %108 %108 0 1 + %344 = OpCompositeExtract %float %108 3 + %345 = OpCompositeConstruct %v2float %344 %344 + %346 = OpFDiv %v2float %343 %345 + %347 = OpVectorShuffle %v2float %119 %119 2 3 + %348 = OpFSub %v2float %346 %347 + %349 = OpFSub %v2float %342 %348 + %350 = OpFMul %v2float %349 %54 + %351 = OpFAdd %v2float %350 %56 + %352 = OpVectorShuffle %v4float %351 %49 0 1 2 3 + OpStore %gl_FragDepth %336 + OpStore %out_var_SV_Target0 %352 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag new file mode 100644 index 0000000000..eba220ba4e --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4-no-opt/asm/frag/phi-variable-declaration.asm.invalid.frag @@ -0,0 +1,878 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 353 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainPixelShader "main" %gl_FragCoord %in_var_TEXCOORD6 %in_var_TEXCOORD7 %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_TEXCOORD0 %in_var_PRIMITIVE_ID %gl_FrontFacing %gl_FragDepth %out_var_SV_Target0 + OpExecutionMode %MainPixelShader OriginUpperLeft + OpExecutionMode %MainPixelShader DepthReplacing + OpExecutionMode %MainPixelShader DepthLess + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_PrimitiveDither "type.PrimitiveDither" + OpMemberName %type_PrimitiveDither 0 "PrimitiveDither_LODFactor" + OpName %PrimitiveDither "PrimitiveDither" + OpName %type_PrimitiveFade "type.PrimitiveFade" + OpMemberName %type_PrimitiveFade 0 "PrimitiveFade_FadeTimeScaleBias" + OpName %PrimitiveFade "PrimitiveFade" + OpName %type_Material "type.Material" + OpMemberName %type_Material 0 "Material_VectorExpressions" + OpMemberName %type_Material 1 "Material_ScalarExpressions" + OpName %Material "Material" + OpName %type_2d_image "type.2d.image" + OpName %Material_Texture2D_0 "Material_Texture2D_0" + OpName %type_sampler "type.sampler" + OpName %Material_Texture2D_0Sampler "Material_Texture2D_0Sampler" + OpName %Material_Texture2D_3 "Material_Texture2D_3" + OpName %Material_Texture2D_3Sampler "Material_Texture2D_3Sampler" + OpName %in_var_TEXCOORD6 "in.var.TEXCOORD6" + OpName %in_var_TEXCOORD7 "in.var.TEXCOORD7" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_PRIMITIVE_ID "in.var.PRIMITIVE_ID" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainPixelShader "MainPixelShader" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorateString %in_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %in_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorate %in_var_PRIMITIVE_ID Flat + OpDecorate %gl_FrontFacing BuiltIn FrontFacing + OpDecorateString %gl_FrontFacing UserSemantic "SV_IsFrontFace" + OpDecorate %gl_FrontFacing Flat + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorateString %gl_FragDepth UserSemantic "SV_DepthLessEqual" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD6 Location 0 + OpDecorate %in_var_TEXCOORD7 Location 1 + OpDecorate %in_var_TEXCOORD10_centroid Location 2 + OpDecorate %in_var_TEXCOORD11_centroid Location 3 + OpDecorate %in_var_TEXCOORD0 Location 4 + OpDecorate %in_var_PRIMITIVE_ID Location 5 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %PrimitiveDither DescriptorSet 0 + OpDecorate %PrimitiveDither Binding 1 + OpDecorate %PrimitiveFade DescriptorSet 0 + OpDecorate %PrimitiveFade Binding 2 + OpDecorate %Material DescriptorSet 0 + OpDecorate %Material Binding 3 + OpDecorate %Material_Texture2D_0 DescriptorSet 0 + OpDecorate %Material_Texture2D_0 Binding 0 + OpDecorate %Material_Texture2D_0Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_0Sampler Binding 0 + OpDecorate %Material_Texture2D_3 DescriptorSet 0 + OpDecorate %Material_Texture2D_3 Binding 1 + OpDecorate %Material_Texture2D_3Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_3Sampler Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpDecorate %type_View Block + OpMemberDecorate %type_PrimitiveDither 0 Offset 0 + OpDecorate %type_PrimitiveDither Block + OpMemberDecorate %type_PrimitiveFade 0 Offset 0 + OpDecorate %type_PrimitiveFade Block + OpDecorate %_arr_v4float_uint_9 ArrayStride 16 + OpDecorate %_arr_v4float_uint_3 ArrayStride 16 + OpMemberDecorate %type_Material 0 Offset 0 + OpMemberDecorate %type_Material 1 Offset 144 + OpDecorate %type_Material Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 +%float_0_00100000005 = OpConstant %float 0.00100000005 + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %49 = OpConstantComposite %v2float %float_0 %float_0 + %float_1 = OpConstant %float 1 + %int_4 = OpConstant %int 4 + %int_11 = OpConstant %int 11 +%float_0_249500006 = OpConstant %float 0.249500006 + %54 = OpConstantComposite %v2float %float_0_249500006 %float_0_249500006 +%float_0_499992371 = OpConstant %float 0.499992371 + %56 = OpConstantComposite %v2float %float_0_499992371 %float_0_499992371 + %int_32 = OpConstant %int 32 + %int_53 = OpConstant %int 53 + %int_57 = OpConstant %int 57 + %int_80 = OpConstant %int 80 + %int_82 = OpConstant %int 82 + %int_98 = OpConstant %int 98 + %uint_1 = OpConstant %uint 1 +%mat3v3float = OpTypeMatrix %v3float 3 + %float_2 = OpConstant %float 2 + %float_n1 = OpConstant %float -1 + %67 = OpConstantComposite %v2float %float_n1 %float_n1 + %bool = OpTypeBool + %float_n0_5 = OpConstant %float -0.5 + %70 = OpConstantComposite %v3float %float_0 %float_0 %float_1 +%float_0_333299994 = OpConstant %float 0.333299994 + %uint_5 = OpConstant %uint 5 +%float_347_834503 = OpConstant %float 347.834503 +%float_3343_28369 = OpConstant %float 3343.28369 + %75 = OpConstantComposite %v2float %float_347_834503 %float_3343_28369 + %float_1000 = OpConstant %float 1000 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_PrimitiveDither = OpTypeStruct %float +%_ptr_Uniform_type_PrimitiveDither = OpTypePointer Uniform %type_PrimitiveDither +%type_PrimitiveFade = OpTypeStruct %v2float +%_ptr_Uniform_type_PrimitiveFade = OpTypePointer Uniform %type_PrimitiveFade + %uint_9 = OpConstant %uint 9 +%_arr_v4float_uint_9 = OpTypeArray %v4float %uint_9 + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%type_Material = OpTypeStruct %_arr_v4float_uint_9 %_arr_v4float_uint_3 +%_ptr_Uniform_type_Material = OpTypePointer Uniform %type_Material +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_ptr_Input__arr_v4float_uint_1 = OpTypePointer Input %_arr_v4float_uint_1 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_bool = OpTypePointer Input %bool +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %93 = OpTypeFunction %void +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%PrimitiveDither = OpVariable %_ptr_Uniform_type_PrimitiveDither Uniform +%PrimitiveFade = OpVariable %_ptr_Uniform_type_PrimitiveFade Uniform + %Material = OpVariable %_ptr_Uniform_type_Material Uniform +%Material_Texture2D_0 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_0Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%Material_Texture2D_3 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_3Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD6 = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD7 = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr_v4float_uint_1 Input +%in_var_PRIMITIVE_ID = OpVariable %_ptr_Input_uint Input +%gl_FrontFacing = OpVariable %_ptr_Input_bool Input +%gl_FragDepth = OpVariable %_ptr_Output_float Output +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %98 = OpUndef %float + %99 = OpConstantNull %v2float +%float_0_015625 = OpConstant %float 0.015625 + %101 = OpConstantComposite %v2float %float_0_015625 %float_0_015625 +%float_0_166666672 = OpConstant %float 0.166666672 + %103 = OpUndef %float + %104 = OpConstantNull %v3float +%MainPixelShader = OpFunction %void None %93 + %105 = OpLabel + %106 = OpLoad %v4float %gl_FragCoord + %107 = OpLoad %v4float %in_var_TEXCOORD6 + %108 = OpLoad %v4float %in_var_TEXCOORD7 + %109 = OpLoad %v4float %in_var_TEXCOORD10_centroid + %110 = OpLoad %v4float %in_var_TEXCOORD11_centroid + %111 = OpLoad %_arr_v4float_uint_1 %in_var_TEXCOORD0 + %112 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_4 + %113 = OpLoad %mat4v4float %112 + %114 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_11 + %115 = OpLoad %mat4v4float %114 + %116 = OpAccessChain %_ptr_Uniform_v3float %View %int_32 + %117 = OpLoad %v3float %116 + %118 = OpAccessChain %_ptr_Uniform_v4float %View %int_53 + %119 = OpLoad %v4float %118 + %120 = OpAccessChain %_ptr_Uniform_v4float %View %int_57 + %121 = OpLoad %v4float %120 + %122 = OpAccessChain %_ptr_Uniform_float %View %int_80 + %123 = OpLoad %float %122 + %124 = OpCompositeExtract %v4float %111 0 + %125 = OpVectorShuffle %v2float %99 %124 2 3 + %126 = OpVectorShuffle %v3float %109 %109 0 1 2 + %127 = OpVectorShuffle %v3float %110 %110 0 1 2 + %128 = OpExtInst %v3float %1 Cross %127 %126 + %129 = OpCompositeExtract %float %110 3 + %130 = OpCompositeConstruct %v3float %129 %129 %129 + %131 = OpFMul %v3float %128 %130 + %132 = OpCompositeConstruct %mat3v3float %126 %131 %127 + %133 = OpVectorShuffle %v2float %106 %106 0 1 + %134 = OpVectorShuffle %v2float %121 %121 0 1 + %135 = OpFSub %v2float %133 %134 + %136 = OpCompositeExtract %float %106 2 + %137 = OpCompositeConstruct %v4float %103 %103 %136 %float_1 + %138 = OpCompositeExtract %float %106 3 + %139 = OpCompositeConstruct %v4float %138 %138 %138 %138 + %140 = OpFMul %v4float %137 %139 + %141 = OpCompositeExtract %float %106 0 + %142 = OpCompositeExtract %float %106 1 + %143 = OpCompositeConstruct %v4float %141 %142 %136 %float_1 + %144 = OpMatrixTimesVector %v4float %115 %143 + %145 = OpVectorShuffle %v3float %144 %144 0 1 2 + %146 = OpCompositeExtract %float %144 3 + %147 = OpCompositeConstruct %v3float %146 %146 %146 + %148 = OpFDiv %v3float %145 %147 + %149 = OpFSub %v3float %148 %117 + %150 = OpFNegate %v3float %148 + %151 = OpExtInst %v3float %1 Normalize %150 + %152 = OpVectorTimesMatrix %v3float %151 %132 + %153 = OpVectorShuffle %v2float %152 %152 0 1 + %154 = OpFMul %v2float %153 %67 + %155 = OpCompositeExtract %float %152 2 + %156 = OpCompositeConstruct %v2float %155 %155 + %157 = OpFDiv %v2float %154 %156 + %158 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_0 + %159 = OpLoad %float %158 + %160 = OpCompositeConstruct %v2float %159 %159 + %161 = OpFMul %v2float %160 %157 + %162 = OpDot %float %151 %127 + %163 = OpExtInst %float %1 FAbs %162 + %164 = OpExtInst %float %1 FMax %163 %float_0 + %165 = OpExtInst %float %1 FMin %164 %float_1 + %166 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_1 + %167 = OpLoad %float %166 + %168 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_2 + %169 = OpLoad %float %168 + %170 = OpExtInst %float %1 FMix %167 %169 %165 + %171 = OpExtInst %float %1 Floor %170 + %172 = OpFDiv %float %float_1 %170 + %173 = OpCompositeConstruct %v2float %172 %172 + %174 = OpFMul %v2float %161 %173 + %175 = OpDPdx %v2float %125 + %176 = OpDPdy %v2float %125 + %177 = OpLoad %type_2d_image %Material_Texture2D_0 + %178 = OpLoad %type_sampler %Material_Texture2D_0Sampler + OpBranch %179 + %179 = OpLabel + %180 = OpPhi %float %float_1 %105 %181 %182 + %183 = OpPhi %v2float %49 %105 %184 %182 + %185 = OpPhi %int %int_0 %105 %186 %182 + %187 = OpPhi %float %float_1 %105 %188 %182 + %189 = OpPhi %float %float_1 %105 %180 %182 + %190 = OpConvertSToF %float %185 + %191 = OpFAdd %float %171 %float_2 + %192 = OpFOrdLessThan %bool %190 %191 + OpLoopMerge %193 %182 None + OpBranchConditional %192 %194 %193 + %194 = OpLabel + %195 = OpFAdd %v2float %125 %183 + %196 = OpSampledImage %type_sampled_image %177 %178 + %197 = OpImageSampleExplicitLod %v4float %196 %195 Grad %175 %176 + %188 = OpCompositeExtract %float %197 1 + %198 = OpFOrdLessThan %bool %180 %188 + OpSelectionMerge %182 None + OpBranchConditional %198 %199 %182 + %199 = OpLabel + %200 = OpFSub %float %189 %187 + %201 = OpFSub %float %188 %180 + %202 = OpFAdd %float %200 %201 + %203 = OpFDiv %float %201 %202 + %204 = OpFMul %float %189 %203 + %205 = OpFSub %float %float_1 %203 + %206 = OpFMul %float %180 %205 + %207 = OpFAdd %float %204 %206 + %208 = OpCompositeConstruct %v2float %203 %203 + %209 = OpFMul %v2float %208 %174 + %210 = OpFSub %v2float %183 %209 + OpBranch %193 + %182 = OpLabel + %181 = OpFSub %float %180 %172 + %184 = OpFAdd %v2float %183 %174 + %186 = OpIAdd %int %185 %int_1 + OpBranch %179 + %193 = OpLabel + %211 = OpPhi %float %98 %179 %207 %199 + %212 = OpPhi %v2float %183 %179 %210 %199 + %213 = OpVectorShuffle %v2float %212 %104 0 1 + %214 = OpFAdd %v2float %125 %213 + %215 = OpAccessChain %_ptr_Uniform_float %View %int_82 + %216 = OpLoad %float %215 + %217 = OpSampledImage %type_sampled_image %177 %178 + %218 = OpImageSampleImplicitLod %v4float %217 %214 Bias %216 + %219 = OpCompositeExtract %float %218 0 + %220 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_2 %int_1 + %221 = OpLoad %float %220 + %222 = OpFMul %float %219 %221 + %223 = OpFSub %float %float_1 %222 + %224 = OpExtInst %float %1 FMax %223 %float_0 + %225 = OpExtInst %float %1 FMin %224 %float_1 + %226 = OpAccessChain %_ptr_Uniform_float %View %int_98 %int_0 + %227 = OpLoad %float %226 + %228 = OpCompositeConstruct %v2float %227 %227 + %229 = OpFAdd %v2float %135 %228 + %230 = OpCompositeExtract %float %229 0 + %231 = OpConvertFToU %uint %230 + %232 = OpCompositeExtract %float %229 1 + %233 = OpConvertFToU %uint %232 + %234 = OpIMul %uint %uint_2 %233 + %235 = OpIAdd %uint %231 %234 + %236 = OpUMod %uint %235 %uint_5 + %237 = OpConvertUToF %float %236 + %238 = OpFMul %v2float %135 %101 + %239 = OpLoad %type_2d_image %Material_Texture2D_3 + %240 = OpLoad %type_sampler %Material_Texture2D_3Sampler + %241 = OpSampledImage %type_sampled_image %239 %240 + %242 = OpImageSampleImplicitLod %v4float %241 %238 Bias %216 + %243 = OpCompositeExtract %float %242 0 + %244 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_2 %int_2 + %245 = OpLoad %float %244 + %246 = OpFMul %float %243 %245 + %247 = OpFAdd %float %237 %246 + %248 = OpFMul %float %247 %float_0_166666672 + %249 = OpFAdd %float %225 %248 + %250 = OpFAdd %float %249 %float_n0_5 + %251 = OpCompositeExtract %float %218 2 + %252 = OpFAdd %float %251 %250 + %253 = OpSampledImage %type_sampled_image %239 %240 + %254 = OpImageSampleImplicitLod %v4float %253 %238 Bias %216 + %255 = OpCompositeExtract %float %254 0 + %256 = OpFAdd %float %237 %255 + %257 = OpFMul %float %256 %float_0_166666672 + %258 = OpAccessChain %_ptr_Uniform_float %PrimitiveFade %int_0 %int_0 + %259 = OpLoad %float %258 + %260 = OpFMul %float %123 %259 + %261 = OpAccessChain %_ptr_Uniform_float %PrimitiveFade %int_0 %int_1 + %262 = OpLoad %float %261 + %263 = OpFAdd %float %260 %262 + %264 = OpExtInst %float %1 FClamp %263 %float_0 %float_1 + %265 = OpFAdd %float %264 %257 + %266 = OpFAdd %float %265 %float_n0_5 + %267 = OpFMul %float %252 %266 + %268 = OpFSub %float %float_1 %211 + %269 = OpFMul %float %268 %159 + %270 = OpCompositeExtract %float %212 0 + %271 = OpCompositeExtract %float %212 1 + %272 = OpCompositeConstruct %v3float %270 %271 %269 + %273 = OpDot %float %272 %272 + %274 = OpExtInst %float %1 Sqrt %273 + %275 = OpDPdx %v2float %125 + %276 = OpExtInst %v2float %1 FAbs %275 + %277 = OpDot %float %276 %276 + %278 = OpExtInst %float %1 Sqrt %277 + %279 = OpDPdx %v3float %149 + %280 = OpDot %float %279 %279 + %281 = OpExtInst %float %1 Sqrt %280 + %282 = OpFDiv %float %278 %281 + %283 = OpDPdy %v2float %125 + %284 = OpExtInst %v2float %1 FAbs %283 + %285 = OpDot %float %284 %284 + %286 = OpExtInst %float %1 Sqrt %285 + %287 = OpDPdy %v3float %149 + %288 = OpDot %float %287 %287 + %289 = OpExtInst %float %1 Sqrt %288 + %290 = OpFDiv %float %286 %289 + %291 = OpExtInst %float %1 FMax %282 %290 + %292 = OpCompositeExtract %v4float %113 0 + %293 = OpVectorShuffle %v3float %292 %292 0 1 2 + %294 = OpCompositeExtract %v4float %113 1 + %295 = OpVectorShuffle %v3float %294 %294 0 1 2 + %296 = OpCompositeExtract %v4float %113 2 + %297 = OpVectorShuffle %v3float %296 %296 0 1 2 + %298 = OpCompositeConstruct %mat3v3float %293 %295 %297 + %299 = OpMatrixTimesVector %v3float %298 %70 + %300 = OpDot %float %299 %151 + %301 = OpExtInst %float %1 FAbs %300 + %302 = OpFDiv %float %291 %301 + %303 = OpFDiv %float %274 %302 + %304 = OpAccessChain %_ptr_Uniform_float %PrimitiveDither %int_0 + %305 = OpLoad %float %304 + %306 = OpFOrdNotEqual %bool %305 %float_0 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %307 + %308 = OpLabel + %309 = OpExtInst %float %1 FAbs %305 + %310 = OpFOrdGreaterThan %bool %309 %float_0_00100000005 + OpSelectionMerge %311 None + OpBranchConditional %310 %312 %311 + %312 = OpLabel + %313 = OpExtInst %v2float %1 Floor %133 + %314 = OpDot %float %313 %75 + %315 = OpExtInst %float %1 Cos %314 + %316 = OpFMul %float %315 %float_1000 + %317 = OpExtInst %float %1 Fract %316 + %318 = OpFOrdLessThan %bool %305 %float_0 + %319 = OpFAdd %float %305 %float_1 + %320 = OpFOrdGreaterThan %bool %319 %317 + %321 = OpFOrdLessThan %bool %305 %317 + %322 = OpSelect %bool %318 %320 %321 + %323 = OpSelect %float %322 %float_1 %float_0 + %324 = OpFSub %float %323 %float_0_00100000005 + %325 = OpFOrdLessThan %bool %324 %float_0 + OpSelectionMerge %326 None + OpBranchConditional %325 %327 %326 + %327 = OpLabel + OpKill + %326 = OpLabel + OpBranch %311 + %311 = OpLabel + OpBranch %307 + %307 = OpLabel + %328 = OpFSub %float %267 %float_0_333299994 + %329 = OpFOrdLessThan %bool %328 %float_0 + OpSelectionMerge %330 None + OpBranchConditional %329 %331 %330 + %331 = OpLabel + OpKill + %330 = OpLabel + %332 = OpCompositeExtract %float %140 2 + %333 = OpCompositeExtract %float %140 3 + %334 = OpFAdd %float %333 %303 + %335 = OpFDiv %float %332 %334 + %336 = OpExtInst %float %1 FMin %335 %136 + %337 = OpVectorShuffle %v2float %107 %107 0 1 + %338 = OpCompositeExtract %float %107 3 + %339 = OpCompositeConstruct %v2float %338 %338 + %340 = OpFDiv %v2float %337 %339 + %341 = OpVectorShuffle %v2float %119 %119 0 1 + %342 = OpFSub %v2float %340 %341 + %343 = OpVectorShuffle %v2float %108 %108 0 1 + %344 = OpCompositeExtract %float %108 3 + %345 = OpCompositeConstruct %v2float %344 %344 + %346 = OpFDiv %v2float %343 %345 + %347 = OpVectorShuffle %v2float %119 %119 2 3 + %348 = OpFSub %v2float %346 %347 + %349 = OpFSub %v2float %342 %348 + %350 = OpFMul %v2float %349 %54 + %351 = OpFAdd %v2float %350 %56 + %352 = OpVectorShuffle %v4float %351 %49 0 1 2 3 + OpStore %gl_FragDepth %336 + OpStore %out_var_SV_Target0 %352 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese b/third_party/spirv-cross/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese new file mode 100644 index 0000000000..778e93d39a --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4-no-opt/asm/tese/ds-texcoord-array.asm.tese @@ -0,0 +1,715 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 183 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %MainDomain "main" %gl_TessLevelOuter %gl_TessLevelInner %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_TEXCOORD0 %in_var_COLOR1 %in_var_COLOR2 %in_var_VS_To_DS_Position %in_var_TEXCOORD7 %in_var_Flat_DisplacementScales %in_var_Flat_TessellationMultiplier %in_var_Flat_WorldDisplacementMultiplier %gl_TessCoord %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_TEXCOORD0 %out_var_COLOR1 %out_var_COLOR2 %out_var_TEXCOORD6 %out_var_TEXCOORD7 %gl_Position + OpExecutionMode %MainDomain Triangles + OpExecutionMode %MainDomain SpacingFractionalOdd + OpExecutionMode %MainDomain VertexOrderCw + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpMemberName %type_View 179 "PrePadding_View_3048" + OpMemberName %type_View 180 "PrePadding_View_3052" + OpMemberName %type_View 181 "View_WorldToVirtualTexture" + OpMemberName %type_View 182 "View_VirtualTextureParams" + OpMemberName %type_View 183 "View_XRPassthroughCameraUVs" + OpName %View "View" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_COLOR1 "in.var.COLOR1" + OpName %in_var_COLOR2 "in.var.COLOR2" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %in_var_TEXCOORD7 "in.var.TEXCOORD7" + OpName %in_var_Flat_DisplacementScales "in.var.Flat_DisplacementScales" + OpName %in_var_Flat_TessellationMultiplier "in.var.Flat_TessellationMultiplier" + OpName %in_var_Flat_WorldDisplacementMultiplier "in.var.Flat_WorldDisplacementMultiplier" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_COLOR1 "out.var.COLOR1" + OpName %out_var_COLOR2 "out.var.COLOR2" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %out_var_TEXCOORD7 "out.var.TEXCOORD7" + OpName %MainDomain "MainDomain" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_COLOR1 UserSemantic "COLOR1" + OpDecorateString %in_var_COLOR2 UserSemantic "COLOR2" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %in_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorateString %in_var_Flat_DisplacementScales UserSemantic "Flat_DisplacementScales" + OpDecorateString %in_var_Flat_TessellationMultiplier UserSemantic "Flat_TessellationMultiplier" + OpDecorateString %in_var_Flat_WorldDisplacementMultiplier UserSemantic "Flat_WorldDisplacementMultiplier" + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorateString %gl_TessCoord UserSemantic "SV_DomainLocation" + OpDecorate %gl_TessCoord Patch + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_COLOR1 UserSemantic "COLOR1" + OpDecorateString %out_var_COLOR2 UserSemantic "COLOR2" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %out_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %in_var_COLOR1 Location 0 + OpDecorate %in_var_COLOR2 Location 1 + OpDecorate %in_var_Flat_DisplacementScales Location 2 + OpDecorate %in_var_Flat_TessellationMultiplier Location 3 + OpDecorate %in_var_Flat_WorldDisplacementMultiplier Location 4 + OpDecorate %in_var_TEXCOORD0 Location 5 + OpDecorate %in_var_TEXCOORD10_centroid Location 6 + OpDecorate %in_var_TEXCOORD11_centroid Location 7 + OpDecorate %in_var_TEXCOORD7 Location 8 + OpDecorate %in_var_VS_To_DS_Position Location 9 + OpDecorate %out_var_TEXCOORD10_centroid Location 0 + OpDecorate %out_var_TEXCOORD11_centroid Location 1 + OpDecorate %out_var_TEXCOORD0 Location 2 + OpDecorate %out_var_COLOR1 Location 3 + OpDecorate %out_var_COLOR2 Location 4 + OpDecorate %out_var_TEXCOORD6 Location 5 + OpDecorate %out_var_TEXCOORD7 Location 6 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpMemberDecorate %type_View 179 Offset 3048 + OpMemberDecorate %type_View 180 Offset 3052 + OpMemberDecorate %type_View 181 Offset 3056 + OpMemberDecorate %type_View 181 MatrixStride 16 + OpMemberDecorate %type_View 181 ColMajor + OpMemberDecorate %type_View 182 Offset 3120 + OpMemberDecorate %type_View 183 Offset 3136 + OpDecorate %type_View Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint_1 = OpConstant %uint 1 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float %float %float %mat4v4float %v4float %_arr_v4float_uint_2 +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_arr__arr_v4float_uint_1_uint_3 = OpTypeArray %_arr_v4float_uint_1 %uint_3 +%_ptr_Input__arr__arr_v4float_uint_1_uint_3 = OpTypePointer Input %_arr__arr_v4float_uint_1_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Input__arr_v3float_uint_3 = OpTypePointer Input %_arr_v3float_uint_3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Input__arr_float_uint_3 = OpTypePointer Input %_arr_float_uint_3 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output__arr_v4float_uint_1 = OpTypePointer Output %_arr_v4float_uint_1 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %63 = OpTypeFunction %void +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float + %View = OpVariable %_ptr_Uniform_type_View Uniform +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr__arr_v4float_uint_1_uint_3 Input +%in_var_COLOR1 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_COLOR2 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD7 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_Flat_DisplacementScales = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_Flat_TessellationMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_Flat_WorldDisplacementMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD0 = OpVariable %_ptr_Output__arr_v4float_uint_1 Output +%out_var_COLOR1 = OpVariable %_ptr_Output_v4float Output +%out_var_COLOR2 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD7 = OpVariable %_ptr_Output_v3float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output +%_ptr_Function__arr_v4float_uint_1 = OpTypePointer Function %_arr_v4float_uint_1 + %68 = OpUndef %v4float + %69 = OpConstantNull %v4float + %MainDomain = OpFunction %void None %63 + %70 = OpLabel + %71 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %72 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %73 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %74 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %75 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %76 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %77 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD10_centroid + %78 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD11_centroid + %79 = OpLoad %_arr__arr_v4float_uint_1_uint_3 %in_var_TEXCOORD0 + %80 = OpLoad %_arr_v4float_uint_3 %in_var_COLOR1 + %81 = OpLoad %_arr_v4float_uint_3 %in_var_COLOR2 + %82 = OpCompositeExtract %v4float %77 0 + %83 = OpCompositeExtract %v4float %78 0 + %84 = OpCompositeExtract %_arr_v4float_uint_1 %79 0 + %85 = OpCompositeExtract %v4float %80 0 + %86 = OpCompositeExtract %v4float %81 0 + %87 = OpCompositeExtract %v4float %77 1 + %88 = OpCompositeExtract %v4float %78 1 + %89 = OpCompositeExtract %_arr_v4float_uint_1 %79 1 + %90 = OpCompositeExtract %v4float %80 1 + %91 = OpCompositeExtract %v4float %81 1 + %92 = OpCompositeExtract %v4float %77 2 + %93 = OpCompositeExtract %v4float %78 2 + %94 = OpCompositeExtract %_arr_v4float_uint_1 %79 2 + %95 = OpCompositeExtract %v4float %80 2 + %96 = OpCompositeExtract %v4float %81 2 + %97 = OpLoad %_arr_v4float_uint_3 %in_var_VS_To_DS_Position + %98 = OpLoad %_arr_v3float_uint_3 %in_var_TEXCOORD7 + %99 = OpCompositeExtract %v4float %97 0 + %100 = OpCompositeExtract %v3float %98 0 + %101 = OpCompositeExtract %v4float %97 1 + %102 = OpCompositeExtract %v3float %98 1 + %103 = OpCompositeExtract %v4float %97 2 + %104 = OpCompositeExtract %v3float %98 2 + %105 = OpLoad %v3float %gl_TessCoord + %106 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %107 = OpLoad %mat4v4float %106 + %108 = OpCompositeExtract %float %105 0 + %109 = OpCompositeExtract %float %105 1 + %110 = OpCompositeExtract %float %105 2 + %111 = OpCompositeConstruct %v4float %108 %108 %108 %108 + %112 = OpFMul %v4float %99 %111 + %113 = OpCompositeConstruct %v4float %109 %109 %109 %109 + %114 = OpFMul %v4float %101 %113 + %115 = OpFAdd %v4float %112 %114 + %116 = OpCompositeConstruct %v4float %110 %110 %110 %110 + %117 = OpFMul %v4float %103 %116 + %118 = OpFAdd %v4float %115 %117 + OpStore %72 %84 + OpStore %71 %89 + %119 = OpVectorShuffle %v3float %82 %82 0 1 2 + %120 = OpCompositeConstruct %v3float %108 %108 %108 + %121 = OpFMul %v3float %119 %120 + %122 = OpVectorShuffle %v3float %87 %87 0 1 2 + %123 = OpCompositeConstruct %v3float %109 %109 %109 + %124 = OpFMul %v3float %122 %123 + %125 = OpFAdd %v3float %121 %124 + %126 = OpFMul %v4float %83 %111 + %127 = OpFMul %v4float %88 %113 + %128 = OpFAdd %v4float %126 %127 + %129 = OpFMul %v4float %85 %111 + %130 = OpFMul %v4float %90 %113 + %131 = OpFAdd %v4float %129 %130 + OpBranch %132 + %132 = OpLabel + %133 = OpPhi %int %int_0 %70 %134 %135 + %136 = OpSLessThan %bool %133 %int_1 + OpLoopMerge %137 %135 None + OpBranchConditional %136 %135 %137 + %135 = OpLabel + %138 = OpAccessChain %_ptr_Function_v4float %72 %133 + %139 = OpLoad %v4float %138 + %140 = OpFMul %v4float %139 %111 + %141 = OpAccessChain %_ptr_Function_v4float %71 %133 + %142 = OpLoad %v4float %141 + %143 = OpFMul %v4float %142 %113 + %144 = OpFAdd %v4float %140 %143 + %145 = OpAccessChain %_ptr_Function_v4float %73 %133 + OpStore %145 %144 + %134 = OpIAdd %int %133 %int_1 + OpBranch %132 + %137 = OpLabel + %146 = OpFMul %v4float %86 %111 + %147 = OpFMul %v4float %91 %113 + %148 = OpFAdd %v4float %146 %147 + %149 = OpLoad %_arr_v4float_uint_1 %73 + %150 = OpFMul %v3float %100 %120 + %151 = OpFMul %v3float %102 %123 + %152 = OpFAdd %v3float %150 %151 + OpStore %75 %149 + OpStore %74 %94 + %153 = OpVectorShuffle %v3float %125 %69 0 1 2 + %154 = OpVectorShuffle %v3float %92 %92 0 1 2 + %155 = OpCompositeConstruct %v3float %110 %110 %110 + %156 = OpFMul %v3float %154 %155 + %157 = OpFAdd %v3float %153 %156 + %158 = OpVectorShuffle %v4float %68 %157 4 5 6 3 + %159 = OpFMul %v4float %93 %116 + %160 = OpFAdd %v4float %128 %159 + %161 = OpFMul %v4float %95 %116 + %162 = OpFAdd %v4float %131 %161 + OpBranch %163 + %163 = OpLabel + %164 = OpPhi %int %int_0 %137 %165 %166 + %167 = OpSLessThan %bool %164 %int_1 + OpLoopMerge %168 %166 None + OpBranchConditional %167 %166 %168 + %166 = OpLabel + %169 = OpAccessChain %_ptr_Function_v4float %75 %164 + %170 = OpLoad %v4float %169 + %171 = OpAccessChain %_ptr_Function_v4float %74 %164 + %172 = OpLoad %v4float %171 + %173 = OpFMul %v4float %172 %116 + %174 = OpFAdd %v4float %170 %173 + %175 = OpAccessChain %_ptr_Function_v4float %76 %164 + OpStore %175 %174 + %165 = OpIAdd %int %164 %int_1 + OpBranch %163 + %168 = OpLabel + %176 = OpFMul %v4float %96 %116 + %177 = OpFAdd %v4float %148 %176 + %178 = OpLoad %_arr_v4float_uint_1 %76 + %179 = OpFMul %v3float %104 %155 + %180 = OpFAdd %v3float %152 %179 + %181 = OpVectorShuffle %v4float %118 %118 4 5 6 3 + %182 = OpMatrixTimesVector %v4float %107 %181 + OpStore %out_var_TEXCOORD10_centroid %158 + OpStore %out_var_TEXCOORD11_centroid %160 + OpStore %out_var_TEXCOORD0 %178 + OpStore %out_var_COLOR1 %162 + OpStore %out_var_COLOR2 %177 + OpStore %out_var_TEXCOORD6 %181 + OpStore %out_var_TEXCOORD7 %180 + OpStore %gl_Position %182 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert b/third_party/spirv-cross/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert new file mode 100644 index 0000000000..693f16c009 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4-no-opt/asm/vert/loop-accesschain-writethrough.asm.invalid.vert @@ -0,0 +1,259 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 181 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %ScatterMainVS "main" %gl_VertexIndex %gl_InstanceIndex %out_var_TEXCOORD0 %out_var_TEXCOORD1 %out_var_TEXCOORD2 %out_var_TEXCOORD3 %out_var_TEXCOORD4 %out_var_TEXCOORD5 %out_var_TEXCOORD6 %gl_Position + OpSource HLSL 600 + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "ViewportSize" + OpMemberName %type__Globals 1 "ScatteringScaling" + OpMemberName %type__Globals 2 "CocRadiusToCircumscribedRadius" + OpName %_Globals "$Globals" + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %ScatterDrawList "ScatterDrawList" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_TEXCOORD1 "out.var.TEXCOORD1" + OpName %out_var_TEXCOORD2 "out.var.TEXCOORD2" + OpName %out_var_TEXCOORD3 "out.var.TEXCOORD3" + OpName %out_var_TEXCOORD4 "out.var.TEXCOORD4" + OpName %out_var_TEXCOORD5 "out.var.TEXCOORD5" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %ScatterMainVS "ScatterMainVS" + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorateString %gl_VertexIndex UserSemantic "SV_VertexID" + OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex + OpDecorateString %gl_InstanceIndex UserSemantic "SV_InstanceID" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_TEXCOORD1 UserSemantic "TEXCOORD1" + OpDecorateString %out_var_TEXCOORD2 UserSemantic "TEXCOORD2" + OpDecorateString %out_var_TEXCOORD3 UserSemantic "TEXCOORD3" + OpDecorateString %out_var_TEXCOORD4 UserSemantic "TEXCOORD4" + OpDecorateString %out_var_TEXCOORD5 UserSemantic "TEXCOORD5" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %out_var_TEXCOORD0 Location 0 + OpDecorate %out_var_TEXCOORD1 Location 1 + OpDecorate %out_var_TEXCOORD2 Location 2 + OpDecorate %out_var_TEXCOORD3 Location 3 + OpDecorate %out_var_TEXCOORD4 Location 4 + OpDecorate %out_var_TEXCOORD5 Location 5 + OpDecorate %out_var_TEXCOORD6 Location 6 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 1 + OpDecorate %ScatterDrawList DescriptorSet 0 + OpDecorate %ScatterDrawList Binding 0 + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 20 + OpDecorate %type__Globals Block + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %float_0_5 = OpConstant %float 0.5 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %uint_16 = OpConstant %uint 16 + %float_0 = OpConstant %float 0 + %uint_0 = OpConstant %uint 0 + %uint_5 = OpConstant %uint 5 + %uint_1 = OpConstant %uint 1 + %int_3 = OpConstant %int 3 + %float_n0_5 = OpConstant %float -0.5 + %int_2 = OpConstant %int 2 + %float_2 = OpConstant %float 2 + %39 = OpConstantComposite %v2float %float_2 %float_2 + %40 = OpConstantComposite %v2float %float_1 %float_1 + %41 = OpConstantComposite %v2float %float_0_5 %float_0_5 +%type__Globals = OpTypeStruct %v4float %float %float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %48 = OpTypeFunction %void +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Function__arr_float_uint_4 = OpTypePointer Function %_arr_float_uint_4 +%_arr_v2float_uint_4 = OpTypeArray %v2float %uint_4 +%_ptr_Function__arr_v2float_uint_4 = OpTypePointer Function %_arr_v2float_uint_4 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%ScatterDrawList = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform +%gl_VertexIndex = OpVariable %_ptr_Input_uint Input +%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input +%out_var_TEXCOORD0 = OpVariable %_ptr_Output_v2float Output +%out_var_TEXCOORD1 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD2 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD3 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD4 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD5 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_v4float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output +%ScatterMainVS = OpFunction %void None %48 + %60 = OpLabel + %61 = OpVariable %_ptr_Function__arr_v4float_uint_4 Function + %62 = OpVariable %_ptr_Function__arr_float_uint_4 Function + %63 = OpVariable %_ptr_Function__arr_v2float_uint_4 Function + %64 = OpLoad %uint %gl_VertexIndex + %65 = OpLoad %uint %gl_InstanceIndex + %66 = OpUDiv %uint %64 %uint_4 + %67 = OpIMul %uint %66 %uint_4 + %68 = OpISub %uint %64 %67 + %69 = OpIMul %uint %uint_16 %65 + %70 = OpIAdd %uint %69 %66 + OpBranch %71 + %71 = OpLabel + %72 = OpPhi %float %float_0 %60 %73 %74 + %75 = OpPhi %uint %uint_0 %60 %76 %74 + %77 = OpULessThan %bool %75 %uint_4 + OpLoopMerge %78 %74 Unroll + OpBranchConditional %77 %79 %78 + %79 = OpLabel + %80 = OpIMul %uint %uint_5 %70 + %81 = OpIAdd %uint %80 %75 + %82 = OpIAdd %uint %81 %uint_1 + %83 = OpAccessChain %_ptr_Uniform_v4float %ScatterDrawList %int_0 %82 + %84 = OpLoad %v4float %83 + %85 = OpCompositeExtract %float %84 0 + %86 = OpCompositeExtract %float %84 1 + %87 = OpCompositeExtract %float %84 2 + %88 = OpCompositeConstruct %v4float %85 %86 %87 %float_0 + %89 = OpAccessChain %_ptr_Function_v4float %61 %75 + OpStore %89 %88 + %90 = OpCompositeExtract %float %84 3 + %91 = OpAccessChain %_ptr_Function_float %62 %75 + OpStore %91 %90 + %92 = OpIEqual %bool %75 %uint_0 + OpSelectionMerge %74 None + OpBranchConditional %92 %93 %94 + %93 = OpLabel + %95 = OpLoad %float %91 + OpBranch %74 + %94 = OpLabel + %96 = OpLoad %float %91 + %97 = OpExtInst %float %1 FMax %72 %96 + OpBranch %74 + %74 = OpLabel + %73 = OpPhi %float %95 %93 %97 %94 + %98 = OpLoad %float %91 + %99 = OpFDiv %float %float_n0_5 %98 + %100 = OpAccessChain %_ptr_Function_float %63 %75 %int_0 + OpStore %100 %99 + %101 = OpLoad %float %91 + %102 = OpFMul %float %float_0_5 %101 + %103 = OpFAdd %float %102 %float_0_5 + %104 = OpAccessChain %_ptr_Function_float %63 %75 %int_1 + OpStore %104 %103 + %76 = OpIAdd %uint %75 %uint_1 + OpBranch %71 + %78 = OpLabel + %105 = OpAccessChain %_ptr_Function_v4float %61 %int_0 + %106 = OpLoad %v4float %105 + %107 = OpCompositeExtract %float %106 0 + %108 = OpCompositeExtract %float %106 1 + %109 = OpCompositeExtract %float %106 2 + %110 = OpAccessChain %_ptr_Function_float %62 %int_0 + %111 = OpLoad %float %110 + %112 = OpCompositeConstruct %v4float %107 %108 %109 %111 + %113 = OpAccessChain %_ptr_Function_v4float %61 %int_1 + %114 = OpLoad %v4float %113 + %115 = OpCompositeExtract %float %114 0 + %116 = OpCompositeExtract %float %114 1 + %117 = OpCompositeExtract %float %114 2 + %118 = OpAccessChain %_ptr_Function_float %62 %int_1 + %119 = OpLoad %float %118 + %120 = OpCompositeConstruct %v4float %115 %116 %117 %119 + %121 = OpAccessChain %_ptr_Function_v4float %61 %int_2 + %122 = OpLoad %v4float %121 + %123 = OpCompositeExtract %float %122 0 + %124 = OpCompositeExtract %float %122 1 + %125 = OpCompositeExtract %float %122 2 + %126 = OpAccessChain %_ptr_Function_float %62 %int_2 + %127 = OpLoad %float %126 + %128 = OpCompositeConstruct %v4float %123 %124 %125 %127 + %129 = OpAccessChain %_ptr_Function_v4float %61 %int_3 + %130 = OpLoad %v4float %129 + %131 = OpCompositeExtract %float %130 0 + %132 = OpCompositeExtract %float %130 1 + %133 = OpCompositeExtract %float %130 2 + %134 = OpAccessChain %_ptr_Function_float %62 %int_3 + %135 = OpLoad %float %134 + %136 = OpCompositeConstruct %v4float %131 %132 %133 %135 + %137 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 + %138 = OpLoad %float %137 + %139 = OpCompositeConstruct %v2float %138 %138 + %140 = OpIMul %uint %uint_5 %70 + %141 = OpAccessChain %_ptr_Uniform_v4float %ScatterDrawList %int_0 %140 + %142 = OpLoad %v4float %141 + %143 = OpVectorShuffle %v2float %142 %142 0 1 + %144 = OpFMul %v2float %139 %143 + %145 = OpAccessChain %_ptr_Function_v2float %63 %int_0 + %146 = OpLoad %v2float %145 + %147 = OpAccessChain %_ptr_Function_v2float %63 %int_1 + %148 = OpLoad %v2float %147 + %149 = OpVectorShuffle %v4float %146 %148 0 1 2 3 + %150 = OpAccessChain %_ptr_Function_v2float %63 %int_2 + %151 = OpLoad %v2float %150 + %152 = OpAccessChain %_ptr_Function_v2float %63 %int_3 + %153 = OpLoad %v2float %152 + %154 = OpVectorShuffle %v4float %151 %153 0 1 2 3 + %155 = OpUMod %uint %68 %uint_2 + %156 = OpConvertUToF %float %155 + %157 = OpUDiv %uint %68 %uint_2 + %158 = OpConvertUToF %float %157 + %159 = OpCompositeConstruct %v2float %156 %158 + %160 = OpFMul %v2float %159 %39 + %161 = OpFSub %v2float %160 %40 + %162 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 + %163 = OpLoad %float %162 + %164 = OpFMul %float %72 %163 + %165 = OpFAdd %float %164 %float_1 + %166 = OpCompositeConstruct %v2float %165 %165 + %167 = OpFMul %v2float %166 %161 + %168 = OpFAdd %v2float %167 %144 + %169 = OpFAdd %v2float %168 %41 + %170 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_0 + %171 = OpLoad %v4float %170 + %172 = OpVectorShuffle %v2float %171 %171 2 3 + %173 = OpFMul %v2float %169 %172 + %174 = OpCompositeExtract %float %173 0 + %175 = OpFMul %float %174 %float_2 + %176 = OpFSub %float %175 %float_1 + %177 = OpCompositeExtract %float %173 1 + %178 = OpFMul %float %177 %float_2 + %179 = OpFSub %float %float_1 %178 + %180 = OpCompositeConstruct %v4float %176 %179 %float_0 %float_1 + OpStore %out_var_TEXCOORD0 %144 + OpStore %out_var_TEXCOORD1 %112 + OpStore %out_var_TEXCOORD2 %120 + OpStore %out_var_TEXCOORD3 %128 + OpStore %out_var_TEXCOORD4 %136 + OpStore %out_var_TEXCOORD5 %149 + OpStore %out_var_TEXCOORD6 %154 + OpStore %gl_Position %180 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/depth-compare.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/depth-compare.asm.frag new file mode 100644 index 0000000000..603d4f28c4 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/depth-compare.asm.frag @@ -0,0 +1,961 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 452 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainOnePassPointLightPS "main" %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %MainOnePassPointLightPS OriginUpperLeft + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_2d_image "type.2d.image" + OpName %SceneTexturesStruct_SceneDepthTexture "SceneTexturesStruct_SceneDepthTexture" + OpName %type_sampler "type.sampler" + OpName %SceneTexturesStruct_SceneDepthTextureSampler "SceneTexturesStruct_SceneDepthTextureSampler" + OpName %SceneTexturesStruct_GBufferATexture "SceneTexturesStruct_GBufferATexture" + OpName %SceneTexturesStruct_GBufferBTexture "SceneTexturesStruct_GBufferBTexture" + OpName %SceneTexturesStruct_GBufferDTexture "SceneTexturesStruct_GBufferDTexture" + OpName %SceneTexturesStruct_GBufferATextureSampler "SceneTexturesStruct_GBufferATextureSampler" + OpName %SceneTexturesStruct_GBufferBTextureSampler "SceneTexturesStruct_GBufferBTextureSampler" + OpName %SceneTexturesStruct_GBufferDTextureSampler "SceneTexturesStruct_GBufferDTextureSampler" + OpName %ShadowDepthTextureSampler "ShadowDepthTextureSampler" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "SoftTransitionScale" + OpMemberName %type__Globals 1 "ShadowViewProjectionMatrices" + OpMemberName %type__Globals 2 "InvShadowmapResolution" + OpMemberName %type__Globals 3 "ShadowFadeFraction" + OpMemberName %type__Globals 4 "ShadowSharpen" + OpMemberName %type__Globals 5 "LightPositionAndInvRadius" + OpMemberName %type__Globals 6 "ProjectionDepthBiasParameters" + OpMemberName %type__Globals 7 "PointLightDepthBiasAndProjParameters" + OpName %_Globals "$Globals" + OpName %type_cube_image "type.cube.image" + OpName %ShadowDepthCubeTexture "ShadowDepthCubeTexture" + OpName %ShadowDepthCubeTextureSampler "ShadowDepthCubeTextureSampler" + OpName %SSProfilesTexture "SSProfilesTexture" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainOnePassPointLightPS "MainOnePassPointLightPS" + OpName %type_sampled_image "type.sampled.image" + OpName %type_sampled_image_0 "type.sampled.image" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %SceneTexturesStruct_SceneDepthTexture DescriptorSet 0 + OpDecorate %SceneTexturesStruct_SceneDepthTexture Binding 0 + OpDecorate %SceneTexturesStruct_SceneDepthTextureSampler DescriptorSet 0 + OpDecorate %SceneTexturesStruct_SceneDepthTextureSampler Binding 0 + OpDecorate %SceneTexturesStruct_GBufferATexture DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferATexture Binding 1 + OpDecorate %SceneTexturesStruct_GBufferBTexture DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferBTexture Binding 2 + OpDecorate %SceneTexturesStruct_GBufferDTexture DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferDTexture Binding 3 + OpDecorate %SceneTexturesStruct_GBufferATextureSampler DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferATextureSampler Binding 1 + OpDecorate %SceneTexturesStruct_GBufferBTextureSampler DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferBTextureSampler Binding 2 + OpDecorate %SceneTexturesStruct_GBufferDTextureSampler DescriptorSet 0 + OpDecorate %SceneTexturesStruct_GBufferDTextureSampler Binding 3 + OpDecorate %ShadowDepthTextureSampler DescriptorSet 0 + OpDecorate %ShadowDepthTextureSampler Binding 4 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 1 + OpDecorate %ShadowDepthCubeTexture DescriptorSet 0 + OpDecorate %ShadowDepthCubeTexture Binding 4 + OpDecorate %ShadowDepthCubeTextureSampler DescriptorSet 0 + OpDecorate %ShadowDepthCubeTextureSampler Binding 5 + OpDecorate %SSProfilesTexture DescriptorSet 0 + OpDecorate %SSProfilesTexture Binding 5 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpDecorate %_arr_mat4v4float_uint_6 ArrayStride 64 + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 1 MatrixStride 16 + OpMemberDecorate %type__Globals 1 ColMajor + OpMemberDecorate %type__Globals 2 Offset 400 + OpMemberDecorate %type__Globals 3 Offset 404 + OpMemberDecorate %type__Globals 4 Offset 408 + OpMemberDecorate %type__Globals 5 Offset 416 + OpMemberDecorate %type__Globals 6 Offset 432 + OpMemberDecorate %type__Globals 7 Offset 448 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %float_0 = OpConstant %float 0 + %float_2_5 = OpConstant %float 2.5 +%float_2_37764096 = OpConstant %float 2.37764096 +%float_0_772542 = OpConstant %float 0.772542 +%float_1_46946299 = OpConstant %float 1.46946299 +%float_n2_02254295 = OpConstant %float -2.02254295 +%float_n1_46946299 = OpConstant %float -1.46946299 +%float_n2_022542 = OpConstant %float -2.022542 +%float_n2_37764096 = OpConstant %float -2.37764096 +%float_0_772543013 = OpConstant %float 0.772543013 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_7 = OpConstant %int 7 + %int_58 = OpConstant %int 58 + %int_24 = OpConstant %int 24 + %int_11 = OpConstant %int 11 + %int_5 = OpConstant %int 5 + %float_0_5 = OpConstant %float 0.5 + %int_4 = OpConstant %int 4 + %int_2 = OpConstant %int 2 + %62 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %bool = OpTypeBool + %uint_5 = OpConstant %uint 5 + %65 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %66 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %float_10 = OpConstant %float 10 + %float_5 = OpConstant %float 5 + %uint_0 = OpConstant %uint 0 + %int_23 = OpConstant %int 23 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 + %uint_16 = OpConstant %uint 16 +%float_0_150000006 = OpConstant %float 0.150000006 + %float_0_25 = OpConstant %float 0.25 + %float_2 = OpConstant %float 2 + %77 = OpConstantComposite %v3float %float_2 %float_2 %float_2 + %float_255 = OpConstant %float 255 + %uint_15 = OpConstant %uint 15 +%uint_4294967280 = OpConstant %uint 4294967280 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %uint_6 = OpConstant %uint 6 +%_arr_mat4v4float_uint_6 = OpTypeArray %mat4v4float %uint_6 +%type__Globals = OpTypeStruct %v3float %_arr_mat4v4float_uint_6 %float %float %float %v4float %v2float %v4float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_cube_image = OpTypeImage %float Cube 2 0 0 1 Unknown +%_ptr_UniformConstant_type_cube_image = OpTypePointer UniformConstant %type_cube_image + %v2int = OpTypeVector %int 2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %91 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_cube_image + %v3int = OpTypeVector %int 3 +%type_sampled_image_0 = OpTypeSampledImage %type_2d_image + %v4bool = OpTypeVector %bool 4 + %View = OpVariable %_ptr_Uniform_type_View Uniform +%SceneTexturesStruct_SceneDepthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%SceneTexturesStruct_SceneDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%SceneTexturesStruct_GBufferATexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%SceneTexturesStruct_GBufferBTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%SceneTexturesStruct_GBufferDTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%SceneTexturesStruct_GBufferATextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%SceneTexturesStruct_GBufferBTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%SceneTexturesStruct_GBufferDTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%ShadowDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%ShadowDepthCubeTexture = OpVariable %_ptr_UniformConstant_type_cube_image UniformConstant +%ShadowDepthCubeTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%SSProfilesTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output +%float_0_200000003 = OpConstant %float 0.200000003 + %98 = OpConstantComposite %v3float %float_2_5 %float_2_5 %float_2_5 + %99 = OpConstantComposite %v3float %float_2_37764096 %float_2_37764096 %float_2_37764096 + %100 = OpConstantComposite %v3float %float_0_772542 %float_0_772542 %float_0_772542 + %101 = OpConstantComposite %v3float %float_1_46946299 %float_1_46946299 %float_1_46946299 + %102 = OpConstantComposite %v3float %float_n2_02254295 %float_n2_02254295 %float_n2_02254295 + %103 = OpConstantComposite %v3float %float_n1_46946299 %float_n1_46946299 %float_n1_46946299 + %104 = OpConstantComposite %v3float %float_n2_022542 %float_n2_022542 %float_n2_022542 + %105 = OpConstantComposite %v3float %float_n2_37764096 %float_n2_37764096 %float_n2_37764096 + %106 = OpConstantComposite %v3float %float_0_772543013 %float_0_772543013 %float_0_772543013 + %107 = OpUndef %v4float +%MainOnePassPointLightPS = OpFunction %void None %91 + %108 = OpLabel + %109 = OpLoad %v4float %gl_FragCoord + %110 = OpVectorShuffle %v2float %109 %109 0 1 + %111 = OpAccessChain %_ptr_Uniform_v4float %View %int_58 + %112 = OpLoad %v4float %111 + %113 = OpVectorShuffle %v2float %112 %112 2 3 + %114 = OpFMul %v2float %110 %113 + %115 = OpLoad %type_2d_image %SceneTexturesStruct_SceneDepthTexture + %116 = OpLoad %type_sampler %SceneTexturesStruct_SceneDepthTextureSampler + %117 = OpSampledImage %type_sampled_image_0 %115 %116 + %118 = OpImageSampleExplicitLod %v4float %117 %114 Lod %float_0 + %119 = OpCompositeExtract %float %118 0 + %120 = OpAccessChain %_ptr_Uniform_float %View %int_23 %uint_0 + %121 = OpLoad %float %120 + %122 = OpFMul %float %119 %121 + %123 = OpAccessChain %_ptr_Uniform_float %View %int_23 %uint_1 + %124 = OpLoad %float %123 + %125 = OpFAdd %float %122 %124 + %126 = OpAccessChain %_ptr_Uniform_float %View %int_23 %uint_2 + %127 = OpLoad %float %126 + %128 = OpFMul %float %119 %127 + %129 = OpAccessChain %_ptr_Uniform_float %View %int_23 %uint_3 + %130 = OpLoad %float %129 + %131 = OpFSub %float %128 %130 + %132 = OpFDiv %float %float_1 %131 + %133 = OpFAdd %float %125 %132 + %134 = OpAccessChain %_ptr_Uniform_v4float %View %int_24 + %135 = OpLoad %v4float %134 + %136 = OpVectorShuffle %v2float %135 %135 3 2 + %137 = OpFSub %v2float %114 %136 + %138 = OpVectorShuffle %v2float %135 %135 0 1 + %139 = OpFDiv %v2float %137 %138 + %140 = OpCompositeConstruct %v2float %133 %133 + %141 = OpFMul %v2float %139 %140 + %142 = OpCompositeExtract %float %141 0 + %143 = OpCompositeExtract %float %141 1 + %144 = OpCompositeConstruct %v4float %142 %143 %133 %float_1 + %145 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_11 + %146 = OpLoad %mat4v4float %145 + %147 = OpMatrixTimesVector %v4float %146 %144 + %148 = OpVectorShuffle %v3float %147 %147 0 1 2 + %149 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_5 + %150 = OpLoad %v4float %149 + %151 = OpVectorShuffle %v3float %150 %150 0 1 2 + %152 = OpFSub %v3float %151 %148 + %153 = OpAccessChain %_ptr_Uniform_float %_Globals %int_5 %int_3 + %154 = OpLoad %float %153 + %155 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %156 = OpAccessChain %_ptr_Uniform_float %_Globals %int_7 %int_0 + %157 = OpLoad %float %156 + %158 = OpExtInst %float %1 Length %152 + %159 = OpFMul %float %158 %154 + %160 = OpFOrdLessThan %bool %159 %float_1 + OpSelectionMerge %161 DontFlatten + OpBranchConditional %160 %162 %161 + %162 = OpLabel + %163 = OpCompositeConstruct %v3float %158 %158 %158 + %164 = OpFDiv %v3float %152 %163 + %165 = OpExtInst %v3float %1 FAbs %152 + %166 = OpCompositeExtract %float %165 0 + %167 = OpCompositeExtract %float %165 1 + %168 = OpCompositeExtract %float %165 2 + %169 = OpExtInst %float %1 FMax %167 %168 + %170 = OpExtInst %float %1 FMax %166 %169 + %171 = OpFOrdEqual %bool %170 %166 + OpSelectionMerge %172 None + OpBranchConditional %171 %173 %174 + %174 = OpLabel + %175 = OpFOrdEqual %bool %170 %167 + OpSelectionMerge %176 None + OpBranchConditional %175 %177 %178 + %178 = OpLabel + %179 = OpCompositeExtract %float %152 2 + %180 = OpFOrdEqual %bool %168 %179 + %181 = OpSelect %int %180 %int_4 %int_5 + OpBranch %176 + %177 = OpLabel + %182 = OpCompositeExtract %float %152 1 + %183 = OpFOrdEqual %bool %167 %182 + %184 = OpSelect %int %183 %int_2 %int_3 + OpBranch %176 + %176 = OpLabel + %185 = OpPhi %int %184 %177 %181 %178 + OpBranch %172 + %173 = OpLabel + %186 = OpCompositeExtract %float %152 0 + %187 = OpFOrdEqual %bool %166 %186 + %188 = OpSelect %int %187 %int_0 %int_1 + OpBranch %172 + %172 = OpLabel + %189 = OpPhi %int %188 %173 %185 %176 + %190 = OpCompositeExtract %float %147 0 + %191 = OpCompositeExtract %float %147 1 + %192 = OpCompositeExtract %float %147 2 + %193 = OpCompositeConstruct %v4float %190 %191 %192 %float_1 + %194 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_1 %189 + %195 = OpLoad %mat4v4float %194 + %196 = OpMatrixTimesVector %v4float %195 %193 + %197 = OpCompositeExtract %float %196 2 + %198 = OpCompositeExtract %float %196 3 + %199 = OpFDiv %float %197 %198 + %200 = OpFNegate %float %157 + %201 = OpFDiv %float %200 %198 + %202 = OpLoad %type_cube_image %ShadowDepthCubeTexture + %203 = OpLoad %type_sampler %ShadowDepthCubeTextureSampler + %204 = OpFAdd %float %199 %201 + %205 = OpSampledImage %type_sampled_image %202 %203 + %206 = OpImageSampleDrefExplicitLod %float %205 %164 %204 Lod %float_0 + OpBranch %161 + %161 = OpLabel + %207 = OpPhi %float %float_1 %108 %206 %172 + %208 = OpFSub %float %207 %float_0_5 + %209 = OpAccessChain %_ptr_Uniform_float %_Globals %int_4 + %210 = OpLoad %float %209 + %211 = OpFMul %float %208 %210 + %212 = OpFAdd %float %211 %float_0_5 + %213 = OpExtInst %float %1 FClamp %212 %float_0 %float_1 + %214 = OpFMul %float %213 %213 + %215 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3 + %216 = OpLoad %float %215 + %217 = OpExtInst %float %1 FMix %float_1 %214 %216 + %218 = OpExtInst %float %1 Sqrt %217 + %219 = OpCompositeInsert %v4float %218 %107 2 + %220 = OpVectorShuffle %v4float %219 %62 4 5 2 6 + %221 = OpLoad %type_2d_image %SceneTexturesStruct_GBufferATexture + %222 = OpLoad %type_sampler %SceneTexturesStruct_GBufferATextureSampler + %223 = OpSampledImage %type_sampled_image_0 %221 %222 + %224 = OpImageSampleExplicitLod %v4float %223 %114 Lod %float_0 + %225 = OpLoad %type_2d_image %SceneTexturesStruct_GBufferBTexture + %226 = OpLoad %type_sampler %SceneTexturesStruct_GBufferBTextureSampler + %227 = OpSampledImage %type_sampled_image_0 %225 %226 + %228 = OpImageSampleExplicitLod %v4float %227 %114 Lod %float_0 + %229 = OpLoad %type_2d_image %SceneTexturesStruct_GBufferDTexture + %230 = OpLoad %type_sampler %SceneTexturesStruct_GBufferDTextureSampler + %231 = OpSampledImage %type_sampled_image_0 %229 %230 + %232 = OpImageSampleExplicitLod %v4float %231 %114 Lod %float_0 + %233 = OpVectorShuffle %v3float %224 %224 0 1 2 + %234 = OpFMul %v3float %233 %77 + %235 = OpFSub %v3float %234 %62 + %236 = OpExtInst %v3float %1 Normalize %235 + %237 = OpCompositeExtract %float %228 3 + %238 = OpFMul %float %237 %float_255 + %239 = OpExtInst %float %1 Round %238 + %240 = OpConvertFToU %uint %239 + %241 = OpBitwiseAnd %uint %240 %uint_15 + %242 = OpBitwiseAnd %uint %240 %uint_4294967280 + %243 = OpBitwiseAnd %uint %242 %uint_16 + %244 = OpINotEqual %bool %243 %uint_0 + %245 = OpLogicalNot %bool %244 + %246 = OpCompositeConstruct %v4bool %245 %245 %245 %245 + %247 = OpSelect %v4float %246 %232 %66 + %248 = OpIEqual %bool %241 %uint_5 + OpSelectionMerge %249 None + OpBranchConditional %248 %250 %249 + %250 = OpLabel + %251 = OpLoad %v4float %155 + %252 = OpCompositeExtract %float %247 0 + %253 = OpFMul %float %252 %float_255 + %254 = OpFAdd %float %253 %float_0_5 + %255 = OpConvertFToU %uint %254 + %256 = OpBitcast %int %255 + %257 = OpCompositeConstruct %v3int %int_1 %256 %int_0 + %258 = OpVectorShuffle %v2int %257 %257 0 1 + %259 = OpLoad %type_2d_image %SSProfilesTexture + %260 = OpImageFetch %v4float %259 %258 Lod %int_0 + %261 = OpCompositeExtract %float %260 0 + %262 = OpCompositeExtract %float %260 1 + %263 = OpFMul %float %262 %float_0_5 + %264 = OpCompositeConstruct %v3float %263 %263 %263 + %265 = OpFMul %v3float %236 %264 + %266 = OpFSub %v3float %148 %265 + %267 = OpDot %float %152 %152 + %268 = OpExtInst %float %1 InverseSqrt %267 + %269 = OpCompositeConstruct %v3float %268 %268 %268 + %270 = OpFMul %v3float %152 %269 + %271 = OpFNegate %v3float %270 + %272 = OpDot %float %271 %236 + %273 = OpExtInst %float %1 FClamp %272 %float_0 %float_1 + %274 = OpExtInst %float %1 Pow %273 %float_1 + OpSelectionMerge %275 DontFlatten + OpBranchConditional %160 %276 %275 + %276 = OpLabel + %277 = OpCompositeConstruct %v3float %158 %158 %158 + %278 = OpFDiv %v3float %152 %277 + %279 = OpExtInst %v3float %1 Cross %278 %65 + %280 = OpExtInst %v3float %1 Normalize %279 + %281 = OpExtInst %v3float %1 Cross %280 %278 + %282 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 + %283 = OpLoad %float %282 + %284 = OpCompositeConstruct %v3float %283 %283 %283 + %285 = OpFMul %v3float %280 %284 + %286 = OpFMul %v3float %281 %284 + %287 = OpExtInst %v3float %1 FAbs %278 + %288 = OpCompositeExtract %float %287 0 + %289 = OpCompositeExtract %float %287 1 + %290 = OpCompositeExtract %float %287 2 + %291 = OpExtInst %float %1 FMax %289 %290 + %292 = OpExtInst %float %1 FMax %288 %291 + %293 = OpFOrdEqual %bool %292 %288 + OpSelectionMerge %294 None + OpBranchConditional %293 %295 %296 + %296 = OpLabel + %297 = OpFOrdEqual %bool %292 %289 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %300 + %300 = OpLabel + %301 = OpCompositeExtract %float %278 2 + %302 = OpFOrdEqual %bool %290 %301 + %303 = OpSelect %int %302 %int_4 %int_5 + OpBranch %298 + %299 = OpLabel + %304 = OpCompositeExtract %float %278 1 + %305 = OpFOrdEqual %bool %289 %304 + %306 = OpSelect %int %305 %int_2 %int_3 + OpBranch %298 + %298 = OpLabel + %307 = OpPhi %int %306 %299 %303 %300 + OpBranch %294 + %295 = OpLabel + %308 = OpCompositeExtract %float %278 0 + %309 = OpFOrdEqual %bool %288 %308 + %310 = OpSelect %int %309 %int_0 %int_1 + OpBranch %294 + %294 = OpLabel + %311 = OpPhi %int %310 %295 %307 %298 + %312 = OpCompositeExtract %float %266 0 + %313 = OpCompositeExtract %float %266 1 + %314 = OpCompositeExtract %float %266 2 + %315 = OpCompositeConstruct %v4float %312 %313 %314 %float_1 + %316 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_1 %311 + %317 = OpLoad %mat4v4float %316 + %318 = OpMatrixTimesVector %v4float %317 %315 + %319 = OpCompositeExtract %float %318 2 + %320 = OpCompositeExtract %float %318 3 + %321 = OpFDiv %float %319 %320 + %322 = OpFDiv %float %float_10 %154 + %323 = OpFMul %float %261 %322 + %324 = OpCompositeExtract %float %251 2 + %325 = OpFMul %float %321 %324 + %326 = OpCompositeExtract %float %251 3 + %327 = OpFSub %float %325 %326 + %328 = OpFDiv %float %float_1 %327 + %329 = OpFMul %float %328 %154 + %330 = OpFMul %v3float %286 %98 + %331 = OpFAdd %v3float %278 %330 + %332 = OpLoad %type_cube_image %ShadowDepthCubeTexture + %333 = OpLoad %type_sampler %ShadowDepthTextureSampler + %334 = OpSampledImage %type_sampled_image %332 %333 + %335 = OpImageSampleExplicitLod %v4float %334 %331 Lod %float_0 + %336 = OpCompositeExtract %float %335 0 + %337 = OpFMul %float %336 %324 + %338 = OpFSub %float %337 %326 + %339 = OpFDiv %float %float_1 %338 + %340 = OpFMul %float %339 %154 + %341 = OpFSub %float %329 %340 + %342 = OpFMul %float %341 %323 + %343 = OpFOrdGreaterThan %bool %342 %float_0 + %344 = OpFAdd %float %342 %263 + %345 = OpFMul %float %342 %274 + %346 = OpFAdd %float %345 %263 + %347 = OpExtInst %float %1 FMax %float_0 %346 + %348 = OpSelect %float %343 %344 %347 + %349 = OpExtInst %float %1 FAbs %348 + %350 = OpExtInst %float %1 FClamp %349 %float_0_150000006 %float_5 + %351 = OpFAdd %float %350 %float_0_25 + %352 = OpFMul %v3float %285 %99 + %353 = OpFAdd %v3float %278 %352 + %354 = OpFMul %v3float %286 %100 + %355 = OpFAdd %v3float %353 %354 + %356 = OpSampledImage %type_sampled_image %332 %333 + %357 = OpImageSampleExplicitLod %v4float %356 %355 Lod %float_0 + %358 = OpCompositeExtract %float %357 0 + %359 = OpFMul %float %358 %324 + %360 = OpFSub %float %359 %326 + %361 = OpFDiv %float %float_1 %360 + %362 = OpFMul %float %361 %154 + %363 = OpFSub %float %329 %362 + %364 = OpFMul %float %363 %323 + %365 = OpFOrdGreaterThan %bool %364 %float_0 + %366 = OpFAdd %float %364 %263 + %367 = OpFMul %float %364 %274 + %368 = OpFAdd %float %367 %263 + %369 = OpExtInst %float %1 FMax %float_0 %368 + %370 = OpSelect %float %365 %366 %369 + %371 = OpExtInst %float %1 FAbs %370 + %372 = OpExtInst %float %1 FClamp %371 %float_0_150000006 %float_5 + %373 = OpFAdd %float %372 %float_0_25 + %374 = OpFAdd %float %351 %373 + %375 = OpFMul %v3float %285 %101 + %376 = OpFAdd %v3float %278 %375 + %377 = OpFMul %v3float %286 %102 + %378 = OpFAdd %v3float %376 %377 + %379 = OpSampledImage %type_sampled_image %332 %333 + %380 = OpImageSampleExplicitLod %v4float %379 %378 Lod %float_0 + %381 = OpCompositeExtract %float %380 0 + %382 = OpFMul %float %381 %324 + %383 = OpFSub %float %382 %326 + %384 = OpFDiv %float %float_1 %383 + %385 = OpFMul %float %384 %154 + %386 = OpFSub %float %329 %385 + %387 = OpFMul %float %386 %323 + %388 = OpFOrdGreaterThan %bool %387 %float_0 + %389 = OpFAdd %float %387 %263 + %390 = OpFMul %float %387 %274 + %391 = OpFAdd %float %390 %263 + %392 = OpExtInst %float %1 FMax %float_0 %391 + %393 = OpSelect %float %388 %389 %392 + %394 = OpExtInst %float %1 FAbs %393 + %395 = OpExtInst %float %1 FClamp %394 %float_0_150000006 %float_5 + %396 = OpFAdd %float %395 %float_0_25 + %397 = OpFAdd %float %374 %396 + %398 = OpFMul %v3float %285 %103 + %399 = OpFAdd %v3float %278 %398 + %400 = OpFMul %v3float %286 %104 + %401 = OpFAdd %v3float %399 %400 + %402 = OpSampledImage %type_sampled_image %332 %333 + %403 = OpImageSampleExplicitLod %v4float %402 %401 Lod %float_0 + %404 = OpCompositeExtract %float %403 0 + %405 = OpFMul %float %404 %324 + %406 = OpFSub %float %405 %326 + %407 = OpFDiv %float %float_1 %406 + %408 = OpFMul %float %407 %154 + %409 = OpFSub %float %329 %408 + %410 = OpFMul %float %409 %323 + %411 = OpFOrdGreaterThan %bool %410 %float_0 + %412 = OpFAdd %float %410 %263 + %413 = OpFMul %float %410 %274 + %414 = OpFAdd %float %413 %263 + %415 = OpExtInst %float %1 FMax %float_0 %414 + %416 = OpSelect %float %411 %412 %415 + %417 = OpExtInst %float %1 FAbs %416 + %418 = OpExtInst %float %1 FClamp %417 %float_0_150000006 %float_5 + %419 = OpFAdd %float %418 %float_0_25 + %420 = OpFAdd %float %397 %419 + %421 = OpFMul %v3float %285 %105 + %422 = OpFAdd %v3float %278 %421 + %423 = OpFMul %v3float %286 %106 + %424 = OpFAdd %v3float %422 %423 + %425 = OpSampledImage %type_sampled_image %332 %333 + %426 = OpImageSampleExplicitLod %v4float %425 %424 Lod %float_0 + %427 = OpCompositeExtract %float %426 0 + %428 = OpFMul %float %427 %324 + %429 = OpFSub %float %428 %326 + %430 = OpFDiv %float %float_1 %429 + %431 = OpFMul %float %430 %154 + %432 = OpFSub %float %329 %431 + %433 = OpFMul %float %432 %323 + %434 = OpFOrdGreaterThan %bool %433 %float_0 + %435 = OpFAdd %float %433 %263 + %436 = OpFMul %float %433 %274 + %437 = OpFAdd %float %436 %263 + %438 = OpExtInst %float %1 FMax %float_0 %437 + %439 = OpSelect %float %434 %435 %438 + %440 = OpExtInst %float %1 FAbs %439 + %441 = OpExtInst %float %1 FClamp %440 %float_0_150000006 %float_5 + %442 = OpFAdd %float %441 %float_0_25 + %443 = OpFAdd %float %420 %442 + %444 = OpFMul %float %443 %float_0_200000003 + OpBranch %275 + %275 = OpLabel + %445 = OpPhi %float %float_1 %250 %444 %294 + %446 = OpFMul %float %445 %float_0_200000003 + %447 = OpFSub %float %float_1 %446 + OpBranch %249 + %249 = OpLabel + %448 = OpPhi %float %float_1 %161 %447 %275 + %449 = OpExtInst %float %1 Sqrt %448 + %450 = OpSelect %float %248 %449 %218 + %451 = OpCompositeInsert %v4float %450 %220 3 + OpStore %out_var_SV_Target0 %451 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/global-constant-arrays.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/global-constant-arrays.asm.frag new file mode 100644 index 0000000000..47db9ebc51 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/global-constant-arrays.asm.frag @@ -0,0 +1,3556 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 3005 +; Schema: 0 + OpCapability Shader + OpCapability Geometry + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainPS "main" %in_var_TEXCOORD0 %gl_FragCoord %gl_Layer %out_var_SV_Target0 + OpExecutionMode %MainPS OriginUpperLeft + OpSource HLSL 600 + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "MappingPolynomial" + OpMemberName %type__Globals 1 "InverseGamma" + OpMemberName %type__Globals 2 "ColorMatrixR_ColorCurveCd1" + OpMemberName %type__Globals 3 "ColorMatrixG_ColorCurveCd3Cm3" + OpMemberName %type__Globals 4 "ColorMatrixB_ColorCurveCm2" + OpMemberName %type__Globals 5 "ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3" + OpMemberName %type__Globals 6 "ColorCurve_Ch1_Ch2" + OpMemberName %type__Globals 7 "ColorShadow_Luma" + OpMemberName %type__Globals 8 "ColorShadow_Tint1" + OpMemberName %type__Globals 9 "ColorShadow_Tint2" + OpMemberName %type__Globals 10 "FilmSlope" + OpMemberName %type__Globals 11 "FilmToe" + OpMemberName %type__Globals 12 "FilmShoulder" + OpMemberName %type__Globals 13 "FilmBlackClip" + OpMemberName %type__Globals 14 "FilmWhiteClip" + OpMemberName %type__Globals 15 "ColorScale" + OpMemberName %type__Globals 16 "OverlayColor" + OpMemberName %type__Globals 17 "WhiteTemp" + OpMemberName %type__Globals 18 "WhiteTint" + OpMemberName %type__Globals 19 "ColorSaturation" + OpMemberName %type__Globals 20 "ColorContrast" + OpMemberName %type__Globals 21 "ColorGamma" + OpMemberName %type__Globals 22 "ColorGain" + OpMemberName %type__Globals 23 "ColorOffset" + OpMemberName %type__Globals 24 "ColorSaturationShadows" + OpMemberName %type__Globals 25 "ColorContrastShadows" + OpMemberName %type__Globals 26 "ColorGammaShadows" + OpMemberName %type__Globals 27 "ColorGainShadows" + OpMemberName %type__Globals 28 "ColorOffsetShadows" + OpMemberName %type__Globals 29 "ColorSaturationMidtones" + OpMemberName %type__Globals 30 "ColorContrastMidtones" + OpMemberName %type__Globals 31 "ColorGammaMidtones" + OpMemberName %type__Globals 32 "ColorGainMidtones" + OpMemberName %type__Globals 33 "ColorOffsetMidtones" + OpMemberName %type__Globals 34 "ColorSaturationHighlights" + OpMemberName %type__Globals 35 "ColorContrastHighlights" + OpMemberName %type__Globals 36 "ColorGammaHighlights" + OpMemberName %type__Globals 37 "ColorGainHighlights" + OpMemberName %type__Globals 38 "ColorOffsetHighlights" + OpMemberName %type__Globals 39 "ColorCorrectionShadowsMax" + OpMemberName %type__Globals 40 "ColorCorrectionHighlightsMin" + OpMemberName %type__Globals 41 "OutputDevice" + OpMemberName %type__Globals 42 "OutputGamut" + OpMemberName %type__Globals 43 "BlueCorrection" + OpMemberName %type__Globals 44 "ExpandGamut" + OpName %_Globals "$Globals" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainPS "MainPS" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorate %in_var_TEXCOORD0 NoPerspective + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorate %gl_Layer BuiltIn Layer + OpDecorateString %gl_Layer UserSemantic "SV_RenderTargetArrayIndex" + OpDecorate %gl_Layer Flat + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 0 + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 48 + OpMemberDecorate %type__Globals 4 Offset 64 + OpMemberDecorate %type__Globals 5 Offset 80 + OpMemberDecorate %type__Globals 6 Offset 96 + OpMemberDecorate %type__Globals 7 Offset 112 + OpMemberDecorate %type__Globals 8 Offset 128 + OpMemberDecorate %type__Globals 9 Offset 144 + OpMemberDecorate %type__Globals 10 Offset 160 + OpMemberDecorate %type__Globals 11 Offset 164 + OpMemberDecorate %type__Globals 12 Offset 168 + OpMemberDecorate %type__Globals 13 Offset 172 + OpMemberDecorate %type__Globals 14 Offset 176 + OpMemberDecorate %type__Globals 15 Offset 180 + OpMemberDecorate %type__Globals 16 Offset 192 + OpMemberDecorate %type__Globals 17 Offset 208 + OpMemberDecorate %type__Globals 18 Offset 212 + OpMemberDecorate %type__Globals 19 Offset 224 + OpMemberDecorate %type__Globals 20 Offset 240 + OpMemberDecorate %type__Globals 21 Offset 256 + OpMemberDecorate %type__Globals 22 Offset 272 + OpMemberDecorate %type__Globals 23 Offset 288 + OpMemberDecorate %type__Globals 24 Offset 304 + OpMemberDecorate %type__Globals 25 Offset 320 + OpMemberDecorate %type__Globals 26 Offset 336 + OpMemberDecorate %type__Globals 27 Offset 352 + OpMemberDecorate %type__Globals 28 Offset 368 + OpMemberDecorate %type__Globals 29 Offset 384 + OpMemberDecorate %type__Globals 30 Offset 400 + OpMemberDecorate %type__Globals 31 Offset 416 + OpMemberDecorate %type__Globals 32 Offset 432 + OpMemberDecorate %type__Globals 33 Offset 448 + OpMemberDecorate %type__Globals 34 Offset 464 + OpMemberDecorate %type__Globals 35 Offset 480 + OpMemberDecorate %type__Globals 36 Offset 496 + OpMemberDecorate %type__Globals 37 Offset 512 + OpMemberDecorate %type__Globals 38 Offset 528 + OpMemberDecorate %type__Globals 39 Offset 544 + OpMemberDecorate %type__Globals 40 Offset 548 + OpMemberDecorate %type__Globals 41 Offset 552 + OpMemberDecorate %type__Globals 42 Offset 556 + OpMemberDecorate %type__Globals 43 Offset 560 + OpMemberDecorate %type__Globals 44 Offset 564 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 +%float_0_952552378 = OpConstant %float 0.952552378 + %float_0 = OpConstant %float 0 + +; HACK: Needed to hack this constant since MSVC and GNU libc are off by 1 ULP when converting to string (it probably still works fine though in a roundtrip ...) +%float_9_36786018en05 = OpConstant %float 9.25 + +%float_0_343966454 = OpConstant %float 0.343966454 +%float_0_728166103 = OpConstant %float 0.728166103 +%float_n0_0721325427 = OpConstant %float -0.0721325427 +%float_1_00882518 = OpConstant %float 1.00882518 +%float_1_04981101 = OpConstant %float 1.04981101 +%float_n9_74845025en05 = OpConstant %float -9.74845025e-05 +%float_n0_495903015 = OpConstant %float -0.495903015 +%float_1_37331307 = OpConstant %float 1.37331307 +%float_0_0982400328 = OpConstant %float 0.0982400328 +%float_0_991252005 = OpConstant %float 0.991252005 +%float_0_662454188 = OpConstant %float 0.662454188 +%float_0_134004205 = OpConstant %float 0.134004205 +%float_0_156187683 = OpConstant %float 0.156187683 +%float_0_272228718 = OpConstant %float 0.272228718 +%float_0_674081743 = OpConstant %float 0.674081743 +%float_0_0536895171 = OpConstant %float 0.0536895171 +%float_n0_00557464967 = OpConstant %float -0.00557464967 +%float_0_0040607336 = OpConstant %float 0.0040607336 +%float_1_01033914 = OpConstant %float 1.01033914 +%float_1_6410234 = OpConstant %float 1.6410234 +%float_n0_324803293 = OpConstant %float -0.324803293 +%float_n0_236424699 = OpConstant %float -0.236424699 +%float_n0_663662851 = OpConstant %float -0.663662851 +%float_1_61533165 = OpConstant %float 1.61533165 +%float_0_0167563483 = OpConstant %float 0.0167563483 +%float_0_0117218941 = OpConstant %float 0.0117218941 +%float_n0_00828444213 = OpConstant %float -0.00828444213 +%float_0_988394856 = OpConstant %float 0.988394856 +%float_1_45143926 = OpConstant %float 1.45143926 +%float_n0_236510754 = OpConstant %float -0.236510754 +%float_n0_214928567 = OpConstant %float -0.214928567 +%float_n0_0765537769 = OpConstant %float -0.0765537769 +%float_1_17622972 = OpConstant %float 1.17622972 +%float_n0_0996759236 = OpConstant %float -0.0996759236 +%float_0_00831614807 = OpConstant %float 0.00831614807 +%float_n0_00603244966 = OpConstant %float -0.00603244966 +%float_0_997716308 = OpConstant %float 0.997716308 +%float_0_695452213 = OpConstant %float 0.695452213 +%float_0_140678704 = OpConstant %float 0.140678704 +%float_0_163869068 = OpConstant %float 0.163869068 +%float_0_0447945632 = OpConstant %float 0.0447945632 +%float_0_859671116 = OpConstant %float 0.859671116 +%float_0_0955343172 = OpConstant %float 0.0955343172 +%float_n0_00552588282 = OpConstant %float -0.00552588282 +%float_0_00402521016 = OpConstant %float 0.00402521016 +%float_1_00150073 = OpConstant %float 1.00150073 + %67 = OpConstantComposite %v3float %float_0_272228718 %float_0_674081743 %float_0_0536895171 +%float_3_2409699 = OpConstant %float 3.2409699 +%float_n1_5373832 = OpConstant %float -1.5373832 +%float_n0_498610765 = OpConstant %float -0.498610765 +%float_n0_969243646 = OpConstant %float -0.969243646 +%float_1_8759675 = OpConstant %float 1.8759675 +%float_0_0415550582 = OpConstant %float 0.0415550582 +%float_0_0556300804 = OpConstant %float 0.0556300804 +%float_n0_203976959 = OpConstant %float -0.203976959 +%float_1_05697155 = OpConstant %float 1.05697155 +%float_0_412456393 = OpConstant %float 0.412456393 +%float_0_357576102 = OpConstant %float 0.357576102 +%float_0_180437505 = OpConstant %float 0.180437505 +%float_0_212672904 = OpConstant %float 0.212672904 +%float_0_715152204 = OpConstant %float 0.715152204 +%float_0_0721750036 = OpConstant %float 0.0721750036 +%float_0_0193339009 = OpConstant %float 0.0193339009 +%float_0_119191997 = OpConstant %float 0.119191997 +%float_0_950304091 = OpConstant %float 0.950304091 +%float_1_71660841 = OpConstant %float 1.71660841 +%float_n0_355662107 = OpConstant %float -0.355662107 +%float_n0_253360093 = OpConstant %float -0.253360093 +%float_n0_666682899 = OpConstant %float -0.666682899 +%float_1_61647761 = OpConstant %float 1.61647761 +%float_0_0157685 = OpConstant %float 0.0157685 +%float_0_0176422 = OpConstant %float 0.0176422 +%float_n0_0427763015 = OpConstant %float -0.0427763015 +%float_0_942228675 = OpConstant %float 0.942228675 +%float_2_49339628 = OpConstant %float 2.49339628 +%float_n0_93134588 = OpConstant %float -0.93134588 +%float_n0_402694494 = OpConstant %float -0.402694494 +%float_n0_829486787 = OpConstant %float -0.829486787 +%float_1_76265967 = OpConstant %float 1.76265967 +%float_0_0236246008 = OpConstant %float 0.0236246008 +%float_0_0358507 = OpConstant %float 0.0358507 +%float_n0_0761827007 = OpConstant %float -0.0761827007 +%float_0_957014024 = OpConstant %float 0.957014024 +%float_1_01303005 = OpConstant %float 1.01303005 +%float_0_00610530982 = OpConstant %float 0.00610530982 +%float_n0_0149710001 = OpConstant %float -0.0149710001 +%float_0_00769822998 = OpConstant %float 0.00769822998 +%float_0_998165011 = OpConstant %float 0.998165011 +%float_n0_00503202993 = OpConstant %float -0.00503202993 +%float_n0_00284131011 = OpConstant %float -0.00284131011 +%float_0_00468515977 = OpConstant %float 0.00468515977 +%float_0_924507022 = OpConstant %float 0.924507022 +%float_0_987223983 = OpConstant %float 0.987223983 +%float_n0_00611326983 = OpConstant %float -0.00611326983 +%float_0_0159533005 = OpConstant %float 0.0159533005 +%float_n0_00759836007 = OpConstant %float -0.00759836007 +%float_1_00186002 = OpConstant %float 1.00186002 +%float_0_0053300201 = OpConstant %float 0.0053300201 +%float_0_00307257008 = OpConstant %float 0.00307257008 +%float_n0_00509594986 = OpConstant %float -0.00509594986 +%float_1_08168006 = OpConstant %float 1.08168006 + %float_0_5 = OpConstant %float 0.5 + %float_n1 = OpConstant %float -1 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%float_0_015625 = OpConstant %float 0.015625 + %128 = OpConstantComposite %v2float %float_0_015625 %float_0_015625 + %129 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_42 = OpConstant %int 42 + %uint_3 = OpConstant %uint 3 + %132 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_9 = OpConstant %int 9 + %int_3 = OpConstant %int 3 + %135 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_n4 = OpConstant %float -4 + %int_44 = OpConstant %int 44 +%float_0_544169128 = OpConstant %float 0.544169128 +%float_0_239592597 = OpConstant %float 0.239592597 +%float_0_166694298 = OpConstant %float 0.166694298 +%float_0_239465594 = OpConstant %float 0.239465594 +%float_0_702153027 = OpConstant %float 0.702153027 +%float_0_058381401 = OpConstant %float 0.058381401 +%float_n0_00234390004 = OpConstant %float -0.00234390004 +%float_0_0361833982 = OpConstant %float 0.0361833982 +%float_1_05521834 = OpConstant %float 1.05521834 +%float_0_940437257 = OpConstant %float 0.940437257 +%float_n0_0183068793 = OpConstant %float -0.0183068793 +%float_0_077869609 = OpConstant %float 0.077869609 +%float_0_00837869663 = OpConstant %float 0.00837869663 +%float_0_828660011 = OpConstant %float 0.828660011 +%float_0_162961304 = OpConstant %float 0.162961304 +%float_0_00054712611 = OpConstant %float 0.00054712611 +%float_n0_000883374596 = OpConstant %float -0.000883374596 +%float_1_00033629 = OpConstant %float 1.00033629 +%float_1_06317997 = OpConstant %float 1.06317997 +%float_0_0233955998 = OpConstant %float 0.0233955998 +%float_n0_0865726024 = OpConstant %float -0.0865726024 +%float_n0_0106336996 = OpConstant %float -0.0106336996 +%float_1_20632005 = OpConstant %float 1.20632005 +%float_n0_195690006 = OpConstant %float -0.195690006 +%float_n0_000590886979 = OpConstant %float -0.000590886979 +%float_0_00105247996 = OpConstant %float 0.00105247996 +%float_0_999538004 = OpConstant %float 0.999538004 + %int_43 = OpConstant %int 43 + %int_15 = OpConstant %int 15 + %int_16 = OpConstant %int 16 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %int_2 = OpConstant %int 2 +%mat3v3float = OpTypeMatrix %v3float 3 + %int_41 = OpConstant %int 41 +%float_0_159301758 = OpConstant %float 0.159301758 +%float_78_84375 = OpConstant %float 78.84375 +%float_0_8359375 = OpConstant %float 0.8359375 +%float_18_8515625 = OpConstant %float 18.8515625 +%float_18_6875 = OpConstant %float 18.6875 +%float_10000 = OpConstant %float 10000 +%float_0_0126833133 = OpConstant %float 0.0126833133 + %182 = OpConstantComposite %v3float %float_0_0126833133 %float_0_0126833133 %float_0_0126833133 + %183 = OpConstantComposite %v3float %float_0_8359375 %float_0_8359375 %float_0_8359375 + %184 = OpConstantComposite %v3float %float_18_8515625 %float_18_8515625 %float_18_8515625 + %185 = OpConstantComposite %v3float %float_18_6875 %float_18_6875 %float_18_6875 +%float_6_27739477 = OpConstant %float 6.27739477 + %187 = OpConstantComposite %v3float %float_6_27739477 %float_6_27739477 %float_6_27739477 + %188 = OpConstantComposite %v3float %float_10000 %float_10000 %float_10000 + %float_14 = OpConstant %float 14 +%float_0_180000007 = OpConstant %float 0.180000007 +%float_0_434017599 = OpConstant %float 0.434017599 + %192 = OpConstantComposite %v3float %float_0_434017599 %float_0_434017599 %float_0_434017599 + %193 = OpConstantComposite %v3float %float_14 %float_14 %float_14 + %194 = OpConstantComposite %v3float %float_0_180000007 %float_0_180000007 %float_0_180000007 + %int_17 = OpConstant %int 17 + %float_4000 = OpConstant %float 4000 +%float_0_312700003 = OpConstant %float 0.312700003 +%float_0_328999996 = OpConstant %float 0.328999996 + %int_18 = OpConstant %int 18 + %int_24 = OpConstant %int 24 + %int_19 = OpConstant %int 19 + %int_25 = OpConstant %int 25 + %int_20 = OpConstant %int 20 + %int_26 = OpConstant %int 26 + %int_21 = OpConstant %int 21 + %int_27 = OpConstant %int 27 + %int_22 = OpConstant %int 22 + %int_28 = OpConstant %int 28 + %int_23 = OpConstant %int 23 + %int_39 = OpConstant %int 39 + %int_34 = OpConstant %int 34 + %int_35 = OpConstant %int 35 + %int_36 = OpConstant %int 36 + %int_37 = OpConstant %int 37 + %int_38 = OpConstant %int 38 + %int_40 = OpConstant %int 40 + %int_29 = OpConstant %int 29 + %int_30 = OpConstant %int 30 + %int_31 = OpConstant %int 31 + %int_32 = OpConstant %int 32 + %int_33 = OpConstant %int 33 +%float_0_0500000007 = OpConstant %float 0.0500000007 + %float_1_75 = OpConstant %float 1.75 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_0299999993 = OpConstant %float 0.0299999993 + %float_2 = OpConstant %float 2 +%float_0_959999979 = OpConstant %float 0.959999979 + %228 = OpConstantComposite %v3float %float_0_959999979 %float_0_959999979 %float_0_959999979 + %int_13 = OpConstant %int 13 + %int_11 = OpConstant %int 11 + %int_14 = OpConstant %int 14 + %int_12 = OpConstant %int 12 +%float_0_800000012 = OpConstant %float 0.800000012 + %int_10 = OpConstant %int 10 + %float_10 = OpConstant %float 10 + %float_n2 = OpConstant %float -2 + %float_3 = OpConstant %float 3 + %238 = OpConstantComposite %v3float %float_3 %float_3 %float_3 + %239 = OpConstantComposite %v3float %float_2 %float_2 %float_2 +%float_0_930000007 = OpConstant %float 0.930000007 + %241 = OpConstantComposite %v3float %float_0_930000007 %float_0_930000007 %float_0_930000007 + %int_4 = OpConstant %int 4 + %int_8 = OpConstant %int 8 + %int_7 = OpConstant %int 7 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 +%float_0_00200000009 = OpConstant %float 0.00200000009 + %248 = OpConstantComposite %v3float %float_0_00200000009 %float_0_00200000009 %float_0_00200000009 +%float_6_10351999en05 = OpConstant %float 6.10351999e-05 + %250 = OpConstantComposite %v3float %float_6_10351999en05 %float_6_10351999en05 %float_6_10351999en05 + %float_4_5 = OpConstant %float 4.5 + %252 = OpConstantComposite %v3float %float_4_5 %float_4_5 %float_4_5 +%float_0_0179999992 = OpConstant %float 0.0179999992 + %254 = OpConstantComposite %v3float %float_0_0179999992 %float_0_0179999992 %float_0_0179999992 +%float_0_449999988 = OpConstant %float 0.449999988 + %256 = OpConstantComposite %v3float %float_0_449999988 %float_0_449999988 %float_0_449999988 +%float_1_09899998 = OpConstant %float 1.09899998 + %258 = OpConstantComposite %v3float %float_1_09899998 %float_1_09899998 %float_1_09899998 +%float_0_0989999995 = OpConstant %float 0.0989999995 + %260 = OpConstantComposite %v3float %float_0_0989999995 %float_0_0989999995 %float_0_0989999995 + %float_1_5 = OpConstant %float 1.5 + %262 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5 + %263 = OpConstantComposite %v3float %float_0_159301758 %float_0_159301758 %float_0_159301758 + %264 = OpConstantComposite %v3float %float_78_84375 %float_78_84375 %float_78_84375 +%float_1_00055635 = OpConstant %float 1.00055635 + %float_7000 = OpConstant %float 7000 +%float_0_244063005 = OpConstant %float 0.244063005 +%float_99_1100006 = OpConstant %float 99.1100006 +%float_2967800 = OpConstant %float 2967800 +%float_0_237039998 = OpConstant %float 0.237039998 +%float_247_479996 = OpConstant %float 247.479996 +%float_1901800 = OpConstant %float 1901800 + %float_n3 = OpConstant %float -3 +%float_2_86999989 = OpConstant %float 2.86999989 +%float_0_275000006 = OpConstant %float 0.275000006 +%float_0_860117733 = OpConstant %float 0.860117733 +%float_0_000154118257 = OpConstant %float 0.000154118257 +%float_1_28641219en07 = OpConstant %float 1.28641219e-07 +%float_0_00084242021 = OpConstant %float 0.00084242021 +%float_7_08145137en07 = OpConstant %float 7.08145137e-07 +%float_0_317398727 = OpConstant %float 0.317398727 + +; HACK: Needed to hack this constant since MSVC and GNU libc are off by 1 ULP when converting to string (it probably still works fine though in a roundtrip ...) +%float_4_22806261en05 = OpConstant %float 4.25 + +%float_4_20481676en08 = OpConstant %float 4.20481676e-08 +%float_2_8974182en05 = OpConstant %float 2.8974182e-05 +%float_1_61456057en07 = OpConstant %float 1.61456057e-07 + %float_8 = OpConstant %float 8 + %float_4 = OpConstant %float 4 +%float_0_895099998 = OpConstant %float 0.895099998 +%float_0_266400009 = OpConstant %float 0.266400009 +%float_n0_161400005 = OpConstant %float -0.161400005 +%float_n0_750199974 = OpConstant %float -0.750199974 +%float_1_71350002 = OpConstant %float 1.71350002 +%float_0_0366999991 = OpConstant %float 0.0366999991 +%float_0_0388999991 = OpConstant %float 0.0388999991 +%float_n0_0684999973 = OpConstant %float -0.0684999973 +%float_1_02960002 = OpConstant %float 1.02960002 +%float_0_986992896 = OpConstant %float 0.986992896 +%float_n0_1470543 = OpConstant %float -0.1470543 +%float_0_159962699 = OpConstant %float 0.159962699 +%float_0_432305306 = OpConstant %float 0.432305306 +%float_0_518360317 = OpConstant %float 0.518360317 +%float_0_0492912009 = OpConstant %float 0.0492912009 +%float_n0_0085287001 = OpConstant %float -0.0085287001 +%float_0_040042799 = OpConstant %float 0.040042799 +%float_0_968486726 = OpConstant %float 0.968486726 +%float_5_55555534 = OpConstant %float 5.55555534 + %307 = OpConstantComposite %v3float %float_5_55555534 %float_5_55555534 %float_5_55555534 +%float_1_00000001en10 = OpConstant %float 1.00000001e-10 +%float_0_00999999978 = OpConstant %float 0.00999999978 +%float_0_666666687 = OpConstant %float 0.666666687 + %float_180 = OpConstant %float 180 + %float_360 = OpConstant %float 360 +%float_65535 = OpConstant %float 65535 + %314 = OpConstantComposite %v3float %float_65535 %float_65535 %float_65535 +%float_n4_97062206 = OpConstant %float -4.97062206 +%float_n3_02937818 = OpConstant %float -3.02937818 +%float_n2_12619996 = OpConstant %float -2.12619996 +%float_n1_51049995 = OpConstant %float -1.51049995 +%float_n1_05780005 = OpConstant %float -1.05780005 +%float_n0_466800004 = OpConstant %float -0.466800004 +%float_0_119379997 = OpConstant %float 0.119379997 +%float_0_708813429 = OpConstant %float 0.708813429 +%float_1_29118657 = OpConstant %float 1.29118657 +%float_0_808913231 = OpConstant %float 0.808913231 +%float_1_19108677 = OpConstant %float 1.19108677 +%float_1_56830001 = OpConstant %float 1.56830001 +%float_1_9483 = OpConstant %float 1.9483 +%float_2_30830002 = OpConstant %float 2.30830002 +%float_2_63840008 = OpConstant %float 2.63840008 +%float_2_85949993 = OpConstant %float 2.85949993 +%float_2_98726082 = OpConstant %float 2.98726082 +%float_3_01273918 = OpConstant %float 3.01273918 +%float_0_179999992 = OpConstant %float 0.179999992 +%float_9_99999975en05 = OpConstant %float 9.99999975e-05 + %float_1000 = OpConstant %float 1000 +%float_0_0599999987 = OpConstant %float 0.0599999987 +%float_3_50738446en05 = OpConstant %float 3.50738446e-05 + %338 = OpConstantComposite %v3float %float_3_50738446en05 %float_3_50738446en05 %float_3_50738446en05 +%float_n2_30102992 = OpConstant %float -2.30102992 +%float_n1_93120003 = OpConstant %float -1.93120003 +%float_n1_52049994 = OpConstant %float -1.52049994 +%float_0_801995218 = OpConstant %float 0.801995218 +%float_1_19800484 = OpConstant %float 1.19800484 +%float_1_59430003 = OpConstant %float 1.59430003 +%float_1_99730003 = OpConstant %float 1.99730003 +%float_2_37829995 = OpConstant %float 2.37829995 +%float_2_76839995 = OpConstant %float 2.76839995 +%float_3_05150008 = OpConstant %float 3.05150008 +%float_3_27462935 = OpConstant %float 3.27462935 +%float_3_32743073 = OpConstant %float 3.32743073 +%float_0_00499999989 = OpConstant %float 0.00499999989 + %float_11 = OpConstant %float 11 + %float_2000 = OpConstant %float 2000 +%float_0_119999997 = OpConstant %float 0.119999997 +%float_0_00313066994 = OpConstant %float 0.00313066994 +%float_12_9200001 = OpConstant %float 12.9200001 +%float_0_416666657 = OpConstant %float 0.416666657 +%float_1_05499995 = OpConstant %float 1.05499995 +%float_0_0549999997 = OpConstant %float 0.0549999997 +%float_n0_166666672 = OpConstant %float -0.166666672 + %float_n0_5 = OpConstant %float -0.5 +%float_0_166666672 = OpConstant %float 0.166666672 +%float_n3_15737653 = OpConstant %float -3.15737653 +%float_n0_485249996 = OpConstant %float -0.485249996 +%float_1_84773242 = OpConstant %float 1.84773242 +%float_n0_718548238 = OpConstant %float -0.718548238 +%float_2_08103061 = OpConstant %float 2.08103061 +%float_3_6681242 = OpConstant %float 3.6681242 + %float_18 = OpConstant %float 18 + %float_7 = OpConstant %float 7 +%type__Globals = OpTypeStruct %v4float %v3float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %float %float %float %float %float %v3float %v4float %float %float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %float %float %uint %uint %float %float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %377 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %v2bool = OpTypeVector %bool 2 + %v3bool = OpTypeVector %bool 3 + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_arr_float_uint_6 = OpTypeArray %float %uint_6 + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %gl_Layer = OpVariable %_ptr_Input_uint Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function__arr_float_uint_6 = OpTypePointer Function %_arr_float_uint_6 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %391 = OpUndef %v3float + %392 = OpConstantComposite %v3float %float_0_952552378 %float_0 %float_9_36786018en05 + %393 = OpConstantComposite %v3float %float_0_343966454 %float_0_728166103 %float_n0_0721325427 + %394 = OpConstantComposite %v3float %float_0 %float_0 %float_1_00882518 + %395 = OpConstantComposite %mat3v3float %392 %393 %394 + %396 = OpConstantComposite %v3float %float_1_04981101 %float_0 %float_n9_74845025en05 + %397 = OpConstantComposite %v3float %float_n0_495903015 %float_1_37331307 %float_0_0982400328 + %398 = OpConstantComposite %v3float %float_0 %float_0 %float_0_991252005 + %399 = OpConstantComposite %mat3v3float %396 %397 %398 + %400 = OpConstantComposite %v3float %float_0_662454188 %float_0_134004205 %float_0_156187683 + %401 = OpConstantComposite %v3float %float_n0_00557464967 %float_0_0040607336 %float_1_01033914 + %402 = OpConstantComposite %mat3v3float %400 %67 %401 + %403 = OpConstantComposite %v3float %float_1_6410234 %float_n0_324803293 %float_n0_236424699 + %404 = OpConstantComposite %v3float %float_n0_663662851 %float_1_61533165 %float_0_0167563483 + %405 = OpConstantComposite %v3float %float_0_0117218941 %float_n0_00828444213 %float_0_988394856 + %406 = OpConstantComposite %mat3v3float %403 %404 %405 + %407 = OpConstantComposite %v3float %float_1_45143926 %float_n0_236510754 %float_n0_214928567 + %408 = OpConstantComposite %v3float %float_n0_0765537769 %float_1_17622972 %float_n0_0996759236 + %409 = OpConstantComposite %v3float %float_0_00831614807 %float_n0_00603244966 %float_0_997716308 + %410 = OpConstantComposite %mat3v3float %407 %408 %409 + %411 = OpConstantComposite %v3float %float_0_695452213 %float_0_140678704 %float_0_163869068 + %412 = OpConstantComposite %v3float %float_0_0447945632 %float_0_859671116 %float_0_0955343172 + %413 = OpConstantComposite %v3float %float_n0_00552588282 %float_0_00402521016 %float_1_00150073 + %414 = OpConstantComposite %mat3v3float %411 %412 %413 + %415 = OpConstantComposite %v3float %float_3_2409699 %float_n1_5373832 %float_n0_498610765 + %416 = OpConstantComposite %v3float %float_n0_969243646 %float_1_8759675 %float_0_0415550582 + %417 = OpConstantComposite %v3float %float_0_0556300804 %float_n0_203976959 %float_1_05697155 + %418 = OpConstantComposite %mat3v3float %415 %416 %417 + %419 = OpConstantComposite %v3float %float_0_412456393 %float_0_357576102 %float_0_180437505 + %420 = OpConstantComposite %v3float %float_0_212672904 %float_0_715152204 %float_0_0721750036 + %421 = OpConstantComposite %v3float %float_0_0193339009 %float_0_119191997 %float_0_950304091 + %422 = OpConstantComposite %mat3v3float %419 %420 %421 + %423 = OpConstantComposite %v3float %float_1_71660841 %float_n0_355662107 %float_n0_253360093 + %424 = OpConstantComposite %v3float %float_n0_666682899 %float_1_61647761 %float_0_0157685 + %425 = OpConstantComposite %v3float %float_0_0176422 %float_n0_0427763015 %float_0_942228675 + %426 = OpConstantComposite %mat3v3float %423 %424 %425 + %427 = OpConstantComposite %v3float %float_2_49339628 %float_n0_93134588 %float_n0_402694494 + %428 = OpConstantComposite %v3float %float_n0_829486787 %float_1_76265967 %float_0_0236246008 + %429 = OpConstantComposite %v3float %float_0_0358507 %float_n0_0761827007 %float_0_957014024 + %430 = OpConstantComposite %mat3v3float %427 %428 %429 + %431 = OpConstantComposite %v3float %float_1_01303005 %float_0_00610530982 %float_n0_0149710001 + %432 = OpConstantComposite %v3float %float_0_00769822998 %float_0_998165011 %float_n0_00503202993 + %433 = OpConstantComposite %v3float %float_n0_00284131011 %float_0_00468515977 %float_0_924507022 + %434 = OpConstantComposite %mat3v3float %431 %432 %433 + %435 = OpConstantComposite %v3float %float_0_987223983 %float_n0_00611326983 %float_0_0159533005 + %436 = OpConstantComposite %v3float %float_n0_00759836007 %float_1_00186002 %float_0_0053300201 + %437 = OpConstantComposite %v3float %float_0_00307257008 %float_n0_00509594986 %float_1_08168006 + %438 = OpConstantComposite %mat3v3float %435 %436 %437 + %439 = OpConstantComposite %v3float %float_0_5 %float_n1 %float_0_5 + %440 = OpConstantComposite %v3float %float_n1 %float_1 %float_0_5 + %441 = OpConstantComposite %v3float %float_0_5 %float_0 %float_0 + %442 = OpConstantComposite %mat3v3float %439 %440 %441 + %443 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %444 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %445 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %446 = OpConstantComposite %mat3v3float %443 %444 %445 +%float_n6_07624626 = OpConstant %float -6.07624626 + %448 = OpConstantComposite %v3float %float_n6_07624626 %float_n6_07624626 %float_n6_07624626 + %449 = OpConstantComposite %v3float %float_0_895099998 %float_0_266400009 %float_n0_161400005 + %450 = OpConstantComposite %v3float %float_n0_750199974 %float_1_71350002 %float_0_0366999991 + %451 = OpConstantComposite %v3float %float_0_0388999991 %float_n0_0684999973 %float_1_02960002 + %452 = OpConstantComposite %mat3v3float %449 %450 %451 + %453 = OpConstantComposite %v3float %float_0_986992896 %float_n0_1470543 %float_0_159962699 + %454 = OpConstantComposite %v3float %float_0_432305306 %float_0_518360317 %float_0_0492912009 + %455 = OpConstantComposite %v3float %float_n0_0085287001 %float_0_040042799 %float_0_968486726 + %456 = OpConstantComposite %mat3v3float %453 %454 %455 +%float_0_358299971 = OpConstant %float 0.358299971 + %458 = OpConstantComposite %v3float %float_0_544169128 %float_0_239592597 %float_0_166694298 + %459 = OpConstantComposite %v3float %float_0_239465594 %float_0_702153027 %float_0_058381401 + %460 = OpConstantComposite %v3float %float_n0_00234390004 %float_0_0361833982 %float_1_05521834 + %461 = OpConstantComposite %mat3v3float %458 %459 %460 + %462 = OpConstantComposite %v3float %float_0_940437257 %float_n0_0183068793 %float_0_077869609 + %463 = OpConstantComposite %v3float %float_0_00837869663 %float_0_828660011 %float_0_162961304 + %464 = OpConstantComposite %v3float %float_0_00054712611 %float_n0_000883374596 %float_1_00033629 + %465 = OpConstantComposite %mat3v3float %462 %463 %464 + %466 = OpConstantComposite %v3float %float_1_06317997 %float_0_0233955998 %float_n0_0865726024 + %467 = OpConstantComposite %v3float %float_n0_0106336996 %float_1_20632005 %float_n0_195690006 + %468 = OpConstantComposite %v3float %float_n0_000590886979 %float_0_00105247996 %float_0_999538004 + %469 = OpConstantComposite %mat3v3float %466 %467 %468 +%float_0_0533333346 = OpConstant %float 0.0533333346 +%float_0_159999996 = OpConstant %float 0.159999996 +%float_57_2957764 = OpConstant %float 57.2957764 +%float_n67_5 = OpConstant %float -67.5 + %float_67_5 = OpConstant %float 67.5 + %475 = OpConstantComposite %_arr_float_uint_6 %float_n4 %float_n4 %float_n3_15737653 %float_n0_485249996 %float_1_84773242 %float_1_84773242 + %476 = OpConstantComposite %_arr_float_uint_6 %float_n0_718548238 %float_2_08103061 %float_3_6681242 %float_4 %float_4 %float_4 + %float_n15 = OpConstant %float -15 + %float_n14 = OpConstant %float -14 + %479 = OpConstantComposite %_arr_float_uint_10 %float_n4_97062206 %float_n3_02937818 %float_n2_12619996 %float_n1_51049995 %float_n1_05780005 %float_n0_466800004 %float_0_119379997 %float_0_708813429 %float_1_29118657 %float_1_29118657 + %480 = OpConstantComposite %_arr_float_uint_10 %float_0_808913231 %float_1_19108677 %float_1_56830001 %float_1_9483 %float_2_30830002 %float_2_63840008 %float_2_85949993 %float_2_98726082 %float_3_01273918 %float_3_01273918 + %float_n12 = OpConstant %float -12 + %482 = OpConstantComposite %_arr_float_uint_10 %float_n2_30102992 %float_n2_30102992 %float_n1_93120003 %float_n1_52049994 %float_n1_05780005 %float_n0_466800004 %float_0_119379997 %float_0_708813429 %float_1_29118657 %float_1_29118657 + %483 = OpConstantComposite %_arr_float_uint_10 %float_0_801995218 %float_1_19800484 %float_1_59430003 %float_1_99730003 %float_2_37829995 %float_2_76839995 %float_3_05150008 %float_3_27462935 %float_3_32743073 %float_3_32743073 +%float_0_0322580636 = OpConstant %float 0.0322580636 +%float_1_03225803 = OpConstant %float 1.03225803 + %486 = OpConstantComposite %v2float %float_1_03225803 %float_1_03225803 +%float_4_60443853e_09 = OpConstant %float 4.60443853e+09 +%float_2_00528435e_09 = OpConstant %float 2.00528435e+09 +%float_0_333333343 = OpConstant %float 0.333333343 + %float_5 = OpConstant %float 5 + %float_2_5 = OpConstant %float 2.5 +%float_0_0250000004 = OpConstant %float 0.0250000004 +%float_0_239999995 = OpConstant %float 0.239999995 +%float_0_0148148146 = OpConstant %float 0.0148148146 +%float_0_819999993 = OpConstant %float 0.819999993 + %496 = OpConstantComposite %v3float %float_9_99999975en05 %float_9_99999975en05 %float_9_99999975en05 +%float_0_0296296291 = OpConstant %float 0.0296296291 +%float_0_952381015 = OpConstant %float 0.952381015 + %499 = OpConstantComposite %v3float %float_0_952381015 %float_0_952381015 %float_0_952381015 + %MainPS = OpFunction %void None %377 + %500 = OpLabel + %501 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %502 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %503 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %504 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %505 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %506 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %507 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %508 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %509 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %510 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %511 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %512 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %513 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %514 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %515 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %516 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %517 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %518 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %519 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %520 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %521 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %522 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %523 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %524 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %525 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %526 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %527 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %528 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %529 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %530 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %531 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %532 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %533 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %534 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %535 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %536 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %537 = OpLoad %v2float %in_var_TEXCOORD0 + %538 = OpLoad %uint %gl_Layer + %539 = OpFSub %v2float %537 %128 + %540 = OpFMul %v2float %539 %486 + %541 = OpCompositeExtract %float %540 0 + %542 = OpCompositeExtract %float %540 1 + %543 = OpConvertUToF %float %538 + %544 = OpFMul %float %543 %float_0_0322580636 + %545 = OpCompositeConstruct %v4float %541 %542 %544 %float_0 + %546 = OpMatrixTimesMatrix %mat3v3float %422 %434 + %547 = OpMatrixTimesMatrix %mat3v3float %546 %406 + %548 = OpMatrixTimesMatrix %mat3v3float %402 %438 + %549 = OpMatrixTimesMatrix %mat3v3float %548 %418 + %550 = OpMatrixTimesMatrix %mat3v3float %395 %406 + %551 = OpMatrixTimesMatrix %mat3v3float %402 %399 + %552 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_42 + %553 = OpLoad %uint %552 + OpBranch %554 + %554 = OpLabel + OpLoopMerge %555 %556 None + OpBranch %557 + %557 = OpLabel + %558 = OpMatrixTimesMatrix %mat3v3float %548 %430 + %559 = OpMatrixTimesMatrix %mat3v3float %548 %426 + %560 = OpIEqual %bool %553 %uint_1 + OpSelectionMerge %561 None + OpBranchConditional %560 %562 %563 + %563 = OpLabel + %564 = OpIEqual %bool %553 %uint_2 + OpSelectionMerge %565 None + OpBranchConditional %564 %566 %567 + %567 = OpLabel + %568 = OpIEqual %bool %553 %uint_3 + OpSelectionMerge %569 None + OpBranchConditional %568 %570 %571 + %571 = OpLabel + %572 = OpIEqual %bool %553 %uint_4 + OpSelectionMerge %573 None + OpBranchConditional %572 %574 %575 + %575 = OpLabel + OpBranch %555 + %574 = OpLabel + OpBranch %555 + %573 = OpLabel + OpUnreachable + %570 = OpLabel + OpBranch %555 + %569 = OpLabel + OpUnreachable + %566 = OpLabel + OpBranch %555 + %565 = OpLabel + OpUnreachable + %562 = OpLabel + OpBranch %555 + %561 = OpLabel + OpUnreachable + %556 = OpLabel + OpBranch %554 + %555 = OpLabel + %576 = OpPhi %mat3v3float %549 %575 %446 %574 %414 %570 %559 %566 %558 %562 + %577 = OpVectorShuffle %v3float %545 %545 0 1 2 + %578 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_41 + %579 = OpLoad %uint %578 + %580 = OpUGreaterThanEqual %bool %579 %uint_3 + OpSelectionMerge %581 None + OpBranchConditional %580 %582 %583 + %583 = OpLabel + %584 = OpFSub %v3float %577 %192 + %585 = OpFMul %v3float %584 %193 + %586 = OpExtInst %v3float %1 Exp2 %585 + %587 = OpFMul %v3float %586 %194 + %588 = OpExtInst %v3float %1 Exp2 %448 + %589 = OpFMul %v3float %588 %194 + %590 = OpFSub %v3float %587 %589 + OpBranch %581 + %582 = OpLabel + %591 = OpExtInst %v3float %1 Pow %577 %182 + %592 = OpFSub %v3float %591 %183 + %593 = OpExtInst %v3float %1 FMax %132 %592 + %594 = OpFMul %v3float %185 %591 + %595 = OpFSub %v3float %184 %594 + %596 = OpFDiv %v3float %593 %595 + %597 = OpExtInst %v3float %1 Pow %596 %187 + %598 = OpFMul %v3float %597 %188 + OpBranch %581 + %581 = OpLabel + %599 = OpPhi %v3float %590 %583 %598 %582 + %600 = OpAccessChain %_ptr_Uniform_float %_Globals %int_17 + %601 = OpLoad %float %600 + %602 = OpFMul %float %601 %float_1_00055635 + %603 = OpFOrdLessThanEqual %bool %602 %float_7000 + %604 = OpFDiv %float %float_4_60443853e_09 %601 + %605 = OpFSub %float %float_2967800 %604 + %606 = OpFDiv %float %605 %602 + %607 = OpFAdd %float %float_99_1100006 %606 + %608 = OpFDiv %float %607 %602 + %609 = OpFAdd %float %float_0_244063005 %608 + %610 = OpFDiv %float %float_2_00528435e_09 %601 + %611 = OpFSub %float %float_1901800 %610 + %612 = OpFDiv %float %611 %602 + %613 = OpFAdd %float %float_247_479996 %612 + %614 = OpFDiv %float %613 %602 + %615 = OpFAdd %float %float_0_237039998 %614 + %616 = OpSelect %float %603 %609 %615 + %617 = OpFMul %float %float_n3 %616 + %618 = OpFMul %float %617 %616 + %619 = OpFMul %float %float_2_86999989 %616 + %620 = OpFAdd %float %618 %619 + %621 = OpFSub %float %620 %float_0_275000006 + %622 = OpCompositeConstruct %v2float %616 %621 + %623 = OpFMul %float %float_0_000154118257 %601 + %624 = OpFAdd %float %float_0_860117733 %623 + %625 = OpFMul %float %float_1_28641219en07 %601 + %626 = OpFMul %float %625 %601 + %627 = OpFAdd %float %624 %626 + %628 = OpFMul %float %float_0_00084242021 %601 + %629 = OpFAdd %float %float_1 %628 + %630 = OpFMul %float %float_7_08145137en07 %601 + %631 = OpFMul %float %630 %601 + %632 = OpFAdd %float %629 %631 + %633 = OpFDiv %float %627 %632 + %634 = OpFMul %float %float_4_22806261en05 %601 + %635 = OpFAdd %float %float_0_317398727 %634 + %636 = OpFMul %float %float_4_20481676en08 %601 + %637 = OpFMul %float %636 %601 + %638 = OpFAdd %float %635 %637 + %639 = OpFMul %float %float_2_8974182en05 %601 + %640 = OpFSub %float %float_1 %639 + %641 = OpFMul %float %float_1_61456057en07 %601 + %642 = OpFMul %float %641 %601 + %643 = OpFAdd %float %640 %642 + %644 = OpFDiv %float %638 %643 + %645 = OpFMul %float %float_3 %633 + %646 = OpFMul %float %float_2 %633 + %647 = OpFMul %float %float_8 %644 + %648 = OpFSub %float %646 %647 + %649 = OpFAdd %float %648 %float_4 + %650 = OpFDiv %float %645 %649 + %651 = OpFMul %float %float_2 %644 + %652 = OpFDiv %float %651 %649 + %653 = OpCompositeConstruct %v2float %650 %652 + %654 = OpFOrdLessThan %bool %601 %float_4000 + %655 = OpCompositeConstruct %v2bool %654 %654 + %656 = OpSelect %v2float %655 %653 %622 + %657 = OpAccessChain %_ptr_Uniform_float %_Globals %int_18 + %658 = OpLoad %float %657 + %659 = OpCompositeConstruct %v2float %633 %644 + %660 = OpExtInst %v2float %1 Normalize %659 + %661 = OpCompositeExtract %float %660 1 + %662 = OpFNegate %float %661 + %663 = OpFMul %float %662 %658 + %664 = OpFMul %float %663 %float_0_0500000007 + %665 = OpFAdd %float %633 %664 + %666 = OpCompositeExtract %float %660 0 + %667 = OpFMul %float %666 %658 + %668 = OpFMul %float %667 %float_0_0500000007 + %669 = OpFAdd %float %644 %668 + %670 = OpFMul %float %float_3 %665 + %671 = OpFMul %float %float_2 %665 + %672 = OpFMul %float %float_8 %669 + %673 = OpFSub %float %671 %672 + %674 = OpFAdd %float %673 %float_4 + %675 = OpFDiv %float %670 %674 + %676 = OpFMul %float %float_2 %669 + %677 = OpFDiv %float %676 %674 + %678 = OpCompositeConstruct %v2float %675 %677 + %679 = OpFSub %v2float %678 %653 + %680 = OpFAdd %v2float %656 %679 + %681 = OpCompositeExtract %float %680 0 + %682 = OpCompositeExtract %float %680 1 + %683 = OpExtInst %float %1 FMax %682 %float_1_00000001en10 + %684 = OpFDiv %float %681 %683 + %685 = OpCompositeInsert %v3float %684 %391 0 + %686 = OpCompositeInsert %v3float %float_1 %685 1 + %687 = OpFSub %float %float_1 %681 + %688 = OpFSub %float %687 %682 + %689 = OpFDiv %float %688 %683 + %690 = OpCompositeInsert %v3float %689 %686 2 + %691 = OpExtInst %float %1 FMax %float_0_328999996 %float_1_00000001en10 + %692 = OpFDiv %float %float_0_312700003 %691 + %693 = OpCompositeInsert %v3float %692 %391 0 + %694 = OpCompositeInsert %v3float %float_1 %693 1 + %695 = OpFDiv %float %float_0_358299971 %691 + %696 = OpCompositeInsert %v3float %695 %694 2 + %697 = OpVectorTimesMatrix %v3float %690 %452 + %698 = OpVectorTimesMatrix %v3float %696 %452 + %699 = OpCompositeExtract %float %698 0 + %700 = OpCompositeExtract %float %697 0 + %701 = OpFDiv %float %699 %700 + %702 = OpCompositeConstruct %v3float %701 %float_0 %float_0 + %703 = OpCompositeExtract %float %698 1 + %704 = OpCompositeExtract %float %697 1 + %705 = OpFDiv %float %703 %704 + %706 = OpCompositeConstruct %v3float %float_0 %705 %float_0 + %707 = OpCompositeExtract %float %698 2 + %708 = OpCompositeExtract %float %697 2 + %709 = OpFDiv %float %707 %708 + %710 = OpCompositeConstruct %v3float %float_0 %float_0 %709 + %711 = OpCompositeConstruct %mat3v3float %702 %706 %710 + %712 = OpMatrixTimesMatrix %mat3v3float %452 %711 + %713 = OpMatrixTimesMatrix %mat3v3float %712 %456 + %714 = OpMatrixTimesMatrix %mat3v3float %422 %713 + %715 = OpMatrixTimesMatrix %mat3v3float %714 %418 + %716 = OpVectorTimesMatrix %v3float %599 %715 + %717 = OpVectorTimesMatrix %v3float %716 %547 + %718 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_9 + %719 = OpAccessChain %_ptr_Uniform_float %_Globals %int_9 %int_3 + %720 = OpLoad %float %719 + %721 = OpFOrdNotEqual %bool %720 %float_0 + OpSelectionMerge %722 None + OpBranchConditional %721 %723 %722 + %723 = OpLabel + %724 = OpDot %float %717 %67 + %725 = OpCompositeConstruct %v3float %724 %724 %724 + %726 = OpFDiv %v3float %717 %725 + %727 = OpFSub %v3float %726 %135 + %728 = OpDot %float %727 %727 + %729 = OpFMul %float %float_n4 %728 + %730 = OpExtInst %float %1 Exp2 %729 + %731 = OpFSub %float %float_1 %730 + %732 = OpAccessChain %_ptr_Uniform_float %_Globals %int_44 + %733 = OpLoad %float %732 + %734 = OpFMul %float %float_n4 %733 + %735 = OpFMul %float %734 %724 + %736 = OpFMul %float %735 %724 + %737 = OpExtInst %float %1 Exp2 %736 + %738 = OpFSub %float %float_1 %737 + %739 = OpFMul %float %731 %738 + %740 = OpMatrixTimesMatrix %mat3v3float %461 %406 + %741 = OpMatrixTimesMatrix %mat3v3float %549 %740 + %742 = OpVectorTimesMatrix %v3float %717 %741 + %743 = OpCompositeConstruct %v3float %739 %739 %739 + %744 = OpExtInst %v3float %1 FMix %717 %742 %743 + OpBranch %722 + %722 = OpLabel + %745 = OpPhi %v3float %717 %581 %744 %723 + %746 = OpDot %float %745 %67 + %747 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_24 + %748 = OpLoad %v4float %747 + %749 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_19 + %750 = OpLoad %v4float %749 + %751 = OpFMul %v4float %748 %750 + %752 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_25 + %753 = OpLoad %v4float %752 + %754 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_20 + %755 = OpLoad %v4float %754 + %756 = OpFMul %v4float %753 %755 + %757 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_26 + %758 = OpLoad %v4float %757 + %759 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_21 + %760 = OpLoad %v4float %759 + %761 = OpFMul %v4float %758 %760 + %762 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_27 + %763 = OpLoad %v4float %762 + %764 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_22 + %765 = OpLoad %v4float %764 + %766 = OpFMul %v4float %763 %765 + %767 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_28 + %768 = OpLoad %v4float %767 + %769 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_23 + %770 = OpLoad %v4float %769 + %771 = OpFAdd %v4float %768 %770 + %772 = OpCompositeConstruct %v3float %746 %746 %746 + %773 = OpVectorShuffle %v3float %751 %751 0 1 2 + %774 = OpCompositeExtract %float %751 3 + %775 = OpCompositeConstruct %v3float %774 %774 %774 + %776 = OpFMul %v3float %773 %775 + %777 = OpExtInst %v3float %1 FMix %772 %745 %776 + %778 = OpExtInst %v3float %1 FMax %132 %777 + %779 = OpFMul %v3float %778 %307 + %780 = OpVectorShuffle %v3float %756 %756 0 1 2 + %781 = OpCompositeExtract %float %756 3 + %782 = OpCompositeConstruct %v3float %781 %781 %781 + %783 = OpFMul %v3float %780 %782 + %784 = OpExtInst %v3float %1 Pow %779 %783 + %785 = OpFMul %v3float %784 %194 + %786 = OpVectorShuffle %v3float %761 %761 0 1 2 + %787 = OpCompositeExtract %float %761 3 + %788 = OpCompositeConstruct %v3float %787 %787 %787 + %789 = OpFMul %v3float %786 %788 + %790 = OpFDiv %v3float %135 %789 + %791 = OpExtInst %v3float %1 Pow %785 %790 + %792 = OpVectorShuffle %v3float %766 %766 0 1 2 + %793 = OpCompositeExtract %float %766 3 + %794 = OpCompositeConstruct %v3float %793 %793 %793 + %795 = OpFMul %v3float %792 %794 + %796 = OpFMul %v3float %791 %795 + %797 = OpVectorShuffle %v3float %771 %771 0 1 2 + %798 = OpCompositeExtract %float %771 3 + %799 = OpCompositeConstruct %v3float %798 %798 %798 + %800 = OpFAdd %v3float %797 %799 + %801 = OpFAdd %v3float %796 %800 + %802 = OpAccessChain %_ptr_Uniform_float %_Globals %int_39 + %803 = OpLoad %float %802 + %804 = OpExtInst %float %1 SmoothStep %float_0 %803 %746 + %805 = OpFSub %float %float_1 %804 + %806 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_34 + %807 = OpLoad %v4float %806 + %808 = OpFMul %v4float %807 %750 + %809 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_35 + %810 = OpLoad %v4float %809 + %811 = OpFMul %v4float %810 %755 + %812 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_36 + %813 = OpLoad %v4float %812 + %814 = OpFMul %v4float %813 %760 + %815 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_37 + %816 = OpLoad %v4float %815 + %817 = OpFMul %v4float %816 %765 + %818 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_38 + %819 = OpLoad %v4float %818 + %820 = OpFAdd %v4float %819 %770 + %821 = OpVectorShuffle %v3float %808 %808 0 1 2 + %822 = OpCompositeExtract %float %808 3 + %823 = OpCompositeConstruct %v3float %822 %822 %822 + %824 = OpFMul %v3float %821 %823 + %825 = OpExtInst %v3float %1 FMix %772 %745 %824 + %826 = OpExtInst %v3float %1 FMax %132 %825 + %827 = OpFMul %v3float %826 %307 + %828 = OpVectorShuffle %v3float %811 %811 0 1 2 + %829 = OpCompositeExtract %float %811 3 + %830 = OpCompositeConstruct %v3float %829 %829 %829 + %831 = OpFMul %v3float %828 %830 + %832 = OpExtInst %v3float %1 Pow %827 %831 + %833 = OpFMul %v3float %832 %194 + %834 = OpVectorShuffle %v3float %814 %814 0 1 2 + %835 = OpCompositeExtract %float %814 3 + %836 = OpCompositeConstruct %v3float %835 %835 %835 + %837 = OpFMul %v3float %834 %836 + %838 = OpFDiv %v3float %135 %837 + %839 = OpExtInst %v3float %1 Pow %833 %838 + %840 = OpVectorShuffle %v3float %817 %817 0 1 2 + %841 = OpCompositeExtract %float %817 3 + %842 = OpCompositeConstruct %v3float %841 %841 %841 + %843 = OpFMul %v3float %840 %842 + %844 = OpFMul %v3float %839 %843 + %845 = OpVectorShuffle %v3float %820 %820 0 1 2 + %846 = OpCompositeExtract %float %820 3 + %847 = OpCompositeConstruct %v3float %846 %846 %846 + %848 = OpFAdd %v3float %845 %847 + %849 = OpFAdd %v3float %844 %848 + %850 = OpAccessChain %_ptr_Uniform_float %_Globals %int_40 + %851 = OpLoad %float %850 + %852 = OpExtInst %float %1 SmoothStep %851 %float_1 %746 + %853 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_29 + %854 = OpLoad %v4float %853 + %855 = OpFMul %v4float %854 %750 + %856 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_30 + %857 = OpLoad %v4float %856 + %858 = OpFMul %v4float %857 %755 + %859 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_31 + %860 = OpLoad %v4float %859 + %861 = OpFMul %v4float %860 %760 + %862 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_32 + %863 = OpLoad %v4float %862 + %864 = OpFMul %v4float %863 %765 + %865 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_33 + %866 = OpLoad %v4float %865 + %867 = OpFAdd %v4float %866 %770 + %868 = OpVectorShuffle %v3float %855 %855 0 1 2 + %869 = OpCompositeExtract %float %855 3 + %870 = OpCompositeConstruct %v3float %869 %869 %869 + %871 = OpFMul %v3float %868 %870 + %872 = OpExtInst %v3float %1 FMix %772 %745 %871 + %873 = OpExtInst %v3float %1 FMax %132 %872 + %874 = OpFMul %v3float %873 %307 + %875 = OpVectorShuffle %v3float %858 %858 0 1 2 + %876 = OpCompositeExtract %float %858 3 + %877 = OpCompositeConstruct %v3float %876 %876 %876 + %878 = OpFMul %v3float %875 %877 + %879 = OpExtInst %v3float %1 Pow %874 %878 + %880 = OpFMul %v3float %879 %194 + %881 = OpVectorShuffle %v3float %861 %861 0 1 2 + %882 = OpCompositeExtract %float %861 3 + %883 = OpCompositeConstruct %v3float %882 %882 %882 + %884 = OpFMul %v3float %881 %883 + %885 = OpFDiv %v3float %135 %884 + %886 = OpExtInst %v3float %1 Pow %880 %885 + %887 = OpVectorShuffle %v3float %864 %864 0 1 2 + %888 = OpCompositeExtract %float %864 3 + %889 = OpCompositeConstruct %v3float %888 %888 %888 + %890 = OpFMul %v3float %887 %889 + %891 = OpFMul %v3float %886 %890 + %892 = OpVectorShuffle %v3float %867 %867 0 1 2 + %893 = OpCompositeExtract %float %867 3 + %894 = OpCompositeConstruct %v3float %893 %893 %893 + %895 = OpFAdd %v3float %892 %894 + %896 = OpFAdd %v3float %891 %895 + %897 = OpFSub %float %804 %852 + %898 = OpCompositeConstruct %v3float %805 %805 %805 + %899 = OpFMul %v3float %801 %898 + %900 = OpCompositeConstruct %v3float %897 %897 %897 + %901 = OpFMul %v3float %896 %900 + %902 = OpFAdd %v3float %899 %901 + %903 = OpCompositeConstruct %v3float %852 %852 %852 + %904 = OpFMul %v3float %849 %903 + %905 = OpFAdd %v3float %902 %904 + %906 = OpVectorTimesMatrix %v3float %905 %549 + %907 = OpMatrixTimesMatrix %mat3v3float %551 %465 + %908 = OpMatrixTimesMatrix %mat3v3float %907 %550 + %909 = OpMatrixTimesMatrix %mat3v3float %551 %469 + %910 = OpMatrixTimesMatrix %mat3v3float %909 %550 + %911 = OpVectorTimesMatrix %v3float %905 %908 + %912 = OpAccessChain %_ptr_Uniform_float %_Globals %int_43 + %913 = OpLoad %float %912 + %914 = OpCompositeConstruct %v3float %913 %913 %913 + %915 = OpExtInst %v3float %1 FMix %905 %911 %914 + %916 = OpVectorTimesMatrix %v3float %915 %551 + %917 = OpCompositeExtract %float %916 0 + %918 = OpCompositeExtract %float %916 1 + %919 = OpExtInst %float %1 FMin %917 %918 + %920 = OpCompositeExtract %float %916 2 + %921 = OpExtInst %float %1 FMin %919 %920 + %922 = OpExtInst %float %1 FMax %917 %918 + %923 = OpExtInst %float %1 FMax %922 %920 + %924 = OpExtInst %float %1 FMax %923 %float_1_00000001en10 + %925 = OpExtInst %float %1 FMax %921 %float_1_00000001en10 + %926 = OpFSub %float %924 %925 + %927 = OpExtInst %float %1 FMax %923 %float_0_00999999978 + %928 = OpFDiv %float %926 %927 + %929 = OpFSub %float %920 %918 + %930 = OpFMul %float %920 %929 + %931 = OpFSub %float %918 %917 + %932 = OpFMul %float %918 %931 + %933 = OpFAdd %float %930 %932 + %934 = OpFSub %float %917 %920 + %935 = OpFMul %float %917 %934 + %936 = OpFAdd %float %933 %935 + %937 = OpExtInst %float %1 Sqrt %936 + %938 = OpFAdd %float %920 %918 + %939 = OpFAdd %float %938 %917 + %940 = OpFMul %float %float_1_75 %937 + %941 = OpFAdd %float %939 %940 + %942 = OpFMul %float %941 %float_0_333333343 + %943 = OpFSub %float %928 %float_0_400000006 + %944 = OpFMul %float %943 %float_5 + %945 = OpFMul %float %943 %float_2_5 + %946 = OpExtInst %float %1 FAbs %945 + %947 = OpFSub %float %float_1 %946 + %948 = OpExtInst %float %1 FMax %947 %float_0 + %949 = OpExtInst %float %1 FSign %944 + %950 = OpConvertFToS %int %949 + %951 = OpConvertSToF %float %950 + %952 = OpFMul %float %948 %948 + %953 = OpFSub %float %float_1 %952 + %954 = OpFMul %float %951 %953 + %955 = OpFAdd %float %float_1 %954 + %956 = OpFMul %float %955 %float_0_0250000004 + %957 = OpFOrdLessThanEqual %bool %942 %float_0_0533333346 + OpSelectionMerge %958 None + OpBranchConditional %957 %959 %960 + %960 = OpLabel + %961 = OpFOrdGreaterThanEqual %bool %942 %float_0_159999996 + OpSelectionMerge %962 None + OpBranchConditional %961 %963 %964 + %964 = OpLabel + %965 = OpFDiv %float %float_0_239999995 %941 + %966 = OpFSub %float %965 %float_0_5 + %967 = OpFMul %float %956 %966 + OpBranch %962 + %963 = OpLabel + OpBranch %962 + %962 = OpLabel + %968 = OpPhi %float %967 %964 %float_0 %963 + OpBranch %958 + %959 = OpLabel + OpBranch %958 + %958 = OpLabel + %969 = OpPhi %float %968 %962 %956 %959 + %970 = OpFAdd %float %float_1 %969 + %971 = OpCompositeConstruct %v3float %970 %970 %970 + %972 = OpFMul %v3float %916 %971 + %973 = OpCompositeExtract %float %972 0 + %974 = OpCompositeExtract %float %972 1 + %975 = OpFOrdEqual %bool %973 %974 + %976 = OpCompositeExtract %float %972 2 + %977 = OpFOrdEqual %bool %974 %976 + %978 = OpLogicalAnd %bool %975 %977 + OpSelectionMerge %979 None + OpBranchConditional %978 %980 %981 + %981 = OpLabel + %982 = OpExtInst %float %1 Sqrt %float_3 + %983 = OpFSub %float %974 %976 + %984 = OpFMul %float %982 %983 + %985 = OpFMul %float %float_2 %973 + %986 = OpFSub %float %985 %974 + %987 = OpFSub %float %986 %976 + %988 = OpExtInst %float %1 Atan2 %984 %987 + %989 = OpFMul %float %float_57_2957764 %988 + OpBranch %979 + %980 = OpLabel + OpBranch %979 + %979 = OpLabel + %990 = OpPhi %float %989 %981 %float_0 %980 + %991 = OpFOrdLessThan %bool %990 %float_0 + OpSelectionMerge %992 None + OpBranchConditional %991 %993 %992 + %993 = OpLabel + %994 = OpFAdd %float %990 %float_360 + OpBranch %992 + %992 = OpLabel + %995 = OpPhi %float %990 %979 %994 %993 + %996 = OpExtInst %float %1 FClamp %995 %float_0 %float_360 + %997 = OpFOrdGreaterThan %bool %996 %float_180 + OpSelectionMerge %998 None + OpBranchConditional %997 %999 %998 + %999 = OpLabel + %1000 = OpFSub %float %996 %float_360 + OpBranch %998 + %998 = OpLabel + %1001 = OpPhi %float %996 %992 %1000 %999 + %1002 = OpFMul %float %1001 %float_0_0148148146 + %1003 = OpExtInst %float %1 FAbs %1002 + %1004 = OpFSub %float %float_1 %1003 + %1005 = OpExtInst %float %1 SmoothStep %float_0 %float_1 %1004 + %1006 = OpFMul %float %1005 %1005 + %1007 = OpFMul %float %1006 %928 + %1008 = OpFSub %float %float_0_0299999993 %973 + %1009 = OpFMul %float %1007 %1008 + %1010 = OpFMul %float %1009 %float_0_180000007 + %1011 = OpFAdd %float %973 %1010 + %1012 = OpCompositeInsert %v3float %1011 %972 0 + %1013 = OpVectorTimesMatrix %v3float %1012 %410 + %1014 = OpExtInst %v3float %1 FMax %132 %1013 + %1015 = OpDot %float %1014 %67 + %1016 = OpCompositeConstruct %v3float %1015 %1015 %1015 + %1017 = OpExtInst %v3float %1 FMix %1016 %1014 %228 + %1018 = OpAccessChain %_ptr_Uniform_float %_Globals %int_13 + %1019 = OpLoad %float %1018 + %1020 = OpFAdd %float %float_1 %1019 + %1021 = OpAccessChain %_ptr_Uniform_float %_Globals %int_11 + %1022 = OpLoad %float %1021 + %1023 = OpFSub %float %1020 %1022 + %1024 = OpAccessChain %_ptr_Uniform_float %_Globals %int_14 + %1025 = OpLoad %float %1024 + %1026 = OpFAdd %float %float_1 %1025 + %1027 = OpAccessChain %_ptr_Uniform_float %_Globals %int_12 + %1028 = OpLoad %float %1027 + %1029 = OpFSub %float %1026 %1028 + %1030 = OpFOrdGreaterThan %bool %1022 %float_0_800000012 + OpSelectionMerge %1031 None + OpBranchConditional %1030 %1032 %1033 + %1033 = OpLabel + %1034 = OpFAdd %float %float_0_180000007 %1019 + %1035 = OpFDiv %float %1034 %1023 + %1036 = OpExtInst %float %1 Log %float_0_180000007 + %1037 = OpExtInst %float %1 Log %float_10 + %1038 = OpFDiv %float %1036 %1037 + %1039 = OpFSub %float %float_2 %1035 + %1040 = OpFDiv %float %1035 %1039 + %1041 = OpExtInst %float %1 Log %1040 + %1042 = OpFMul %float %float_0_5 %1041 + %1043 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1044 = OpLoad %float %1043 + %1045 = OpFDiv %float %1023 %1044 + %1046 = OpFMul %float %1042 %1045 + %1047 = OpFSub %float %1038 %1046 + OpBranch %1031 + %1032 = OpLabel + %1048 = OpFSub %float %float_0_819999993 %1022 + %1049 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1050 = OpLoad %float %1049 + %1051 = OpFDiv %float %1048 %1050 + %1052 = OpExtInst %float %1 Log %float_0_180000007 + %1053 = OpExtInst %float %1 Log %float_10 + %1054 = OpFDiv %float %1052 %1053 + %1055 = OpFAdd %float %1051 %1054 + OpBranch %1031 + %1031 = OpLabel + %1056 = OpPhi %float %1047 %1033 %1055 %1032 + %1057 = OpFSub %float %float_1 %1022 + %1058 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1059 = OpLoad %float %1058 + %1060 = OpFDiv %float %1057 %1059 + %1061 = OpFSub %float %1060 %1056 + %1062 = OpFDiv %float %1028 %1059 + %1063 = OpFSub %float %1062 %1061 + %1064 = OpExtInst %v3float %1 Log %1017 + %1065 = OpExtInst %float %1 Log %float_10 + %1066 = OpCompositeConstruct %v3float %1065 %1065 %1065 + %1067 = OpFDiv %v3float %1064 %1066 + %1068 = OpCompositeConstruct %v3float %1059 %1059 %1059 + %1069 = OpCompositeConstruct %v3float %1061 %1061 %1061 + %1070 = OpFAdd %v3float %1067 %1069 + %1071 = OpFMul %v3float %1068 %1070 + %1072 = OpFNegate %float %1019 + %1073 = OpCompositeConstruct %v3float %1072 %1072 %1072 + %1074 = OpFMul %float %float_2 %1023 + %1075 = OpCompositeConstruct %v3float %1074 %1074 %1074 + %1076 = OpFMul %float %float_n2 %1059 + %1077 = OpFDiv %float %1076 %1023 + %1078 = OpCompositeConstruct %v3float %1077 %1077 %1077 + %1079 = OpCompositeConstruct %v3float %1056 %1056 %1056 + %1080 = OpFSub %v3float %1067 %1079 + %1081 = OpFMul %v3float %1078 %1080 + %1082 = OpExtInst %v3float %1 Exp %1081 + %1083 = OpFAdd %v3float %135 %1082 + %1084 = OpFDiv %v3float %1075 %1083 + %1085 = OpFAdd %v3float %1073 %1084 + %1086 = OpCompositeConstruct %v3float %1026 %1026 %1026 + %1087 = OpFMul %float %float_2 %1029 + %1088 = OpCompositeConstruct %v3float %1087 %1087 %1087 + %1089 = OpFMul %float %float_2 %1059 + %1090 = OpFDiv %float %1089 %1029 + %1091 = OpCompositeConstruct %v3float %1090 %1090 %1090 + %1092 = OpCompositeConstruct %v3float %1063 %1063 %1063 + %1093 = OpFSub %v3float %1067 %1092 + %1094 = OpFMul %v3float %1091 %1093 + %1095 = OpExtInst %v3float %1 Exp %1094 + %1096 = OpFAdd %v3float %135 %1095 + %1097 = OpFDiv %v3float %1088 %1096 + %1098 = OpFSub %v3float %1086 %1097 + %1099 = OpFOrdLessThan %v3bool %1067 %1079 + %1100 = OpSelect %v3float %1099 %1085 %1071 + %1101 = OpFOrdGreaterThan %v3bool %1067 %1092 + %1102 = OpSelect %v3float %1101 %1098 %1071 + %1103 = OpFSub %float %1063 %1056 + %1104 = OpCompositeConstruct %v3float %1103 %1103 %1103 + %1105 = OpFDiv %v3float %1080 %1104 + %1106 = OpExtInst %v3float %1 FClamp %1105 %132 %135 + %1107 = OpFOrdLessThan %bool %1063 %1056 + %1108 = OpFSub %v3float %135 %1106 + %1109 = OpCompositeConstruct %v3bool %1107 %1107 %1107 + %1110 = OpSelect %v3float %1109 %1108 %1106 + %1111 = OpFMul %v3float %239 %1110 + %1112 = OpFSub %v3float %238 %1111 + %1113 = OpFMul %v3float %1112 %1110 + %1114 = OpFMul %v3float %1113 %1110 + %1115 = OpExtInst %v3float %1 FMix %1100 %1102 %1114 + %1116 = OpDot %float %1115 %67 + %1117 = OpCompositeConstruct %v3float %1116 %1116 %1116 + %1118 = OpExtInst %v3float %1 FMix %1117 %1115 %241 + %1119 = OpExtInst %v3float %1 FMax %132 %1118 + %1120 = OpVectorTimesMatrix %v3float %1119 %910 + %1121 = OpExtInst %v3float %1 FMix %1119 %1120 %914 + %1122 = OpVectorTimesMatrix %v3float %1121 %549 + %1123 = OpExtInst %v3float %1 FMax %132 %1122 + %1124 = OpFOrdEqual %bool %720 %float_0 + OpSelectionMerge %1125 DontFlatten + OpBranchConditional %1124 %1126 %1125 + %1126 = OpLabel + %1127 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_2 + %1128 = OpLoad %v4float %1127 + %1129 = OpVectorShuffle %v3float %1128 %1128 0 1 2 + %1130 = OpDot %float %906 %1129 + %1131 = OpCompositeInsert %v3float %1130 %391 0 + %1132 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 + %1133 = OpLoad %v4float %1132 + %1134 = OpVectorShuffle %v3float %1133 %1133 0 1 2 + %1135 = OpDot %float %906 %1134 + %1136 = OpCompositeInsert %v3float %1135 %1131 1 + %1137 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_4 + %1138 = OpLoad %v4float %1137 + %1139 = OpVectorShuffle %v3float %1138 %1138 0 1 2 + %1140 = OpDot %float %906 %1139 + %1141 = OpCompositeInsert %v3float %1140 %1136 2 + %1142 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8 + %1143 = OpLoad %v4float %1142 + %1144 = OpVectorShuffle %v3float %1143 %1143 0 1 2 + %1145 = OpLoad %v4float %718 + %1146 = OpVectorShuffle %v3float %1145 %1145 0 1 2 + %1147 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %1148 = OpLoad %v4float %1147 + %1149 = OpVectorShuffle %v3float %1148 %1148 0 1 2 + %1150 = OpDot %float %906 %1149 + %1151 = OpFAdd %float %1150 %float_1 + %1152 = OpFDiv %float %float_1 %1151 + %1153 = OpCompositeConstruct %v3float %1152 %1152 %1152 + %1154 = OpFMul %v3float %1146 %1153 + %1155 = OpFAdd %v3float %1144 %1154 + %1156 = OpFMul %v3float %1141 %1155 + %1157 = OpExtInst %v3float %1 FMax %132 %1156 + %1158 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_5 + %1159 = OpLoad %v4float %1158 + %1160 = OpVectorShuffle %v3float %1159 %1159 0 0 0 + %1161 = OpFSub %v3float %1160 %1157 + %1162 = OpExtInst %v3float %1 FMax %132 %1161 + %1163 = OpVectorShuffle %v3float %1159 %1159 2 2 2 + %1164 = OpExtInst %v3float %1 FMax %1157 %1163 + %1165 = OpExtInst %v3float %1 FClamp %1157 %1160 %1163 + %1166 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_6 + %1167 = OpLoad %v4float %1166 + %1168 = OpVectorShuffle %v3float %1167 %1167 0 0 0 + %1169 = OpFMul %v3float %1164 %1168 + %1170 = OpVectorShuffle %v3float %1167 %1167 1 1 1 + %1171 = OpFAdd %v3float %1169 %1170 + %1172 = OpVectorShuffle %v3float %1159 %1159 3 3 3 + %1173 = OpFAdd %v3float %1164 %1172 + %1174 = OpFDiv %v3float %135 %1173 + %1175 = OpFMul %v3float %1171 %1174 + %1176 = OpVectorShuffle %v3float %1138 %1138 3 3 3 + %1177 = OpFMul %v3float %1165 %1176 + %1178 = OpVectorShuffle %v3float %1128 %1128 3 3 3 + %1179 = OpFMul %v3float %1162 %1178 + %1180 = OpVectorShuffle %v3float %1159 %1159 1 1 1 + %1181 = OpFAdd %v3float %1162 %1180 + %1182 = OpFDiv %v3float %135 %1181 + %1183 = OpFMul %v3float %1179 %1182 + %1184 = OpVectorShuffle %v3float %1133 %1133 3 3 3 + %1185 = OpFAdd %v3float %1183 %1184 + %1186 = OpFAdd %v3float %1177 %1185 + %1187 = OpFAdd %v3float %1175 %1186 + %1188 = OpFSub %v3float %1187 %248 + OpBranch %1125 + %1125 = OpLabel + %1189 = OpPhi %v3float %1123 %1031 %1188 %1126 + %1190 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_0 + %1191 = OpLoad %float %1190 + %1192 = OpCompositeConstruct %v3float %1191 %1191 %1191 + %1193 = OpFMul %v3float %1189 %1189 + %1194 = OpFMul %v3float %1192 %1193 + %1195 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_1 + %1196 = OpLoad %float %1195 + %1197 = OpCompositeConstruct %v3float %1196 %1196 %1196 + %1198 = OpFMul %v3float %1197 %1189 + %1199 = OpFAdd %v3float %1194 %1198 + %1200 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %1201 = OpLoad %float %1200 + %1202 = OpCompositeConstruct %v3float %1201 %1201 %1201 + %1203 = OpFAdd %v3float %1199 %1202 + %1204 = OpAccessChain %_ptr_Uniform_v3float %_Globals %int_15 + %1205 = OpLoad %v3float %1204 + %1206 = OpFMul %v3float %1203 %1205 + %1207 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_16 + %1208 = OpLoad %v4float %1207 + %1209 = OpVectorShuffle %v3float %1208 %1208 0 1 2 + %1210 = OpAccessChain %_ptr_Uniform_float %_Globals %int_16 %int_3 + %1211 = OpLoad %float %1210 + %1212 = OpCompositeConstruct %v3float %1211 %1211 %1211 + %1213 = OpExtInst %v3float %1 FMix %1206 %1209 %1212 + %1214 = OpExtInst %v3float %1 FMax %132 %1213 + %1215 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %int_1 + %1216 = OpLoad %float %1215 + %1217 = OpCompositeConstruct %v3float %1216 %1216 %1216 + %1218 = OpExtInst %v3float %1 Pow %1214 %1217 + %1219 = OpIEqual %bool %579 %uint_0 + OpSelectionMerge %1220 DontFlatten + OpBranchConditional %1219 %1221 %1222 + %1222 = OpLabel + %1223 = OpIEqual %bool %579 %uint_1 + OpSelectionMerge %1224 None + OpBranchConditional %1223 %1225 %1226 + %1226 = OpLabel + %1227 = OpIEqual %bool %579 %uint_3 + %1228 = OpIEqual %bool %579 %uint_5 + %1229 = OpLogicalOr %bool %1227 %1228 + OpSelectionMerge %1230 None + OpBranchConditional %1229 %1231 %1232 + %1232 = OpLabel + %1233 = OpIEqual %bool %579 %uint_4 + %1234 = OpIEqual %bool %579 %uint_6 + %1235 = OpLogicalOr %bool %1233 %1234 + OpSelectionMerge %1236 None + OpBranchConditional %1235 %1237 %1238 + %1238 = OpLabel + %1239 = OpIEqual %bool %579 %uint_7 + OpSelectionMerge %1240 None + OpBranchConditional %1239 %1241 %1242 + %1242 = OpLabel + %1243 = OpVectorTimesMatrix %v3float %1218 %547 + %1244 = OpVectorTimesMatrix %v3float %1243 %576 + %1245 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %int_2 + %1246 = OpLoad %float %1245 + %1247 = OpCompositeConstruct %v3float %1246 %1246 %1246 + %1248 = OpExtInst %v3float %1 Pow %1244 %1247 + OpBranch %1240 + %1241 = OpLabel + %1249 = OpVectorTimesMatrix %v3float %906 %547 + %1250 = OpVectorTimesMatrix %v3float %1249 %576 + %1251 = OpFMul %v3float %1250 %496 + %1252 = OpExtInst %v3float %1 Pow %1251 %263 + %1253 = OpFMul %v3float %184 %1252 + %1254 = OpFAdd %v3float %183 %1253 + %1255 = OpFMul %v3float %185 %1252 + %1256 = OpFAdd %v3float %135 %1255 + %1257 = OpFDiv %v3float %135 %1256 + %1258 = OpFMul %v3float %1254 %1257 + %1259 = OpExtInst %v3float %1 Pow %1258 %264 + OpBranch %1240 + %1240 = OpLabel + %1260 = OpPhi %v3float %1248 %1242 %1259 %1241 + OpBranch %1236 + %1237 = OpLabel + %1261 = OpMatrixTimesMatrix %mat3v3float %546 %399 + %1262 = OpFMul %v3float %906 %262 + %1263 = OpVectorTimesMatrix %v3float %1262 %1261 + %1264 = OpCompositeExtract %float %1263 0 + %1265 = OpCompositeExtract %float %1263 1 + %1266 = OpExtInst %float %1 FMin %1264 %1265 + %1267 = OpCompositeExtract %float %1263 2 + %1268 = OpExtInst %float %1 FMin %1266 %1267 + %1269 = OpExtInst %float %1 FMax %1264 %1265 + %1270 = OpExtInst %float %1 FMax %1269 %1267 + %1271 = OpExtInst %float %1 FMax %1270 %float_1_00000001en10 + %1272 = OpExtInst %float %1 FMax %1268 %float_1_00000001en10 + %1273 = OpFSub %float %1271 %1272 + %1274 = OpExtInst %float %1 FMax %1270 %float_0_00999999978 + %1275 = OpFDiv %float %1273 %1274 + %1276 = OpFSub %float %1267 %1265 + %1277 = OpFMul %float %1267 %1276 + %1278 = OpFSub %float %1265 %1264 + %1279 = OpFMul %float %1265 %1278 + %1280 = OpFAdd %float %1277 %1279 + %1281 = OpFSub %float %1264 %1267 + %1282 = OpFMul %float %1264 %1281 + %1283 = OpFAdd %float %1280 %1282 + %1284 = OpExtInst %float %1 Sqrt %1283 + %1285 = OpFAdd %float %1267 %1265 + %1286 = OpFAdd %float %1285 %1264 + %1287 = OpFMul %float %float_1_75 %1284 + %1288 = OpFAdd %float %1286 %1287 + %1289 = OpFMul %float %1288 %float_0_333333343 + %1290 = OpFSub %float %1275 %float_0_400000006 + %1291 = OpFMul %float %1290 %float_5 + %1292 = OpFMul %float %1290 %float_2_5 + %1293 = OpExtInst %float %1 FAbs %1292 + %1294 = OpFSub %float %float_1 %1293 + %1295 = OpExtInst %float %1 FMax %1294 %float_0 + %1296 = OpExtInst %float %1 FSign %1291 + %1297 = OpConvertFToS %int %1296 + %1298 = OpConvertSToF %float %1297 + %1299 = OpFMul %float %1295 %1295 + %1300 = OpFSub %float %float_1 %1299 + %1301 = OpFMul %float %1298 %1300 + %1302 = OpFAdd %float %float_1 %1301 + %1303 = OpFMul %float %1302 %float_0_0250000004 + %1304 = OpFOrdLessThanEqual %bool %1289 %float_0_0533333346 + OpSelectionMerge %1305 None + OpBranchConditional %1304 %1306 %1307 + %1307 = OpLabel + %1308 = OpFOrdGreaterThanEqual %bool %1289 %float_0_159999996 + OpSelectionMerge %1309 None + OpBranchConditional %1308 %1310 %1311 + %1311 = OpLabel + %1312 = OpFDiv %float %float_0_239999995 %1288 + %1313 = OpFSub %float %1312 %float_0_5 + %1314 = OpFMul %float %1303 %1313 + OpBranch %1309 + %1310 = OpLabel + OpBranch %1309 + %1309 = OpLabel + %1315 = OpPhi %float %1314 %1311 %float_0 %1310 + OpBranch %1305 + %1306 = OpLabel + OpBranch %1305 + %1305 = OpLabel + %1316 = OpPhi %float %1315 %1309 %1303 %1306 + %1317 = OpFAdd %float %float_1 %1316 + %1318 = OpCompositeConstruct %v3float %1317 %1317 %1317 + %1319 = OpFMul %v3float %1263 %1318 + %1320 = OpCompositeExtract %float %1319 0 + %1321 = OpCompositeExtract %float %1319 1 + %1322 = OpFOrdEqual %bool %1320 %1321 + %1323 = OpCompositeExtract %float %1319 2 + %1324 = OpFOrdEqual %bool %1321 %1323 + %1325 = OpLogicalAnd %bool %1322 %1324 + OpSelectionMerge %1326 None + OpBranchConditional %1325 %1327 %1328 + %1328 = OpLabel + %1329 = OpExtInst %float %1 Sqrt %float_3 + %1330 = OpFSub %float %1321 %1323 + %1331 = OpFMul %float %1329 %1330 + %1332 = OpFMul %float %float_2 %1320 + %1333 = OpFSub %float %1332 %1321 + %1334 = OpFSub %float %1333 %1323 + %1335 = OpExtInst %float %1 Atan2 %1331 %1334 + %1336 = OpFMul %float %float_57_2957764 %1335 + OpBranch %1326 + %1327 = OpLabel + OpBranch %1326 + %1326 = OpLabel + %1337 = OpPhi %float %1336 %1328 %float_0 %1327 + %1338 = OpFOrdLessThan %bool %1337 %float_0 + OpSelectionMerge %1339 None + OpBranchConditional %1338 %1340 %1339 + %1340 = OpLabel + %1341 = OpFAdd %float %1337 %float_360 + OpBranch %1339 + %1339 = OpLabel + %1342 = OpPhi %float %1337 %1326 %1341 %1340 + %1343 = OpExtInst %float %1 FClamp %1342 %float_0 %float_360 + %1344 = OpFOrdGreaterThan %bool %1343 %float_180 + OpSelectionMerge %1345 None + OpBranchConditional %1344 %1346 %1345 + %1346 = OpLabel + %1347 = OpFSub %float %1343 %float_360 + OpBranch %1345 + %1345 = OpLabel + %1348 = OpPhi %float %1343 %1339 %1347 %1346 + %1349 = OpFOrdGreaterThan %bool %1348 %float_n67_5 + %1350 = OpFOrdLessThan %bool %1348 %float_67_5 + %1351 = OpLogicalAnd %bool %1349 %1350 + OpSelectionMerge %1352 None + OpBranchConditional %1351 %1353 %1352 + %1353 = OpLabel + %1354 = OpFSub %float %1348 %float_n67_5 + %1355 = OpFMul %float %1354 %float_0_0296296291 + %1356 = OpConvertFToS %int %1355 + %1357 = OpConvertSToF %float %1356 + %1358 = OpFSub %float %1355 %1357 + %1359 = OpFMul %float %1358 %1358 + %1360 = OpFMul %float %1359 %1358 + %1361 = OpIEqual %bool %1356 %int_3 + OpSelectionMerge %1362 None + OpBranchConditional %1361 %1363 %1364 + %1364 = OpLabel + %1365 = OpIEqual %bool %1356 %int_2 + OpSelectionMerge %1366 None + OpBranchConditional %1365 %1367 %1368 + %1368 = OpLabel + %1369 = OpIEqual %bool %1356 %int_1 + OpSelectionMerge %1370 None + OpBranchConditional %1369 %1371 %1372 + %1372 = OpLabel + %1373 = OpIEqual %bool %1356 %int_0 + OpSelectionMerge %1374 None + OpBranchConditional %1373 %1375 %1376 + %1376 = OpLabel + OpBranch %1374 + %1375 = OpLabel + %1377 = OpFMul %float %1360 %float_0_166666672 + OpBranch %1374 + %1374 = OpLabel + %1378 = OpPhi %float %float_0 %1376 %1377 %1375 + OpBranch %1370 + %1371 = OpLabel + %1379 = OpFMul %float %1360 %float_n0_5 + %1380 = OpFMul %float %1359 %float_0_5 + %1381 = OpFAdd %float %1379 %1380 + %1382 = OpFMul %float %1358 %float_0_5 + %1383 = OpFAdd %float %1381 %1382 + %1384 = OpFAdd %float %1383 %float_0_166666672 + OpBranch %1370 + %1370 = OpLabel + %1385 = OpPhi %float %1378 %1374 %1384 %1371 + OpBranch %1366 + %1367 = OpLabel + %1386 = OpFMul %float %1360 %float_0_5 + %1387 = OpFMul %float %1359 %float_n1 + %1388 = OpFAdd %float %1386 %1387 + %1389 = OpFAdd %float %1388 %float_0_666666687 + OpBranch %1366 + %1366 = OpLabel + %1390 = OpPhi %float %1385 %1370 %1389 %1367 + OpBranch %1362 + %1363 = OpLabel + %1391 = OpFMul %float %1360 %float_n0_166666672 + %1392 = OpFMul %float %1359 %float_0_5 + %1393 = OpFAdd %float %1391 %1392 + %1394 = OpFMul %float %1358 %float_n0_5 + %1395 = OpFAdd %float %1393 %1394 + %1396 = OpFAdd %float %1395 %float_0_166666672 + OpBranch %1362 + %1362 = OpLabel + %1397 = OpPhi %float %1390 %1366 %1396 %1363 + OpBranch %1352 + %1352 = OpLabel + %1398 = OpPhi %float %float_0 %1345 %1397 %1362 + %1399 = OpFMul %float %1398 %float_1_5 + %1400 = OpFMul %float %1399 %1275 + %1401 = OpFSub %float %float_0_0299999993 %1320 + %1402 = OpFMul %float %1400 %1401 + %1403 = OpFMul %float %1402 %float_0_180000007 + %1404 = OpFAdd %float %1320 %1403 + %1405 = OpCompositeInsert %v3float %1404 %1319 0 + %1406 = OpExtInst %v3float %1 FClamp %1405 %132 %314 + %1407 = OpVectorTimesMatrix %v3float %1406 %410 + %1408 = OpExtInst %v3float %1 FClamp %1407 %132 %314 + %1409 = OpDot %float %1408 %67 + %1410 = OpCompositeConstruct %v3float %1409 %1409 %1409 + %1411 = OpExtInst %v3float %1 FMix %1410 %1408 %228 + %1412 = OpCompositeExtract %float %1411 0 + %1413 = OpExtInst %float %1 Exp2 %float_n15 + %1414 = OpFMul %float %float_0_179999992 %1413 + %1415 = OpExtInst %float %1 Exp2 %float_18 + %1416 = OpFMul %float %float_0_179999992 %1415 + OpStore %502 %475 + OpStore %501 %476 + %1417 = OpFOrdLessThanEqual %bool %1412 %float_0 + %1418 = OpExtInst %float %1 Exp2 %float_n14 + %1419 = OpSelect %float %1417 %1418 %1412 + %1420 = OpExtInst %float %1 Log %1419 + %1421 = OpFDiv %float %1420 %1065 + %1422 = OpExtInst %float %1 Log %1414 + %1423 = OpFDiv %float %1422 %1065 + %1424 = OpFOrdLessThanEqual %bool %1421 %1423 + OpSelectionMerge %1425 None + OpBranchConditional %1424 %1426 %1427 + %1427 = OpLabel + %1428 = OpFOrdGreaterThan %bool %1421 %1423 + %1429 = OpExtInst %float %1 Log %float_0_180000007 + %1430 = OpFDiv %float %1429 %1065 + %1431 = OpFOrdLessThan %bool %1421 %1430 + %1432 = OpLogicalAnd %bool %1428 %1431 + OpSelectionMerge %1433 None + OpBranchConditional %1432 %1434 %1435 + %1435 = OpLabel + %1436 = OpFOrdGreaterThanEqual %bool %1421 %1430 + %1437 = OpExtInst %float %1 Log %1416 + %1438 = OpFDiv %float %1437 %1065 + %1439 = OpFOrdLessThan %bool %1421 %1438 + %1440 = OpLogicalAnd %bool %1436 %1439 + OpSelectionMerge %1441 None + OpBranchConditional %1440 %1442 %1443 + %1443 = OpLabel + %1444 = OpExtInst %float %1 Log %float_10000 + %1445 = OpFDiv %float %1444 %1065 + OpBranch %1441 + %1442 = OpLabel + %1446 = OpFSub %float %1421 %1430 + %1447 = OpFMul %float %float_3 %1446 + %1448 = OpFSub %float %1438 %1430 + %1449 = OpFDiv %float %1447 %1448 + %1450 = OpConvertFToS %int %1449 + %1451 = OpConvertSToF %float %1450 + %1452 = OpFSub %float %1449 %1451 + %1453 = OpAccessChain %_ptr_Function_float %501 %1450 + %1454 = OpLoad %float %1453 + %1455 = OpIAdd %int %1450 %int_1 + %1456 = OpAccessChain %_ptr_Function_float %501 %1455 + %1457 = OpLoad %float %1456 + %1458 = OpIAdd %int %1450 %int_2 + %1459 = OpAccessChain %_ptr_Function_float %501 %1458 + %1460 = OpLoad %float %1459 + %1461 = OpCompositeConstruct %v3float %1454 %1457 %1460 + %1462 = OpFMul %float %1452 %1452 + %1463 = OpCompositeConstruct %v3float %1462 %1452 %float_1 + %1464 = OpMatrixTimesVector %v3float %442 %1461 + %1465 = OpDot %float %1463 %1464 + OpBranch %1441 + %1441 = OpLabel + %1466 = OpPhi %float %1445 %1443 %1465 %1442 + OpBranch %1433 + %1434 = OpLabel + %1467 = OpFSub %float %1421 %1423 + %1468 = OpFMul %float %float_3 %1467 + %1469 = OpFSub %float %1430 %1423 + %1470 = OpFDiv %float %1468 %1469 + %1471 = OpConvertFToS %int %1470 + %1472 = OpConvertSToF %float %1471 + %1473 = OpFSub %float %1470 %1472 + %1474 = OpAccessChain %_ptr_Function_float %502 %1471 + %1475 = OpLoad %float %1474 + %1476 = OpIAdd %int %1471 %int_1 + %1477 = OpAccessChain %_ptr_Function_float %502 %1476 + %1478 = OpLoad %float %1477 + %1479 = OpIAdd %int %1471 %int_2 + %1480 = OpAccessChain %_ptr_Function_float %502 %1479 + %1481 = OpLoad %float %1480 + %1482 = OpCompositeConstruct %v3float %1475 %1478 %1481 + %1483 = OpFMul %float %1473 %1473 + %1484 = OpCompositeConstruct %v3float %1483 %1473 %float_1 + %1485 = OpMatrixTimesVector %v3float %442 %1482 + %1486 = OpDot %float %1484 %1485 + OpBranch %1433 + %1433 = OpLabel + %1487 = OpPhi %float %1466 %1441 %1486 %1434 + OpBranch %1425 + %1426 = OpLabel + %1488 = OpExtInst %float %1 Log %float_9_99999975en05 + %1489 = OpFDiv %float %1488 %1065 + OpBranch %1425 + %1425 = OpLabel + %1490 = OpPhi %float %1487 %1433 %1489 %1426 + %1491 = OpExtInst %float %1 Pow %float_10 %1490 + %1492 = OpCompositeInsert %v3float %1491 %391 0 + %1493 = OpCompositeExtract %float %1411 1 + OpStore %504 %475 + OpStore %503 %476 + %1494 = OpFOrdLessThanEqual %bool %1493 %float_0 + %1495 = OpSelect %float %1494 %1418 %1493 + %1496 = OpExtInst %float %1 Log %1495 + %1497 = OpFDiv %float %1496 %1065 + %1498 = OpFOrdLessThanEqual %bool %1497 %1423 + OpSelectionMerge %1499 None + OpBranchConditional %1498 %1500 %1501 + %1501 = OpLabel + %1502 = OpFOrdGreaterThan %bool %1497 %1423 + %1503 = OpExtInst %float %1 Log %float_0_180000007 + %1504 = OpFDiv %float %1503 %1065 + %1505 = OpFOrdLessThan %bool %1497 %1504 + %1506 = OpLogicalAnd %bool %1502 %1505 + OpSelectionMerge %1507 None + OpBranchConditional %1506 %1508 %1509 + %1509 = OpLabel + %1510 = OpFOrdGreaterThanEqual %bool %1497 %1504 + %1511 = OpExtInst %float %1 Log %1416 + %1512 = OpFDiv %float %1511 %1065 + %1513 = OpFOrdLessThan %bool %1497 %1512 + %1514 = OpLogicalAnd %bool %1510 %1513 + OpSelectionMerge %1515 None + OpBranchConditional %1514 %1516 %1517 + %1517 = OpLabel + %1518 = OpExtInst %float %1 Log %float_10000 + %1519 = OpFDiv %float %1518 %1065 + OpBranch %1515 + %1516 = OpLabel + %1520 = OpFSub %float %1497 %1504 + %1521 = OpFMul %float %float_3 %1520 + %1522 = OpFSub %float %1512 %1504 + %1523 = OpFDiv %float %1521 %1522 + %1524 = OpConvertFToS %int %1523 + %1525 = OpConvertSToF %float %1524 + %1526 = OpFSub %float %1523 %1525 + %1527 = OpAccessChain %_ptr_Function_float %503 %1524 + %1528 = OpLoad %float %1527 + %1529 = OpIAdd %int %1524 %int_1 + %1530 = OpAccessChain %_ptr_Function_float %503 %1529 + %1531 = OpLoad %float %1530 + %1532 = OpIAdd %int %1524 %int_2 + %1533 = OpAccessChain %_ptr_Function_float %503 %1532 + %1534 = OpLoad %float %1533 + %1535 = OpCompositeConstruct %v3float %1528 %1531 %1534 + %1536 = OpFMul %float %1526 %1526 + %1537 = OpCompositeConstruct %v3float %1536 %1526 %float_1 + %1538 = OpMatrixTimesVector %v3float %442 %1535 + %1539 = OpDot %float %1537 %1538 + OpBranch %1515 + %1515 = OpLabel + %1540 = OpPhi %float %1519 %1517 %1539 %1516 + OpBranch %1507 + %1508 = OpLabel + %1541 = OpFSub %float %1497 %1423 + %1542 = OpFMul %float %float_3 %1541 + %1543 = OpFSub %float %1504 %1423 + %1544 = OpFDiv %float %1542 %1543 + %1545 = OpConvertFToS %int %1544 + %1546 = OpConvertSToF %float %1545 + %1547 = OpFSub %float %1544 %1546 + %1548 = OpAccessChain %_ptr_Function_float %504 %1545 + %1549 = OpLoad %float %1548 + %1550 = OpIAdd %int %1545 %int_1 + %1551 = OpAccessChain %_ptr_Function_float %504 %1550 + %1552 = OpLoad %float %1551 + %1553 = OpIAdd %int %1545 %int_2 + %1554 = OpAccessChain %_ptr_Function_float %504 %1553 + %1555 = OpLoad %float %1554 + %1556 = OpCompositeConstruct %v3float %1549 %1552 %1555 + %1557 = OpFMul %float %1547 %1547 + %1558 = OpCompositeConstruct %v3float %1557 %1547 %float_1 + %1559 = OpMatrixTimesVector %v3float %442 %1556 + %1560 = OpDot %float %1558 %1559 + OpBranch %1507 + %1507 = OpLabel + %1561 = OpPhi %float %1540 %1515 %1560 %1508 + OpBranch %1499 + %1500 = OpLabel + %1562 = OpExtInst %float %1 Log %float_9_99999975en05 + %1563 = OpFDiv %float %1562 %1065 + OpBranch %1499 + %1499 = OpLabel + %1564 = OpPhi %float %1561 %1507 %1563 %1500 + %1565 = OpExtInst %float %1 Pow %float_10 %1564 + %1566 = OpCompositeInsert %v3float %1565 %1492 1 + %1567 = OpCompositeExtract %float %1411 2 + OpStore %506 %475 + OpStore %505 %476 + %1568 = OpFOrdLessThanEqual %bool %1567 %float_0 + %1569 = OpSelect %float %1568 %1418 %1567 + %1570 = OpExtInst %float %1 Log %1569 + %1571 = OpFDiv %float %1570 %1065 + %1572 = OpFOrdLessThanEqual %bool %1571 %1423 + OpSelectionMerge %1573 None + OpBranchConditional %1572 %1574 %1575 + %1575 = OpLabel + %1576 = OpFOrdGreaterThan %bool %1571 %1423 + %1577 = OpExtInst %float %1 Log %float_0_180000007 + %1578 = OpFDiv %float %1577 %1065 + %1579 = OpFOrdLessThan %bool %1571 %1578 + %1580 = OpLogicalAnd %bool %1576 %1579 + OpSelectionMerge %1581 None + OpBranchConditional %1580 %1582 %1583 + %1583 = OpLabel + %1584 = OpFOrdGreaterThanEqual %bool %1571 %1578 + %1585 = OpExtInst %float %1 Log %1416 + %1586 = OpFDiv %float %1585 %1065 + %1587 = OpFOrdLessThan %bool %1571 %1586 + %1588 = OpLogicalAnd %bool %1584 %1587 + OpSelectionMerge %1589 None + OpBranchConditional %1588 %1590 %1591 + %1591 = OpLabel + %1592 = OpExtInst %float %1 Log %float_10000 + %1593 = OpFDiv %float %1592 %1065 + OpBranch %1589 + %1590 = OpLabel + %1594 = OpFSub %float %1571 %1578 + %1595 = OpFMul %float %float_3 %1594 + %1596 = OpFSub %float %1586 %1578 + %1597 = OpFDiv %float %1595 %1596 + %1598 = OpConvertFToS %int %1597 + %1599 = OpConvertSToF %float %1598 + %1600 = OpFSub %float %1597 %1599 + %1601 = OpAccessChain %_ptr_Function_float %505 %1598 + %1602 = OpLoad %float %1601 + %1603 = OpIAdd %int %1598 %int_1 + %1604 = OpAccessChain %_ptr_Function_float %505 %1603 + %1605 = OpLoad %float %1604 + %1606 = OpIAdd %int %1598 %int_2 + %1607 = OpAccessChain %_ptr_Function_float %505 %1606 + %1608 = OpLoad %float %1607 + %1609 = OpCompositeConstruct %v3float %1602 %1605 %1608 + %1610 = OpFMul %float %1600 %1600 + %1611 = OpCompositeConstruct %v3float %1610 %1600 %float_1 + %1612 = OpMatrixTimesVector %v3float %442 %1609 + %1613 = OpDot %float %1611 %1612 + OpBranch %1589 + %1589 = OpLabel + %1614 = OpPhi %float %1593 %1591 %1613 %1590 + OpBranch %1581 + %1582 = OpLabel + %1615 = OpFSub %float %1571 %1423 + %1616 = OpFMul %float %float_3 %1615 + %1617 = OpFSub %float %1578 %1423 + %1618 = OpFDiv %float %1616 %1617 + %1619 = OpConvertFToS %int %1618 + %1620 = OpConvertSToF %float %1619 + %1621 = OpFSub %float %1618 %1620 + %1622 = OpAccessChain %_ptr_Function_float %506 %1619 + %1623 = OpLoad %float %1622 + %1624 = OpIAdd %int %1619 %int_1 + %1625 = OpAccessChain %_ptr_Function_float %506 %1624 + %1626 = OpLoad %float %1625 + %1627 = OpIAdd %int %1619 %int_2 + %1628 = OpAccessChain %_ptr_Function_float %506 %1627 + %1629 = OpLoad %float %1628 + %1630 = OpCompositeConstruct %v3float %1623 %1626 %1629 + %1631 = OpFMul %float %1621 %1621 + %1632 = OpCompositeConstruct %v3float %1631 %1621 %float_1 + %1633 = OpMatrixTimesVector %v3float %442 %1630 + %1634 = OpDot %float %1632 %1633 + OpBranch %1581 + %1581 = OpLabel + %1635 = OpPhi %float %1614 %1589 %1634 %1582 + OpBranch %1573 + %1574 = OpLabel + %1636 = OpExtInst %float %1 Log %float_9_99999975en05 + %1637 = OpFDiv %float %1636 %1065 + OpBranch %1573 + %1573 = OpLabel + %1638 = OpPhi %float %1635 %1581 %1637 %1574 + %1639 = OpExtInst %float %1 Pow %float_10 %1638 + %1640 = OpCompositeInsert %v3float %1639 %1566 2 + %1641 = OpVectorTimesMatrix %v3float %1640 %414 + %1642 = OpVectorTimesMatrix %v3float %1641 %410 + %1643 = OpExtInst %float %1 Pow %float_2 %float_n12 + %1644 = OpFMul %float %float_0_179999992 %1643 + OpStore %514 %475 + OpStore %513 %476 + %1645 = OpFOrdLessThanEqual %bool %1644 %float_0 + %1646 = OpSelect %float %1645 %1418 %1644 + %1647 = OpExtInst %float %1 Log %1646 + %1648 = OpFDiv %float %1647 %1065 + %1649 = OpFOrdLessThanEqual %bool %1648 %1423 + OpSelectionMerge %1650 None + OpBranchConditional %1649 %1651 %1652 + %1652 = OpLabel + %1653 = OpFOrdGreaterThan %bool %1648 %1423 + %1654 = OpExtInst %float %1 Log %float_0_180000007 + %1655 = OpFDiv %float %1654 %1065 + %1656 = OpFOrdLessThan %bool %1648 %1655 + %1657 = OpLogicalAnd %bool %1653 %1656 + OpSelectionMerge %1658 None + OpBranchConditional %1657 %1659 %1660 + %1660 = OpLabel + %1661 = OpFOrdGreaterThanEqual %bool %1648 %1655 + %1662 = OpExtInst %float %1 Log %1416 + %1663 = OpFDiv %float %1662 %1065 + %1664 = OpFOrdLessThan %bool %1648 %1663 + %1665 = OpLogicalAnd %bool %1661 %1664 + OpSelectionMerge %1666 None + OpBranchConditional %1665 %1667 %1668 + %1668 = OpLabel + %1669 = OpExtInst %float %1 Log %float_10000 + %1670 = OpFDiv %float %1669 %1065 + OpBranch %1666 + %1667 = OpLabel + %1671 = OpFSub %float %1648 %1655 + %1672 = OpFMul %float %float_3 %1671 + %1673 = OpFSub %float %1663 %1655 + %1674 = OpFDiv %float %1672 %1673 + %1675 = OpConvertFToS %int %1674 + %1676 = OpConvertSToF %float %1675 + %1677 = OpFSub %float %1674 %1676 + %1678 = OpAccessChain %_ptr_Function_float %513 %1675 + %1679 = OpLoad %float %1678 + %1680 = OpIAdd %int %1675 %int_1 + %1681 = OpAccessChain %_ptr_Function_float %513 %1680 + %1682 = OpLoad %float %1681 + %1683 = OpIAdd %int %1675 %int_2 + %1684 = OpAccessChain %_ptr_Function_float %513 %1683 + %1685 = OpLoad %float %1684 + %1686 = OpCompositeConstruct %v3float %1679 %1682 %1685 + %1687 = OpFMul %float %1677 %1677 + %1688 = OpCompositeConstruct %v3float %1687 %1677 %float_1 + %1689 = OpMatrixTimesVector %v3float %442 %1686 + %1690 = OpDot %float %1688 %1689 + OpBranch %1666 + %1666 = OpLabel + %1691 = OpPhi %float %1670 %1668 %1690 %1667 + OpBranch %1658 + %1659 = OpLabel + %1692 = OpFSub %float %1648 %1423 + %1693 = OpFMul %float %float_3 %1692 + %1694 = OpFSub %float %1655 %1423 + %1695 = OpFDiv %float %1693 %1694 + %1696 = OpConvertFToS %int %1695 + %1697 = OpConvertSToF %float %1696 + %1698 = OpFSub %float %1695 %1697 + %1699 = OpAccessChain %_ptr_Function_float %514 %1696 + %1700 = OpLoad %float %1699 + %1701 = OpIAdd %int %1696 %int_1 + %1702 = OpAccessChain %_ptr_Function_float %514 %1701 + %1703 = OpLoad %float %1702 + %1704 = OpIAdd %int %1696 %int_2 + %1705 = OpAccessChain %_ptr_Function_float %514 %1704 + %1706 = OpLoad %float %1705 + %1707 = OpCompositeConstruct %v3float %1700 %1703 %1706 + %1708 = OpFMul %float %1698 %1698 + %1709 = OpCompositeConstruct %v3float %1708 %1698 %float_1 + %1710 = OpMatrixTimesVector %v3float %442 %1707 + %1711 = OpDot %float %1709 %1710 + OpBranch %1658 + %1658 = OpLabel + %1712 = OpPhi %float %1691 %1666 %1711 %1659 + OpBranch %1650 + %1651 = OpLabel + %1713 = OpExtInst %float %1 Log %float_9_99999975en05 + %1714 = OpFDiv %float %1713 %1065 + OpBranch %1650 + %1650 = OpLabel + %1715 = OpPhi %float %1712 %1658 %1714 %1651 + %1716 = OpExtInst %float %1 Pow %float_10 %1715 + OpStore %516 %475 + OpStore %515 %476 + %1717 = OpExtInst %float %1 Log %float_0_180000007 + %1718 = OpFDiv %float %1717 %1065 + %1719 = OpFOrdLessThanEqual %bool %1718 %1423 + OpSelectionMerge %1720 None + OpBranchConditional %1719 %1721 %1722 + %1722 = OpLabel + %1723 = OpFOrdGreaterThan %bool %1718 %1423 + %1724 = OpFOrdLessThan %bool %1718 %1718 + %1725 = OpLogicalAnd %bool %1723 %1724 + OpSelectionMerge %1726 None + OpBranchConditional %1725 %1727 %1728 + %1728 = OpLabel + %1729 = OpFOrdGreaterThanEqual %bool %1718 %1718 + %1730 = OpExtInst %float %1 Log %1416 + %1731 = OpFDiv %float %1730 %1065 + %1732 = OpFOrdLessThan %bool %1718 %1731 + %1733 = OpLogicalAnd %bool %1729 %1732 + OpSelectionMerge %1734 None + OpBranchConditional %1733 %1735 %1736 + %1736 = OpLabel + %1737 = OpExtInst %float %1 Log %float_10000 + %1738 = OpFDiv %float %1737 %1065 + OpBranch %1734 + %1735 = OpLabel + %1739 = OpFSub %float %1718 %1718 + %1740 = OpFMul %float %float_3 %1739 + %1741 = OpFSub %float %1731 %1718 + %1742 = OpFDiv %float %1740 %1741 + %1743 = OpConvertFToS %int %1742 + %1744 = OpConvertSToF %float %1743 + %1745 = OpFSub %float %1742 %1744 + %1746 = OpAccessChain %_ptr_Function_float %515 %1743 + %1747 = OpLoad %float %1746 + %1748 = OpIAdd %int %1743 %int_1 + %1749 = OpAccessChain %_ptr_Function_float %515 %1748 + %1750 = OpLoad %float %1749 + %1751 = OpIAdd %int %1743 %int_2 + %1752 = OpAccessChain %_ptr_Function_float %515 %1751 + %1753 = OpLoad %float %1752 + %1754 = OpCompositeConstruct %v3float %1747 %1750 %1753 + %1755 = OpFMul %float %1745 %1745 + %1756 = OpCompositeConstruct %v3float %1755 %1745 %float_1 + %1757 = OpMatrixTimesVector %v3float %442 %1754 + %1758 = OpDot %float %1756 %1757 + OpBranch %1734 + %1734 = OpLabel + %1759 = OpPhi %float %1738 %1736 %1758 %1735 + OpBranch %1726 + %1727 = OpLabel + %1760 = OpFSub %float %1718 %1423 + %1761 = OpFMul %float %float_3 %1760 + %1762 = OpAccessChain %_ptr_Function_float %516 %int_3 + %1763 = OpLoad %float %1762 + %1764 = OpAccessChain %_ptr_Function_float %516 %int_4 + %1765 = OpLoad %float %1764 + %1766 = OpAccessChain %_ptr_Function_float %516 %int_5 + %1767 = OpLoad %float %1766 + %1768 = OpCompositeConstruct %v3float %1763 %1765 %1767 + %1769 = OpMatrixTimesVector %v3float %442 %1768 + %1770 = OpCompositeExtract %float %1769 2 + OpBranch %1726 + %1726 = OpLabel + %1771 = OpPhi %float %1759 %1734 %1770 %1727 + OpBranch %1720 + %1721 = OpLabel + %1772 = OpExtInst %float %1 Log %float_9_99999975en05 + %1773 = OpFDiv %float %1772 %1065 + OpBranch %1720 + %1720 = OpLabel + %1774 = OpPhi %float %1771 %1726 %1773 %1721 + %1775 = OpExtInst %float %1 Pow %float_10 %1774 + %1776 = OpExtInst %float %1 Pow %float_2 %float_11 + %1777 = OpFMul %float %float_0_179999992 %1776 + OpStore %518 %475 + OpStore %517 %476 + %1778 = OpFOrdLessThanEqual %bool %1777 %float_0 + %1779 = OpSelect %float %1778 %1418 %1777 + %1780 = OpExtInst %float %1 Log %1779 + %1781 = OpFDiv %float %1780 %1065 + %1782 = OpFOrdLessThanEqual %bool %1781 %1423 + OpSelectionMerge %1783 None + OpBranchConditional %1782 %1784 %1785 + %1785 = OpLabel + %1786 = OpFOrdGreaterThan %bool %1781 %1423 + %1787 = OpFOrdLessThan %bool %1781 %1718 + %1788 = OpLogicalAnd %bool %1786 %1787 + OpSelectionMerge %1789 None + OpBranchConditional %1788 %1790 %1791 + %1791 = OpLabel + %1792 = OpFOrdGreaterThanEqual %bool %1781 %1718 + %1793 = OpExtInst %float %1 Log %1416 + %1794 = OpFDiv %float %1793 %1065 + %1795 = OpFOrdLessThan %bool %1781 %1794 + %1796 = OpLogicalAnd %bool %1792 %1795 + OpSelectionMerge %1797 None + OpBranchConditional %1796 %1798 %1799 + %1799 = OpLabel + %1800 = OpExtInst %float %1 Log %float_10000 + %1801 = OpFDiv %float %1800 %1065 + OpBranch %1797 + %1798 = OpLabel + %1802 = OpFSub %float %1781 %1718 + %1803 = OpFMul %float %float_3 %1802 + %1804 = OpFSub %float %1794 %1718 + %1805 = OpFDiv %float %1803 %1804 + %1806 = OpConvertFToS %int %1805 + %1807 = OpConvertSToF %float %1806 + %1808 = OpFSub %float %1805 %1807 + %1809 = OpAccessChain %_ptr_Function_float %517 %1806 + %1810 = OpLoad %float %1809 + %1811 = OpIAdd %int %1806 %int_1 + %1812 = OpAccessChain %_ptr_Function_float %517 %1811 + %1813 = OpLoad %float %1812 + %1814 = OpIAdd %int %1806 %int_2 + %1815 = OpAccessChain %_ptr_Function_float %517 %1814 + %1816 = OpLoad %float %1815 + %1817 = OpCompositeConstruct %v3float %1810 %1813 %1816 + %1818 = OpFMul %float %1808 %1808 + %1819 = OpCompositeConstruct %v3float %1818 %1808 %float_1 + %1820 = OpMatrixTimesVector %v3float %442 %1817 + %1821 = OpDot %float %1819 %1820 + OpBranch %1797 + %1797 = OpLabel + %1822 = OpPhi %float %1801 %1799 %1821 %1798 + OpBranch %1789 + %1790 = OpLabel + %1823 = OpFSub %float %1781 %1423 + %1824 = OpFMul %float %float_3 %1823 + %1825 = OpFSub %float %1718 %1423 + %1826 = OpFDiv %float %1824 %1825 + %1827 = OpConvertFToS %int %1826 + %1828 = OpConvertSToF %float %1827 + %1829 = OpFSub %float %1826 %1828 + %1830 = OpAccessChain %_ptr_Function_float %518 %1827 + %1831 = OpLoad %float %1830 + %1832 = OpIAdd %int %1827 %int_1 + %1833 = OpAccessChain %_ptr_Function_float %518 %1832 + %1834 = OpLoad %float %1833 + %1835 = OpIAdd %int %1827 %int_2 + %1836 = OpAccessChain %_ptr_Function_float %518 %1835 + %1837 = OpLoad %float %1836 + %1838 = OpCompositeConstruct %v3float %1831 %1834 %1837 + %1839 = OpFMul %float %1829 %1829 + %1840 = OpCompositeConstruct %v3float %1839 %1829 %float_1 + %1841 = OpMatrixTimesVector %v3float %442 %1838 + %1842 = OpDot %float %1840 %1841 + OpBranch %1789 + %1789 = OpLabel + %1843 = OpPhi %float %1822 %1797 %1842 %1790 + OpBranch %1783 + %1784 = OpLabel + %1844 = OpExtInst %float %1 Log %float_9_99999975en05 + %1845 = OpFDiv %float %1844 %1065 + OpBranch %1783 + %1783 = OpLabel + %1846 = OpPhi %float %1843 %1789 %1845 %1784 + %1847 = OpExtInst %float %1 Pow %float_10 %1846 + %1848 = OpCompositeExtract %float %1642 0 + OpStore %512 %482 + OpStore %511 %483 + %1849 = OpFOrdLessThanEqual %bool %1848 %float_0 + %1850 = OpSelect %float %1849 %float_9_99999975en05 %1848 + %1851 = OpExtInst %float %1 Log %1850 + %1852 = OpFDiv %float %1851 %1065 + %1853 = OpExtInst %float %1 Log %1716 + %1854 = OpFDiv %float %1853 %1065 + %1855 = OpFOrdLessThanEqual %bool %1852 %1854 + OpSelectionMerge %1856 None + OpBranchConditional %1855 %1857 %1858 + %1858 = OpLabel + %1859 = OpFOrdGreaterThan %bool %1852 %1854 + %1860 = OpExtInst %float %1 Log %1775 + %1861 = OpFDiv %float %1860 %1065 + %1862 = OpFOrdLessThan %bool %1852 %1861 + %1863 = OpLogicalAnd %bool %1859 %1862 + OpSelectionMerge %1864 None + OpBranchConditional %1863 %1865 %1866 + %1866 = OpLabel + %1867 = OpFOrdGreaterThanEqual %bool %1852 %1861 + %1868 = OpExtInst %float %1 Log %1847 + %1869 = OpFDiv %float %1868 %1065 + %1870 = OpFOrdLessThan %bool %1852 %1869 + %1871 = OpLogicalAnd %bool %1867 %1870 + OpSelectionMerge %1872 None + OpBranchConditional %1871 %1873 %1874 + %1874 = OpLabel + %1875 = OpFMul %float %1852 %float_0_119999997 + %1876 = OpExtInst %float %1 Log %float_2000 + %1877 = OpFDiv %float %1876 %1065 + %1878 = OpFMul %float %float_0_119999997 %1868 + %1879 = OpFDiv %float %1878 %1065 + %1880 = OpFSub %float %1877 %1879 + %1881 = OpFAdd %float %1875 %1880 + OpBranch %1872 + %1873 = OpLabel + %1882 = OpFSub %float %1852 %1861 + %1883 = OpFMul %float %float_7 %1882 + %1884 = OpFSub %float %1869 %1861 + %1885 = OpFDiv %float %1883 %1884 + %1886 = OpConvertFToS %int %1885 + %1887 = OpConvertSToF %float %1886 + %1888 = OpFSub %float %1885 %1887 + %1889 = OpAccessChain %_ptr_Function_float %511 %1886 + %1890 = OpLoad %float %1889 + %1891 = OpIAdd %int %1886 %int_1 + %1892 = OpAccessChain %_ptr_Function_float %511 %1891 + %1893 = OpLoad %float %1892 + %1894 = OpIAdd %int %1886 %int_2 + %1895 = OpAccessChain %_ptr_Function_float %511 %1894 + %1896 = OpLoad %float %1895 + %1897 = OpCompositeConstruct %v3float %1890 %1893 %1896 + %1898 = OpFMul %float %1888 %1888 + %1899 = OpCompositeConstruct %v3float %1898 %1888 %float_1 + %1900 = OpMatrixTimesVector %v3float %442 %1897 + %1901 = OpDot %float %1899 %1900 + OpBranch %1872 + %1872 = OpLabel + %1902 = OpPhi %float %1881 %1874 %1901 %1873 + OpBranch %1864 + %1865 = OpLabel + %1903 = OpFSub %float %1852 %1854 + %1904 = OpFMul %float %float_7 %1903 + %1905 = OpFSub %float %1861 %1854 + %1906 = OpFDiv %float %1904 %1905 + %1907 = OpConvertFToS %int %1906 + %1908 = OpConvertSToF %float %1907 + %1909 = OpFSub %float %1906 %1908 + %1910 = OpAccessChain %_ptr_Function_float %512 %1907 + %1911 = OpLoad %float %1910 + %1912 = OpIAdd %int %1907 %int_1 + %1913 = OpAccessChain %_ptr_Function_float %512 %1912 + %1914 = OpLoad %float %1913 + %1915 = OpIAdd %int %1907 %int_2 + %1916 = OpAccessChain %_ptr_Function_float %512 %1915 + %1917 = OpLoad %float %1916 + %1918 = OpCompositeConstruct %v3float %1911 %1914 %1917 + %1919 = OpFMul %float %1909 %1909 + %1920 = OpCompositeConstruct %v3float %1919 %1909 %float_1 + %1921 = OpMatrixTimesVector %v3float %442 %1918 + %1922 = OpDot %float %1920 %1921 + OpBranch %1864 + %1864 = OpLabel + %1923 = OpPhi %float %1902 %1872 %1922 %1865 + OpBranch %1856 + %1857 = OpLabel + %1924 = OpExtInst %float %1 Log %float_0_00499999989 + %1925 = OpFDiv %float %1924 %1065 + OpBranch %1856 + %1856 = OpLabel + %1926 = OpPhi %float %1923 %1864 %1925 %1857 + %1927 = OpExtInst %float %1 Pow %float_10 %1926 + %1928 = OpCompositeInsert %v3float %1927 %391 0 + %1929 = OpCompositeExtract %float %1642 1 + OpStore %510 %482 + OpStore %509 %483 + %1930 = OpFOrdLessThanEqual %bool %1929 %float_0 + %1931 = OpSelect %float %1930 %float_9_99999975en05 %1929 + %1932 = OpExtInst %float %1 Log %1931 + %1933 = OpFDiv %float %1932 %1065 + %1934 = OpFOrdLessThanEqual %bool %1933 %1854 + OpSelectionMerge %1935 None + OpBranchConditional %1934 %1936 %1937 + %1937 = OpLabel + %1938 = OpFOrdGreaterThan %bool %1933 %1854 + %1939 = OpExtInst %float %1 Log %1775 + %1940 = OpFDiv %float %1939 %1065 + %1941 = OpFOrdLessThan %bool %1933 %1940 + %1942 = OpLogicalAnd %bool %1938 %1941 + OpSelectionMerge %1943 None + OpBranchConditional %1942 %1944 %1945 + %1945 = OpLabel + %1946 = OpFOrdGreaterThanEqual %bool %1933 %1940 + %1947 = OpExtInst %float %1 Log %1847 + %1948 = OpFDiv %float %1947 %1065 + %1949 = OpFOrdLessThan %bool %1933 %1948 + %1950 = OpLogicalAnd %bool %1946 %1949 + OpSelectionMerge %1951 None + OpBranchConditional %1950 %1952 %1953 + %1953 = OpLabel + %1954 = OpFMul %float %1933 %float_0_119999997 + %1955 = OpExtInst %float %1 Log %float_2000 + %1956 = OpFDiv %float %1955 %1065 + %1957 = OpFMul %float %float_0_119999997 %1947 + %1958 = OpFDiv %float %1957 %1065 + %1959 = OpFSub %float %1956 %1958 + %1960 = OpFAdd %float %1954 %1959 + OpBranch %1951 + %1952 = OpLabel + %1961 = OpFSub %float %1933 %1940 + %1962 = OpFMul %float %float_7 %1961 + %1963 = OpFSub %float %1948 %1940 + %1964 = OpFDiv %float %1962 %1963 + %1965 = OpConvertFToS %int %1964 + %1966 = OpConvertSToF %float %1965 + %1967 = OpFSub %float %1964 %1966 + %1968 = OpAccessChain %_ptr_Function_float %509 %1965 + %1969 = OpLoad %float %1968 + %1970 = OpIAdd %int %1965 %int_1 + %1971 = OpAccessChain %_ptr_Function_float %509 %1970 + %1972 = OpLoad %float %1971 + %1973 = OpIAdd %int %1965 %int_2 + %1974 = OpAccessChain %_ptr_Function_float %509 %1973 + %1975 = OpLoad %float %1974 + %1976 = OpCompositeConstruct %v3float %1969 %1972 %1975 + %1977 = OpFMul %float %1967 %1967 + %1978 = OpCompositeConstruct %v3float %1977 %1967 %float_1 + %1979 = OpMatrixTimesVector %v3float %442 %1976 + %1980 = OpDot %float %1978 %1979 + OpBranch %1951 + %1951 = OpLabel + %1981 = OpPhi %float %1960 %1953 %1980 %1952 + OpBranch %1943 + %1944 = OpLabel + %1982 = OpFSub %float %1933 %1854 + %1983 = OpFMul %float %float_7 %1982 + %1984 = OpFSub %float %1940 %1854 + %1985 = OpFDiv %float %1983 %1984 + %1986 = OpConvertFToS %int %1985 + %1987 = OpConvertSToF %float %1986 + %1988 = OpFSub %float %1985 %1987 + %1989 = OpAccessChain %_ptr_Function_float %510 %1986 + %1990 = OpLoad %float %1989 + %1991 = OpIAdd %int %1986 %int_1 + %1992 = OpAccessChain %_ptr_Function_float %510 %1991 + %1993 = OpLoad %float %1992 + %1994 = OpIAdd %int %1986 %int_2 + %1995 = OpAccessChain %_ptr_Function_float %510 %1994 + %1996 = OpLoad %float %1995 + %1997 = OpCompositeConstruct %v3float %1990 %1993 %1996 + %1998 = OpFMul %float %1988 %1988 + %1999 = OpCompositeConstruct %v3float %1998 %1988 %float_1 + %2000 = OpMatrixTimesVector %v3float %442 %1997 + %2001 = OpDot %float %1999 %2000 + OpBranch %1943 + %1943 = OpLabel + %2002 = OpPhi %float %1981 %1951 %2001 %1944 + OpBranch %1935 + %1936 = OpLabel + %2003 = OpExtInst %float %1 Log %float_0_00499999989 + %2004 = OpFDiv %float %2003 %1065 + OpBranch %1935 + %1935 = OpLabel + %2005 = OpPhi %float %2002 %1943 %2004 %1936 + %2006 = OpExtInst %float %1 Pow %float_10 %2005 + %2007 = OpCompositeInsert %v3float %2006 %1928 1 + %2008 = OpCompositeExtract %float %1642 2 + OpStore %508 %482 + OpStore %507 %483 + %2009 = OpFOrdLessThanEqual %bool %2008 %float_0 + %2010 = OpSelect %float %2009 %float_9_99999975en05 %2008 + %2011 = OpExtInst %float %1 Log %2010 + %2012 = OpFDiv %float %2011 %1065 + %2013 = OpFOrdLessThanEqual %bool %2012 %1854 + OpSelectionMerge %2014 None + OpBranchConditional %2013 %2015 %2016 + %2016 = OpLabel + %2017 = OpFOrdGreaterThan %bool %2012 %1854 + %2018 = OpExtInst %float %1 Log %1775 + %2019 = OpFDiv %float %2018 %1065 + %2020 = OpFOrdLessThan %bool %2012 %2019 + %2021 = OpLogicalAnd %bool %2017 %2020 + OpSelectionMerge %2022 None + OpBranchConditional %2021 %2023 %2024 + %2024 = OpLabel + %2025 = OpFOrdGreaterThanEqual %bool %2012 %2019 + %2026 = OpExtInst %float %1 Log %1847 + %2027 = OpFDiv %float %2026 %1065 + %2028 = OpFOrdLessThan %bool %2012 %2027 + %2029 = OpLogicalAnd %bool %2025 %2028 + OpSelectionMerge %2030 None + OpBranchConditional %2029 %2031 %2032 + %2032 = OpLabel + %2033 = OpFMul %float %2012 %float_0_119999997 + %2034 = OpExtInst %float %1 Log %float_2000 + %2035 = OpFDiv %float %2034 %1065 + %2036 = OpFMul %float %float_0_119999997 %2026 + %2037 = OpFDiv %float %2036 %1065 + %2038 = OpFSub %float %2035 %2037 + %2039 = OpFAdd %float %2033 %2038 + OpBranch %2030 + %2031 = OpLabel + %2040 = OpFSub %float %2012 %2019 + %2041 = OpFMul %float %float_7 %2040 + %2042 = OpFSub %float %2027 %2019 + %2043 = OpFDiv %float %2041 %2042 + %2044 = OpConvertFToS %int %2043 + %2045 = OpConvertSToF %float %2044 + %2046 = OpFSub %float %2043 %2045 + %2047 = OpAccessChain %_ptr_Function_float %507 %2044 + %2048 = OpLoad %float %2047 + %2049 = OpIAdd %int %2044 %int_1 + %2050 = OpAccessChain %_ptr_Function_float %507 %2049 + %2051 = OpLoad %float %2050 + %2052 = OpIAdd %int %2044 %int_2 + %2053 = OpAccessChain %_ptr_Function_float %507 %2052 + %2054 = OpLoad %float %2053 + %2055 = OpCompositeConstruct %v3float %2048 %2051 %2054 + %2056 = OpFMul %float %2046 %2046 + %2057 = OpCompositeConstruct %v3float %2056 %2046 %float_1 + %2058 = OpMatrixTimesVector %v3float %442 %2055 + %2059 = OpDot %float %2057 %2058 + OpBranch %2030 + %2030 = OpLabel + %2060 = OpPhi %float %2039 %2032 %2059 %2031 + OpBranch %2022 + %2023 = OpLabel + %2061 = OpFSub %float %2012 %1854 + %2062 = OpFMul %float %float_7 %2061 + %2063 = OpFSub %float %2019 %1854 + %2064 = OpFDiv %float %2062 %2063 + %2065 = OpConvertFToS %int %2064 + %2066 = OpConvertSToF %float %2065 + %2067 = OpFSub %float %2064 %2066 + %2068 = OpAccessChain %_ptr_Function_float %508 %2065 + %2069 = OpLoad %float %2068 + %2070 = OpIAdd %int %2065 %int_1 + %2071 = OpAccessChain %_ptr_Function_float %508 %2070 + %2072 = OpLoad %float %2071 + %2073 = OpIAdd %int %2065 %int_2 + %2074 = OpAccessChain %_ptr_Function_float %508 %2073 + %2075 = OpLoad %float %2074 + %2076 = OpCompositeConstruct %v3float %2069 %2072 %2075 + %2077 = OpFMul %float %2067 %2067 + %2078 = OpCompositeConstruct %v3float %2077 %2067 %float_1 + %2079 = OpMatrixTimesVector %v3float %442 %2076 + %2080 = OpDot %float %2078 %2079 + OpBranch %2022 + %2022 = OpLabel + %2081 = OpPhi %float %2060 %2030 %2080 %2023 + OpBranch %2014 + %2015 = OpLabel + %2082 = OpExtInst %float %1 Log %float_0_00499999989 + %2083 = OpFDiv %float %2082 %1065 + OpBranch %2014 + %2014 = OpLabel + %2084 = OpPhi %float %2081 %2022 %2083 %2015 + %2085 = OpExtInst %float %1 Pow %float_10 %2084 + %2086 = OpCompositeInsert %v3float %2085 %2007 2 + %2087 = OpVectorTimesMatrix %v3float %2086 %576 + %2088 = OpFMul %v3float %2087 %496 + %2089 = OpExtInst %v3float %1 Pow %2088 %263 + %2090 = OpFMul %v3float %184 %2089 + %2091 = OpFAdd %v3float %183 %2090 + %2092 = OpFMul %v3float %185 %2089 + %2093 = OpFAdd %v3float %135 %2092 + %2094 = OpFDiv %v3float %135 %2093 + %2095 = OpFMul %v3float %2091 %2094 + %2096 = OpExtInst %v3float %1 Pow %2095 %264 + OpBranch %1236 + %1236 = OpLabel + %2097 = OpPhi %v3float %1260 %1240 %2096 %2014 + OpBranch %1230 + %1231 = OpLabel + %2098 = OpMatrixTimesMatrix %mat3v3float %546 %399 + %2099 = OpFMul %v3float %906 %262 + %2100 = OpVectorTimesMatrix %v3float %2099 %2098 + %2101 = OpCompositeExtract %float %2100 0 + %2102 = OpCompositeExtract %float %2100 1 + %2103 = OpExtInst %float %1 FMin %2101 %2102 + %2104 = OpCompositeExtract %float %2100 2 + %2105 = OpExtInst %float %1 FMin %2103 %2104 + %2106 = OpExtInst %float %1 FMax %2101 %2102 + %2107 = OpExtInst %float %1 FMax %2106 %2104 + %2108 = OpExtInst %float %1 FMax %2107 %float_1_00000001en10 + %2109 = OpExtInst %float %1 FMax %2105 %float_1_00000001en10 + %2110 = OpFSub %float %2108 %2109 + %2111 = OpExtInst %float %1 FMax %2107 %float_0_00999999978 + %2112 = OpFDiv %float %2110 %2111 + %2113 = OpFSub %float %2104 %2102 + %2114 = OpFMul %float %2104 %2113 + %2115 = OpFSub %float %2102 %2101 + %2116 = OpFMul %float %2102 %2115 + %2117 = OpFAdd %float %2114 %2116 + %2118 = OpFSub %float %2101 %2104 + %2119 = OpFMul %float %2101 %2118 + %2120 = OpFAdd %float %2117 %2119 + %2121 = OpExtInst %float %1 Sqrt %2120 + %2122 = OpFAdd %float %2104 %2102 + %2123 = OpFAdd %float %2122 %2101 + %2124 = OpFMul %float %float_1_75 %2121 + %2125 = OpFAdd %float %2123 %2124 + %2126 = OpFMul %float %2125 %float_0_333333343 + %2127 = OpFSub %float %2112 %float_0_400000006 + %2128 = OpFMul %float %2127 %float_5 + %2129 = OpFMul %float %2127 %float_2_5 + %2130 = OpExtInst %float %1 FAbs %2129 + %2131 = OpFSub %float %float_1 %2130 + %2132 = OpExtInst %float %1 FMax %2131 %float_0 + %2133 = OpExtInst %float %1 FSign %2128 + %2134 = OpConvertFToS %int %2133 + %2135 = OpConvertSToF %float %2134 + %2136 = OpFMul %float %2132 %2132 + %2137 = OpFSub %float %float_1 %2136 + %2138 = OpFMul %float %2135 %2137 + %2139 = OpFAdd %float %float_1 %2138 + %2140 = OpFMul %float %2139 %float_0_0250000004 + %2141 = OpFOrdLessThanEqual %bool %2126 %float_0_0533333346 + OpSelectionMerge %2142 None + OpBranchConditional %2141 %2143 %2144 + %2144 = OpLabel + %2145 = OpFOrdGreaterThanEqual %bool %2126 %float_0_159999996 + OpSelectionMerge %2146 None + OpBranchConditional %2145 %2147 %2148 + %2148 = OpLabel + %2149 = OpFDiv %float %float_0_239999995 %2125 + %2150 = OpFSub %float %2149 %float_0_5 + %2151 = OpFMul %float %2140 %2150 + OpBranch %2146 + %2147 = OpLabel + OpBranch %2146 + %2146 = OpLabel + %2152 = OpPhi %float %2151 %2148 %float_0 %2147 + OpBranch %2142 + %2143 = OpLabel + OpBranch %2142 + %2142 = OpLabel + %2153 = OpPhi %float %2152 %2146 %2140 %2143 + %2154 = OpFAdd %float %float_1 %2153 + %2155 = OpCompositeConstruct %v3float %2154 %2154 %2154 + %2156 = OpFMul %v3float %2100 %2155 + %2157 = OpCompositeExtract %float %2156 0 + %2158 = OpCompositeExtract %float %2156 1 + %2159 = OpFOrdEqual %bool %2157 %2158 + %2160 = OpCompositeExtract %float %2156 2 + %2161 = OpFOrdEqual %bool %2158 %2160 + %2162 = OpLogicalAnd %bool %2159 %2161 + OpSelectionMerge %2163 None + OpBranchConditional %2162 %2164 %2165 + %2165 = OpLabel + %2166 = OpExtInst %float %1 Sqrt %float_3 + %2167 = OpFSub %float %2158 %2160 + %2168 = OpFMul %float %2166 %2167 + %2169 = OpFMul %float %float_2 %2157 + %2170 = OpFSub %float %2169 %2158 + %2171 = OpFSub %float %2170 %2160 + %2172 = OpExtInst %float %1 Atan2 %2168 %2171 + %2173 = OpFMul %float %float_57_2957764 %2172 + OpBranch %2163 + %2164 = OpLabel + OpBranch %2163 + %2163 = OpLabel + %2174 = OpPhi %float %2173 %2165 %float_0 %2164 + %2175 = OpFOrdLessThan %bool %2174 %float_0 + OpSelectionMerge %2176 None + OpBranchConditional %2175 %2177 %2176 + %2177 = OpLabel + %2178 = OpFAdd %float %2174 %float_360 + OpBranch %2176 + %2176 = OpLabel + %2179 = OpPhi %float %2174 %2163 %2178 %2177 + %2180 = OpExtInst %float %1 FClamp %2179 %float_0 %float_360 + %2181 = OpFOrdGreaterThan %bool %2180 %float_180 + OpSelectionMerge %2182 None + OpBranchConditional %2181 %2183 %2182 + %2183 = OpLabel + %2184 = OpFSub %float %2180 %float_360 + OpBranch %2182 + %2182 = OpLabel + %2185 = OpPhi %float %2180 %2176 %2184 %2183 + %2186 = OpFOrdGreaterThan %bool %2185 %float_n67_5 + %2187 = OpFOrdLessThan %bool %2185 %float_67_5 + %2188 = OpLogicalAnd %bool %2186 %2187 + OpSelectionMerge %2189 None + OpBranchConditional %2188 %2190 %2189 + %2190 = OpLabel + %2191 = OpFSub %float %2185 %float_n67_5 + %2192 = OpFMul %float %2191 %float_0_0296296291 + %2193 = OpConvertFToS %int %2192 + %2194 = OpConvertSToF %float %2193 + %2195 = OpFSub %float %2192 %2194 + %2196 = OpFMul %float %2195 %2195 + %2197 = OpFMul %float %2196 %2195 + %2198 = OpIEqual %bool %2193 %int_3 + OpSelectionMerge %2199 None + OpBranchConditional %2198 %2200 %2201 + %2201 = OpLabel + %2202 = OpIEqual %bool %2193 %int_2 + OpSelectionMerge %2203 None + OpBranchConditional %2202 %2204 %2205 + %2205 = OpLabel + %2206 = OpIEqual %bool %2193 %int_1 + OpSelectionMerge %2207 None + OpBranchConditional %2206 %2208 %2209 + %2209 = OpLabel + %2210 = OpIEqual %bool %2193 %int_0 + OpSelectionMerge %2211 None + OpBranchConditional %2210 %2212 %2213 + %2213 = OpLabel + OpBranch %2211 + %2212 = OpLabel + %2214 = OpFMul %float %2197 %float_0_166666672 + OpBranch %2211 + %2211 = OpLabel + %2215 = OpPhi %float %float_0 %2213 %2214 %2212 + OpBranch %2207 + %2208 = OpLabel + %2216 = OpFMul %float %2197 %float_n0_5 + %2217 = OpFMul %float %2196 %float_0_5 + %2218 = OpFAdd %float %2216 %2217 + %2219 = OpFMul %float %2195 %float_0_5 + %2220 = OpFAdd %float %2218 %2219 + %2221 = OpFAdd %float %2220 %float_0_166666672 + OpBranch %2207 + %2207 = OpLabel + %2222 = OpPhi %float %2215 %2211 %2221 %2208 + OpBranch %2203 + %2204 = OpLabel + %2223 = OpFMul %float %2197 %float_0_5 + %2224 = OpFMul %float %2196 %float_n1 + %2225 = OpFAdd %float %2223 %2224 + %2226 = OpFAdd %float %2225 %float_0_666666687 + OpBranch %2203 + %2203 = OpLabel + %2227 = OpPhi %float %2222 %2207 %2226 %2204 + OpBranch %2199 + %2200 = OpLabel + %2228 = OpFMul %float %2197 %float_n0_166666672 + %2229 = OpFMul %float %2196 %float_0_5 + %2230 = OpFAdd %float %2228 %2229 + %2231 = OpFMul %float %2195 %float_n0_5 + %2232 = OpFAdd %float %2230 %2231 + %2233 = OpFAdd %float %2232 %float_0_166666672 + OpBranch %2199 + %2199 = OpLabel + %2234 = OpPhi %float %2227 %2203 %2233 %2200 + OpBranch %2189 + %2189 = OpLabel + %2235 = OpPhi %float %float_0 %2182 %2234 %2199 + %2236 = OpFMul %float %2235 %float_1_5 + %2237 = OpFMul %float %2236 %2112 + %2238 = OpFSub %float %float_0_0299999993 %2157 + %2239 = OpFMul %float %2237 %2238 + %2240 = OpFMul %float %2239 %float_0_180000007 + %2241 = OpFAdd %float %2157 %2240 + %2242 = OpCompositeInsert %v3float %2241 %2156 0 + %2243 = OpExtInst %v3float %1 FClamp %2242 %132 %314 + %2244 = OpVectorTimesMatrix %v3float %2243 %410 + %2245 = OpExtInst %v3float %1 FClamp %2244 %132 %314 + %2246 = OpDot %float %2245 %67 + %2247 = OpCompositeConstruct %v3float %2246 %2246 %2246 + %2248 = OpExtInst %v3float %1 FMix %2247 %2245 %228 + %2249 = OpCompositeExtract %float %2248 0 + %2250 = OpExtInst %float %1 Exp2 %float_n15 + %2251 = OpFMul %float %float_0_179999992 %2250 + %2252 = OpExtInst %float %1 Exp2 %float_18 + %2253 = OpFMul %float %float_0_179999992 %2252 + OpStore %520 %475 + OpStore %519 %476 + %2254 = OpFOrdLessThanEqual %bool %2249 %float_0 + %2255 = OpExtInst %float %1 Exp2 %float_n14 + %2256 = OpSelect %float %2254 %2255 %2249 + %2257 = OpExtInst %float %1 Log %2256 + %2258 = OpFDiv %float %2257 %1065 + %2259 = OpExtInst %float %1 Log %2251 + %2260 = OpFDiv %float %2259 %1065 + %2261 = OpFOrdLessThanEqual %bool %2258 %2260 + OpSelectionMerge %2262 None + OpBranchConditional %2261 %2263 %2264 + %2264 = OpLabel + %2265 = OpFOrdGreaterThan %bool %2258 %2260 + %2266 = OpExtInst %float %1 Log %float_0_180000007 + %2267 = OpFDiv %float %2266 %1065 + %2268 = OpFOrdLessThan %bool %2258 %2267 + %2269 = OpLogicalAnd %bool %2265 %2268 + OpSelectionMerge %2270 None + OpBranchConditional %2269 %2271 %2272 + %2272 = OpLabel + %2273 = OpFOrdGreaterThanEqual %bool %2258 %2267 + %2274 = OpExtInst %float %1 Log %2253 + %2275 = OpFDiv %float %2274 %1065 + %2276 = OpFOrdLessThan %bool %2258 %2275 + %2277 = OpLogicalAnd %bool %2273 %2276 + OpSelectionMerge %2278 None + OpBranchConditional %2277 %2279 %2280 + %2280 = OpLabel + %2281 = OpExtInst %float %1 Log %float_10000 + %2282 = OpFDiv %float %2281 %1065 + OpBranch %2278 + %2279 = OpLabel + %2283 = OpFSub %float %2258 %2267 + %2284 = OpFMul %float %float_3 %2283 + %2285 = OpFSub %float %2275 %2267 + %2286 = OpFDiv %float %2284 %2285 + %2287 = OpConvertFToS %int %2286 + %2288 = OpConvertSToF %float %2287 + %2289 = OpFSub %float %2286 %2288 + %2290 = OpAccessChain %_ptr_Function_float %519 %2287 + %2291 = OpLoad %float %2290 + %2292 = OpIAdd %int %2287 %int_1 + %2293 = OpAccessChain %_ptr_Function_float %519 %2292 + %2294 = OpLoad %float %2293 + %2295 = OpIAdd %int %2287 %int_2 + %2296 = OpAccessChain %_ptr_Function_float %519 %2295 + %2297 = OpLoad %float %2296 + %2298 = OpCompositeConstruct %v3float %2291 %2294 %2297 + %2299 = OpFMul %float %2289 %2289 + %2300 = OpCompositeConstruct %v3float %2299 %2289 %float_1 + %2301 = OpMatrixTimesVector %v3float %442 %2298 + %2302 = OpDot %float %2300 %2301 + OpBranch %2278 + %2278 = OpLabel + %2303 = OpPhi %float %2282 %2280 %2302 %2279 + OpBranch %2270 + %2271 = OpLabel + %2304 = OpFSub %float %2258 %2260 + %2305 = OpFMul %float %float_3 %2304 + %2306 = OpFSub %float %2267 %2260 + %2307 = OpFDiv %float %2305 %2306 + %2308 = OpConvertFToS %int %2307 + %2309 = OpConvertSToF %float %2308 + %2310 = OpFSub %float %2307 %2309 + %2311 = OpAccessChain %_ptr_Function_float %520 %2308 + %2312 = OpLoad %float %2311 + %2313 = OpIAdd %int %2308 %int_1 + %2314 = OpAccessChain %_ptr_Function_float %520 %2313 + %2315 = OpLoad %float %2314 + %2316 = OpIAdd %int %2308 %int_2 + %2317 = OpAccessChain %_ptr_Function_float %520 %2316 + %2318 = OpLoad %float %2317 + %2319 = OpCompositeConstruct %v3float %2312 %2315 %2318 + %2320 = OpFMul %float %2310 %2310 + %2321 = OpCompositeConstruct %v3float %2320 %2310 %float_1 + %2322 = OpMatrixTimesVector %v3float %442 %2319 + %2323 = OpDot %float %2321 %2322 + OpBranch %2270 + %2270 = OpLabel + %2324 = OpPhi %float %2303 %2278 %2323 %2271 + OpBranch %2262 + %2263 = OpLabel + %2325 = OpExtInst %float %1 Log %float_9_99999975en05 + %2326 = OpFDiv %float %2325 %1065 + OpBranch %2262 + %2262 = OpLabel + %2327 = OpPhi %float %2324 %2270 %2326 %2263 + %2328 = OpExtInst %float %1 Pow %float_10 %2327 + %2329 = OpCompositeInsert %v3float %2328 %391 0 + %2330 = OpCompositeExtract %float %2248 1 + OpStore %522 %475 + OpStore %521 %476 + %2331 = OpFOrdLessThanEqual %bool %2330 %float_0 + %2332 = OpSelect %float %2331 %2255 %2330 + %2333 = OpExtInst %float %1 Log %2332 + %2334 = OpFDiv %float %2333 %1065 + %2335 = OpFOrdLessThanEqual %bool %2334 %2260 + OpSelectionMerge %2336 None + OpBranchConditional %2335 %2337 %2338 + %2338 = OpLabel + %2339 = OpFOrdGreaterThan %bool %2334 %2260 + %2340 = OpExtInst %float %1 Log %float_0_180000007 + %2341 = OpFDiv %float %2340 %1065 + %2342 = OpFOrdLessThan %bool %2334 %2341 + %2343 = OpLogicalAnd %bool %2339 %2342 + OpSelectionMerge %2344 None + OpBranchConditional %2343 %2345 %2346 + %2346 = OpLabel + %2347 = OpFOrdGreaterThanEqual %bool %2334 %2341 + %2348 = OpExtInst %float %1 Log %2253 + %2349 = OpFDiv %float %2348 %1065 + %2350 = OpFOrdLessThan %bool %2334 %2349 + %2351 = OpLogicalAnd %bool %2347 %2350 + OpSelectionMerge %2352 None + OpBranchConditional %2351 %2353 %2354 + %2354 = OpLabel + %2355 = OpExtInst %float %1 Log %float_10000 + %2356 = OpFDiv %float %2355 %1065 + OpBranch %2352 + %2353 = OpLabel + %2357 = OpFSub %float %2334 %2341 + %2358 = OpFMul %float %float_3 %2357 + %2359 = OpFSub %float %2349 %2341 + %2360 = OpFDiv %float %2358 %2359 + %2361 = OpConvertFToS %int %2360 + %2362 = OpConvertSToF %float %2361 + %2363 = OpFSub %float %2360 %2362 + %2364 = OpAccessChain %_ptr_Function_float %521 %2361 + %2365 = OpLoad %float %2364 + %2366 = OpIAdd %int %2361 %int_1 + %2367 = OpAccessChain %_ptr_Function_float %521 %2366 + %2368 = OpLoad %float %2367 + %2369 = OpIAdd %int %2361 %int_2 + %2370 = OpAccessChain %_ptr_Function_float %521 %2369 + %2371 = OpLoad %float %2370 + %2372 = OpCompositeConstruct %v3float %2365 %2368 %2371 + %2373 = OpFMul %float %2363 %2363 + %2374 = OpCompositeConstruct %v3float %2373 %2363 %float_1 + %2375 = OpMatrixTimesVector %v3float %442 %2372 + %2376 = OpDot %float %2374 %2375 + OpBranch %2352 + %2352 = OpLabel + %2377 = OpPhi %float %2356 %2354 %2376 %2353 + OpBranch %2344 + %2345 = OpLabel + %2378 = OpFSub %float %2334 %2260 + %2379 = OpFMul %float %float_3 %2378 + %2380 = OpFSub %float %2341 %2260 + %2381 = OpFDiv %float %2379 %2380 + %2382 = OpConvertFToS %int %2381 + %2383 = OpConvertSToF %float %2382 + %2384 = OpFSub %float %2381 %2383 + %2385 = OpAccessChain %_ptr_Function_float %522 %2382 + %2386 = OpLoad %float %2385 + %2387 = OpIAdd %int %2382 %int_1 + %2388 = OpAccessChain %_ptr_Function_float %522 %2387 + %2389 = OpLoad %float %2388 + %2390 = OpIAdd %int %2382 %int_2 + %2391 = OpAccessChain %_ptr_Function_float %522 %2390 + %2392 = OpLoad %float %2391 + %2393 = OpCompositeConstruct %v3float %2386 %2389 %2392 + %2394 = OpFMul %float %2384 %2384 + %2395 = OpCompositeConstruct %v3float %2394 %2384 %float_1 + %2396 = OpMatrixTimesVector %v3float %442 %2393 + %2397 = OpDot %float %2395 %2396 + OpBranch %2344 + %2344 = OpLabel + %2398 = OpPhi %float %2377 %2352 %2397 %2345 + OpBranch %2336 + %2337 = OpLabel + %2399 = OpExtInst %float %1 Log %float_9_99999975en05 + %2400 = OpFDiv %float %2399 %1065 + OpBranch %2336 + %2336 = OpLabel + %2401 = OpPhi %float %2398 %2344 %2400 %2337 + %2402 = OpExtInst %float %1 Pow %float_10 %2401 + %2403 = OpCompositeInsert %v3float %2402 %2329 1 + %2404 = OpCompositeExtract %float %2248 2 + OpStore %524 %475 + OpStore %523 %476 + %2405 = OpFOrdLessThanEqual %bool %2404 %float_0 + %2406 = OpSelect %float %2405 %2255 %2404 + %2407 = OpExtInst %float %1 Log %2406 + %2408 = OpFDiv %float %2407 %1065 + %2409 = OpFOrdLessThanEqual %bool %2408 %2260 + OpSelectionMerge %2410 None + OpBranchConditional %2409 %2411 %2412 + %2412 = OpLabel + %2413 = OpFOrdGreaterThan %bool %2408 %2260 + %2414 = OpExtInst %float %1 Log %float_0_180000007 + %2415 = OpFDiv %float %2414 %1065 + %2416 = OpFOrdLessThan %bool %2408 %2415 + %2417 = OpLogicalAnd %bool %2413 %2416 + OpSelectionMerge %2418 None + OpBranchConditional %2417 %2419 %2420 + %2420 = OpLabel + %2421 = OpFOrdGreaterThanEqual %bool %2408 %2415 + %2422 = OpExtInst %float %1 Log %2253 + %2423 = OpFDiv %float %2422 %1065 + %2424 = OpFOrdLessThan %bool %2408 %2423 + %2425 = OpLogicalAnd %bool %2421 %2424 + OpSelectionMerge %2426 None + OpBranchConditional %2425 %2427 %2428 + %2428 = OpLabel + %2429 = OpExtInst %float %1 Log %float_10000 + %2430 = OpFDiv %float %2429 %1065 + OpBranch %2426 + %2427 = OpLabel + %2431 = OpFSub %float %2408 %2415 + %2432 = OpFMul %float %float_3 %2431 + %2433 = OpFSub %float %2423 %2415 + %2434 = OpFDiv %float %2432 %2433 + %2435 = OpConvertFToS %int %2434 + %2436 = OpConvertSToF %float %2435 + %2437 = OpFSub %float %2434 %2436 + %2438 = OpAccessChain %_ptr_Function_float %523 %2435 + %2439 = OpLoad %float %2438 + %2440 = OpIAdd %int %2435 %int_1 + %2441 = OpAccessChain %_ptr_Function_float %523 %2440 + %2442 = OpLoad %float %2441 + %2443 = OpIAdd %int %2435 %int_2 + %2444 = OpAccessChain %_ptr_Function_float %523 %2443 + %2445 = OpLoad %float %2444 + %2446 = OpCompositeConstruct %v3float %2439 %2442 %2445 + %2447 = OpFMul %float %2437 %2437 + %2448 = OpCompositeConstruct %v3float %2447 %2437 %float_1 + %2449 = OpMatrixTimesVector %v3float %442 %2446 + %2450 = OpDot %float %2448 %2449 + OpBranch %2426 + %2426 = OpLabel + %2451 = OpPhi %float %2430 %2428 %2450 %2427 + OpBranch %2418 + %2419 = OpLabel + %2452 = OpFSub %float %2408 %2260 + %2453 = OpFMul %float %float_3 %2452 + %2454 = OpFSub %float %2415 %2260 + %2455 = OpFDiv %float %2453 %2454 + %2456 = OpConvertFToS %int %2455 + %2457 = OpConvertSToF %float %2456 + %2458 = OpFSub %float %2455 %2457 + %2459 = OpAccessChain %_ptr_Function_float %524 %2456 + %2460 = OpLoad %float %2459 + %2461 = OpIAdd %int %2456 %int_1 + %2462 = OpAccessChain %_ptr_Function_float %524 %2461 + %2463 = OpLoad %float %2462 + %2464 = OpIAdd %int %2456 %int_2 + %2465 = OpAccessChain %_ptr_Function_float %524 %2464 + %2466 = OpLoad %float %2465 + %2467 = OpCompositeConstruct %v3float %2460 %2463 %2466 + %2468 = OpFMul %float %2458 %2458 + %2469 = OpCompositeConstruct %v3float %2468 %2458 %float_1 + %2470 = OpMatrixTimesVector %v3float %442 %2467 + %2471 = OpDot %float %2469 %2470 + OpBranch %2418 + %2418 = OpLabel + %2472 = OpPhi %float %2451 %2426 %2471 %2419 + OpBranch %2410 + %2411 = OpLabel + %2473 = OpExtInst %float %1 Log %float_9_99999975en05 + %2474 = OpFDiv %float %2473 %1065 + OpBranch %2410 + %2410 = OpLabel + %2475 = OpPhi %float %2472 %2418 %2474 %2411 + %2476 = OpExtInst %float %1 Pow %float_10 %2475 + %2477 = OpCompositeInsert %v3float %2476 %2403 2 + %2478 = OpVectorTimesMatrix %v3float %2477 %414 + %2479 = OpVectorTimesMatrix %v3float %2478 %410 + %2480 = OpExtInst %float %1 Pow %float_2 %float_n12 + %2481 = OpFMul %float %float_0_179999992 %2480 + OpStore %532 %475 + OpStore %531 %476 + %2482 = OpFOrdLessThanEqual %bool %2481 %float_0 + %2483 = OpSelect %float %2482 %2255 %2481 + %2484 = OpExtInst %float %1 Log %2483 + %2485 = OpFDiv %float %2484 %1065 + %2486 = OpFOrdLessThanEqual %bool %2485 %2260 + OpSelectionMerge %2487 None + OpBranchConditional %2486 %2488 %2489 + %2489 = OpLabel + %2490 = OpFOrdGreaterThan %bool %2485 %2260 + %2491 = OpExtInst %float %1 Log %float_0_180000007 + %2492 = OpFDiv %float %2491 %1065 + %2493 = OpFOrdLessThan %bool %2485 %2492 + %2494 = OpLogicalAnd %bool %2490 %2493 + OpSelectionMerge %2495 None + OpBranchConditional %2494 %2496 %2497 + %2497 = OpLabel + %2498 = OpFOrdGreaterThanEqual %bool %2485 %2492 + %2499 = OpExtInst %float %1 Log %2253 + %2500 = OpFDiv %float %2499 %1065 + %2501 = OpFOrdLessThan %bool %2485 %2500 + %2502 = OpLogicalAnd %bool %2498 %2501 + OpSelectionMerge %2503 None + OpBranchConditional %2502 %2504 %2505 + %2505 = OpLabel + %2506 = OpExtInst %float %1 Log %float_10000 + %2507 = OpFDiv %float %2506 %1065 + OpBranch %2503 + %2504 = OpLabel + %2508 = OpFSub %float %2485 %2492 + %2509 = OpFMul %float %float_3 %2508 + %2510 = OpFSub %float %2500 %2492 + %2511 = OpFDiv %float %2509 %2510 + %2512 = OpConvertFToS %int %2511 + %2513 = OpConvertSToF %float %2512 + %2514 = OpFSub %float %2511 %2513 + %2515 = OpAccessChain %_ptr_Function_float %531 %2512 + %2516 = OpLoad %float %2515 + %2517 = OpIAdd %int %2512 %int_1 + %2518 = OpAccessChain %_ptr_Function_float %531 %2517 + %2519 = OpLoad %float %2518 + %2520 = OpIAdd %int %2512 %int_2 + %2521 = OpAccessChain %_ptr_Function_float %531 %2520 + %2522 = OpLoad %float %2521 + %2523 = OpCompositeConstruct %v3float %2516 %2519 %2522 + %2524 = OpFMul %float %2514 %2514 + %2525 = OpCompositeConstruct %v3float %2524 %2514 %float_1 + %2526 = OpMatrixTimesVector %v3float %442 %2523 + %2527 = OpDot %float %2525 %2526 + OpBranch %2503 + %2503 = OpLabel + %2528 = OpPhi %float %2507 %2505 %2527 %2504 + OpBranch %2495 + %2496 = OpLabel + %2529 = OpFSub %float %2485 %2260 + %2530 = OpFMul %float %float_3 %2529 + %2531 = OpFSub %float %2492 %2260 + %2532 = OpFDiv %float %2530 %2531 + %2533 = OpConvertFToS %int %2532 + %2534 = OpConvertSToF %float %2533 + %2535 = OpFSub %float %2532 %2534 + %2536 = OpAccessChain %_ptr_Function_float %532 %2533 + %2537 = OpLoad %float %2536 + %2538 = OpIAdd %int %2533 %int_1 + %2539 = OpAccessChain %_ptr_Function_float %532 %2538 + %2540 = OpLoad %float %2539 + %2541 = OpIAdd %int %2533 %int_2 + %2542 = OpAccessChain %_ptr_Function_float %532 %2541 + %2543 = OpLoad %float %2542 + %2544 = OpCompositeConstruct %v3float %2537 %2540 %2543 + %2545 = OpFMul %float %2535 %2535 + %2546 = OpCompositeConstruct %v3float %2545 %2535 %float_1 + %2547 = OpMatrixTimesVector %v3float %442 %2544 + %2548 = OpDot %float %2546 %2547 + OpBranch %2495 + %2495 = OpLabel + %2549 = OpPhi %float %2528 %2503 %2548 %2496 + OpBranch %2487 + %2488 = OpLabel + %2550 = OpExtInst %float %1 Log %float_9_99999975en05 + %2551 = OpFDiv %float %2550 %1065 + OpBranch %2487 + %2487 = OpLabel + %2552 = OpPhi %float %2549 %2495 %2551 %2488 + %2553 = OpExtInst %float %1 Pow %float_10 %2552 + OpStore %534 %475 + OpStore %533 %476 + %2554 = OpExtInst %float %1 Log %float_0_180000007 + %2555 = OpFDiv %float %2554 %1065 + %2556 = OpFOrdLessThanEqual %bool %2555 %2260 + OpSelectionMerge %2557 None + OpBranchConditional %2556 %2558 %2559 + %2559 = OpLabel + %2560 = OpFOrdGreaterThan %bool %2555 %2260 + %2561 = OpFOrdLessThan %bool %2555 %2555 + %2562 = OpLogicalAnd %bool %2560 %2561 + OpSelectionMerge %2563 None + OpBranchConditional %2562 %2564 %2565 + %2565 = OpLabel + %2566 = OpFOrdGreaterThanEqual %bool %2555 %2555 + %2567 = OpExtInst %float %1 Log %2253 + %2568 = OpFDiv %float %2567 %1065 + %2569 = OpFOrdLessThan %bool %2555 %2568 + %2570 = OpLogicalAnd %bool %2566 %2569 + OpSelectionMerge %2571 None + OpBranchConditional %2570 %2572 %2573 + %2573 = OpLabel + %2574 = OpExtInst %float %1 Log %float_10000 + %2575 = OpFDiv %float %2574 %1065 + OpBranch %2571 + %2572 = OpLabel + %2576 = OpFSub %float %2555 %2555 + %2577 = OpFMul %float %float_3 %2576 + %2578 = OpFSub %float %2568 %2555 + %2579 = OpFDiv %float %2577 %2578 + %2580 = OpConvertFToS %int %2579 + %2581 = OpConvertSToF %float %2580 + %2582 = OpFSub %float %2579 %2581 + %2583 = OpAccessChain %_ptr_Function_float %533 %2580 + %2584 = OpLoad %float %2583 + %2585 = OpIAdd %int %2580 %int_1 + %2586 = OpAccessChain %_ptr_Function_float %533 %2585 + %2587 = OpLoad %float %2586 + %2588 = OpIAdd %int %2580 %int_2 + %2589 = OpAccessChain %_ptr_Function_float %533 %2588 + %2590 = OpLoad %float %2589 + %2591 = OpCompositeConstruct %v3float %2584 %2587 %2590 + %2592 = OpFMul %float %2582 %2582 + %2593 = OpCompositeConstruct %v3float %2592 %2582 %float_1 + %2594 = OpMatrixTimesVector %v3float %442 %2591 + %2595 = OpDot %float %2593 %2594 + OpBranch %2571 + %2571 = OpLabel + %2596 = OpPhi %float %2575 %2573 %2595 %2572 + OpBranch %2563 + %2564 = OpLabel + %2597 = OpFSub %float %2555 %2260 + %2598 = OpFMul %float %float_3 %2597 + %2599 = OpAccessChain %_ptr_Function_float %534 %int_3 + %2600 = OpLoad %float %2599 + %2601 = OpAccessChain %_ptr_Function_float %534 %int_4 + %2602 = OpLoad %float %2601 + %2603 = OpAccessChain %_ptr_Function_float %534 %int_5 + %2604 = OpLoad %float %2603 + %2605 = OpCompositeConstruct %v3float %2600 %2602 %2604 + %2606 = OpMatrixTimesVector %v3float %442 %2605 + %2607 = OpCompositeExtract %float %2606 2 + OpBranch %2563 + %2563 = OpLabel + %2608 = OpPhi %float %2596 %2571 %2607 %2564 + OpBranch %2557 + %2558 = OpLabel + %2609 = OpExtInst %float %1 Log %float_9_99999975en05 + %2610 = OpFDiv %float %2609 %1065 + OpBranch %2557 + %2557 = OpLabel + %2611 = OpPhi %float %2608 %2563 %2610 %2558 + %2612 = OpExtInst %float %1 Pow %float_10 %2611 + %2613 = OpExtInst %float %1 Pow %float_2 %float_10 + %2614 = OpFMul %float %float_0_179999992 %2613 + OpStore %536 %475 + OpStore %535 %476 + %2615 = OpFOrdLessThanEqual %bool %2614 %float_0 + %2616 = OpSelect %float %2615 %2255 %2614 + %2617 = OpExtInst %float %1 Log %2616 + %2618 = OpFDiv %float %2617 %1065 + %2619 = OpFOrdLessThanEqual %bool %2618 %2260 + OpSelectionMerge %2620 None + OpBranchConditional %2619 %2621 %2622 + %2622 = OpLabel + %2623 = OpFOrdGreaterThan %bool %2618 %2260 + %2624 = OpFOrdLessThan %bool %2618 %2555 + %2625 = OpLogicalAnd %bool %2623 %2624 + OpSelectionMerge %2626 None + OpBranchConditional %2625 %2627 %2628 + %2628 = OpLabel + %2629 = OpFOrdGreaterThanEqual %bool %2618 %2555 + %2630 = OpExtInst %float %1 Log %2253 + %2631 = OpFDiv %float %2630 %1065 + %2632 = OpFOrdLessThan %bool %2618 %2631 + %2633 = OpLogicalAnd %bool %2629 %2632 + OpSelectionMerge %2634 None + OpBranchConditional %2633 %2635 %2636 + %2636 = OpLabel + %2637 = OpExtInst %float %1 Log %float_10000 + %2638 = OpFDiv %float %2637 %1065 + OpBranch %2634 + %2635 = OpLabel + %2639 = OpFSub %float %2618 %2555 + %2640 = OpFMul %float %float_3 %2639 + %2641 = OpFSub %float %2631 %2555 + %2642 = OpFDiv %float %2640 %2641 + %2643 = OpConvertFToS %int %2642 + %2644 = OpConvertSToF %float %2643 + %2645 = OpFSub %float %2642 %2644 + %2646 = OpAccessChain %_ptr_Function_float %535 %2643 + %2647 = OpLoad %float %2646 + %2648 = OpIAdd %int %2643 %int_1 + %2649 = OpAccessChain %_ptr_Function_float %535 %2648 + %2650 = OpLoad %float %2649 + %2651 = OpIAdd %int %2643 %int_2 + %2652 = OpAccessChain %_ptr_Function_float %535 %2651 + %2653 = OpLoad %float %2652 + %2654 = OpCompositeConstruct %v3float %2647 %2650 %2653 + %2655 = OpFMul %float %2645 %2645 + %2656 = OpCompositeConstruct %v3float %2655 %2645 %float_1 + %2657 = OpMatrixTimesVector %v3float %442 %2654 + %2658 = OpDot %float %2656 %2657 + OpBranch %2634 + %2634 = OpLabel + %2659 = OpPhi %float %2638 %2636 %2658 %2635 + OpBranch %2626 + %2627 = OpLabel + %2660 = OpFSub %float %2618 %2260 + %2661 = OpFMul %float %float_3 %2660 + %2662 = OpFSub %float %2555 %2260 + %2663 = OpFDiv %float %2661 %2662 + %2664 = OpConvertFToS %int %2663 + %2665 = OpConvertSToF %float %2664 + %2666 = OpFSub %float %2663 %2665 + %2667 = OpAccessChain %_ptr_Function_float %536 %2664 + %2668 = OpLoad %float %2667 + %2669 = OpIAdd %int %2664 %int_1 + %2670 = OpAccessChain %_ptr_Function_float %536 %2669 + %2671 = OpLoad %float %2670 + %2672 = OpIAdd %int %2664 %int_2 + %2673 = OpAccessChain %_ptr_Function_float %536 %2672 + %2674 = OpLoad %float %2673 + %2675 = OpCompositeConstruct %v3float %2668 %2671 %2674 + %2676 = OpFMul %float %2666 %2666 + %2677 = OpCompositeConstruct %v3float %2676 %2666 %float_1 + %2678 = OpMatrixTimesVector %v3float %442 %2675 + %2679 = OpDot %float %2677 %2678 + OpBranch %2626 + %2626 = OpLabel + %2680 = OpPhi %float %2659 %2634 %2679 %2627 + OpBranch %2620 + %2621 = OpLabel + %2681 = OpExtInst %float %1 Log %float_9_99999975en05 + %2682 = OpFDiv %float %2681 %1065 + OpBranch %2620 + %2620 = OpLabel + %2683 = OpPhi %float %2680 %2626 %2682 %2621 + %2684 = OpExtInst %float %1 Pow %float_10 %2683 + %2685 = OpCompositeExtract %float %2479 0 + OpStore %530 %479 + OpStore %529 %480 + %2686 = OpFOrdLessThanEqual %bool %2685 %float_0 + %2687 = OpSelect %float %2686 %float_9_99999975en05 %2685 + %2688 = OpExtInst %float %1 Log %2687 + %2689 = OpFDiv %float %2688 %1065 + %2690 = OpExtInst %float %1 Log %2553 + %2691 = OpFDiv %float %2690 %1065 + %2692 = OpFOrdLessThanEqual %bool %2689 %2691 + OpSelectionMerge %2693 None + OpBranchConditional %2692 %2694 %2695 + %2695 = OpLabel + %2696 = OpFOrdGreaterThan %bool %2689 %2691 + %2697 = OpExtInst %float %1 Log %2612 + %2698 = OpFDiv %float %2697 %1065 + %2699 = OpFOrdLessThan %bool %2689 %2698 + %2700 = OpLogicalAnd %bool %2696 %2699 + OpSelectionMerge %2701 None + OpBranchConditional %2700 %2702 %2703 + %2703 = OpLabel + %2704 = OpFOrdGreaterThanEqual %bool %2689 %2698 + %2705 = OpExtInst %float %1 Log %2684 + %2706 = OpFDiv %float %2705 %1065 + %2707 = OpFOrdLessThan %bool %2689 %2706 + %2708 = OpLogicalAnd %bool %2704 %2707 + OpSelectionMerge %2709 None + OpBranchConditional %2708 %2710 %2711 + %2711 = OpLabel + %2712 = OpFMul %float %2689 %float_0_0599999987 + %2713 = OpExtInst %float %1 Log %float_1000 + %2714 = OpFDiv %float %2713 %1065 + %2715 = OpFMul %float %float_0_0599999987 %2705 + %2716 = OpFDiv %float %2715 %1065 + %2717 = OpFSub %float %2714 %2716 + %2718 = OpFAdd %float %2712 %2717 + OpBranch %2709 + %2710 = OpLabel + %2719 = OpFSub %float %2689 %2698 + %2720 = OpFMul %float %float_7 %2719 + %2721 = OpFSub %float %2706 %2698 + %2722 = OpFDiv %float %2720 %2721 + %2723 = OpConvertFToS %int %2722 + %2724 = OpConvertSToF %float %2723 + %2725 = OpFSub %float %2722 %2724 + %2726 = OpAccessChain %_ptr_Function_float %529 %2723 + %2727 = OpLoad %float %2726 + %2728 = OpIAdd %int %2723 %int_1 + %2729 = OpAccessChain %_ptr_Function_float %529 %2728 + %2730 = OpLoad %float %2729 + %2731 = OpIAdd %int %2723 %int_2 + %2732 = OpAccessChain %_ptr_Function_float %529 %2731 + %2733 = OpLoad %float %2732 + %2734 = OpCompositeConstruct %v3float %2727 %2730 %2733 + %2735 = OpFMul %float %2725 %2725 + %2736 = OpCompositeConstruct %v3float %2735 %2725 %float_1 + %2737 = OpMatrixTimesVector %v3float %442 %2734 + %2738 = OpDot %float %2736 %2737 + OpBranch %2709 + %2709 = OpLabel + %2739 = OpPhi %float %2718 %2711 %2738 %2710 + OpBranch %2701 + %2702 = OpLabel + %2740 = OpFSub %float %2689 %2691 + %2741 = OpFMul %float %float_7 %2740 + %2742 = OpFSub %float %2698 %2691 + %2743 = OpFDiv %float %2741 %2742 + %2744 = OpConvertFToS %int %2743 + %2745 = OpConvertSToF %float %2744 + %2746 = OpFSub %float %2743 %2745 + %2747 = OpAccessChain %_ptr_Function_float %530 %2744 + %2748 = OpLoad %float %2747 + %2749 = OpIAdd %int %2744 %int_1 + %2750 = OpAccessChain %_ptr_Function_float %530 %2749 + %2751 = OpLoad %float %2750 + %2752 = OpIAdd %int %2744 %int_2 + %2753 = OpAccessChain %_ptr_Function_float %530 %2752 + %2754 = OpLoad %float %2753 + %2755 = OpCompositeConstruct %v3float %2748 %2751 %2754 + %2756 = OpFMul %float %2746 %2746 + %2757 = OpCompositeConstruct %v3float %2756 %2746 %float_1 + %2758 = OpMatrixTimesVector %v3float %442 %2755 + %2759 = OpDot %float %2757 %2758 + OpBranch %2701 + %2701 = OpLabel + %2760 = OpPhi %float %2739 %2709 %2759 %2702 + OpBranch %2693 + %2694 = OpLabel + %2761 = OpFMul %float %2689 %float_3 + %2762 = OpExtInst %float %1 Log %float_9_99999975en05 + %2763 = OpFDiv %float %2762 %1065 + %2764 = OpFMul %float %float_3 %2690 + %2765 = OpFDiv %float %2764 %1065 + %2766 = OpFSub %float %2763 %2765 + %2767 = OpFAdd %float %2761 %2766 + OpBranch %2693 + %2693 = OpLabel + %2768 = OpPhi %float %2760 %2701 %2767 %2694 + %2769 = OpExtInst %float %1 Pow %float_10 %2768 + %2770 = OpCompositeInsert %v3float %2769 %391 0 + %2771 = OpCompositeExtract %float %2479 1 + OpStore %528 %479 + OpStore %527 %480 + %2772 = OpFOrdLessThanEqual %bool %2771 %float_0 + %2773 = OpSelect %float %2772 %float_9_99999975en05 %2771 + %2774 = OpExtInst %float %1 Log %2773 + %2775 = OpFDiv %float %2774 %1065 + %2776 = OpFOrdLessThanEqual %bool %2775 %2691 + OpSelectionMerge %2777 None + OpBranchConditional %2776 %2778 %2779 + %2779 = OpLabel + %2780 = OpFOrdGreaterThan %bool %2775 %2691 + %2781 = OpExtInst %float %1 Log %2612 + %2782 = OpFDiv %float %2781 %1065 + %2783 = OpFOrdLessThan %bool %2775 %2782 + %2784 = OpLogicalAnd %bool %2780 %2783 + OpSelectionMerge %2785 None + OpBranchConditional %2784 %2786 %2787 + %2787 = OpLabel + %2788 = OpFOrdGreaterThanEqual %bool %2775 %2782 + %2789 = OpExtInst %float %1 Log %2684 + %2790 = OpFDiv %float %2789 %1065 + %2791 = OpFOrdLessThan %bool %2775 %2790 + %2792 = OpLogicalAnd %bool %2788 %2791 + OpSelectionMerge %2793 None + OpBranchConditional %2792 %2794 %2795 + %2795 = OpLabel + %2796 = OpFMul %float %2775 %float_0_0599999987 + %2797 = OpExtInst %float %1 Log %float_1000 + %2798 = OpFDiv %float %2797 %1065 + %2799 = OpFMul %float %float_0_0599999987 %2789 + %2800 = OpFDiv %float %2799 %1065 + %2801 = OpFSub %float %2798 %2800 + %2802 = OpFAdd %float %2796 %2801 + OpBranch %2793 + %2794 = OpLabel + %2803 = OpFSub %float %2775 %2782 + %2804 = OpFMul %float %float_7 %2803 + %2805 = OpFSub %float %2790 %2782 + %2806 = OpFDiv %float %2804 %2805 + %2807 = OpConvertFToS %int %2806 + %2808 = OpConvertSToF %float %2807 + %2809 = OpFSub %float %2806 %2808 + %2810 = OpAccessChain %_ptr_Function_float %527 %2807 + %2811 = OpLoad %float %2810 + %2812 = OpIAdd %int %2807 %int_1 + %2813 = OpAccessChain %_ptr_Function_float %527 %2812 + %2814 = OpLoad %float %2813 + %2815 = OpIAdd %int %2807 %int_2 + %2816 = OpAccessChain %_ptr_Function_float %527 %2815 + %2817 = OpLoad %float %2816 + %2818 = OpCompositeConstruct %v3float %2811 %2814 %2817 + %2819 = OpFMul %float %2809 %2809 + %2820 = OpCompositeConstruct %v3float %2819 %2809 %float_1 + %2821 = OpMatrixTimesVector %v3float %442 %2818 + %2822 = OpDot %float %2820 %2821 + OpBranch %2793 + %2793 = OpLabel + %2823 = OpPhi %float %2802 %2795 %2822 %2794 + OpBranch %2785 + %2786 = OpLabel + %2824 = OpFSub %float %2775 %2691 + %2825 = OpFMul %float %float_7 %2824 + %2826 = OpFSub %float %2782 %2691 + %2827 = OpFDiv %float %2825 %2826 + %2828 = OpConvertFToS %int %2827 + %2829 = OpConvertSToF %float %2828 + %2830 = OpFSub %float %2827 %2829 + %2831 = OpAccessChain %_ptr_Function_float %528 %2828 + %2832 = OpLoad %float %2831 + %2833 = OpIAdd %int %2828 %int_1 + %2834 = OpAccessChain %_ptr_Function_float %528 %2833 + %2835 = OpLoad %float %2834 + %2836 = OpIAdd %int %2828 %int_2 + %2837 = OpAccessChain %_ptr_Function_float %528 %2836 + %2838 = OpLoad %float %2837 + %2839 = OpCompositeConstruct %v3float %2832 %2835 %2838 + %2840 = OpFMul %float %2830 %2830 + %2841 = OpCompositeConstruct %v3float %2840 %2830 %float_1 + %2842 = OpMatrixTimesVector %v3float %442 %2839 + %2843 = OpDot %float %2841 %2842 + OpBranch %2785 + %2785 = OpLabel + %2844 = OpPhi %float %2823 %2793 %2843 %2786 + OpBranch %2777 + %2778 = OpLabel + %2845 = OpFMul %float %2775 %float_3 + %2846 = OpExtInst %float %1 Log %float_9_99999975en05 + %2847 = OpFDiv %float %2846 %1065 + %2848 = OpFMul %float %float_3 %2690 + %2849 = OpFDiv %float %2848 %1065 + %2850 = OpFSub %float %2847 %2849 + %2851 = OpFAdd %float %2845 %2850 + OpBranch %2777 + %2777 = OpLabel + %2852 = OpPhi %float %2844 %2785 %2851 %2778 + %2853 = OpExtInst %float %1 Pow %float_10 %2852 + %2854 = OpCompositeInsert %v3float %2853 %2770 1 + %2855 = OpCompositeExtract %float %2479 2 + OpStore %526 %479 + OpStore %525 %480 + %2856 = OpFOrdLessThanEqual %bool %2855 %float_0 + %2857 = OpSelect %float %2856 %float_9_99999975en05 %2855 + %2858 = OpExtInst %float %1 Log %2857 + %2859 = OpFDiv %float %2858 %1065 + %2860 = OpFOrdLessThanEqual %bool %2859 %2691 + OpSelectionMerge %2861 None + OpBranchConditional %2860 %2862 %2863 + %2863 = OpLabel + %2864 = OpFOrdGreaterThan %bool %2859 %2691 + %2865 = OpExtInst %float %1 Log %2612 + %2866 = OpFDiv %float %2865 %1065 + %2867 = OpFOrdLessThan %bool %2859 %2866 + %2868 = OpLogicalAnd %bool %2864 %2867 + OpSelectionMerge %2869 None + OpBranchConditional %2868 %2870 %2871 + %2871 = OpLabel + %2872 = OpFOrdGreaterThanEqual %bool %2859 %2866 + %2873 = OpExtInst %float %1 Log %2684 + %2874 = OpFDiv %float %2873 %1065 + %2875 = OpFOrdLessThan %bool %2859 %2874 + %2876 = OpLogicalAnd %bool %2872 %2875 + OpSelectionMerge %2877 None + OpBranchConditional %2876 %2878 %2879 + %2879 = OpLabel + %2880 = OpFMul %float %2859 %float_0_0599999987 + %2881 = OpExtInst %float %1 Log %float_1000 + %2882 = OpFDiv %float %2881 %1065 + %2883 = OpFMul %float %float_0_0599999987 %2873 + %2884 = OpFDiv %float %2883 %1065 + %2885 = OpFSub %float %2882 %2884 + %2886 = OpFAdd %float %2880 %2885 + OpBranch %2877 + %2878 = OpLabel + %2887 = OpFSub %float %2859 %2866 + %2888 = OpFMul %float %float_7 %2887 + %2889 = OpFSub %float %2874 %2866 + %2890 = OpFDiv %float %2888 %2889 + %2891 = OpConvertFToS %int %2890 + %2892 = OpConvertSToF %float %2891 + %2893 = OpFSub %float %2890 %2892 + %2894 = OpAccessChain %_ptr_Function_float %525 %2891 + %2895 = OpLoad %float %2894 + %2896 = OpIAdd %int %2891 %int_1 + %2897 = OpAccessChain %_ptr_Function_float %525 %2896 + %2898 = OpLoad %float %2897 + %2899 = OpIAdd %int %2891 %int_2 + %2900 = OpAccessChain %_ptr_Function_float %525 %2899 + %2901 = OpLoad %float %2900 + %2902 = OpCompositeConstruct %v3float %2895 %2898 %2901 + %2903 = OpFMul %float %2893 %2893 + %2904 = OpCompositeConstruct %v3float %2903 %2893 %float_1 + %2905 = OpMatrixTimesVector %v3float %442 %2902 + %2906 = OpDot %float %2904 %2905 + OpBranch %2877 + %2877 = OpLabel + %2907 = OpPhi %float %2886 %2879 %2906 %2878 + OpBranch %2869 + %2870 = OpLabel + %2908 = OpFSub %float %2859 %2691 + %2909 = OpFMul %float %float_7 %2908 + %2910 = OpFSub %float %2866 %2691 + %2911 = OpFDiv %float %2909 %2910 + %2912 = OpConvertFToS %int %2911 + %2913 = OpConvertSToF %float %2912 + %2914 = OpFSub %float %2911 %2913 + %2915 = OpAccessChain %_ptr_Function_float %526 %2912 + %2916 = OpLoad %float %2915 + %2917 = OpIAdd %int %2912 %int_1 + %2918 = OpAccessChain %_ptr_Function_float %526 %2917 + %2919 = OpLoad %float %2918 + %2920 = OpIAdd %int %2912 %int_2 + %2921 = OpAccessChain %_ptr_Function_float %526 %2920 + %2922 = OpLoad %float %2921 + %2923 = OpCompositeConstruct %v3float %2916 %2919 %2922 + %2924 = OpFMul %float %2914 %2914 + %2925 = OpCompositeConstruct %v3float %2924 %2914 %float_1 + %2926 = OpMatrixTimesVector %v3float %442 %2923 + %2927 = OpDot %float %2925 %2926 + OpBranch %2869 + %2869 = OpLabel + %2928 = OpPhi %float %2907 %2877 %2927 %2870 + OpBranch %2861 + %2862 = OpLabel + %2929 = OpFMul %float %2859 %float_3 + %2930 = OpExtInst %float %1 Log %float_9_99999975en05 + %2931 = OpFDiv %float %2930 %1065 + %2932 = OpFMul %float %float_3 %2690 + %2933 = OpFDiv %float %2932 %1065 + %2934 = OpFSub %float %2931 %2933 + %2935 = OpFAdd %float %2929 %2934 + OpBranch %2861 + %2861 = OpLabel + %2936 = OpPhi %float %2928 %2869 %2935 %2862 + %2937 = OpExtInst %float %1 Pow %float_10 %2936 + %2938 = OpCompositeInsert %v3float %2937 %2854 2 + %2939 = OpFSub %v3float %2938 %338 + %2940 = OpVectorTimesMatrix %v3float %2939 %576 + %2941 = OpFMul %v3float %2940 %496 + %2942 = OpExtInst %v3float %1 Pow %2941 %263 + %2943 = OpFMul %v3float %184 %2942 + %2944 = OpFAdd %v3float %183 %2943 + %2945 = OpFMul %v3float %185 %2942 + %2946 = OpFAdd %v3float %135 %2945 + %2947 = OpFDiv %v3float %135 %2946 + %2948 = OpFMul %v3float %2944 %2947 + %2949 = OpExtInst %v3float %1 Pow %2948 %264 + OpBranch %1230 + %1230 = OpLabel + %2950 = OpPhi %v3float %2097 %1236 %2949 %2861 + OpBranch %1224 + %1225 = OpLabel + %2951 = OpVectorTimesMatrix %v3float %1218 %547 + %2952 = OpVectorTimesMatrix %v3float %2951 %576 + %2953 = OpExtInst %v3float %1 FMax %250 %2952 + %2954 = OpFMul %v3float %2953 %252 + %2955 = OpExtInst %v3float %1 FMax %2953 %254 + %2956 = OpExtInst %v3float %1 Pow %2955 %256 + %2957 = OpFMul %v3float %2956 %258 + %2958 = OpFSub %v3float %2957 %260 + %2959 = OpExtInst %v3float %1 FMin %2954 %2958 + OpBranch %1224 + %1224 = OpLabel + %2960 = OpPhi %v3float %2950 %1230 %2959 %1225 + OpBranch %1220 + %1221 = OpLabel + %2961 = OpCompositeExtract %float %1218 0 + OpBranch %2962 + %2962 = OpLabel + OpLoopMerge %2963 %2964 None + OpBranch %2965 + %2965 = OpLabel + %2966 = OpFOrdLessThan %bool %2961 %float_0_00313066994 + OpSelectionMerge %2967 None + OpBranchConditional %2966 %2968 %2967 + %2968 = OpLabel + %2969 = OpFMul %float %2961 %float_12_9200001 + OpBranch %2963 + %2967 = OpLabel + %2970 = OpExtInst %float %1 Pow %2961 %float_0_416666657 + %2971 = OpFMul %float %2970 %float_1_05499995 + %2972 = OpFSub %float %2971 %float_0_0549999997 + OpBranch %2963 + %2964 = OpLabel + OpBranch %2962 + %2963 = OpLabel + %2973 = OpPhi %float %2969 %2968 %2972 %2967 + %2974 = OpCompositeExtract %float %1218 1 + OpBranch %2975 + %2975 = OpLabel + OpLoopMerge %2976 %2977 None + OpBranch %2978 + %2978 = OpLabel + %2979 = OpFOrdLessThan %bool %2974 %float_0_00313066994 + OpSelectionMerge %2980 None + OpBranchConditional %2979 %2981 %2980 + %2981 = OpLabel + %2982 = OpFMul %float %2974 %float_12_9200001 + OpBranch %2976 + %2980 = OpLabel + %2983 = OpExtInst %float %1 Pow %2974 %float_0_416666657 + %2984 = OpFMul %float %2983 %float_1_05499995 + %2985 = OpFSub %float %2984 %float_0_0549999997 + OpBranch %2976 + %2977 = OpLabel + OpBranch %2975 + %2976 = OpLabel + %2986 = OpPhi %float %2982 %2981 %2985 %2980 + %2987 = OpCompositeExtract %float %1218 2 + OpBranch %2988 + %2988 = OpLabel + OpLoopMerge %2989 %2990 None + OpBranch %2991 + %2991 = OpLabel + %2992 = OpFOrdLessThan %bool %2987 %float_0_00313066994 + OpSelectionMerge %2993 None + OpBranchConditional %2992 %2994 %2993 + %2994 = OpLabel + %2995 = OpFMul %float %2987 %float_12_9200001 + OpBranch %2989 + %2993 = OpLabel + %2996 = OpExtInst %float %1 Pow %2987 %float_0_416666657 + %2997 = OpFMul %float %2996 %float_1_05499995 + %2998 = OpFSub %float %2997 %float_0_0549999997 + OpBranch %2989 + %2990 = OpLabel + OpBranch %2988 + %2989 = OpLabel + %2999 = OpPhi %float %2995 %2994 %2998 %2993 + %3000 = OpCompositeConstruct %v3float %2973 %2986 %2999 + OpBranch %1220 + %1220 = OpLabel + %3001 = OpPhi %v3float %2960 %1224 %3000 %2989 + %3002 = OpFMul %v3float %3001 %499 + %3003 = OpVectorShuffle %v4float %129 %3002 4 5 6 3 + %3004 = OpCompositeInsert %v4float %float_0 %3003 3 + OpStore %out_var_SV_Target0 %3004 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag new file mode 100644 index 0000000000..e0359bfdd3 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag @@ -0,0 +1,3694 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 3107 +; Schema: 0 + OpCapability Shader + OpCapability Geometry + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainPS "main" %in_var_TEXCOORD0 %gl_FragCoord %gl_Layer %out_var_SV_Target0 + OpExecutionMode %MainPS OriginUpperLeft + OpSource HLSL 600 + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "MappingPolynomial" + OpMemberName %type__Globals 1 "InverseGamma" + OpMemberName %type__Globals 2 "ColorMatrixR_ColorCurveCd1" + OpMemberName %type__Globals 3 "ColorMatrixG_ColorCurveCd3Cm3" + OpMemberName %type__Globals 4 "ColorMatrixB_ColorCurveCm2" + OpMemberName %type__Globals 5 "ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3" + OpMemberName %type__Globals 6 "ColorCurve_Ch1_Ch2" + OpMemberName %type__Globals 7 "ColorShadow_Luma" + OpMemberName %type__Globals 8 "ColorShadow_Tint1" + OpMemberName %type__Globals 9 "ColorShadow_Tint2" + OpMemberName %type__Globals 10 "FilmSlope" + OpMemberName %type__Globals 11 "FilmToe" + OpMemberName %type__Globals 12 "FilmShoulder" + OpMemberName %type__Globals 13 "FilmBlackClip" + OpMemberName %type__Globals 14 "FilmWhiteClip" + OpMemberName %type__Globals 15 "LUTWeights" + OpMemberName %type__Globals 16 "ColorScale" + OpMemberName %type__Globals 17 "OverlayColor" + OpMemberName %type__Globals 18 "WhiteTemp" + OpMemberName %type__Globals 19 "WhiteTint" + OpMemberName %type__Globals 20 "ColorSaturation" + OpMemberName %type__Globals 21 "ColorContrast" + OpMemberName %type__Globals 22 "ColorGamma" + OpMemberName %type__Globals 23 "ColorGain" + OpMemberName %type__Globals 24 "ColorOffset" + OpMemberName %type__Globals 25 "ColorSaturationShadows" + OpMemberName %type__Globals 26 "ColorContrastShadows" + OpMemberName %type__Globals 27 "ColorGammaShadows" + OpMemberName %type__Globals 28 "ColorGainShadows" + OpMemberName %type__Globals 29 "ColorOffsetShadows" + OpMemberName %type__Globals 30 "ColorSaturationMidtones" + OpMemberName %type__Globals 31 "ColorContrastMidtones" + OpMemberName %type__Globals 32 "ColorGammaMidtones" + OpMemberName %type__Globals 33 "ColorGainMidtones" + OpMemberName %type__Globals 34 "ColorOffsetMidtones" + OpMemberName %type__Globals 35 "ColorSaturationHighlights" + OpMemberName %type__Globals 36 "ColorContrastHighlights" + OpMemberName %type__Globals 37 "ColorGammaHighlights" + OpMemberName %type__Globals 38 "ColorGainHighlights" + OpMemberName %type__Globals 39 "ColorOffsetHighlights" + OpMemberName %type__Globals 40 "ColorCorrectionShadowsMax" + OpMemberName %type__Globals 41 "ColorCorrectionHighlightsMin" + OpMemberName %type__Globals 42 "OutputDevice" + OpMemberName %type__Globals 43 "OutputGamut" + OpMemberName %type__Globals 44 "BlueCorrection" + OpMemberName %type__Globals 45 "ExpandGamut" + OpName %_Globals "$Globals" + OpName %type_2d_image "type.2d.image" + OpName %Texture1 "Texture1" + OpName %type_sampler "type.sampler" + OpName %Texture1Sampler "Texture1Sampler" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainPS "MainPS" + OpName %type_sampled_image "type.sampled.image" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorate %in_var_TEXCOORD0 NoPerspective + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorate %gl_Layer BuiltIn Layer + OpDecorateString %gl_Layer UserSemantic "SV_RenderTargetArrayIndex" + OpDecorate %gl_Layer Flat + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 0 + OpDecorate %Texture1 DescriptorSet 0 + OpDecorate %Texture1 Binding 0 + OpDecorate %Texture1Sampler DescriptorSet 0 + OpDecorate %Texture1Sampler Binding 0 + OpDecorate %_arr_float_uint_5 ArrayStride 16 + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 48 + OpMemberDecorate %type__Globals 4 Offset 64 + OpMemberDecorate %type__Globals 5 Offset 80 + OpMemberDecorate %type__Globals 6 Offset 96 + OpMemberDecorate %type__Globals 7 Offset 112 + OpMemberDecorate %type__Globals 8 Offset 128 + OpMemberDecorate %type__Globals 9 Offset 144 + OpMemberDecorate %type__Globals 10 Offset 160 + OpMemberDecorate %type__Globals 11 Offset 164 + OpMemberDecorate %type__Globals 12 Offset 168 + OpMemberDecorate %type__Globals 13 Offset 172 + OpMemberDecorate %type__Globals 14 Offset 176 + OpMemberDecorate %type__Globals 15 Offset 192 + OpMemberDecorate %type__Globals 16 Offset 272 + OpMemberDecorate %type__Globals 17 Offset 288 + OpMemberDecorate %type__Globals 18 Offset 304 + OpMemberDecorate %type__Globals 19 Offset 308 + OpMemberDecorate %type__Globals 20 Offset 320 + OpMemberDecorate %type__Globals 21 Offset 336 + OpMemberDecorate %type__Globals 22 Offset 352 + OpMemberDecorate %type__Globals 23 Offset 368 + OpMemberDecorate %type__Globals 24 Offset 384 + OpMemberDecorate %type__Globals 25 Offset 400 + OpMemberDecorate %type__Globals 26 Offset 416 + OpMemberDecorate %type__Globals 27 Offset 432 + OpMemberDecorate %type__Globals 28 Offset 448 + OpMemberDecorate %type__Globals 29 Offset 464 + OpMemberDecorate %type__Globals 30 Offset 480 + OpMemberDecorate %type__Globals 31 Offset 496 + OpMemberDecorate %type__Globals 32 Offset 512 + OpMemberDecorate %type__Globals 33 Offset 528 + OpMemberDecorate %type__Globals 34 Offset 544 + OpMemberDecorate %type__Globals 35 Offset 560 + OpMemberDecorate %type__Globals 36 Offset 576 + OpMemberDecorate %type__Globals 37 Offset 592 + OpMemberDecorate %type__Globals 38 Offset 608 + OpMemberDecorate %type__Globals 39 Offset 624 + OpMemberDecorate %type__Globals 40 Offset 640 + OpMemberDecorate %type__Globals 41 Offset 644 + OpMemberDecorate %type__Globals 42 Offset 648 + OpMemberDecorate %type__Globals 43 Offset 652 + OpMemberDecorate %type__Globals 44 Offset 656 + OpMemberDecorate %type__Globals 45 Offset 660 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 +%float_0_952552378 = OpConstant %float 0.952552378 + %float_0 = OpConstant %float 0 + +; HACK: Needed to hack this constant since MSVC and GNU libc are off by 1 ULP when converting to string (it probably still works fine though in a roundtrip ...) +%float_9_36786018en05 = OpConstant %float 9.25 + +%float_0_343966454 = OpConstant %float 0.343966454 +%float_0_728166103 = OpConstant %float 0.728166103 +%float_n0_0721325427 = OpConstant %float -0.0721325427 +%float_1_00882518 = OpConstant %float 1.00882518 +%float_1_04981101 = OpConstant %float 1.04981101 +%float_n9_74845025en05 = OpConstant %float -9.74845025e-05 +%float_n0_495903015 = OpConstant %float -0.495903015 +%float_1_37331307 = OpConstant %float 1.37331307 +%float_0_0982400328 = OpConstant %float 0.0982400328 +%float_0_991252005 = OpConstant %float 0.991252005 +%float_0_662454188 = OpConstant %float 0.662454188 +%float_0_134004205 = OpConstant %float 0.134004205 +%float_0_156187683 = OpConstant %float 0.156187683 +%float_0_272228718 = OpConstant %float 0.272228718 +%float_0_674081743 = OpConstant %float 0.674081743 +%float_0_0536895171 = OpConstant %float 0.0536895171 +%float_n0_00557464967 = OpConstant %float -0.00557464967 +%float_0_0040607336 = OpConstant %float 0.0040607336 +%float_1_01033914 = OpConstant %float 1.01033914 +%float_1_6410234 = OpConstant %float 1.6410234 +%float_n0_324803293 = OpConstant %float -0.324803293 +%float_n0_236424699 = OpConstant %float -0.236424699 +%float_n0_663662851 = OpConstant %float -0.663662851 +%float_1_61533165 = OpConstant %float 1.61533165 +%float_0_0167563483 = OpConstant %float 0.0167563483 +%float_0_0117218941 = OpConstant %float 0.0117218941 +%float_n0_00828444213 = OpConstant %float -0.00828444213 +%float_0_988394856 = OpConstant %float 0.988394856 +%float_1_45143926 = OpConstant %float 1.45143926 +%float_n0_236510754 = OpConstant %float -0.236510754 +%float_n0_214928567 = OpConstant %float -0.214928567 +%float_n0_0765537769 = OpConstant %float -0.0765537769 +%float_1_17622972 = OpConstant %float 1.17622972 +%float_n0_0996759236 = OpConstant %float -0.0996759236 +%float_0_00831614807 = OpConstant %float 0.00831614807 +%float_n0_00603244966 = OpConstant %float -0.00603244966 +%float_0_997716308 = OpConstant %float 0.997716308 +%float_0_695452213 = OpConstant %float 0.695452213 +%float_0_140678704 = OpConstant %float 0.140678704 +%float_0_163869068 = OpConstant %float 0.163869068 +%float_0_0447945632 = OpConstant %float 0.0447945632 +%float_0_859671116 = OpConstant %float 0.859671116 +%float_0_0955343172 = OpConstant %float 0.0955343172 +%float_n0_00552588282 = OpConstant %float -0.00552588282 +%float_0_00402521016 = OpConstant %float 0.00402521016 +%float_1_00150073 = OpConstant %float 1.00150073 + %73 = OpConstantComposite %v3float %float_0_272228718 %float_0_674081743 %float_0_0536895171 +%float_3_2409699 = OpConstant %float 3.2409699 +%float_n1_5373832 = OpConstant %float -1.5373832 +%float_n0_498610765 = OpConstant %float -0.498610765 +%float_n0_969243646 = OpConstant %float -0.969243646 +%float_1_8759675 = OpConstant %float 1.8759675 +%float_0_0415550582 = OpConstant %float 0.0415550582 +%float_0_0556300804 = OpConstant %float 0.0556300804 +%float_n0_203976959 = OpConstant %float -0.203976959 +%float_1_05697155 = OpConstant %float 1.05697155 +%float_0_412456393 = OpConstant %float 0.412456393 +%float_0_357576102 = OpConstant %float 0.357576102 +%float_0_180437505 = OpConstant %float 0.180437505 +%float_0_212672904 = OpConstant %float 0.212672904 +%float_0_715152204 = OpConstant %float 0.715152204 +%float_0_0721750036 = OpConstant %float 0.0721750036 +%float_0_0193339009 = OpConstant %float 0.0193339009 +%float_0_119191997 = OpConstant %float 0.119191997 +%float_0_950304091 = OpConstant %float 0.950304091 +%float_1_71660841 = OpConstant %float 1.71660841 +%float_n0_355662107 = OpConstant %float -0.355662107 +%float_n0_253360093 = OpConstant %float -0.253360093 +%float_n0_666682899 = OpConstant %float -0.666682899 +%float_1_61647761 = OpConstant %float 1.61647761 +%float_0_0157685 = OpConstant %float 0.0157685 +%float_0_0176422 = OpConstant %float 0.0176422 +%float_n0_0427763015 = OpConstant %float -0.0427763015 +%float_0_942228675 = OpConstant %float 0.942228675 +%float_2_49339628 = OpConstant %float 2.49339628 +%float_n0_93134588 = OpConstant %float -0.93134588 +%float_n0_402694494 = OpConstant %float -0.402694494 +%float_n0_829486787 = OpConstant %float -0.829486787 +%float_1_76265967 = OpConstant %float 1.76265967 +%float_0_0236246008 = OpConstant %float 0.0236246008 +%float_0_0358507 = OpConstant %float 0.0358507 +%float_n0_0761827007 = OpConstant %float -0.0761827007 +%float_0_957014024 = OpConstant %float 0.957014024 +%float_1_01303005 = OpConstant %float 1.01303005 +%float_0_00610530982 = OpConstant %float 0.00610530982 +%float_n0_0149710001 = OpConstant %float -0.0149710001 +%float_0_00769822998 = OpConstant %float 0.00769822998 +%float_0_998165011 = OpConstant %float 0.998165011 +%float_n0_00503202993 = OpConstant %float -0.00503202993 +%float_n0_00284131011 = OpConstant %float -0.00284131011 +%float_0_00468515977 = OpConstant %float 0.00468515977 +%float_0_924507022 = OpConstant %float 0.924507022 +%float_0_987223983 = OpConstant %float 0.987223983 +%float_n0_00611326983 = OpConstant %float -0.00611326983 +%float_0_0159533005 = OpConstant %float 0.0159533005 +%float_n0_00759836007 = OpConstant %float -0.00759836007 +%float_1_00186002 = OpConstant %float 1.00186002 +%float_0_0053300201 = OpConstant %float 0.0053300201 +%float_0_00307257008 = OpConstant %float 0.00307257008 +%float_n0_00509594986 = OpConstant %float -0.00509594986 +%float_1_08168006 = OpConstant %float 1.08168006 + %float_0_5 = OpConstant %float 0.5 + %float_n1 = OpConstant %float -1 + %float_1 = OpConstant %float 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%float_0_015625 = OpConstant %float 0.015625 + %134 = OpConstantComposite %v2float %float_0_015625 %float_0_015625 + %135 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_43 = OpConstant %int 43 + %uint_3 = OpConstant %uint 3 + %138 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_9 = OpConstant %int 9 + %int_3 = OpConstant %int 3 + %141 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_n4 = OpConstant %float -4 + %int_45 = OpConstant %int 45 +%float_0_544169128 = OpConstant %float 0.544169128 +%float_0_239592597 = OpConstant %float 0.239592597 +%float_0_166694298 = OpConstant %float 0.166694298 +%float_0_239465594 = OpConstant %float 0.239465594 +%float_0_702153027 = OpConstant %float 0.702153027 +%float_0_058381401 = OpConstant %float 0.058381401 +%float_n0_00234390004 = OpConstant %float -0.00234390004 +%float_0_0361833982 = OpConstant %float 0.0361833982 +%float_1_05521834 = OpConstant %float 1.05521834 +%float_0_940437257 = OpConstant %float 0.940437257 +%float_n0_0183068793 = OpConstant %float -0.0183068793 +%float_0_077869609 = OpConstant %float 0.077869609 +%float_0_00837869663 = OpConstant %float 0.00837869663 +%float_0_828660011 = OpConstant %float 0.828660011 +%float_0_162961304 = OpConstant %float 0.162961304 +%float_0_00054712611 = OpConstant %float 0.00054712611 +%float_n0_000883374596 = OpConstant %float -0.000883374596 +%float_1_00033629 = OpConstant %float 1.00033629 +%float_1_06317997 = OpConstant %float 1.06317997 +%float_0_0233955998 = OpConstant %float 0.0233955998 +%float_n0_0865726024 = OpConstant %float -0.0865726024 +%float_n0_0106336996 = OpConstant %float -0.0106336996 +%float_1_20632005 = OpConstant %float 1.20632005 +%float_n0_195690006 = OpConstant %float -0.195690006 +%float_n0_000590886979 = OpConstant %float -0.000590886979 +%float_0_00105247996 = OpConstant %float 0.00105247996 +%float_0_999538004 = OpConstant %float 0.999538004 + %int_44 = OpConstant %int 44 +%float_0_9375 = OpConstant %float 0.9375 + %173 = OpConstantComposite %v3float %float_0_9375 %float_0_9375 %float_0_9375 +%float_0_03125 = OpConstant %float 0.03125 + %175 = OpConstantComposite %v3float %float_0_03125 %float_0_03125 %float_0_03125 + %int_15 = OpConstant %int 15 + %float_16 = OpConstant %float 16 + %int_16 = OpConstant %int 16 + %int_17 = OpConstant %int 17 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_5 = OpConstant %uint 5 + %uint_6 = OpConstant %uint 6 + %int_2 = OpConstant %int 2 +%mat3v3float = OpTypeMatrix %v3float 3 + %int_42 = OpConstant %int 42 +%float_0_159301758 = OpConstant %float 0.159301758 +%float_78_84375 = OpConstant %float 78.84375 +%float_0_8359375 = OpConstant %float 0.8359375 +%float_18_8515625 = OpConstant %float 18.8515625 +%float_18_6875 = OpConstant %float 18.6875 +%float_10000 = OpConstant %float 10000 +%float_0_0126833133 = OpConstant %float 0.0126833133 + %194 = OpConstantComposite %v3float %float_0_0126833133 %float_0_0126833133 %float_0_0126833133 + %195 = OpConstantComposite %v3float %float_0_8359375 %float_0_8359375 %float_0_8359375 + %196 = OpConstantComposite %v3float %float_18_8515625 %float_18_8515625 %float_18_8515625 + %197 = OpConstantComposite %v3float %float_18_6875 %float_18_6875 %float_18_6875 +%float_6_27739477 = OpConstant %float 6.27739477 + %199 = OpConstantComposite %v3float %float_6_27739477 %float_6_27739477 %float_6_27739477 + %200 = OpConstantComposite %v3float %float_10000 %float_10000 %float_10000 + %float_14 = OpConstant %float 14 +%float_0_180000007 = OpConstant %float 0.180000007 +%float_0_434017599 = OpConstant %float 0.434017599 + %204 = OpConstantComposite %v3float %float_0_434017599 %float_0_434017599 %float_0_434017599 + %205 = OpConstantComposite %v3float %float_14 %float_14 %float_14 + %206 = OpConstantComposite %v3float %float_0_180000007 %float_0_180000007 %float_0_180000007 + %int_18 = OpConstant %int 18 + %float_4000 = OpConstant %float 4000 +%float_0_312700003 = OpConstant %float 0.312700003 +%float_0_328999996 = OpConstant %float 0.328999996 + %int_19 = OpConstant %int 19 + %int_25 = OpConstant %int 25 + %int_20 = OpConstant %int 20 + %int_26 = OpConstant %int 26 + %int_21 = OpConstant %int 21 + %int_27 = OpConstant %int 27 + %int_22 = OpConstant %int 22 + %int_28 = OpConstant %int 28 + %int_23 = OpConstant %int 23 + %int_29 = OpConstant %int 29 + %int_24 = OpConstant %int 24 + %int_40 = OpConstant %int 40 + %int_35 = OpConstant %int 35 + %int_36 = OpConstant %int 36 + %int_37 = OpConstant %int 37 + %int_38 = OpConstant %int 38 + %int_39 = OpConstant %int 39 + %int_41 = OpConstant %int 41 + %int_30 = OpConstant %int 30 + %int_31 = OpConstant %int 31 + %int_32 = OpConstant %int 32 + %int_33 = OpConstant %int 33 + %int_34 = OpConstant %int 34 +%float_0_0500000007 = OpConstant %float 0.0500000007 + %float_1_75 = OpConstant %float 1.75 +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_819999993 = OpConstant %float 0.819999993 +%float_0_0299999993 = OpConstant %float 0.0299999993 + %float_2 = OpConstant %float 2 +%float_0_959999979 = OpConstant %float 0.959999979 + %241 = OpConstantComposite %v3float %float_0_959999979 %float_0_959999979 %float_0_959999979 + %int_13 = OpConstant %int 13 + %int_11 = OpConstant %int 11 + %int_14 = OpConstant %int 14 + %int_12 = OpConstant %int 12 +%float_0_800000012 = OpConstant %float 0.800000012 + %int_10 = OpConstant %int 10 + %float_10 = OpConstant %float 10 + %float_n2 = OpConstant %float -2 + %float_3 = OpConstant %float 3 + %251 = OpConstantComposite %v3float %float_3 %float_3 %float_3 + %252 = OpConstantComposite %v3float %float_2 %float_2 %float_2 +%float_0_930000007 = OpConstant %float 0.930000007 + %254 = OpConstantComposite %v3float %float_0_930000007 %float_0_930000007 %float_0_930000007 + %int_4 = OpConstant %int 4 + %int_8 = OpConstant %int 8 + %int_7 = OpConstant %int 7 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 +%float_0_00200000009 = OpConstant %float 0.00200000009 + %261 = OpConstantComposite %v3float %float_0_00200000009 %float_0_00200000009 %float_0_00200000009 +%float_6_10351999en05 = OpConstant %float 6.10351999e-05 + %263 = OpConstantComposite %v3float %float_6_10351999en05 %float_6_10351999en05 %float_6_10351999en05 +%float_0_0404499993 = OpConstant %float 0.0404499993 + %265 = OpConstantComposite %v3float %float_0_0404499993 %float_0_0404499993 %float_0_0404499993 +%float_0_947867274 = OpConstant %float 0.947867274 + %267 = OpConstantComposite %v3float %float_0_947867274 %float_0_947867274 %float_0_947867274 +%float_0_0521326996 = OpConstant %float 0.0521326996 + %269 = OpConstantComposite %v3float %float_0_0521326996 %float_0_0521326996 %float_0_0521326996 +%float_2_4000001 = OpConstant %float 2.4000001 + %271 = OpConstantComposite %v3float %float_2_4000001 %float_2_4000001 %float_2_4000001 +%float_0_0773993805 = OpConstant %float 0.0773993805 + %273 = OpConstantComposite %v3float %float_0_0773993805 %float_0_0773993805 %float_0_0773993805 + %float_4_5 = OpConstant %float 4.5 + %275 = OpConstantComposite %v3float %float_4_5 %float_4_5 %float_4_5 +%float_0_0179999992 = OpConstant %float 0.0179999992 + %277 = OpConstantComposite %v3float %float_0_0179999992 %float_0_0179999992 %float_0_0179999992 +%float_0_449999988 = OpConstant %float 0.449999988 + %279 = OpConstantComposite %v3float %float_0_449999988 %float_0_449999988 %float_0_449999988 +%float_1_09899998 = OpConstant %float 1.09899998 + %281 = OpConstantComposite %v3float %float_1_09899998 %float_1_09899998 %float_1_09899998 +%float_0_0989999995 = OpConstant %float 0.0989999995 + %283 = OpConstantComposite %v3float %float_0_0989999995 %float_0_0989999995 %float_0_0989999995 + %float_1_5 = OpConstant %float 1.5 + %285 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5 + %286 = OpConstantComposite %v3float %float_0_159301758 %float_0_159301758 %float_0_159301758 + %287 = OpConstantComposite %v3float %float_78_84375 %float_78_84375 %float_78_84375 +%float_1_00055635 = OpConstant %float 1.00055635 + %float_7000 = OpConstant %float 7000 +%float_0_244063005 = OpConstant %float 0.244063005 +%float_99_1100006 = OpConstant %float 99.1100006 +%float_2967800 = OpConstant %float 2967800 +%float_0_237039998 = OpConstant %float 0.237039998 +%float_247_479996 = OpConstant %float 247.479996 +%float_1901800 = OpConstant %float 1901800 + %float_n3 = OpConstant %float -3 +%float_2_86999989 = OpConstant %float 2.86999989 +%float_0_275000006 = OpConstant %float 0.275000006 +%float_0_860117733 = OpConstant %float 0.860117733 +%float_0_000154118257 = OpConstant %float 0.000154118257 +%float_1_28641219en07 = OpConstant %float 1.28641219e-07 +%float_0_00084242021 = OpConstant %float 0.00084242021 +%float_7_08145137en07 = OpConstant %float 7.08145137e-07 +%float_0_317398727 = OpConstant %float 0.317398727 + +; HACK: Needed to hack this constant since MSVC and GNU libc are off by 1 ULP when converting to string (it probably still works fine though in a roundtrip ...) +%float_4_22806261en05 = OpConstant %float 4.25 + +%float_4_20481676en08 = OpConstant %float 4.20481676e-08 +%float_2_8974182en05 = OpConstant %float 2.8974182e-05 +%float_1_61456057en07 = OpConstant %float 1.61456057e-07 + %float_8 = OpConstant %float 8 + %float_4 = OpConstant %float 4 +%float_0_895099998 = OpConstant %float 0.895099998 +%float_0_266400009 = OpConstant %float 0.266400009 +%float_n0_161400005 = OpConstant %float -0.161400005 +%float_n0_750199974 = OpConstant %float -0.750199974 +%float_1_71350002 = OpConstant %float 1.71350002 +%float_0_0366999991 = OpConstant %float 0.0366999991 +%float_0_0388999991 = OpConstant %float 0.0388999991 +%float_n0_0684999973 = OpConstant %float -0.0684999973 +%float_1_02960002 = OpConstant %float 1.02960002 +%float_0_986992896 = OpConstant %float 0.986992896 +%float_n0_1470543 = OpConstant %float -0.1470543 +%float_0_159962699 = OpConstant %float 0.159962699 +%float_0_432305306 = OpConstant %float 0.432305306 +%float_0_518360317 = OpConstant %float 0.518360317 +%float_0_0492912009 = OpConstant %float 0.0492912009 +%float_n0_0085287001 = OpConstant %float -0.0085287001 +%float_0_040042799 = OpConstant %float 0.040042799 +%float_0_968486726 = OpConstant %float 0.968486726 +%float_5_55555534 = OpConstant %float 5.55555534 + %330 = OpConstantComposite %v3float %float_5_55555534 %float_5_55555534 %float_5_55555534 +%float_1_00000001en10 = OpConstant %float 1.00000001e-10 +%float_0_00999999978 = OpConstant %float 0.00999999978 +%float_0_666666687 = OpConstant %float 0.666666687 + %float_180 = OpConstant %float 180 + %float_360 = OpConstant %float 360 +%float_65535 = OpConstant %float 65535 + %337 = OpConstantComposite %v3float %float_65535 %float_65535 %float_65535 +%float_n4_97062206 = OpConstant %float -4.97062206 +%float_n3_02937818 = OpConstant %float -3.02937818 +%float_n2_12619996 = OpConstant %float -2.12619996 +%float_n1_51049995 = OpConstant %float -1.51049995 +%float_n1_05780005 = OpConstant %float -1.05780005 +%float_n0_466800004 = OpConstant %float -0.466800004 +%float_0_119379997 = OpConstant %float 0.119379997 +%float_0_708813429 = OpConstant %float 0.708813429 +%float_1_29118657 = OpConstant %float 1.29118657 +%float_0_808913231 = OpConstant %float 0.808913231 +%float_1_19108677 = OpConstant %float 1.19108677 +%float_1_56830001 = OpConstant %float 1.56830001 +%float_1_9483 = OpConstant %float 1.9483 +%float_2_30830002 = OpConstant %float 2.30830002 +%float_2_63840008 = OpConstant %float 2.63840008 +%float_2_85949993 = OpConstant %float 2.85949993 +%float_2_98726082 = OpConstant %float 2.98726082 +%float_3_01273918 = OpConstant %float 3.01273918 +%float_0_179999992 = OpConstant %float 0.179999992 +%float_9_99999975en05 = OpConstant %float 9.99999975e-05 + %float_1000 = OpConstant %float 1000 +%float_0_0599999987 = OpConstant %float 0.0599999987 +%float_3_50738446en05 = OpConstant %float 3.50738446e-05 + %361 = OpConstantComposite %v3float %float_3_50738446en05 %float_3_50738446en05 %float_3_50738446en05 +%float_n2_30102992 = OpConstant %float -2.30102992 +%float_n1_93120003 = OpConstant %float -1.93120003 +%float_n1_52049994 = OpConstant %float -1.52049994 +%float_0_801995218 = OpConstant %float 0.801995218 +%float_1_19800484 = OpConstant %float 1.19800484 +%float_1_59430003 = OpConstant %float 1.59430003 +%float_1_99730003 = OpConstant %float 1.99730003 +%float_2_37829995 = OpConstant %float 2.37829995 +%float_2_76839995 = OpConstant %float 2.76839995 +%float_3_05150008 = OpConstant %float 3.05150008 +%float_3_27462935 = OpConstant %float 3.27462935 +%float_3_32743073 = OpConstant %float 3.32743073 +%float_0_00499999989 = OpConstant %float 0.00499999989 + %float_11 = OpConstant %float 11 + %float_2000 = OpConstant %float 2000 +%float_0_119999997 = OpConstant %float 0.119999997 +%float_0_00313066994 = OpConstant %float 0.00313066994 +%float_12_9200001 = OpConstant %float 12.9200001 +%float_0_416666657 = OpConstant %float 0.416666657 +%float_1_05499995 = OpConstant %float 1.05499995 +%float_0_0549999997 = OpConstant %float 0.0549999997 +%float_n0_166666672 = OpConstant %float -0.166666672 + %float_n0_5 = OpConstant %float -0.5 +%float_0_166666672 = OpConstant %float 0.166666672 +%float_n3_15737653 = OpConstant %float -3.15737653 +%float_n0_485249996 = OpConstant %float -0.485249996 +%float_1_84773242 = OpConstant %float 1.84773242 +%float_n0_718548238 = OpConstant %float -0.718548238 +%float_2_08103061 = OpConstant %float 2.08103061 +%float_3_6681242 = OpConstant %float 3.6681242 + %float_18 = OpConstant %float 18 + %float_7 = OpConstant %float 7 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%type__Globals = OpTypeStruct %v4float %v3float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %float %float %float %float %float %_arr_float_uint_5 %v3float %v4float %float %float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %float %float %uint %uint %float %float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %402 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %v2bool = OpTypeVector %bool 2 + %v3bool = OpTypeVector %bool 3 +%type_sampled_image = OpTypeSampledImage %type_2d_image + %uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_arr_float_uint_6 = OpTypeArray %float %uint_6 + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform + %Texture1 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Texture1Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %gl_Layer = OpVariable %_ptr_Input_uint Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function__arr_float_uint_6 = OpTypePointer Function %_arr_float_uint_6 +%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10 + %416 = OpConstantComposite %v3float %float_0_952552378 %float_0 %float_9_36786018en05 + %417 = OpConstantComposite %v3float %float_0_343966454 %float_0_728166103 %float_n0_0721325427 + %418 = OpConstantComposite %v3float %float_0 %float_0 %float_1_00882518 + %419 = OpConstantComposite %mat3v3float %416 %417 %418 + %420 = OpConstantComposite %v3float %float_1_04981101 %float_0 %float_n9_74845025en05 + %421 = OpConstantComposite %v3float %float_n0_495903015 %float_1_37331307 %float_0_0982400328 + %422 = OpConstantComposite %v3float %float_0 %float_0 %float_0_991252005 + %423 = OpConstantComposite %mat3v3float %420 %421 %422 + %424 = OpConstantComposite %v3float %float_0_662454188 %float_0_134004205 %float_0_156187683 + %425 = OpConstantComposite %v3float %float_n0_00557464967 %float_0_0040607336 %float_1_01033914 + %426 = OpConstantComposite %mat3v3float %424 %73 %425 + %427 = OpConstantComposite %v3float %float_1_6410234 %float_n0_324803293 %float_n0_236424699 + %428 = OpConstantComposite %v3float %float_n0_663662851 %float_1_61533165 %float_0_0167563483 + %429 = OpConstantComposite %v3float %float_0_0117218941 %float_n0_00828444213 %float_0_988394856 + %430 = OpConstantComposite %mat3v3float %427 %428 %429 + %431 = OpConstantComposite %v3float %float_1_45143926 %float_n0_236510754 %float_n0_214928567 + %432 = OpConstantComposite %v3float %float_n0_0765537769 %float_1_17622972 %float_n0_0996759236 + %433 = OpConstantComposite %v3float %float_0_00831614807 %float_n0_00603244966 %float_0_997716308 + %434 = OpConstantComposite %mat3v3float %431 %432 %433 + %435 = OpConstantComposite %v3float %float_0_695452213 %float_0_140678704 %float_0_163869068 + %436 = OpConstantComposite %v3float %float_0_0447945632 %float_0_859671116 %float_0_0955343172 + %437 = OpConstantComposite %v3float %float_n0_00552588282 %float_0_00402521016 %float_1_00150073 + %438 = OpConstantComposite %mat3v3float %435 %436 %437 + %439 = OpConstantComposite %v3float %float_3_2409699 %float_n1_5373832 %float_n0_498610765 + %440 = OpConstantComposite %v3float %float_n0_969243646 %float_1_8759675 %float_0_0415550582 + %441 = OpConstantComposite %v3float %float_0_0556300804 %float_n0_203976959 %float_1_05697155 + %442 = OpConstantComposite %mat3v3float %439 %440 %441 + %443 = OpConstantComposite %v3float %float_0_412456393 %float_0_357576102 %float_0_180437505 + %444 = OpConstantComposite %v3float %float_0_212672904 %float_0_715152204 %float_0_0721750036 + %445 = OpConstantComposite %v3float %float_0_0193339009 %float_0_119191997 %float_0_950304091 + %446 = OpConstantComposite %mat3v3float %443 %444 %445 + %447 = OpConstantComposite %v3float %float_1_71660841 %float_n0_355662107 %float_n0_253360093 + %448 = OpConstantComposite %v3float %float_n0_666682899 %float_1_61647761 %float_0_0157685 + %449 = OpConstantComposite %v3float %float_0_0176422 %float_n0_0427763015 %float_0_942228675 + %450 = OpConstantComposite %mat3v3float %447 %448 %449 + %451 = OpConstantComposite %v3float %float_2_49339628 %float_n0_93134588 %float_n0_402694494 + %452 = OpConstantComposite %v3float %float_n0_829486787 %float_1_76265967 %float_0_0236246008 + %453 = OpConstantComposite %v3float %float_0_0358507 %float_n0_0761827007 %float_0_957014024 + %454 = OpConstantComposite %mat3v3float %451 %452 %453 + %455 = OpConstantComposite %v3float %float_1_01303005 %float_0_00610530982 %float_n0_0149710001 + %456 = OpConstantComposite %v3float %float_0_00769822998 %float_0_998165011 %float_n0_00503202993 + %457 = OpConstantComposite %v3float %float_n0_00284131011 %float_0_00468515977 %float_0_924507022 + %458 = OpConstantComposite %mat3v3float %455 %456 %457 + %459 = OpConstantComposite %v3float %float_0_987223983 %float_n0_00611326983 %float_0_0159533005 + %460 = OpConstantComposite %v3float %float_n0_00759836007 %float_1_00186002 %float_0_0053300201 + %461 = OpConstantComposite %v3float %float_0_00307257008 %float_n0_00509594986 %float_1_08168006 + %462 = OpConstantComposite %mat3v3float %459 %460 %461 + %463 = OpConstantComposite %v3float %float_0_5 %float_n1 %float_0_5 + %464 = OpConstantComposite %v3float %float_n1 %float_1 %float_0_5 + %465 = OpConstantComposite %v3float %float_0_5 %float_0 %float_0 + %466 = OpConstantComposite %mat3v3float %463 %464 %465 + %467 = OpConstantComposite %v3float %float_1 %float_0 %float_0 + %468 = OpConstantComposite %v3float %float_0 %float_1 %float_0 + %469 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %470 = OpConstantComposite %mat3v3float %467 %468 %469 +%float_n6_07624626 = OpConstant %float -6.07624626 + %472 = OpConstantComposite %v3float %float_n6_07624626 %float_n6_07624626 %float_n6_07624626 + %473 = OpConstantComposite %v3float %float_0_895099998 %float_0_266400009 %float_n0_161400005 + %474 = OpConstantComposite %v3float %float_n0_750199974 %float_1_71350002 %float_0_0366999991 + %475 = OpConstantComposite %v3float %float_0_0388999991 %float_n0_0684999973 %float_1_02960002 + %476 = OpConstantComposite %mat3v3float %473 %474 %475 + %477 = OpConstantComposite %v3float %float_0_986992896 %float_n0_1470543 %float_0_159962699 + %478 = OpConstantComposite %v3float %float_0_432305306 %float_0_518360317 %float_0_0492912009 + %479 = OpConstantComposite %v3float %float_n0_0085287001 %float_0_040042799 %float_0_968486726 + %480 = OpConstantComposite %mat3v3float %477 %478 %479 + %481 = OpConstantComposite %v3float %float_0_544169128 %float_0_239592597 %float_0_166694298 + %482 = OpConstantComposite %v3float %float_0_239465594 %float_0_702153027 %float_0_058381401 + %483 = OpConstantComposite %v3float %float_n0_00234390004 %float_0_0361833982 %float_1_05521834 + %484 = OpConstantComposite %mat3v3float %481 %482 %483 + %485 = OpConstantComposite %v3float %float_0_940437257 %float_n0_0183068793 %float_0_077869609 + %486 = OpConstantComposite %v3float %float_0_00837869663 %float_0_828660011 %float_0_162961304 + %487 = OpConstantComposite %v3float %float_0_00054712611 %float_n0_000883374596 %float_1_00033629 + %488 = OpConstantComposite %mat3v3float %485 %486 %487 + %489 = OpConstantComposite %v3float %float_1_06317997 %float_0_0233955998 %float_n0_0865726024 + %490 = OpConstantComposite %v3float %float_n0_0106336996 %float_1_20632005 %float_n0_195690006 + %491 = OpConstantComposite %v3float %float_n0_000590886979 %float_0_00105247996 %float_0_999538004 + %492 = OpConstantComposite %mat3v3float %489 %490 %491 +%float_0_0533333346 = OpConstant %float 0.0533333346 +%float_0_159999996 = OpConstant %float 0.159999996 +%float_57_2957764 = OpConstant %float 57.2957764 +%float_0_0625 = OpConstant %float 0.0625 +%float_n67_5 = OpConstant %float -67.5 + %float_67_5 = OpConstant %float 67.5 + %499 = OpConstantComposite %_arr_float_uint_6 %float_n4 %float_n4 %float_n3_15737653 %float_n0_485249996 %float_1_84773242 %float_1_84773242 + %500 = OpConstantComposite %_arr_float_uint_6 %float_n0_718548238 %float_2_08103061 %float_3_6681242 %float_4 %float_4 %float_4 + %float_n15 = OpConstant %float -15 + %float_n14 = OpConstant %float -14 + %503 = OpConstantComposite %_arr_float_uint_10 %float_n4_97062206 %float_n3_02937818 %float_n2_12619996 %float_n1_51049995 %float_n1_05780005 %float_n0_466800004 %float_0_119379997 %float_0_708813429 %float_1_29118657 %float_1_29118657 + %504 = OpConstantComposite %_arr_float_uint_10 %float_0_808913231 %float_1_19108677 %float_1_56830001 %float_1_9483 %float_2_30830002 %float_2_63840008 %float_2_85949993 %float_2_98726082 %float_3_01273918 %float_3_01273918 + %float_n12 = OpConstant %float -12 + %506 = OpConstantComposite %_arr_float_uint_10 %float_n2_30102992 %float_n2_30102992 %float_n1_93120003 %float_n1_52049994 %float_n1_05780005 %float_n0_466800004 %float_0_119379997 %float_0_708813429 %float_1_29118657 %float_1_29118657 + %507 = OpConstantComposite %_arr_float_uint_10 %float_0_801995218 %float_1_19800484 %float_1_59430003 %float_1_99730003 %float_2_37829995 %float_2_76839995 %float_3_05150008 %float_3_27462935 %float_3_32743073 %float_3_32743073 +%float_0_0322580636 = OpConstant %float 0.0322580636 +%float_1_03225803 = OpConstant %float 1.03225803 + %510 = OpConstantComposite %v2float %float_1_03225803 %float_1_03225803 +%float_4_60443853e_09 = OpConstant %float 4.60443853e+09 +%float_2_00528435e_09 = OpConstant %float 2.00528435e+09 +%float_0_333333343 = OpConstant %float 0.333333343 + %float_5 = OpConstant %float 5 + %float_2_5 = OpConstant %float 2.5 +%float_0_0250000004 = OpConstant %float 0.0250000004 +%float_0_239999995 = OpConstant %float 0.239999995 +%float_0_0148148146 = OpConstant %float 0.0148148146 + %519 = OpConstantComposite %v3float %float_9_99999975en05 %float_9_99999975en05 %float_9_99999975en05 +%float_0_0296296291 = OpConstant %float 0.0296296291 +%float_0_952381015 = OpConstant %float 0.952381015 + %522 = OpConstantComposite %v3float %float_0_952381015 %float_0_952381015 %float_0_952381015 + %523 = OpUndef %v3float +%float_0_358299971 = OpConstant %float 0.358299971 + %525 = OpUndef %v3float + %MainPS = OpFunction %void None %402 + %526 = OpLabel + %527 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %528 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %529 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %530 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %531 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %532 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %533 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %534 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %535 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %536 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %537 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %538 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %539 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %540 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %541 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %542 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %543 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %544 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %545 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %546 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %547 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %548 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %549 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %550 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %551 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %552 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %553 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %554 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %555 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %556 = OpVariable %_ptr_Function__arr_float_uint_10 Function + %557 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %558 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %559 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %560 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %561 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %562 = OpVariable %_ptr_Function__arr_float_uint_6 Function + %563 = OpLoad %v2float %in_var_TEXCOORD0 + %564 = OpLoad %uint %gl_Layer + %565 = OpFSub %v2float %563 %134 + %566 = OpFMul %v2float %565 %510 + %567 = OpCompositeExtract %float %566 0 + %568 = OpCompositeExtract %float %566 1 + %569 = OpConvertUToF %float %564 + %570 = OpFMul %float %569 %float_0_0322580636 + %571 = OpCompositeConstruct %v4float %567 %568 %570 %float_0 + %572 = OpMatrixTimesMatrix %mat3v3float %446 %458 + %573 = OpMatrixTimesMatrix %mat3v3float %572 %430 + %574 = OpMatrixTimesMatrix %mat3v3float %426 %462 + %575 = OpMatrixTimesMatrix %mat3v3float %574 %442 + %576 = OpMatrixTimesMatrix %mat3v3float %419 %430 + %577 = OpMatrixTimesMatrix %mat3v3float %426 %423 + %578 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_43 + %579 = OpLoad %uint %578 + OpBranch %580 + %580 = OpLabel + OpLoopMerge %581 %582 None + OpBranch %583 + %583 = OpLabel + %584 = OpMatrixTimesMatrix %mat3v3float %574 %454 + %585 = OpMatrixTimesMatrix %mat3v3float %574 %450 + %586 = OpIEqual %bool %579 %uint_1 + OpSelectionMerge %587 None + OpBranchConditional %586 %588 %589 + %589 = OpLabel + %590 = OpIEqual %bool %579 %uint_2 + OpSelectionMerge %591 None + OpBranchConditional %590 %592 %593 + %593 = OpLabel + %594 = OpIEqual %bool %579 %uint_3 + OpSelectionMerge %595 None + OpBranchConditional %594 %596 %597 + %597 = OpLabel + %598 = OpIEqual %bool %579 %uint_4 + OpSelectionMerge %599 None + OpBranchConditional %598 %600 %601 + %601 = OpLabel + OpBranch %581 + %600 = OpLabel + OpBranch %581 + %599 = OpLabel + OpUnreachable + %596 = OpLabel + OpBranch %581 + %595 = OpLabel + OpUnreachable + %592 = OpLabel + OpBranch %581 + %591 = OpLabel + OpUnreachable + %588 = OpLabel + OpBranch %581 + %587 = OpLabel + OpUnreachable + %582 = OpLabel + OpBranch %580 + %581 = OpLabel + %602 = OpPhi %mat3v3float %575 %601 %470 %600 %438 %596 %585 %592 %584 %588 + %603 = OpVectorShuffle %v3float %571 %571 0 1 2 + %604 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_42 + %605 = OpLoad %uint %604 + %606 = OpUGreaterThanEqual %bool %605 %uint_3 + OpSelectionMerge %607 None + OpBranchConditional %606 %608 %609 + %609 = OpLabel + %610 = OpFSub %v3float %603 %204 + %611 = OpFMul %v3float %610 %205 + %612 = OpExtInst %v3float %1 Exp2 %611 + %613 = OpFMul %v3float %612 %206 + %614 = OpExtInst %v3float %1 Exp2 %472 + %615 = OpFMul %v3float %614 %206 + %616 = OpFSub %v3float %613 %615 + OpBranch %607 + %608 = OpLabel + %617 = OpExtInst %v3float %1 Pow %603 %194 + %618 = OpFSub %v3float %617 %195 + %619 = OpExtInst %v3float %1 FMax %138 %618 + %620 = OpFMul %v3float %197 %617 + %621 = OpFSub %v3float %196 %620 + %622 = OpFDiv %v3float %619 %621 + %623 = OpExtInst %v3float %1 Pow %622 %199 + %624 = OpFMul %v3float %623 %200 + OpBranch %607 + %607 = OpLabel + %625 = OpPhi %v3float %616 %609 %624 %608 + %626 = OpAccessChain %_ptr_Uniform_float %_Globals %int_18 + %627 = OpLoad %float %626 + %628 = OpFMul %float %627 %float_1_00055635 + %629 = OpFOrdLessThanEqual %bool %628 %float_7000 + %630 = OpFDiv %float %float_4_60443853e_09 %627 + %631 = OpFSub %float %float_2967800 %630 + %632 = OpFDiv %float %631 %628 + %633 = OpFAdd %float %float_99_1100006 %632 + %634 = OpFDiv %float %633 %628 + %635 = OpFAdd %float %float_0_244063005 %634 + %636 = OpFDiv %float %float_2_00528435e_09 %627 + %637 = OpFSub %float %float_1901800 %636 + %638 = OpFDiv %float %637 %628 + %639 = OpFAdd %float %float_247_479996 %638 + %640 = OpFDiv %float %639 %628 + %641 = OpFAdd %float %float_0_237039998 %640 + %642 = OpSelect %float %629 %635 %641 + %643 = OpFMul %float %float_n3 %642 + %644 = OpFMul %float %643 %642 + %645 = OpFMul %float %float_2_86999989 %642 + %646 = OpFAdd %float %644 %645 + %647 = OpFSub %float %646 %float_0_275000006 + %648 = OpCompositeConstruct %v2float %642 %647 + %649 = OpFMul %float %float_0_000154118257 %627 + %650 = OpFAdd %float %float_0_860117733 %649 + %651 = OpFMul %float %float_1_28641219en07 %627 + %652 = OpFMul %float %651 %627 + %653 = OpFAdd %float %650 %652 + %654 = OpFMul %float %float_0_00084242021 %627 + %655 = OpFAdd %float %float_1 %654 + %656 = OpFMul %float %float_7_08145137en07 %627 + %657 = OpFMul %float %656 %627 + %658 = OpFAdd %float %655 %657 + %659 = OpFDiv %float %653 %658 + %660 = OpFMul %float %float_4_22806261en05 %627 + %661 = OpFAdd %float %float_0_317398727 %660 + %662 = OpFMul %float %float_4_20481676en08 %627 + %663 = OpFMul %float %662 %627 + %664 = OpFAdd %float %661 %663 + %665 = OpFMul %float %float_2_8974182en05 %627 + %666 = OpFSub %float %float_1 %665 + %667 = OpFMul %float %float_1_61456057en07 %627 + %668 = OpFMul %float %667 %627 + %669 = OpFAdd %float %666 %668 + %670 = OpFDiv %float %664 %669 + %671 = OpFMul %float %float_3 %659 + %672 = OpFMul %float %float_2 %659 + %673 = OpFMul %float %float_8 %670 + %674 = OpFSub %float %672 %673 + %675 = OpFAdd %float %674 %float_4 + %676 = OpFDiv %float %671 %675 + %677 = OpFMul %float %float_2 %670 + %678 = OpFDiv %float %677 %675 + %679 = OpCompositeConstruct %v2float %676 %678 + %680 = OpFOrdLessThan %bool %627 %float_4000 + %681 = OpCompositeConstruct %v2bool %680 %680 + %682 = OpSelect %v2float %681 %679 %648 + %683 = OpAccessChain %_ptr_Uniform_float %_Globals %int_19 + %684 = OpLoad %float %683 + %685 = OpCompositeConstruct %v2float %659 %670 + %686 = OpExtInst %v2float %1 Normalize %685 + %687 = OpCompositeExtract %float %686 1 + %688 = OpFNegate %float %687 + %689 = OpFMul %float %688 %684 + %690 = OpFMul %float %689 %float_0_0500000007 + %691 = OpFAdd %float %659 %690 + %692 = OpCompositeExtract %float %686 0 + %693 = OpFMul %float %692 %684 + %694 = OpFMul %float %693 %float_0_0500000007 + %695 = OpFAdd %float %670 %694 + %696 = OpFMul %float %float_3 %691 + %697 = OpFMul %float %float_2 %691 + %698 = OpFMul %float %float_8 %695 + %699 = OpFSub %float %697 %698 + %700 = OpFAdd %float %699 %float_4 + %701 = OpFDiv %float %696 %700 + %702 = OpFMul %float %float_2 %695 + %703 = OpFDiv %float %702 %700 + %704 = OpCompositeConstruct %v2float %701 %703 + %705 = OpFSub %v2float %704 %679 + %706 = OpFAdd %v2float %682 %705 + %707 = OpCompositeExtract %float %706 0 + %708 = OpCompositeExtract %float %706 1 + %709 = OpExtInst %float %1 FMax %708 %float_1_00000001en10 + %710 = OpFDiv %float %707 %709 + %711 = OpCompositeInsert %v3float %710 %523 0 + %712 = OpCompositeInsert %v3float %float_1 %711 1 + %713 = OpFSub %float %float_1 %707 + %714 = OpFSub %float %713 %708 + %715 = OpFDiv %float %714 %709 + %716 = OpCompositeInsert %v3float %715 %712 2 + %717 = OpExtInst %float %1 FMax %float_0_328999996 %float_1_00000001en10 + %718 = OpFDiv %float %float_0_312700003 %717 + %719 = OpCompositeInsert %v3float %718 %523 0 + %720 = OpCompositeInsert %v3float %float_1 %719 1 + %721 = OpFDiv %float %float_0_358299971 %717 + %722 = OpCompositeInsert %v3float %721 %720 2 + %723 = OpVectorTimesMatrix %v3float %716 %476 + %724 = OpVectorTimesMatrix %v3float %722 %476 + %725 = OpCompositeExtract %float %724 0 + %726 = OpCompositeExtract %float %723 0 + %727 = OpFDiv %float %725 %726 + %728 = OpCompositeConstruct %v3float %727 %float_0 %float_0 + %729 = OpCompositeExtract %float %724 1 + %730 = OpCompositeExtract %float %723 1 + %731 = OpFDiv %float %729 %730 + %732 = OpCompositeConstruct %v3float %float_0 %731 %float_0 + %733 = OpCompositeExtract %float %724 2 + %734 = OpCompositeExtract %float %723 2 + %735 = OpFDiv %float %733 %734 + %736 = OpCompositeConstruct %v3float %float_0 %float_0 %735 + %737 = OpCompositeConstruct %mat3v3float %728 %732 %736 + %738 = OpMatrixTimesMatrix %mat3v3float %476 %737 + %739 = OpMatrixTimesMatrix %mat3v3float %738 %480 + %740 = OpMatrixTimesMatrix %mat3v3float %446 %739 + %741 = OpMatrixTimesMatrix %mat3v3float %740 %442 + %742 = OpVectorTimesMatrix %v3float %625 %741 + %743 = OpVectorTimesMatrix %v3float %742 %573 + %744 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_9 + %745 = OpAccessChain %_ptr_Uniform_float %_Globals %int_9 %int_3 + %746 = OpLoad %float %745 + %747 = OpFOrdNotEqual %bool %746 %float_0 + OpSelectionMerge %748 None + OpBranchConditional %747 %749 %748 + %749 = OpLabel + %750 = OpDot %float %743 %73 + %751 = OpCompositeConstruct %v3float %750 %750 %750 + %752 = OpFDiv %v3float %743 %751 + %753 = OpFSub %v3float %752 %141 + %754 = OpDot %float %753 %753 + %755 = OpFMul %float %float_n4 %754 + %756 = OpExtInst %float %1 Exp2 %755 + %757 = OpFSub %float %float_1 %756 + %758 = OpAccessChain %_ptr_Uniform_float %_Globals %int_45 + %759 = OpLoad %float %758 + %760 = OpFMul %float %float_n4 %759 + %761 = OpFMul %float %760 %750 + %762 = OpFMul %float %761 %750 + %763 = OpExtInst %float %1 Exp2 %762 + %764 = OpFSub %float %float_1 %763 + %765 = OpFMul %float %757 %764 + %766 = OpMatrixTimesMatrix %mat3v3float %484 %430 + %767 = OpMatrixTimesMatrix %mat3v3float %575 %766 + %768 = OpVectorTimesMatrix %v3float %743 %767 + %769 = OpCompositeConstruct %v3float %765 %765 %765 + %770 = OpExtInst %v3float %1 FMix %743 %768 %769 + OpBranch %748 + %748 = OpLabel + %771 = OpPhi %v3float %743 %607 %770 %749 + %772 = OpDot %float %771 %73 + %773 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_25 + %774 = OpLoad %v4float %773 + %775 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_20 + %776 = OpLoad %v4float %775 + %777 = OpFMul %v4float %774 %776 + %778 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_26 + %779 = OpLoad %v4float %778 + %780 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_21 + %781 = OpLoad %v4float %780 + %782 = OpFMul %v4float %779 %781 + %783 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_27 + %784 = OpLoad %v4float %783 + %785 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_22 + %786 = OpLoad %v4float %785 + %787 = OpFMul %v4float %784 %786 + %788 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_28 + %789 = OpLoad %v4float %788 + %790 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_23 + %791 = OpLoad %v4float %790 + %792 = OpFMul %v4float %789 %791 + %793 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_29 + %794 = OpLoad %v4float %793 + %795 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_24 + %796 = OpLoad %v4float %795 + %797 = OpFAdd %v4float %794 %796 + %798 = OpCompositeConstruct %v3float %772 %772 %772 + %799 = OpVectorShuffle %v3float %777 %777 0 1 2 + %800 = OpCompositeExtract %float %777 3 + %801 = OpCompositeConstruct %v3float %800 %800 %800 + %802 = OpFMul %v3float %799 %801 + %803 = OpExtInst %v3float %1 FMix %798 %771 %802 + %804 = OpExtInst %v3float %1 FMax %138 %803 + %805 = OpFMul %v3float %804 %330 + %806 = OpVectorShuffle %v3float %782 %782 0 1 2 + %807 = OpCompositeExtract %float %782 3 + %808 = OpCompositeConstruct %v3float %807 %807 %807 + %809 = OpFMul %v3float %806 %808 + %810 = OpExtInst %v3float %1 Pow %805 %809 + %811 = OpFMul %v3float %810 %206 + %812 = OpVectorShuffle %v3float %787 %787 0 1 2 + %813 = OpCompositeExtract %float %787 3 + %814 = OpCompositeConstruct %v3float %813 %813 %813 + %815 = OpFMul %v3float %812 %814 + %816 = OpFDiv %v3float %141 %815 + %817 = OpExtInst %v3float %1 Pow %811 %816 + %818 = OpVectorShuffle %v3float %792 %792 0 1 2 + %819 = OpCompositeExtract %float %792 3 + %820 = OpCompositeConstruct %v3float %819 %819 %819 + %821 = OpFMul %v3float %818 %820 + %822 = OpFMul %v3float %817 %821 + %823 = OpVectorShuffle %v3float %797 %797 0 1 2 + %824 = OpCompositeExtract %float %797 3 + %825 = OpCompositeConstruct %v3float %824 %824 %824 + %826 = OpFAdd %v3float %823 %825 + %827 = OpFAdd %v3float %822 %826 + %828 = OpAccessChain %_ptr_Uniform_float %_Globals %int_40 + %829 = OpLoad %float %828 + %830 = OpExtInst %float %1 SmoothStep %float_0 %829 %772 + %831 = OpFSub %float %float_1 %830 + %832 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_35 + %833 = OpLoad %v4float %832 + %834 = OpFMul %v4float %833 %776 + %835 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_36 + %836 = OpLoad %v4float %835 + %837 = OpFMul %v4float %836 %781 + %838 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_37 + %839 = OpLoad %v4float %838 + %840 = OpFMul %v4float %839 %786 + %841 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_38 + %842 = OpLoad %v4float %841 + %843 = OpFMul %v4float %842 %791 + %844 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_39 + %845 = OpLoad %v4float %844 + %846 = OpFAdd %v4float %845 %796 + %847 = OpVectorShuffle %v3float %834 %834 0 1 2 + %848 = OpCompositeExtract %float %834 3 + %849 = OpCompositeConstruct %v3float %848 %848 %848 + %850 = OpFMul %v3float %847 %849 + %851 = OpExtInst %v3float %1 FMix %798 %771 %850 + %852 = OpExtInst %v3float %1 FMax %138 %851 + %853 = OpFMul %v3float %852 %330 + %854 = OpVectorShuffle %v3float %837 %837 0 1 2 + %855 = OpCompositeExtract %float %837 3 + %856 = OpCompositeConstruct %v3float %855 %855 %855 + %857 = OpFMul %v3float %854 %856 + %858 = OpExtInst %v3float %1 Pow %853 %857 + %859 = OpFMul %v3float %858 %206 + %860 = OpVectorShuffle %v3float %840 %840 0 1 2 + %861 = OpCompositeExtract %float %840 3 + %862 = OpCompositeConstruct %v3float %861 %861 %861 + %863 = OpFMul %v3float %860 %862 + %864 = OpFDiv %v3float %141 %863 + %865 = OpExtInst %v3float %1 Pow %859 %864 + %866 = OpVectorShuffle %v3float %843 %843 0 1 2 + %867 = OpCompositeExtract %float %843 3 + %868 = OpCompositeConstruct %v3float %867 %867 %867 + %869 = OpFMul %v3float %866 %868 + %870 = OpFMul %v3float %865 %869 + %871 = OpVectorShuffle %v3float %846 %846 0 1 2 + %872 = OpCompositeExtract %float %846 3 + %873 = OpCompositeConstruct %v3float %872 %872 %872 + %874 = OpFAdd %v3float %871 %873 + %875 = OpFAdd %v3float %870 %874 + %876 = OpAccessChain %_ptr_Uniform_float %_Globals %int_41 + %877 = OpLoad %float %876 + %878 = OpExtInst %float %1 SmoothStep %877 %float_1 %772 + %879 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_30 + %880 = OpLoad %v4float %879 + %881 = OpFMul %v4float %880 %776 + %882 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_31 + %883 = OpLoad %v4float %882 + %884 = OpFMul %v4float %883 %781 + %885 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_32 + %886 = OpLoad %v4float %885 + %887 = OpFMul %v4float %886 %786 + %888 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_33 + %889 = OpLoad %v4float %888 + %890 = OpFMul %v4float %889 %791 + %891 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_34 + %892 = OpLoad %v4float %891 + %893 = OpFAdd %v4float %892 %796 + %894 = OpVectorShuffle %v3float %881 %881 0 1 2 + %895 = OpCompositeExtract %float %881 3 + %896 = OpCompositeConstruct %v3float %895 %895 %895 + %897 = OpFMul %v3float %894 %896 + %898 = OpExtInst %v3float %1 FMix %798 %771 %897 + %899 = OpExtInst %v3float %1 FMax %138 %898 + %900 = OpFMul %v3float %899 %330 + %901 = OpVectorShuffle %v3float %884 %884 0 1 2 + %902 = OpCompositeExtract %float %884 3 + %903 = OpCompositeConstruct %v3float %902 %902 %902 + %904 = OpFMul %v3float %901 %903 + %905 = OpExtInst %v3float %1 Pow %900 %904 + %906 = OpFMul %v3float %905 %206 + %907 = OpVectorShuffle %v3float %887 %887 0 1 2 + %908 = OpCompositeExtract %float %887 3 + %909 = OpCompositeConstruct %v3float %908 %908 %908 + %910 = OpFMul %v3float %907 %909 + %911 = OpFDiv %v3float %141 %910 + %912 = OpExtInst %v3float %1 Pow %906 %911 + %913 = OpVectorShuffle %v3float %890 %890 0 1 2 + %914 = OpCompositeExtract %float %890 3 + %915 = OpCompositeConstruct %v3float %914 %914 %914 + %916 = OpFMul %v3float %913 %915 + %917 = OpFMul %v3float %912 %916 + %918 = OpVectorShuffle %v3float %893 %893 0 1 2 + %919 = OpCompositeExtract %float %893 3 + %920 = OpCompositeConstruct %v3float %919 %919 %919 + %921 = OpFAdd %v3float %918 %920 + %922 = OpFAdd %v3float %917 %921 + %923 = OpFSub %float %830 %878 + %924 = OpCompositeConstruct %v3float %831 %831 %831 + %925 = OpFMul %v3float %827 %924 + %926 = OpCompositeConstruct %v3float %923 %923 %923 + %927 = OpFMul %v3float %922 %926 + %928 = OpFAdd %v3float %925 %927 + %929 = OpCompositeConstruct %v3float %878 %878 %878 + %930 = OpFMul %v3float %875 %929 + %931 = OpFAdd %v3float %928 %930 + %932 = OpVectorTimesMatrix %v3float %931 %575 + %933 = OpMatrixTimesMatrix %mat3v3float %577 %488 + %934 = OpMatrixTimesMatrix %mat3v3float %933 %576 + %935 = OpMatrixTimesMatrix %mat3v3float %577 %492 + %936 = OpMatrixTimesMatrix %mat3v3float %935 %576 + %937 = OpVectorTimesMatrix %v3float %931 %934 + %938 = OpAccessChain %_ptr_Uniform_float %_Globals %int_44 + %939 = OpLoad %float %938 + %940 = OpCompositeConstruct %v3float %939 %939 %939 + %941 = OpExtInst %v3float %1 FMix %931 %937 %940 + %942 = OpVectorTimesMatrix %v3float %941 %577 + %943 = OpCompositeExtract %float %942 0 + %944 = OpCompositeExtract %float %942 1 + %945 = OpExtInst %float %1 FMin %943 %944 + %946 = OpCompositeExtract %float %942 2 + %947 = OpExtInst %float %1 FMin %945 %946 + %948 = OpExtInst %float %1 FMax %943 %944 + %949 = OpExtInst %float %1 FMax %948 %946 + %950 = OpExtInst %float %1 FMax %949 %float_1_00000001en10 + %951 = OpExtInst %float %1 FMax %947 %float_1_00000001en10 + %952 = OpFSub %float %950 %951 + %953 = OpExtInst %float %1 FMax %949 %float_0_00999999978 + %954 = OpFDiv %float %952 %953 + %955 = OpFSub %float %946 %944 + %956 = OpFMul %float %946 %955 + %957 = OpFSub %float %944 %943 + %958 = OpFMul %float %944 %957 + %959 = OpFAdd %float %956 %958 + %960 = OpFSub %float %943 %946 + %961 = OpFMul %float %943 %960 + %962 = OpFAdd %float %959 %961 + %963 = OpExtInst %float %1 Sqrt %962 + %964 = OpFAdd %float %946 %944 + %965 = OpFAdd %float %964 %943 + %966 = OpFMul %float %float_1_75 %963 + %967 = OpFAdd %float %965 %966 + %968 = OpFMul %float %967 %float_0_333333343 + %969 = OpFSub %float %954 %float_0_400000006 + %970 = OpFMul %float %969 %float_5 + %971 = OpFMul %float %969 %float_2_5 + %972 = OpExtInst %float %1 FAbs %971 + %973 = OpFSub %float %float_1 %972 + %974 = OpExtInst %float %1 FMax %973 %float_0 + %975 = OpExtInst %float %1 FSign %970 + %976 = OpConvertFToS %int %975 + %977 = OpConvertSToF %float %976 + %978 = OpFMul %float %974 %974 + %979 = OpFSub %float %float_1 %978 + %980 = OpFMul %float %977 %979 + %981 = OpFAdd %float %float_1 %980 + %982 = OpFMul %float %981 %float_0_0250000004 + %983 = OpFOrdLessThanEqual %bool %968 %float_0_0533333346 + OpSelectionMerge %984 None + OpBranchConditional %983 %985 %986 + %986 = OpLabel + %987 = OpFOrdGreaterThanEqual %bool %968 %float_0_159999996 + OpSelectionMerge %988 None + OpBranchConditional %987 %989 %990 + %990 = OpLabel + %991 = OpFDiv %float %float_0_239999995 %967 + %992 = OpFSub %float %991 %float_0_5 + %993 = OpFMul %float %982 %992 + OpBranch %988 + %989 = OpLabel + OpBranch %988 + %988 = OpLabel + %994 = OpPhi %float %993 %990 %float_0 %989 + OpBranch %984 + %985 = OpLabel + OpBranch %984 + %984 = OpLabel + %995 = OpPhi %float %994 %988 %982 %985 + %996 = OpFAdd %float %float_1 %995 + %997 = OpCompositeConstruct %v3float %996 %996 %996 + %998 = OpFMul %v3float %942 %997 + %999 = OpCompositeExtract %float %998 0 + %1000 = OpCompositeExtract %float %998 1 + %1001 = OpFOrdEqual %bool %999 %1000 + %1002 = OpCompositeExtract %float %998 2 + %1003 = OpFOrdEqual %bool %1000 %1002 + %1004 = OpLogicalAnd %bool %1001 %1003 + OpSelectionMerge %1005 None + OpBranchConditional %1004 %1006 %1007 + %1007 = OpLabel + %1008 = OpExtInst %float %1 Sqrt %float_3 + %1009 = OpFSub %float %1000 %1002 + %1010 = OpFMul %float %1008 %1009 + %1011 = OpFMul %float %float_2 %999 + %1012 = OpFSub %float %1011 %1000 + %1013 = OpFSub %float %1012 %1002 + %1014 = OpExtInst %float %1 Atan2 %1010 %1013 + %1015 = OpFMul %float %float_57_2957764 %1014 + OpBranch %1005 + %1006 = OpLabel + OpBranch %1005 + %1005 = OpLabel + %1016 = OpPhi %float %1015 %1007 %float_0 %1006 + %1017 = OpFOrdLessThan %bool %1016 %float_0 + OpSelectionMerge %1018 None + OpBranchConditional %1017 %1019 %1018 + %1019 = OpLabel + %1020 = OpFAdd %float %1016 %float_360 + OpBranch %1018 + %1018 = OpLabel + %1021 = OpPhi %float %1016 %1005 %1020 %1019 + %1022 = OpExtInst %float %1 FClamp %1021 %float_0 %float_360 + %1023 = OpFOrdGreaterThan %bool %1022 %float_180 + OpSelectionMerge %1024 None + OpBranchConditional %1023 %1025 %1024 + %1025 = OpLabel + %1026 = OpFSub %float %1022 %float_360 + OpBranch %1024 + %1024 = OpLabel + %1027 = OpPhi %float %1022 %1018 %1026 %1025 + %1028 = OpFMul %float %1027 %float_0_0148148146 + %1029 = OpExtInst %float %1 FAbs %1028 + %1030 = OpFSub %float %float_1 %1029 + %1031 = OpExtInst %float %1 SmoothStep %float_0 %float_1 %1030 + %1032 = OpFMul %float %1031 %1031 + %1033 = OpFMul %float %1032 %954 + %1034 = OpFSub %float %float_0_0299999993 %999 + %1035 = OpFMul %float %1033 %1034 + %1036 = OpFMul %float %1035 %float_0_180000007 + %1037 = OpFAdd %float %999 %1036 + %1038 = OpCompositeInsert %v3float %1037 %998 0 + %1039 = OpVectorTimesMatrix %v3float %1038 %434 + %1040 = OpExtInst %v3float %1 FMax %138 %1039 + %1041 = OpDot %float %1040 %73 + %1042 = OpCompositeConstruct %v3float %1041 %1041 %1041 + %1043 = OpExtInst %v3float %1 FMix %1042 %1040 %241 + %1044 = OpAccessChain %_ptr_Uniform_float %_Globals %int_13 + %1045 = OpLoad %float %1044 + %1046 = OpFAdd %float %float_1 %1045 + %1047 = OpAccessChain %_ptr_Uniform_float %_Globals %int_11 + %1048 = OpLoad %float %1047 + %1049 = OpFSub %float %1046 %1048 + %1050 = OpAccessChain %_ptr_Uniform_float %_Globals %int_14 + %1051 = OpLoad %float %1050 + %1052 = OpFAdd %float %float_1 %1051 + %1053 = OpAccessChain %_ptr_Uniform_float %_Globals %int_12 + %1054 = OpLoad %float %1053 + %1055 = OpFSub %float %1052 %1054 + %1056 = OpFOrdGreaterThan %bool %1048 %float_0_800000012 + OpSelectionMerge %1057 None + OpBranchConditional %1056 %1058 %1059 + %1059 = OpLabel + %1060 = OpFAdd %float %float_0_180000007 %1045 + %1061 = OpFDiv %float %1060 %1049 + %1062 = OpExtInst %float %1 Log %float_0_180000007 + %1063 = OpExtInst %float %1 Log %float_10 + %1064 = OpFDiv %float %1062 %1063 + %1065 = OpFSub %float %float_2 %1061 + %1066 = OpFDiv %float %1061 %1065 + %1067 = OpExtInst %float %1 Log %1066 + %1068 = OpFMul %float %float_0_5 %1067 + %1069 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1070 = OpLoad %float %1069 + %1071 = OpFDiv %float %1049 %1070 + %1072 = OpFMul %float %1068 %1071 + %1073 = OpFSub %float %1064 %1072 + OpBranch %1057 + %1058 = OpLabel + %1074 = OpFSub %float %float_0_819999993 %1048 + %1075 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1076 = OpLoad %float %1075 + %1077 = OpFDiv %float %1074 %1076 + %1078 = OpExtInst %float %1 Log %float_0_180000007 + %1079 = OpExtInst %float %1 Log %float_10 + %1080 = OpFDiv %float %1078 %1079 + %1081 = OpFAdd %float %1077 %1080 + OpBranch %1057 + %1057 = OpLabel + %1082 = OpPhi %float %1073 %1059 %1081 %1058 + %1083 = OpFSub %float %float_1 %1048 + %1084 = OpAccessChain %_ptr_Uniform_float %_Globals %int_10 + %1085 = OpLoad %float %1084 + %1086 = OpFDiv %float %1083 %1085 + %1087 = OpFSub %float %1086 %1082 + %1088 = OpFDiv %float %1054 %1085 + %1089 = OpFSub %float %1088 %1087 + %1090 = OpExtInst %v3float %1 Log %1043 + %1091 = OpExtInst %float %1 Log %float_10 + %1092 = OpCompositeConstruct %v3float %1091 %1091 %1091 + %1093 = OpFDiv %v3float %1090 %1092 + %1094 = OpCompositeConstruct %v3float %1085 %1085 %1085 + %1095 = OpCompositeConstruct %v3float %1087 %1087 %1087 + %1096 = OpFAdd %v3float %1093 %1095 + %1097 = OpFMul %v3float %1094 %1096 + %1098 = OpFNegate %float %1045 + %1099 = OpCompositeConstruct %v3float %1098 %1098 %1098 + %1100 = OpFMul %float %float_2 %1049 + %1101 = OpCompositeConstruct %v3float %1100 %1100 %1100 + %1102 = OpFMul %float %float_n2 %1085 + %1103 = OpFDiv %float %1102 %1049 + %1104 = OpCompositeConstruct %v3float %1103 %1103 %1103 + %1105 = OpCompositeConstruct %v3float %1082 %1082 %1082 + %1106 = OpFSub %v3float %1093 %1105 + %1107 = OpFMul %v3float %1104 %1106 + %1108 = OpExtInst %v3float %1 Exp %1107 + %1109 = OpFAdd %v3float %141 %1108 + %1110 = OpFDiv %v3float %1101 %1109 + %1111 = OpFAdd %v3float %1099 %1110 + %1112 = OpCompositeConstruct %v3float %1052 %1052 %1052 + %1113 = OpFMul %float %float_2 %1055 + %1114 = OpCompositeConstruct %v3float %1113 %1113 %1113 + %1115 = OpFMul %float %float_2 %1085 + %1116 = OpFDiv %float %1115 %1055 + %1117 = OpCompositeConstruct %v3float %1116 %1116 %1116 + %1118 = OpCompositeConstruct %v3float %1089 %1089 %1089 + %1119 = OpFSub %v3float %1093 %1118 + %1120 = OpFMul %v3float %1117 %1119 + %1121 = OpExtInst %v3float %1 Exp %1120 + %1122 = OpFAdd %v3float %141 %1121 + %1123 = OpFDiv %v3float %1114 %1122 + %1124 = OpFSub %v3float %1112 %1123 + %1125 = OpFOrdLessThan %v3bool %1093 %1105 + %1126 = OpSelect %v3float %1125 %1111 %1097 + %1127 = OpFOrdGreaterThan %v3bool %1093 %1118 + %1128 = OpSelect %v3float %1127 %1124 %1097 + %1129 = OpFSub %float %1089 %1082 + %1130 = OpCompositeConstruct %v3float %1129 %1129 %1129 + %1131 = OpFDiv %v3float %1106 %1130 + %1132 = OpExtInst %v3float %1 FClamp %1131 %138 %141 + %1133 = OpFOrdLessThan %bool %1089 %1082 + %1134 = OpFSub %v3float %141 %1132 + %1135 = OpCompositeConstruct %v3bool %1133 %1133 %1133 + %1136 = OpSelect %v3float %1135 %1134 %1132 + %1137 = OpFMul %v3float %252 %1136 + %1138 = OpFSub %v3float %251 %1137 + %1139 = OpFMul %v3float %1138 %1136 + %1140 = OpFMul %v3float %1139 %1136 + %1141 = OpExtInst %v3float %1 FMix %1126 %1128 %1140 + %1142 = OpDot %float %1141 %73 + %1143 = OpCompositeConstruct %v3float %1142 %1142 %1142 + %1144 = OpExtInst %v3float %1 FMix %1143 %1141 %254 + %1145 = OpExtInst %v3float %1 FMax %138 %1144 + %1146 = OpVectorTimesMatrix %v3float %1145 %936 + %1147 = OpExtInst %v3float %1 FMix %1145 %1146 %940 + %1148 = OpVectorTimesMatrix %v3float %1147 %575 + %1149 = OpExtInst %v3float %1 FMax %138 %1148 + %1150 = OpFOrdEqual %bool %746 %float_0 + OpSelectionMerge %1151 DontFlatten + OpBranchConditional %1150 %1152 %1151 + %1152 = OpLabel + %1153 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_2 + %1154 = OpLoad %v4float %1153 + %1155 = OpVectorShuffle %v3float %1154 %1154 0 1 2 + %1156 = OpDot %float %932 %1155 + %1157 = OpCompositeInsert %v3float %1156 %525 0 + %1158 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 + %1159 = OpLoad %v4float %1158 + %1160 = OpVectorShuffle %v3float %1159 %1159 0 1 2 + %1161 = OpDot %float %932 %1160 + %1162 = OpCompositeInsert %v3float %1161 %1157 1 + %1163 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_4 + %1164 = OpLoad %v4float %1163 + %1165 = OpVectorShuffle %v3float %1164 %1164 0 1 2 + %1166 = OpDot %float %932 %1165 + %1167 = OpCompositeInsert %v3float %1166 %1162 2 + %1168 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8 + %1169 = OpLoad %v4float %1168 + %1170 = OpVectorShuffle %v3float %1169 %1169 0 1 2 + %1171 = OpLoad %v4float %744 + %1172 = OpVectorShuffle %v3float %1171 %1171 0 1 2 + %1173 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %1174 = OpLoad %v4float %1173 + %1175 = OpVectorShuffle %v3float %1174 %1174 0 1 2 + %1176 = OpDot %float %932 %1175 + %1177 = OpFAdd %float %1176 %float_1 + %1178 = OpFDiv %float %float_1 %1177 + %1179 = OpCompositeConstruct %v3float %1178 %1178 %1178 + %1180 = OpFMul %v3float %1172 %1179 + %1181 = OpFAdd %v3float %1170 %1180 + %1182 = OpFMul %v3float %1167 %1181 + %1183 = OpExtInst %v3float %1 FMax %138 %1182 + %1184 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_5 + %1185 = OpLoad %v4float %1184 + %1186 = OpVectorShuffle %v3float %1185 %1185 0 0 0 + %1187 = OpFSub %v3float %1186 %1183 + %1188 = OpExtInst %v3float %1 FMax %138 %1187 + %1189 = OpVectorShuffle %v3float %1185 %1185 2 2 2 + %1190 = OpExtInst %v3float %1 FMax %1183 %1189 + %1191 = OpExtInst %v3float %1 FClamp %1183 %1186 %1189 + %1192 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_6 + %1193 = OpLoad %v4float %1192 + %1194 = OpVectorShuffle %v3float %1193 %1193 0 0 0 + %1195 = OpFMul %v3float %1190 %1194 + %1196 = OpVectorShuffle %v3float %1193 %1193 1 1 1 + %1197 = OpFAdd %v3float %1195 %1196 + %1198 = OpVectorShuffle %v3float %1185 %1185 3 3 3 + %1199 = OpFAdd %v3float %1190 %1198 + %1200 = OpFDiv %v3float %141 %1199 + %1201 = OpFMul %v3float %1197 %1200 + %1202 = OpVectorShuffle %v3float %1164 %1164 3 3 3 + %1203 = OpFMul %v3float %1191 %1202 + %1204 = OpVectorShuffle %v3float %1154 %1154 3 3 3 + %1205 = OpFMul %v3float %1188 %1204 + %1206 = OpVectorShuffle %v3float %1185 %1185 1 1 1 + %1207 = OpFAdd %v3float %1188 %1206 + %1208 = OpFDiv %v3float %141 %1207 + %1209 = OpFMul %v3float %1205 %1208 + %1210 = OpVectorShuffle %v3float %1159 %1159 3 3 3 + %1211 = OpFAdd %v3float %1209 %1210 + %1212 = OpFAdd %v3float %1203 %1211 + %1213 = OpFAdd %v3float %1201 %1212 + %1214 = OpFSub %v3float %1213 %261 + OpBranch %1151 + %1151 = OpLabel + %1215 = OpPhi %v3float %1149 %1057 %1214 %1152 + %1216 = OpExtInst %v3float %1 FClamp %1215 %138 %141 + %1217 = OpCompositeExtract %float %1216 0 + OpBranch %1218 + %1218 = OpLabel + OpLoopMerge %1219 %1220 None + OpBranch %1221 + %1221 = OpLabel + %1222 = OpFOrdLessThan %bool %1217 %float_0_00313066994 + OpSelectionMerge %1223 None + OpBranchConditional %1222 %1224 %1223 + %1224 = OpLabel + %1225 = OpFMul %float %1217 %float_12_9200001 + OpBranch %1219 + %1223 = OpLabel + %1226 = OpExtInst %float %1 Pow %1217 %float_0_416666657 + %1227 = OpFMul %float %1226 %float_1_05499995 + %1228 = OpFSub %float %1227 %float_0_0549999997 + OpBranch %1219 + %1220 = OpLabel + OpBranch %1218 + %1219 = OpLabel + %1229 = OpPhi %float %1225 %1224 %1228 %1223 + %1230 = OpCompositeExtract %float %1216 1 + OpBranch %1231 + %1231 = OpLabel + OpLoopMerge %1232 %1233 None + OpBranch %1234 + %1234 = OpLabel + %1235 = OpFOrdLessThan %bool %1230 %float_0_00313066994 + OpSelectionMerge %1236 None + OpBranchConditional %1235 %1237 %1236 + %1237 = OpLabel + %1238 = OpFMul %float %1230 %float_12_9200001 + OpBranch %1232 + %1236 = OpLabel + %1239 = OpExtInst %float %1 Pow %1230 %float_0_416666657 + %1240 = OpFMul %float %1239 %float_1_05499995 + %1241 = OpFSub %float %1240 %float_0_0549999997 + OpBranch %1232 + %1233 = OpLabel + OpBranch %1231 + %1232 = OpLabel + %1242 = OpPhi %float %1238 %1237 %1241 %1236 + %1243 = OpCompositeExtract %float %1216 2 + OpBranch %1244 + %1244 = OpLabel + OpLoopMerge %1245 %1246 None + OpBranch %1247 + %1247 = OpLabel + %1248 = OpFOrdLessThan %bool %1243 %float_0_00313066994 + OpSelectionMerge %1249 None + OpBranchConditional %1248 %1250 %1249 + %1250 = OpLabel + %1251 = OpFMul %float %1243 %float_12_9200001 + OpBranch %1245 + %1249 = OpLabel + %1252 = OpExtInst %float %1 Pow %1243 %float_0_416666657 + %1253 = OpFMul %float %1252 %float_1_05499995 + %1254 = OpFSub %float %1253 %float_0_0549999997 + OpBranch %1245 + %1246 = OpLabel + OpBranch %1244 + %1245 = OpLabel + %1255 = OpPhi %float %1251 %1250 %1254 %1249 + %1256 = OpCompositeConstruct %v3float %1229 %1242 %1255 + %1257 = OpFMul %v3float %1256 %173 + %1258 = OpFAdd %v3float %1257 %175 + %1259 = OpAccessChain %_ptr_Uniform_float %_Globals %int_15 %int_0 + %1260 = OpLoad %float %1259 + %1261 = OpCompositeConstruct %v3float %1260 %1260 %1260 + %1262 = OpFMul %v3float %1261 %1256 + %1263 = OpAccessChain %_ptr_Uniform_float %_Globals %int_15 %int_1 + %1264 = OpLoad %float %1263 + %1265 = OpCompositeConstruct %v3float %1264 %1264 %1264 + %1266 = OpLoad %type_2d_image %Texture1 + %1267 = OpLoad %type_sampler %Texture1Sampler + %1268 = OpCompositeExtract %float %1258 2 + %1269 = OpFMul %float %1268 %float_16 + %1270 = OpFSub %float %1269 %float_0_5 + %1271 = OpExtInst %float %1 Floor %1270 + %1272 = OpFSub %float %1270 %1271 + %1273 = OpCompositeExtract %float %1258 0 + %1274 = OpFAdd %float %1273 %1271 + %1275 = OpFMul %float %1274 %float_0_0625 + %1276 = OpCompositeExtract %float %1258 1 + %1277 = OpCompositeConstruct %v2float %1275 %1276 + %1278 = OpSampledImage %type_sampled_image %1266 %1267 + %1279 = OpImageSampleImplicitLod %v4float %1278 %1277 None + %1280 = OpFAdd %float %1275 %float_0_0625 + %1281 = OpCompositeConstruct %v2float %1280 %1276 + %1282 = OpSampledImage %type_sampled_image %1266 %1267 + %1283 = OpImageSampleImplicitLod %v4float %1282 %1281 None + %1284 = OpCompositeConstruct %v4float %1272 %1272 %1272 %1272 + %1285 = OpExtInst %v4float %1 FMix %1279 %1283 %1284 + %1286 = OpVectorShuffle %v3float %1285 %1285 0 1 2 + %1287 = OpFMul %v3float %1265 %1286 + %1288 = OpFAdd %v3float %1262 %1287 + %1289 = OpExtInst %v3float %1 FMax %263 %1288 + %1290 = OpFOrdGreaterThan %v3bool %1289 %265 + %1291 = OpFMul %v3float %1289 %267 + %1292 = OpFAdd %v3float %1291 %269 + %1293 = OpExtInst %v3float %1 Pow %1292 %271 + %1294 = OpFMul %v3float %1289 %273 + %1295 = OpSelect %v3float %1290 %1293 %1294 + %1296 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_0 + %1297 = OpLoad %float %1296 + %1298 = OpCompositeConstruct %v3float %1297 %1297 %1297 + %1299 = OpFMul %v3float %1295 %1295 + %1300 = OpFMul %v3float %1298 %1299 + %1301 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_1 + %1302 = OpLoad %float %1301 + %1303 = OpCompositeConstruct %v3float %1302 %1302 %1302 + %1304 = OpFMul %v3float %1303 %1295 + %1305 = OpFAdd %v3float %1300 %1304 + %1306 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %1307 = OpLoad %float %1306 + %1308 = OpCompositeConstruct %v3float %1307 %1307 %1307 + %1309 = OpFAdd %v3float %1305 %1308 + %1310 = OpAccessChain %_ptr_Uniform_v3float %_Globals %int_16 + %1311 = OpLoad %v3float %1310 + %1312 = OpFMul %v3float %1309 %1311 + %1313 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_17 + %1314 = OpLoad %v4float %1313 + %1315 = OpVectorShuffle %v3float %1314 %1314 0 1 2 + %1316 = OpAccessChain %_ptr_Uniform_float %_Globals %int_17 %int_3 + %1317 = OpLoad %float %1316 + %1318 = OpCompositeConstruct %v3float %1317 %1317 %1317 + %1319 = OpExtInst %v3float %1 FMix %1312 %1315 %1318 + %1320 = OpExtInst %v3float %1 FMax %138 %1319 + %1321 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %int_1 + %1322 = OpLoad %float %1321 + %1323 = OpCompositeConstruct %v3float %1322 %1322 %1322 + %1324 = OpExtInst %v3float %1 Pow %1320 %1323 + %1325 = OpIEqual %bool %605 %uint_0 + OpSelectionMerge %1326 DontFlatten + OpBranchConditional %1325 %1327 %1328 + %1328 = OpLabel + %1329 = OpIEqual %bool %605 %uint_1 + OpSelectionMerge %1330 None + OpBranchConditional %1329 %1331 %1332 + %1332 = OpLabel + %1333 = OpIEqual %bool %605 %uint_3 + %1334 = OpIEqual %bool %605 %uint_5 + %1335 = OpLogicalOr %bool %1333 %1334 + OpSelectionMerge %1336 None + OpBranchConditional %1335 %1337 %1338 + %1338 = OpLabel + %1339 = OpIEqual %bool %605 %uint_4 + %1340 = OpIEqual %bool %605 %uint_6 + %1341 = OpLogicalOr %bool %1339 %1340 + OpSelectionMerge %1342 None + OpBranchConditional %1341 %1343 %1344 + %1344 = OpLabel + %1345 = OpIEqual %bool %605 %uint_7 + OpSelectionMerge %1346 None + OpBranchConditional %1345 %1347 %1348 + %1348 = OpLabel + %1349 = OpVectorTimesMatrix %v3float %1324 %573 + %1350 = OpVectorTimesMatrix %v3float %1349 %602 + %1351 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %int_2 + %1352 = OpLoad %float %1351 + %1353 = OpCompositeConstruct %v3float %1352 %1352 %1352 + %1354 = OpExtInst %v3float %1 Pow %1350 %1353 + OpBranch %1346 + %1347 = OpLabel + %1355 = OpVectorTimesMatrix %v3float %932 %573 + %1356 = OpVectorTimesMatrix %v3float %1355 %602 + %1357 = OpFMul %v3float %1356 %519 + %1358 = OpExtInst %v3float %1 Pow %1357 %286 + %1359 = OpFMul %v3float %196 %1358 + %1360 = OpFAdd %v3float %195 %1359 + %1361 = OpFMul %v3float %197 %1358 + %1362 = OpFAdd %v3float %141 %1361 + %1363 = OpFDiv %v3float %141 %1362 + %1364 = OpFMul %v3float %1360 %1363 + %1365 = OpExtInst %v3float %1 Pow %1364 %287 + OpBranch %1346 + %1346 = OpLabel + %1366 = OpPhi %v3float %1354 %1348 %1365 %1347 + OpBranch %1342 + %1343 = OpLabel + %1367 = OpMatrixTimesMatrix %mat3v3float %572 %423 + %1368 = OpFMul %v3float %932 %285 + %1369 = OpVectorTimesMatrix %v3float %1368 %1367 + %1370 = OpCompositeExtract %float %1369 0 + %1371 = OpCompositeExtract %float %1369 1 + %1372 = OpExtInst %float %1 FMin %1370 %1371 + %1373 = OpCompositeExtract %float %1369 2 + %1374 = OpExtInst %float %1 FMin %1372 %1373 + %1375 = OpExtInst %float %1 FMax %1370 %1371 + %1376 = OpExtInst %float %1 FMax %1375 %1373 + %1377 = OpExtInst %float %1 FMax %1376 %float_1_00000001en10 + %1378 = OpExtInst %float %1 FMax %1374 %float_1_00000001en10 + %1379 = OpFSub %float %1377 %1378 + %1380 = OpExtInst %float %1 FMax %1376 %float_0_00999999978 + %1381 = OpFDiv %float %1379 %1380 + %1382 = OpFSub %float %1373 %1371 + %1383 = OpFMul %float %1373 %1382 + %1384 = OpFSub %float %1371 %1370 + %1385 = OpFMul %float %1371 %1384 + %1386 = OpFAdd %float %1383 %1385 + %1387 = OpFSub %float %1370 %1373 + %1388 = OpFMul %float %1370 %1387 + %1389 = OpFAdd %float %1386 %1388 + %1390 = OpExtInst %float %1 Sqrt %1389 + %1391 = OpFAdd %float %1373 %1371 + %1392 = OpFAdd %float %1391 %1370 + %1393 = OpFMul %float %float_1_75 %1390 + %1394 = OpFAdd %float %1392 %1393 + %1395 = OpFMul %float %1394 %float_0_333333343 + %1396 = OpFSub %float %1381 %float_0_400000006 + %1397 = OpFMul %float %1396 %float_5 + %1398 = OpFMul %float %1396 %float_2_5 + %1399 = OpExtInst %float %1 FAbs %1398 + %1400 = OpFSub %float %float_1 %1399 + %1401 = OpExtInst %float %1 FMax %1400 %float_0 + %1402 = OpExtInst %float %1 FSign %1397 + %1403 = OpConvertFToS %int %1402 + %1404 = OpConvertSToF %float %1403 + %1405 = OpFMul %float %1401 %1401 + %1406 = OpFSub %float %float_1 %1405 + %1407 = OpFMul %float %1404 %1406 + %1408 = OpFAdd %float %float_1 %1407 + %1409 = OpFMul %float %1408 %float_0_0250000004 + %1410 = OpFOrdLessThanEqual %bool %1395 %float_0_0533333346 + OpSelectionMerge %1411 None + OpBranchConditional %1410 %1412 %1413 + %1413 = OpLabel + %1414 = OpFOrdGreaterThanEqual %bool %1395 %float_0_159999996 + OpSelectionMerge %1415 None + OpBranchConditional %1414 %1416 %1417 + %1417 = OpLabel + %1418 = OpFDiv %float %float_0_239999995 %1394 + %1419 = OpFSub %float %1418 %float_0_5 + %1420 = OpFMul %float %1409 %1419 + OpBranch %1415 + %1416 = OpLabel + OpBranch %1415 + %1415 = OpLabel + %1421 = OpPhi %float %1420 %1417 %float_0 %1416 + OpBranch %1411 + %1412 = OpLabel + OpBranch %1411 + %1411 = OpLabel + %1422 = OpPhi %float %1421 %1415 %1409 %1412 + %1423 = OpFAdd %float %float_1 %1422 + %1424 = OpCompositeConstruct %v3float %1423 %1423 %1423 + %1425 = OpFMul %v3float %1369 %1424 + %1426 = OpCompositeExtract %float %1425 0 + %1427 = OpCompositeExtract %float %1425 1 + %1428 = OpFOrdEqual %bool %1426 %1427 + %1429 = OpCompositeExtract %float %1425 2 + %1430 = OpFOrdEqual %bool %1427 %1429 + %1431 = OpLogicalAnd %bool %1428 %1430 + OpSelectionMerge %1432 None + OpBranchConditional %1431 %1433 %1434 + %1434 = OpLabel + %1435 = OpExtInst %float %1 Sqrt %float_3 + %1436 = OpFSub %float %1427 %1429 + %1437 = OpFMul %float %1435 %1436 + %1438 = OpFMul %float %float_2 %1426 + %1439 = OpFSub %float %1438 %1427 + %1440 = OpFSub %float %1439 %1429 + %1441 = OpExtInst %float %1 Atan2 %1437 %1440 + %1442 = OpFMul %float %float_57_2957764 %1441 + OpBranch %1432 + %1433 = OpLabel + OpBranch %1432 + %1432 = OpLabel + %1443 = OpPhi %float %1442 %1434 %float_0 %1433 + %1444 = OpFOrdLessThan %bool %1443 %float_0 + OpSelectionMerge %1445 None + OpBranchConditional %1444 %1446 %1445 + %1446 = OpLabel + %1447 = OpFAdd %float %1443 %float_360 + OpBranch %1445 + %1445 = OpLabel + %1448 = OpPhi %float %1443 %1432 %1447 %1446 + %1449 = OpExtInst %float %1 FClamp %1448 %float_0 %float_360 + %1450 = OpFOrdGreaterThan %bool %1449 %float_180 + OpSelectionMerge %1451 None + OpBranchConditional %1450 %1452 %1451 + %1452 = OpLabel + %1453 = OpFSub %float %1449 %float_360 + OpBranch %1451 + %1451 = OpLabel + %1454 = OpPhi %float %1449 %1445 %1453 %1452 + %1455 = OpFOrdGreaterThan %bool %1454 %float_n67_5 + %1456 = OpFOrdLessThan %bool %1454 %float_67_5 + %1457 = OpLogicalAnd %bool %1455 %1456 + OpSelectionMerge %1458 None + OpBranchConditional %1457 %1459 %1458 + %1459 = OpLabel + %1460 = OpFSub %float %1454 %float_n67_5 + %1461 = OpFMul %float %1460 %float_0_0296296291 + %1462 = OpConvertFToS %int %1461 + %1463 = OpConvertSToF %float %1462 + %1464 = OpFSub %float %1461 %1463 + %1465 = OpFMul %float %1464 %1464 + %1466 = OpFMul %float %1465 %1464 + %1467 = OpIEqual %bool %1462 %int_3 + OpSelectionMerge %1468 None + OpBranchConditional %1467 %1469 %1470 + %1470 = OpLabel + %1471 = OpIEqual %bool %1462 %int_2 + OpSelectionMerge %1472 None + OpBranchConditional %1471 %1473 %1474 + %1474 = OpLabel + %1475 = OpIEqual %bool %1462 %int_1 + OpSelectionMerge %1476 None + OpBranchConditional %1475 %1477 %1478 + %1478 = OpLabel + %1479 = OpIEqual %bool %1462 %int_0 + OpSelectionMerge %1480 None + OpBranchConditional %1479 %1481 %1482 + %1482 = OpLabel + OpBranch %1480 + %1481 = OpLabel + %1483 = OpFMul %float %1466 %float_0_166666672 + OpBranch %1480 + %1480 = OpLabel + %1484 = OpPhi %float %float_0 %1482 %1483 %1481 + OpBranch %1476 + %1477 = OpLabel + %1485 = OpFMul %float %1466 %float_n0_5 + %1486 = OpFMul %float %1465 %float_0_5 + %1487 = OpFAdd %float %1485 %1486 + %1488 = OpFMul %float %1464 %float_0_5 + %1489 = OpFAdd %float %1487 %1488 + %1490 = OpFAdd %float %1489 %float_0_166666672 + OpBranch %1476 + %1476 = OpLabel + %1491 = OpPhi %float %1484 %1480 %1490 %1477 + OpBranch %1472 + %1473 = OpLabel + %1492 = OpFMul %float %1466 %float_0_5 + %1493 = OpFMul %float %1465 %float_n1 + %1494 = OpFAdd %float %1492 %1493 + %1495 = OpFAdd %float %1494 %float_0_666666687 + OpBranch %1472 + %1472 = OpLabel + %1496 = OpPhi %float %1491 %1476 %1495 %1473 + OpBranch %1468 + %1469 = OpLabel + %1497 = OpFMul %float %1466 %float_n0_166666672 + %1498 = OpFMul %float %1465 %float_0_5 + %1499 = OpFAdd %float %1497 %1498 + %1500 = OpFMul %float %1464 %float_n0_5 + %1501 = OpFAdd %float %1499 %1500 + %1502 = OpFAdd %float %1501 %float_0_166666672 + OpBranch %1468 + %1468 = OpLabel + %1503 = OpPhi %float %1496 %1472 %1502 %1469 + OpBranch %1458 + %1458 = OpLabel + %1504 = OpPhi %float %float_0 %1451 %1503 %1468 + %1505 = OpFMul %float %1504 %float_1_5 + %1506 = OpFMul %float %1505 %1381 + %1507 = OpFSub %float %float_0_0299999993 %1426 + %1508 = OpFMul %float %1506 %1507 + %1509 = OpFMul %float %1508 %float_0_180000007 + %1510 = OpFAdd %float %1426 %1509 + %1511 = OpCompositeInsert %v3float %1510 %1425 0 + %1512 = OpExtInst %v3float %1 FClamp %1511 %138 %337 + %1513 = OpVectorTimesMatrix %v3float %1512 %434 + %1514 = OpExtInst %v3float %1 FClamp %1513 %138 %337 + %1515 = OpDot %float %1514 %73 + %1516 = OpCompositeConstruct %v3float %1515 %1515 %1515 + %1517 = OpExtInst %v3float %1 FMix %1516 %1514 %241 + %1518 = OpCompositeExtract %float %1517 0 + %1519 = OpExtInst %float %1 Exp2 %float_n15 + %1520 = OpFMul %float %float_0_179999992 %1519 + %1521 = OpExtInst %float %1 Exp2 %float_18 + %1522 = OpFMul %float %float_0_179999992 %1521 + OpStore %528 %499 + OpStore %527 %500 + %1523 = OpFOrdLessThanEqual %bool %1518 %float_0 + %1524 = OpExtInst %float %1 Exp2 %float_n14 + %1525 = OpSelect %float %1523 %1524 %1518 + %1526 = OpExtInst %float %1 Log %1525 + %1527 = OpFDiv %float %1526 %1091 + %1528 = OpExtInst %float %1 Log %1520 + %1529 = OpFDiv %float %1528 %1091 + %1530 = OpFOrdLessThanEqual %bool %1527 %1529 + OpSelectionMerge %1531 None + OpBranchConditional %1530 %1532 %1533 + %1533 = OpLabel + %1534 = OpFOrdGreaterThan %bool %1527 %1529 + %1535 = OpExtInst %float %1 Log %float_0_180000007 + %1536 = OpFDiv %float %1535 %1091 + %1537 = OpFOrdLessThan %bool %1527 %1536 + %1538 = OpLogicalAnd %bool %1534 %1537 + OpSelectionMerge %1539 None + OpBranchConditional %1538 %1540 %1541 + %1541 = OpLabel + %1542 = OpFOrdGreaterThanEqual %bool %1527 %1536 + %1543 = OpExtInst %float %1 Log %1522 + %1544 = OpFDiv %float %1543 %1091 + %1545 = OpFOrdLessThan %bool %1527 %1544 + %1546 = OpLogicalAnd %bool %1542 %1545 + OpSelectionMerge %1547 None + OpBranchConditional %1546 %1548 %1549 + %1549 = OpLabel + %1550 = OpExtInst %float %1 Log %float_10000 + %1551 = OpFDiv %float %1550 %1091 + OpBranch %1547 + %1548 = OpLabel + %1552 = OpFSub %float %1527 %1536 + %1553 = OpFMul %float %float_3 %1552 + %1554 = OpFSub %float %1544 %1536 + %1555 = OpFDiv %float %1553 %1554 + %1556 = OpConvertFToS %int %1555 + %1557 = OpConvertSToF %float %1556 + %1558 = OpFSub %float %1555 %1557 + %1559 = OpAccessChain %_ptr_Function_float %527 %1556 + %1560 = OpLoad %float %1559 + %1561 = OpIAdd %int %1556 %int_1 + %1562 = OpAccessChain %_ptr_Function_float %527 %1561 + %1563 = OpLoad %float %1562 + %1564 = OpIAdd %int %1556 %int_2 + %1565 = OpAccessChain %_ptr_Function_float %527 %1564 + %1566 = OpLoad %float %1565 + %1567 = OpCompositeConstruct %v3float %1560 %1563 %1566 + %1568 = OpFMul %float %1558 %1558 + %1569 = OpCompositeConstruct %v3float %1568 %1558 %float_1 + %1570 = OpMatrixTimesVector %v3float %466 %1567 + %1571 = OpDot %float %1569 %1570 + OpBranch %1547 + %1547 = OpLabel + %1572 = OpPhi %float %1551 %1549 %1571 %1548 + OpBranch %1539 + %1540 = OpLabel + %1573 = OpFSub %float %1527 %1529 + %1574 = OpFMul %float %float_3 %1573 + %1575 = OpFSub %float %1536 %1529 + %1576 = OpFDiv %float %1574 %1575 + %1577 = OpConvertFToS %int %1576 + %1578 = OpConvertSToF %float %1577 + %1579 = OpFSub %float %1576 %1578 + %1580 = OpAccessChain %_ptr_Function_float %528 %1577 + %1581 = OpLoad %float %1580 + %1582 = OpIAdd %int %1577 %int_1 + %1583 = OpAccessChain %_ptr_Function_float %528 %1582 + %1584 = OpLoad %float %1583 + %1585 = OpIAdd %int %1577 %int_2 + %1586 = OpAccessChain %_ptr_Function_float %528 %1585 + %1587 = OpLoad %float %1586 + %1588 = OpCompositeConstruct %v3float %1581 %1584 %1587 + %1589 = OpFMul %float %1579 %1579 + %1590 = OpCompositeConstruct %v3float %1589 %1579 %float_1 + %1591 = OpMatrixTimesVector %v3float %466 %1588 + %1592 = OpDot %float %1590 %1591 + OpBranch %1539 + %1539 = OpLabel + %1593 = OpPhi %float %1572 %1547 %1592 %1540 + OpBranch %1531 + %1532 = OpLabel + %1594 = OpExtInst %float %1 Log %float_9_99999975en05 + %1595 = OpFDiv %float %1594 %1091 + OpBranch %1531 + %1531 = OpLabel + %1596 = OpPhi %float %1593 %1539 %1595 %1532 + %1597 = OpExtInst %float %1 Pow %float_10 %1596 + %1598 = OpCompositeInsert %v3float %1597 %523 0 + %1599 = OpCompositeExtract %float %1517 1 + OpStore %530 %499 + OpStore %529 %500 + %1600 = OpFOrdLessThanEqual %bool %1599 %float_0 + %1601 = OpSelect %float %1600 %1524 %1599 + %1602 = OpExtInst %float %1 Log %1601 + %1603 = OpFDiv %float %1602 %1091 + %1604 = OpFOrdLessThanEqual %bool %1603 %1529 + OpSelectionMerge %1605 None + OpBranchConditional %1604 %1606 %1607 + %1607 = OpLabel + %1608 = OpFOrdGreaterThan %bool %1603 %1529 + %1609 = OpExtInst %float %1 Log %float_0_180000007 + %1610 = OpFDiv %float %1609 %1091 + %1611 = OpFOrdLessThan %bool %1603 %1610 + %1612 = OpLogicalAnd %bool %1608 %1611 + OpSelectionMerge %1613 None + OpBranchConditional %1612 %1614 %1615 + %1615 = OpLabel + %1616 = OpFOrdGreaterThanEqual %bool %1603 %1610 + %1617 = OpExtInst %float %1 Log %1522 + %1618 = OpFDiv %float %1617 %1091 + %1619 = OpFOrdLessThan %bool %1603 %1618 + %1620 = OpLogicalAnd %bool %1616 %1619 + OpSelectionMerge %1621 None + OpBranchConditional %1620 %1622 %1623 + %1623 = OpLabel + %1624 = OpExtInst %float %1 Log %float_10000 + %1625 = OpFDiv %float %1624 %1091 + OpBranch %1621 + %1622 = OpLabel + %1626 = OpFSub %float %1603 %1610 + %1627 = OpFMul %float %float_3 %1626 + %1628 = OpFSub %float %1618 %1610 + %1629 = OpFDiv %float %1627 %1628 + %1630 = OpConvertFToS %int %1629 + %1631 = OpConvertSToF %float %1630 + %1632 = OpFSub %float %1629 %1631 + %1633 = OpAccessChain %_ptr_Function_float %529 %1630 + %1634 = OpLoad %float %1633 + %1635 = OpIAdd %int %1630 %int_1 + %1636 = OpAccessChain %_ptr_Function_float %529 %1635 + %1637 = OpLoad %float %1636 + %1638 = OpIAdd %int %1630 %int_2 + %1639 = OpAccessChain %_ptr_Function_float %529 %1638 + %1640 = OpLoad %float %1639 + %1641 = OpCompositeConstruct %v3float %1634 %1637 %1640 + %1642 = OpFMul %float %1632 %1632 + %1643 = OpCompositeConstruct %v3float %1642 %1632 %float_1 + %1644 = OpMatrixTimesVector %v3float %466 %1641 + %1645 = OpDot %float %1643 %1644 + OpBranch %1621 + %1621 = OpLabel + %1646 = OpPhi %float %1625 %1623 %1645 %1622 + OpBranch %1613 + %1614 = OpLabel + %1647 = OpFSub %float %1603 %1529 + %1648 = OpFMul %float %float_3 %1647 + %1649 = OpFSub %float %1610 %1529 + %1650 = OpFDiv %float %1648 %1649 + %1651 = OpConvertFToS %int %1650 + %1652 = OpConvertSToF %float %1651 + %1653 = OpFSub %float %1650 %1652 + %1654 = OpAccessChain %_ptr_Function_float %530 %1651 + %1655 = OpLoad %float %1654 + %1656 = OpIAdd %int %1651 %int_1 + %1657 = OpAccessChain %_ptr_Function_float %530 %1656 + %1658 = OpLoad %float %1657 + %1659 = OpIAdd %int %1651 %int_2 + %1660 = OpAccessChain %_ptr_Function_float %530 %1659 + %1661 = OpLoad %float %1660 + %1662 = OpCompositeConstruct %v3float %1655 %1658 %1661 + %1663 = OpFMul %float %1653 %1653 + %1664 = OpCompositeConstruct %v3float %1663 %1653 %float_1 + %1665 = OpMatrixTimesVector %v3float %466 %1662 + %1666 = OpDot %float %1664 %1665 + OpBranch %1613 + %1613 = OpLabel + %1667 = OpPhi %float %1646 %1621 %1666 %1614 + OpBranch %1605 + %1606 = OpLabel + %1668 = OpExtInst %float %1 Log %float_9_99999975en05 + %1669 = OpFDiv %float %1668 %1091 + OpBranch %1605 + %1605 = OpLabel + %1670 = OpPhi %float %1667 %1613 %1669 %1606 + %1671 = OpExtInst %float %1 Pow %float_10 %1670 + %1672 = OpCompositeInsert %v3float %1671 %1598 1 + %1673 = OpCompositeExtract %float %1517 2 + OpStore %532 %499 + OpStore %531 %500 + %1674 = OpFOrdLessThanEqual %bool %1673 %float_0 + %1675 = OpSelect %float %1674 %1524 %1673 + %1676 = OpExtInst %float %1 Log %1675 + %1677 = OpFDiv %float %1676 %1091 + %1678 = OpFOrdLessThanEqual %bool %1677 %1529 + OpSelectionMerge %1679 None + OpBranchConditional %1678 %1680 %1681 + %1681 = OpLabel + %1682 = OpFOrdGreaterThan %bool %1677 %1529 + %1683 = OpExtInst %float %1 Log %float_0_180000007 + %1684 = OpFDiv %float %1683 %1091 + %1685 = OpFOrdLessThan %bool %1677 %1684 + %1686 = OpLogicalAnd %bool %1682 %1685 + OpSelectionMerge %1687 None + OpBranchConditional %1686 %1688 %1689 + %1689 = OpLabel + %1690 = OpFOrdGreaterThanEqual %bool %1677 %1684 + %1691 = OpExtInst %float %1 Log %1522 + %1692 = OpFDiv %float %1691 %1091 + %1693 = OpFOrdLessThan %bool %1677 %1692 + %1694 = OpLogicalAnd %bool %1690 %1693 + OpSelectionMerge %1695 None + OpBranchConditional %1694 %1696 %1697 + %1697 = OpLabel + %1698 = OpExtInst %float %1 Log %float_10000 + %1699 = OpFDiv %float %1698 %1091 + OpBranch %1695 + %1696 = OpLabel + %1700 = OpFSub %float %1677 %1684 + %1701 = OpFMul %float %float_3 %1700 + %1702 = OpFSub %float %1692 %1684 + %1703 = OpFDiv %float %1701 %1702 + %1704 = OpConvertFToS %int %1703 + %1705 = OpConvertSToF %float %1704 + %1706 = OpFSub %float %1703 %1705 + %1707 = OpAccessChain %_ptr_Function_float %531 %1704 + %1708 = OpLoad %float %1707 + %1709 = OpIAdd %int %1704 %int_1 + %1710 = OpAccessChain %_ptr_Function_float %531 %1709 + %1711 = OpLoad %float %1710 + %1712 = OpIAdd %int %1704 %int_2 + %1713 = OpAccessChain %_ptr_Function_float %531 %1712 + %1714 = OpLoad %float %1713 + %1715 = OpCompositeConstruct %v3float %1708 %1711 %1714 + %1716 = OpFMul %float %1706 %1706 + %1717 = OpCompositeConstruct %v3float %1716 %1706 %float_1 + %1718 = OpMatrixTimesVector %v3float %466 %1715 + %1719 = OpDot %float %1717 %1718 + OpBranch %1695 + %1695 = OpLabel + %1720 = OpPhi %float %1699 %1697 %1719 %1696 + OpBranch %1687 + %1688 = OpLabel + %1721 = OpFSub %float %1677 %1529 + %1722 = OpFMul %float %float_3 %1721 + %1723 = OpFSub %float %1684 %1529 + %1724 = OpFDiv %float %1722 %1723 + %1725 = OpConvertFToS %int %1724 + %1726 = OpConvertSToF %float %1725 + %1727 = OpFSub %float %1724 %1726 + %1728 = OpAccessChain %_ptr_Function_float %532 %1725 + %1729 = OpLoad %float %1728 + %1730 = OpIAdd %int %1725 %int_1 + %1731 = OpAccessChain %_ptr_Function_float %532 %1730 + %1732 = OpLoad %float %1731 + %1733 = OpIAdd %int %1725 %int_2 + %1734 = OpAccessChain %_ptr_Function_float %532 %1733 + %1735 = OpLoad %float %1734 + %1736 = OpCompositeConstruct %v3float %1729 %1732 %1735 + %1737 = OpFMul %float %1727 %1727 + %1738 = OpCompositeConstruct %v3float %1737 %1727 %float_1 + %1739 = OpMatrixTimesVector %v3float %466 %1736 + %1740 = OpDot %float %1738 %1739 + OpBranch %1687 + %1687 = OpLabel + %1741 = OpPhi %float %1720 %1695 %1740 %1688 + OpBranch %1679 + %1680 = OpLabel + %1742 = OpExtInst %float %1 Log %float_9_99999975en05 + %1743 = OpFDiv %float %1742 %1091 + OpBranch %1679 + %1679 = OpLabel + %1744 = OpPhi %float %1741 %1687 %1743 %1680 + %1745 = OpExtInst %float %1 Pow %float_10 %1744 + %1746 = OpCompositeInsert %v3float %1745 %1672 2 + %1747 = OpVectorTimesMatrix %v3float %1746 %438 + %1748 = OpVectorTimesMatrix %v3float %1747 %434 + %1749 = OpExtInst %float %1 Pow %float_2 %float_n12 + %1750 = OpFMul %float %float_0_179999992 %1749 + OpStore %540 %499 + OpStore %539 %500 + %1751 = OpFOrdLessThanEqual %bool %1750 %float_0 + %1752 = OpSelect %float %1751 %1524 %1750 + %1753 = OpExtInst %float %1 Log %1752 + %1754 = OpFDiv %float %1753 %1091 + %1755 = OpFOrdLessThanEqual %bool %1754 %1529 + OpSelectionMerge %1756 None + OpBranchConditional %1755 %1757 %1758 + %1758 = OpLabel + %1759 = OpFOrdGreaterThan %bool %1754 %1529 + %1760 = OpExtInst %float %1 Log %float_0_180000007 + %1761 = OpFDiv %float %1760 %1091 + %1762 = OpFOrdLessThan %bool %1754 %1761 + %1763 = OpLogicalAnd %bool %1759 %1762 + OpSelectionMerge %1764 None + OpBranchConditional %1763 %1765 %1766 + %1766 = OpLabel + %1767 = OpFOrdGreaterThanEqual %bool %1754 %1761 + %1768 = OpExtInst %float %1 Log %1522 + %1769 = OpFDiv %float %1768 %1091 + %1770 = OpFOrdLessThan %bool %1754 %1769 + %1771 = OpLogicalAnd %bool %1767 %1770 + OpSelectionMerge %1772 None + OpBranchConditional %1771 %1773 %1774 + %1774 = OpLabel + %1775 = OpExtInst %float %1 Log %float_10000 + %1776 = OpFDiv %float %1775 %1091 + OpBranch %1772 + %1773 = OpLabel + %1777 = OpFSub %float %1754 %1761 + %1778 = OpFMul %float %float_3 %1777 + %1779 = OpFSub %float %1769 %1761 + %1780 = OpFDiv %float %1778 %1779 + %1781 = OpConvertFToS %int %1780 + %1782 = OpConvertSToF %float %1781 + %1783 = OpFSub %float %1780 %1782 + %1784 = OpAccessChain %_ptr_Function_float %539 %1781 + %1785 = OpLoad %float %1784 + %1786 = OpIAdd %int %1781 %int_1 + %1787 = OpAccessChain %_ptr_Function_float %539 %1786 + %1788 = OpLoad %float %1787 + %1789 = OpIAdd %int %1781 %int_2 + %1790 = OpAccessChain %_ptr_Function_float %539 %1789 + %1791 = OpLoad %float %1790 + %1792 = OpCompositeConstruct %v3float %1785 %1788 %1791 + %1793 = OpFMul %float %1783 %1783 + %1794 = OpCompositeConstruct %v3float %1793 %1783 %float_1 + %1795 = OpMatrixTimesVector %v3float %466 %1792 + %1796 = OpDot %float %1794 %1795 + OpBranch %1772 + %1772 = OpLabel + %1797 = OpPhi %float %1776 %1774 %1796 %1773 + OpBranch %1764 + %1765 = OpLabel + %1798 = OpFSub %float %1754 %1529 + %1799 = OpFMul %float %float_3 %1798 + %1800 = OpFSub %float %1761 %1529 + %1801 = OpFDiv %float %1799 %1800 + %1802 = OpConvertFToS %int %1801 + %1803 = OpConvertSToF %float %1802 + %1804 = OpFSub %float %1801 %1803 + %1805 = OpAccessChain %_ptr_Function_float %540 %1802 + %1806 = OpLoad %float %1805 + %1807 = OpIAdd %int %1802 %int_1 + %1808 = OpAccessChain %_ptr_Function_float %540 %1807 + %1809 = OpLoad %float %1808 + %1810 = OpIAdd %int %1802 %int_2 + %1811 = OpAccessChain %_ptr_Function_float %540 %1810 + %1812 = OpLoad %float %1811 + %1813 = OpCompositeConstruct %v3float %1806 %1809 %1812 + %1814 = OpFMul %float %1804 %1804 + %1815 = OpCompositeConstruct %v3float %1814 %1804 %float_1 + %1816 = OpMatrixTimesVector %v3float %466 %1813 + %1817 = OpDot %float %1815 %1816 + OpBranch %1764 + %1764 = OpLabel + %1818 = OpPhi %float %1797 %1772 %1817 %1765 + OpBranch %1756 + %1757 = OpLabel + %1819 = OpExtInst %float %1 Log %float_9_99999975en05 + %1820 = OpFDiv %float %1819 %1091 + OpBranch %1756 + %1756 = OpLabel + %1821 = OpPhi %float %1818 %1764 %1820 %1757 + %1822 = OpExtInst %float %1 Pow %float_10 %1821 + OpStore %542 %499 + OpStore %541 %500 + %1823 = OpExtInst %float %1 Log %float_0_180000007 + %1824 = OpFDiv %float %1823 %1091 + %1825 = OpFOrdLessThanEqual %bool %1824 %1529 + OpSelectionMerge %1826 None + OpBranchConditional %1825 %1827 %1828 + %1828 = OpLabel + %1829 = OpFOrdGreaterThan %bool %1824 %1529 + %1830 = OpFOrdLessThan %bool %1824 %1824 + %1831 = OpLogicalAnd %bool %1829 %1830 + OpSelectionMerge %1832 None + OpBranchConditional %1831 %1833 %1834 + %1834 = OpLabel + %1835 = OpFOrdGreaterThanEqual %bool %1824 %1824 + %1836 = OpExtInst %float %1 Log %1522 + %1837 = OpFDiv %float %1836 %1091 + %1838 = OpFOrdLessThan %bool %1824 %1837 + %1839 = OpLogicalAnd %bool %1835 %1838 + OpSelectionMerge %1840 None + OpBranchConditional %1839 %1841 %1842 + %1842 = OpLabel + %1843 = OpExtInst %float %1 Log %float_10000 + %1844 = OpFDiv %float %1843 %1091 + OpBranch %1840 + %1841 = OpLabel + %1845 = OpFSub %float %1824 %1824 + %1846 = OpFMul %float %float_3 %1845 + %1847 = OpFSub %float %1837 %1824 + %1848 = OpFDiv %float %1846 %1847 + %1849 = OpConvertFToS %int %1848 + %1850 = OpConvertSToF %float %1849 + %1851 = OpFSub %float %1848 %1850 + %1852 = OpAccessChain %_ptr_Function_float %541 %1849 + %1853 = OpLoad %float %1852 + %1854 = OpIAdd %int %1849 %int_1 + %1855 = OpAccessChain %_ptr_Function_float %541 %1854 + %1856 = OpLoad %float %1855 + %1857 = OpIAdd %int %1849 %int_2 + %1858 = OpAccessChain %_ptr_Function_float %541 %1857 + %1859 = OpLoad %float %1858 + %1860 = OpCompositeConstruct %v3float %1853 %1856 %1859 + %1861 = OpFMul %float %1851 %1851 + %1862 = OpCompositeConstruct %v3float %1861 %1851 %float_1 + %1863 = OpMatrixTimesVector %v3float %466 %1860 + %1864 = OpDot %float %1862 %1863 + OpBranch %1840 + %1840 = OpLabel + %1865 = OpPhi %float %1844 %1842 %1864 %1841 + OpBranch %1832 + %1833 = OpLabel + %1866 = OpAccessChain %_ptr_Function_float %542 %int_3 + %1867 = OpLoad %float %1866 + %1868 = OpAccessChain %_ptr_Function_float %542 %int_4 + %1869 = OpLoad %float %1868 + %1870 = OpAccessChain %_ptr_Function_float %542 %int_5 + %1871 = OpLoad %float %1870 + %1872 = OpCompositeConstruct %v3float %1867 %1869 %1871 + %1873 = OpMatrixTimesVector %v3float %466 %1872 + %1874 = OpCompositeExtract %float %1873 2 + OpBranch %1832 + %1832 = OpLabel + %1875 = OpPhi %float %1865 %1840 %1874 %1833 + OpBranch %1826 + %1827 = OpLabel + %1876 = OpExtInst %float %1 Log %float_9_99999975en05 + %1877 = OpFDiv %float %1876 %1091 + OpBranch %1826 + %1826 = OpLabel + %1878 = OpPhi %float %1875 %1832 %1877 %1827 + %1879 = OpExtInst %float %1 Pow %float_10 %1878 + %1880 = OpExtInst %float %1 Pow %float_2 %float_11 + %1881 = OpFMul %float %float_0_179999992 %1880 + OpStore %544 %499 + OpStore %543 %500 + %1882 = OpFOrdLessThanEqual %bool %1881 %float_0 + %1883 = OpSelect %float %1882 %1524 %1881 + %1884 = OpExtInst %float %1 Log %1883 + %1885 = OpFDiv %float %1884 %1091 + %1886 = OpFOrdLessThanEqual %bool %1885 %1529 + OpSelectionMerge %1887 None + OpBranchConditional %1886 %1888 %1889 + %1889 = OpLabel + %1890 = OpFOrdGreaterThan %bool %1885 %1529 + %1891 = OpFOrdLessThan %bool %1885 %1824 + %1892 = OpLogicalAnd %bool %1890 %1891 + OpSelectionMerge %1893 None + OpBranchConditional %1892 %1894 %1895 + %1895 = OpLabel + %1896 = OpFOrdGreaterThanEqual %bool %1885 %1824 + %1897 = OpExtInst %float %1 Log %1522 + %1898 = OpFDiv %float %1897 %1091 + %1899 = OpFOrdLessThan %bool %1885 %1898 + %1900 = OpLogicalAnd %bool %1896 %1899 + OpSelectionMerge %1901 None + OpBranchConditional %1900 %1902 %1903 + %1903 = OpLabel + %1904 = OpExtInst %float %1 Log %float_10000 + %1905 = OpFDiv %float %1904 %1091 + OpBranch %1901 + %1902 = OpLabel + %1906 = OpFSub %float %1885 %1824 + %1907 = OpFMul %float %float_3 %1906 + %1908 = OpFSub %float %1898 %1824 + %1909 = OpFDiv %float %1907 %1908 + %1910 = OpConvertFToS %int %1909 + %1911 = OpConvertSToF %float %1910 + %1912 = OpFSub %float %1909 %1911 + %1913 = OpAccessChain %_ptr_Function_float %543 %1910 + %1914 = OpLoad %float %1913 + %1915 = OpIAdd %int %1910 %int_1 + %1916 = OpAccessChain %_ptr_Function_float %543 %1915 + %1917 = OpLoad %float %1916 + %1918 = OpIAdd %int %1910 %int_2 + %1919 = OpAccessChain %_ptr_Function_float %543 %1918 + %1920 = OpLoad %float %1919 + %1921 = OpCompositeConstruct %v3float %1914 %1917 %1920 + %1922 = OpFMul %float %1912 %1912 + %1923 = OpCompositeConstruct %v3float %1922 %1912 %float_1 + %1924 = OpMatrixTimesVector %v3float %466 %1921 + %1925 = OpDot %float %1923 %1924 + OpBranch %1901 + %1901 = OpLabel + %1926 = OpPhi %float %1905 %1903 %1925 %1902 + OpBranch %1893 + %1894 = OpLabel + %1927 = OpFSub %float %1885 %1529 + %1928 = OpFMul %float %float_3 %1927 + %1929 = OpFSub %float %1824 %1529 + %1930 = OpFDiv %float %1928 %1929 + %1931 = OpConvertFToS %int %1930 + %1932 = OpConvertSToF %float %1931 + %1933 = OpFSub %float %1930 %1932 + %1934 = OpAccessChain %_ptr_Function_float %544 %1931 + %1935 = OpLoad %float %1934 + %1936 = OpIAdd %int %1931 %int_1 + %1937 = OpAccessChain %_ptr_Function_float %544 %1936 + %1938 = OpLoad %float %1937 + %1939 = OpIAdd %int %1931 %int_2 + %1940 = OpAccessChain %_ptr_Function_float %544 %1939 + %1941 = OpLoad %float %1940 + %1942 = OpCompositeConstruct %v3float %1935 %1938 %1941 + %1943 = OpFMul %float %1933 %1933 + %1944 = OpCompositeConstruct %v3float %1943 %1933 %float_1 + %1945 = OpMatrixTimesVector %v3float %466 %1942 + %1946 = OpDot %float %1944 %1945 + OpBranch %1893 + %1893 = OpLabel + %1947 = OpPhi %float %1926 %1901 %1946 %1894 + OpBranch %1887 + %1888 = OpLabel + %1948 = OpExtInst %float %1 Log %float_9_99999975en05 + %1949 = OpFDiv %float %1948 %1091 + OpBranch %1887 + %1887 = OpLabel + %1950 = OpPhi %float %1947 %1893 %1949 %1888 + %1951 = OpExtInst %float %1 Pow %float_10 %1950 + %1952 = OpCompositeExtract %float %1748 0 + OpStore %538 %506 + OpStore %537 %507 + %1953 = OpFOrdLessThanEqual %bool %1952 %float_0 + %1954 = OpSelect %float %1953 %float_9_99999975en05 %1952 + %1955 = OpExtInst %float %1 Log %1954 + %1956 = OpFDiv %float %1955 %1091 + %1957 = OpExtInst %float %1 Log %1822 + %1958 = OpFDiv %float %1957 %1091 + %1959 = OpFOrdLessThanEqual %bool %1956 %1958 + OpSelectionMerge %1960 None + OpBranchConditional %1959 %1961 %1962 + %1962 = OpLabel + %1963 = OpFOrdGreaterThan %bool %1956 %1958 + %1964 = OpExtInst %float %1 Log %1879 + %1965 = OpFDiv %float %1964 %1091 + %1966 = OpFOrdLessThan %bool %1956 %1965 + %1967 = OpLogicalAnd %bool %1963 %1966 + OpSelectionMerge %1968 None + OpBranchConditional %1967 %1969 %1970 + %1970 = OpLabel + %1971 = OpFOrdGreaterThanEqual %bool %1956 %1965 + %1972 = OpExtInst %float %1 Log %1951 + %1973 = OpFDiv %float %1972 %1091 + %1974 = OpFOrdLessThan %bool %1956 %1973 + %1975 = OpLogicalAnd %bool %1971 %1974 + OpSelectionMerge %1976 None + OpBranchConditional %1975 %1977 %1978 + %1978 = OpLabel + %1979 = OpFMul %float %1956 %float_0_119999997 + %1980 = OpExtInst %float %1 Log %float_2000 + %1981 = OpFDiv %float %1980 %1091 + %1982 = OpFMul %float %float_0_119999997 %1972 + %1983 = OpFDiv %float %1982 %1091 + %1984 = OpFSub %float %1981 %1983 + %1985 = OpFAdd %float %1979 %1984 + OpBranch %1976 + %1977 = OpLabel + %1986 = OpFSub %float %1956 %1965 + %1987 = OpFMul %float %float_7 %1986 + %1988 = OpFSub %float %1973 %1965 + %1989 = OpFDiv %float %1987 %1988 + %1990 = OpConvertFToS %int %1989 + %1991 = OpConvertSToF %float %1990 + %1992 = OpFSub %float %1989 %1991 + %1993 = OpAccessChain %_ptr_Function_float %537 %1990 + %1994 = OpLoad %float %1993 + %1995 = OpIAdd %int %1990 %int_1 + %1996 = OpAccessChain %_ptr_Function_float %537 %1995 + %1997 = OpLoad %float %1996 + %1998 = OpIAdd %int %1990 %int_2 + %1999 = OpAccessChain %_ptr_Function_float %537 %1998 + %2000 = OpLoad %float %1999 + %2001 = OpCompositeConstruct %v3float %1994 %1997 %2000 + %2002 = OpFMul %float %1992 %1992 + %2003 = OpCompositeConstruct %v3float %2002 %1992 %float_1 + %2004 = OpMatrixTimesVector %v3float %466 %2001 + %2005 = OpDot %float %2003 %2004 + OpBranch %1976 + %1976 = OpLabel + %2006 = OpPhi %float %1985 %1978 %2005 %1977 + OpBranch %1968 + %1969 = OpLabel + %2007 = OpFSub %float %1956 %1958 + %2008 = OpFMul %float %float_7 %2007 + %2009 = OpFSub %float %1965 %1958 + %2010 = OpFDiv %float %2008 %2009 + %2011 = OpConvertFToS %int %2010 + %2012 = OpConvertSToF %float %2011 + %2013 = OpFSub %float %2010 %2012 + %2014 = OpAccessChain %_ptr_Function_float %538 %2011 + %2015 = OpLoad %float %2014 + %2016 = OpIAdd %int %2011 %int_1 + %2017 = OpAccessChain %_ptr_Function_float %538 %2016 + %2018 = OpLoad %float %2017 + %2019 = OpIAdd %int %2011 %int_2 + %2020 = OpAccessChain %_ptr_Function_float %538 %2019 + %2021 = OpLoad %float %2020 + %2022 = OpCompositeConstruct %v3float %2015 %2018 %2021 + %2023 = OpFMul %float %2013 %2013 + %2024 = OpCompositeConstruct %v3float %2023 %2013 %float_1 + %2025 = OpMatrixTimesVector %v3float %466 %2022 + %2026 = OpDot %float %2024 %2025 + OpBranch %1968 + %1968 = OpLabel + %2027 = OpPhi %float %2006 %1976 %2026 %1969 + OpBranch %1960 + %1961 = OpLabel + %2028 = OpExtInst %float %1 Log %float_0_00499999989 + %2029 = OpFDiv %float %2028 %1091 + OpBranch %1960 + %1960 = OpLabel + %2030 = OpPhi %float %2027 %1968 %2029 %1961 + %2031 = OpExtInst %float %1 Pow %float_10 %2030 + %2032 = OpCompositeInsert %v3float %2031 %523 0 + %2033 = OpCompositeExtract %float %1748 1 + OpStore %536 %506 + OpStore %535 %507 + %2034 = OpFOrdLessThanEqual %bool %2033 %float_0 + %2035 = OpSelect %float %2034 %float_9_99999975en05 %2033 + %2036 = OpExtInst %float %1 Log %2035 + %2037 = OpFDiv %float %2036 %1091 + %2038 = OpFOrdLessThanEqual %bool %2037 %1958 + OpSelectionMerge %2039 None + OpBranchConditional %2038 %2040 %2041 + %2041 = OpLabel + %2042 = OpFOrdGreaterThan %bool %2037 %1958 + %2043 = OpExtInst %float %1 Log %1879 + %2044 = OpFDiv %float %2043 %1091 + %2045 = OpFOrdLessThan %bool %2037 %2044 + %2046 = OpLogicalAnd %bool %2042 %2045 + OpSelectionMerge %2047 None + OpBranchConditional %2046 %2048 %2049 + %2049 = OpLabel + %2050 = OpFOrdGreaterThanEqual %bool %2037 %2044 + %2051 = OpExtInst %float %1 Log %1951 + %2052 = OpFDiv %float %2051 %1091 + %2053 = OpFOrdLessThan %bool %2037 %2052 + %2054 = OpLogicalAnd %bool %2050 %2053 + OpSelectionMerge %2055 None + OpBranchConditional %2054 %2056 %2057 + %2057 = OpLabel + %2058 = OpFMul %float %2037 %float_0_119999997 + %2059 = OpExtInst %float %1 Log %float_2000 + %2060 = OpFDiv %float %2059 %1091 + %2061 = OpFMul %float %float_0_119999997 %2051 + %2062 = OpFDiv %float %2061 %1091 + %2063 = OpFSub %float %2060 %2062 + %2064 = OpFAdd %float %2058 %2063 + OpBranch %2055 + %2056 = OpLabel + %2065 = OpFSub %float %2037 %2044 + %2066 = OpFMul %float %float_7 %2065 + %2067 = OpFSub %float %2052 %2044 + %2068 = OpFDiv %float %2066 %2067 + %2069 = OpConvertFToS %int %2068 + %2070 = OpConvertSToF %float %2069 + %2071 = OpFSub %float %2068 %2070 + %2072 = OpAccessChain %_ptr_Function_float %535 %2069 + %2073 = OpLoad %float %2072 + %2074 = OpIAdd %int %2069 %int_1 + %2075 = OpAccessChain %_ptr_Function_float %535 %2074 + %2076 = OpLoad %float %2075 + %2077 = OpIAdd %int %2069 %int_2 + %2078 = OpAccessChain %_ptr_Function_float %535 %2077 + %2079 = OpLoad %float %2078 + %2080 = OpCompositeConstruct %v3float %2073 %2076 %2079 + %2081 = OpFMul %float %2071 %2071 + %2082 = OpCompositeConstruct %v3float %2081 %2071 %float_1 + %2083 = OpMatrixTimesVector %v3float %466 %2080 + %2084 = OpDot %float %2082 %2083 + OpBranch %2055 + %2055 = OpLabel + %2085 = OpPhi %float %2064 %2057 %2084 %2056 + OpBranch %2047 + %2048 = OpLabel + %2086 = OpFSub %float %2037 %1958 + %2087 = OpFMul %float %float_7 %2086 + %2088 = OpFSub %float %2044 %1958 + %2089 = OpFDiv %float %2087 %2088 + %2090 = OpConvertFToS %int %2089 + %2091 = OpConvertSToF %float %2090 + %2092 = OpFSub %float %2089 %2091 + %2093 = OpAccessChain %_ptr_Function_float %536 %2090 + %2094 = OpLoad %float %2093 + %2095 = OpIAdd %int %2090 %int_1 + %2096 = OpAccessChain %_ptr_Function_float %536 %2095 + %2097 = OpLoad %float %2096 + %2098 = OpIAdd %int %2090 %int_2 + %2099 = OpAccessChain %_ptr_Function_float %536 %2098 + %2100 = OpLoad %float %2099 + %2101 = OpCompositeConstruct %v3float %2094 %2097 %2100 + %2102 = OpFMul %float %2092 %2092 + %2103 = OpCompositeConstruct %v3float %2102 %2092 %float_1 + %2104 = OpMatrixTimesVector %v3float %466 %2101 + %2105 = OpDot %float %2103 %2104 + OpBranch %2047 + %2047 = OpLabel + %2106 = OpPhi %float %2085 %2055 %2105 %2048 + OpBranch %2039 + %2040 = OpLabel + %2107 = OpExtInst %float %1 Log %float_0_00499999989 + %2108 = OpFDiv %float %2107 %1091 + OpBranch %2039 + %2039 = OpLabel + %2109 = OpPhi %float %2106 %2047 %2108 %2040 + %2110 = OpExtInst %float %1 Pow %float_10 %2109 + %2111 = OpCompositeInsert %v3float %2110 %2032 1 + %2112 = OpCompositeExtract %float %1748 2 + OpStore %534 %506 + OpStore %533 %507 + %2113 = OpFOrdLessThanEqual %bool %2112 %float_0 + %2114 = OpSelect %float %2113 %float_9_99999975en05 %2112 + %2115 = OpExtInst %float %1 Log %2114 + %2116 = OpFDiv %float %2115 %1091 + %2117 = OpFOrdLessThanEqual %bool %2116 %1958 + OpSelectionMerge %2118 None + OpBranchConditional %2117 %2119 %2120 + %2120 = OpLabel + %2121 = OpFOrdGreaterThan %bool %2116 %1958 + %2122 = OpExtInst %float %1 Log %1879 + %2123 = OpFDiv %float %2122 %1091 + %2124 = OpFOrdLessThan %bool %2116 %2123 + %2125 = OpLogicalAnd %bool %2121 %2124 + OpSelectionMerge %2126 None + OpBranchConditional %2125 %2127 %2128 + %2128 = OpLabel + %2129 = OpFOrdGreaterThanEqual %bool %2116 %2123 + %2130 = OpExtInst %float %1 Log %1951 + %2131 = OpFDiv %float %2130 %1091 + %2132 = OpFOrdLessThan %bool %2116 %2131 + %2133 = OpLogicalAnd %bool %2129 %2132 + OpSelectionMerge %2134 None + OpBranchConditional %2133 %2135 %2136 + %2136 = OpLabel + %2137 = OpFMul %float %2116 %float_0_119999997 + %2138 = OpExtInst %float %1 Log %float_2000 + %2139 = OpFDiv %float %2138 %1091 + %2140 = OpFMul %float %float_0_119999997 %2130 + %2141 = OpFDiv %float %2140 %1091 + %2142 = OpFSub %float %2139 %2141 + %2143 = OpFAdd %float %2137 %2142 + OpBranch %2134 + %2135 = OpLabel + %2144 = OpFSub %float %2116 %2123 + %2145 = OpFMul %float %float_7 %2144 + %2146 = OpFSub %float %2131 %2123 + %2147 = OpFDiv %float %2145 %2146 + %2148 = OpConvertFToS %int %2147 + %2149 = OpConvertSToF %float %2148 + %2150 = OpFSub %float %2147 %2149 + %2151 = OpAccessChain %_ptr_Function_float %533 %2148 + %2152 = OpLoad %float %2151 + %2153 = OpIAdd %int %2148 %int_1 + %2154 = OpAccessChain %_ptr_Function_float %533 %2153 + %2155 = OpLoad %float %2154 + %2156 = OpIAdd %int %2148 %int_2 + %2157 = OpAccessChain %_ptr_Function_float %533 %2156 + %2158 = OpLoad %float %2157 + %2159 = OpCompositeConstruct %v3float %2152 %2155 %2158 + %2160 = OpFMul %float %2150 %2150 + %2161 = OpCompositeConstruct %v3float %2160 %2150 %float_1 + %2162 = OpMatrixTimesVector %v3float %466 %2159 + %2163 = OpDot %float %2161 %2162 + OpBranch %2134 + %2134 = OpLabel + %2164 = OpPhi %float %2143 %2136 %2163 %2135 + OpBranch %2126 + %2127 = OpLabel + %2165 = OpFSub %float %2116 %1958 + %2166 = OpFMul %float %float_7 %2165 + %2167 = OpFSub %float %2123 %1958 + %2168 = OpFDiv %float %2166 %2167 + %2169 = OpConvertFToS %int %2168 + %2170 = OpConvertSToF %float %2169 + %2171 = OpFSub %float %2168 %2170 + %2172 = OpAccessChain %_ptr_Function_float %534 %2169 + %2173 = OpLoad %float %2172 + %2174 = OpIAdd %int %2169 %int_1 + %2175 = OpAccessChain %_ptr_Function_float %534 %2174 + %2176 = OpLoad %float %2175 + %2177 = OpIAdd %int %2169 %int_2 + %2178 = OpAccessChain %_ptr_Function_float %534 %2177 + %2179 = OpLoad %float %2178 + %2180 = OpCompositeConstruct %v3float %2173 %2176 %2179 + %2181 = OpFMul %float %2171 %2171 + %2182 = OpCompositeConstruct %v3float %2181 %2171 %float_1 + %2183 = OpMatrixTimesVector %v3float %466 %2180 + %2184 = OpDot %float %2182 %2183 + OpBranch %2126 + %2126 = OpLabel + %2185 = OpPhi %float %2164 %2134 %2184 %2127 + OpBranch %2118 + %2119 = OpLabel + %2186 = OpExtInst %float %1 Log %float_0_00499999989 + %2187 = OpFDiv %float %2186 %1091 + OpBranch %2118 + %2118 = OpLabel + %2188 = OpPhi %float %2185 %2126 %2187 %2119 + %2189 = OpExtInst %float %1 Pow %float_10 %2188 + %2190 = OpCompositeInsert %v3float %2189 %2111 2 + %2191 = OpVectorTimesMatrix %v3float %2190 %602 + %2192 = OpFMul %v3float %2191 %519 + %2193 = OpExtInst %v3float %1 Pow %2192 %286 + %2194 = OpFMul %v3float %196 %2193 + %2195 = OpFAdd %v3float %195 %2194 + %2196 = OpFMul %v3float %197 %2193 + %2197 = OpFAdd %v3float %141 %2196 + %2198 = OpFDiv %v3float %141 %2197 + %2199 = OpFMul %v3float %2195 %2198 + %2200 = OpExtInst %v3float %1 Pow %2199 %287 + OpBranch %1342 + %1342 = OpLabel + %2201 = OpPhi %v3float %1366 %1346 %2200 %2118 + OpBranch %1336 + %1337 = OpLabel + %2202 = OpMatrixTimesMatrix %mat3v3float %572 %423 + %2203 = OpFMul %v3float %932 %285 + %2204 = OpVectorTimesMatrix %v3float %2203 %2202 + %2205 = OpCompositeExtract %float %2204 0 + %2206 = OpCompositeExtract %float %2204 1 + %2207 = OpExtInst %float %1 FMin %2205 %2206 + %2208 = OpCompositeExtract %float %2204 2 + %2209 = OpExtInst %float %1 FMin %2207 %2208 + %2210 = OpExtInst %float %1 FMax %2205 %2206 + %2211 = OpExtInst %float %1 FMax %2210 %2208 + %2212 = OpExtInst %float %1 FMax %2211 %float_1_00000001en10 + %2213 = OpExtInst %float %1 FMax %2209 %float_1_00000001en10 + %2214 = OpFSub %float %2212 %2213 + %2215 = OpExtInst %float %1 FMax %2211 %float_0_00999999978 + %2216 = OpFDiv %float %2214 %2215 + %2217 = OpFSub %float %2208 %2206 + %2218 = OpFMul %float %2208 %2217 + %2219 = OpFSub %float %2206 %2205 + %2220 = OpFMul %float %2206 %2219 + %2221 = OpFAdd %float %2218 %2220 + %2222 = OpFSub %float %2205 %2208 + %2223 = OpFMul %float %2205 %2222 + %2224 = OpFAdd %float %2221 %2223 + %2225 = OpExtInst %float %1 Sqrt %2224 + %2226 = OpFAdd %float %2208 %2206 + %2227 = OpFAdd %float %2226 %2205 + %2228 = OpFMul %float %float_1_75 %2225 + %2229 = OpFAdd %float %2227 %2228 + %2230 = OpFMul %float %2229 %float_0_333333343 + %2231 = OpFSub %float %2216 %float_0_400000006 + %2232 = OpFMul %float %2231 %float_5 + %2233 = OpFMul %float %2231 %float_2_5 + %2234 = OpExtInst %float %1 FAbs %2233 + %2235 = OpFSub %float %float_1 %2234 + %2236 = OpExtInst %float %1 FMax %2235 %float_0 + %2237 = OpExtInst %float %1 FSign %2232 + %2238 = OpConvertFToS %int %2237 + %2239 = OpConvertSToF %float %2238 + %2240 = OpFMul %float %2236 %2236 + %2241 = OpFSub %float %float_1 %2240 + %2242 = OpFMul %float %2239 %2241 + %2243 = OpFAdd %float %float_1 %2242 + %2244 = OpFMul %float %2243 %float_0_0250000004 + %2245 = OpFOrdLessThanEqual %bool %2230 %float_0_0533333346 + OpSelectionMerge %2246 None + OpBranchConditional %2245 %2247 %2248 + %2248 = OpLabel + %2249 = OpFOrdGreaterThanEqual %bool %2230 %float_0_159999996 + OpSelectionMerge %2250 None + OpBranchConditional %2249 %2251 %2252 + %2252 = OpLabel + %2253 = OpFDiv %float %float_0_239999995 %2229 + %2254 = OpFSub %float %2253 %float_0_5 + %2255 = OpFMul %float %2244 %2254 + OpBranch %2250 + %2251 = OpLabel + OpBranch %2250 + %2250 = OpLabel + %2256 = OpPhi %float %2255 %2252 %float_0 %2251 + OpBranch %2246 + %2247 = OpLabel + OpBranch %2246 + %2246 = OpLabel + %2257 = OpPhi %float %2256 %2250 %2244 %2247 + %2258 = OpFAdd %float %float_1 %2257 + %2259 = OpCompositeConstruct %v3float %2258 %2258 %2258 + %2260 = OpFMul %v3float %2204 %2259 + %2261 = OpCompositeExtract %float %2260 0 + %2262 = OpCompositeExtract %float %2260 1 + %2263 = OpFOrdEqual %bool %2261 %2262 + %2264 = OpCompositeExtract %float %2260 2 + %2265 = OpFOrdEqual %bool %2262 %2264 + %2266 = OpLogicalAnd %bool %2263 %2265 + OpSelectionMerge %2267 None + OpBranchConditional %2266 %2268 %2269 + %2269 = OpLabel + %2270 = OpExtInst %float %1 Sqrt %float_3 + %2271 = OpFSub %float %2262 %2264 + %2272 = OpFMul %float %2270 %2271 + %2273 = OpFMul %float %float_2 %2261 + %2274 = OpFSub %float %2273 %2262 + %2275 = OpFSub %float %2274 %2264 + %2276 = OpExtInst %float %1 Atan2 %2272 %2275 + %2277 = OpFMul %float %float_57_2957764 %2276 + OpBranch %2267 + %2268 = OpLabel + OpBranch %2267 + %2267 = OpLabel + %2278 = OpPhi %float %2277 %2269 %float_0 %2268 + %2279 = OpFOrdLessThan %bool %2278 %float_0 + OpSelectionMerge %2280 None + OpBranchConditional %2279 %2281 %2280 + %2281 = OpLabel + %2282 = OpFAdd %float %2278 %float_360 + OpBranch %2280 + %2280 = OpLabel + %2283 = OpPhi %float %2278 %2267 %2282 %2281 + %2284 = OpExtInst %float %1 FClamp %2283 %float_0 %float_360 + %2285 = OpFOrdGreaterThan %bool %2284 %float_180 + OpSelectionMerge %2286 None + OpBranchConditional %2285 %2287 %2286 + %2287 = OpLabel + %2288 = OpFSub %float %2284 %float_360 + OpBranch %2286 + %2286 = OpLabel + %2289 = OpPhi %float %2284 %2280 %2288 %2287 + %2290 = OpFOrdGreaterThan %bool %2289 %float_n67_5 + %2291 = OpFOrdLessThan %bool %2289 %float_67_5 + %2292 = OpLogicalAnd %bool %2290 %2291 + OpSelectionMerge %2293 None + OpBranchConditional %2292 %2294 %2293 + %2294 = OpLabel + %2295 = OpFSub %float %2289 %float_n67_5 + %2296 = OpFMul %float %2295 %float_0_0296296291 + %2297 = OpConvertFToS %int %2296 + %2298 = OpConvertSToF %float %2297 + %2299 = OpFSub %float %2296 %2298 + %2300 = OpFMul %float %2299 %2299 + %2301 = OpFMul %float %2300 %2299 + %2302 = OpIEqual %bool %2297 %int_3 + OpSelectionMerge %2303 None + OpBranchConditional %2302 %2304 %2305 + %2305 = OpLabel + %2306 = OpIEqual %bool %2297 %int_2 + OpSelectionMerge %2307 None + OpBranchConditional %2306 %2308 %2309 + %2309 = OpLabel + %2310 = OpIEqual %bool %2297 %int_1 + OpSelectionMerge %2311 None + OpBranchConditional %2310 %2312 %2313 + %2313 = OpLabel + %2314 = OpIEqual %bool %2297 %int_0 + OpSelectionMerge %2315 None + OpBranchConditional %2314 %2316 %2317 + %2317 = OpLabel + OpBranch %2315 + %2316 = OpLabel + %2318 = OpFMul %float %2301 %float_0_166666672 + OpBranch %2315 + %2315 = OpLabel + %2319 = OpPhi %float %float_0 %2317 %2318 %2316 + OpBranch %2311 + %2312 = OpLabel + %2320 = OpFMul %float %2301 %float_n0_5 + %2321 = OpFMul %float %2300 %float_0_5 + %2322 = OpFAdd %float %2320 %2321 + %2323 = OpFMul %float %2299 %float_0_5 + %2324 = OpFAdd %float %2322 %2323 + %2325 = OpFAdd %float %2324 %float_0_166666672 + OpBranch %2311 + %2311 = OpLabel + %2326 = OpPhi %float %2319 %2315 %2325 %2312 + OpBranch %2307 + %2308 = OpLabel + %2327 = OpFMul %float %2301 %float_0_5 + %2328 = OpFMul %float %2300 %float_n1 + %2329 = OpFAdd %float %2327 %2328 + %2330 = OpFAdd %float %2329 %float_0_666666687 + OpBranch %2307 + %2307 = OpLabel + %2331 = OpPhi %float %2326 %2311 %2330 %2308 + OpBranch %2303 + %2304 = OpLabel + %2332 = OpFMul %float %2301 %float_n0_166666672 + %2333 = OpFMul %float %2300 %float_0_5 + %2334 = OpFAdd %float %2332 %2333 + %2335 = OpFMul %float %2299 %float_n0_5 + %2336 = OpFAdd %float %2334 %2335 + %2337 = OpFAdd %float %2336 %float_0_166666672 + OpBranch %2303 + %2303 = OpLabel + %2338 = OpPhi %float %2331 %2307 %2337 %2304 + OpBranch %2293 + %2293 = OpLabel + %2339 = OpPhi %float %float_0 %2286 %2338 %2303 + %2340 = OpFMul %float %2339 %float_1_5 + %2341 = OpFMul %float %2340 %2216 + %2342 = OpFSub %float %float_0_0299999993 %2261 + %2343 = OpFMul %float %2341 %2342 + %2344 = OpFMul %float %2343 %float_0_180000007 + %2345 = OpFAdd %float %2261 %2344 + %2346 = OpCompositeInsert %v3float %2345 %2260 0 + %2347 = OpExtInst %v3float %1 FClamp %2346 %138 %337 + %2348 = OpVectorTimesMatrix %v3float %2347 %434 + %2349 = OpExtInst %v3float %1 FClamp %2348 %138 %337 + %2350 = OpDot %float %2349 %73 + %2351 = OpCompositeConstruct %v3float %2350 %2350 %2350 + %2352 = OpExtInst %v3float %1 FMix %2351 %2349 %241 + %2353 = OpCompositeExtract %float %2352 0 + %2354 = OpExtInst %float %1 Exp2 %float_n15 + %2355 = OpFMul %float %float_0_179999992 %2354 + %2356 = OpExtInst %float %1 Exp2 %float_18 + %2357 = OpFMul %float %float_0_179999992 %2356 + OpStore %546 %499 + OpStore %545 %500 + %2358 = OpFOrdLessThanEqual %bool %2353 %float_0 + %2359 = OpExtInst %float %1 Exp2 %float_n14 + %2360 = OpSelect %float %2358 %2359 %2353 + %2361 = OpExtInst %float %1 Log %2360 + %2362 = OpFDiv %float %2361 %1091 + %2363 = OpExtInst %float %1 Log %2355 + %2364 = OpFDiv %float %2363 %1091 + %2365 = OpFOrdLessThanEqual %bool %2362 %2364 + OpSelectionMerge %2366 None + OpBranchConditional %2365 %2367 %2368 + %2368 = OpLabel + %2369 = OpFOrdGreaterThan %bool %2362 %2364 + %2370 = OpExtInst %float %1 Log %float_0_180000007 + %2371 = OpFDiv %float %2370 %1091 + %2372 = OpFOrdLessThan %bool %2362 %2371 + %2373 = OpLogicalAnd %bool %2369 %2372 + OpSelectionMerge %2374 None + OpBranchConditional %2373 %2375 %2376 + %2376 = OpLabel + %2377 = OpFOrdGreaterThanEqual %bool %2362 %2371 + %2378 = OpExtInst %float %1 Log %2357 + %2379 = OpFDiv %float %2378 %1091 + %2380 = OpFOrdLessThan %bool %2362 %2379 + %2381 = OpLogicalAnd %bool %2377 %2380 + OpSelectionMerge %2382 None + OpBranchConditional %2381 %2383 %2384 + %2384 = OpLabel + %2385 = OpExtInst %float %1 Log %float_10000 + %2386 = OpFDiv %float %2385 %1091 + OpBranch %2382 + %2383 = OpLabel + %2387 = OpFSub %float %2362 %2371 + %2388 = OpFMul %float %float_3 %2387 + %2389 = OpFSub %float %2379 %2371 + %2390 = OpFDiv %float %2388 %2389 + %2391 = OpConvertFToS %int %2390 + %2392 = OpConvertSToF %float %2391 + %2393 = OpFSub %float %2390 %2392 + %2394 = OpAccessChain %_ptr_Function_float %545 %2391 + %2395 = OpLoad %float %2394 + %2396 = OpIAdd %int %2391 %int_1 + %2397 = OpAccessChain %_ptr_Function_float %545 %2396 + %2398 = OpLoad %float %2397 + %2399 = OpIAdd %int %2391 %int_2 + %2400 = OpAccessChain %_ptr_Function_float %545 %2399 + %2401 = OpLoad %float %2400 + %2402 = OpCompositeConstruct %v3float %2395 %2398 %2401 + %2403 = OpFMul %float %2393 %2393 + %2404 = OpCompositeConstruct %v3float %2403 %2393 %float_1 + %2405 = OpMatrixTimesVector %v3float %466 %2402 + %2406 = OpDot %float %2404 %2405 + OpBranch %2382 + %2382 = OpLabel + %2407 = OpPhi %float %2386 %2384 %2406 %2383 + OpBranch %2374 + %2375 = OpLabel + %2408 = OpFSub %float %2362 %2364 + %2409 = OpFMul %float %float_3 %2408 + %2410 = OpFSub %float %2371 %2364 + %2411 = OpFDiv %float %2409 %2410 + %2412 = OpConvertFToS %int %2411 + %2413 = OpConvertSToF %float %2412 + %2414 = OpFSub %float %2411 %2413 + %2415 = OpAccessChain %_ptr_Function_float %546 %2412 + %2416 = OpLoad %float %2415 + %2417 = OpIAdd %int %2412 %int_1 + %2418 = OpAccessChain %_ptr_Function_float %546 %2417 + %2419 = OpLoad %float %2418 + %2420 = OpIAdd %int %2412 %int_2 + %2421 = OpAccessChain %_ptr_Function_float %546 %2420 + %2422 = OpLoad %float %2421 + %2423 = OpCompositeConstruct %v3float %2416 %2419 %2422 + %2424 = OpFMul %float %2414 %2414 + %2425 = OpCompositeConstruct %v3float %2424 %2414 %float_1 + %2426 = OpMatrixTimesVector %v3float %466 %2423 + %2427 = OpDot %float %2425 %2426 + OpBranch %2374 + %2374 = OpLabel + %2428 = OpPhi %float %2407 %2382 %2427 %2375 + OpBranch %2366 + %2367 = OpLabel + %2429 = OpExtInst %float %1 Log %float_9_99999975en05 + %2430 = OpFDiv %float %2429 %1091 + OpBranch %2366 + %2366 = OpLabel + %2431 = OpPhi %float %2428 %2374 %2430 %2367 + %2432 = OpExtInst %float %1 Pow %float_10 %2431 + %2433 = OpCompositeInsert %v3float %2432 %523 0 + %2434 = OpCompositeExtract %float %2352 1 + OpStore %548 %499 + OpStore %547 %500 + %2435 = OpFOrdLessThanEqual %bool %2434 %float_0 + %2436 = OpSelect %float %2435 %2359 %2434 + %2437 = OpExtInst %float %1 Log %2436 + %2438 = OpFDiv %float %2437 %1091 + %2439 = OpFOrdLessThanEqual %bool %2438 %2364 + OpSelectionMerge %2440 None + OpBranchConditional %2439 %2441 %2442 + %2442 = OpLabel + %2443 = OpFOrdGreaterThan %bool %2438 %2364 + %2444 = OpExtInst %float %1 Log %float_0_180000007 + %2445 = OpFDiv %float %2444 %1091 + %2446 = OpFOrdLessThan %bool %2438 %2445 + %2447 = OpLogicalAnd %bool %2443 %2446 + OpSelectionMerge %2448 None + OpBranchConditional %2447 %2449 %2450 + %2450 = OpLabel + %2451 = OpFOrdGreaterThanEqual %bool %2438 %2445 + %2452 = OpExtInst %float %1 Log %2357 + %2453 = OpFDiv %float %2452 %1091 + %2454 = OpFOrdLessThan %bool %2438 %2453 + %2455 = OpLogicalAnd %bool %2451 %2454 + OpSelectionMerge %2456 None + OpBranchConditional %2455 %2457 %2458 + %2458 = OpLabel + %2459 = OpExtInst %float %1 Log %float_10000 + %2460 = OpFDiv %float %2459 %1091 + OpBranch %2456 + %2457 = OpLabel + %2461 = OpFSub %float %2438 %2445 + %2462 = OpFMul %float %float_3 %2461 + %2463 = OpFSub %float %2453 %2445 + %2464 = OpFDiv %float %2462 %2463 + %2465 = OpConvertFToS %int %2464 + %2466 = OpConvertSToF %float %2465 + %2467 = OpFSub %float %2464 %2466 + %2468 = OpAccessChain %_ptr_Function_float %547 %2465 + %2469 = OpLoad %float %2468 + %2470 = OpIAdd %int %2465 %int_1 + %2471 = OpAccessChain %_ptr_Function_float %547 %2470 + %2472 = OpLoad %float %2471 + %2473 = OpIAdd %int %2465 %int_2 + %2474 = OpAccessChain %_ptr_Function_float %547 %2473 + %2475 = OpLoad %float %2474 + %2476 = OpCompositeConstruct %v3float %2469 %2472 %2475 + %2477 = OpFMul %float %2467 %2467 + %2478 = OpCompositeConstruct %v3float %2477 %2467 %float_1 + %2479 = OpMatrixTimesVector %v3float %466 %2476 + %2480 = OpDot %float %2478 %2479 + OpBranch %2456 + %2456 = OpLabel + %2481 = OpPhi %float %2460 %2458 %2480 %2457 + OpBranch %2448 + %2449 = OpLabel + %2482 = OpFSub %float %2438 %2364 + %2483 = OpFMul %float %float_3 %2482 + %2484 = OpFSub %float %2445 %2364 + %2485 = OpFDiv %float %2483 %2484 + %2486 = OpConvertFToS %int %2485 + %2487 = OpConvertSToF %float %2486 + %2488 = OpFSub %float %2485 %2487 + %2489 = OpAccessChain %_ptr_Function_float %548 %2486 + %2490 = OpLoad %float %2489 + %2491 = OpIAdd %int %2486 %int_1 + %2492 = OpAccessChain %_ptr_Function_float %548 %2491 + %2493 = OpLoad %float %2492 + %2494 = OpIAdd %int %2486 %int_2 + %2495 = OpAccessChain %_ptr_Function_float %548 %2494 + %2496 = OpLoad %float %2495 + %2497 = OpCompositeConstruct %v3float %2490 %2493 %2496 + %2498 = OpFMul %float %2488 %2488 + %2499 = OpCompositeConstruct %v3float %2498 %2488 %float_1 + %2500 = OpMatrixTimesVector %v3float %466 %2497 + %2501 = OpDot %float %2499 %2500 + OpBranch %2448 + %2448 = OpLabel + %2502 = OpPhi %float %2481 %2456 %2501 %2449 + OpBranch %2440 + %2441 = OpLabel + %2503 = OpExtInst %float %1 Log %float_9_99999975en05 + %2504 = OpFDiv %float %2503 %1091 + OpBranch %2440 + %2440 = OpLabel + %2505 = OpPhi %float %2502 %2448 %2504 %2441 + %2506 = OpExtInst %float %1 Pow %float_10 %2505 + %2507 = OpCompositeInsert %v3float %2506 %2433 1 + %2508 = OpCompositeExtract %float %2352 2 + OpStore %550 %499 + OpStore %549 %500 + %2509 = OpFOrdLessThanEqual %bool %2508 %float_0 + %2510 = OpSelect %float %2509 %2359 %2508 + %2511 = OpExtInst %float %1 Log %2510 + %2512 = OpFDiv %float %2511 %1091 + %2513 = OpFOrdLessThanEqual %bool %2512 %2364 + OpSelectionMerge %2514 None + OpBranchConditional %2513 %2515 %2516 + %2516 = OpLabel + %2517 = OpFOrdGreaterThan %bool %2512 %2364 + %2518 = OpExtInst %float %1 Log %float_0_180000007 + %2519 = OpFDiv %float %2518 %1091 + %2520 = OpFOrdLessThan %bool %2512 %2519 + %2521 = OpLogicalAnd %bool %2517 %2520 + OpSelectionMerge %2522 None + OpBranchConditional %2521 %2523 %2524 + %2524 = OpLabel + %2525 = OpFOrdGreaterThanEqual %bool %2512 %2519 + %2526 = OpExtInst %float %1 Log %2357 + %2527 = OpFDiv %float %2526 %1091 + %2528 = OpFOrdLessThan %bool %2512 %2527 + %2529 = OpLogicalAnd %bool %2525 %2528 + OpSelectionMerge %2530 None + OpBranchConditional %2529 %2531 %2532 + %2532 = OpLabel + %2533 = OpExtInst %float %1 Log %float_10000 + %2534 = OpFDiv %float %2533 %1091 + OpBranch %2530 + %2531 = OpLabel + %2535 = OpFSub %float %2512 %2519 + %2536 = OpFMul %float %float_3 %2535 + %2537 = OpFSub %float %2527 %2519 + %2538 = OpFDiv %float %2536 %2537 + %2539 = OpConvertFToS %int %2538 + %2540 = OpConvertSToF %float %2539 + %2541 = OpFSub %float %2538 %2540 + %2542 = OpAccessChain %_ptr_Function_float %549 %2539 + %2543 = OpLoad %float %2542 + %2544 = OpIAdd %int %2539 %int_1 + %2545 = OpAccessChain %_ptr_Function_float %549 %2544 + %2546 = OpLoad %float %2545 + %2547 = OpIAdd %int %2539 %int_2 + %2548 = OpAccessChain %_ptr_Function_float %549 %2547 + %2549 = OpLoad %float %2548 + %2550 = OpCompositeConstruct %v3float %2543 %2546 %2549 + %2551 = OpFMul %float %2541 %2541 + %2552 = OpCompositeConstruct %v3float %2551 %2541 %float_1 + %2553 = OpMatrixTimesVector %v3float %466 %2550 + %2554 = OpDot %float %2552 %2553 + OpBranch %2530 + %2530 = OpLabel + %2555 = OpPhi %float %2534 %2532 %2554 %2531 + OpBranch %2522 + %2523 = OpLabel + %2556 = OpFSub %float %2512 %2364 + %2557 = OpFMul %float %float_3 %2556 + %2558 = OpFSub %float %2519 %2364 + %2559 = OpFDiv %float %2557 %2558 + %2560 = OpConvertFToS %int %2559 + %2561 = OpConvertSToF %float %2560 + %2562 = OpFSub %float %2559 %2561 + %2563 = OpAccessChain %_ptr_Function_float %550 %2560 + %2564 = OpLoad %float %2563 + %2565 = OpIAdd %int %2560 %int_1 + %2566 = OpAccessChain %_ptr_Function_float %550 %2565 + %2567 = OpLoad %float %2566 + %2568 = OpIAdd %int %2560 %int_2 + %2569 = OpAccessChain %_ptr_Function_float %550 %2568 + %2570 = OpLoad %float %2569 + %2571 = OpCompositeConstruct %v3float %2564 %2567 %2570 + %2572 = OpFMul %float %2562 %2562 + %2573 = OpCompositeConstruct %v3float %2572 %2562 %float_1 + %2574 = OpMatrixTimesVector %v3float %466 %2571 + %2575 = OpDot %float %2573 %2574 + OpBranch %2522 + %2522 = OpLabel + %2576 = OpPhi %float %2555 %2530 %2575 %2523 + OpBranch %2514 + %2515 = OpLabel + %2577 = OpExtInst %float %1 Log %float_9_99999975en05 + %2578 = OpFDiv %float %2577 %1091 + OpBranch %2514 + %2514 = OpLabel + %2579 = OpPhi %float %2576 %2522 %2578 %2515 + %2580 = OpExtInst %float %1 Pow %float_10 %2579 + %2581 = OpCompositeInsert %v3float %2580 %2507 2 + %2582 = OpVectorTimesMatrix %v3float %2581 %438 + %2583 = OpVectorTimesMatrix %v3float %2582 %434 + %2584 = OpExtInst %float %1 Pow %float_2 %float_n12 + %2585 = OpFMul %float %float_0_179999992 %2584 + OpStore %558 %499 + OpStore %557 %500 + %2586 = OpFOrdLessThanEqual %bool %2585 %float_0 + %2587 = OpSelect %float %2586 %2359 %2585 + %2588 = OpExtInst %float %1 Log %2587 + %2589 = OpFDiv %float %2588 %1091 + %2590 = OpFOrdLessThanEqual %bool %2589 %2364 + OpSelectionMerge %2591 None + OpBranchConditional %2590 %2592 %2593 + %2593 = OpLabel + %2594 = OpFOrdGreaterThan %bool %2589 %2364 + %2595 = OpExtInst %float %1 Log %float_0_180000007 + %2596 = OpFDiv %float %2595 %1091 + %2597 = OpFOrdLessThan %bool %2589 %2596 + %2598 = OpLogicalAnd %bool %2594 %2597 + OpSelectionMerge %2599 None + OpBranchConditional %2598 %2600 %2601 + %2601 = OpLabel + %2602 = OpFOrdGreaterThanEqual %bool %2589 %2596 + %2603 = OpExtInst %float %1 Log %2357 + %2604 = OpFDiv %float %2603 %1091 + %2605 = OpFOrdLessThan %bool %2589 %2604 + %2606 = OpLogicalAnd %bool %2602 %2605 + OpSelectionMerge %2607 None + OpBranchConditional %2606 %2608 %2609 + %2609 = OpLabel + %2610 = OpExtInst %float %1 Log %float_10000 + %2611 = OpFDiv %float %2610 %1091 + OpBranch %2607 + %2608 = OpLabel + %2612 = OpFSub %float %2589 %2596 + %2613 = OpFMul %float %float_3 %2612 + %2614 = OpFSub %float %2604 %2596 + %2615 = OpFDiv %float %2613 %2614 + %2616 = OpConvertFToS %int %2615 + %2617 = OpConvertSToF %float %2616 + %2618 = OpFSub %float %2615 %2617 + %2619 = OpAccessChain %_ptr_Function_float %557 %2616 + %2620 = OpLoad %float %2619 + %2621 = OpIAdd %int %2616 %int_1 + %2622 = OpAccessChain %_ptr_Function_float %557 %2621 + %2623 = OpLoad %float %2622 + %2624 = OpIAdd %int %2616 %int_2 + %2625 = OpAccessChain %_ptr_Function_float %557 %2624 + %2626 = OpLoad %float %2625 + %2627 = OpCompositeConstruct %v3float %2620 %2623 %2626 + %2628 = OpFMul %float %2618 %2618 + %2629 = OpCompositeConstruct %v3float %2628 %2618 %float_1 + %2630 = OpMatrixTimesVector %v3float %466 %2627 + %2631 = OpDot %float %2629 %2630 + OpBranch %2607 + %2607 = OpLabel + %2632 = OpPhi %float %2611 %2609 %2631 %2608 + OpBranch %2599 + %2600 = OpLabel + %2633 = OpFSub %float %2589 %2364 + %2634 = OpFMul %float %float_3 %2633 + %2635 = OpFSub %float %2596 %2364 + %2636 = OpFDiv %float %2634 %2635 + %2637 = OpConvertFToS %int %2636 + %2638 = OpConvertSToF %float %2637 + %2639 = OpFSub %float %2636 %2638 + %2640 = OpAccessChain %_ptr_Function_float %558 %2637 + %2641 = OpLoad %float %2640 + %2642 = OpIAdd %int %2637 %int_1 + %2643 = OpAccessChain %_ptr_Function_float %558 %2642 + %2644 = OpLoad %float %2643 + %2645 = OpIAdd %int %2637 %int_2 + %2646 = OpAccessChain %_ptr_Function_float %558 %2645 + %2647 = OpLoad %float %2646 + %2648 = OpCompositeConstruct %v3float %2641 %2644 %2647 + %2649 = OpFMul %float %2639 %2639 + %2650 = OpCompositeConstruct %v3float %2649 %2639 %float_1 + %2651 = OpMatrixTimesVector %v3float %466 %2648 + %2652 = OpDot %float %2650 %2651 + OpBranch %2599 + %2599 = OpLabel + %2653 = OpPhi %float %2632 %2607 %2652 %2600 + OpBranch %2591 + %2592 = OpLabel + %2654 = OpExtInst %float %1 Log %float_9_99999975en05 + %2655 = OpFDiv %float %2654 %1091 + OpBranch %2591 + %2591 = OpLabel + %2656 = OpPhi %float %2653 %2599 %2655 %2592 + %2657 = OpExtInst %float %1 Pow %float_10 %2656 + OpStore %560 %499 + OpStore %559 %500 + %2658 = OpExtInst %float %1 Log %float_0_180000007 + %2659 = OpFDiv %float %2658 %1091 + %2660 = OpFOrdLessThanEqual %bool %2659 %2364 + OpSelectionMerge %2661 None + OpBranchConditional %2660 %2662 %2663 + %2663 = OpLabel + %2664 = OpFOrdGreaterThan %bool %2659 %2364 + %2665 = OpFOrdLessThan %bool %2659 %2659 + %2666 = OpLogicalAnd %bool %2664 %2665 + OpSelectionMerge %2667 None + OpBranchConditional %2666 %2668 %2669 + %2669 = OpLabel + %2670 = OpFOrdGreaterThanEqual %bool %2659 %2659 + %2671 = OpExtInst %float %1 Log %2357 + %2672 = OpFDiv %float %2671 %1091 + %2673 = OpFOrdLessThan %bool %2659 %2672 + %2674 = OpLogicalAnd %bool %2670 %2673 + OpSelectionMerge %2675 None + OpBranchConditional %2674 %2676 %2677 + %2677 = OpLabel + %2678 = OpExtInst %float %1 Log %float_10000 + %2679 = OpFDiv %float %2678 %1091 + OpBranch %2675 + %2676 = OpLabel + %2680 = OpFSub %float %2659 %2659 + %2681 = OpFMul %float %float_3 %2680 + %2682 = OpFSub %float %2672 %2659 + %2683 = OpFDiv %float %2681 %2682 + %2684 = OpConvertFToS %int %2683 + %2685 = OpConvertSToF %float %2684 + %2686 = OpFSub %float %2683 %2685 + %2687 = OpAccessChain %_ptr_Function_float %559 %2684 + %2688 = OpLoad %float %2687 + %2689 = OpIAdd %int %2684 %int_1 + %2690 = OpAccessChain %_ptr_Function_float %559 %2689 + %2691 = OpLoad %float %2690 + %2692 = OpIAdd %int %2684 %int_2 + %2693 = OpAccessChain %_ptr_Function_float %559 %2692 + %2694 = OpLoad %float %2693 + %2695 = OpCompositeConstruct %v3float %2688 %2691 %2694 + %2696 = OpFMul %float %2686 %2686 + %2697 = OpCompositeConstruct %v3float %2696 %2686 %float_1 + %2698 = OpMatrixTimesVector %v3float %466 %2695 + %2699 = OpDot %float %2697 %2698 + OpBranch %2675 + %2675 = OpLabel + %2700 = OpPhi %float %2679 %2677 %2699 %2676 + OpBranch %2667 + %2668 = OpLabel + %2701 = OpAccessChain %_ptr_Function_float %560 %int_3 + %2702 = OpLoad %float %2701 + %2703 = OpAccessChain %_ptr_Function_float %560 %int_4 + %2704 = OpLoad %float %2703 + %2705 = OpAccessChain %_ptr_Function_float %560 %int_5 + %2706 = OpLoad %float %2705 + %2707 = OpCompositeConstruct %v3float %2702 %2704 %2706 + %2708 = OpMatrixTimesVector %v3float %466 %2707 + %2709 = OpCompositeExtract %float %2708 2 + OpBranch %2667 + %2667 = OpLabel + %2710 = OpPhi %float %2700 %2675 %2709 %2668 + OpBranch %2661 + %2662 = OpLabel + %2711 = OpExtInst %float %1 Log %float_9_99999975en05 + %2712 = OpFDiv %float %2711 %1091 + OpBranch %2661 + %2661 = OpLabel + %2713 = OpPhi %float %2710 %2667 %2712 %2662 + %2714 = OpExtInst %float %1 Pow %float_10 %2713 + %2715 = OpExtInst %float %1 Pow %float_2 %float_10 + %2716 = OpFMul %float %float_0_179999992 %2715 + OpStore %562 %499 + OpStore %561 %500 + %2717 = OpFOrdLessThanEqual %bool %2716 %float_0 + %2718 = OpSelect %float %2717 %2359 %2716 + %2719 = OpExtInst %float %1 Log %2718 + %2720 = OpFDiv %float %2719 %1091 + %2721 = OpFOrdLessThanEqual %bool %2720 %2364 + OpSelectionMerge %2722 None + OpBranchConditional %2721 %2723 %2724 + %2724 = OpLabel + %2725 = OpFOrdGreaterThan %bool %2720 %2364 + %2726 = OpFOrdLessThan %bool %2720 %2659 + %2727 = OpLogicalAnd %bool %2725 %2726 + OpSelectionMerge %2728 None + OpBranchConditional %2727 %2729 %2730 + %2730 = OpLabel + %2731 = OpFOrdGreaterThanEqual %bool %2720 %2659 + %2732 = OpExtInst %float %1 Log %2357 + %2733 = OpFDiv %float %2732 %1091 + %2734 = OpFOrdLessThan %bool %2720 %2733 + %2735 = OpLogicalAnd %bool %2731 %2734 + OpSelectionMerge %2736 None + OpBranchConditional %2735 %2737 %2738 + %2738 = OpLabel + %2739 = OpExtInst %float %1 Log %float_10000 + %2740 = OpFDiv %float %2739 %1091 + OpBranch %2736 + %2737 = OpLabel + %2741 = OpFSub %float %2720 %2659 + %2742 = OpFMul %float %float_3 %2741 + %2743 = OpFSub %float %2733 %2659 + %2744 = OpFDiv %float %2742 %2743 + %2745 = OpConvertFToS %int %2744 + %2746 = OpConvertSToF %float %2745 + %2747 = OpFSub %float %2744 %2746 + %2748 = OpAccessChain %_ptr_Function_float %561 %2745 + %2749 = OpLoad %float %2748 + %2750 = OpIAdd %int %2745 %int_1 + %2751 = OpAccessChain %_ptr_Function_float %561 %2750 + %2752 = OpLoad %float %2751 + %2753 = OpIAdd %int %2745 %int_2 + %2754 = OpAccessChain %_ptr_Function_float %561 %2753 + %2755 = OpLoad %float %2754 + %2756 = OpCompositeConstruct %v3float %2749 %2752 %2755 + %2757 = OpFMul %float %2747 %2747 + %2758 = OpCompositeConstruct %v3float %2757 %2747 %float_1 + %2759 = OpMatrixTimesVector %v3float %466 %2756 + %2760 = OpDot %float %2758 %2759 + OpBranch %2736 + %2736 = OpLabel + %2761 = OpPhi %float %2740 %2738 %2760 %2737 + OpBranch %2728 + %2729 = OpLabel + %2762 = OpFSub %float %2720 %2364 + %2763 = OpFMul %float %float_3 %2762 + %2764 = OpFSub %float %2659 %2364 + %2765 = OpFDiv %float %2763 %2764 + %2766 = OpConvertFToS %int %2765 + %2767 = OpConvertSToF %float %2766 + %2768 = OpFSub %float %2765 %2767 + %2769 = OpAccessChain %_ptr_Function_float %562 %2766 + %2770 = OpLoad %float %2769 + %2771 = OpIAdd %int %2766 %int_1 + %2772 = OpAccessChain %_ptr_Function_float %562 %2771 + %2773 = OpLoad %float %2772 + %2774 = OpIAdd %int %2766 %int_2 + %2775 = OpAccessChain %_ptr_Function_float %562 %2774 + %2776 = OpLoad %float %2775 + %2777 = OpCompositeConstruct %v3float %2770 %2773 %2776 + %2778 = OpFMul %float %2768 %2768 + %2779 = OpCompositeConstruct %v3float %2778 %2768 %float_1 + %2780 = OpMatrixTimesVector %v3float %466 %2777 + %2781 = OpDot %float %2779 %2780 + OpBranch %2728 + %2728 = OpLabel + %2782 = OpPhi %float %2761 %2736 %2781 %2729 + OpBranch %2722 + %2723 = OpLabel + %2783 = OpExtInst %float %1 Log %float_9_99999975en05 + %2784 = OpFDiv %float %2783 %1091 + OpBranch %2722 + %2722 = OpLabel + %2785 = OpPhi %float %2782 %2728 %2784 %2723 + %2786 = OpExtInst %float %1 Pow %float_10 %2785 + %2787 = OpCompositeExtract %float %2583 0 + OpStore %556 %503 + OpStore %555 %504 + %2788 = OpFOrdLessThanEqual %bool %2787 %float_0 + %2789 = OpSelect %float %2788 %float_9_99999975en05 %2787 + %2790 = OpExtInst %float %1 Log %2789 + %2791 = OpFDiv %float %2790 %1091 + %2792 = OpExtInst %float %1 Log %2657 + %2793 = OpFDiv %float %2792 %1091 + %2794 = OpFOrdLessThanEqual %bool %2791 %2793 + OpSelectionMerge %2795 None + OpBranchConditional %2794 %2796 %2797 + %2797 = OpLabel + %2798 = OpFOrdGreaterThan %bool %2791 %2793 + %2799 = OpExtInst %float %1 Log %2714 + %2800 = OpFDiv %float %2799 %1091 + %2801 = OpFOrdLessThan %bool %2791 %2800 + %2802 = OpLogicalAnd %bool %2798 %2801 + OpSelectionMerge %2803 None + OpBranchConditional %2802 %2804 %2805 + %2805 = OpLabel + %2806 = OpFOrdGreaterThanEqual %bool %2791 %2800 + %2807 = OpExtInst %float %1 Log %2786 + %2808 = OpFDiv %float %2807 %1091 + %2809 = OpFOrdLessThan %bool %2791 %2808 + %2810 = OpLogicalAnd %bool %2806 %2809 + OpSelectionMerge %2811 None + OpBranchConditional %2810 %2812 %2813 + %2813 = OpLabel + %2814 = OpFMul %float %2791 %float_0_0599999987 + %2815 = OpExtInst %float %1 Log %float_1000 + %2816 = OpFDiv %float %2815 %1091 + %2817 = OpFMul %float %float_0_0599999987 %2807 + %2818 = OpFDiv %float %2817 %1091 + %2819 = OpFSub %float %2816 %2818 + %2820 = OpFAdd %float %2814 %2819 + OpBranch %2811 + %2812 = OpLabel + %2821 = OpFSub %float %2791 %2800 + %2822 = OpFMul %float %float_7 %2821 + %2823 = OpFSub %float %2808 %2800 + %2824 = OpFDiv %float %2822 %2823 + %2825 = OpConvertFToS %int %2824 + %2826 = OpConvertSToF %float %2825 + %2827 = OpFSub %float %2824 %2826 + %2828 = OpAccessChain %_ptr_Function_float %555 %2825 + %2829 = OpLoad %float %2828 + %2830 = OpIAdd %int %2825 %int_1 + %2831 = OpAccessChain %_ptr_Function_float %555 %2830 + %2832 = OpLoad %float %2831 + %2833 = OpIAdd %int %2825 %int_2 + %2834 = OpAccessChain %_ptr_Function_float %555 %2833 + %2835 = OpLoad %float %2834 + %2836 = OpCompositeConstruct %v3float %2829 %2832 %2835 + %2837 = OpFMul %float %2827 %2827 + %2838 = OpCompositeConstruct %v3float %2837 %2827 %float_1 + %2839 = OpMatrixTimesVector %v3float %466 %2836 + %2840 = OpDot %float %2838 %2839 + OpBranch %2811 + %2811 = OpLabel + %2841 = OpPhi %float %2820 %2813 %2840 %2812 + OpBranch %2803 + %2804 = OpLabel + %2842 = OpFSub %float %2791 %2793 + %2843 = OpFMul %float %float_7 %2842 + %2844 = OpFSub %float %2800 %2793 + %2845 = OpFDiv %float %2843 %2844 + %2846 = OpConvertFToS %int %2845 + %2847 = OpConvertSToF %float %2846 + %2848 = OpFSub %float %2845 %2847 + %2849 = OpAccessChain %_ptr_Function_float %556 %2846 + %2850 = OpLoad %float %2849 + %2851 = OpIAdd %int %2846 %int_1 + %2852 = OpAccessChain %_ptr_Function_float %556 %2851 + %2853 = OpLoad %float %2852 + %2854 = OpIAdd %int %2846 %int_2 + %2855 = OpAccessChain %_ptr_Function_float %556 %2854 + %2856 = OpLoad %float %2855 + %2857 = OpCompositeConstruct %v3float %2850 %2853 %2856 + %2858 = OpFMul %float %2848 %2848 + %2859 = OpCompositeConstruct %v3float %2858 %2848 %float_1 + %2860 = OpMatrixTimesVector %v3float %466 %2857 + %2861 = OpDot %float %2859 %2860 + OpBranch %2803 + %2803 = OpLabel + %2862 = OpPhi %float %2841 %2811 %2861 %2804 + OpBranch %2795 + %2796 = OpLabel + %2863 = OpFMul %float %2791 %float_3 + %2864 = OpExtInst %float %1 Log %float_9_99999975en05 + %2865 = OpFDiv %float %2864 %1091 + %2866 = OpFMul %float %float_3 %2792 + %2867 = OpFDiv %float %2866 %1091 + %2868 = OpFSub %float %2865 %2867 + %2869 = OpFAdd %float %2863 %2868 + OpBranch %2795 + %2795 = OpLabel + %2870 = OpPhi %float %2862 %2803 %2869 %2796 + %2871 = OpExtInst %float %1 Pow %float_10 %2870 + %2872 = OpCompositeInsert %v3float %2871 %523 0 + %2873 = OpCompositeExtract %float %2583 1 + OpStore %554 %503 + OpStore %553 %504 + %2874 = OpFOrdLessThanEqual %bool %2873 %float_0 + %2875 = OpSelect %float %2874 %float_9_99999975en05 %2873 + %2876 = OpExtInst %float %1 Log %2875 + %2877 = OpFDiv %float %2876 %1091 + %2878 = OpFOrdLessThanEqual %bool %2877 %2793 + OpSelectionMerge %2879 None + OpBranchConditional %2878 %2880 %2881 + %2881 = OpLabel + %2882 = OpFOrdGreaterThan %bool %2877 %2793 + %2883 = OpExtInst %float %1 Log %2714 + %2884 = OpFDiv %float %2883 %1091 + %2885 = OpFOrdLessThan %bool %2877 %2884 + %2886 = OpLogicalAnd %bool %2882 %2885 + OpSelectionMerge %2887 None + OpBranchConditional %2886 %2888 %2889 + %2889 = OpLabel + %2890 = OpFOrdGreaterThanEqual %bool %2877 %2884 + %2891 = OpExtInst %float %1 Log %2786 + %2892 = OpFDiv %float %2891 %1091 + %2893 = OpFOrdLessThan %bool %2877 %2892 + %2894 = OpLogicalAnd %bool %2890 %2893 + OpSelectionMerge %2895 None + OpBranchConditional %2894 %2896 %2897 + %2897 = OpLabel + %2898 = OpFMul %float %2877 %float_0_0599999987 + %2899 = OpExtInst %float %1 Log %float_1000 + %2900 = OpFDiv %float %2899 %1091 + %2901 = OpFMul %float %float_0_0599999987 %2891 + %2902 = OpFDiv %float %2901 %1091 + %2903 = OpFSub %float %2900 %2902 + %2904 = OpFAdd %float %2898 %2903 + OpBranch %2895 + %2896 = OpLabel + %2905 = OpFSub %float %2877 %2884 + %2906 = OpFMul %float %float_7 %2905 + %2907 = OpFSub %float %2892 %2884 + %2908 = OpFDiv %float %2906 %2907 + %2909 = OpConvertFToS %int %2908 + %2910 = OpConvertSToF %float %2909 + %2911 = OpFSub %float %2908 %2910 + %2912 = OpAccessChain %_ptr_Function_float %553 %2909 + %2913 = OpLoad %float %2912 + %2914 = OpIAdd %int %2909 %int_1 + %2915 = OpAccessChain %_ptr_Function_float %553 %2914 + %2916 = OpLoad %float %2915 + %2917 = OpIAdd %int %2909 %int_2 + %2918 = OpAccessChain %_ptr_Function_float %553 %2917 + %2919 = OpLoad %float %2918 + %2920 = OpCompositeConstruct %v3float %2913 %2916 %2919 + %2921 = OpFMul %float %2911 %2911 + %2922 = OpCompositeConstruct %v3float %2921 %2911 %float_1 + %2923 = OpMatrixTimesVector %v3float %466 %2920 + %2924 = OpDot %float %2922 %2923 + OpBranch %2895 + %2895 = OpLabel + %2925 = OpPhi %float %2904 %2897 %2924 %2896 + OpBranch %2887 + %2888 = OpLabel + %2926 = OpFSub %float %2877 %2793 + %2927 = OpFMul %float %float_7 %2926 + %2928 = OpFSub %float %2884 %2793 + %2929 = OpFDiv %float %2927 %2928 + %2930 = OpConvertFToS %int %2929 + %2931 = OpConvertSToF %float %2930 + %2932 = OpFSub %float %2929 %2931 + %2933 = OpAccessChain %_ptr_Function_float %554 %2930 + %2934 = OpLoad %float %2933 + %2935 = OpIAdd %int %2930 %int_1 + %2936 = OpAccessChain %_ptr_Function_float %554 %2935 + %2937 = OpLoad %float %2936 + %2938 = OpIAdd %int %2930 %int_2 + %2939 = OpAccessChain %_ptr_Function_float %554 %2938 + %2940 = OpLoad %float %2939 + %2941 = OpCompositeConstruct %v3float %2934 %2937 %2940 + %2942 = OpFMul %float %2932 %2932 + %2943 = OpCompositeConstruct %v3float %2942 %2932 %float_1 + %2944 = OpMatrixTimesVector %v3float %466 %2941 + %2945 = OpDot %float %2943 %2944 + OpBranch %2887 + %2887 = OpLabel + %2946 = OpPhi %float %2925 %2895 %2945 %2888 + OpBranch %2879 + %2880 = OpLabel + %2947 = OpFMul %float %2877 %float_3 + %2948 = OpExtInst %float %1 Log %float_9_99999975en05 + %2949 = OpFDiv %float %2948 %1091 + %2950 = OpFMul %float %float_3 %2792 + %2951 = OpFDiv %float %2950 %1091 + %2952 = OpFSub %float %2949 %2951 + %2953 = OpFAdd %float %2947 %2952 + OpBranch %2879 + %2879 = OpLabel + %2954 = OpPhi %float %2946 %2887 %2953 %2880 + %2955 = OpExtInst %float %1 Pow %float_10 %2954 + %2956 = OpCompositeInsert %v3float %2955 %2872 1 + %2957 = OpCompositeExtract %float %2583 2 + OpStore %552 %503 + OpStore %551 %504 + %2958 = OpFOrdLessThanEqual %bool %2957 %float_0 + %2959 = OpSelect %float %2958 %float_9_99999975en05 %2957 + %2960 = OpExtInst %float %1 Log %2959 + %2961 = OpFDiv %float %2960 %1091 + %2962 = OpFOrdLessThanEqual %bool %2961 %2793 + OpSelectionMerge %2963 None + OpBranchConditional %2962 %2964 %2965 + %2965 = OpLabel + %2966 = OpFOrdGreaterThan %bool %2961 %2793 + %2967 = OpExtInst %float %1 Log %2714 + %2968 = OpFDiv %float %2967 %1091 + %2969 = OpFOrdLessThan %bool %2961 %2968 + %2970 = OpLogicalAnd %bool %2966 %2969 + OpSelectionMerge %2971 None + OpBranchConditional %2970 %2972 %2973 + %2973 = OpLabel + %2974 = OpFOrdGreaterThanEqual %bool %2961 %2968 + %2975 = OpExtInst %float %1 Log %2786 + %2976 = OpFDiv %float %2975 %1091 + %2977 = OpFOrdLessThan %bool %2961 %2976 + %2978 = OpLogicalAnd %bool %2974 %2977 + OpSelectionMerge %2979 None + OpBranchConditional %2978 %2980 %2981 + %2981 = OpLabel + %2982 = OpFMul %float %2961 %float_0_0599999987 + %2983 = OpExtInst %float %1 Log %float_1000 + %2984 = OpFDiv %float %2983 %1091 + %2985 = OpFMul %float %float_0_0599999987 %2975 + %2986 = OpFDiv %float %2985 %1091 + %2987 = OpFSub %float %2984 %2986 + %2988 = OpFAdd %float %2982 %2987 + OpBranch %2979 + %2980 = OpLabel + %2989 = OpFSub %float %2961 %2968 + %2990 = OpFMul %float %float_7 %2989 + %2991 = OpFSub %float %2976 %2968 + %2992 = OpFDiv %float %2990 %2991 + %2993 = OpConvertFToS %int %2992 + %2994 = OpConvertSToF %float %2993 + %2995 = OpFSub %float %2992 %2994 + %2996 = OpAccessChain %_ptr_Function_float %551 %2993 + %2997 = OpLoad %float %2996 + %2998 = OpIAdd %int %2993 %int_1 + %2999 = OpAccessChain %_ptr_Function_float %551 %2998 + %3000 = OpLoad %float %2999 + %3001 = OpIAdd %int %2993 %int_2 + %3002 = OpAccessChain %_ptr_Function_float %551 %3001 + %3003 = OpLoad %float %3002 + %3004 = OpCompositeConstruct %v3float %2997 %3000 %3003 + %3005 = OpFMul %float %2995 %2995 + %3006 = OpCompositeConstruct %v3float %3005 %2995 %float_1 + %3007 = OpMatrixTimesVector %v3float %466 %3004 + %3008 = OpDot %float %3006 %3007 + OpBranch %2979 + %2979 = OpLabel + %3009 = OpPhi %float %2988 %2981 %3008 %2980 + OpBranch %2971 + %2972 = OpLabel + %3010 = OpFSub %float %2961 %2793 + %3011 = OpFMul %float %float_7 %3010 + %3012 = OpFSub %float %2968 %2793 + %3013 = OpFDiv %float %3011 %3012 + %3014 = OpConvertFToS %int %3013 + %3015 = OpConvertSToF %float %3014 + %3016 = OpFSub %float %3013 %3015 + %3017 = OpAccessChain %_ptr_Function_float %552 %3014 + %3018 = OpLoad %float %3017 + %3019 = OpIAdd %int %3014 %int_1 + %3020 = OpAccessChain %_ptr_Function_float %552 %3019 + %3021 = OpLoad %float %3020 + %3022 = OpIAdd %int %3014 %int_2 + %3023 = OpAccessChain %_ptr_Function_float %552 %3022 + %3024 = OpLoad %float %3023 + %3025 = OpCompositeConstruct %v3float %3018 %3021 %3024 + %3026 = OpFMul %float %3016 %3016 + %3027 = OpCompositeConstruct %v3float %3026 %3016 %float_1 + %3028 = OpMatrixTimesVector %v3float %466 %3025 + %3029 = OpDot %float %3027 %3028 + OpBranch %2971 + %2971 = OpLabel + %3030 = OpPhi %float %3009 %2979 %3029 %2972 + OpBranch %2963 + %2964 = OpLabel + %3031 = OpFMul %float %2961 %float_3 + %3032 = OpExtInst %float %1 Log %float_9_99999975en05 + %3033 = OpFDiv %float %3032 %1091 + %3034 = OpFMul %float %float_3 %2792 + %3035 = OpFDiv %float %3034 %1091 + %3036 = OpFSub %float %3033 %3035 + %3037 = OpFAdd %float %3031 %3036 + OpBranch %2963 + %2963 = OpLabel + %3038 = OpPhi %float %3030 %2971 %3037 %2964 + %3039 = OpExtInst %float %1 Pow %float_10 %3038 + %3040 = OpCompositeInsert %v3float %3039 %2956 2 + %3041 = OpFSub %v3float %3040 %361 + %3042 = OpVectorTimesMatrix %v3float %3041 %602 + %3043 = OpFMul %v3float %3042 %519 + %3044 = OpExtInst %v3float %1 Pow %3043 %286 + %3045 = OpFMul %v3float %196 %3044 + %3046 = OpFAdd %v3float %195 %3045 + %3047 = OpFMul %v3float %197 %3044 + %3048 = OpFAdd %v3float %141 %3047 + %3049 = OpFDiv %v3float %141 %3048 + %3050 = OpFMul %v3float %3046 %3049 + %3051 = OpExtInst %v3float %1 Pow %3050 %287 + OpBranch %1336 + %1336 = OpLabel + %3052 = OpPhi %v3float %2201 %1342 %3051 %2963 + OpBranch %1330 + %1331 = OpLabel + %3053 = OpVectorTimesMatrix %v3float %1324 %573 + %3054 = OpVectorTimesMatrix %v3float %3053 %602 + %3055 = OpExtInst %v3float %1 FMax %263 %3054 + %3056 = OpFMul %v3float %3055 %275 + %3057 = OpExtInst %v3float %1 FMax %3055 %277 + %3058 = OpExtInst %v3float %1 Pow %3057 %279 + %3059 = OpFMul %v3float %3058 %281 + %3060 = OpFSub %v3float %3059 %283 + %3061 = OpExtInst %v3float %1 FMin %3056 %3060 + OpBranch %1330 + %1330 = OpLabel + %3062 = OpPhi %v3float %3052 %1336 %3061 %1331 + OpBranch %1326 + %1327 = OpLabel + %3063 = OpCompositeExtract %float %1324 0 + OpBranch %3064 + %3064 = OpLabel + OpLoopMerge %3065 %3066 None + OpBranch %3067 + %3067 = OpLabel + %3068 = OpFOrdLessThan %bool %3063 %float_0_00313066994 + OpSelectionMerge %3069 None + OpBranchConditional %3068 %3070 %3069 + %3070 = OpLabel + %3071 = OpFMul %float %3063 %float_12_9200001 + OpBranch %3065 + %3069 = OpLabel + %3072 = OpExtInst %float %1 Pow %3063 %float_0_416666657 + %3073 = OpFMul %float %3072 %float_1_05499995 + %3074 = OpFSub %float %3073 %float_0_0549999997 + OpBranch %3065 + %3066 = OpLabel + OpBranch %3064 + %3065 = OpLabel + %3075 = OpPhi %float %3071 %3070 %3074 %3069 + %3076 = OpCompositeExtract %float %1324 1 + OpBranch %3077 + %3077 = OpLabel + OpLoopMerge %3078 %3079 None + OpBranch %3080 + %3080 = OpLabel + %3081 = OpFOrdLessThan %bool %3076 %float_0_00313066994 + OpSelectionMerge %3082 None + OpBranchConditional %3081 %3083 %3082 + %3083 = OpLabel + %3084 = OpFMul %float %3076 %float_12_9200001 + OpBranch %3078 + %3082 = OpLabel + %3085 = OpExtInst %float %1 Pow %3076 %float_0_416666657 + %3086 = OpFMul %float %3085 %float_1_05499995 + %3087 = OpFSub %float %3086 %float_0_0549999997 + OpBranch %3078 + %3079 = OpLabel + OpBranch %3077 + %3078 = OpLabel + %3088 = OpPhi %float %3084 %3083 %3087 %3082 + %3089 = OpCompositeExtract %float %1324 2 + OpBranch %3090 + %3090 = OpLabel + OpLoopMerge %3091 %3092 None + OpBranch %3093 + %3093 = OpLabel + %3094 = OpFOrdLessThan %bool %3089 %float_0_00313066994 + OpSelectionMerge %3095 None + OpBranchConditional %3094 %3096 %3095 + %3096 = OpLabel + %3097 = OpFMul %float %3089 %float_12_9200001 + OpBranch %3091 + %3095 = OpLabel + %3098 = OpExtInst %float %1 Pow %3089 %float_0_416666657 + %3099 = OpFMul %float %3098 %float_1_05499995 + %3100 = OpFSub %float %3099 %float_0_0549999997 + OpBranch %3091 + %3092 = OpLabel + OpBranch %3090 + %3091 = OpLabel + %3101 = OpPhi %float %3097 %3096 %3100 %3095 + %3102 = OpCompositeConstruct %v3float %3075 %3088 %3101 + OpBranch %1326 + %1326 = OpLabel + %3103 = OpPhi %v3float %3062 %1330 %3102 %3091 + %3104 = OpFMul %v3float %3103 %522 + %3105 = OpVectorShuffle %v4float %135 %3104 4 5 6 3 + %3106 = OpCompositeInsert %v4float %float_0 %3105 3 + OpStore %out_var_SV_Target0 %3106 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag new file mode 100644 index 0000000000..097eb6354d --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag @@ -0,0 +1,1230 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 271 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %MainPS "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_PRIMITIVE_ID %in_var_TEXCOORD7 %gl_FragCoord %gl_FrontFacing %gl_SampleMask %out_var_SV_Target0 %gl_SampleMask_0 + OpExecutionMode %MainPS OriginUpperLeft + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_3d_image "type.3d.image" + OpName %type_sampler "type.sampler" + OpName %View_SharedBilinearClampedSampler "View_SharedBilinearClampedSampler" + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %View_PrimitiveSceneData "View_PrimitiveSceneData" + OpName %type_TranslucentBasePass "type.TranslucentBasePass" + OpMemberName %type_TranslucentBasePass 0 "TranslucentBasePass_Shared_Forward_NumLocalLights" + OpMemberName %type_TranslucentBasePass 1 "TranslucentBasePass_Shared_Forward_NumReflectionCaptures" + OpMemberName %type_TranslucentBasePass 2 "TranslucentBasePass_Shared_Forward_HasDirectionalLight" + OpMemberName %type_TranslucentBasePass 3 "TranslucentBasePass_Shared_Forward_NumGridCells" + OpMemberName %type_TranslucentBasePass 4 "TranslucentBasePass_Shared_Forward_CulledGridSize" + OpMemberName %type_TranslucentBasePass 5 "TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell" + OpMemberName %type_TranslucentBasePass 6 "TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift" + OpMemberName %type_TranslucentBasePass 7 "PrePadding_TranslucentBasePass_Shared_Forward_36" + OpMemberName %type_TranslucentBasePass 8 "PrePadding_TranslucentBasePass_Shared_Forward_40" + OpMemberName %type_TranslucentBasePass 9 "PrePadding_TranslucentBasePass_Shared_Forward_44" + OpMemberName %type_TranslucentBasePass 10 "TranslucentBasePass_Shared_Forward_LightGridZParams" + OpMemberName %type_TranslucentBasePass 11 "PrePadding_TranslucentBasePass_Shared_Forward_60" + OpMemberName %type_TranslucentBasePass 12 "TranslucentBasePass_Shared_Forward_DirectionalLightDirection" + OpMemberName %type_TranslucentBasePass 13 "PrePadding_TranslucentBasePass_Shared_Forward_76" + OpMemberName %type_TranslucentBasePass 14 "TranslucentBasePass_Shared_Forward_DirectionalLightColor" + OpMemberName %type_TranslucentBasePass 15 "TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity" + OpMemberName %type_TranslucentBasePass 16 "TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask" + OpMemberName %type_TranslucentBasePass 17 "PrePadding_TranslucentBasePass_Shared_Forward_100" + OpMemberName %type_TranslucentBasePass 18 "TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD" + OpMemberName %type_TranslucentBasePass 19 "TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades" + OpMemberName %type_TranslucentBasePass 20 "PrePadding_TranslucentBasePass_Shared_Forward_116" + OpMemberName %type_TranslucentBasePass 21 "PrePadding_TranslucentBasePass_Shared_Forward_120" + OpMemberName %type_TranslucentBasePass 22 "PrePadding_TranslucentBasePass_Shared_Forward_124" + OpMemberName %type_TranslucentBasePass 23 "TranslucentBasePass_Shared_Forward_CascadeEndDepths" + OpMemberName %type_TranslucentBasePass 24 "TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix" + OpMemberName %type_TranslucentBasePass 25 "TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax" + OpMemberName %type_TranslucentBasePass 26 "TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize" + OpMemberName %type_TranslucentBasePass 27 "TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias" + OpMemberName %type_TranslucentBasePass 28 "TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing" + OpMemberName %type_TranslucentBasePass 29 "PrePadding_TranslucentBasePass_Shared_Forward_488" + OpMemberName %type_TranslucentBasePass 30 "PrePadding_TranslucentBasePass_Shared_Forward_492" + OpMemberName %type_TranslucentBasePass 31 "TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize" + OpMemberName %type_TranslucentBasePass 32 "TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow" + OpMemberName %type_TranslucentBasePass 33 "PrePadding_TranslucentBasePass_Shared_ForwardISR_576" + OpMemberName %type_TranslucentBasePass 34 "PrePadding_TranslucentBasePass_Shared_ForwardISR_580" + OpMemberName %type_TranslucentBasePass 35 "PrePadding_TranslucentBasePass_Shared_ForwardISR_584" + OpMemberName %type_TranslucentBasePass 36 "PrePadding_TranslucentBasePass_Shared_ForwardISR_588" + OpMemberName %type_TranslucentBasePass 37 "PrePadding_TranslucentBasePass_Shared_ForwardISR_592" + OpMemberName %type_TranslucentBasePass 38 "PrePadding_TranslucentBasePass_Shared_ForwardISR_596" + OpMemberName %type_TranslucentBasePass 39 "PrePadding_TranslucentBasePass_Shared_ForwardISR_600" + OpMemberName %type_TranslucentBasePass 40 "PrePadding_TranslucentBasePass_Shared_ForwardISR_604" + OpMemberName %type_TranslucentBasePass 41 "PrePadding_TranslucentBasePass_Shared_ForwardISR_608" + OpMemberName %type_TranslucentBasePass 42 "PrePadding_TranslucentBasePass_Shared_ForwardISR_612" + OpMemberName %type_TranslucentBasePass 43 "PrePadding_TranslucentBasePass_Shared_ForwardISR_616" + OpMemberName %type_TranslucentBasePass 44 "PrePadding_TranslucentBasePass_Shared_ForwardISR_620" + OpMemberName %type_TranslucentBasePass 45 "PrePadding_TranslucentBasePass_Shared_ForwardISR_624" + OpMemberName %type_TranslucentBasePass 46 "PrePadding_TranslucentBasePass_Shared_ForwardISR_628" + OpMemberName %type_TranslucentBasePass 47 "PrePadding_TranslucentBasePass_Shared_ForwardISR_632" + OpMemberName %type_TranslucentBasePass 48 "PrePadding_TranslucentBasePass_Shared_ForwardISR_636" + OpMemberName %type_TranslucentBasePass 49 "TranslucentBasePass_Shared_ForwardISR_NumLocalLights" + OpMemberName %type_TranslucentBasePass 50 "TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures" + OpMemberName %type_TranslucentBasePass 51 "TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight" + OpMemberName %type_TranslucentBasePass 52 "TranslucentBasePass_Shared_ForwardISR_NumGridCells" + OpMemberName %type_TranslucentBasePass 53 "TranslucentBasePass_Shared_ForwardISR_CulledGridSize" + OpMemberName %type_TranslucentBasePass 54 "TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell" + OpMemberName %type_TranslucentBasePass 55 "TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift" + OpMemberName %type_TranslucentBasePass 56 "PrePadding_TranslucentBasePass_Shared_ForwardISR_676" + OpMemberName %type_TranslucentBasePass 57 "PrePadding_TranslucentBasePass_Shared_ForwardISR_680" + OpMemberName %type_TranslucentBasePass 58 "PrePadding_TranslucentBasePass_Shared_ForwardISR_684" + OpMemberName %type_TranslucentBasePass 59 "TranslucentBasePass_Shared_ForwardISR_LightGridZParams" + OpMemberName %type_TranslucentBasePass 60 "PrePadding_TranslucentBasePass_Shared_ForwardISR_700" + OpMemberName %type_TranslucentBasePass 61 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection" + OpMemberName %type_TranslucentBasePass 62 "PrePadding_TranslucentBasePass_Shared_ForwardISR_716" + OpMemberName %type_TranslucentBasePass 63 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor" + OpMemberName %type_TranslucentBasePass 64 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity" + OpMemberName %type_TranslucentBasePass 65 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask" + OpMemberName %type_TranslucentBasePass 66 "PrePadding_TranslucentBasePass_Shared_ForwardISR_740" + OpMemberName %type_TranslucentBasePass 67 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD" + OpMemberName %type_TranslucentBasePass 68 "TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades" + OpMemberName %type_TranslucentBasePass 69 "PrePadding_TranslucentBasePass_Shared_ForwardISR_756" + OpMemberName %type_TranslucentBasePass 70 "PrePadding_TranslucentBasePass_Shared_ForwardISR_760" + OpMemberName %type_TranslucentBasePass 71 "PrePadding_TranslucentBasePass_Shared_ForwardISR_764" + OpMemberName %type_TranslucentBasePass 72 "TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths" + OpMemberName %type_TranslucentBasePass 73 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix" + OpMemberName %type_TranslucentBasePass 74 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax" + OpMemberName %type_TranslucentBasePass 75 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize" + OpMemberName %type_TranslucentBasePass 76 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias" + OpMemberName %type_TranslucentBasePass 77 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing" + OpMemberName %type_TranslucentBasePass 78 "PrePadding_TranslucentBasePass_Shared_ForwardISR_1128" + OpMemberName %type_TranslucentBasePass 79 "PrePadding_TranslucentBasePass_Shared_ForwardISR_1132" + OpMemberName %type_TranslucentBasePass 80 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize" + OpMemberName %type_TranslucentBasePass 81 "TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow" + OpMemberName %type_TranslucentBasePass 82 "PrePadding_TranslucentBasePass_Shared_Reflection_1216" + OpMemberName %type_TranslucentBasePass 83 "PrePadding_TranslucentBasePass_Shared_Reflection_1220" + OpMemberName %type_TranslucentBasePass 84 "PrePadding_TranslucentBasePass_Shared_Reflection_1224" + OpMemberName %type_TranslucentBasePass 85 "PrePadding_TranslucentBasePass_Shared_Reflection_1228" + OpMemberName %type_TranslucentBasePass 86 "PrePadding_TranslucentBasePass_Shared_Reflection_1232" + OpMemberName %type_TranslucentBasePass 87 "PrePadding_TranslucentBasePass_Shared_Reflection_1236" + OpMemberName %type_TranslucentBasePass 88 "PrePadding_TranslucentBasePass_Shared_Reflection_1240" + OpMemberName %type_TranslucentBasePass 89 "PrePadding_TranslucentBasePass_Shared_Reflection_1244" + OpMemberName %type_TranslucentBasePass 90 "PrePadding_TranslucentBasePass_Shared_Reflection_1248" + OpMemberName %type_TranslucentBasePass 91 "PrePadding_TranslucentBasePass_Shared_Reflection_1252" + OpMemberName %type_TranslucentBasePass 92 "PrePadding_TranslucentBasePass_Shared_Reflection_1256" + OpMemberName %type_TranslucentBasePass 93 "PrePadding_TranslucentBasePass_Shared_Reflection_1260" + OpMemberName %type_TranslucentBasePass 94 "PrePadding_TranslucentBasePass_Shared_Reflection_1264" + OpMemberName %type_TranslucentBasePass 95 "PrePadding_TranslucentBasePass_Shared_Reflection_1268" + OpMemberName %type_TranslucentBasePass 96 "PrePadding_TranslucentBasePass_Shared_Reflection_1272" + OpMemberName %type_TranslucentBasePass 97 "PrePadding_TranslucentBasePass_Shared_Reflection_1276" + OpMemberName %type_TranslucentBasePass 98 "TranslucentBasePass_Shared_Reflection_SkyLightParameters" + OpMemberName %type_TranslucentBasePass 99 "TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness" + OpMemberName %type_TranslucentBasePass 100 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300" + OpMemberName %type_TranslucentBasePass 101 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304" + OpMemberName %type_TranslucentBasePass 102 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308" + OpMemberName %type_TranslucentBasePass 103 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312" + OpMemberName %type_TranslucentBasePass 104 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316" + OpMemberName %type_TranslucentBasePass 105 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320" + OpMemberName %type_TranslucentBasePass 106 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324" + OpMemberName %type_TranslucentBasePass 107 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328" + OpMemberName %type_TranslucentBasePass 108 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332" + OpMemberName %type_TranslucentBasePass 109 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336" + OpMemberName %type_TranslucentBasePass 110 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340" + OpMemberName %type_TranslucentBasePass 111 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344" + OpMemberName %type_TranslucentBasePass 112 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348" + OpMemberName %type_TranslucentBasePass 113 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352" + OpMemberName %type_TranslucentBasePass 114 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356" + OpMemberName %type_TranslucentBasePass 115 "TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane" + OpMemberName %type_TranslucentBasePass 116 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin" + OpMemberName %type_TranslucentBasePass 117 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis" + OpMemberName %type_TranslucentBasePass 118 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis" + OpMemberName %type_TranslucentBasePass 119 "TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix" + OpMemberName %type_TranslucentBasePass 120 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters" + OpMemberName %type_TranslucentBasePass 121 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1484" + OpMemberName %type_TranslucentBasePass 122 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2" + OpMemberName %type_TranslucentBasePass 123 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1496" + OpMemberName %type_TranslucentBasePass 124 "PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500" + OpMemberName %type_TranslucentBasePass 125 "TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV" + OpMemberName %type_TranslucentBasePass 126 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias" + OpMemberName %type_TranslucentBasePass 127 "TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound" + OpMemberName %type_TranslucentBasePass 128 "TranslucentBasePass_Shared_PlanarReflection_bIsStereo" + OpMemberName %type_TranslucentBasePass 129 "PrePadding_TranslucentBasePass_Shared_Fog_1676" + OpMemberName %type_TranslucentBasePass 130 "PrePadding_TranslucentBasePass_Shared_Fog_1680" + OpMemberName %type_TranslucentBasePass 131 "PrePadding_TranslucentBasePass_Shared_Fog_1684" + OpMemberName %type_TranslucentBasePass 132 "PrePadding_TranslucentBasePass_Shared_Fog_1688" + OpMemberName %type_TranslucentBasePass 133 "PrePadding_TranslucentBasePass_Shared_Fog_1692" + OpMemberName %type_TranslucentBasePass 134 "TranslucentBasePass_Shared_Fog_ExponentialFogParameters" + OpMemberName %type_TranslucentBasePass 135 "TranslucentBasePass_Shared_Fog_ExponentialFogParameters2" + OpMemberName %type_TranslucentBasePass 136 "TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter" + OpMemberName %type_TranslucentBasePass 137 "TranslucentBasePass_Shared_Fog_ExponentialFogParameters3" + OpMemberName %type_TranslucentBasePass 138 "TranslucentBasePass_Shared_Fog_InscatteringLightDirection" + OpMemberName %type_TranslucentBasePass 139 "TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor" + OpMemberName %type_TranslucentBasePass 140 "TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation" + OpMemberName %type_TranslucentBasePass 141 "PrePadding_TranslucentBasePass_Shared_Fog_1800" + OpMemberName %type_TranslucentBasePass 142 "PrePadding_TranslucentBasePass_Shared_Fog_1804" + OpMemberName %type_TranslucentBasePass 143 "TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters" + OpMemberName %type_TranslucentBasePass 144 "TranslucentBasePass_Shared_Fog_ApplyVolumetricFog" + OpMemberName %type_TranslucentBasePass 145 "PrePadding_TranslucentBasePass_1824" + OpMemberName %type_TranslucentBasePass 146 "PrePadding_TranslucentBasePass_1828" + OpMemberName %type_TranslucentBasePass 147 "PrePadding_TranslucentBasePass_1832" + OpMemberName %type_TranslucentBasePass 148 "PrePadding_TranslucentBasePass_1836" + OpMemberName %type_TranslucentBasePass 149 "PrePadding_TranslucentBasePass_1840" + OpMemberName %type_TranslucentBasePass 150 "PrePadding_TranslucentBasePass_1844" + OpMemberName %type_TranslucentBasePass 151 "PrePadding_TranslucentBasePass_1848" + OpMemberName %type_TranslucentBasePass 152 "PrePadding_TranslucentBasePass_1852" + OpMemberName %type_TranslucentBasePass 153 "PrePadding_TranslucentBasePass_1856" + OpMemberName %type_TranslucentBasePass 154 "PrePadding_TranslucentBasePass_1860" + OpMemberName %type_TranslucentBasePass 155 "PrePadding_TranslucentBasePass_1864" + OpMemberName %type_TranslucentBasePass 156 "PrePadding_TranslucentBasePass_1868" + OpMemberName %type_TranslucentBasePass 157 "PrePadding_TranslucentBasePass_1872" + OpMemberName %type_TranslucentBasePass 158 "PrePadding_TranslucentBasePass_1876" + OpMemberName %type_TranslucentBasePass 159 "PrePadding_TranslucentBasePass_1880" + OpMemberName %type_TranslucentBasePass 160 "PrePadding_TranslucentBasePass_1884" + OpMemberName %type_TranslucentBasePass 161 "PrePadding_TranslucentBasePass_1888" + OpMemberName %type_TranslucentBasePass 162 "PrePadding_TranslucentBasePass_1892" + OpMemberName %type_TranslucentBasePass 163 "PrePadding_TranslucentBasePass_1896" + OpMemberName %type_TranslucentBasePass 164 "PrePadding_TranslucentBasePass_1900" + OpMemberName %type_TranslucentBasePass 165 "PrePadding_TranslucentBasePass_1904" + OpMemberName %type_TranslucentBasePass 166 "PrePadding_TranslucentBasePass_1908" + OpMemberName %type_TranslucentBasePass 167 "PrePadding_TranslucentBasePass_1912" + OpMemberName %type_TranslucentBasePass 168 "PrePadding_TranslucentBasePass_1916" + OpMemberName %type_TranslucentBasePass 169 "PrePadding_TranslucentBasePass_1920" + OpMemberName %type_TranslucentBasePass 170 "PrePadding_TranslucentBasePass_1924" + OpMemberName %type_TranslucentBasePass 171 "PrePadding_TranslucentBasePass_1928" + OpMemberName %type_TranslucentBasePass 172 "PrePadding_TranslucentBasePass_1932" + OpMemberName %type_TranslucentBasePass 173 "PrePadding_TranslucentBasePass_1936" + OpMemberName %type_TranslucentBasePass 174 "PrePadding_TranslucentBasePass_1940" + OpMemberName %type_TranslucentBasePass 175 "PrePadding_TranslucentBasePass_1944" + OpMemberName %type_TranslucentBasePass 176 "PrePadding_TranslucentBasePass_1948" + OpMemberName %type_TranslucentBasePass 177 "PrePadding_TranslucentBasePass_1952" + OpMemberName %type_TranslucentBasePass 178 "PrePadding_TranslucentBasePass_1956" + OpMemberName %type_TranslucentBasePass 179 "PrePadding_TranslucentBasePass_1960" + OpMemberName %type_TranslucentBasePass 180 "PrePadding_TranslucentBasePass_1964" + OpMemberName %type_TranslucentBasePass 181 "PrePadding_TranslucentBasePass_1968" + OpMemberName %type_TranslucentBasePass 182 "PrePadding_TranslucentBasePass_1972" + OpMemberName %type_TranslucentBasePass 183 "PrePadding_TranslucentBasePass_1976" + OpMemberName %type_TranslucentBasePass 184 "PrePadding_TranslucentBasePass_1980" + OpMemberName %type_TranslucentBasePass 185 "PrePadding_TranslucentBasePass_1984" + OpMemberName %type_TranslucentBasePass 186 "PrePadding_TranslucentBasePass_1988" + OpMemberName %type_TranslucentBasePass 187 "PrePadding_TranslucentBasePass_1992" + OpMemberName %type_TranslucentBasePass 188 "PrePadding_TranslucentBasePass_1996" + OpMemberName %type_TranslucentBasePass 189 "PrePadding_TranslucentBasePass_2000" + OpMemberName %type_TranslucentBasePass 190 "PrePadding_TranslucentBasePass_2004" + OpMemberName %type_TranslucentBasePass 191 "PrePadding_TranslucentBasePass_2008" + OpMemberName %type_TranslucentBasePass 192 "PrePadding_TranslucentBasePass_2012" + OpMemberName %type_TranslucentBasePass 193 "PrePadding_TranslucentBasePass_2016" + OpMemberName %type_TranslucentBasePass 194 "PrePadding_TranslucentBasePass_2020" + OpMemberName %type_TranslucentBasePass 195 "PrePadding_TranslucentBasePass_2024" + OpMemberName %type_TranslucentBasePass 196 "PrePadding_TranslucentBasePass_2028" + OpMemberName %type_TranslucentBasePass 197 "PrePadding_TranslucentBasePass_2032" + OpMemberName %type_TranslucentBasePass 198 "PrePadding_TranslucentBasePass_2036" + OpMemberName %type_TranslucentBasePass 199 "PrePadding_TranslucentBasePass_2040" + OpMemberName %type_TranslucentBasePass 200 "PrePadding_TranslucentBasePass_2044" + OpMemberName %type_TranslucentBasePass 201 "PrePadding_TranslucentBasePass_2048" + OpMemberName %type_TranslucentBasePass 202 "PrePadding_TranslucentBasePass_2052" + OpMemberName %type_TranslucentBasePass 203 "PrePadding_TranslucentBasePass_2056" + OpMemberName %type_TranslucentBasePass 204 "PrePadding_TranslucentBasePass_2060" + OpMemberName %type_TranslucentBasePass 205 "PrePadding_TranslucentBasePass_2064" + OpMemberName %type_TranslucentBasePass 206 "PrePadding_TranslucentBasePass_2068" + OpMemberName %type_TranslucentBasePass 207 "PrePadding_TranslucentBasePass_2072" + OpMemberName %type_TranslucentBasePass 208 "PrePadding_TranslucentBasePass_2076" + OpMemberName %type_TranslucentBasePass 209 "PrePadding_TranslucentBasePass_2080" + OpMemberName %type_TranslucentBasePass 210 "PrePadding_TranslucentBasePass_2084" + OpMemberName %type_TranslucentBasePass 211 "PrePadding_TranslucentBasePass_2088" + OpMemberName %type_TranslucentBasePass 212 "PrePadding_TranslucentBasePass_2092" + OpMemberName %type_TranslucentBasePass 213 "PrePadding_TranslucentBasePass_2096" + OpMemberName %type_TranslucentBasePass 214 "PrePadding_TranslucentBasePass_2100" + OpMemberName %type_TranslucentBasePass 215 "PrePadding_TranslucentBasePass_2104" + OpMemberName %type_TranslucentBasePass 216 "PrePadding_TranslucentBasePass_2108" + OpMemberName %type_TranslucentBasePass 217 "PrePadding_TranslucentBasePass_2112" + OpMemberName %type_TranslucentBasePass 218 "PrePadding_TranslucentBasePass_2116" + OpMemberName %type_TranslucentBasePass 219 "PrePadding_TranslucentBasePass_2120" + OpMemberName %type_TranslucentBasePass 220 "PrePadding_TranslucentBasePass_2124" + OpMemberName %type_TranslucentBasePass 221 "PrePadding_TranslucentBasePass_2128" + OpMemberName %type_TranslucentBasePass 222 "PrePadding_TranslucentBasePass_2132" + OpMemberName %type_TranslucentBasePass 223 "PrePadding_TranslucentBasePass_2136" + OpMemberName %type_TranslucentBasePass 224 "PrePadding_TranslucentBasePass_2140" + OpMemberName %type_TranslucentBasePass 225 "TranslucentBasePass_HZBUvFactorAndInvFactor" + OpMemberName %type_TranslucentBasePass 226 "TranslucentBasePass_PrevScreenPositionScaleBias" + OpMemberName %type_TranslucentBasePass 227 "TranslucentBasePass_PrevSceneColorPreExposureInv" + OpName %TranslucentBasePass "TranslucentBasePass" + OpName %TranslucentBasePass_Shared_Fog_IntegratedLightScattering "TranslucentBasePass_Shared_Fog_IntegratedLightScattering" + OpName %type_Material "type.Material" + OpMemberName %type_Material 0 "Material_VectorExpressions" + OpMemberName %type_Material 1 "Material_ScalarExpressions" + OpName %Material "Material" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_PRIMITIVE_ID "in.var.PRIMITIVE_ID" + OpName %in_var_TEXCOORD7 "in.var.TEXCOORD7" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %MainPS "MainPS" + OpName %type_sampled_image "type.sampled.image" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorate %in_var_PRIMITIVE_ID Flat + OpDecorateString %in_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_Position" + OpDecorate %gl_FrontFacing BuiltIn FrontFacing + OpDecorateString %gl_FrontFacing UserSemantic "SV_IsFrontFace" + OpDecorate %gl_FrontFacing Flat + OpDecorate %gl_SampleMask BuiltIn SampleMask + OpDecorateString %gl_SampleMask UserSemantic "SV_Coverage" + OpDecorate %gl_SampleMask Flat + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %gl_SampleMask_0 BuiltIn SampleMask + OpDecorateString %gl_SampleMask_0 UserSemantic "SV_Coverage" + OpDecorate %in_var_TEXCOORD10_centroid Location 0 + OpDecorate %in_var_TEXCOORD11_centroid Location 1 + OpDecorate %in_var_PRIMITIVE_ID Location 2 + OpDecorate %in_var_TEXCOORD7 Location 3 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 1 + OpDecorate %View_SharedBilinearClampedSampler DescriptorSet 0 + OpDecorate %View_SharedBilinearClampedSampler Binding 0 + OpDecorate %View_PrimitiveSceneData DescriptorSet 0 + OpDecorate %View_PrimitiveSceneData Binding 0 + OpDecorate %TranslucentBasePass DescriptorSet 0 + OpDecorate %TranslucentBasePass Binding 2 + OpDecorate %TranslucentBasePass_Shared_Fog_IntegratedLightScattering DescriptorSet 0 + OpDecorate %TranslucentBasePass_Shared_Fog_IntegratedLightScattering Binding 0 + OpDecorate %Material DescriptorSet 0 + OpDecorate %Material Binding 3 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + OpDecorate %_arr_mat4v4float_uint_4 ArrayStride 64 + OpDecorate %_arr_mat4v4float_uint_2 ArrayStride 64 + OpMemberDecorate %type_TranslucentBasePass 0 Offset 0 + OpMemberDecorate %type_TranslucentBasePass 1 Offset 4 + OpMemberDecorate %type_TranslucentBasePass 2 Offset 8 + OpMemberDecorate %type_TranslucentBasePass 3 Offset 12 + OpMemberDecorate %type_TranslucentBasePass 4 Offset 16 + OpMemberDecorate %type_TranslucentBasePass 5 Offset 28 + OpMemberDecorate %type_TranslucentBasePass 6 Offset 32 + OpMemberDecorate %type_TranslucentBasePass 7 Offset 36 + OpMemberDecorate %type_TranslucentBasePass 8 Offset 40 + OpMemberDecorate %type_TranslucentBasePass 9 Offset 44 + OpMemberDecorate %type_TranslucentBasePass 10 Offset 48 + OpMemberDecorate %type_TranslucentBasePass 11 Offset 60 + OpMemberDecorate %type_TranslucentBasePass 12 Offset 64 + OpMemberDecorate %type_TranslucentBasePass 13 Offset 76 + OpMemberDecorate %type_TranslucentBasePass 14 Offset 80 + OpMemberDecorate %type_TranslucentBasePass 15 Offset 92 + OpMemberDecorate %type_TranslucentBasePass 16 Offset 96 + OpMemberDecorate %type_TranslucentBasePass 17 Offset 100 + OpMemberDecorate %type_TranslucentBasePass 18 Offset 104 + OpMemberDecorate %type_TranslucentBasePass 19 Offset 112 + OpMemberDecorate %type_TranslucentBasePass 20 Offset 116 + OpMemberDecorate %type_TranslucentBasePass 21 Offset 120 + OpMemberDecorate %type_TranslucentBasePass 22 Offset 124 + OpMemberDecorate %type_TranslucentBasePass 23 Offset 128 + OpMemberDecorate %type_TranslucentBasePass 24 Offset 144 + OpMemberDecorate %type_TranslucentBasePass 24 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 24 ColMajor + OpMemberDecorate %type_TranslucentBasePass 25 Offset 400 + OpMemberDecorate %type_TranslucentBasePass 26 Offset 464 + OpMemberDecorate %type_TranslucentBasePass 27 Offset 480 + OpMemberDecorate %type_TranslucentBasePass 28 Offset 484 + OpMemberDecorate %type_TranslucentBasePass 29 Offset 488 + OpMemberDecorate %type_TranslucentBasePass 30 Offset 492 + OpMemberDecorate %type_TranslucentBasePass 31 Offset 496 + OpMemberDecorate %type_TranslucentBasePass 32 Offset 512 + OpMemberDecorate %type_TranslucentBasePass 32 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 32 ColMajor + OpMemberDecorate %type_TranslucentBasePass 33 Offset 576 + OpMemberDecorate %type_TranslucentBasePass 34 Offset 580 + OpMemberDecorate %type_TranslucentBasePass 35 Offset 584 + OpMemberDecorate %type_TranslucentBasePass 36 Offset 588 + OpMemberDecorate %type_TranslucentBasePass 37 Offset 592 + OpMemberDecorate %type_TranslucentBasePass 38 Offset 596 + OpMemberDecorate %type_TranslucentBasePass 39 Offset 600 + OpMemberDecorate %type_TranslucentBasePass 40 Offset 604 + OpMemberDecorate %type_TranslucentBasePass 41 Offset 608 + OpMemberDecorate %type_TranslucentBasePass 42 Offset 612 + OpMemberDecorate %type_TranslucentBasePass 43 Offset 616 + OpMemberDecorate %type_TranslucentBasePass 44 Offset 620 + OpMemberDecorate %type_TranslucentBasePass 45 Offset 624 + OpMemberDecorate %type_TranslucentBasePass 46 Offset 628 + OpMemberDecorate %type_TranslucentBasePass 47 Offset 632 + OpMemberDecorate %type_TranslucentBasePass 48 Offset 636 + OpMemberDecorate %type_TranslucentBasePass 49 Offset 640 + OpMemberDecorate %type_TranslucentBasePass 50 Offset 644 + OpMemberDecorate %type_TranslucentBasePass 51 Offset 648 + OpMemberDecorate %type_TranslucentBasePass 52 Offset 652 + OpMemberDecorate %type_TranslucentBasePass 53 Offset 656 + OpMemberDecorate %type_TranslucentBasePass 54 Offset 668 + OpMemberDecorate %type_TranslucentBasePass 55 Offset 672 + OpMemberDecorate %type_TranslucentBasePass 56 Offset 676 + OpMemberDecorate %type_TranslucentBasePass 57 Offset 680 + OpMemberDecorate %type_TranslucentBasePass 58 Offset 684 + OpMemberDecorate %type_TranslucentBasePass 59 Offset 688 + OpMemberDecorate %type_TranslucentBasePass 60 Offset 700 + OpMemberDecorate %type_TranslucentBasePass 61 Offset 704 + OpMemberDecorate %type_TranslucentBasePass 62 Offset 716 + OpMemberDecorate %type_TranslucentBasePass 63 Offset 720 + OpMemberDecorate %type_TranslucentBasePass 64 Offset 732 + OpMemberDecorate %type_TranslucentBasePass 65 Offset 736 + OpMemberDecorate %type_TranslucentBasePass 66 Offset 740 + OpMemberDecorate %type_TranslucentBasePass 67 Offset 744 + OpMemberDecorate %type_TranslucentBasePass 68 Offset 752 + OpMemberDecorate %type_TranslucentBasePass 69 Offset 756 + OpMemberDecorate %type_TranslucentBasePass 70 Offset 760 + OpMemberDecorate %type_TranslucentBasePass 71 Offset 764 + OpMemberDecorate %type_TranslucentBasePass 72 Offset 768 + OpMemberDecorate %type_TranslucentBasePass 73 Offset 784 + OpMemberDecorate %type_TranslucentBasePass 73 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 73 ColMajor + OpMemberDecorate %type_TranslucentBasePass 74 Offset 1040 + OpMemberDecorate %type_TranslucentBasePass 75 Offset 1104 + OpMemberDecorate %type_TranslucentBasePass 76 Offset 1120 + OpMemberDecorate %type_TranslucentBasePass 77 Offset 1124 + OpMemberDecorate %type_TranslucentBasePass 78 Offset 1128 + OpMemberDecorate %type_TranslucentBasePass 79 Offset 1132 + OpMemberDecorate %type_TranslucentBasePass 80 Offset 1136 + OpMemberDecorate %type_TranslucentBasePass 81 Offset 1152 + OpMemberDecorate %type_TranslucentBasePass 81 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 81 ColMajor + OpMemberDecorate %type_TranslucentBasePass 82 Offset 1216 + OpMemberDecorate %type_TranslucentBasePass 83 Offset 1220 + OpMemberDecorate %type_TranslucentBasePass 84 Offset 1224 + OpMemberDecorate %type_TranslucentBasePass 85 Offset 1228 + OpMemberDecorate %type_TranslucentBasePass 86 Offset 1232 + OpMemberDecorate %type_TranslucentBasePass 87 Offset 1236 + OpMemberDecorate %type_TranslucentBasePass 88 Offset 1240 + OpMemberDecorate %type_TranslucentBasePass 89 Offset 1244 + OpMemberDecorate %type_TranslucentBasePass 90 Offset 1248 + OpMemberDecorate %type_TranslucentBasePass 91 Offset 1252 + OpMemberDecorate %type_TranslucentBasePass 92 Offset 1256 + OpMemberDecorate %type_TranslucentBasePass 93 Offset 1260 + OpMemberDecorate %type_TranslucentBasePass 94 Offset 1264 + OpMemberDecorate %type_TranslucentBasePass 95 Offset 1268 + OpMemberDecorate %type_TranslucentBasePass 96 Offset 1272 + OpMemberDecorate %type_TranslucentBasePass 97 Offset 1276 + OpMemberDecorate %type_TranslucentBasePass 98 Offset 1280 + OpMemberDecorate %type_TranslucentBasePass 99 Offset 1296 + OpMemberDecorate %type_TranslucentBasePass 100 Offset 1300 + OpMemberDecorate %type_TranslucentBasePass 101 Offset 1304 + OpMemberDecorate %type_TranslucentBasePass 102 Offset 1308 + OpMemberDecorate %type_TranslucentBasePass 103 Offset 1312 + OpMemberDecorate %type_TranslucentBasePass 104 Offset 1316 + OpMemberDecorate %type_TranslucentBasePass 105 Offset 1320 + OpMemberDecorate %type_TranslucentBasePass 106 Offset 1324 + OpMemberDecorate %type_TranslucentBasePass 107 Offset 1328 + OpMemberDecorate %type_TranslucentBasePass 108 Offset 1332 + OpMemberDecorate %type_TranslucentBasePass 109 Offset 1336 + OpMemberDecorate %type_TranslucentBasePass 110 Offset 1340 + OpMemberDecorate %type_TranslucentBasePass 111 Offset 1344 + OpMemberDecorate %type_TranslucentBasePass 112 Offset 1348 + OpMemberDecorate %type_TranslucentBasePass 113 Offset 1352 + OpMemberDecorate %type_TranslucentBasePass 114 Offset 1356 + OpMemberDecorate %type_TranslucentBasePass 115 Offset 1360 + OpMemberDecorate %type_TranslucentBasePass 116 Offset 1376 + OpMemberDecorate %type_TranslucentBasePass 117 Offset 1392 + OpMemberDecorate %type_TranslucentBasePass 118 Offset 1408 + OpMemberDecorate %type_TranslucentBasePass 119 Offset 1424 + OpMemberDecorate %type_TranslucentBasePass 119 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 119 ColMajor + OpMemberDecorate %type_TranslucentBasePass 120 Offset 1472 + OpMemberDecorate %type_TranslucentBasePass 121 Offset 1484 + OpMemberDecorate %type_TranslucentBasePass 122 Offset 1488 + OpMemberDecorate %type_TranslucentBasePass 123 Offset 1496 + OpMemberDecorate %type_TranslucentBasePass 124 Offset 1500 + OpMemberDecorate %type_TranslucentBasePass 125 Offset 1504 + OpMemberDecorate %type_TranslucentBasePass 125 MatrixStride 16 + OpMemberDecorate %type_TranslucentBasePass 125 ColMajor + OpMemberDecorate %type_TranslucentBasePass 126 Offset 1632 + OpMemberDecorate %type_TranslucentBasePass 127 Offset 1664 + OpMemberDecorate %type_TranslucentBasePass 128 Offset 1672 + OpMemberDecorate %type_TranslucentBasePass 129 Offset 1676 + OpMemberDecorate %type_TranslucentBasePass 130 Offset 1680 + OpMemberDecorate %type_TranslucentBasePass 131 Offset 1684 + OpMemberDecorate %type_TranslucentBasePass 132 Offset 1688 + OpMemberDecorate %type_TranslucentBasePass 133 Offset 1692 + OpMemberDecorate %type_TranslucentBasePass 134 Offset 1696 + OpMemberDecorate %type_TranslucentBasePass 135 Offset 1712 + OpMemberDecorate %type_TranslucentBasePass 136 Offset 1728 + OpMemberDecorate %type_TranslucentBasePass 137 Offset 1744 + OpMemberDecorate %type_TranslucentBasePass 138 Offset 1760 + OpMemberDecorate %type_TranslucentBasePass 139 Offset 1776 + OpMemberDecorate %type_TranslucentBasePass 140 Offset 1792 + OpMemberDecorate %type_TranslucentBasePass 141 Offset 1800 + OpMemberDecorate %type_TranslucentBasePass 142 Offset 1804 + OpMemberDecorate %type_TranslucentBasePass 143 Offset 1808 + OpMemberDecorate %type_TranslucentBasePass 144 Offset 1820 + OpMemberDecorate %type_TranslucentBasePass 145 Offset 1824 + OpMemberDecorate %type_TranslucentBasePass 146 Offset 1828 + OpMemberDecorate %type_TranslucentBasePass 147 Offset 1832 + OpMemberDecorate %type_TranslucentBasePass 148 Offset 1836 + OpMemberDecorate %type_TranslucentBasePass 149 Offset 1840 + OpMemberDecorate %type_TranslucentBasePass 150 Offset 1844 + OpMemberDecorate %type_TranslucentBasePass 151 Offset 1848 + OpMemberDecorate %type_TranslucentBasePass 152 Offset 1852 + OpMemberDecorate %type_TranslucentBasePass 153 Offset 1856 + OpMemberDecorate %type_TranslucentBasePass 154 Offset 1860 + OpMemberDecorate %type_TranslucentBasePass 155 Offset 1864 + OpMemberDecorate %type_TranslucentBasePass 156 Offset 1868 + OpMemberDecorate %type_TranslucentBasePass 157 Offset 1872 + OpMemberDecorate %type_TranslucentBasePass 158 Offset 1876 + OpMemberDecorate %type_TranslucentBasePass 159 Offset 1880 + OpMemberDecorate %type_TranslucentBasePass 160 Offset 1884 + OpMemberDecorate %type_TranslucentBasePass 161 Offset 1888 + OpMemberDecorate %type_TranslucentBasePass 162 Offset 1892 + OpMemberDecorate %type_TranslucentBasePass 163 Offset 1896 + OpMemberDecorate %type_TranslucentBasePass 164 Offset 1900 + OpMemberDecorate %type_TranslucentBasePass 165 Offset 1904 + OpMemberDecorate %type_TranslucentBasePass 166 Offset 1908 + OpMemberDecorate %type_TranslucentBasePass 167 Offset 1912 + OpMemberDecorate %type_TranslucentBasePass 168 Offset 1916 + OpMemberDecorate %type_TranslucentBasePass 169 Offset 1920 + OpMemberDecorate %type_TranslucentBasePass 170 Offset 1924 + OpMemberDecorate %type_TranslucentBasePass 171 Offset 1928 + OpMemberDecorate %type_TranslucentBasePass 172 Offset 1932 + OpMemberDecorate %type_TranslucentBasePass 173 Offset 1936 + OpMemberDecorate %type_TranslucentBasePass 174 Offset 1940 + OpMemberDecorate %type_TranslucentBasePass 175 Offset 1944 + OpMemberDecorate %type_TranslucentBasePass 176 Offset 1948 + OpMemberDecorate %type_TranslucentBasePass 177 Offset 1952 + OpMemberDecorate %type_TranslucentBasePass 178 Offset 1956 + OpMemberDecorate %type_TranslucentBasePass 179 Offset 1960 + OpMemberDecorate %type_TranslucentBasePass 180 Offset 1964 + OpMemberDecorate %type_TranslucentBasePass 181 Offset 1968 + OpMemberDecorate %type_TranslucentBasePass 182 Offset 1972 + OpMemberDecorate %type_TranslucentBasePass 183 Offset 1976 + OpMemberDecorate %type_TranslucentBasePass 184 Offset 1980 + OpMemberDecorate %type_TranslucentBasePass 185 Offset 1984 + OpMemberDecorate %type_TranslucentBasePass 186 Offset 1988 + OpMemberDecorate %type_TranslucentBasePass 187 Offset 1992 + OpMemberDecorate %type_TranslucentBasePass 188 Offset 1996 + OpMemberDecorate %type_TranslucentBasePass 189 Offset 2000 + OpMemberDecorate %type_TranslucentBasePass 190 Offset 2004 + OpMemberDecorate %type_TranslucentBasePass 191 Offset 2008 + OpMemberDecorate %type_TranslucentBasePass 192 Offset 2012 + OpMemberDecorate %type_TranslucentBasePass 193 Offset 2016 + OpMemberDecorate %type_TranslucentBasePass 194 Offset 2020 + OpMemberDecorate %type_TranslucentBasePass 195 Offset 2024 + OpMemberDecorate %type_TranslucentBasePass 196 Offset 2028 + OpMemberDecorate %type_TranslucentBasePass 197 Offset 2032 + OpMemberDecorate %type_TranslucentBasePass 198 Offset 2036 + OpMemberDecorate %type_TranslucentBasePass 199 Offset 2040 + OpMemberDecorate %type_TranslucentBasePass 200 Offset 2044 + OpMemberDecorate %type_TranslucentBasePass 201 Offset 2048 + OpMemberDecorate %type_TranslucentBasePass 202 Offset 2052 + OpMemberDecorate %type_TranslucentBasePass 203 Offset 2056 + OpMemberDecorate %type_TranslucentBasePass 204 Offset 2060 + OpMemberDecorate %type_TranslucentBasePass 205 Offset 2064 + OpMemberDecorate %type_TranslucentBasePass 206 Offset 2068 + OpMemberDecorate %type_TranslucentBasePass 207 Offset 2072 + OpMemberDecorate %type_TranslucentBasePass 208 Offset 2076 + OpMemberDecorate %type_TranslucentBasePass 209 Offset 2080 + OpMemberDecorate %type_TranslucentBasePass 210 Offset 2084 + OpMemberDecorate %type_TranslucentBasePass 211 Offset 2088 + OpMemberDecorate %type_TranslucentBasePass 212 Offset 2092 + OpMemberDecorate %type_TranslucentBasePass 213 Offset 2096 + OpMemberDecorate %type_TranslucentBasePass 214 Offset 2100 + OpMemberDecorate %type_TranslucentBasePass 215 Offset 2104 + OpMemberDecorate %type_TranslucentBasePass 216 Offset 2108 + OpMemberDecorate %type_TranslucentBasePass 217 Offset 2112 + OpMemberDecorate %type_TranslucentBasePass 218 Offset 2116 + OpMemberDecorate %type_TranslucentBasePass 219 Offset 2120 + OpMemberDecorate %type_TranslucentBasePass 220 Offset 2124 + OpMemberDecorate %type_TranslucentBasePass 221 Offset 2128 + OpMemberDecorate %type_TranslucentBasePass 222 Offset 2132 + OpMemberDecorate %type_TranslucentBasePass 223 Offset 2136 + OpMemberDecorate %type_TranslucentBasePass 224 Offset 2140 + OpMemberDecorate %type_TranslucentBasePass 225 Offset 2144 + OpMemberDecorate %type_TranslucentBasePass 226 Offset 2160 + OpMemberDecorate %type_TranslucentBasePass 227 Offset 2176 + OpDecorate %type_TranslucentBasePass Block + OpDecorate %_arr_v4float_uint_1 ArrayStride 16 + OpMemberDecorate %type_Material 0 Offset 0 + OpMemberDecorate %type_Material 1 Offset 32 + OpDecorate %type_Material Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float_0 = OpConstant %float 0 + %48 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_10 = OpConstant %int 10 + %int_144 = OpConstant %int 144 + %int_70 = OpConstant %int 70 + %float_1 = OpConstant %float 1 + %53 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%float_0_577000022 = OpConstant %float 0.577000022 + %55 = OpConstantComposite %v3float %float_0_577000022 %float_0_577000022 %float_0_577000022 + %56 = OpConstantComposite %v3float %float_1 %float_1 %float_0 + %57 = OpConstantComposite %v3float %float_0 %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %59 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %int_60 = OpConstant %int 60 + %61 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %uint_26 = OpConstant %uint 26 + %uint_1 = OpConstant %uint 1 + %uint_5 = OpConstant %uint 5 + %uint_19 = OpConstant %uint 19 + %float_n0_5 = OpConstant %float -0.5 + %67 = OpConstantComposite %v2float %float_0_5 %float_n0_5 + %68 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %float_0_25 = OpConstant %float 0.25 + %int_31 = OpConstant %int 31 + %int_66 = OpConstant %int 66 + %int_153 = OpConstant %int 153 + %int_155 = OpConstant %int 155 +%mat3v3float = OpTypeMatrix %v3float 3 + %75 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %float_n1 = OpConstant %float -1 +%float_0_200000003 = OpConstant %float 0.200000003 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_3d_image = OpTypeImage %float 3D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_3d_image = OpTypePointer UniformConstant %type_3d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float + %v3int = OpTypeVector %int 3 +%_arr_mat4v4float_uint_4 = OpTypeArray %mat4v4float %uint_4 +%mat3v4float = OpTypeMatrix %v4float 3 +%_arr_mat4v4float_uint_2 = OpTypeArray %mat4v4float %uint_2 +%type_TranslucentBasePass = OpTypeStruct %uint %uint %uint %uint %v3int %uint %uint %uint %uint %uint %v3float %float %v3float %float %v3float %float %uint %uint %v2float %uint %uint %uint %uint %v4float %_arr_mat4v4float_uint_4 %_arr_v4float_uint_4 %v4float %float %uint %uint %uint %v4float %mat4v4float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %v3int %uint %uint %uint %uint %uint %v3float %float %v3float %float %v3float %float %uint %uint %v2float %uint %uint %uint %uint %v4float %_arr_mat4v4float_uint_4 %_arr_v4float_uint_4 %v4float %float %uint %uint %uint %v4float %mat4v4float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %v4float %v4float %v4float %mat3v4float %v3float %float %v2float %float %float %_arr_mat4v4float_uint_2 %_arr_v4float_uint_2 %v2float %uint %float %float %float %float %float %v4float %v4float %v4float %v4float %v4float %v4float %v2float %float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %v4float %float +%_ptr_Uniform_type_TranslucentBasePass = OpTypePointer Uniform %type_TranslucentBasePass +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%type_Material = OpTypeStruct %_arr_v4float_uint_2 %_arr_v4float_uint_1 +%_ptr_Uniform_type_Material = OpTypePointer Uniform %type_Material +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_bool = OpTypePointer Input %bool +%_arr_uint_uint_1 = OpTypeArray %uint %uint_1 +%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1 + %void = OpTypeVoid + %94 = OpTypeFunction %void +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%type_sampled_image = OpTypeSampledImage %type_3d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%View_SharedBilinearClampedSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%View_PrimitiveSceneData = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform +%TranslucentBasePass = OpVariable %_ptr_Uniform_type_TranslucentBasePass Uniform +%TranslucentBasePass_Shared_Fog_IntegratedLightScattering = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant + %Material = OpVariable %_ptr_Uniform_type_Material Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input_v4float Input +%in_var_PRIMITIVE_ID = OpVariable %_ptr_Input_uint Input +%in_var_TEXCOORD7 = OpVariable %_ptr_Input_v4float Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%gl_FrontFacing = OpVariable %_ptr_Input_bool Input +%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output +%gl_SampleMask_0 = OpVariable %_ptr_Output__arr_uint_uint_1 Output + %102 = OpConstantNull %v4float + %float_n1_5 = OpConstant %float -1.5 + %float_3 = OpConstant %float 3 + %105 = OpConstantComposite %v3float %float_n1 %float_n1_5 %float_3 +%float_12_25 = OpConstant %float 12.25 +%float_0_00200000009 = OpConstant %float 0.00200000009 + %108 = OpUndef %float + %uint_15 = OpConstant %uint 15 + %MainPS = OpFunction %void None %94 + %110 = OpLabel + %111 = OpLoad %v4float %in_var_TEXCOORD10_centroid + %112 = OpLoad %v4float %in_var_TEXCOORD11_centroid + %113 = OpLoad %uint %in_var_PRIMITIVE_ID + %114 = OpLoad %v4float %in_var_TEXCOORD7 + %115 = OpLoad %v4float %gl_FragCoord + %116 = OpLoad %_arr_uint_uint_1 %gl_SampleMask + %117 = OpCompositeExtract %uint %116 0 + %118 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_1 + %119 = OpLoad %mat4v4float %118 + %120 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_10 + %121 = OpLoad %mat4v4float %120 + %122 = OpAccessChain %_ptr_Uniform_v3float %View %int_31 + %123 = OpLoad %v3float %122 + %124 = OpAccessChain %_ptr_Uniform_v4float %View %int_66 + %125 = OpLoad %v4float %124 + %126 = OpVectorShuffle %v3float %111 %111 0 1 2 + %127 = OpVectorShuffle %v3float %112 %112 0 1 2 + %128 = OpExtInst %v3float %1 Cross %127 %126 + %129 = OpCompositeExtract %float %112 3 + %130 = OpCompositeConstruct %v3float %129 %129 %129 + %131 = OpFMul %v3float %128 %130 + %132 = OpCompositeConstruct %mat3v3float %126 %131 %127 + %133 = OpCompositeExtract %float %115 0 + %134 = OpCompositeExtract %float %115 1 + %135 = OpCompositeExtract %float %115 2 + %136 = OpCompositeConstruct %v4float %133 %134 %135 %float_1 + %137 = OpMatrixTimesVector %v4float %121 %136 + %138 = OpVectorShuffle %v3float %137 %137 0 1 2 + %139 = OpCompositeExtract %float %137 3 + %140 = OpCompositeConstruct %v3float %139 %139 %139 + %141 = OpFDiv %v3float %138 %140 + %142 = OpFSub %v3float %141 %123 + %143 = OpVectorShuffle %v3float %125 %125 0 1 2 + %144 = OpCompositeExtract %float %125 3 + %145 = OpCompositeConstruct %v3float %144 %144 %144 + %146 = OpFMul %v3float %75 %145 + %147 = OpFAdd %v3float %146 %143 + %148 = OpExtInst %v3float %1 Normalize %147 + %149 = OpMatrixTimesVector %v3float %132 %148 + %150 = OpExtInst %v3float %1 Normalize %149 + %151 = OpExtInst %float %1 Sqrt %float_12_25 + %152 = OpCompositeConstruct %v3float %151 %151 %151 + %153 = OpFDiv %v3float %105 %152 + %154 = OpDot %float %153 %150 + %155 = OpFAdd %float %float_1 %154 + %156 = OpFMul %float %155 %float_0_5 + %157 = OpFAdd %float %156 %float_0_200000003 + %158 = OpAccessChain %_ptr_Uniform_v4float %Material %int_0 %int_1 + %159 = OpLoad %v4float %158 + %160 = OpVectorShuffle %v3float %159 %159 0 1 2 + %161 = OpCompositeConstruct %v3float %157 %157 %157 + %162 = OpFMul %v3float %160 %161 + %163 = OpAccessChain %_ptr_Uniform_float %TranslucentBasePass %int_144 + %164 = OpLoad %float %163 + %165 = OpFOrdGreaterThan %bool %164 %float_0 + OpSelectionMerge %166 None + OpBranchConditional %165 %167 %166 + %167 = OpLabel + %168 = OpCompositeExtract %float %142 0 + %169 = OpCompositeExtract %float %142 1 + %170 = OpCompositeExtract %float %142 2 + %171 = OpCompositeConstruct %v4float %168 %169 %170 %float_1 + %172 = OpMatrixTimesVector %v4float %119 %171 + %173 = OpCompositeExtract %float %172 3 + %174 = OpCompositeConstruct %v2float %173 %173 + %175 = OpVectorShuffle %v2float %172 %172 0 1 + %176 = OpFDiv %v2float %175 %174 + %177 = OpVectorShuffle %v2float %176 %102 0 1 + %178 = OpFMul %v2float %177 %67 + %179 = OpFAdd %v2float %178 %61 + %180 = OpCompositeExtract %float %179 0 + %181 = OpCompositeExtract %float %179 1 + %182 = OpAccessChain %_ptr_Uniform_float %View %int_155 %int_0 + %183 = OpLoad %float %182 + %184 = OpFMul %float %173 %183 + %185 = OpAccessChain %_ptr_Uniform_float %View %int_155 %int_1 + %186 = OpLoad %float %185 + %187 = OpFAdd %float %184 %186 + %188 = OpExtInst %float %1 Log2 %187 + %189 = OpAccessChain %_ptr_Uniform_float %View %int_155 %int_2 + %190 = OpLoad %float %189 + %191 = OpFMul %float %188 %190 + %192 = OpAccessChain %_ptr_Uniform_float %View %int_153 %int_2 + %193 = OpLoad %float %192 + %194 = OpFMul %float %191 %193 + %195 = OpCompositeConstruct %v3float %180 %181 %194 + OpSelectionMerge %196 None + OpBranchConditional %165 %197 %196 + %197 = OpLabel + %198 = OpLoad %type_3d_image %TranslucentBasePass_Shared_Fog_IntegratedLightScattering + %199 = OpLoad %type_sampler %View_SharedBilinearClampedSampler + %200 = OpSampledImage %type_sampled_image %198 %199 + %201 = OpImageSampleExplicitLod %v4float %200 %195 Lod %float_0 + OpBranch %196 + %196 = OpLabel + %202 = OpPhi %v4float %68 %167 %201 %197 + %203 = OpVectorShuffle %v3float %202 %202 0 1 2 + %204 = OpVectorShuffle %v3float %114 %114 0 1 2 + %205 = OpCompositeExtract %float %202 3 + %206 = OpCompositeConstruct %v3float %205 %205 %205 + %207 = OpFMul %v3float %204 %206 + %208 = OpFAdd %v3float %203 %207 + %209 = OpCompositeExtract %float %208 0 + %210 = OpCompositeExtract %float %208 1 + %211 = OpCompositeExtract %float %208 2 + %212 = OpCompositeExtract %float %114 3 + %213 = OpFMul %float %205 %212 + %214 = OpCompositeConstruct %v4float %209 %210 %211 %213 + OpBranch %166 + %166 = OpLabel + %215 = OpPhi %v4float %114 %110 %214 %196 + %216 = OpExtInst %v3float %1 FMax %162 %48 + %217 = OpAccessChain %_ptr_Uniform_float %View %int_70 + %218 = OpLoad %float %217 + %219 = OpFOrdGreaterThan %bool %218 %float_0 + OpSelectionMerge %220 DontFlatten + OpBranchConditional %219 %221 %220 + %221 = OpLabel + %222 = OpIMul %uint %113 %uint_26 + %223 = OpIAdd %uint %222 %uint_5 + %224 = OpAccessChain %_ptr_Uniform_v4float %View_PrimitiveSceneData %int_0 %223 + %225 = OpLoad %v4float %224 + %226 = OpVectorShuffle %v3float %225 %225 0 1 2 + %227 = OpFSub %v3float %142 %226 + %228 = OpExtInst %v3float %1 FAbs %227 + %229 = OpIAdd %uint %222 %uint_19 + %230 = OpAccessChain %_ptr_Uniform_v4float %View_PrimitiveSceneData %int_0 %229 + %231 = OpLoad %v4float %230 + %232 = OpVectorShuffle %v3float %231 %231 0 1 2 + %233 = OpFAdd %v3float %232 %53 + %234 = OpFOrdGreaterThan %v3bool %228 %233 + %235 = OpAny %bool %234 + OpSelectionMerge %236 None + OpBranchConditional %235 %237 %236 + %237 = OpLabel + %238 = OpDot %float %142 %55 + %239 = OpFMul %float %238 %float_0_00200000009 + %240 = OpExtInst %float %1 Fract %239 + %241 = OpCompositeConstruct %v3float %240 %240 %240 + %242 = OpFOrdGreaterThan %v3bool %241 %59 + %243 = OpSelect %v3float %242 %53 %48 + %244 = OpExtInst %v3float %1 FMix %56 %57 %243 + OpBranch %236 + %236 = OpLabel + %245 = OpPhi %v3float %216 %221 %244 %237 + OpBranch %220 + %220 = OpLabel + %246 = OpPhi %v3float %216 %166 %245 %236 + %247 = OpCompositeExtract %float %215 3 + %248 = OpCompositeConstruct %v3float %247 %247 %247 + %249 = OpFMul %v3float %246 %248 + %250 = OpVectorShuffle %v3float %215 %215 0 1 2 + %251 = OpFAdd %v3float %249 %250 + %252 = OpCompositeExtract %float %251 0 + %253 = OpCompositeExtract %float %251 1 + %254 = OpCompositeExtract %float %251 2 + %255 = OpCompositeConstruct %v4float %252 %253 %254 %108 + %256 = OpCompositeInsert %v4float %float_1 %255 3 + %257 = OpAccessChain %_ptr_Uniform_int %View %int_60 + %258 = OpLoad %int %257 + %259 = OpSGreaterThan %bool %258 %int_1 + OpSelectionMerge %260 None + OpBranchConditional %259 %261 %262 + %262 = OpLabel + OpBranch %260 + %261 = OpLabel + %263 = OpConvertSToF %float %258 + %264 = OpFMul %float %263 %float_0_25 + %265 = OpCompositeConstruct %v4float %264 %264 %264 %264 + %266 = OpFMul %v4float %256 %265 + %267 = OpBitwiseAnd %uint %117 %uint_15 + OpBranch %260 + %260 = OpLabel + %268 = OpPhi %v4float %266 %261 %256 %262 + %269 = OpPhi %uint %267 %261 %117 %262 + OpStore %out_var_SV_Target0 %268 + %270 = OpAccessChain %_ptr_Output_uint %gl_SampleMask_0 %uint_0 + OpStore %270 %269 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..e6565873a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag @@ -0,0 +1,589 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 130 +; Schema: 0 + OpCapability Shader + OpCapability InputAttachment + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %Main "main" %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %Main OriginUpperLeft + OpSource HLSL 600 + OpName %type_subpass_image "type.subpass.image" + OpName %gl_LastFragData "gl_LastFragData" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_sampler "type.sampler" + OpName %type_2d_image "type.2d.image" + OpName %ShadowDepthTexture "ShadowDepthTexture" + OpName %ShadowDepthTextureSampler "ShadowDepthTextureSampler" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "SoftTransitionScale" + OpMemberName %type__Globals 1 "ShadowBufferSize" + OpMemberName %type__Globals 2 "ShadowFadeFraction" + OpMemberName %type__Globals 3 "ShadowSharpen" + OpMemberName %type__Globals 4 "LightPositionAndInvRadius" + OpMemberName %type__Globals 5 "ScreenToShadowMatrix" + OpMemberName %type__Globals 6 "ProjectionDepthBiasParameters" + OpMemberName %type__Globals 7 "ModulatedShadowColor" + OpMemberName %type__Globals 8 "ShadowTileOffsetAndSize" + OpName %_Globals "$Globals" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %Main "Main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_LastFragData InputAttachmentIndex 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %gl_LastFragData DescriptorSet 0 + OpDecorate %gl_LastFragData Binding 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %ShadowDepthTexture DescriptorSet 0 + OpDecorate %ShadowDepthTexture Binding 0 + OpDecorate %ShadowDepthTextureSampler DescriptorSet 0 + OpDecorate %ShadowDepthTextureSampler Binding 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 36 + OpMemberDecorate %type__Globals 4 Offset 48 + OpMemberDecorate %type__Globals 5 Offset 64 + OpMemberDecorate %type__Globals 5 MatrixStride 16 + OpMemberDecorate %type__Globals 5 ColMajor + OpMemberDecorate %type__Globals 6 Offset 128 + OpMemberDecorate %type__Globals 7 Offset 144 + OpMemberDecorate %type__Globals 8 Offset 160 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %float_1 = OpConstant %float 1 + %int_58 = OpConstant %int 58 + %int_24 = OpConstant %int 24 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_8 = OpConstant %int 8 +%float_0_999989986 = OpConstant %float 0.999989986 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %int_7 = OpConstant %int 7 + %float_0_5 = OpConstant %float 0.5 + %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v2int = OpTypeVector %int 2 + %43 = OpConstantComposite %v2int %int_0 %int_0 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0 +%type_subpass_image = OpTypeImage %float SubpassData 2 0 0 2 Unknown +%_ptr_UniformConstant_type_subpass_image = OpTypePointer UniformConstant %type_subpass_image +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type__Globals = OpTypeStruct %v3float %v4float %float %float %v4float %mat4v4float %v2float %v4float %v4float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %53 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_2d_image +%gl_LastFragData = OpVariable %_ptr_UniformConstant_type_subpass_image UniformConstant + %View = OpVariable %_ptr_Uniform_type_View Uniform +%ShadowDepthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%ShadowDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %57 = OpConstantNull %v4float + %58 = OpUndef %v4float + %Main = OpFunction %void None %53 + %59 = OpLabel + %60 = OpLoad %v4float %gl_FragCoord + %61 = OpVectorShuffle %v2float %60 %60 0 1 + %62 = OpAccessChain %_ptr_Uniform_v4float %View %int_58 + %63 = OpLoad %v4float %62 + %64 = OpVectorShuffle %v2float %63 %63 2 3 + %65 = OpFMul %v2float %61 %64 + %66 = OpLoad %type_subpass_image %gl_LastFragData + %67 = OpImageRead %v4float %66 %43 None + %68 = OpCompositeExtract %float %67 3 + %69 = OpAccessChain %_ptr_Uniform_v4float %View %int_24 + %70 = OpLoad %v4float %69 + %71 = OpVectorShuffle %v2float %70 %70 3 2 + %72 = OpFSub %v2float %65 %71 + %73 = OpVectorShuffle %v2float %70 %70 0 1 + %74 = OpFDiv %v2float %72 %73 + %75 = OpCompositeConstruct %v2float %68 %68 + %76 = OpFMul %v2float %74 %75 + %77 = OpCompositeExtract %float %76 0 + %78 = OpCompositeExtract %float %76 1 + %79 = OpCompositeConstruct %v4float %77 %78 %68 %float_1 + %80 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_5 + %81 = OpLoad %mat4v4float %80 + %82 = OpMatrixTimesVector %v4float %81 %79 + %83 = OpCompositeExtract %float %82 2 + %84 = OpCompositeExtract %float %82 3 + %85 = OpCompositeConstruct %v3float %84 %84 %84 + %86 = OpVectorShuffle %v3float %82 %82 0 1 2 + %87 = OpFDiv %v3float %86 %85 + %88 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8 + %89 = OpLoad %v4float %88 + %90 = OpVectorShuffle %v2float %89 %89 2 3 + %91 = OpVectorShuffle %v2float %87 %57 0 1 + %92 = OpFMul %v2float %91 %90 + %93 = OpVectorShuffle %v2float %89 %89 0 1 + %94 = OpVectorShuffle %v2float %92 %57 0 1 + %95 = OpFAdd %v2float %94 %93 + %96 = OpExtInst %float %1 FMin %83 %float_0_999989986 + %97 = OpLoad %type_2d_image %ShadowDepthTexture + %98 = OpLoad %type_sampler %ShadowDepthTextureSampler + %99 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %100 = OpLoad %float %99 + %101 = OpVectorShuffle %v2float %95 %57 0 1 + %102 = OpSampledImage %type_sampled_image %97 %98 + %103 = OpImageSampleExplicitLod %v4float %102 %101 Lod %float_0 + %104 = OpVectorShuffle %v3float %103 %103 0 0 0 + %105 = OpFMul %float %96 %100 + %106 = OpFSub %float %105 %float_1 + %107 = OpCompositeConstruct %v3float %100 %100 %100 + %108 = OpFMul %v3float %104 %107 + %109 = OpCompositeConstruct %v3float %106 %106 %106 + %110 = OpFSub %v3float %108 %109 + %111 = OpExtInst %v3float %1 FClamp %110 %44 %41 + %112 = OpCompositeExtract %float %111 0 + %113 = OpFSub %float %112 %float_0_5 + %114 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3 + %115 = OpLoad %float %114 + %116 = OpFMul %float %113 %115 + %117 = OpFAdd %float %116 %float_0_5 + %118 = OpExtInst %float %1 FClamp %117 %float_0 %float_1 + %119 = OpFMul %float %118 %118 + %120 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 + %121 = OpLoad %float %120 + %122 = OpExtInst %float %1 FMix %float_1 %119 %121 + %123 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %124 = OpLoad %v4float %123 + %125 = OpVectorShuffle %v3float %124 %124 0 1 2 + %126 = OpCompositeConstruct %v3float %122 %122 %122 + %127 = OpExtInst %v3float %1 FMix %125 %41 %126 + %128 = OpVectorShuffle %v4float %58 %127 4 5 6 3 + %129 = OpCompositeInsert %v4float %float_0 %128 3 + OpStore %out_var_SV_Target0 %129 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag new file mode 100644 index 0000000000..e6565873a0 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/subpass-input.msl23.framebuffer-fetch.asm.frag @@ -0,0 +1,589 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 130 +; Schema: 0 + OpCapability Shader + OpCapability InputAttachment + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %Main "main" %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %Main OriginUpperLeft + OpSource HLSL 600 + OpName %type_subpass_image "type.subpass.image" + OpName %gl_LastFragData "gl_LastFragData" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_sampler "type.sampler" + OpName %type_2d_image "type.2d.image" + OpName %ShadowDepthTexture "ShadowDepthTexture" + OpName %ShadowDepthTextureSampler "ShadowDepthTextureSampler" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "SoftTransitionScale" + OpMemberName %type__Globals 1 "ShadowBufferSize" + OpMemberName %type__Globals 2 "ShadowFadeFraction" + OpMemberName %type__Globals 3 "ShadowSharpen" + OpMemberName %type__Globals 4 "LightPositionAndInvRadius" + OpMemberName %type__Globals 5 "ScreenToShadowMatrix" + OpMemberName %type__Globals 6 "ProjectionDepthBiasParameters" + OpMemberName %type__Globals 7 "ModulatedShadowColor" + OpMemberName %type__Globals 8 "ShadowTileOffsetAndSize" + OpName %_Globals "$Globals" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %Main "Main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_LastFragData InputAttachmentIndex 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %gl_LastFragData DescriptorSet 0 + OpDecorate %gl_LastFragData Binding 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %ShadowDepthTexture DescriptorSet 0 + OpDecorate %ShadowDepthTexture Binding 0 + OpDecorate %ShadowDepthTextureSampler DescriptorSet 0 + OpDecorate %ShadowDepthTextureSampler Binding 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 36 + OpMemberDecorate %type__Globals 4 Offset 48 + OpMemberDecorate %type__Globals 5 Offset 64 + OpMemberDecorate %type__Globals 5 MatrixStride 16 + OpMemberDecorate %type__Globals 5 ColMajor + OpMemberDecorate %type__Globals 6 Offset 128 + OpMemberDecorate %type__Globals 7 Offset 144 + OpMemberDecorate %type__Globals 8 Offset 160 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %float_1 = OpConstant %float 1 + %int_58 = OpConstant %int 58 + %int_24 = OpConstant %int 24 + %int_5 = OpConstant %int 5 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_8 = OpConstant %int 8 +%float_0_999989986 = OpConstant %float 0.999989986 + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %int_7 = OpConstant %int 7 + %float_0_5 = OpConstant %float 0.5 + %41 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %v2int = OpTypeVector %int 2 + %43 = OpConstantComposite %v2int %int_0 %int_0 + %44 = OpConstantComposite %v3float %float_0 %float_0 %float_0 +%type_subpass_image = OpTypeImage %float SubpassData 2 0 0 2 Unknown +%_ptr_UniformConstant_type_subpass_image = OpTypePointer UniformConstant %type_subpass_image +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type__Globals = OpTypeStruct %v3float %v4float %float %float %v4float %mat4v4float %v2float %v4float %v4float +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %53 = OpTypeFunction %void +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%type_sampled_image = OpTypeSampledImage %type_2d_image +%gl_LastFragData = OpVariable %_ptr_UniformConstant_type_subpass_image UniformConstant + %View = OpVariable %_ptr_Uniform_type_View Uniform +%ShadowDepthTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%ShadowDepthTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %57 = OpConstantNull %v4float + %58 = OpUndef %v4float + %Main = OpFunction %void None %53 + %59 = OpLabel + %60 = OpLoad %v4float %gl_FragCoord + %61 = OpVectorShuffle %v2float %60 %60 0 1 + %62 = OpAccessChain %_ptr_Uniform_v4float %View %int_58 + %63 = OpLoad %v4float %62 + %64 = OpVectorShuffle %v2float %63 %63 2 3 + %65 = OpFMul %v2float %61 %64 + %66 = OpLoad %type_subpass_image %gl_LastFragData + %67 = OpImageRead %v4float %66 %43 None + %68 = OpCompositeExtract %float %67 3 + %69 = OpAccessChain %_ptr_Uniform_v4float %View %int_24 + %70 = OpLoad %v4float %69 + %71 = OpVectorShuffle %v2float %70 %70 3 2 + %72 = OpFSub %v2float %65 %71 + %73 = OpVectorShuffle %v2float %70 %70 0 1 + %74 = OpFDiv %v2float %72 %73 + %75 = OpCompositeConstruct %v2float %68 %68 + %76 = OpFMul %v2float %74 %75 + %77 = OpCompositeExtract %float %76 0 + %78 = OpCompositeExtract %float %76 1 + %79 = OpCompositeConstruct %v4float %77 %78 %68 %float_1 + %80 = OpAccessChain %_ptr_Uniform_mat4v4float %_Globals %int_5 + %81 = OpLoad %mat4v4float %80 + %82 = OpMatrixTimesVector %v4float %81 %79 + %83 = OpCompositeExtract %float %82 2 + %84 = OpCompositeExtract %float %82 3 + %85 = OpCompositeConstruct %v3float %84 %84 %84 + %86 = OpVectorShuffle %v3float %82 %82 0 1 2 + %87 = OpFDiv %v3float %86 %85 + %88 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_8 + %89 = OpLoad %v4float %88 + %90 = OpVectorShuffle %v2float %89 %89 2 3 + %91 = OpVectorShuffle %v2float %87 %57 0 1 + %92 = OpFMul %v2float %91 %90 + %93 = OpVectorShuffle %v2float %89 %89 0 1 + %94 = OpVectorShuffle %v2float %92 %57 0 1 + %95 = OpFAdd %v2float %94 %93 + %96 = OpExtInst %float %1 FMin %83 %float_0_999989986 + %97 = OpLoad %type_2d_image %ShadowDepthTexture + %98 = OpLoad %type_sampler %ShadowDepthTextureSampler + %99 = OpAccessChain %_ptr_Uniform_float %_Globals %int_0 %int_2 + %100 = OpLoad %float %99 + %101 = OpVectorShuffle %v2float %95 %57 0 1 + %102 = OpSampledImage %type_sampled_image %97 %98 + %103 = OpImageSampleExplicitLod %v4float %102 %101 Lod %float_0 + %104 = OpVectorShuffle %v3float %103 %103 0 0 0 + %105 = OpFMul %float %96 %100 + %106 = OpFSub %float %105 %float_1 + %107 = OpCompositeConstruct %v3float %100 %100 %100 + %108 = OpFMul %v3float %104 %107 + %109 = OpCompositeConstruct %v3float %106 %106 %106 + %110 = OpFSub %v3float %108 %109 + %111 = OpExtInst %v3float %1 FClamp %110 %44 %41 + %112 = OpCompositeExtract %float %111 0 + %113 = OpFSub %float %112 %float_0_5 + %114 = OpAccessChain %_ptr_Uniform_float %_Globals %int_3 + %115 = OpLoad %float %114 + %116 = OpFMul %float %113 %115 + %117 = OpFAdd %float %116 %float_0_5 + %118 = OpExtInst %float %1 FClamp %117 %float_0 %float_1 + %119 = OpFMul %float %118 %118 + %120 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 + %121 = OpLoad %float %120 + %122 = OpExtInst %float %1 FMix %float_1 %119 %121 + %123 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_7 + %124 = OpLoad %v4float %123 + %125 = OpVectorShuffle %v3float %124 %124 0 1 2 + %126 = OpCompositeConstruct %v3float %122 %122 %122 + %127 = OpExtInst %v3float %1 FMix %125 %41 %126 + %128 = OpVectorShuffle %v4float %58 %127 4 5 6 3 + %129 = OpCompositeInsert %v4float %float_0 %128 3 + OpStore %out_var_SV_Target0 %129 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag new file mode 100644 index 0000000000..270a1978fc --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.argument.msl2.frag @@ -0,0 +1,242 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 180 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %ShadowObjectCullPS "main" %in_var_TEXCOORD0 %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %ShadowObjectCullPS OriginUpperLeft + OpSource HLSL 600 + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %CulledObjectBoxBounds "CulledObjectBoxBounds" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "ShadowTileListGroupSize" + OpName %_Globals "$Globals" + OpName %type_buffer_image "type.buffer.image" + OpName %RWShadowTileNumCulledObjects "RWShadowTileNumCulledObjects" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %ShadowObjectCullPS "ShadowObjectCullPS" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %CulledObjectBoxBounds DescriptorSet 0 + OpDecorate %CulledObjectBoxBounds Binding 1 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 2 + OpDecorate %RWShadowTileNumCulledObjects DescriptorSet 0 + OpDecorate %RWShadowTileNumCulledObjects Binding 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + OpMemberDecorate %type__Globals 0 Offset 0 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v2float %float_2 %float_2 + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v2float %float_1 %float_1 +%float_n1000 = OpConstant %float -1000 + %int_2 = OpConstant %int 2 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 +%float_500000 = OpConstant %float 500000 + %35 = OpConstantComposite %v3float %float_500000 %float_500000 %float_500000 +%float_n500000 = OpConstant %float -500000 + %37 = OpConstantComposite %v3float %float_n500000 %float_n500000 %float_n500000 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %44 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_n1 = OpConstant %float -1 + %46 = OpConstantComposite %v3float %float_n1 %float_n1 %float_n1 + %uint_5 = OpConstant %uint 5 + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float + %v2uint = OpTypeVector %uint 2 +%type__Globals = OpTypeStruct %v2uint +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_buffer_image = OpTypeImage %uint Buffer 2 0 0 2 R32ui +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %58 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint_8 = OpConstant %uint 8 +%_arr_v3float_uint_8 = OpTypeArray %v3float %uint_8 +%_ptr_Function__arr_v3float_uint_8 = OpTypePointer Function %_arr_v3float_uint_8 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Image_uint = OpTypePointer Image %uint +%CulledObjectBoxBounds = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%RWShadowTileNumCulledObjects = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_uint Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %70 = OpUndef %v3float + %71 = OpConstantNull %v3float +%ShadowObjectCullPS = OpFunction %void None %58 + %72 = OpLabel + %73 = OpVariable %_ptr_Function__arr_v3float_uint_8 Function + %74 = OpLoad %uint %in_var_TEXCOORD0 + %75 = OpLoad %v4float %gl_FragCoord + %76 = OpVectorShuffle %v2float %75 %75 0 1 + %77 = OpConvertFToU %v2uint %76 + %78 = OpCompositeExtract %uint %77 1 + %79 = OpAccessChain %_ptr_Uniform_v2uint %_Globals %int_0 + %80 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_0 + %81 = OpLoad %uint %80 + %82 = OpIMul %uint %78 %81 + %83 = OpCompositeExtract %uint %77 0 + %84 = OpIAdd %uint %82 %83 + %85 = OpConvertUToF %float %83 + %86 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_1 + %87 = OpLoad %uint %86 + %88 = OpISub %uint %87 %uint_1 + %89 = OpISub %uint %88 %78 + %90 = OpConvertUToF %float %89 + %91 = OpCompositeConstruct %v2float %85 %90 + %92 = OpLoad %v2uint %79 + %93 = OpConvertUToF %v2float %92 + %94 = OpFDiv %v2float %91 %93 + %95 = OpFMul %v2float %94 %27 + %96 = OpFSub %v2float %95 %29 + %97 = OpFAdd %v2float %91 %29 + %98 = OpFDiv %v2float %97 %93 + %99 = OpFMul %v2float %98 %27 + %100 = OpFSub %v2float %99 %29 + %101 = OpVectorShuffle %v3float %70 %100 3 4 2 + %102 = OpCompositeInsert %v3float %float_1 %101 2 + %103 = OpIMul %uint %74 %uint_5 + %104 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %103 + %105 = OpLoad %v4float %104 + %106 = OpVectorShuffle %v3float %105 %105 0 1 2 + %107 = OpIAdd %uint %103 %uint_1 + %108 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %107 + %109 = OpLoad %v4float %108 + %110 = OpVectorShuffle %v3float %109 %109 0 1 2 + %111 = OpVectorShuffle %v2float %109 %71 0 1 + %112 = OpVectorShuffle %v2float %96 %71 0 1 + %113 = OpFOrdGreaterThan %v2bool %111 %112 + %114 = OpAll %bool %113 + %115 = OpFOrdLessThan %v3bool %106 %102 + %116 = OpAll %bool %115 + %117 = OpLogicalAnd %bool %114 %116 + OpSelectionMerge %118 DontFlatten + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpFAdd %v3float %106 %110 + %121 = OpFMul %v3float %33 %120 + %122 = OpCompositeExtract %float %96 0 + %123 = OpCompositeExtract %float %96 1 + %124 = OpCompositeConstruct %v3float %122 %123 %float_n1000 + %125 = OpAccessChain %_ptr_Function_v3float %73 %int_0 + OpStore %125 %124 + %126 = OpCompositeExtract %float %100 0 + %127 = OpCompositeConstruct %v3float %126 %123 %float_n1000 + %128 = OpAccessChain %_ptr_Function_v3float %73 %int_1 + OpStore %128 %127 + %129 = OpCompositeExtract %float %100 1 + %130 = OpCompositeConstruct %v3float %122 %129 %float_n1000 + %131 = OpAccessChain %_ptr_Function_v3float %73 %int_2 + OpStore %131 %130 + %132 = OpCompositeConstruct %v3float %126 %129 %float_n1000 + %133 = OpAccessChain %_ptr_Function_v3float %73 %int_3 + OpStore %133 %132 + %134 = OpCompositeConstruct %v3float %122 %123 %float_1 + %135 = OpAccessChain %_ptr_Function_v3float %73 %int_4 + OpStore %135 %134 + %136 = OpCompositeConstruct %v3float %126 %123 %float_1 + %137 = OpAccessChain %_ptr_Function_v3float %73 %int_5 + OpStore %137 %136 + %138 = OpCompositeConstruct %v3float %122 %129 %float_1 + %139 = OpAccessChain %_ptr_Function_v3float %73 %int_6 + OpStore %139 %138 + %140 = OpCompositeConstruct %v3float %126 %129 %float_1 + %141 = OpAccessChain %_ptr_Function_v3float %73 %int_7 + OpStore %141 %140 + %142 = OpIAdd %uint %103 %uint_2 + %143 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %142 + %144 = OpLoad %v4float %143 + %145 = OpVectorShuffle %v3float %144 %144 0 1 2 + %146 = OpIAdd %uint %103 %uint_3 + %147 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %146 + %148 = OpLoad %v4float %147 + %149 = OpVectorShuffle %v3float %148 %148 0 1 2 + %150 = OpIAdd %uint %103 %uint_4 + %151 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %150 + %152 = OpLoad %v4float %151 + %153 = OpVectorShuffle %v3float %152 %152 0 1 2 + OpBranch %154 + %154 = OpLabel + %155 = OpPhi %v3float %37 %119 %156 %157 + %158 = OpPhi %v3float %35 %119 %159 %157 + %160 = OpPhi %int %int_0 %119 %161 %157 + %162 = OpSLessThan %bool %160 %int_8 + OpLoopMerge %163 %157 Unroll + OpBranchConditional %162 %157 %163 + %157 = OpLabel + %164 = OpAccessChain %_ptr_Function_v3float %73 %160 + %165 = OpLoad %v3float %164 + %166 = OpFSub %v3float %165 %121 + %167 = OpDot %float %166 %145 + %168 = OpDot %float %166 %149 + %169 = OpDot %float %166 %153 + %170 = OpCompositeConstruct %v3float %167 %168 %169 + %159 = OpExtInst %v3float %1 FMin %158 %170 + %156 = OpExtInst %v3float %1 FMax %155 %170 + %161 = OpIAdd %int %160 %int_1 + OpBranch %154 + %163 = OpLabel + %171 = OpFOrdLessThan %v3bool %158 %44 + %172 = OpAll %bool %171 + %173 = OpFOrdGreaterThan %v3bool %155 %46 + %174 = OpAll %bool %173 + %175 = OpLogicalAnd %bool %172 %174 + OpSelectionMerge %176 DontFlatten + OpBranchConditional %175 %177 %176 + %177 = OpLabel + %178 = OpImageTexelPointer %_ptr_Image_uint %RWShadowTileNumCulledObjects %84 %uint_0 + %179 = OpAtomicIAdd %uint %178 %uint_1 %uint_0 %uint_1 + OpBranch %176 + %176 = OpLabel + OpBranch %118 + %118 = OpLabel + OpStore %out_var_SV_Target0 %22 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.frag new file mode 100644 index 0000000000..270a1978fc --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.frag @@ -0,0 +1,242 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 180 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %ShadowObjectCullPS "main" %in_var_TEXCOORD0 %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %ShadowObjectCullPS OriginUpperLeft + OpSource HLSL 600 + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %CulledObjectBoxBounds "CulledObjectBoxBounds" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "ShadowTileListGroupSize" + OpName %_Globals "$Globals" + OpName %type_buffer_image "type.buffer.image" + OpName %RWShadowTileNumCulledObjects "RWShadowTileNumCulledObjects" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %ShadowObjectCullPS "ShadowObjectCullPS" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %CulledObjectBoxBounds DescriptorSet 0 + OpDecorate %CulledObjectBoxBounds Binding 1 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 2 + OpDecorate %RWShadowTileNumCulledObjects DescriptorSet 0 + OpDecorate %RWShadowTileNumCulledObjects Binding 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + OpMemberDecorate %type__Globals 0 Offset 0 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v2float %float_2 %float_2 + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v2float %float_1 %float_1 +%float_n1000 = OpConstant %float -1000 + %int_2 = OpConstant %int 2 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 +%float_500000 = OpConstant %float 500000 + %35 = OpConstantComposite %v3float %float_500000 %float_500000 %float_500000 +%float_n500000 = OpConstant %float -500000 + %37 = OpConstantComposite %v3float %float_n500000 %float_n500000 %float_n500000 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %44 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_n1 = OpConstant %float -1 + %46 = OpConstantComposite %v3float %float_n1 %float_n1 %float_n1 + %uint_5 = OpConstant %uint 5 + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float + %v2uint = OpTypeVector %uint 2 +%type__Globals = OpTypeStruct %v2uint +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_buffer_image = OpTypeImage %uint Buffer 2 0 0 2 R32ui +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %58 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint_8 = OpConstant %uint 8 +%_arr_v3float_uint_8 = OpTypeArray %v3float %uint_8 +%_ptr_Function__arr_v3float_uint_8 = OpTypePointer Function %_arr_v3float_uint_8 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Image_uint = OpTypePointer Image %uint +%CulledObjectBoxBounds = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%RWShadowTileNumCulledObjects = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_uint Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %70 = OpUndef %v3float + %71 = OpConstantNull %v3float +%ShadowObjectCullPS = OpFunction %void None %58 + %72 = OpLabel + %73 = OpVariable %_ptr_Function__arr_v3float_uint_8 Function + %74 = OpLoad %uint %in_var_TEXCOORD0 + %75 = OpLoad %v4float %gl_FragCoord + %76 = OpVectorShuffle %v2float %75 %75 0 1 + %77 = OpConvertFToU %v2uint %76 + %78 = OpCompositeExtract %uint %77 1 + %79 = OpAccessChain %_ptr_Uniform_v2uint %_Globals %int_0 + %80 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_0 + %81 = OpLoad %uint %80 + %82 = OpIMul %uint %78 %81 + %83 = OpCompositeExtract %uint %77 0 + %84 = OpIAdd %uint %82 %83 + %85 = OpConvertUToF %float %83 + %86 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_1 + %87 = OpLoad %uint %86 + %88 = OpISub %uint %87 %uint_1 + %89 = OpISub %uint %88 %78 + %90 = OpConvertUToF %float %89 + %91 = OpCompositeConstruct %v2float %85 %90 + %92 = OpLoad %v2uint %79 + %93 = OpConvertUToF %v2float %92 + %94 = OpFDiv %v2float %91 %93 + %95 = OpFMul %v2float %94 %27 + %96 = OpFSub %v2float %95 %29 + %97 = OpFAdd %v2float %91 %29 + %98 = OpFDiv %v2float %97 %93 + %99 = OpFMul %v2float %98 %27 + %100 = OpFSub %v2float %99 %29 + %101 = OpVectorShuffle %v3float %70 %100 3 4 2 + %102 = OpCompositeInsert %v3float %float_1 %101 2 + %103 = OpIMul %uint %74 %uint_5 + %104 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %103 + %105 = OpLoad %v4float %104 + %106 = OpVectorShuffle %v3float %105 %105 0 1 2 + %107 = OpIAdd %uint %103 %uint_1 + %108 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %107 + %109 = OpLoad %v4float %108 + %110 = OpVectorShuffle %v3float %109 %109 0 1 2 + %111 = OpVectorShuffle %v2float %109 %71 0 1 + %112 = OpVectorShuffle %v2float %96 %71 0 1 + %113 = OpFOrdGreaterThan %v2bool %111 %112 + %114 = OpAll %bool %113 + %115 = OpFOrdLessThan %v3bool %106 %102 + %116 = OpAll %bool %115 + %117 = OpLogicalAnd %bool %114 %116 + OpSelectionMerge %118 DontFlatten + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpFAdd %v3float %106 %110 + %121 = OpFMul %v3float %33 %120 + %122 = OpCompositeExtract %float %96 0 + %123 = OpCompositeExtract %float %96 1 + %124 = OpCompositeConstruct %v3float %122 %123 %float_n1000 + %125 = OpAccessChain %_ptr_Function_v3float %73 %int_0 + OpStore %125 %124 + %126 = OpCompositeExtract %float %100 0 + %127 = OpCompositeConstruct %v3float %126 %123 %float_n1000 + %128 = OpAccessChain %_ptr_Function_v3float %73 %int_1 + OpStore %128 %127 + %129 = OpCompositeExtract %float %100 1 + %130 = OpCompositeConstruct %v3float %122 %129 %float_n1000 + %131 = OpAccessChain %_ptr_Function_v3float %73 %int_2 + OpStore %131 %130 + %132 = OpCompositeConstruct %v3float %126 %129 %float_n1000 + %133 = OpAccessChain %_ptr_Function_v3float %73 %int_3 + OpStore %133 %132 + %134 = OpCompositeConstruct %v3float %122 %123 %float_1 + %135 = OpAccessChain %_ptr_Function_v3float %73 %int_4 + OpStore %135 %134 + %136 = OpCompositeConstruct %v3float %126 %123 %float_1 + %137 = OpAccessChain %_ptr_Function_v3float %73 %int_5 + OpStore %137 %136 + %138 = OpCompositeConstruct %v3float %122 %129 %float_1 + %139 = OpAccessChain %_ptr_Function_v3float %73 %int_6 + OpStore %139 %138 + %140 = OpCompositeConstruct %v3float %126 %129 %float_1 + %141 = OpAccessChain %_ptr_Function_v3float %73 %int_7 + OpStore %141 %140 + %142 = OpIAdd %uint %103 %uint_2 + %143 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %142 + %144 = OpLoad %v4float %143 + %145 = OpVectorShuffle %v3float %144 %144 0 1 2 + %146 = OpIAdd %uint %103 %uint_3 + %147 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %146 + %148 = OpLoad %v4float %147 + %149 = OpVectorShuffle %v3float %148 %148 0 1 2 + %150 = OpIAdd %uint %103 %uint_4 + %151 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %150 + %152 = OpLoad %v4float %151 + %153 = OpVectorShuffle %v3float %152 %152 0 1 2 + OpBranch %154 + %154 = OpLabel + %155 = OpPhi %v3float %37 %119 %156 %157 + %158 = OpPhi %v3float %35 %119 %159 %157 + %160 = OpPhi %int %int_0 %119 %161 %157 + %162 = OpSLessThan %bool %160 %int_8 + OpLoopMerge %163 %157 Unroll + OpBranchConditional %162 %157 %163 + %157 = OpLabel + %164 = OpAccessChain %_ptr_Function_v3float %73 %160 + %165 = OpLoad %v3float %164 + %166 = OpFSub %v3float %165 %121 + %167 = OpDot %float %166 %145 + %168 = OpDot %float %166 %149 + %169 = OpDot %float %166 %153 + %170 = OpCompositeConstruct %v3float %167 %168 %169 + %159 = OpExtInst %v3float %1 FMin %158 %170 + %156 = OpExtInst %v3float %1 FMax %155 %170 + %161 = OpIAdd %int %160 %int_1 + OpBranch %154 + %163 = OpLabel + %171 = OpFOrdLessThan %v3bool %158 %44 + %172 = OpAll %bool %171 + %173 = OpFOrdGreaterThan %v3bool %155 %46 + %174 = OpAll %bool %173 + %175 = OpLogicalAnd %bool %172 %174 + OpSelectionMerge %176 DontFlatten + OpBranchConditional %175 %177 %176 + %177 = OpLabel + %178 = OpImageTexelPointer %_ptr_Image_uint %RWShadowTileNumCulledObjects %84 %uint_0 + %179 = OpAtomicIAdd %uint %178 %uint_1 %uint_0 %uint_1 + OpBranch %176 + %176 = OpLabel + OpBranch %118 + %118 = OpLabel + OpStore %out_var_SV_Target0 %22 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag new file mode 100644 index 0000000000..270a1978fc --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag @@ -0,0 +1,242 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 180 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %ShadowObjectCullPS "main" %in_var_TEXCOORD0 %gl_FragCoord %out_var_SV_Target0 + OpExecutionMode %ShadowObjectCullPS OriginUpperLeft + OpSource HLSL 600 + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %CulledObjectBoxBounds "CulledObjectBoxBounds" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "ShadowTileListGroupSize" + OpName %_Globals "$Globals" + OpName %type_buffer_image "type.buffer.image" + OpName %RWShadowTileNumCulledObjects "RWShadowTileNumCulledObjects" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target0 "out.var.SV_Target0" + OpName %ShadowObjectCullPS "ShadowObjectCullPS" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorate %in_var_TEXCOORD0 Flat + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorateString %gl_FragCoord UserSemantic "SV_POSITION" + OpDecorateString %out_var_SV_Target0 UserSemantic "SV_Target0" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target0 Location 0 + OpDecorate %CulledObjectBoxBounds DescriptorSet 0 + OpDecorate %CulledObjectBoxBounds Binding 1 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 2 + OpDecorate %RWShadowTileNumCulledObjects DescriptorSet 0 + OpDecorate %RWShadowTileNumCulledObjects Binding 0 + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + OpMemberDecorate %type__Globals 0 Offset 0 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %float_0 = OpConstant %float 0 + %22 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 + %float_2 = OpConstant %float 2 + %27 = OpConstantComposite %v2float %float_2 %float_2 + %float_1 = OpConstant %float 1 + %29 = OpConstantComposite %v2float %float_1 %float_1 +%float_n1000 = OpConstant %float -1000 + %int_2 = OpConstant %int 2 + %float_0_5 = OpConstant %float 0.5 + %33 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 +%float_500000 = OpConstant %float 500000 + %35 = OpConstantComposite %v3float %float_500000 %float_500000 %float_500000 +%float_n500000 = OpConstant %float -500000 + %37 = OpConstantComposite %v3float %float_n500000 %float_n500000 %float_n500000 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %int_5 = OpConstant %int 5 + %int_6 = OpConstant %int 6 + %int_7 = OpConstant %int 7 + %int_8 = OpConstant %int 8 + %44 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_n1 = OpConstant %float -1 + %46 = OpConstantComposite %v3float %float_n1 %float_n1 %float_n1 + %uint_5 = OpConstant %uint 5 + %uint_0 = OpConstant %uint 0 + %uint_3 = OpConstant %uint 3 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float + %v2uint = OpTypeVector %uint 2 +%type__Globals = OpTypeStruct %v2uint +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_buffer_image = OpTypeImage %uint Buffer 2 0 0 2 R32ui +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %58 = OpTypeFunction %void +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint_8 = OpConstant %uint 8 +%_arr_v3float_uint_8 = OpTypeArray %v3float %uint_8 +%_ptr_Function__arr_v3float_uint_8 = OpTypePointer Function %_arr_v3float_uint_8 +%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %bool = OpTypeBool + %v2bool = OpTypeVector %bool 2 + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Image_uint = OpTypePointer Image %uint +%CulledObjectBoxBounds = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%RWShadowTileNumCulledObjects = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_uint Input +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%out_var_SV_Target0 = OpVariable %_ptr_Output_v4float Output + %70 = OpUndef %v3float + %71 = OpConstantNull %v3float +%ShadowObjectCullPS = OpFunction %void None %58 + %72 = OpLabel + %73 = OpVariable %_ptr_Function__arr_v3float_uint_8 Function + %74 = OpLoad %uint %in_var_TEXCOORD0 + %75 = OpLoad %v4float %gl_FragCoord + %76 = OpVectorShuffle %v2float %75 %75 0 1 + %77 = OpConvertFToU %v2uint %76 + %78 = OpCompositeExtract %uint %77 1 + %79 = OpAccessChain %_ptr_Uniform_v2uint %_Globals %int_0 + %80 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_0 + %81 = OpLoad %uint %80 + %82 = OpIMul %uint %78 %81 + %83 = OpCompositeExtract %uint %77 0 + %84 = OpIAdd %uint %82 %83 + %85 = OpConvertUToF %float %83 + %86 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 %int_1 + %87 = OpLoad %uint %86 + %88 = OpISub %uint %87 %uint_1 + %89 = OpISub %uint %88 %78 + %90 = OpConvertUToF %float %89 + %91 = OpCompositeConstruct %v2float %85 %90 + %92 = OpLoad %v2uint %79 + %93 = OpConvertUToF %v2float %92 + %94 = OpFDiv %v2float %91 %93 + %95 = OpFMul %v2float %94 %27 + %96 = OpFSub %v2float %95 %29 + %97 = OpFAdd %v2float %91 %29 + %98 = OpFDiv %v2float %97 %93 + %99 = OpFMul %v2float %98 %27 + %100 = OpFSub %v2float %99 %29 + %101 = OpVectorShuffle %v3float %70 %100 3 4 2 + %102 = OpCompositeInsert %v3float %float_1 %101 2 + %103 = OpIMul %uint %74 %uint_5 + %104 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %103 + %105 = OpLoad %v4float %104 + %106 = OpVectorShuffle %v3float %105 %105 0 1 2 + %107 = OpIAdd %uint %103 %uint_1 + %108 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %107 + %109 = OpLoad %v4float %108 + %110 = OpVectorShuffle %v3float %109 %109 0 1 2 + %111 = OpVectorShuffle %v2float %109 %71 0 1 + %112 = OpVectorShuffle %v2float %96 %71 0 1 + %113 = OpFOrdGreaterThan %v2bool %111 %112 + %114 = OpAll %bool %113 + %115 = OpFOrdLessThan %v3bool %106 %102 + %116 = OpAll %bool %115 + %117 = OpLogicalAnd %bool %114 %116 + OpSelectionMerge %118 DontFlatten + OpBranchConditional %117 %119 %118 + %119 = OpLabel + %120 = OpFAdd %v3float %106 %110 + %121 = OpFMul %v3float %33 %120 + %122 = OpCompositeExtract %float %96 0 + %123 = OpCompositeExtract %float %96 1 + %124 = OpCompositeConstruct %v3float %122 %123 %float_n1000 + %125 = OpAccessChain %_ptr_Function_v3float %73 %int_0 + OpStore %125 %124 + %126 = OpCompositeExtract %float %100 0 + %127 = OpCompositeConstruct %v3float %126 %123 %float_n1000 + %128 = OpAccessChain %_ptr_Function_v3float %73 %int_1 + OpStore %128 %127 + %129 = OpCompositeExtract %float %100 1 + %130 = OpCompositeConstruct %v3float %122 %129 %float_n1000 + %131 = OpAccessChain %_ptr_Function_v3float %73 %int_2 + OpStore %131 %130 + %132 = OpCompositeConstruct %v3float %126 %129 %float_n1000 + %133 = OpAccessChain %_ptr_Function_v3float %73 %int_3 + OpStore %133 %132 + %134 = OpCompositeConstruct %v3float %122 %123 %float_1 + %135 = OpAccessChain %_ptr_Function_v3float %73 %int_4 + OpStore %135 %134 + %136 = OpCompositeConstruct %v3float %126 %123 %float_1 + %137 = OpAccessChain %_ptr_Function_v3float %73 %int_5 + OpStore %137 %136 + %138 = OpCompositeConstruct %v3float %122 %129 %float_1 + %139 = OpAccessChain %_ptr_Function_v3float %73 %int_6 + OpStore %139 %138 + %140 = OpCompositeConstruct %v3float %126 %129 %float_1 + %141 = OpAccessChain %_ptr_Function_v3float %73 %int_7 + OpStore %141 %140 + %142 = OpIAdd %uint %103 %uint_2 + %143 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %142 + %144 = OpLoad %v4float %143 + %145 = OpVectorShuffle %v3float %144 %144 0 1 2 + %146 = OpIAdd %uint %103 %uint_3 + %147 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %146 + %148 = OpLoad %v4float %147 + %149 = OpVectorShuffle %v3float %148 %148 0 1 2 + %150 = OpIAdd %uint %103 %uint_4 + %151 = OpAccessChain %_ptr_Uniform_v4float %CulledObjectBoxBounds %int_0 %150 + %152 = OpLoad %v4float %151 + %153 = OpVectorShuffle %v3float %152 %152 0 1 2 + OpBranch %154 + %154 = OpLabel + %155 = OpPhi %v3float %37 %119 %156 %157 + %158 = OpPhi %v3float %35 %119 %159 %157 + %160 = OpPhi %int %int_0 %119 %161 %157 + %162 = OpSLessThan %bool %160 %int_8 + OpLoopMerge %163 %157 Unroll + OpBranchConditional %162 %157 %163 + %157 = OpLabel + %164 = OpAccessChain %_ptr_Function_v3float %73 %160 + %165 = OpLoad %v3float %164 + %166 = OpFSub %v3float %165 %121 + %167 = OpDot %float %166 %145 + %168 = OpDot %float %166 %149 + %169 = OpDot %float %166 %153 + %170 = OpCompositeConstruct %v3float %167 %168 %169 + %159 = OpExtInst %v3float %1 FMin %158 %170 + %156 = OpExtInst %v3float %1 FMax %155 %170 + %161 = OpIAdd %int %160 %int_1 + OpBranch %154 + %163 = OpLabel + %171 = OpFOrdLessThan %v3bool %158 %44 + %172 = OpAll %bool %171 + %173 = OpFOrdGreaterThan %v3bool %155 %46 + %174 = OpAll %bool %173 + %175 = OpLogicalAnd %bool %172 %174 + OpSelectionMerge %176 DontFlatten + OpBranchConditional %175 %177 %176 + %177 = OpLabel + %178 = OpImageTexelPointer %_ptr_Image_uint %RWShadowTileNumCulledObjects %84 %uint_0 + %179 = OpAtomicIAdd %uint %178 %uint_1 %uint_0 %uint_1 + OpBranch %176 + %176 = OpLabel + OpBranch %118 + %118 = OpLabel + OpStore %out_var_SV_Target0 %22 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc new file mode 100644 index 0000000000..4c70e14cb7 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-incorrect-base-type.invalid.asm.tesc @@ -0,0 +1,1158 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 598 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %MainHull "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_COLOR0 %in_var_TEXCOORD0 %in_var_TEXCOORD4 %in_var_PRIMITIVE_ID %in_var_LIGHTMAP_ID %in_var_VS_To_DS_Position %gl_InvocationID %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_COLOR0 %out_var_TEXCOORD0 %out_var_TEXCOORD4 %out_var_PRIMITIVE_ID %out_var_LIGHTMAP_ID %out_var_VS_To_DS_Position %out_var_PN_POSITION %out_var_PN_DisplacementScales %out_var_PN_TessellationMultiplier %out_var_PN_WorldDisplacementMultiplier %gl_TessLevelOuter %gl_TessLevelInner %out_var_PN_POSITION9 + OpExecutionMode %MainHull Triangles + OpExecutionMode %MainHull SpacingFractionalOdd + OpExecutionMode %MainHull VertexOrderCw + OpExecutionMode %MainHull OutputVertices 3 + OpSource HLSL 600 + OpName %FPNTessellationHSToDS "FPNTessellationHSToDS" + OpMemberName %FPNTessellationHSToDS 0 "PassSpecificData" + OpMemberName %FPNTessellationHSToDS 1 "WorldPosition" + OpMemberName %FPNTessellationHSToDS 2 "DisplacementScale" + OpMemberName %FPNTessellationHSToDS 3 "TessellationMultiplier" + OpMemberName %FPNTessellationHSToDS 4 "WorldDisplacementMultiplier" + OpName %FBasePassVSToDS "FBasePassVSToDS" + OpMemberName %FBasePassVSToDS 0 "FactoryInterpolants" + OpMemberName %FBasePassVSToDS 1 "BasePassInterpolants" + OpMemberName %FBasePassVSToDS 2 "Position" + OpName %FVertexFactoryInterpolantsVSToDS "FVertexFactoryInterpolantsVSToDS" + OpMemberName %FVertexFactoryInterpolantsVSToDS 0 "InterpolantsVSToPS" + OpName %FVertexFactoryInterpolantsVSToPS "FVertexFactoryInterpolantsVSToPS" + OpMemberName %FVertexFactoryInterpolantsVSToPS 0 "TangentToWorld0" + OpMemberName %FVertexFactoryInterpolantsVSToPS 1 "TangentToWorld2" + OpMemberName %FVertexFactoryInterpolantsVSToPS 2 "Color" + OpMemberName %FVertexFactoryInterpolantsVSToPS 3 "TexCoords" + OpMemberName %FVertexFactoryInterpolantsVSToPS 4 "LightMapCoordinate" + OpMemberName %FVertexFactoryInterpolantsVSToPS 5 "PrimitiveId" + OpMemberName %FVertexFactoryInterpolantsVSToPS 6 "LightmapDataIndex" + OpName %FBasePassInterpolantsVSToDS "FBasePassInterpolantsVSToDS" + OpName %FSharedBasePassInterpolants "FSharedBasePassInterpolants" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_StructuredBuffer_v4float "type.StructuredBuffer.v4float" + OpName %View_PrimitiveSceneData "View_PrimitiveSceneData" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_COLOR0 "in.var.COLOR0" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_TEXCOORD4 "in.var.TEXCOORD4" + OpName %in_var_PRIMITIVE_ID "in.var.PRIMITIVE_ID" + OpName %in_var_LIGHTMAP_ID "in.var.LIGHTMAP_ID" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_COLOR0 "out.var.COLOR0" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_TEXCOORD4 "out.var.TEXCOORD4" + OpName %out_var_PRIMITIVE_ID "out.var.PRIMITIVE_ID" + OpName %out_var_LIGHTMAP_ID "out.var.LIGHTMAP_ID" + OpName %out_var_VS_To_DS_Position "out.var.VS_To_DS_Position" + OpName %out_var_PN_POSITION "out.var.PN_POSITION" + OpName %out_var_PN_DisplacementScales "out.var.PN_DisplacementScales" + OpName %out_var_PN_TessellationMultiplier "out.var.PN_TessellationMultiplier" + OpName %out_var_PN_WorldDisplacementMultiplier "out.var.PN_WorldDisplacementMultiplier" + OpName %out_var_PN_POSITION9 "out.var.PN_POSITION9" + OpName %MainHull "MainHull" + OpName %param_var_I "param.var.I" + OpName %temp_var_hullMainRetVal "temp.var.hullMainRetVal" + OpName %if_merge "if.merge" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_TEXCOORD4 UserSemantic "TEXCOORD4" + OpDecorateString %in_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorateString %in_var_LIGHTMAP_ID UserSemantic "LIGHTMAP_ID" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorateString %gl_InvocationID UserSemantic "SV_OutputControlPointID" + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_TEXCOORD4 UserSemantic "TEXCOORD4" + OpDecorateString %out_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorateString %out_var_LIGHTMAP_ID UserSemantic "LIGHTMAP_ID" + OpDecorateString %out_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %out_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %out_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %out_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %out_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %out_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %out_var_PN_POSITION9 Patch + OpDecorate %in_var_TEXCOORD10_centroid Location 0 + OpDecorate %in_var_TEXCOORD11_centroid Location 1 + OpDecorate %in_var_COLOR0 Location 2 + OpDecorate %in_var_TEXCOORD0 Location 3 + OpDecorate %in_var_TEXCOORD4 Location 4 + OpDecorate %in_var_PRIMITIVE_ID Location 5 + OpDecorate %in_var_LIGHTMAP_ID Location 6 + OpDecorate %in_var_VS_To_DS_Position Location 7 + OpDecorate %out_var_COLOR0 Location 0 + OpDecorate %out_var_LIGHTMAP_ID Location 1 + OpDecorate %out_var_PN_DisplacementScales Location 2 + OpDecorate %out_var_PN_POSITION Location 3 + OpDecorate %out_var_PN_POSITION9 Location 6 + OpDecorate %out_var_PN_TessellationMultiplier Location 7 + OpDecorate %out_var_PN_WorldDisplacementMultiplier Location 8 + OpDecorate %out_var_PRIMITIVE_ID Location 9 + OpDecorate %out_var_TEXCOORD0 Location 10 + OpDecorate %out_var_TEXCOORD10_centroid Location 11 + OpDecorate %out_var_TEXCOORD11_centroid Location 12 + OpDecorate %out_var_TEXCOORD4 Location 13 + OpDecorate %out_var_VS_To_DS_Position Location 14 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 1 + OpDecorate %View_PrimitiveSceneData DescriptorSet 0 + OpDecorate %View_PrimitiveSceneData Binding 0 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %type_StructuredBuffer_v4float 0 Offset 0 + OpMemberDecorate %type_StructuredBuffer_v4float 0 NonWritable + OpDecorate %type_StructuredBuffer_v4float BufferBlock + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float_2 = OpConstant %float 2 + %62 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %float_0_5 = OpConstant %float 0.5 + %int_3 = OpConstant %int 3 +%float_0_333000004 = OpConstant %float 0.333000004 + %float_1 = OpConstant %float 1 + %67 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_15 = OpConstant %float 15 + %69 = OpConstantComposite %v4float %float_15 %float_15 %float_15 %float_15 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%FVertexFactoryInterpolantsVSToPS = OpTypeStruct %v4float %v4float %v4float %_arr_v4float_uint_1 %v4float %uint %uint +%FVertexFactoryInterpolantsVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToPS +%FSharedBasePassInterpolants = OpTypeStruct +%FBasePassInterpolantsVSToDS = OpTypeStruct %FSharedBasePassInterpolants +%FBasePassVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToDS %FBasePassInterpolantsVSToDS %v4float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%FPNTessellationHSToDS = OpTypeStruct %FBasePassVSToDS %_arr_v4float_uint_3 %v3float %float %float + %v3int = OpTypeVector %int 3 + %73 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %74 = OpConstantComposite %v3int %int_3 %int_3 %int_3 + %float_0 = OpConstant %float 0 + %76 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %77 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %int_77 = OpConstant %int 77 + %int_6 = OpConstant %int 6 + %int_27 = OpConstant %int 27 + %81 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %82 = OpConstantComposite %v3int %int_2 %int_2 %int_2 + %uint_26 = OpConstant %uint 26 + %uint_12 = OpConstant %uint 12 + %uint_22 = OpConstant %uint 22 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%_runtimearr_v4float = OpTypeRuntimeArray %v4float +%type_StructuredBuffer_v4float = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_type_StructuredBuffer_v4float = OpTypePointer Uniform %type_StructuredBuffer_v4float +%_arr_v4float_uint_12 = OpTypeArray %v4float %uint_12 +%_ptr_Input__arr_v4float_uint_12 = OpTypePointer Input %_arr_v4float_uint_12 +%_arr__arr_v4float_uint_1_uint_12 = OpTypeArray %_arr_v4float_uint_1 %uint_12 +%_ptr_Input__arr__arr_v4float_uint_1_uint_12 = OpTypePointer Input %_arr__arr_v4float_uint_1_uint_12 +%_arr_uint_uint_12 = OpTypeArray %uint %uint_12 +%_ptr_Input__arr_uint_uint_12 = OpTypePointer Input %_arr_uint_uint_12 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_arr__arr_v4float_uint_1_uint_3 = OpTypeArray %_arr_v4float_uint_1 %uint_3 +%_ptr_Output__arr__arr_v4float_uint_1_uint_3 = OpTypePointer Output %_arr__arr_v4float_uint_1_uint_3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Output__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Output %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %111 = OpTypeFunction %void +%_arr_FBasePassVSToDS_uint_12 = OpTypeArray %FBasePassVSToDS %uint_12 +%_ptr_Function__arr_FBasePassVSToDS_uint_12 = OpTypePointer Function %_arr_FBasePassVSToDS_uint_12 +%_arr_FPNTessellationHSToDS_uint_3 = OpTypeArray %FPNTessellationHSToDS %uint_3 +%_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 = OpTypePointer Workgroup %_arr_FPNTessellationHSToDS_uint_3 +%_ptr_Output__arr_v4float_uint_1 = OpTypePointer Output %_arr_v4float_uint_1 +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Workgroup_FPNTessellationHSToDS = OpTypePointer Workgroup %FPNTessellationHSToDS + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_FVertexFactoryInterpolantsVSToDS = OpTypePointer Function %FVertexFactoryInterpolantsVSToDS +%_ptr_Function_FVertexFactoryInterpolantsVSToPS = OpTypePointer Function %FVertexFactoryInterpolantsVSToPS +%_ptr_Function_FBasePassVSToDS = OpTypePointer Function %FBasePassVSToDS + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %View = OpVariable %_ptr_Uniform_type_View Uniform +%View_PrimitiveSceneData = OpVariable %_ptr_Uniform_type_StructuredBuffer_v4float Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_COLOR0 = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr__arr_v4float_uint_1_uint_12 Input +%in_var_TEXCOORD4 = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_PRIMITIVE_ID = OpVariable %_ptr_Input__arr_uint_uint_12 Input +%in_var_LIGHTMAP_ID = OpVariable %_ptr_Input__arr_uint_uint_12 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%gl_InvocationID = OpVariable %_ptr_Input_uint Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_COLOR0 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_TEXCOORD0 = OpVariable %_ptr_Output__arr__arr_v4float_uint_1_uint_3 Output +%out_var_TEXCOORD4 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PRIMITIVE_ID = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%out_var_LIGHTMAP_ID = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%out_var_VS_To_DS_Position = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PN_POSITION = OpVariable %_ptr_Output__arr__arr_v4float_uint_3_uint_3 Output +%out_var_PN_DisplacementScales = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_PN_TessellationMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%out_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output +%out_var_PN_POSITION9 = OpVariable %_ptr_Output_v4float Output + %133 = OpConstantNull %FSharedBasePassInterpolants + %134 = OpConstantComposite %FBasePassInterpolantsVSToDS %133 +%float_0_333333343 = OpConstant %float 0.333333343 + %136 = OpConstantComposite %v4float %float_0_333333343 %float_0_333333343 %float_0_333333343 %float_0_333333343 + %137 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%float_0_166666672 = OpConstant %float 0.166666672 + %139 = OpConstantComposite %v4float %float_0_166666672 %float_0_166666672 %float_0_166666672 %float_0_166666672 + %140 = OpUndef %v4float + +; XXX: Original asm used Function here, which is wrong. +; This patches the SPIR-V to be correct. +%temp_var_hullMainRetVal = OpVariable %_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 Workgroup + + %MainHull = OpFunction %void None %111 + %141 = OpLabel +%param_var_I = OpVariable %_ptr_Function__arr_FBasePassVSToDS_uint_12 Function + %142 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD10_centroid + %143 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD11_centroid + %144 = OpLoad %_arr_v4float_uint_12 %in_var_COLOR0 + %145 = OpLoad %_arr__arr_v4float_uint_1_uint_12 %in_var_TEXCOORD0 + %146 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD4 + %147 = OpLoad %_arr_uint_uint_12 %in_var_PRIMITIVE_ID + %148 = OpLoad %_arr_uint_uint_12 %in_var_LIGHTMAP_ID + %149 = OpCompositeExtract %v4float %142 0 + %150 = OpCompositeExtract %v4float %143 0 + %151 = OpCompositeExtract %v4float %144 0 + %152 = OpCompositeExtract %_arr_v4float_uint_1 %145 0 + %153 = OpCompositeExtract %v4float %146 0 + %154 = OpCompositeExtract %uint %147 0 + %155 = OpCompositeExtract %uint %148 0 + %156 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %149 %150 %151 %152 %153 %154 %155 + %157 = OpCompositeExtract %v4float %142 1 + %158 = OpCompositeExtract %v4float %143 1 + %159 = OpCompositeExtract %v4float %144 1 + %160 = OpCompositeExtract %_arr_v4float_uint_1 %145 1 + %161 = OpCompositeExtract %v4float %146 1 + %162 = OpCompositeExtract %uint %147 1 + %163 = OpCompositeExtract %uint %148 1 + %164 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %157 %158 %159 %160 %161 %162 %163 + %165 = OpCompositeExtract %v4float %142 2 + %166 = OpCompositeExtract %v4float %143 2 + %167 = OpCompositeExtract %v4float %144 2 + %168 = OpCompositeExtract %_arr_v4float_uint_1 %145 2 + %169 = OpCompositeExtract %v4float %146 2 + %170 = OpCompositeExtract %uint %147 2 + %171 = OpCompositeExtract %uint %148 2 + %172 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %165 %166 %167 %168 %169 %170 %171 + %173 = OpCompositeExtract %v4float %142 3 + %174 = OpCompositeExtract %v4float %143 3 + %175 = OpCompositeExtract %v4float %144 3 + %176 = OpCompositeExtract %_arr_v4float_uint_1 %145 3 + %177 = OpCompositeExtract %v4float %146 3 + %178 = OpCompositeExtract %uint %147 3 + %179 = OpCompositeExtract %uint %148 3 + %180 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %173 %174 %175 %176 %177 %178 %179 + %181 = OpCompositeExtract %v4float %142 4 + %182 = OpCompositeExtract %v4float %143 4 + %183 = OpCompositeExtract %v4float %144 4 + %184 = OpCompositeExtract %_arr_v4float_uint_1 %145 4 + %185 = OpCompositeExtract %v4float %146 4 + %186 = OpCompositeExtract %uint %147 4 + %187 = OpCompositeExtract %uint %148 4 + %188 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %181 %182 %183 %184 %185 %186 %187 + %189 = OpCompositeExtract %v4float %142 5 + %190 = OpCompositeExtract %v4float %143 5 + %191 = OpCompositeExtract %v4float %144 5 + %192 = OpCompositeExtract %_arr_v4float_uint_1 %145 5 + %193 = OpCompositeExtract %v4float %146 5 + %194 = OpCompositeExtract %uint %147 5 + %195 = OpCompositeExtract %uint %148 5 + %196 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %189 %190 %191 %192 %193 %194 %195 + %197 = OpCompositeExtract %v4float %142 6 + %198 = OpCompositeExtract %v4float %143 6 + %199 = OpCompositeExtract %v4float %144 6 + %200 = OpCompositeExtract %_arr_v4float_uint_1 %145 6 + %201 = OpCompositeExtract %v4float %146 6 + %202 = OpCompositeExtract %uint %147 6 + %203 = OpCompositeExtract %uint %148 6 + %204 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %197 %198 %199 %200 %201 %202 %203 + %205 = OpCompositeExtract %v4float %142 7 + %206 = OpCompositeExtract %v4float %143 7 + %207 = OpCompositeExtract %v4float %144 7 + %208 = OpCompositeExtract %_arr_v4float_uint_1 %145 7 + %209 = OpCompositeExtract %v4float %146 7 + %210 = OpCompositeExtract %uint %147 7 + %211 = OpCompositeExtract %uint %148 7 + %212 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %205 %206 %207 %208 %209 %210 %211 + %213 = OpCompositeExtract %v4float %142 8 + %214 = OpCompositeExtract %v4float %143 8 + %215 = OpCompositeExtract %v4float %144 8 + %216 = OpCompositeExtract %_arr_v4float_uint_1 %145 8 + %217 = OpCompositeExtract %v4float %146 8 + %218 = OpCompositeExtract %uint %147 8 + %219 = OpCompositeExtract %uint %148 8 + %220 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %213 %214 %215 %216 %217 %218 %219 + %221 = OpCompositeExtract %v4float %142 9 + %222 = OpCompositeExtract %v4float %143 9 + %223 = OpCompositeExtract %v4float %144 9 + %224 = OpCompositeExtract %_arr_v4float_uint_1 %145 9 + %225 = OpCompositeExtract %v4float %146 9 + %226 = OpCompositeExtract %uint %147 9 + %227 = OpCompositeExtract %uint %148 9 + %228 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %221 %222 %223 %224 %225 %226 %227 + %229 = OpCompositeExtract %v4float %142 10 + %230 = OpCompositeExtract %v4float %143 10 + %231 = OpCompositeExtract %v4float %144 10 + %232 = OpCompositeExtract %_arr_v4float_uint_1 %145 10 + %233 = OpCompositeExtract %v4float %146 10 + %234 = OpCompositeExtract %uint %147 10 + %235 = OpCompositeExtract %uint %148 10 + %236 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %229 %230 %231 %232 %233 %234 %235 + %237 = OpCompositeExtract %v4float %142 11 + %238 = OpCompositeExtract %v4float %143 11 + %239 = OpCompositeExtract %v4float %144 11 + %240 = OpCompositeExtract %_arr_v4float_uint_1 %145 11 + %241 = OpCompositeExtract %v4float %146 11 + %242 = OpCompositeExtract %uint %147 11 + %243 = OpCompositeExtract %uint %148 11 + %244 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %237 %238 %239 %240 %241 %242 %243 + %245 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %156 + %246 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %164 + %247 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %172 + %248 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %180 + %249 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %188 + %250 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %196 + %251 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %204 + %252 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %212 + %253 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %220 + %254 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %228 + %255 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %236 + %256 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %244 + %257 = OpLoad %_arr_v4float_uint_12 %in_var_VS_To_DS_Position + %258 = OpCompositeExtract %v4float %257 0 + %259 = OpCompositeConstruct %FBasePassVSToDS %245 %134 %258 + %260 = OpCompositeExtract %v4float %257 1 + %261 = OpCompositeConstruct %FBasePassVSToDS %246 %134 %260 + %262 = OpCompositeExtract %v4float %257 2 + %263 = OpCompositeConstruct %FBasePassVSToDS %247 %134 %262 + %264 = OpCompositeExtract %v4float %257 3 + %265 = OpCompositeConstruct %FBasePassVSToDS %248 %134 %264 + %266 = OpCompositeExtract %v4float %257 4 + %267 = OpCompositeConstruct %FBasePassVSToDS %249 %134 %266 + %268 = OpCompositeExtract %v4float %257 5 + %269 = OpCompositeConstruct %FBasePassVSToDS %250 %134 %268 + %270 = OpCompositeExtract %v4float %257 6 + %271 = OpCompositeConstruct %FBasePassVSToDS %251 %134 %270 + %272 = OpCompositeExtract %v4float %257 7 + %273 = OpCompositeConstruct %FBasePassVSToDS %252 %134 %272 + %274 = OpCompositeExtract %v4float %257 8 + %275 = OpCompositeConstruct %FBasePassVSToDS %253 %134 %274 + %276 = OpCompositeExtract %v4float %257 9 + %277 = OpCompositeConstruct %FBasePassVSToDS %254 %134 %276 + %278 = OpCompositeExtract %v4float %257 10 + %279 = OpCompositeConstruct %FBasePassVSToDS %255 %134 %278 + %280 = OpCompositeExtract %v4float %257 11 + %281 = OpCompositeConstruct %FBasePassVSToDS %256 %134 %280 + %282 = OpCompositeConstruct %_arr_FBasePassVSToDS_uint_12 %259 %261 %263 %265 %267 %269 %271 %273 %275 %277 %279 %281 + OpStore %param_var_I %282 + %283 = OpLoad %uint %gl_InvocationID + %284 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %283 %int_0 + %285 = OpLoad %FVertexFactoryInterpolantsVSToDS %284 + %286 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %285 0 + %287 = OpCompositeExtract %v4float %286 0 + %288 = OpCompositeExtract %v4float %286 1 + %289 = OpVectorShuffle %v3float %287 %287 0 1 2 + %290 = OpVectorShuffle %v3float %288 %288 0 1 2 + %291 = OpExtInst %v3float %1 Cross %290 %289 + %292 = OpCompositeExtract %float %288 3 + %293 = OpCompositeConstruct %v3float %292 %292 %292 + %294 = OpFMul %v3float %291 %293 + %295 = OpCompositeConstruct %mat3v3float %289 %294 %290 + %296 = OpCompositeExtract %float %288 0 + %297 = OpCompositeExtract %float %288 1 + %298 = OpCompositeExtract %float %288 2 + %299 = OpCompositeConstruct %v4float %296 %297 %298 %float_0 + %300 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToPS %param_var_I %283 %int_0 %int_0 + %301 = OpLoad %FVertexFactoryInterpolantsVSToPS %300 + %302 = OpCompositeExtract %uint %301 5 + %303 = OpIMul %uint %302 %uint_26 + %304 = OpIAdd %uint %303 %uint_22 + %305 = OpAccessChain %_ptr_Uniform_v4float %View_PrimitiveSceneData %int_0 %304 + %306 = OpLoad %v4float %305 + %307 = OpVectorShuffle %v3float %306 %306 0 1 2 + %308 = OpVectorTimesMatrix %v3float %307 %295 + %309 = OpULessThan %bool %283 %uint_2 + %310 = OpIAdd %uint %283 %uint_1 + %311 = OpSelect %uint %309 %310 %uint_0 + %312 = OpIMul %uint %uint_2 %283 + %313 = OpIAdd %uint %uint_3 %312 + %314 = OpIAdd %uint %312 %uint_4 + %315 = OpAccessChain %_ptr_Function_FBasePassVSToDS %param_var_I %283 + %316 = OpLoad %FBasePassVSToDS %315 + %317 = OpAccessChain %_ptr_Function_v4float %param_var_I %283 %int_2 + %318 = OpLoad %v4float %317 + %319 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %311 %int_0 + %320 = OpLoad %FVertexFactoryInterpolantsVSToDS %319 + %321 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %320 0 + %322 = OpCompositeExtract %v4float %321 1 + %323 = OpCompositeExtract %float %322 0 + %324 = OpCompositeExtract %float %322 1 + %325 = OpCompositeExtract %float %322 2 + %326 = OpCompositeConstruct %v4float %323 %324 %325 %float_0 + %327 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %313 %int_0 + %328 = OpLoad %FVertexFactoryInterpolantsVSToDS %327 + %329 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %328 0 + %330 = OpCompositeExtract %v4float %329 1 + %331 = OpCompositeExtract %float %330 0 + %332 = OpCompositeExtract %float %330 1 + %333 = OpCompositeExtract %float %330 2 + %334 = OpCompositeConstruct %v4float %331 %332 %333 %float_0 + %335 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %314 %int_0 + %336 = OpLoad %FVertexFactoryInterpolantsVSToDS %335 + %337 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %336 0 + %338 = OpCompositeExtract %v4float %337 1 + %339 = OpCompositeExtract %float %338 0 + %340 = OpCompositeExtract %float %338 1 + %341 = OpCompositeExtract %float %338 2 + %342 = OpCompositeConstruct %v4float %339 %340 %341 %float_0 + %343 = OpLoad %v4float %317 + %344 = OpAccessChain %_ptr_Function_v4float %param_var_I %311 %int_2 + %345 = OpLoad %v4float %344 + %346 = OpFMul %v4float %62 %343 + %347 = OpFAdd %v4float %346 %345 + %348 = OpFSub %v4float %345 %343 + %349 = OpDot %float %348 %299 + %350 = OpCompositeConstruct %v4float %349 %349 %349 %349 + %351 = OpFMul %v4float %350 %299 + %352 = OpFSub %v4float %347 %351 + %353 = OpFMul %v4float %352 %136 + %354 = OpAccessChain %_ptr_Function_v4float %param_var_I %313 %int_2 + %355 = OpLoad %v4float %354 + %356 = OpAccessChain %_ptr_Function_v4float %param_var_I %314 %int_2 + %357 = OpLoad %v4float %356 + %358 = OpFMul %v4float %62 %355 + %359 = OpFAdd %v4float %358 %357 + %360 = OpFSub %v4float %357 %355 + %361 = OpDot %float %360 %334 + %362 = OpCompositeConstruct %v4float %361 %361 %361 %361 + %363 = OpFMul %v4float %362 %334 + %364 = OpFSub %v4float %359 %363 + %365 = OpFMul %v4float %364 %136 + %366 = OpFAdd %v4float %353 %365 + %367 = OpFMul %v4float %366 %137 + %368 = OpLoad %v4float %344 + %369 = OpLoad %v4float %317 + %370 = OpFMul %v4float %62 %368 + %371 = OpFAdd %v4float %370 %369 + %372 = OpFSub %v4float %369 %368 + %373 = OpDot %float %372 %326 + %374 = OpCompositeConstruct %v4float %373 %373 %373 %373 + %375 = OpFMul %v4float %374 %326 + %376 = OpFSub %v4float %371 %375 + %377 = OpFMul %v4float %376 %136 + %378 = OpLoad %v4float %356 + %379 = OpLoad %v4float %354 + %380 = OpFMul %v4float %62 %378 + %381 = OpFAdd %v4float %380 %379 + %382 = OpFSub %v4float %379 %378 + %383 = OpDot %float %382 %342 + %384 = OpCompositeConstruct %v4float %383 %383 %383 %383 + %385 = OpFMul %v4float %384 %342 + %386 = OpFSub %v4float %381 %385 + %387 = OpFMul %v4float %386 %136 + %388 = OpFAdd %v4float %377 %387 + %389 = OpFMul %v4float %388 %137 + %390 = OpCompositeConstruct %_arr_v4float_uint_3 %318 %367 %389 + %391 = OpCompositeConstruct %FPNTessellationHSToDS %316 %390 %308 %float_1 %float_1 + %392 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %316 0 + %393 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %392 0 + %394 = OpCompositeExtract %v4float %393 0 + %395 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD10_centroid %283 + OpStore %395 %394 + %396 = OpCompositeExtract %v4float %393 1 + %397 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD11_centroid %283 + OpStore %397 %396 + %398 = OpCompositeExtract %v4float %393 2 + %399 = OpAccessChain %_ptr_Output_v4float %out_var_COLOR0 %283 + OpStore %399 %398 + %400 = OpCompositeExtract %_arr_v4float_uint_1 %393 3 + %401 = OpAccessChain %_ptr_Output__arr_v4float_uint_1 %out_var_TEXCOORD0 %283 + OpStore %401 %400 + %402 = OpCompositeExtract %v4float %393 4 + %403 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD4 %283 + OpStore %403 %402 + %404 = OpCompositeExtract %uint %393 5 + %405 = OpAccessChain %_ptr_Output_uint %out_var_PRIMITIVE_ID %283 + OpStore %405 %404 + %406 = OpCompositeExtract %uint %393 6 + %407 = OpAccessChain %_ptr_Output_uint %out_var_LIGHTMAP_ID %283 + OpStore %407 %406 + %408 = OpCompositeExtract %v4float %316 2 + %409 = OpAccessChain %_ptr_Output_v4float %out_var_VS_To_DS_Position %283 + OpStore %409 %408 + %410 = OpAccessChain %_ptr_Output__arr_v4float_uint_3 %out_var_PN_POSITION %283 + OpStore %410 %390 + %411 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DisplacementScales %283 + OpStore %411 %308 + %412 = OpAccessChain %_ptr_Output_float %out_var_PN_TessellationMultiplier %283 + OpStore %412 %float_1 + %413 = OpAccessChain %_ptr_Output_float %out_var_PN_WorldDisplacementMultiplier %283 + OpStore %413 %float_1 + %414 = OpAccessChain %_ptr_Workgroup_FPNTessellationHSToDS %temp_var_hullMainRetVal %283 + OpStore %414 %391 + OpControlBarrier %uint_2 %uint_4 %uint_0 + %415 = OpIEqual %bool %283 %uint_0 + OpSelectionMerge %if_merge None + OpBranchConditional %415 %416 %if_merge + %416 = OpLabel + %417 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %418 = OpLoad %mat4v4float %417 + %419 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_6 + %420 = OpLoad %mat4v4float %419 + %421 = OpAccessChain %_ptr_Uniform_v3float %View %int_27 + %422 = OpLoad %v3float %421 + %423 = OpAccessChain %_ptr_Uniform_float %View %int_77 + %424 = OpLoad %float %423 + %425 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_0 + %426 = OpLoad %v4float %425 + %427 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_1 + %428 = OpLoad %v4float %427 + %429 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_2 + %430 = OpLoad %v4float %429 + %431 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_0 + %432 = OpLoad %v4float %431 + %433 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_1 + %434 = OpLoad %v4float %433 + %435 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_2 + %436 = OpLoad %v4float %435 + %437 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_0 + %438 = OpLoad %v4float %437 + %439 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_1 + %440 = OpLoad %v4float %439 + %441 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_2 + %442 = OpLoad %v4float %441 + %443 = OpFAdd %v4float %428 %430 + %444 = OpFAdd %v4float %443 %434 + %445 = OpFAdd %v4float %444 %436 + %446 = OpFAdd %v4float %445 %440 + %447 = OpFAdd %v4float %446 %442 + %448 = OpFMul %v4float %447 %139 + %449 = OpFAdd %v4float %438 %432 + %450 = OpFAdd %v4float %449 %426 + %451 = OpFMul %v4float %450 %136 + %452 = OpFSub %v4float %448 %451 + %453 = OpFMul %v4float %452 %137 + %454 = OpFAdd %v4float %448 %453 + %455 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_1 %int_3 + %456 = OpLoad %float %455 + %457 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_2 %int_3 + %458 = OpLoad %float %457 + %459 = OpFAdd %float %456 %458 + %460 = OpFMul %float %float_0_5 %459 + %461 = OpCompositeInsert %v4float %460 %140 0 + %462 = OpLoad %float %457 + %463 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_0 %int_3 + %464 = OpLoad %float %463 + %465 = OpFAdd %float %462 %464 + %466 = OpFMul %float %float_0_5 %465 + %467 = OpCompositeInsert %v4float %466 %461 1 + %468 = OpLoad %float %463 + %469 = OpLoad %float %455 + %470 = OpFAdd %float %468 %469 + %471 = OpFMul %float %float_0_5 %470 + %472 = OpCompositeInsert %v4float %471 %467 2 + %473 = OpLoad %float %463 + %474 = OpLoad %float %455 + %475 = OpFAdd %float %473 %474 + %476 = OpLoad %float %457 + %477 = OpFAdd %float %475 %476 + %478 = OpFMul %float %float_0_333000004 %477 + %479 = OpCompositeInsert %v4float %478 %472 3 + %480 = OpVectorShuffle %v3float %426 %426 0 1 2 + %481 = OpVectorShuffle %v3float %432 %432 0 1 2 + %482 = OpVectorShuffle %v3float %438 %438 0 1 2 + OpBranch %483 + %483 = OpLabel + OpLoopMerge %484 %485 None + OpBranch %486 + %486 = OpLabel + %487 = OpMatrixTimesVector %v4float %420 %76 + %488 = OpCompositeExtract %float %426 0 + %489 = OpCompositeExtract %float %426 1 + %490 = OpCompositeExtract %float %426 2 + %491 = OpCompositeConstruct %v4float %488 %489 %490 %float_1 + %492 = OpMatrixTimesVector %v4float %418 %491 + %493 = OpVectorShuffle %v3float %492 %492 0 1 2 + %494 = OpVectorShuffle %v3float %487 %487 0 1 2 + %495 = OpFSub %v3float %493 %494 + %496 = OpCompositeExtract %float %492 3 + %497 = OpCompositeExtract %float %487 3 + %498 = OpFAdd %float %496 %497 + %499 = OpCompositeConstruct %v3float %498 %498 %498 + %500 = OpFOrdLessThan %v3bool %495 %499 + %501 = OpSelect %v3int %500 %81 %73 + %502 = OpFAdd %v3float %493 %494 + %503 = OpFNegate %float %496 + %504 = OpFSub %float %503 %497 + %505 = OpCompositeConstruct %v3float %504 %504 %504 + %506 = OpFOrdGreaterThan %v3bool %502 %505 + %507 = OpSelect %v3int %506 %81 %73 + %508 = OpIMul %v3int %82 %507 + %509 = OpIAdd %v3int %501 %508 + %510 = OpCompositeExtract %float %432 0 + %511 = OpCompositeExtract %float %432 1 + %512 = OpCompositeExtract %float %432 2 + %513 = OpCompositeConstruct %v4float %510 %511 %512 %float_1 + %514 = OpMatrixTimesVector %v4float %418 %513 + %515 = OpVectorShuffle %v3float %514 %514 0 1 2 + %516 = OpFSub %v3float %515 %494 + %517 = OpCompositeExtract %float %514 3 + %518 = OpFAdd %float %517 %497 + %519 = OpCompositeConstruct %v3float %518 %518 %518 + %520 = OpFOrdLessThan %v3bool %516 %519 + %521 = OpSelect %v3int %520 %81 %73 + %522 = OpFAdd %v3float %515 %494 + %523 = OpFNegate %float %517 + %524 = OpFSub %float %523 %497 + %525 = OpCompositeConstruct %v3float %524 %524 %524 + %526 = OpFOrdGreaterThan %v3bool %522 %525 + %527 = OpSelect %v3int %526 %81 %73 + %528 = OpIMul %v3int %82 %527 + %529 = OpIAdd %v3int %521 %528 + %530 = OpBitwiseOr %v3int %509 %529 + %531 = OpCompositeExtract %float %438 0 + %532 = OpCompositeExtract %float %438 1 + %533 = OpCompositeExtract %float %438 2 + %534 = OpCompositeConstruct %v4float %531 %532 %533 %float_1 + %535 = OpMatrixTimesVector %v4float %418 %534 + %536 = OpVectorShuffle %v3float %535 %535 0 1 2 + %537 = OpFSub %v3float %536 %494 + %538 = OpCompositeExtract %float %535 3 + %539 = OpFAdd %float %538 %497 + %540 = OpCompositeConstruct %v3float %539 %539 %539 + %541 = OpFOrdLessThan %v3bool %537 %540 + %542 = OpSelect %v3int %541 %81 %73 + %543 = OpFAdd %v3float %536 %494 + %544 = OpFNegate %float %538 + %545 = OpFSub %float %544 %497 + %546 = OpCompositeConstruct %v3float %545 %545 %545 + %547 = OpFOrdGreaterThan %v3bool %543 %546 + %548 = OpSelect %v3int %547 %81 %73 + %549 = OpIMul %v3int %82 %548 + %550 = OpIAdd %v3int %542 %549 + %551 = OpBitwiseOr %v3int %530 %550 + %552 = OpINotEqual %v3bool %551 %74 + %553 = OpAny %bool %552 + OpSelectionMerge %554 None + OpBranchConditional %553 %555 %554 + %555 = OpLabel + OpBranch %484 + %554 = OpLabel + %556 = OpFSub %v3float %480 %481 + %557 = OpFSub %v3float %481 %482 + %558 = OpFSub %v3float %482 %480 + %559 = OpFAdd %v3float %480 %481 + %560 = OpFMul %v3float %77 %559 + %561 = OpFSub %v3float %560 %422 + %562 = OpFAdd %v3float %481 %482 + %563 = OpFMul %v3float %77 %562 + %564 = OpFSub %v3float %563 %422 + %565 = OpFAdd %v3float %482 %480 + %566 = OpFMul %v3float %77 %565 + %567 = OpFSub %v3float %566 %422 + %568 = OpDot %float %557 %557 + %569 = OpDot %float %564 %564 + %570 = OpFDiv %float %568 %569 + %571 = OpExtInst %float %1 Sqrt %570 + %572 = OpDot %float %558 %558 + %573 = OpDot %float %567 %567 + %574 = OpFDiv %float %572 %573 + %575 = OpExtInst %float %1 Sqrt %574 + %576 = OpDot %float %556 %556 + %577 = OpDot %float %561 %561 + %578 = OpFDiv %float %576 %577 + %579 = OpExtInst %float %1 Sqrt %578 + %580 = OpCompositeConstruct %v4float %571 %575 %579 %float_1 + %581 = OpFAdd %float %571 %575 + %582 = OpFAdd %float %581 %579 + %583 = OpFMul %float %float_0_333000004 %582 + %584 = OpCompositeInsert %v4float %583 %580 3 + %585 = OpCompositeConstruct %v4float %424 %424 %424 %424 + %586 = OpFMul %v4float %585 %584 + OpBranch %484 + %485 = OpLabel + OpBranch %483 + %484 = OpLabel + %587 = OpPhi %v4float %76 %555 %586 %554 + %588 = OpFMul %v4float %479 %587 + %589 = OpExtInst %v4float %1 FClamp %588 %67 %69 + %590 = OpCompositeExtract %float %589 0 + %591 = OpCompositeExtract %float %589 1 + %592 = OpCompositeExtract %float %589 2 + %593 = OpCompositeExtract %float %589 3 + %594 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_0 + OpStore %594 %590 + %595 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_1 + OpStore %595 %591 + %596 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_2 + OpStore %596 %592 + %597 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %uint_0 + OpStore %597 %593 + OpStore %out_var_PN_POSITION9 %454 + OpBranch %if_merge + %if_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc new file mode 100644 index 0000000000..a146896b90 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-input-array-access.invalid.asm.tesc @@ -0,0 +1,1264 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 607 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %MainHull "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_VS_To_DS_Position %in_var_VS_To_DS_VertexID %gl_InvocationID %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_VS_To_DS_Position %out_var_VS_To_DS_VertexID %out_var_PN_POSITION %out_var_PN_DisplacementScales %out_var_PN_TessellationMultiplier %out_var_PN_WorldDisplacementMultiplier %out_var_PN_DominantVertex %out_var_PN_DominantVertex1 %out_var_PN_DominantVertex2 %out_var_PN_DominantEdge %out_var_PN_DominantEdge1 %out_var_PN_DominantEdge2 %out_var_PN_DominantEdge3 %out_var_PN_DominantEdge4 %out_var_PN_DominantEdge5 %gl_TessLevelOuter %gl_TessLevelInner %out_var_PN_POSITION9 + OpExecutionMode %MainHull Triangles + OpExecutionMode %MainHull SpacingFractionalOdd + OpExecutionMode %MainHull VertexOrderCw + OpExecutionMode %MainHull OutputVertices 3 + OpSource HLSL 600 + OpName %FPNTessellationHSToDS "FPNTessellationHSToDS" + OpMemberName %FPNTessellationHSToDS 0 "PassSpecificData" + OpMemberName %FPNTessellationHSToDS 1 "WorldPosition" + OpMemberName %FPNTessellationHSToDS 2 "DisplacementScale" + OpMemberName %FPNTessellationHSToDS 3 "TessellationMultiplier" + OpMemberName %FPNTessellationHSToDS 4 "WorldDisplacementMultiplier" + OpMemberName %FPNTessellationHSToDS 5 "DominantVertex" + OpMemberName %FPNTessellationHSToDS 6 "DominantEdge" + OpName %FHitProxyVSToDS "FHitProxyVSToDS" + OpMemberName %FHitProxyVSToDS 0 "FactoryInterpolants" + OpMemberName %FHitProxyVSToDS 1 "Position" + OpMemberName %FHitProxyVSToDS 2 "VertexID" + OpName %FVertexFactoryInterpolantsVSToDS "FVertexFactoryInterpolantsVSToDS" + OpMemberName %FVertexFactoryInterpolantsVSToDS 0 "InterpolantsVSToPS" + OpName %FVertexFactoryInterpolantsVSToPS "FVertexFactoryInterpolantsVSToPS" + OpMemberName %FVertexFactoryInterpolantsVSToPS 0 "TangentToWorld0" + OpMemberName %FVertexFactoryInterpolantsVSToPS 1 "TangentToWorld2" + OpName %FHullShaderConstantDominantVertexData "FHullShaderConstantDominantVertexData" + OpMemberName %FHullShaderConstantDominantVertexData 0 "UV" + OpMemberName %FHullShaderConstantDominantVertexData 1 "Normal" + OpMemberName %FHullShaderConstantDominantVertexData 2 "Tangent" + OpName %FHullShaderConstantDominantEdgeData "FHullShaderConstantDominantEdgeData" + OpMemberName %FHullShaderConstantDominantEdgeData 0 "UV0" + OpMemberName %FHullShaderConstantDominantEdgeData 1 "UV1" + OpMemberName %FHullShaderConstantDominantEdgeData 2 "Normal0" + OpMemberName %FHullShaderConstantDominantEdgeData 3 "Normal1" + OpMemberName %FHullShaderConstantDominantEdgeData 4 "Tangent0" + OpMemberName %FHullShaderConstantDominantEdgeData 5 "Tangent1" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_Primitive "type.Primitive" + OpMemberName %type_Primitive 0 "Primitive_LocalToWorld" + OpMemberName %type_Primitive 1 "Primitive_InvNonUniformScaleAndDeterminantSign" + OpMemberName %type_Primitive 2 "Primitive_ObjectWorldPositionAndRadius" + OpMemberName %type_Primitive 3 "Primitive_WorldToLocal" + OpMemberName %type_Primitive 4 "Primitive_PreviousLocalToWorld" + OpMemberName %type_Primitive 5 "Primitive_PreviousWorldToLocal" + OpMemberName %type_Primitive 6 "Primitive_ActorWorldPosition" + OpMemberName %type_Primitive 7 "Primitive_UseSingleSampleShadowFromStationaryLights" + OpMemberName %type_Primitive 8 "Primitive_ObjectBounds" + OpMemberName %type_Primitive 9 "Primitive_LpvBiasMultiplier" + OpMemberName %type_Primitive 10 "Primitive_DecalReceiverMask" + OpMemberName %type_Primitive 11 "Primitive_PerObjectGBufferData" + OpMemberName %type_Primitive 12 "Primitive_UseVolumetricLightmapShadowFromStationaryLights" + OpMemberName %type_Primitive 13 "Primitive_DrawsVelocity" + OpMemberName %type_Primitive 14 "Primitive_ObjectOrientation" + OpMemberName %type_Primitive 15 "Primitive_NonUniformScale" + OpMemberName %type_Primitive 16 "Primitive_LocalObjectBoundsMin" + OpMemberName %type_Primitive 17 "Primitive_LightingChannelMask" + OpMemberName %type_Primitive 18 "Primitive_LocalObjectBoundsMax" + OpMemberName %type_Primitive 19 "Primitive_LightmapDataIndex" + OpMemberName %type_Primitive 20 "Primitive_PreSkinnedLocalBounds" + OpMemberName %type_Primitive 21 "Primitive_SingleCaptureIndex" + OpMemberName %type_Primitive 22 "Primitive_OutputVelocity" + OpMemberName %type_Primitive 23 "PrePadding_Primitive_420" + OpMemberName %type_Primitive 24 "PrePadding_Primitive_424" + OpMemberName %type_Primitive 25 "PrePadding_Primitive_428" + OpMemberName %type_Primitive 26 "Primitive_CustomPrimitiveData" + OpName %Primitive "Primitive" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %in_var_VS_To_DS_VertexID "in.var.VS_To_DS_VertexID" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_VS_To_DS_Position "out.var.VS_To_DS_Position" + OpName %out_var_VS_To_DS_VertexID "out.var.VS_To_DS_VertexID" + OpName %out_var_PN_POSITION "out.var.PN_POSITION" + OpName %out_var_PN_DisplacementScales "out.var.PN_DisplacementScales" + OpName %out_var_PN_TessellationMultiplier "out.var.PN_TessellationMultiplier" + OpName %out_var_PN_WorldDisplacementMultiplier "out.var.PN_WorldDisplacementMultiplier" + OpName %out_var_PN_DominantVertex "out.var.PN_DominantVertex" + OpName %out_var_PN_DominantVertex1 "out.var.PN_DominantVertex1" + OpName %out_var_PN_DominantVertex2 "out.var.PN_DominantVertex2" + OpName %out_var_PN_DominantEdge "out.var.PN_DominantEdge" + OpName %out_var_PN_DominantEdge1 "out.var.PN_DominantEdge1" + OpName %out_var_PN_DominantEdge2 "out.var.PN_DominantEdge2" + OpName %out_var_PN_DominantEdge3 "out.var.PN_DominantEdge3" + OpName %out_var_PN_DominantEdge4 "out.var.PN_DominantEdge4" + OpName %out_var_PN_DominantEdge5 "out.var.PN_DominantEdge5" + OpName %out_var_PN_POSITION9 "out.var.PN_POSITION9" + OpName %MainHull "MainHull" + OpName %param_var_I "param.var.I" + OpName %temp_var_hullMainRetVal "temp.var.hullMainRetVal" + OpName %if_merge "if.merge" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %in_var_VS_To_DS_VertexID UserSemantic "VS_To_DS_VertexID" + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorateString %gl_InvocationID UserSemantic "SV_OutputControlPointID" + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %out_var_VS_To_DS_VertexID UserSemantic "VS_To_DS_VertexID" + OpDecorateString %out_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %out_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %out_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %out_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorateString %out_var_PN_DominantVertex UserSemantic "PN_DominantVertex" + OpDecorateString %out_var_PN_DominantVertex1 UserSemantic "PN_DominantVertex" + OpDecorateString %out_var_PN_DominantVertex2 UserSemantic "PN_DominantVertex" + OpDecorateString %out_var_PN_DominantEdge UserSemantic "PN_DominantEdge" + OpDecorateString %out_var_PN_DominantEdge1 UserSemantic "PN_DominantEdge" + OpDecorateString %out_var_PN_DominantEdge2 UserSemantic "PN_DominantEdge" + OpDecorateString %out_var_PN_DominantEdge3 UserSemantic "PN_DominantEdge" + OpDecorateString %out_var_PN_DominantEdge4 UserSemantic "PN_DominantEdge" + OpDecorateString %out_var_PN_DominantEdge5 UserSemantic "PN_DominantEdge" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %out_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %out_var_PN_POSITION9 Patch + OpDecorate %in_var_TEXCOORD10_centroid Location 0 + OpDecorate %in_var_TEXCOORD11_centroid Location 1 + OpDecorate %in_var_VS_To_DS_Position Location 2 + OpDecorate %in_var_VS_To_DS_VertexID Location 3 + OpDecorate %out_var_PN_DisplacementScales Location 0 + OpDecorate %out_var_PN_DominantEdge Location 1 + OpDecorate %out_var_PN_DominantEdge1 Location 2 + OpDecorate %out_var_PN_DominantEdge2 Location 3 + OpDecorate %out_var_PN_DominantEdge3 Location 4 + OpDecorate %out_var_PN_DominantEdge4 Location 5 + OpDecorate %out_var_PN_DominantEdge5 Location 6 + OpDecorate %out_var_PN_DominantVertex Location 7 + OpDecorate %out_var_PN_DominantVertex1 Location 8 + OpDecorate %out_var_PN_DominantVertex2 Location 9 + OpDecorate %out_var_PN_POSITION Location 10 + OpDecorate %out_var_PN_POSITION9 Location 13 + OpDecorate %out_var_PN_TessellationMultiplier Location 14 + OpDecorate %out_var_PN_WorldDisplacementMultiplier Location 15 + OpDecorate %out_var_TEXCOORD10_centroid Location 16 + OpDecorate %out_var_TEXCOORD11_centroid Location 17 + OpDecorate %out_var_VS_To_DS_Position Location 18 + OpDecorate %out_var_VS_To_DS_VertexID Location 19 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %Primitive DescriptorSet 0 + OpDecorate %Primitive Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpDecorate %type_View Block + OpMemberDecorate %type_Primitive 0 Offset 0 + OpMemberDecorate %type_Primitive 0 MatrixStride 16 + OpMemberDecorate %type_Primitive 0 ColMajor + OpMemberDecorate %type_Primitive 1 Offset 64 + OpMemberDecorate %type_Primitive 2 Offset 80 + OpMemberDecorate %type_Primitive 3 Offset 96 + OpMemberDecorate %type_Primitive 3 MatrixStride 16 + OpMemberDecorate %type_Primitive 3 ColMajor + OpMemberDecorate %type_Primitive 4 Offset 160 + OpMemberDecorate %type_Primitive 4 MatrixStride 16 + OpMemberDecorate %type_Primitive 4 ColMajor + OpMemberDecorate %type_Primitive 5 Offset 224 + OpMemberDecorate %type_Primitive 5 MatrixStride 16 + OpMemberDecorate %type_Primitive 5 ColMajor + OpMemberDecorate %type_Primitive 6 Offset 288 + OpMemberDecorate %type_Primitive 7 Offset 300 + OpMemberDecorate %type_Primitive 8 Offset 304 + OpMemberDecorate %type_Primitive 9 Offset 316 + OpMemberDecorate %type_Primitive 10 Offset 320 + OpMemberDecorate %type_Primitive 11 Offset 324 + OpMemberDecorate %type_Primitive 12 Offset 328 + OpMemberDecorate %type_Primitive 13 Offset 332 + OpMemberDecorate %type_Primitive 14 Offset 336 + OpMemberDecorate %type_Primitive 15 Offset 352 + OpMemberDecorate %type_Primitive 16 Offset 368 + OpMemberDecorate %type_Primitive 17 Offset 380 + OpMemberDecorate %type_Primitive 18 Offset 384 + OpMemberDecorate %type_Primitive 19 Offset 396 + OpMemberDecorate %type_Primitive 20 Offset 400 + OpMemberDecorate %type_Primitive 21 Offset 412 + OpMemberDecorate %type_Primitive 22 Offset 416 + OpMemberDecorate %type_Primitive 23 Offset 420 + OpMemberDecorate %type_Primitive 24 Offset 424 + OpMemberDecorate %type_Primitive 25 Offset 428 + OpMemberDecorate %type_Primitive 26 Offset 432 + OpDecorate %type_Primitive Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float_2 = OpConstant %float 2 + %63 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %float_0_5 = OpConstant %float 0.5 + %int_3 = OpConstant %int 3 +%float_0_333000004 = OpConstant %float 0.333000004 + %float_1 = OpConstant %float 1 + %68 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_15 = OpConstant %float 15 + %70 = OpConstantComposite %v4float %float_15 %float_15 %float_15 %float_15 +%FVertexFactoryInterpolantsVSToPS = OpTypeStruct %v4float %v4float +%FVertexFactoryInterpolantsVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToPS +%FHitProxyVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToDS %v4float %uint +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%FHullShaderConstantDominantVertexData = OpTypeStruct %v2float %v4float %v3float +%FHullShaderConstantDominantEdgeData = OpTypeStruct %v2float %v2float %v4float %v4float %v3float %v3float +%FPNTessellationHSToDS = OpTypeStruct %FHitProxyVSToDS %_arr_v4float_uint_3 %v3float %float %float %FHullShaderConstantDominantVertexData %FHullShaderConstantDominantEdgeData + %uint_9 = OpConstant %uint 9 + %v3int = OpTypeVector %int 3 + %74 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %75 = OpConstantComposite %v3int %int_3 %int_3 %int_3 + %float_0 = OpConstant %float 0 + %77 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %78 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %int_78 = OpConstant %int 78 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_28 = OpConstant %int 28 + %83 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %84 = OpConstantComposite %v3int %int_2 %int_2 %int_2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_Primitive = OpTypeStruct %mat4v4float %v4float %v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %float %float %float %float %v4float %v4float %v3float %uint %v3float %uint %v3float %int %uint %uint %uint %uint %_arr_v4float_uint_4 +%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive + %uint_12 = OpConstant %uint 12 +%_arr_v4float_uint_12 = OpTypeArray %v4float %uint_12 +%_ptr_Input__arr_v4float_uint_12 = OpTypePointer Input %_arr_v4float_uint_12 +%_arr_uint_uint_12 = OpTypeArray %uint %uint_12 +%_ptr_Input__arr_uint_uint_12 = OpTypePointer Input %_arr_uint_uint_12 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Output__arr_uint_uint_3 = OpTypePointer Output %_arr_uint_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Output__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Output %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Output__arr_v2float_uint_3 = OpTypePointer Output %_arr_v2float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %109 = OpTypeFunction %void +%_arr_FHitProxyVSToDS_uint_12 = OpTypeArray %FHitProxyVSToDS %uint_12 +%_ptr_Function__arr_FHitProxyVSToDS_uint_12 = OpTypePointer Function %_arr_FHitProxyVSToDS_uint_12 +%_arr_FPNTessellationHSToDS_uint_3 = OpTypeArray %FPNTessellationHSToDS %uint_3 +%_ptr_Function__arr_FPNTessellationHSToDS_uint_3 = OpTypePointer Function %_arr_FPNTessellationHSToDS_uint_3 +%_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 = OpTypePointer Workgroup %_arr_FPNTessellationHSToDS_uint_3 +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_ptr_Function_FPNTessellationHSToDS = OpTypePointer Function %FPNTessellationHSToDS +%_ptr_Workgroup_FPNTessellationHSToDS = OpTypePointer Workgroup %FPNTessellationHSToDS + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_FVertexFactoryInterpolantsVSToDS = OpTypePointer Function %FVertexFactoryInterpolantsVSToDS +%_ptr_Function_FHitProxyVSToDS = OpTypePointer Function %FHitProxyVSToDS + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %View = OpVariable %_ptr_Uniform_type_View Uniform + %Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_VS_To_DS_VertexID = OpVariable %_ptr_Input__arr_uint_uint_12 Input +%gl_InvocationID = OpVariable %_ptr_Input_uint Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_VS_To_DS_Position = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_VS_To_DS_VertexID = OpVariable %_ptr_Output__arr_uint_uint_3 Output +%out_var_PN_POSITION = OpVariable %_ptr_Output__arr__arr_v4float_uint_3_uint_3 Output +%out_var_PN_DisplacementScales = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_PN_TessellationMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%out_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%out_var_PN_DominantVertex = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%out_var_PN_DominantVertex1 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PN_DominantVertex2 = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_PN_DominantEdge = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%out_var_PN_DominantEdge1 = OpVariable %_ptr_Output__arr_v2float_uint_3 Output +%out_var_PN_DominantEdge2 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PN_DominantEdge3 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PN_DominantEdge4 = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_PN_DominantEdge5 = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output +%out_var_PN_POSITION9 = OpVariable %_ptr_Output_v4float Output + %130 = OpConstantNull %v2float +%float_0_333333343 = OpConstant %float 0.333333343 + %132 = OpConstantComposite %v4float %float_0_333333343 %float_0_333333343 %float_0_333333343 %float_0_333333343 + %133 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%float_0_166666672 = OpConstant %float 0.166666672 + %135 = OpConstantComposite %v4float %float_0_166666672 %float_0_166666672 %float_0_166666672 %float_0_166666672 + %136 = OpUndef %v4float + +; XXX: Original asm used Function here, which is wrong. +; This patches the SPIR-V to be correct. +%temp_var_hullMainRetVal = OpVariable %_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 Workgroup + + %MainHull = OpFunction %void None %109 + %137 = OpLabel +%param_var_I = OpVariable %_ptr_Function__arr_FHitProxyVSToDS_uint_12 Function + %138 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD10_centroid + %139 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD11_centroid + %140 = OpCompositeExtract %v4float %138 0 + %141 = OpCompositeExtract %v4float %139 0 + %142 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %140 %141 + %143 = OpCompositeExtract %v4float %138 1 + %144 = OpCompositeExtract %v4float %139 1 + %145 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %143 %144 + %146 = OpCompositeExtract %v4float %138 2 + %147 = OpCompositeExtract %v4float %139 2 + %148 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %146 %147 + %149 = OpCompositeExtract %v4float %138 3 + %150 = OpCompositeExtract %v4float %139 3 + %151 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %149 %150 + %152 = OpCompositeExtract %v4float %138 4 + %153 = OpCompositeExtract %v4float %139 4 + %154 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %152 %153 + %155 = OpCompositeExtract %v4float %138 5 + %156 = OpCompositeExtract %v4float %139 5 + %157 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %155 %156 + %158 = OpCompositeExtract %v4float %138 6 + %159 = OpCompositeExtract %v4float %139 6 + %160 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %158 %159 + %161 = OpCompositeExtract %v4float %138 7 + %162 = OpCompositeExtract %v4float %139 7 + %163 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %161 %162 + %164 = OpCompositeExtract %v4float %138 8 + %165 = OpCompositeExtract %v4float %139 8 + %166 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %164 %165 + %167 = OpCompositeExtract %v4float %138 9 + %168 = OpCompositeExtract %v4float %139 9 + %169 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %167 %168 + %170 = OpCompositeExtract %v4float %138 10 + %171 = OpCompositeExtract %v4float %139 10 + %172 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %170 %171 + %173 = OpCompositeExtract %v4float %138 11 + %174 = OpCompositeExtract %v4float %139 11 + %175 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %173 %174 + %176 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %142 + %177 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %145 + %178 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %148 + %179 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %151 + %180 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %154 + %181 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %157 + %182 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %160 + %183 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %163 + %184 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %166 + %185 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %169 + %186 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %172 + %187 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %175 + %188 = OpLoad %_arr_v4float_uint_12 %in_var_VS_To_DS_Position + %189 = OpLoad %_arr_uint_uint_12 %in_var_VS_To_DS_VertexID + %190 = OpCompositeExtract %v4float %188 0 + %191 = OpCompositeExtract %uint %189 0 + %192 = OpCompositeConstruct %FHitProxyVSToDS %176 %190 %191 + %193 = OpCompositeExtract %v4float %188 1 + %194 = OpCompositeExtract %uint %189 1 + %195 = OpCompositeConstruct %FHitProxyVSToDS %177 %193 %194 + %196 = OpCompositeExtract %v4float %188 2 + %197 = OpCompositeExtract %uint %189 2 + %198 = OpCompositeConstruct %FHitProxyVSToDS %178 %196 %197 + %199 = OpCompositeExtract %v4float %188 3 + %200 = OpCompositeExtract %uint %189 3 + %201 = OpCompositeConstruct %FHitProxyVSToDS %179 %199 %200 + %202 = OpCompositeExtract %v4float %188 4 + %203 = OpCompositeExtract %uint %189 4 + %204 = OpCompositeConstruct %FHitProxyVSToDS %180 %202 %203 + %205 = OpCompositeExtract %v4float %188 5 + %206 = OpCompositeExtract %uint %189 5 + %207 = OpCompositeConstruct %FHitProxyVSToDS %181 %205 %206 + %208 = OpCompositeExtract %v4float %188 6 + %209 = OpCompositeExtract %uint %189 6 + %210 = OpCompositeConstruct %FHitProxyVSToDS %182 %208 %209 + %211 = OpCompositeExtract %v4float %188 7 + %212 = OpCompositeExtract %uint %189 7 + %213 = OpCompositeConstruct %FHitProxyVSToDS %183 %211 %212 + %214 = OpCompositeExtract %v4float %188 8 + %215 = OpCompositeExtract %uint %189 8 + %216 = OpCompositeConstruct %FHitProxyVSToDS %184 %214 %215 + %217 = OpCompositeExtract %v4float %188 9 + %218 = OpCompositeExtract %uint %189 9 + %219 = OpCompositeConstruct %FHitProxyVSToDS %185 %217 %218 + %220 = OpCompositeExtract %v4float %188 10 + %221 = OpCompositeExtract %uint %189 10 + %222 = OpCompositeConstruct %FHitProxyVSToDS %186 %220 %221 + %223 = OpCompositeExtract %v4float %188 11 + %224 = OpCompositeExtract %uint %189 11 + %225 = OpCompositeConstruct %FHitProxyVSToDS %187 %223 %224 + %226 = OpCompositeConstruct %_arr_FHitProxyVSToDS_uint_12 %192 %195 %198 %201 %204 %207 %210 %213 %216 %219 %222 %225 + OpStore %param_var_I %226 + %227 = OpLoad %uint %gl_InvocationID + %228 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %227 %int_0 + %229 = OpLoad %FVertexFactoryInterpolantsVSToDS %228 + %230 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %229 0 + %231 = OpCompositeExtract %v4float %230 0 + %232 = OpCompositeExtract %v4float %230 1 + %233 = OpVectorShuffle %v3float %231 %231 0 1 2 + %234 = OpVectorShuffle %v3float %232 %232 0 1 2 + %235 = OpExtInst %v3float %1 Cross %234 %233 + %236 = OpCompositeExtract %float %232 3 + %237 = OpCompositeConstruct %v3float %236 %236 %236 + %238 = OpFMul %v3float %235 %237 + %239 = OpCompositeConstruct %mat3v3float %233 %238 %234 + %240 = OpCompositeExtract %float %232 0 + %241 = OpCompositeExtract %float %232 1 + %242 = OpCompositeExtract %float %232 2 + %243 = OpCompositeConstruct %v4float %240 %241 %242 %float_0 + %244 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_15 + %245 = OpLoad %v4float %244 + %246 = OpVectorShuffle %v3float %245 %245 0 1 2 + %247 = OpVectorTimesMatrix %v3float %246 %239 + %248 = OpULessThan %bool %227 %uint_2 + %249 = OpIAdd %uint %227 %uint_1 + %250 = OpSelect %uint %248 %249 %uint_0 + %251 = OpIMul %uint %uint_2 %227 + %252 = OpIAdd %uint %uint_3 %251 + %253 = OpIAdd %uint %251 %uint_4 + %254 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %227 + %255 = OpLoad %FHitProxyVSToDS %254 + %256 = OpAccessChain %_ptr_Function_v4float %param_var_I %227 %int_1 + %257 = OpLoad %v4float %256 + %258 = OpULessThan %bool %250 %uint_2 + %259 = OpIAdd %uint %250 %uint_1 + %260 = OpSelect %uint %258 %259 %uint_0 + %261 = OpIMul %uint %uint_2 %250 + %262 = OpIAdd %uint %uint_3 %261 + %263 = OpIAdd %uint %261 %uint_4 + %264 = OpIAdd %uint %uint_9 %227 + %265 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %264 + %266 = OpLoad %FHitProxyVSToDS %265 + %267 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %266 0 + %268 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %267 0 + %269 = OpCompositeExtract %v4float %268 0 + %270 = OpCompositeExtract %v4float %268 1 + %271 = OpVectorShuffle %v3float %269 %269 0 1 2 + %272 = OpCompositeExtract %float %270 0 + %273 = OpCompositeExtract %float %270 1 + %274 = OpCompositeExtract %float %270 2 + %275 = OpCompositeConstruct %v4float %272 %273 %274 %float_0 + %276 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %250 + %277 = OpLoad %FHitProxyVSToDS %276 + %278 = OpCompositeExtract %uint %277 2 + %279 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %260 + %280 = OpLoad %FHitProxyVSToDS %279 + %281 = OpCompositeExtract %uint %280 2 + %282 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %262 + %283 = OpLoad %FHitProxyVSToDS %282 + %284 = OpCompositeExtract %uint %283 2 + %285 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %263 + %286 = OpLoad %FHitProxyVSToDS %285 + %287 = OpCompositeExtract %uint %286 2 + %288 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %277 0 + %289 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %288 0 + %290 = OpCompositeExtract %v4float %289 0 + %291 = OpCompositeExtract %v4float %289 1 + %292 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %280 0 + %293 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %292 0 + %294 = OpCompositeExtract %v4float %293 0 + %295 = OpCompositeExtract %v4float %293 1 + %296 = OpULessThan %bool %284 %278 + %297 = OpIEqual %bool %284 %278 + %298 = OpULessThan %bool %287 %281 + %299 = OpLogicalAnd %bool %297 %298 + %300 = OpLogicalOr %bool %296 %299 + OpSelectionMerge %301 None + OpBranchConditional %300 %302 %301 + %302 = OpLabel + %303 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %283 0 + %304 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %303 0 + %305 = OpCompositeExtract %v4float %304 0 + %306 = OpCompositeExtract %v4float %304 1 + %307 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %286 0 + %308 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %307 0 + %309 = OpCompositeExtract %v4float %308 0 + %310 = OpCompositeExtract %v4float %308 1 + OpBranch %301 + %301 = OpLabel + %311 = OpPhi %v4float %294 %137 %309 %302 + %312 = OpPhi %v4float %295 %137 %310 %302 + %313 = OpPhi %v4float %290 %137 %305 %302 + %314 = OpPhi %v4float %291 %137 %306 %302 + %315 = OpVectorShuffle %v3float %313 %313 0 1 2 + %316 = OpVectorShuffle %v3float %311 %311 0 1 2 + %317 = OpCompositeExtract %float %314 0 + %318 = OpCompositeExtract %float %314 1 + %319 = OpCompositeExtract %float %314 2 + %320 = OpCompositeConstruct %v4float %317 %318 %319 %float_0 + %321 = OpCompositeExtract %float %312 0 + %322 = OpCompositeExtract %float %312 1 + %323 = OpCompositeExtract %float %312 2 + %324 = OpCompositeConstruct %v4float %321 %322 %323 %float_0 + %325 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %250 %int_0 + %326 = OpLoad %FVertexFactoryInterpolantsVSToDS %325 + %327 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %326 0 + %328 = OpCompositeExtract %v4float %327 1 + %329 = OpCompositeExtract %float %328 0 + %330 = OpCompositeExtract %float %328 1 + %331 = OpCompositeExtract %float %328 2 + %332 = OpCompositeConstruct %v4float %329 %330 %331 %float_0 + %333 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %252 %int_0 + %334 = OpLoad %FVertexFactoryInterpolantsVSToDS %333 + %335 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %334 0 + %336 = OpCompositeExtract %v4float %335 1 + %337 = OpCompositeExtract %float %336 0 + %338 = OpCompositeExtract %float %336 1 + %339 = OpCompositeExtract %float %336 2 + %340 = OpCompositeConstruct %v4float %337 %338 %339 %float_0 + %341 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %253 %int_0 + %342 = OpLoad %FVertexFactoryInterpolantsVSToDS %341 + %343 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %342 0 + %344 = OpCompositeExtract %v4float %343 1 + %345 = OpCompositeExtract %float %344 0 + %346 = OpCompositeExtract %float %344 1 + %347 = OpCompositeExtract %float %344 2 + %348 = OpCompositeConstruct %v4float %345 %346 %347 %float_0 + %349 = OpLoad %v4float %256 + %350 = OpAccessChain %_ptr_Function_v4float %param_var_I %250 %int_1 + %351 = OpLoad %v4float %350 + %352 = OpFMul %v4float %63 %349 + %353 = OpFAdd %v4float %352 %351 + %354 = OpFSub %v4float %351 %349 + %355 = OpDot %float %354 %243 + %356 = OpCompositeConstruct %v4float %355 %355 %355 %355 + %357 = OpFMul %v4float %356 %243 + %358 = OpFSub %v4float %353 %357 + %359 = OpFMul %v4float %358 %132 + %360 = OpAccessChain %_ptr_Function_v4float %param_var_I %252 %int_1 + %361 = OpLoad %v4float %360 + %362 = OpAccessChain %_ptr_Function_v4float %param_var_I %253 %int_1 + %363 = OpLoad %v4float %362 + %364 = OpFMul %v4float %63 %361 + %365 = OpFAdd %v4float %364 %363 + %366 = OpFSub %v4float %363 %361 + %367 = OpDot %float %366 %340 + %368 = OpCompositeConstruct %v4float %367 %367 %367 %367 + %369 = OpFMul %v4float %368 %340 + %370 = OpFSub %v4float %365 %369 + %371 = OpFMul %v4float %370 %132 + %372 = OpFAdd %v4float %359 %371 + %373 = OpFMul %v4float %372 %133 + %374 = OpLoad %v4float %350 + %375 = OpLoad %v4float %256 + %376 = OpFMul %v4float %63 %374 + %377 = OpFAdd %v4float %376 %375 + %378 = OpFSub %v4float %375 %374 + %379 = OpDot %float %378 %332 + %380 = OpCompositeConstruct %v4float %379 %379 %379 %379 + %381 = OpFMul %v4float %380 %332 + %382 = OpFSub %v4float %377 %381 + %383 = OpFMul %v4float %382 %132 + %384 = OpLoad %v4float %362 + %385 = OpLoad %v4float %360 + %386 = OpFMul %v4float %63 %384 + %387 = OpFAdd %v4float %386 %385 + %388 = OpFSub %v4float %385 %384 + %389 = OpDot %float %388 %348 + %390 = OpCompositeConstruct %v4float %389 %389 %389 %389 + %391 = OpFMul %v4float %390 %348 + %392 = OpFSub %v4float %387 %391 + %393 = OpFMul %v4float %392 %132 + %394 = OpFAdd %v4float %383 %393 + %395 = OpFMul %v4float %394 %133 + %396 = OpCompositeConstruct %FHullShaderConstantDominantEdgeData %130 %130 %320 %324 %315 %316 + %397 = OpCompositeConstruct %FHullShaderConstantDominantVertexData %130 %275 %271 + %398 = OpCompositeConstruct %_arr_v4float_uint_3 %257 %373 %395 + %399 = OpCompositeConstruct %FPNTessellationHSToDS %255 %398 %247 %float_1 %float_1 %397 %396 + %400 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %255 0 + %401 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %400 0 + %402 = OpCompositeExtract %v4float %401 0 + %403 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD10_centroid %227 + OpStore %403 %402 + %404 = OpCompositeExtract %v4float %401 1 + %405 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD11_centroid %227 + OpStore %405 %404 + %406 = OpCompositeExtract %v4float %255 1 + %407 = OpAccessChain %_ptr_Output_v4float %out_var_VS_To_DS_Position %227 + OpStore %407 %406 + %408 = OpCompositeExtract %uint %255 2 + %409 = OpAccessChain %_ptr_Output_uint %out_var_VS_To_DS_VertexID %227 + OpStore %409 %408 + %410 = OpAccessChain %_ptr_Output__arr_v4float_uint_3 %out_var_PN_POSITION %227 + OpStore %410 %398 + %411 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DisplacementScales %227 + OpStore %411 %247 + %412 = OpAccessChain %_ptr_Output_float %out_var_PN_TessellationMultiplier %227 + OpStore %412 %float_1 + %413 = OpAccessChain %_ptr_Output_float %out_var_PN_WorldDisplacementMultiplier %227 + OpStore %413 %float_1 + %414 = OpAccessChain %_ptr_Output_v2float %out_var_PN_DominantVertex %227 + OpStore %414 %130 + %415 = OpAccessChain %_ptr_Output_v4float %out_var_PN_DominantVertex1 %227 + OpStore %415 %275 + %416 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DominantVertex2 %227 + OpStore %416 %271 + %417 = OpAccessChain %_ptr_Output_v2float %out_var_PN_DominantEdge %227 + OpStore %417 %130 + %418 = OpAccessChain %_ptr_Output_v2float %out_var_PN_DominantEdge1 %227 + OpStore %418 %130 + %419 = OpAccessChain %_ptr_Output_v4float %out_var_PN_DominantEdge2 %227 + OpStore %419 %320 + %420 = OpAccessChain %_ptr_Output_v4float %out_var_PN_DominantEdge3 %227 + OpStore %420 %324 + %421 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DominantEdge4 %227 + OpStore %421 %315 + %422 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DominantEdge5 %227 + OpStore %422 %316 + %423 = OpAccessChain %_ptr_Workgroup_FPNTessellationHSToDS %temp_var_hullMainRetVal %227 + OpStore %423 %399 + OpControlBarrier %uint_2 %uint_4 %uint_0 + %424 = OpIEqual %bool %227 %uint_0 + OpSelectionMerge %if_merge None + OpBranchConditional %424 %425 %if_merge + %425 = OpLabel + %426 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %427 = OpLoad %mat4v4float %426 + %428 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_7 + %429 = OpLoad %mat4v4float %428 + %430 = OpAccessChain %_ptr_Uniform_v3float %View %int_28 + %431 = OpLoad %v3float %430 + %432 = OpAccessChain %_ptr_Uniform_float %View %int_78 + %433 = OpLoad %float %432 + %434 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_0 + %435 = OpLoad %v4float %434 + %436 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_1 + %437 = OpLoad %v4float %436 + %438 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_2 + %439 = OpLoad %v4float %438 + %440 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_0 + %441 = OpLoad %v4float %440 + %442 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_1 + %443 = OpLoad %v4float %442 + %444 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_2 + %445 = OpLoad %v4float %444 + %446 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_0 + %447 = OpLoad %v4float %446 + %448 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_1 + %449 = OpLoad %v4float %448 + %450 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_2 + %451 = OpLoad %v4float %450 + %452 = OpFAdd %v4float %437 %439 + %453 = OpFAdd %v4float %452 %443 + %454 = OpFAdd %v4float %453 %445 + %455 = OpFAdd %v4float %454 %449 + %456 = OpFAdd %v4float %455 %451 + %457 = OpFMul %v4float %456 %135 + %458 = OpFAdd %v4float %447 %441 + %459 = OpFAdd %v4float %458 %435 + %460 = OpFMul %v4float %459 %132 + %461 = OpFSub %v4float %457 %460 + %462 = OpFMul %v4float %461 %133 + %463 = OpFAdd %v4float %457 %462 + %464 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_1 %int_3 + %465 = OpLoad %float %464 + %466 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_2 %int_3 + %467 = OpLoad %float %466 + %468 = OpFAdd %float %465 %467 + %469 = OpFMul %float %float_0_5 %468 + %470 = OpCompositeInsert %v4float %469 %136 0 + %471 = OpLoad %float %466 + %472 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_0 %int_3 + %473 = OpLoad %float %472 + %474 = OpFAdd %float %471 %473 + %475 = OpFMul %float %float_0_5 %474 + %476 = OpCompositeInsert %v4float %475 %470 1 + %477 = OpLoad %float %472 + %478 = OpLoad %float %464 + %479 = OpFAdd %float %477 %478 + %480 = OpFMul %float %float_0_5 %479 + %481 = OpCompositeInsert %v4float %480 %476 2 + %482 = OpLoad %float %472 + %483 = OpLoad %float %464 + %484 = OpFAdd %float %482 %483 + %485 = OpLoad %float %466 + %486 = OpFAdd %float %484 %485 + %487 = OpFMul %float %float_0_333000004 %486 + %488 = OpCompositeInsert %v4float %487 %481 3 + %489 = OpVectorShuffle %v3float %435 %435 0 1 2 + %490 = OpVectorShuffle %v3float %441 %441 0 1 2 + %491 = OpVectorShuffle %v3float %447 %447 0 1 2 + OpBranch %492 + %492 = OpLabel + OpLoopMerge %493 %494 None + OpBranch %495 + %495 = OpLabel + %496 = OpMatrixTimesVector %v4float %429 %77 + %497 = OpCompositeExtract %float %435 0 + %498 = OpCompositeExtract %float %435 1 + %499 = OpCompositeExtract %float %435 2 + %500 = OpCompositeConstruct %v4float %497 %498 %499 %float_1 + %501 = OpMatrixTimesVector %v4float %427 %500 + %502 = OpVectorShuffle %v3float %501 %501 0 1 2 + %503 = OpVectorShuffle %v3float %496 %496 0 1 2 + %504 = OpFSub %v3float %502 %503 + %505 = OpCompositeExtract %float %501 3 + %506 = OpCompositeExtract %float %496 3 + %507 = OpFAdd %float %505 %506 + %508 = OpCompositeConstruct %v3float %507 %507 %507 + %509 = OpFOrdLessThan %v3bool %504 %508 + %510 = OpSelect %v3int %509 %83 %74 + %511 = OpFAdd %v3float %502 %503 + %512 = OpFNegate %float %505 + %513 = OpFSub %float %512 %506 + %514 = OpCompositeConstruct %v3float %513 %513 %513 + %515 = OpFOrdGreaterThan %v3bool %511 %514 + %516 = OpSelect %v3int %515 %83 %74 + %517 = OpIMul %v3int %84 %516 + %518 = OpIAdd %v3int %510 %517 + %519 = OpCompositeExtract %float %441 0 + %520 = OpCompositeExtract %float %441 1 + %521 = OpCompositeExtract %float %441 2 + %522 = OpCompositeConstruct %v4float %519 %520 %521 %float_1 + %523 = OpMatrixTimesVector %v4float %427 %522 + %524 = OpVectorShuffle %v3float %523 %523 0 1 2 + %525 = OpFSub %v3float %524 %503 + %526 = OpCompositeExtract %float %523 3 + %527 = OpFAdd %float %526 %506 + %528 = OpCompositeConstruct %v3float %527 %527 %527 + %529 = OpFOrdLessThan %v3bool %525 %528 + %530 = OpSelect %v3int %529 %83 %74 + %531 = OpFAdd %v3float %524 %503 + %532 = OpFNegate %float %526 + %533 = OpFSub %float %532 %506 + %534 = OpCompositeConstruct %v3float %533 %533 %533 + %535 = OpFOrdGreaterThan %v3bool %531 %534 + %536 = OpSelect %v3int %535 %83 %74 + %537 = OpIMul %v3int %84 %536 + %538 = OpIAdd %v3int %530 %537 + %539 = OpBitwiseOr %v3int %518 %538 + %540 = OpCompositeExtract %float %447 0 + %541 = OpCompositeExtract %float %447 1 + %542 = OpCompositeExtract %float %447 2 + %543 = OpCompositeConstruct %v4float %540 %541 %542 %float_1 + %544 = OpMatrixTimesVector %v4float %427 %543 + %545 = OpVectorShuffle %v3float %544 %544 0 1 2 + %546 = OpFSub %v3float %545 %503 + %547 = OpCompositeExtract %float %544 3 + %548 = OpFAdd %float %547 %506 + %549 = OpCompositeConstruct %v3float %548 %548 %548 + %550 = OpFOrdLessThan %v3bool %546 %549 + %551 = OpSelect %v3int %550 %83 %74 + %552 = OpFAdd %v3float %545 %503 + %553 = OpFNegate %float %547 + %554 = OpFSub %float %553 %506 + %555 = OpCompositeConstruct %v3float %554 %554 %554 + %556 = OpFOrdGreaterThan %v3bool %552 %555 + %557 = OpSelect %v3int %556 %83 %74 + %558 = OpIMul %v3int %84 %557 + %559 = OpIAdd %v3int %551 %558 + %560 = OpBitwiseOr %v3int %539 %559 + %561 = OpINotEqual %v3bool %560 %75 + %562 = OpAny %bool %561 + OpSelectionMerge %563 None + OpBranchConditional %562 %564 %563 + %564 = OpLabel + OpBranch %493 + %563 = OpLabel + %565 = OpFSub %v3float %489 %490 + %566 = OpFSub %v3float %490 %491 + %567 = OpFSub %v3float %491 %489 + %568 = OpFAdd %v3float %489 %490 + %569 = OpFMul %v3float %78 %568 + %570 = OpFSub %v3float %569 %431 + %571 = OpFAdd %v3float %490 %491 + %572 = OpFMul %v3float %78 %571 + %573 = OpFSub %v3float %572 %431 + %574 = OpFAdd %v3float %491 %489 + %575 = OpFMul %v3float %78 %574 + %576 = OpFSub %v3float %575 %431 + %577 = OpDot %float %566 %566 + %578 = OpDot %float %573 %573 + %579 = OpFDiv %float %577 %578 + %580 = OpExtInst %float %1 Sqrt %579 + %581 = OpDot %float %567 %567 + %582 = OpDot %float %576 %576 + %583 = OpFDiv %float %581 %582 + %584 = OpExtInst %float %1 Sqrt %583 + %585 = OpDot %float %565 %565 + %586 = OpDot %float %570 %570 + %587 = OpFDiv %float %585 %586 + %588 = OpExtInst %float %1 Sqrt %587 + %589 = OpCompositeConstruct %v4float %580 %584 %588 %float_1 + %590 = OpFAdd %float %580 %584 + %591 = OpFAdd %float %590 %588 + %592 = OpFMul %float %float_0_333000004 %591 + %593 = OpCompositeInsert %v4float %592 %589 3 + %594 = OpCompositeConstruct %v4float %433 %433 %433 %433 + %595 = OpFMul %v4float %594 %593 + OpBranch %493 + %494 = OpLabel + OpBranch %492 + %493 = OpLabel + %596 = OpPhi %v4float %77 %564 %595 %563 + %597 = OpFMul %v4float %488 %596 + %598 = OpExtInst %v4float %1 FClamp %597 %68 %70 + %599 = OpCompositeExtract %float %598 0 + %600 = OpCompositeExtract %float %598 1 + %601 = OpCompositeExtract %float %598 2 + %602 = OpCompositeExtract %float %598 3 + %603 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_0 + OpStore %603 %599 + %604 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_1 + OpStore %604 %600 + %605 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_2 + OpStore %605 %601 + %606 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %uint_0 + OpStore %606 %602 + OpStore %out_var_PN_POSITION9 %463 + OpBranch %if_merge + %if_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc new file mode 100644 index 0000000000..1a9b95e085 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tesc/hs-texcoord-array.invalid.asm.tesc @@ -0,0 +1,1144 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 531 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %MainHull "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_COLOR0 %in_var_TEXCOORD0 %in_var_VS_To_DS_Position %gl_InvocationID %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_COLOR0 %out_var_TEXCOORD0 %out_var_VS_To_DS_Position %out_var_PN_POSITION %out_var_PN_DisplacementScales %out_var_PN_TessellationMultiplier %out_var_PN_WorldDisplacementMultiplier %gl_TessLevelOuter %gl_TessLevelInner %out_var_PN_POSITION9 + OpExecutionMode %MainHull Triangles + OpExecutionMode %MainHull SpacingFractionalOdd + OpExecutionMode %MainHull VertexOrderCw + OpExecutionMode %MainHull OutputVertices 3 + OpSource HLSL 600 + OpName %FPNTessellationHSToDS "FPNTessellationHSToDS" + OpMemberName %FPNTessellationHSToDS 0 "PassSpecificData" + OpMemberName %FPNTessellationHSToDS 1 "WorldPosition" + OpMemberName %FPNTessellationHSToDS 2 "DisplacementScale" + OpMemberName %FPNTessellationHSToDS 3 "TessellationMultiplier" + OpMemberName %FPNTessellationHSToDS 4 "WorldDisplacementMultiplier" + OpName %FHitProxyVSToDS "FHitProxyVSToDS" + OpMemberName %FHitProxyVSToDS 0 "FactoryInterpolants" + OpMemberName %FHitProxyVSToDS 1 "Position" + OpName %FVertexFactoryInterpolantsVSToDS "FVertexFactoryInterpolantsVSToDS" + OpMemberName %FVertexFactoryInterpolantsVSToDS 0 "InterpolantsVSToPS" + OpName %FVertexFactoryInterpolantsVSToPS "FVertexFactoryInterpolantsVSToPS" + OpMemberName %FVertexFactoryInterpolantsVSToPS 0 "TangentToWorld0" + OpMemberName %FVertexFactoryInterpolantsVSToPS 1 "TangentToWorld2" + OpMemberName %FVertexFactoryInterpolantsVSToPS 2 "Color" + OpMemberName %FVertexFactoryInterpolantsVSToPS 3 "TexCoords" + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_Primitive "type.Primitive" + OpMemberName %type_Primitive 0 "Primitive_LocalToWorld" + OpMemberName %type_Primitive 1 "Primitive_InvNonUniformScaleAndDeterminantSign" + OpMemberName %type_Primitive 2 "Primitive_ObjectWorldPositionAndRadius" + OpMemberName %type_Primitive 3 "Primitive_WorldToLocal" + OpMemberName %type_Primitive 4 "Primitive_PreviousLocalToWorld" + OpMemberName %type_Primitive 5 "Primitive_PreviousWorldToLocal" + OpMemberName %type_Primitive 6 "Primitive_ActorWorldPosition" + OpMemberName %type_Primitive 7 "Primitive_UseSingleSampleShadowFromStationaryLights" + OpMemberName %type_Primitive 8 "Primitive_ObjectBounds" + OpMemberName %type_Primitive 9 "Primitive_LpvBiasMultiplier" + OpMemberName %type_Primitive 10 "Primitive_DecalReceiverMask" + OpMemberName %type_Primitive 11 "Primitive_PerObjectGBufferData" + OpMemberName %type_Primitive 12 "Primitive_UseVolumetricLightmapShadowFromStationaryLights" + OpMemberName %type_Primitive 13 "Primitive_DrawsVelocity" + OpMemberName %type_Primitive 14 "Primitive_ObjectOrientation" + OpMemberName %type_Primitive 15 "Primitive_NonUniformScale" + OpMemberName %type_Primitive 16 "Primitive_LocalObjectBoundsMin" + OpMemberName %type_Primitive 17 "Primitive_LightingChannelMask" + OpMemberName %type_Primitive 18 "Primitive_LocalObjectBoundsMax" + OpMemberName %type_Primitive 19 "Primitive_LightmapDataIndex" + OpMemberName %type_Primitive 20 "Primitive_PreSkinnedLocalBounds" + OpMemberName %type_Primitive 21 "Primitive_SingleCaptureIndex" + OpMemberName %type_Primitive 22 "Primitive_OutputVelocity" + OpMemberName %type_Primitive 23 "PrePadding_Primitive_420" + OpMemberName %type_Primitive 24 "PrePadding_Primitive_424" + OpMemberName %type_Primitive 25 "PrePadding_Primitive_428" + OpMemberName %type_Primitive 26 "Primitive_CustomPrimitiveData" + OpName %Primitive "Primitive" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_COLOR0 "in.var.COLOR0" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_COLOR0 "out.var.COLOR0" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_VS_To_DS_Position "out.var.VS_To_DS_Position" + OpName %out_var_PN_POSITION "out.var.PN_POSITION" + OpName %out_var_PN_DisplacementScales "out.var.PN_DisplacementScales" + OpName %out_var_PN_TessellationMultiplier "out.var.PN_TessellationMultiplier" + OpName %out_var_PN_WorldDisplacementMultiplier "out.var.PN_WorldDisplacementMultiplier" + OpName %out_var_PN_POSITION9 "out.var.PN_POSITION9" + OpName %MainHull "MainHull" + OpName %param_var_I "param.var.I" + OpName %temp_var_hullMainRetVal "temp.var.hullMainRetVal" + OpName %if_merge "if.merge" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorateString %gl_InvocationID UserSemantic "SV_OutputControlPointID" + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %out_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %out_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %out_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %out_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %out_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %out_var_PN_POSITION9 Patch + OpDecorate %in_var_TEXCOORD10_centroid Location 0 + OpDecorate %in_var_TEXCOORD11_centroid Location 1 + OpDecorate %in_var_COLOR0 Location 2 + OpDecorate %in_var_TEXCOORD0 Location 3 + OpDecorate %in_var_VS_To_DS_Position Location 5 + OpDecorate %out_var_COLOR0 Location 0 + OpDecorate %out_var_PN_DisplacementScales Location 1 + OpDecorate %out_var_PN_POSITION Location 2 + OpDecorate %out_var_PN_POSITION9 Location 5 + OpDecorate %out_var_PN_TessellationMultiplier Location 6 + OpDecorate %out_var_PN_WorldDisplacementMultiplier Location 7 + OpDecorate %out_var_TEXCOORD0 Location 8 + OpDecorate %out_var_TEXCOORD10_centroid Location 10 + OpDecorate %out_var_TEXCOORD11_centroid Location 11 + OpDecorate %out_var_VS_To_DS_Position Location 12 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %Primitive DescriptorSet 0 + OpDecorate %Primitive Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpDecorate %type_View Block + OpMemberDecorate %type_Primitive 0 Offset 0 + OpMemberDecorate %type_Primitive 0 MatrixStride 16 + OpMemberDecorate %type_Primitive 0 ColMajor + OpMemberDecorate %type_Primitive 1 Offset 64 + OpMemberDecorate %type_Primitive 2 Offset 80 + OpMemberDecorate %type_Primitive 3 Offset 96 + OpMemberDecorate %type_Primitive 3 MatrixStride 16 + OpMemberDecorate %type_Primitive 3 ColMajor + OpMemberDecorate %type_Primitive 4 Offset 160 + OpMemberDecorate %type_Primitive 4 MatrixStride 16 + OpMemberDecorate %type_Primitive 4 ColMajor + OpMemberDecorate %type_Primitive 5 Offset 224 + OpMemberDecorate %type_Primitive 5 MatrixStride 16 + OpMemberDecorate %type_Primitive 5 ColMajor + OpMemberDecorate %type_Primitive 6 Offset 288 + OpMemberDecorate %type_Primitive 7 Offset 300 + OpMemberDecorate %type_Primitive 8 Offset 304 + OpMemberDecorate %type_Primitive 9 Offset 316 + OpMemberDecorate %type_Primitive 10 Offset 320 + OpMemberDecorate %type_Primitive 11 Offset 324 + OpMemberDecorate %type_Primitive 12 Offset 328 + OpMemberDecorate %type_Primitive 13 Offset 332 + OpMemberDecorate %type_Primitive 14 Offset 336 + OpMemberDecorate %type_Primitive 15 Offset 352 + OpMemberDecorate %type_Primitive 16 Offset 368 + OpMemberDecorate %type_Primitive 17 Offset 380 + OpMemberDecorate %type_Primitive 18 Offset 384 + OpMemberDecorate %type_Primitive 19 Offset 396 + OpMemberDecorate %type_Primitive 20 Offset 400 + OpMemberDecorate %type_Primitive 21 Offset 412 + OpMemberDecorate %type_Primitive 22 Offset 416 + OpMemberDecorate %type_Primitive 23 Offset 420 + OpMemberDecorate %type_Primitive 24 Offset 424 + OpMemberDecorate %type_Primitive 25 Offset 428 + OpMemberDecorate %type_Primitive 26 Offset 432 + OpDecorate %type_Primitive Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float_2 = OpConstant %float 2 + %54 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 + %float_0_5 = OpConstant %float 0.5 + %int_3 = OpConstant %int 3 +%float_0_333000004 = OpConstant %float 0.333000004 + %float_1 = OpConstant %float 1 + %59 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_15 = OpConstant %float 15 + %61 = OpConstantComposite %v4float %float_15 %float_15 %float_15 %float_15 +%_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2 +%FVertexFactoryInterpolantsVSToPS = OpTypeStruct %v4float %v4float %v4float %_arr_v2float_uint_2 +%FVertexFactoryInterpolantsVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToPS +%FHitProxyVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToDS %v4float +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%FPNTessellationHSToDS = OpTypeStruct %FHitProxyVSToDS %_arr_v4float_uint_3 %v3float %float %float + %v3int = OpTypeVector %int 3 + %65 = OpConstantComposite %v3int %int_0 %int_0 %int_0 + %66 = OpConstantComposite %v3int %int_3 %int_3 %int_3 + %float_0 = OpConstant %float 0 + %68 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %69 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %int_78 = OpConstant %int 78 + %int_15 = OpConstant %int 15 + %int_7 = OpConstant %int 7 + %int_28 = OpConstant %int 28 + %74 = OpConstantComposite %v3int %int_1 %int_1 %int_1 + %75 = OpConstantComposite %v3int %int_2 %int_2 %int_2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_Primitive = OpTypeStruct %mat4v4float %v4float %v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %float %float %float %float %v4float %v4float %v3float %uint %v3float %uint %v3float %int %uint %uint %uint %uint %_arr_v4float_uint_4 +%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive + %uint_12 = OpConstant %uint 12 +%_arr_v4float_uint_12 = OpTypeArray %v4float %uint_12 +%_ptr_Input__arr_v4float_uint_12 = OpTypePointer Input %_arr_v4float_uint_12 +%_arr__arr_v2float_uint_2_uint_12 = OpTypeArray %_arr_v2float_uint_2 %uint_12 +%_ptr_Input__arr__arr_v2float_uint_2_uint_12 = OpTypePointer Input %_arr__arr_v2float_uint_2_uint_12 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 +%_arr__arr_v2float_uint_2_uint_3 = OpTypeArray %_arr_v2float_uint_2 %uint_3 +%_ptr_Output__arr__arr_v2float_uint_2_uint_3 = OpTypePointer Output %_arr__arr_v2float_uint_2_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Output__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Output %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %98 = OpTypeFunction %void +%_arr_FHitProxyVSToDS_uint_12 = OpTypeArray %FHitProxyVSToDS %uint_12 +%_ptr_Function__arr_FHitProxyVSToDS_uint_12 = OpTypePointer Function %_arr_FHitProxyVSToDS_uint_12 +%_arr_FPNTessellationHSToDS_uint_3 = OpTypeArray %FPNTessellationHSToDS %uint_3 +%_ptr_Function__arr_FPNTessellationHSToDS_uint_3 = OpTypePointer Function %_arr_FPNTessellationHSToDS_uint_3 +%_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 = OpTypePointer Workgroup %_arr_FPNTessellationHSToDS_uint_3 +%_ptr_Output__arr_v2float_uint_2 = OpTypePointer Output %_arr_v2float_uint_2 +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Function_FPNTessellationHSToDS = OpTypePointer Function %FPNTessellationHSToDS +%_ptr_Workgroup_FPNTessellationHSToDS = OpTypePointer Workgroup %FPNTessellationHSToDS + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_FVertexFactoryInterpolantsVSToDS = OpTypePointer Function %FVertexFactoryInterpolantsVSToDS +%_ptr_Function_FHitProxyVSToDS = OpTypePointer Function %FHitProxyVSToDS + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %View = OpVariable %_ptr_Uniform_type_View Uniform + %Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_COLOR0 = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr__arr_v2float_uint_2_uint_12 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_12 Input +%gl_InvocationID = OpVariable %_ptr_Input_uint Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_COLOR0 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_TEXCOORD0 = OpVariable %_ptr_Output__arr__arr_v2float_uint_2_uint_3 Output +%out_var_VS_To_DS_Position = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%out_var_PN_POSITION = OpVariable %_ptr_Output__arr__arr_v4float_uint_3_uint_3 Output +%out_var_PN_DisplacementScales = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_PN_TessellationMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%out_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output +%out_var_PN_POSITION9 = OpVariable %_ptr_Output_v4float Output +%float_0_333333343 = OpConstant %float 0.333333343 + %119 = OpConstantComposite %v4float %float_0_333333343 %float_0_333333343 %float_0_333333343 %float_0_333333343 + %120 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%float_0_166666672 = OpConstant %float 0.166666672 + %122 = OpConstantComposite %v4float %float_0_166666672 %float_0_166666672 %float_0_166666672 %float_0_166666672 + %123 = OpUndef %v4float + +; XXX: Original asm used Function here, which is wrong. +; This patches the SPIR-V to be correct. +%temp_var_hullMainRetVal = OpVariable %_ptr_Workgroup__arr_FPNTessellationHSToDS_uint_3 Workgroup + + %MainHull = OpFunction %void None %98 + %124 = OpLabel +%param_var_I = OpVariable %_ptr_Function__arr_FHitProxyVSToDS_uint_12 Function + %125 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD10_centroid + %126 = OpLoad %_arr_v4float_uint_12 %in_var_TEXCOORD11_centroid + %127 = OpLoad %_arr_v4float_uint_12 %in_var_COLOR0 + %128 = OpLoad %_arr__arr_v2float_uint_2_uint_12 %in_var_TEXCOORD0 + %129 = OpCompositeExtract %v4float %125 0 + %130 = OpCompositeExtract %v4float %126 0 + %131 = OpCompositeExtract %v4float %127 0 + %132 = OpCompositeExtract %_arr_v2float_uint_2 %128 0 + %133 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %129 %130 %131 %132 + %134 = OpCompositeExtract %v4float %125 1 + %135 = OpCompositeExtract %v4float %126 1 + %136 = OpCompositeExtract %v4float %127 1 + %137 = OpCompositeExtract %_arr_v2float_uint_2 %128 1 + %138 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %134 %135 %136 %137 + %139 = OpCompositeExtract %v4float %125 2 + %140 = OpCompositeExtract %v4float %126 2 + %141 = OpCompositeExtract %v4float %127 2 + %142 = OpCompositeExtract %_arr_v2float_uint_2 %128 2 + %143 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %139 %140 %141 %142 + %144 = OpCompositeExtract %v4float %125 3 + %145 = OpCompositeExtract %v4float %126 3 + %146 = OpCompositeExtract %v4float %127 3 + %147 = OpCompositeExtract %_arr_v2float_uint_2 %128 3 + %148 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %144 %145 %146 %147 + %149 = OpCompositeExtract %v4float %125 4 + %150 = OpCompositeExtract %v4float %126 4 + %151 = OpCompositeExtract %v4float %127 4 + %152 = OpCompositeExtract %_arr_v2float_uint_2 %128 4 + %153 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %149 %150 %151 %152 + %154 = OpCompositeExtract %v4float %125 5 + %155 = OpCompositeExtract %v4float %126 5 + %156 = OpCompositeExtract %v4float %127 5 + %157 = OpCompositeExtract %_arr_v2float_uint_2 %128 5 + %158 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %154 %155 %156 %157 + %159 = OpCompositeExtract %v4float %125 6 + %160 = OpCompositeExtract %v4float %126 6 + %161 = OpCompositeExtract %v4float %127 6 + %162 = OpCompositeExtract %_arr_v2float_uint_2 %128 6 + %163 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %159 %160 %161 %162 + %164 = OpCompositeExtract %v4float %125 7 + %165 = OpCompositeExtract %v4float %126 7 + %166 = OpCompositeExtract %v4float %127 7 + %167 = OpCompositeExtract %_arr_v2float_uint_2 %128 7 + %168 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %164 %165 %166 %167 + %169 = OpCompositeExtract %v4float %125 8 + %170 = OpCompositeExtract %v4float %126 8 + %171 = OpCompositeExtract %v4float %127 8 + %172 = OpCompositeExtract %_arr_v2float_uint_2 %128 8 + %173 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %169 %170 %171 %172 + %174 = OpCompositeExtract %v4float %125 9 + %175 = OpCompositeExtract %v4float %126 9 + %176 = OpCompositeExtract %v4float %127 9 + %177 = OpCompositeExtract %_arr_v2float_uint_2 %128 9 + %178 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %174 %175 %176 %177 + %179 = OpCompositeExtract %v4float %125 10 + %180 = OpCompositeExtract %v4float %126 10 + %181 = OpCompositeExtract %v4float %127 10 + %182 = OpCompositeExtract %_arr_v2float_uint_2 %128 10 + %183 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %179 %180 %181 %182 + %184 = OpCompositeExtract %v4float %125 11 + %185 = OpCompositeExtract %v4float %126 11 + %186 = OpCompositeExtract %v4float %127 11 + %187 = OpCompositeExtract %_arr_v2float_uint_2 %128 11 + %188 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %184 %185 %186 %187 + %189 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %133 + %190 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %138 + %191 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %143 + %192 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %148 + %193 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %153 + %194 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %158 + %195 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %163 + %196 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %168 + %197 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %173 + %198 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %178 + %199 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %183 + %200 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %188 + %201 = OpLoad %_arr_v4float_uint_12 %in_var_VS_To_DS_Position + %202 = OpCompositeExtract %v4float %201 0 + %203 = OpCompositeConstruct %FHitProxyVSToDS %189 %202 + %204 = OpCompositeExtract %v4float %201 1 + %205 = OpCompositeConstruct %FHitProxyVSToDS %190 %204 + %206 = OpCompositeExtract %v4float %201 2 + %207 = OpCompositeConstruct %FHitProxyVSToDS %191 %206 + %208 = OpCompositeExtract %v4float %201 3 + %209 = OpCompositeConstruct %FHitProxyVSToDS %192 %208 + %210 = OpCompositeExtract %v4float %201 4 + %211 = OpCompositeConstruct %FHitProxyVSToDS %193 %210 + %212 = OpCompositeExtract %v4float %201 5 + %213 = OpCompositeConstruct %FHitProxyVSToDS %194 %212 + %214 = OpCompositeExtract %v4float %201 6 + %215 = OpCompositeConstruct %FHitProxyVSToDS %195 %214 + %216 = OpCompositeExtract %v4float %201 7 + %217 = OpCompositeConstruct %FHitProxyVSToDS %196 %216 + %218 = OpCompositeExtract %v4float %201 8 + %219 = OpCompositeConstruct %FHitProxyVSToDS %197 %218 + %220 = OpCompositeExtract %v4float %201 9 + %221 = OpCompositeConstruct %FHitProxyVSToDS %198 %220 + %222 = OpCompositeExtract %v4float %201 10 + %223 = OpCompositeConstruct %FHitProxyVSToDS %199 %222 + %224 = OpCompositeExtract %v4float %201 11 + %225 = OpCompositeConstruct %FHitProxyVSToDS %200 %224 + %226 = OpCompositeConstruct %_arr_FHitProxyVSToDS_uint_12 %203 %205 %207 %209 %211 %213 %215 %217 %219 %221 %223 %225 + OpStore %param_var_I %226 + %227 = OpLoad %uint %gl_InvocationID + %228 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %227 %int_0 + %229 = OpLoad %FVertexFactoryInterpolantsVSToDS %228 + %230 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %229 0 + %231 = OpCompositeExtract %v4float %230 0 + %232 = OpCompositeExtract %v4float %230 1 + %233 = OpVectorShuffle %v3float %231 %231 0 1 2 + %234 = OpVectorShuffle %v3float %232 %232 0 1 2 + %235 = OpExtInst %v3float %1 Cross %234 %233 + %236 = OpCompositeExtract %float %232 3 + %237 = OpCompositeConstruct %v3float %236 %236 %236 + %238 = OpFMul %v3float %235 %237 + %239 = OpCompositeConstruct %mat3v3float %233 %238 %234 + %240 = OpCompositeExtract %float %232 0 + %241 = OpCompositeExtract %float %232 1 + %242 = OpCompositeExtract %float %232 2 + %243 = OpCompositeConstruct %v4float %240 %241 %242 %float_0 + %244 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_15 + %245 = OpLoad %v4float %244 + %246 = OpVectorShuffle %v3float %245 %245 0 1 2 + %247 = OpVectorTimesMatrix %v3float %246 %239 + %248 = OpULessThan %bool %227 %uint_2 + %249 = OpIAdd %uint %227 %uint_1 + %250 = OpSelect %uint %248 %249 %uint_0 + %251 = OpIMul %uint %uint_2 %227 + %252 = OpIAdd %uint %uint_3 %251 + %253 = OpIAdd %uint %251 %uint_4 + %254 = OpAccessChain %_ptr_Function_FHitProxyVSToDS %param_var_I %227 + %255 = OpLoad %FHitProxyVSToDS %254 + %256 = OpAccessChain %_ptr_Function_v4float %param_var_I %227 %int_1 + %257 = OpLoad %v4float %256 + %258 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %250 %int_0 + %259 = OpLoad %FVertexFactoryInterpolantsVSToDS %258 + %260 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %259 0 + %261 = OpCompositeExtract %v4float %260 1 + %262 = OpCompositeExtract %float %261 0 + %263 = OpCompositeExtract %float %261 1 + %264 = OpCompositeExtract %float %261 2 + %265 = OpCompositeConstruct %v4float %262 %263 %264 %float_0 + %266 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %252 %int_0 + %267 = OpLoad %FVertexFactoryInterpolantsVSToDS %266 + %268 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %267 0 + %269 = OpCompositeExtract %v4float %268 1 + %270 = OpCompositeExtract %float %269 0 + %271 = OpCompositeExtract %float %269 1 + %272 = OpCompositeExtract %float %269 2 + %273 = OpCompositeConstruct %v4float %270 %271 %272 %float_0 + %274 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %253 %int_0 + %275 = OpLoad %FVertexFactoryInterpolantsVSToDS %274 + %276 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %275 0 + %277 = OpCompositeExtract %v4float %276 1 + %278 = OpCompositeExtract %float %277 0 + %279 = OpCompositeExtract %float %277 1 + %280 = OpCompositeExtract %float %277 2 + %281 = OpCompositeConstruct %v4float %278 %279 %280 %float_0 + %282 = OpLoad %v4float %256 + %283 = OpAccessChain %_ptr_Function_v4float %param_var_I %250 %int_1 + %284 = OpLoad %v4float %283 + %285 = OpFMul %v4float %54 %282 + %286 = OpFAdd %v4float %285 %284 + %287 = OpFSub %v4float %284 %282 + %288 = OpDot %float %287 %243 + %289 = OpCompositeConstruct %v4float %288 %288 %288 %288 + %290 = OpFMul %v4float %289 %243 + %291 = OpFSub %v4float %286 %290 + %292 = OpFMul %v4float %291 %119 + %293 = OpAccessChain %_ptr_Function_v4float %param_var_I %252 %int_1 + %294 = OpLoad %v4float %293 + %295 = OpAccessChain %_ptr_Function_v4float %param_var_I %253 %int_1 + %296 = OpLoad %v4float %295 + %297 = OpFMul %v4float %54 %294 + %298 = OpFAdd %v4float %297 %296 + %299 = OpFSub %v4float %296 %294 + %300 = OpDot %float %299 %273 + %301 = OpCompositeConstruct %v4float %300 %300 %300 %300 + %302 = OpFMul %v4float %301 %273 + %303 = OpFSub %v4float %298 %302 + %304 = OpFMul %v4float %303 %119 + %305 = OpFAdd %v4float %292 %304 + %306 = OpFMul %v4float %305 %120 + %307 = OpLoad %v4float %283 + %308 = OpLoad %v4float %256 + %309 = OpFMul %v4float %54 %307 + %310 = OpFAdd %v4float %309 %308 + %311 = OpFSub %v4float %308 %307 + %312 = OpDot %float %311 %265 + %313 = OpCompositeConstruct %v4float %312 %312 %312 %312 + %314 = OpFMul %v4float %313 %265 + %315 = OpFSub %v4float %310 %314 + %316 = OpFMul %v4float %315 %119 + %317 = OpLoad %v4float %295 + %318 = OpLoad %v4float %293 + %319 = OpFMul %v4float %54 %317 + %320 = OpFAdd %v4float %319 %318 + %321 = OpFSub %v4float %318 %317 + %322 = OpDot %float %321 %281 + %323 = OpCompositeConstruct %v4float %322 %322 %322 %322 + %324 = OpFMul %v4float %323 %281 + %325 = OpFSub %v4float %320 %324 + %326 = OpFMul %v4float %325 %119 + %327 = OpFAdd %v4float %316 %326 + %328 = OpFMul %v4float %327 %120 + %329 = OpCompositeConstruct %_arr_v4float_uint_3 %257 %306 %328 + %330 = OpCompositeConstruct %FPNTessellationHSToDS %255 %329 %247 %float_1 %float_1 + %331 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %255 0 + %332 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %331 0 + %333 = OpCompositeExtract %v4float %332 0 + %334 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD10_centroid %227 + OpStore %334 %333 + %335 = OpCompositeExtract %v4float %332 1 + %336 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD11_centroid %227 + OpStore %336 %335 + %337 = OpCompositeExtract %v4float %332 2 + %338 = OpAccessChain %_ptr_Output_v4float %out_var_COLOR0 %227 + OpStore %338 %337 + %339 = OpCompositeExtract %_arr_v2float_uint_2 %332 3 + %340 = OpAccessChain %_ptr_Output__arr_v2float_uint_2 %out_var_TEXCOORD0 %227 + OpStore %340 %339 + %341 = OpCompositeExtract %v4float %255 1 + %342 = OpAccessChain %_ptr_Output_v4float %out_var_VS_To_DS_Position %227 + OpStore %342 %341 + %343 = OpAccessChain %_ptr_Output__arr_v4float_uint_3 %out_var_PN_POSITION %227 + OpStore %343 %329 + %344 = OpAccessChain %_ptr_Output_v3float %out_var_PN_DisplacementScales %227 + OpStore %344 %247 + %345 = OpAccessChain %_ptr_Output_float %out_var_PN_TessellationMultiplier %227 + OpStore %345 %float_1 + %346 = OpAccessChain %_ptr_Output_float %out_var_PN_WorldDisplacementMultiplier %227 + OpStore %346 %float_1 + %347 = OpAccessChain %_ptr_Workgroup_FPNTessellationHSToDS %temp_var_hullMainRetVal %227 + OpStore %347 %330 + OpControlBarrier %uint_2 %uint_4 %uint_0 + %348 = OpIEqual %bool %227 %uint_0 + OpSelectionMerge %if_merge None + OpBranchConditional %348 %349 %if_merge + %349 = OpLabel + %350 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %351 = OpLoad %mat4v4float %350 + %352 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_7 + %353 = OpLoad %mat4v4float %352 + %354 = OpAccessChain %_ptr_Uniform_v3float %View %int_28 + %355 = OpLoad %v3float %354 + %356 = OpAccessChain %_ptr_Uniform_float %View %int_78 + %357 = OpLoad %float %356 + %358 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_0 + %359 = OpLoad %v4float %358 + %360 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_1 + %361 = OpLoad %v4float %360 + %362 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_0 %int_1 %int_2 + %363 = OpLoad %v4float %362 + %364 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_0 + %365 = OpLoad %v4float %364 + %366 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_1 + %367 = OpLoad %v4float %366 + %368 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_1 %int_1 %int_2 + %369 = OpLoad %v4float %368 + %370 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_0 + %371 = OpLoad %v4float %370 + %372 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_1 + %373 = OpLoad %v4float %372 + %374 = OpAccessChain %_ptr_Workgroup_v4float %temp_var_hullMainRetVal %uint_2 %int_1 %int_2 + %375 = OpLoad %v4float %374 + %376 = OpFAdd %v4float %361 %363 + %377 = OpFAdd %v4float %376 %367 + %378 = OpFAdd %v4float %377 %369 + %379 = OpFAdd %v4float %378 %373 + %380 = OpFAdd %v4float %379 %375 + %381 = OpFMul %v4float %380 %122 + %382 = OpFAdd %v4float %371 %365 + %383 = OpFAdd %v4float %382 %359 + %384 = OpFMul %v4float %383 %119 + %385 = OpFSub %v4float %381 %384 + %386 = OpFMul %v4float %385 %120 + %387 = OpFAdd %v4float %381 %386 + %388 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_1 %int_3 + %389 = OpLoad %float %388 + %390 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_2 %int_3 + %391 = OpLoad %float %390 + %392 = OpFAdd %float %389 %391 + %393 = OpFMul %float %float_0_5 %392 + %394 = OpCompositeInsert %v4float %393 %123 0 + %395 = OpLoad %float %390 + %396 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_0 %int_3 + %397 = OpLoad %float %396 + %398 = OpFAdd %float %395 %397 + %399 = OpFMul %float %float_0_5 %398 + %400 = OpCompositeInsert %v4float %399 %394 1 + %401 = OpLoad %float %396 + %402 = OpLoad %float %388 + %403 = OpFAdd %float %401 %402 + %404 = OpFMul %float %float_0_5 %403 + %405 = OpCompositeInsert %v4float %404 %400 2 + %406 = OpLoad %float %396 + %407 = OpLoad %float %388 + %408 = OpFAdd %float %406 %407 + %409 = OpLoad %float %390 + %410 = OpFAdd %float %408 %409 + %411 = OpFMul %float %float_0_333000004 %410 + %412 = OpCompositeInsert %v4float %411 %405 3 + %413 = OpVectorShuffle %v3float %359 %359 0 1 2 + %414 = OpVectorShuffle %v3float %365 %365 0 1 2 + %415 = OpVectorShuffle %v3float %371 %371 0 1 2 + OpBranch %416 + %416 = OpLabel + OpLoopMerge %417 %418 None + OpBranch %419 + %419 = OpLabel + %420 = OpMatrixTimesVector %v4float %353 %68 + %421 = OpCompositeExtract %float %359 0 + %422 = OpCompositeExtract %float %359 1 + %423 = OpCompositeExtract %float %359 2 + %424 = OpCompositeConstruct %v4float %421 %422 %423 %float_1 + %425 = OpMatrixTimesVector %v4float %351 %424 + %426 = OpVectorShuffle %v3float %425 %425 0 1 2 + %427 = OpVectorShuffle %v3float %420 %420 0 1 2 + %428 = OpFSub %v3float %426 %427 + %429 = OpCompositeExtract %float %425 3 + %430 = OpCompositeExtract %float %420 3 + %431 = OpFAdd %float %429 %430 + %432 = OpCompositeConstruct %v3float %431 %431 %431 + %433 = OpFOrdLessThan %v3bool %428 %432 + %434 = OpSelect %v3int %433 %74 %65 + %435 = OpFAdd %v3float %426 %427 + %436 = OpFNegate %float %429 + %437 = OpFSub %float %436 %430 + %438 = OpCompositeConstruct %v3float %437 %437 %437 + %439 = OpFOrdGreaterThan %v3bool %435 %438 + %440 = OpSelect %v3int %439 %74 %65 + %441 = OpIMul %v3int %75 %440 + %442 = OpIAdd %v3int %434 %441 + %443 = OpCompositeExtract %float %365 0 + %444 = OpCompositeExtract %float %365 1 + %445 = OpCompositeExtract %float %365 2 + %446 = OpCompositeConstruct %v4float %443 %444 %445 %float_1 + %447 = OpMatrixTimesVector %v4float %351 %446 + %448 = OpVectorShuffle %v3float %447 %447 0 1 2 + %449 = OpFSub %v3float %448 %427 + %450 = OpCompositeExtract %float %447 3 + %451 = OpFAdd %float %450 %430 + %452 = OpCompositeConstruct %v3float %451 %451 %451 + %453 = OpFOrdLessThan %v3bool %449 %452 + %454 = OpSelect %v3int %453 %74 %65 + %455 = OpFAdd %v3float %448 %427 + %456 = OpFNegate %float %450 + %457 = OpFSub %float %456 %430 + %458 = OpCompositeConstruct %v3float %457 %457 %457 + %459 = OpFOrdGreaterThan %v3bool %455 %458 + %460 = OpSelect %v3int %459 %74 %65 + %461 = OpIMul %v3int %75 %460 + %462 = OpIAdd %v3int %454 %461 + %463 = OpBitwiseOr %v3int %442 %462 + %464 = OpCompositeExtract %float %371 0 + %465 = OpCompositeExtract %float %371 1 + %466 = OpCompositeExtract %float %371 2 + %467 = OpCompositeConstruct %v4float %464 %465 %466 %float_1 + %468 = OpMatrixTimesVector %v4float %351 %467 + %469 = OpVectorShuffle %v3float %468 %468 0 1 2 + %470 = OpFSub %v3float %469 %427 + %471 = OpCompositeExtract %float %468 3 + %472 = OpFAdd %float %471 %430 + %473 = OpCompositeConstruct %v3float %472 %472 %472 + %474 = OpFOrdLessThan %v3bool %470 %473 + %475 = OpSelect %v3int %474 %74 %65 + %476 = OpFAdd %v3float %469 %427 + %477 = OpFNegate %float %471 + %478 = OpFSub %float %477 %430 + %479 = OpCompositeConstruct %v3float %478 %478 %478 + %480 = OpFOrdGreaterThan %v3bool %476 %479 + %481 = OpSelect %v3int %480 %74 %65 + %482 = OpIMul %v3int %75 %481 + %483 = OpIAdd %v3int %475 %482 + %484 = OpBitwiseOr %v3int %463 %483 + %485 = OpINotEqual %v3bool %484 %66 + %486 = OpAny %bool %485 + OpSelectionMerge %487 None + OpBranchConditional %486 %488 %487 + %488 = OpLabel + OpBranch %417 + %487 = OpLabel + %489 = OpFSub %v3float %413 %414 + %490 = OpFSub %v3float %414 %415 + %491 = OpFSub %v3float %415 %413 + %492 = OpFAdd %v3float %413 %414 + %493 = OpFMul %v3float %69 %492 + %494 = OpFSub %v3float %493 %355 + %495 = OpFAdd %v3float %414 %415 + %496 = OpFMul %v3float %69 %495 + %497 = OpFSub %v3float %496 %355 + %498 = OpFAdd %v3float %415 %413 + %499 = OpFMul %v3float %69 %498 + %500 = OpFSub %v3float %499 %355 + %501 = OpDot %float %490 %490 + %502 = OpDot %float %497 %497 + %503 = OpFDiv %float %501 %502 + %504 = OpExtInst %float %1 Sqrt %503 + %505 = OpDot %float %491 %491 + %506 = OpDot %float %500 %500 + %507 = OpFDiv %float %505 %506 + %508 = OpExtInst %float %1 Sqrt %507 + %509 = OpDot %float %489 %489 + %510 = OpDot %float %494 %494 + %511 = OpFDiv %float %509 %510 + %512 = OpExtInst %float %1 Sqrt %511 + %513 = OpCompositeConstruct %v4float %504 %508 %512 %float_1 + %514 = OpFAdd %float %504 %508 + %515 = OpFAdd %float %514 %512 + %516 = OpFMul %float %float_0_333000004 %515 + %517 = OpCompositeInsert %v4float %516 %513 3 + %518 = OpCompositeConstruct %v4float %357 %357 %357 %357 + %519 = OpFMul %v4float %518 %517 + OpBranch %417 + %418 = OpLabel + OpBranch %416 + %417 = OpLabel + %520 = OpPhi %v4float %68 %488 %519 %487 + %521 = OpFMul %v4float %412 %520 + %522 = OpExtInst %v4float %1 FClamp %521 %59 %61 + %523 = OpCompositeExtract %float %522 0 + %524 = OpCompositeExtract %float %522 1 + %525 = OpCompositeExtract %float %522 2 + %526 = OpCompositeExtract %float %522 3 + %527 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_0 + OpStore %527 %523 + %528 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_1 + OpStore %528 %524 + %529 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_2 + OpStore %529 %525 + %530 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %uint_0 + OpStore %530 %526 + OpStore %out_var_PN_POSITION9 %387 + OpBranch %if_merge + %if_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc b/third_party/spirv-cross/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc new file mode 100644 index 0000000000..98216e7924 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.invalid.asm.tesc @@ -0,0 +1,352 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 179 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %MainHull "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_VS_To_DS_Position %gl_InvocationID %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_VS_To_DS_Position %out_var_Flat_DisplacementScales %out_var_Flat_TessellationMultiplier %out_var_Flat_WorldDisplacementMultiplier %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %MainHull Triangles + OpExecutionMode %MainHull SpacingFractionalOdd + OpExecutionMode %MainHull VertexOrderCw + OpExecutionMode %MainHull OutputVertices 3 + OpSource HLSL 600 + OpName %FFlatTessellationHSToDS "FFlatTessellationHSToDS" + OpMemberName %FFlatTessellationHSToDS 0 "PassSpecificData" + OpMemberName %FFlatTessellationHSToDS 1 "DisplacementScale" + OpMemberName %FFlatTessellationHSToDS 2 "TessellationMultiplier" + OpMemberName %FFlatTessellationHSToDS 3 "WorldDisplacementMultiplier" + OpName %FBasePassVSToDS "FBasePassVSToDS" + OpMemberName %FBasePassVSToDS 0 "FactoryInterpolants" + OpMemberName %FBasePassVSToDS 1 "BasePassInterpolants" + OpMemberName %FBasePassVSToDS 2 "Position" + OpName %FVertexFactoryInterpolantsVSToDS "FVertexFactoryInterpolantsVSToDS" + OpMemberName %FVertexFactoryInterpolantsVSToDS 0 "InterpolantsVSToPS" + OpName %FVertexFactoryInterpolantsVSToPS "FVertexFactoryInterpolantsVSToPS" + OpMemberName %FVertexFactoryInterpolantsVSToPS 0 "TangentToWorld0" + OpMemberName %FVertexFactoryInterpolantsVSToPS 1 "TangentToWorld2" + OpName %FBasePassInterpolantsVSToDS "FBasePassInterpolantsVSToDS" + OpName %FSharedBasePassInterpolants "FSharedBasePassInterpolants" + OpName %type_Primitive "type.Primitive" + OpMemberName %type_Primitive 0 "Primitive_LocalToWorld" + OpMemberName %type_Primitive 1 "Primitive_InvNonUniformScaleAndDeterminantSign" + OpMemberName %type_Primitive 2 "Primitive_ObjectWorldPositionAndRadius" + OpMemberName %type_Primitive 3 "Primitive_WorldToLocal" + OpMemberName %type_Primitive 4 "Primitive_PreviousLocalToWorld" + OpMemberName %type_Primitive 5 "Primitive_PreviousWorldToLocal" + OpMemberName %type_Primitive 6 "Primitive_ActorWorldPosition" + OpMemberName %type_Primitive 7 "Primitive_UseSingleSampleShadowFromStationaryLights" + OpMemberName %type_Primitive 8 "Primitive_ObjectBounds" + OpMemberName %type_Primitive 9 "Primitive_LpvBiasMultiplier" + OpMemberName %type_Primitive 10 "Primitive_DecalReceiverMask" + OpMemberName %type_Primitive 11 "Primitive_PerObjectGBufferData" + OpMemberName %type_Primitive 12 "Primitive_UseVolumetricLightmapShadowFromStationaryLights" + OpMemberName %type_Primitive 13 "Primitive_DrawsVelocity" + OpMemberName %type_Primitive 14 "Primitive_ObjectOrientation" + OpMemberName %type_Primitive 15 "Primitive_NonUniformScale" + OpMemberName %type_Primitive 16 "Primitive_LocalObjectBoundsMin" + OpMemberName %type_Primitive 17 "Primitive_LightingChannelMask" + OpMemberName %type_Primitive 18 "Primitive_LocalObjectBoundsMax" + OpMemberName %type_Primitive 19 "Primitive_LightmapDataIndex" + OpMemberName %type_Primitive 20 "Primitive_PreSkinnedLocalBounds" + OpMemberName %type_Primitive 21 "Primitive_SingleCaptureIndex" + OpMemberName %type_Primitive 22 "Primitive_OutputVelocity" + OpMemberName %type_Primitive 23 "PrePadding_Primitive_420" + OpMemberName %type_Primitive 24 "PrePadding_Primitive_424" + OpMemberName %type_Primitive 25 "PrePadding_Primitive_428" + OpMemberName %type_Primitive 26 "Primitive_CustomPrimitiveData" + OpName %Primitive "Primitive" + OpName %type_Material "type.Material" + OpMemberName %type_Material 0 "Material_VectorExpressions" + OpMemberName %type_Material 1 "Material_ScalarExpressions" + OpName %Material "Material" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_VS_To_DS_Position "out.var.VS_To_DS_Position" + OpName %out_var_Flat_DisplacementScales "out.var.Flat_DisplacementScales" + OpName %out_var_Flat_TessellationMultiplier "out.var.Flat_TessellationMultiplier" + OpName %out_var_Flat_WorldDisplacementMultiplier "out.var.Flat_WorldDisplacementMultiplier" + OpName %MainHull "MainHull" + OpName %param_var_I "param.var.I" + OpName %temp_var_hullMainRetVal "temp.var.hullMainRetVal" + OpName %if_merge "if.merge" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorateString %gl_InvocationID UserSemantic "SV_OutputControlPointID" + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %out_var_Flat_DisplacementScales UserSemantic "Flat_DisplacementScales" + OpDecorateString %out_var_Flat_TessellationMultiplier UserSemantic "Flat_TessellationMultiplier" + OpDecorateString %out_var_Flat_WorldDisplacementMultiplier UserSemantic "Flat_WorldDisplacementMultiplier" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorate %in_var_TEXCOORD10_centroid Location 0 + OpDecorate %in_var_TEXCOORD11_centroid Location 1 + OpDecorate %in_var_VS_To_DS_Position Location 2 + OpDecorate %out_var_Flat_DisplacementScales Location 0 + OpDecorate %out_var_Flat_TessellationMultiplier Location 1 + OpDecorate %out_var_Flat_WorldDisplacementMultiplier Location 2 + OpDecorate %out_var_TEXCOORD10_centroid Location 3 + OpDecorate %out_var_TEXCOORD11_centroid Location 4 + OpDecorate %out_var_VS_To_DS_Position Location 5 + OpDecorate %Primitive DescriptorSet 0 + OpDecorate %Primitive Binding 0 + OpDecorate %Material DescriptorSet 0 + OpDecorate %Material Binding 1 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_Primitive 0 Offset 0 + OpMemberDecorate %type_Primitive 0 MatrixStride 16 + OpMemberDecorate %type_Primitive 0 ColMajor + OpMemberDecorate %type_Primitive 1 Offset 64 + OpMemberDecorate %type_Primitive 2 Offset 80 + OpMemberDecorate %type_Primitive 3 Offset 96 + OpMemberDecorate %type_Primitive 3 MatrixStride 16 + OpMemberDecorate %type_Primitive 3 ColMajor + OpMemberDecorate %type_Primitive 4 Offset 160 + OpMemberDecorate %type_Primitive 4 MatrixStride 16 + OpMemberDecorate %type_Primitive 4 ColMajor + OpMemberDecorate %type_Primitive 5 Offset 224 + OpMemberDecorate %type_Primitive 5 MatrixStride 16 + OpMemberDecorate %type_Primitive 5 ColMajor + OpMemberDecorate %type_Primitive 6 Offset 288 + OpMemberDecorate %type_Primitive 7 Offset 300 + OpMemberDecorate %type_Primitive 8 Offset 304 + OpMemberDecorate %type_Primitive 9 Offset 316 + OpMemberDecorate %type_Primitive 10 Offset 320 + OpMemberDecorate %type_Primitive 11 Offset 324 + OpMemberDecorate %type_Primitive 12 Offset 328 + OpMemberDecorate %type_Primitive 13 Offset 332 + OpMemberDecorate %type_Primitive 14 Offset 336 + OpMemberDecorate %type_Primitive 15 Offset 352 + OpMemberDecorate %type_Primitive 16 Offset 368 + OpMemberDecorate %type_Primitive 17 Offset 380 + OpMemberDecorate %type_Primitive 18 Offset 384 + OpMemberDecorate %type_Primitive 19 Offset 396 + OpMemberDecorate %type_Primitive 20 Offset 400 + OpMemberDecorate %type_Primitive 21 Offset 412 + OpMemberDecorate %type_Primitive 22 Offset 416 + OpMemberDecorate %type_Primitive 23 Offset 420 + OpMemberDecorate %type_Primitive 24 Offset 424 + OpMemberDecorate %type_Primitive 25 Offset 428 + OpMemberDecorate %type_Primitive 26 Offset 432 + OpDecorate %type_Primitive Block + OpDecorate %_arr_v4float_uint_3 ArrayStride 16 + OpDecorate %_arr_v4float_uint_1 ArrayStride 16 + OpMemberDecorate %type_Material 0 Offset 0 + OpMemberDecorate %type_Material 1 Offset 48 + OpDecorate %type_Material Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 + %float_0_5 = OpConstant %float 0.5 + %int_1 = OpConstant %int 1 +%float_0_333000004 = OpConstant %float 0.333000004 + %float_1 = OpConstant %float 1 + %49 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_15 = OpConstant %float 15 + %51 = OpConstantComposite %v4float %float_15 %float_15 %float_15 %float_15 +%FVertexFactoryInterpolantsVSToPS = OpTypeStruct %v4float %v4float +%FVertexFactoryInterpolantsVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToPS +%FSharedBasePassInterpolants = OpTypeStruct +%FBasePassInterpolantsVSToDS = OpTypeStruct %FSharedBasePassInterpolants +%FBasePassVSToDS = OpTypeStruct %FVertexFactoryInterpolantsVSToDS %FBasePassInterpolantsVSToDS %v4float +%FFlatTessellationHSToDS = OpTypeStruct %FBasePassVSToDS %v3float %float %float + %int_15 = OpConstant %int 15 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%type_Primitive = OpTypeStruct %mat4v4float %v4float %v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %float %float %float %float %v4float %v4float %v3float %uint %v3float %uint %v3float %int %uint %uint %uint %uint %_arr_v4float_uint_4 +%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%type_Material = OpTypeStruct %_arr_v4float_uint_3 %_arr_v4float_uint_1 +%_ptr_Uniform_type_Material = OpTypePointer Uniform %type_Material +%_arr_v4float_uint_3_0 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3_0 = OpTypePointer Input %_arr_v4float_uint_3_0 +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Output__arr_v4float_uint_3_0 = OpTypePointer Output %_arr_v4float_uint_3_0 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 + %void = OpTypeVoid + %67 = OpTypeFunction %void +%_arr_FBasePassVSToDS_uint_3 = OpTypeArray %FBasePassVSToDS %uint_3 +%_ptr_Function__arr_FBasePassVSToDS_uint_3 = OpTypePointer Function %_arr_FBasePassVSToDS_uint_3 +%_arr_FFlatTessellationHSToDS_uint_3 = OpTypeArray %FFlatTessellationHSToDS %uint_3 +%_ptr_Function__arr_FFlatTessellationHSToDS_uint_3 = OpTypePointer Function %_arr_FFlatTessellationHSToDS_uint_3 +%_ptr_Workgroup__arr_FFlatTessellationHSToDS_uint_3 = OpTypePointer Workgroup %_arr_FFlatTessellationHSToDS_uint_3 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_v3float = OpTypePointer Output %v3float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Function_FFlatTessellationHSToDS = OpTypePointer Function %FFlatTessellationHSToDS +%_ptr_Workgroup_FFlatTessellationHSToDS = OpTypePointer Workgroup %FFlatTessellationHSToDS + %bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Workgroup_float = OpTypePointer Workgroup %float +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_FVertexFactoryInterpolantsVSToDS = OpTypePointer Function %FVertexFactoryInterpolantsVSToDS +%_ptr_Function_FBasePassVSToDS = OpTypePointer Function %FBasePassVSToDS +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform + %Material = OpVariable %_ptr_Uniform_type_Material Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3_0 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3_0 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_3_0 Input +%gl_InvocationID = OpVariable %_ptr_Input_uint Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3_0 Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output__arr_v4float_uint_3_0 Output +%out_var_VS_To_DS_Position = OpVariable %_ptr_Output__arr_v4float_uint_3_0 Output +%out_var_Flat_DisplacementScales = OpVariable %_ptr_Output__arr_v3float_uint_3 Output +%out_var_Flat_TessellationMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%out_var_Flat_WorldDisplacementMultiplier = OpVariable %_ptr_Output__arr_float_uint_3 Output +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %83 = OpConstantNull %FSharedBasePassInterpolants + %84 = OpConstantComposite %FBasePassInterpolantsVSToDS %83 + %85 = OpUndef %v4float + +; XXX: Original asm used Function here, which is wrong. +; This patches the SPIR-V to be correct. +%temp_var_hullMainRetVal = OpVariable %_ptr_Workgroup__arr_FFlatTessellationHSToDS_uint_3 Workgroup + + %MainHull = OpFunction %void None %67 + %86 = OpLabel +%param_var_I = OpVariable %_ptr_Function__arr_FBasePassVSToDS_uint_3 Function + %87 = OpLoad %_arr_v4float_uint_3_0 %in_var_TEXCOORD10_centroid + %88 = OpLoad %_arr_v4float_uint_3_0 %in_var_TEXCOORD11_centroid + %89 = OpCompositeExtract %v4float %87 0 + %90 = OpCompositeExtract %v4float %88 0 + %91 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %89 %90 + %92 = OpCompositeExtract %v4float %87 1 + %93 = OpCompositeExtract %v4float %88 1 + %94 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %92 %93 + %95 = OpCompositeExtract %v4float %87 2 + %96 = OpCompositeExtract %v4float %88 2 + %97 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToPS %95 %96 + %98 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %91 + %99 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %94 + %100 = OpCompositeConstruct %FVertexFactoryInterpolantsVSToDS %97 + %101 = OpLoad %_arr_v4float_uint_3_0 %in_var_VS_To_DS_Position + %102 = OpCompositeExtract %v4float %101 0 + %103 = OpCompositeConstruct %FBasePassVSToDS %98 %84 %102 + %104 = OpCompositeExtract %v4float %101 1 + %105 = OpCompositeConstruct %FBasePassVSToDS %99 %84 %104 + %106 = OpCompositeExtract %v4float %101 2 + %107 = OpCompositeConstruct %FBasePassVSToDS %100 %84 %106 + %108 = OpCompositeConstruct %_arr_FBasePassVSToDS_uint_3 %103 %105 %107 + OpStore %param_var_I %108 + %109 = OpLoad %uint %gl_InvocationID + %110 = OpAccessChain %_ptr_Function_FVertexFactoryInterpolantsVSToDS %param_var_I %109 %int_0 + %111 = OpLoad %FVertexFactoryInterpolantsVSToDS %110 + %112 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %111 0 + %113 = OpCompositeExtract %v4float %112 0 + %114 = OpCompositeExtract %v4float %112 1 + %115 = OpVectorShuffle %v3float %113 %113 0 1 2 + %116 = OpVectorShuffle %v3float %114 %114 0 1 2 + %117 = OpExtInst %v3float %1 Cross %116 %115 + %118 = OpCompositeExtract %float %114 3 + %119 = OpCompositeConstruct %v3float %118 %118 %118 + %120 = OpFMul %v3float %117 %119 + %121 = OpCompositeConstruct %mat3v3float %115 %120 %116 + %122 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_15 + %123 = OpLoad %v4float %122 + %124 = OpVectorShuffle %v3float %123 %123 0 1 2 + %125 = OpVectorTimesMatrix %v3float %124 %121 + %126 = OpAccessChain %_ptr_Function_FBasePassVSToDS %param_var_I %109 + %127 = OpLoad %FBasePassVSToDS %126 + %128 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_0 + %129 = OpLoad %float %128 + %130 = OpCompositeConstruct %FFlatTessellationHSToDS %127 %125 %129 %float_1 + %131 = OpCompositeExtract %FVertexFactoryInterpolantsVSToDS %127 0 + %132 = OpCompositeExtract %FVertexFactoryInterpolantsVSToPS %131 0 + %133 = OpCompositeExtract %v4float %132 0 + %134 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD10_centroid %109 + OpStore %134 %133 + %135 = OpCompositeExtract %v4float %132 1 + %136 = OpAccessChain %_ptr_Output_v4float %out_var_TEXCOORD11_centroid %109 + OpStore %136 %135 + %137 = OpCompositeExtract %v4float %127 2 + %138 = OpAccessChain %_ptr_Output_v4float %out_var_VS_To_DS_Position %109 + OpStore %138 %137 + %139 = OpAccessChain %_ptr_Output_v3float %out_var_Flat_DisplacementScales %109 + OpStore %139 %125 + %140 = OpAccessChain %_ptr_Output_float %out_var_Flat_TessellationMultiplier %109 + OpStore %140 %129 + %141 = OpAccessChain %_ptr_Output_float %out_var_Flat_WorldDisplacementMultiplier %109 + OpStore %141 %float_1 + %142 = OpAccessChain %_ptr_Workgroup_FFlatTessellationHSToDS %temp_var_hullMainRetVal %109 + OpStore %142 %130 + OpControlBarrier %uint_2 %uint_4 %uint_0 + %143 = OpIEqual %bool %109 %uint_0 + OpSelectionMerge %if_merge None + OpBranchConditional %143 %144 %if_merge + %144 = OpLabel + %145 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_1 %int_2 + %146 = OpLoad %float %145 + %147 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_2 %int_2 + %148 = OpLoad %float %147 + %149 = OpFAdd %float %146 %148 + %150 = OpFMul %float %float_0_5 %149 + %151 = OpCompositeInsert %v4float %150 %85 0 + %152 = OpLoad %float %147 + %153 = OpAccessChain %_ptr_Workgroup_float %temp_var_hullMainRetVal %uint_0 %int_2 + %154 = OpLoad %float %153 + %155 = OpFAdd %float %152 %154 + %156 = OpFMul %float %float_0_5 %155 + %157 = OpCompositeInsert %v4float %156 %151 1 + %158 = OpLoad %float %153 + %159 = OpLoad %float %145 + %160 = OpFAdd %float %158 %159 + %161 = OpFMul %float %float_0_5 %160 + %162 = OpCompositeInsert %v4float %161 %157 2 + %163 = OpLoad %float %153 + %164 = OpLoad %float %145 + %165 = OpFAdd %float %163 %164 + %166 = OpLoad %float %147 + %167 = OpFAdd %float %165 %166 + %168 = OpFMul %float %float_0_333000004 %167 + %169 = OpCompositeInsert %v4float %168 %162 3 + %170 = OpExtInst %v4float %1 FClamp %169 %49 %51 + %171 = OpCompositeExtract %float %170 0 + %172 = OpCompositeExtract %float %170 1 + %173 = OpCompositeExtract %float %170 2 + %174 = OpCompositeExtract %float %170 3 + %175 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_0 + OpStore %175 %171 + %176 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_1 + OpStore %176 %172 + %177 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %uint_2 + OpStore %177 %173 + %178 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %uint_0 + OpStore %178 %174 + OpBranch %if_merge + %if_merge = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese new file mode 100644 index 0000000000..dc543d1f86 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese @@ -0,0 +1,1046 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 310 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %MainDomain "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_COLOR0 %in_var_TEXCOORD0 %in_var_PRIMITIVE_ID %in_var_VS_to_DS_Position %in_var_PN_POSITION %in_var_PN_DisplacementScales %in_var_PN_TessellationMultiplier %in_var_PN_WorldDisplacementMultiplier %gl_TessLevelOuter %gl_TessLevelInner %in_var_PN_POSITION9 %gl_TessCoord %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_COLOR0 %out_var_TEXCOORD0 %out_var_PRIMITIVE_ID %out_var_TEXCOORD6 %out_var_TEXCOORD8 %out_var_TEXCOORD7 %gl_Position + OpExecutionMode %MainDomain Triangles + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_sampler "type.sampler" + OpName %type_2d_image "type.2d.image" + OpName %type_ShadowDepthPass "type.ShadowDepthPass" + OpMemberName %type_ShadowDepthPass 0 "PrePadding_ShadowDepthPass_LPV_0" + OpMemberName %type_ShadowDepthPass 1 "PrePadding_ShadowDepthPass_LPV_4" + OpMemberName %type_ShadowDepthPass 2 "PrePadding_ShadowDepthPass_LPV_8" + OpMemberName %type_ShadowDepthPass 3 "PrePadding_ShadowDepthPass_LPV_12" + OpMemberName %type_ShadowDepthPass 4 "PrePadding_ShadowDepthPass_LPV_16" + OpMemberName %type_ShadowDepthPass 5 "PrePadding_ShadowDepthPass_LPV_20" + OpMemberName %type_ShadowDepthPass 6 "PrePadding_ShadowDepthPass_LPV_24" + OpMemberName %type_ShadowDepthPass 7 "PrePadding_ShadowDepthPass_LPV_28" + OpMemberName %type_ShadowDepthPass 8 "PrePadding_ShadowDepthPass_LPV_32" + OpMemberName %type_ShadowDepthPass 9 "PrePadding_ShadowDepthPass_LPV_36" + OpMemberName %type_ShadowDepthPass 10 "PrePadding_ShadowDepthPass_LPV_40" + OpMemberName %type_ShadowDepthPass 11 "PrePadding_ShadowDepthPass_LPV_44" + OpMemberName %type_ShadowDepthPass 12 "PrePadding_ShadowDepthPass_LPV_48" + OpMemberName %type_ShadowDepthPass 13 "PrePadding_ShadowDepthPass_LPV_52" + OpMemberName %type_ShadowDepthPass 14 "PrePadding_ShadowDepthPass_LPV_56" + OpMemberName %type_ShadowDepthPass 15 "PrePadding_ShadowDepthPass_LPV_60" + OpMemberName %type_ShadowDepthPass 16 "PrePadding_ShadowDepthPass_LPV_64" + OpMemberName %type_ShadowDepthPass 17 "PrePadding_ShadowDepthPass_LPV_68" + OpMemberName %type_ShadowDepthPass 18 "PrePadding_ShadowDepthPass_LPV_72" + OpMemberName %type_ShadowDepthPass 19 "PrePadding_ShadowDepthPass_LPV_76" + OpMemberName %type_ShadowDepthPass 20 "PrePadding_ShadowDepthPass_LPV_80" + OpMemberName %type_ShadowDepthPass 21 "PrePadding_ShadowDepthPass_LPV_84" + OpMemberName %type_ShadowDepthPass 22 "PrePadding_ShadowDepthPass_LPV_88" + OpMemberName %type_ShadowDepthPass 23 "PrePadding_ShadowDepthPass_LPV_92" + OpMemberName %type_ShadowDepthPass 24 "PrePadding_ShadowDepthPass_LPV_96" + OpMemberName %type_ShadowDepthPass 25 "PrePadding_ShadowDepthPass_LPV_100" + OpMemberName %type_ShadowDepthPass 26 "PrePadding_ShadowDepthPass_LPV_104" + OpMemberName %type_ShadowDepthPass 27 "PrePadding_ShadowDepthPass_LPV_108" + OpMemberName %type_ShadowDepthPass 28 "PrePadding_ShadowDepthPass_LPV_112" + OpMemberName %type_ShadowDepthPass 29 "PrePadding_ShadowDepthPass_LPV_116" + OpMemberName %type_ShadowDepthPass 30 "PrePadding_ShadowDepthPass_LPV_120" + OpMemberName %type_ShadowDepthPass 31 "PrePadding_ShadowDepthPass_LPV_124" + OpMemberName %type_ShadowDepthPass 32 "PrePadding_ShadowDepthPass_LPV_128" + OpMemberName %type_ShadowDepthPass 33 "PrePadding_ShadowDepthPass_LPV_132" + OpMemberName %type_ShadowDepthPass 34 "PrePadding_ShadowDepthPass_LPV_136" + OpMemberName %type_ShadowDepthPass 35 "PrePadding_ShadowDepthPass_LPV_140" + OpMemberName %type_ShadowDepthPass 36 "PrePadding_ShadowDepthPass_LPV_144" + OpMemberName %type_ShadowDepthPass 37 "PrePadding_ShadowDepthPass_LPV_148" + OpMemberName %type_ShadowDepthPass 38 "PrePadding_ShadowDepthPass_LPV_152" + OpMemberName %type_ShadowDepthPass 39 "PrePadding_ShadowDepthPass_LPV_156" + OpMemberName %type_ShadowDepthPass 40 "PrePadding_ShadowDepthPass_LPV_160" + OpMemberName %type_ShadowDepthPass 41 "PrePadding_ShadowDepthPass_LPV_164" + OpMemberName %type_ShadowDepthPass 42 "PrePadding_ShadowDepthPass_LPV_168" + OpMemberName %type_ShadowDepthPass 43 "PrePadding_ShadowDepthPass_LPV_172" + OpMemberName %type_ShadowDepthPass 44 "PrePadding_ShadowDepthPass_LPV_176" + OpMemberName %type_ShadowDepthPass 45 "PrePadding_ShadowDepthPass_LPV_180" + OpMemberName %type_ShadowDepthPass 46 "PrePadding_ShadowDepthPass_LPV_184" + OpMemberName %type_ShadowDepthPass 47 "PrePadding_ShadowDepthPass_LPV_188" + OpMemberName %type_ShadowDepthPass 48 "PrePadding_ShadowDepthPass_LPV_192" + OpMemberName %type_ShadowDepthPass 49 "PrePadding_ShadowDepthPass_LPV_196" + OpMemberName %type_ShadowDepthPass 50 "PrePadding_ShadowDepthPass_LPV_200" + OpMemberName %type_ShadowDepthPass 51 "PrePadding_ShadowDepthPass_LPV_204" + OpMemberName %type_ShadowDepthPass 52 "PrePadding_ShadowDepthPass_LPV_208" + OpMemberName %type_ShadowDepthPass 53 "PrePadding_ShadowDepthPass_LPV_212" + OpMemberName %type_ShadowDepthPass 54 "PrePadding_ShadowDepthPass_LPV_216" + OpMemberName %type_ShadowDepthPass 55 "PrePadding_ShadowDepthPass_LPV_220" + OpMemberName %type_ShadowDepthPass 56 "PrePadding_ShadowDepthPass_LPV_224" + OpMemberName %type_ShadowDepthPass 57 "PrePadding_ShadowDepthPass_LPV_228" + OpMemberName %type_ShadowDepthPass 58 "PrePadding_ShadowDepthPass_LPV_232" + OpMemberName %type_ShadowDepthPass 59 "PrePadding_ShadowDepthPass_LPV_236" + OpMemberName %type_ShadowDepthPass 60 "PrePadding_ShadowDepthPass_LPV_240" + OpMemberName %type_ShadowDepthPass 61 "PrePadding_ShadowDepthPass_LPV_244" + OpMemberName %type_ShadowDepthPass 62 "PrePadding_ShadowDepthPass_LPV_248" + OpMemberName %type_ShadowDepthPass 63 "PrePadding_ShadowDepthPass_LPV_252" + OpMemberName %type_ShadowDepthPass 64 "PrePadding_ShadowDepthPass_LPV_256" + OpMemberName %type_ShadowDepthPass 65 "PrePadding_ShadowDepthPass_LPV_260" + OpMemberName %type_ShadowDepthPass 66 "PrePadding_ShadowDepthPass_LPV_264" + OpMemberName %type_ShadowDepthPass 67 "PrePadding_ShadowDepthPass_LPV_268" + OpMemberName %type_ShadowDepthPass 68 "ShadowDepthPass_LPV_mRsmToWorld" + OpMemberName %type_ShadowDepthPass 69 "ShadowDepthPass_LPV_mLightColour" + OpMemberName %type_ShadowDepthPass 70 "ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection" + OpMemberName %type_ShadowDepthPass 71 "ShadowDepthPass_LPV_mEyePos" + OpMemberName %type_ShadowDepthPass 72 "ShadowDepthPass_LPV_mOldGridOffset" + OpMemberName %type_ShadowDepthPass 73 "PrePadding_ShadowDepthPass_LPV_396" + OpMemberName %type_ShadowDepthPass 74 "ShadowDepthPass_LPV_mLpvGridOffset" + OpMemberName %type_ShadowDepthPass 75 "ShadowDepthPass_LPV_ClearMultiplier" + OpMemberName %type_ShadowDepthPass 76 "ShadowDepthPass_LPV_LpvScale" + OpMemberName %type_ShadowDepthPass 77 "ShadowDepthPass_LPV_OneOverLpvScale" + OpMemberName %type_ShadowDepthPass 78 "ShadowDepthPass_LPV_DirectionalOcclusionIntensity" + OpMemberName %type_ShadowDepthPass 79 "ShadowDepthPass_LPV_DirectionalOcclusionRadius" + OpMemberName %type_ShadowDepthPass 80 "ShadowDepthPass_LPV_RsmAreaIntensityMultiplier" + OpMemberName %type_ShadowDepthPass 81 "ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier" + OpMemberName %type_ShadowDepthPass 82 "ShadowDepthPass_LPV_SecondaryOcclusionStrength" + OpMemberName %type_ShadowDepthPass 83 "ShadowDepthPass_LPV_SecondaryBounceStrength" + OpMemberName %type_ShadowDepthPass 84 "ShadowDepthPass_LPV_VplInjectionBias" + OpMemberName %type_ShadowDepthPass 85 "ShadowDepthPass_LPV_GeometryVolumeInjectionBias" + OpMemberName %type_ShadowDepthPass 86 "ShadowDepthPass_LPV_EmissiveInjectionMultiplier" + OpMemberName %type_ShadowDepthPass 87 "ShadowDepthPass_LPV_PropagationIndex" + OpMemberName %type_ShadowDepthPass 88 "ShadowDepthPass_ProjectionMatrix" + OpMemberName %type_ShadowDepthPass 89 "ShadowDepthPass_ViewMatrix" + OpMemberName %type_ShadowDepthPass 90 "ShadowDepthPass_ShadowParams" + OpMemberName %type_ShadowDepthPass 91 "ShadowDepthPass_bClampToNearPlane" + OpMemberName %type_ShadowDepthPass 92 "PrePadding_ShadowDepthPass_612" + OpMemberName %type_ShadowDepthPass 93 "PrePadding_ShadowDepthPass_616" + OpMemberName %type_ShadowDepthPass 94 "PrePadding_ShadowDepthPass_620" + OpMemberName %type_ShadowDepthPass 95 "ShadowDepthPass_ShadowViewProjectionMatrices" + OpMemberName %type_ShadowDepthPass 96 "ShadowDepthPass_ShadowViewMatrices" + OpName %ShadowDepthPass "ShadowDepthPass" + OpName %Material_Texture2D_3 "Material_Texture2D_3" + OpName %Material_Texture2D_3Sampler "Material_Texture2D_3Sampler" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_COLOR0 "in.var.COLOR0" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %in_var_PRIMITIVE_ID "in.var.PRIMITIVE_ID" + OpName %in_var_VS_to_DS_Position "in.var.VS_to_DS_Position" + OpName %in_var_PN_POSITION "in.var.PN_POSITION" + OpName %in_var_PN_DisplacementScales "in.var.PN_DisplacementScales" + OpName %in_var_PN_TessellationMultiplier "in.var.PN_TessellationMultiplier" + OpName %in_var_PN_WorldDisplacementMultiplier "in.var.PN_WorldDisplacementMultiplier" + OpName %in_var_PN_POSITION9 "in.var.PN_POSITION9" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_COLOR0 "out.var.COLOR0" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_PRIMITIVE_ID "out.var.PRIMITIVE_ID" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %out_var_TEXCOORD8 "out.var.TEXCOORD8" + OpName %out_var_TEXCOORD7 "out.var.TEXCOORD7" + OpName %MainDomain "MainDomain" + OpName %type_sampled_image "type.sampled.image" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %in_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %in_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorateString %in_var_VS_to_DS_Position UserSemantic "VS_to_DS_Position" + OpDecorateString %in_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %in_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %in_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %in_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %in_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %in_var_PN_POSITION9 Patch + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorateString %gl_TessCoord UserSemantic "SV_DomainLocation" + OpDecorate %gl_TessCoord Patch + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_COLOR0 UserSemantic "COLOR0" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_PRIMITIVE_ID UserSemantic "PRIMITIVE_ID" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %out_var_TEXCOORD8 UserSemantic "TEXCOORD8" + OpDecorateString %out_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %in_var_COLOR0 Location 0 + OpDecorate %in_var_PN_DisplacementScales Location 1 + OpDecorate %in_var_PN_POSITION Location 2 + OpDecorate %in_var_PN_POSITION9 Location 5 + OpDecorate %in_var_PN_TessellationMultiplier Location 6 + OpDecorate %in_var_PN_WorldDisplacementMultiplier Location 7 + OpDecorate %in_var_PRIMITIVE_ID Location 8 + OpDecorate %in_var_TEXCOORD0 Location 9 + OpDecorate %in_var_TEXCOORD10_centroid Location 10 + OpDecorate %in_var_TEXCOORD11_centroid Location 11 + OpDecorate %in_var_VS_to_DS_Position Location 12 + OpDecorate %out_var_TEXCOORD10_centroid Location 0 + OpDecorate %out_var_TEXCOORD11_centroid Location 1 + OpDecorate %out_var_COLOR0 Location 2 + OpDecorate %out_var_TEXCOORD0 Location 3 + OpDecorate %out_var_PRIMITIVE_ID Location 4 + OpDecorate %out_var_TEXCOORD6 Location 5 + OpDecorate %out_var_TEXCOORD8 Location 6 + OpDecorate %out_var_TEXCOORD7 Location 7 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %ShadowDepthPass DescriptorSet 0 + OpDecorate %ShadowDepthPass Binding 1 + OpDecorate %Material_Texture2D_3 DescriptorSet 0 + OpDecorate %Material_Texture2D_3 Binding 0 + OpDecorate %Material_Texture2D_3Sampler DescriptorSet 0 + OpDecorate %Material_Texture2D_3Sampler Binding 0 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpDecorate %type_View Block + OpDecorate %_arr_mat4v4float_uint_6 ArrayStride 64 + OpMemberDecorate %type_ShadowDepthPass 0 Offset 0 + OpMemberDecorate %type_ShadowDepthPass 1 Offset 4 + OpMemberDecorate %type_ShadowDepthPass 2 Offset 8 + OpMemberDecorate %type_ShadowDepthPass 3 Offset 12 + OpMemberDecorate %type_ShadowDepthPass 4 Offset 16 + OpMemberDecorate %type_ShadowDepthPass 5 Offset 20 + OpMemberDecorate %type_ShadowDepthPass 6 Offset 24 + OpMemberDecorate %type_ShadowDepthPass 7 Offset 28 + OpMemberDecorate %type_ShadowDepthPass 8 Offset 32 + OpMemberDecorate %type_ShadowDepthPass 9 Offset 36 + OpMemberDecorate %type_ShadowDepthPass 10 Offset 40 + OpMemberDecorate %type_ShadowDepthPass 11 Offset 44 + OpMemberDecorate %type_ShadowDepthPass 12 Offset 48 + OpMemberDecorate %type_ShadowDepthPass 13 Offset 52 + OpMemberDecorate %type_ShadowDepthPass 14 Offset 56 + OpMemberDecorate %type_ShadowDepthPass 15 Offset 60 + OpMemberDecorate %type_ShadowDepthPass 16 Offset 64 + OpMemberDecorate %type_ShadowDepthPass 17 Offset 68 + OpMemberDecorate %type_ShadowDepthPass 18 Offset 72 + OpMemberDecorate %type_ShadowDepthPass 19 Offset 76 + OpMemberDecorate %type_ShadowDepthPass 20 Offset 80 + OpMemberDecorate %type_ShadowDepthPass 21 Offset 84 + OpMemberDecorate %type_ShadowDepthPass 22 Offset 88 + OpMemberDecorate %type_ShadowDepthPass 23 Offset 92 + OpMemberDecorate %type_ShadowDepthPass 24 Offset 96 + OpMemberDecorate %type_ShadowDepthPass 25 Offset 100 + OpMemberDecorate %type_ShadowDepthPass 26 Offset 104 + OpMemberDecorate %type_ShadowDepthPass 27 Offset 108 + OpMemberDecorate %type_ShadowDepthPass 28 Offset 112 + OpMemberDecorate %type_ShadowDepthPass 29 Offset 116 + OpMemberDecorate %type_ShadowDepthPass 30 Offset 120 + OpMemberDecorate %type_ShadowDepthPass 31 Offset 124 + OpMemberDecorate %type_ShadowDepthPass 32 Offset 128 + OpMemberDecorate %type_ShadowDepthPass 33 Offset 132 + OpMemberDecorate %type_ShadowDepthPass 34 Offset 136 + OpMemberDecorate %type_ShadowDepthPass 35 Offset 140 + OpMemberDecorate %type_ShadowDepthPass 36 Offset 144 + OpMemberDecorate %type_ShadowDepthPass 37 Offset 148 + OpMemberDecorate %type_ShadowDepthPass 38 Offset 152 + OpMemberDecorate %type_ShadowDepthPass 39 Offset 156 + OpMemberDecorate %type_ShadowDepthPass 40 Offset 160 + OpMemberDecorate %type_ShadowDepthPass 41 Offset 164 + OpMemberDecorate %type_ShadowDepthPass 42 Offset 168 + OpMemberDecorate %type_ShadowDepthPass 43 Offset 172 + OpMemberDecorate %type_ShadowDepthPass 44 Offset 176 + OpMemberDecorate %type_ShadowDepthPass 45 Offset 180 + OpMemberDecorate %type_ShadowDepthPass 46 Offset 184 + OpMemberDecorate %type_ShadowDepthPass 47 Offset 188 + OpMemberDecorate %type_ShadowDepthPass 48 Offset 192 + OpMemberDecorate %type_ShadowDepthPass 49 Offset 196 + OpMemberDecorate %type_ShadowDepthPass 50 Offset 200 + OpMemberDecorate %type_ShadowDepthPass 51 Offset 204 + OpMemberDecorate %type_ShadowDepthPass 52 Offset 208 + OpMemberDecorate %type_ShadowDepthPass 53 Offset 212 + OpMemberDecorate %type_ShadowDepthPass 54 Offset 216 + OpMemberDecorate %type_ShadowDepthPass 55 Offset 220 + OpMemberDecorate %type_ShadowDepthPass 56 Offset 224 + OpMemberDecorate %type_ShadowDepthPass 57 Offset 228 + OpMemberDecorate %type_ShadowDepthPass 58 Offset 232 + OpMemberDecorate %type_ShadowDepthPass 59 Offset 236 + OpMemberDecorate %type_ShadowDepthPass 60 Offset 240 + OpMemberDecorate %type_ShadowDepthPass 61 Offset 244 + OpMemberDecorate %type_ShadowDepthPass 62 Offset 248 + OpMemberDecorate %type_ShadowDepthPass 63 Offset 252 + OpMemberDecorate %type_ShadowDepthPass 64 Offset 256 + OpMemberDecorate %type_ShadowDepthPass 65 Offset 260 + OpMemberDecorate %type_ShadowDepthPass 66 Offset 264 + OpMemberDecorate %type_ShadowDepthPass 67 Offset 268 + OpMemberDecorate %type_ShadowDepthPass 68 Offset 272 + OpMemberDecorate %type_ShadowDepthPass 68 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 68 ColMajor + OpMemberDecorate %type_ShadowDepthPass 69 Offset 336 + OpMemberDecorate %type_ShadowDepthPass 70 Offset 352 + OpMemberDecorate %type_ShadowDepthPass 71 Offset 368 + OpMemberDecorate %type_ShadowDepthPass 72 Offset 384 + OpMemberDecorate %type_ShadowDepthPass 73 Offset 396 + OpMemberDecorate %type_ShadowDepthPass 74 Offset 400 + OpMemberDecorate %type_ShadowDepthPass 75 Offset 412 + OpMemberDecorate %type_ShadowDepthPass 76 Offset 416 + OpMemberDecorate %type_ShadowDepthPass 77 Offset 420 + OpMemberDecorate %type_ShadowDepthPass 78 Offset 424 + OpMemberDecorate %type_ShadowDepthPass 79 Offset 428 + OpMemberDecorate %type_ShadowDepthPass 80 Offset 432 + OpMemberDecorate %type_ShadowDepthPass 81 Offset 436 + OpMemberDecorate %type_ShadowDepthPass 82 Offset 440 + OpMemberDecorate %type_ShadowDepthPass 83 Offset 444 + OpMemberDecorate %type_ShadowDepthPass 84 Offset 448 + OpMemberDecorate %type_ShadowDepthPass 85 Offset 452 + OpMemberDecorate %type_ShadowDepthPass 86 Offset 456 + OpMemberDecorate %type_ShadowDepthPass 87 Offset 460 + OpMemberDecorate %type_ShadowDepthPass 88 Offset 464 + OpMemberDecorate %type_ShadowDepthPass 88 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 88 ColMajor + OpMemberDecorate %type_ShadowDepthPass 89 Offset 528 + OpMemberDecorate %type_ShadowDepthPass 89 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 89 ColMajor + OpMemberDecorate %type_ShadowDepthPass 90 Offset 592 + OpMemberDecorate %type_ShadowDepthPass 91 Offset 608 + OpMemberDecorate %type_ShadowDepthPass 92 Offset 612 + OpMemberDecorate %type_ShadowDepthPass 93 Offset 616 + OpMemberDecorate %type_ShadowDepthPass 94 Offset 620 + OpMemberDecorate %type_ShadowDepthPass 95 Offset 624 + OpMemberDecorate %type_ShadowDepthPass 95 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 95 ColMajor + OpMemberDecorate %type_ShadowDepthPass 96 Offset 1008 + OpMemberDecorate %type_ShadowDepthPass 96 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 96 ColMajor + OpDecorate %type_ShadowDepthPass Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_3 = OpConstant %float 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_6 = OpConstant %float 6 + %57 = OpConstantComposite %v4float %float_6 %float_6 %float_6 %float_6 + %float_1 = OpConstant %float 1 + %int_79 = OpConstant %int 79 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_n0_699999988 = OpConstant %float -0.699999988 + %float_2 = OpConstant %float 2 + %63 = OpConstantComposite %v2float %float_1 %float_2 + %float_n1 = OpConstant %float -1 + %float_10 = OpConstant %float 10 + %float_0_5 = OpConstant %float 0.5 + %67 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 + %int_88 = OpConstant %int 88 + %int_89 = OpConstant %int 89 + %int_90 = OpConstant %int 90 + %int_91 = OpConstant %int 91 + %float_0 = OpConstant %float 0 +%float_9_99999997en07 = OpConstant %float 9.99999997e-07 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image + %uint_6 = OpConstant %uint 6 +%_arr_mat4v4float_uint_6 = OpTypeArray %mat4v4float %uint_6 + %v3int = OpTypeVector %int 3 +%type_ShadowDepthPass = OpTypeStruct %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %mat4v4float %v4float %v4float %v4float %v3int %int %v3int %float %float %float %float %float %float %float %float %float %float %float %float %int %mat4v4float %mat4v4float %v4float %float %float %float %float %_arr_mat4v4float_uint_6 %_arr_mat4v4float_uint_6 +%_ptr_Uniform_type_ShadowDepthPass = OpTypePointer Uniform %type_ShadowDepthPass + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_arr__arr_v4float_uint_1_uint_3 = OpTypeArray %_arr_v4float_uint_1 %uint_3 +%_ptr_Input__arr__arr_v4float_uint_1_uint_3 = OpTypePointer Input %_arr__arr_v4float_uint_1_uint_3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Input__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Input %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Input__arr_v3float_uint_3 = OpTypePointer Input %_arr_v3float_uint_3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Input__arr_float_uint_3 = OpTypePointer Input %_arr_float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output__arr_v4float_uint_1 = OpTypePointer Output %_arr_v4float_uint_1 +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %106 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%ShadowDepthPass = OpVariable %_ptr_Uniform_type_ShadowDepthPass Uniform +%Material_Texture2D_3 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%Material_Texture2D_3Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_COLOR0 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input__arr__arr_v4float_uint_1_uint_3 Input +%in_var_PRIMITIVE_ID = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%in_var_VS_to_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_POSITION = OpVariable %_ptr_Input__arr__arr_v4float_uint_3_uint_3 Input +%in_var_PN_DisplacementScales = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_TessellationMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input +%in_var_PN_POSITION9 = OpVariable %_ptr_Input_v4float Input +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_COLOR0 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD0 = OpVariable %_ptr_Output__arr_v4float_uint_1 Output +%out_var_PRIMITIVE_ID = OpVariable %_ptr_Output_uint Output +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_float Output +%out_var_TEXCOORD8 = OpVariable %_ptr_Output_float Output +%out_var_TEXCOORD7 = OpVariable %_ptr_Output_v3float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output + %112 = OpConstantNull %v4float + %113 = OpUndef %v4float +%_ptr_Input_uint = OpTypePointer Input %uint + %MainDomain = OpFunction %void None %106 + %115 = OpLabel + %116 = OpVariable %_ptr_Function_mat4v4float Function + %117 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD10_centroid + %118 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD11_centroid + %119 = OpLoad %_arr_v4float_uint_3 %in_var_COLOR0 + %120 = OpLoad %_arr__arr_v4float_uint_1_uint_3 %in_var_TEXCOORD0 + %121 = OpAccessChain %_ptr_Input_uint %in_var_PRIMITIVE_ID %uint_0 + %122 = OpLoad %uint %121 + %123 = OpCompositeExtract %v4float %117 0 + %124 = OpCompositeExtract %v4float %118 0 + %125 = OpCompositeExtract %v4float %119 0 + %126 = OpCompositeExtract %_arr_v4float_uint_1 %120 0 + %127 = OpCompositeExtract %v4float %117 1 + %128 = OpCompositeExtract %v4float %118 1 + %129 = OpCompositeExtract %v4float %119 1 + %130 = OpCompositeExtract %_arr_v4float_uint_1 %120 1 + %131 = OpCompositeExtract %v4float %117 2 + %132 = OpCompositeExtract %v4float %118 2 + %133 = OpCompositeExtract %v4float %119 2 + %134 = OpCompositeExtract %_arr_v4float_uint_1 %120 2 + %135 = OpLoad %_arr__arr_v4float_uint_3_uint_3 %in_var_PN_POSITION + %136 = OpLoad %_arr_float_uint_3 %in_var_PN_WorldDisplacementMultiplier + %137 = OpCompositeExtract %_arr_v4float_uint_3 %135 0 + %138 = OpCompositeExtract %float %136 0 + %139 = OpCompositeExtract %_arr_v4float_uint_3 %135 1 + %140 = OpCompositeExtract %float %136 1 + %141 = OpCompositeExtract %_arr_v4float_uint_3 %135 2 + %142 = OpCompositeExtract %float %136 2 + %143 = OpCompositeExtract %v4float %137 0 + %144 = OpCompositeExtract %v4float %137 1 + %145 = OpCompositeExtract %v4float %137 2 + %146 = OpCompositeExtract %v4float %139 0 + %147 = OpCompositeExtract %v4float %139 1 + %148 = OpCompositeExtract %v4float %139 2 + %149 = OpCompositeExtract %v4float %141 0 + %150 = OpCompositeExtract %v4float %141 1 + %151 = OpCompositeExtract %v4float %141 2 + %152 = OpLoad %v4float %in_var_PN_POSITION9 + %153 = OpLoad %v3float %gl_TessCoord + %154 = OpCompositeExtract %float %153 0 + %155 = OpCompositeExtract %float %153 1 + %156 = OpCompositeExtract %float %153 2 + %157 = OpFMul %float %154 %154 + %158 = OpFMul %float %155 %155 + %159 = OpFMul %float %156 %156 + %160 = OpFMul %float %157 %float_3 + %161 = OpFMul %float %158 %float_3 + %162 = OpFMul %float %159 %float_3 + %163 = OpCompositeConstruct %v4float %157 %157 %157 %157 + %164 = OpFMul %v4float %143 %163 + %165 = OpCompositeConstruct %v4float %154 %154 %154 %154 + %166 = OpFMul %v4float %164 %165 + %167 = OpCompositeConstruct %v4float %158 %158 %158 %158 + %168 = OpFMul %v4float %146 %167 + %169 = OpCompositeConstruct %v4float %155 %155 %155 %155 + %170 = OpFMul %v4float %168 %169 + %171 = OpFAdd %v4float %166 %170 + %172 = OpCompositeConstruct %v4float %159 %159 %159 %159 + %173 = OpFMul %v4float %149 %172 + %174 = OpCompositeConstruct %v4float %156 %156 %156 %156 + %175 = OpFMul %v4float %173 %174 + %176 = OpFAdd %v4float %171 %175 + %177 = OpCompositeConstruct %v4float %160 %160 %160 %160 + %178 = OpFMul %v4float %144 %177 + %179 = OpFMul %v4float %178 %169 + %180 = OpFAdd %v4float %176 %179 + %181 = OpCompositeConstruct %v4float %161 %161 %161 %161 + %182 = OpFMul %v4float %145 %181 + %183 = OpFMul %v4float %182 %165 + %184 = OpFAdd %v4float %180 %183 + %185 = OpFMul %v4float %147 %181 + %186 = OpFMul %v4float %185 %174 + %187 = OpFAdd %v4float %184 %186 + %188 = OpCompositeConstruct %v4float %162 %162 %162 %162 + %189 = OpFMul %v4float %148 %188 + %190 = OpFMul %v4float %189 %169 + %191 = OpFAdd %v4float %187 %190 + %192 = OpFMul %v4float %150 %188 + %193 = OpFMul %v4float %192 %165 + %194 = OpFAdd %v4float %191 %193 + %195 = OpFMul %v4float %151 %177 + %196 = OpFMul %v4float %195 %174 + %197 = OpFAdd %v4float %194 %196 + %198 = OpFMul %v4float %152 %57 + %199 = OpFMul %v4float %198 %174 + %200 = OpFMul %v4float %199 %165 + %201 = OpFMul %v4float %200 %169 + %202 = OpFAdd %v4float %197 %201 + %203 = OpCompositeExtract %v4float %126 0 + %204 = OpCompositeExtract %v4float %130 0 + %205 = OpVectorShuffle %v3float %123 %123 0 1 2 + %206 = OpCompositeConstruct %v3float %154 %154 %154 + %207 = OpFMul %v3float %205 %206 + %208 = OpVectorShuffle %v3float %127 %127 0 1 2 + %209 = OpCompositeConstruct %v3float %155 %155 %155 + %210 = OpFMul %v3float %208 %209 + %211 = OpFAdd %v3float %207 %210 + %212 = OpFMul %v4float %124 %165 + %213 = OpFMul %v4float %128 %169 + %214 = OpFAdd %v4float %212 %213 + %215 = OpFMul %v4float %125 %165 + %216 = OpFMul %v4float %129 %169 + %217 = OpFAdd %v4float %215 %216 + %218 = OpFMul %v4float %203 %165 + %219 = OpFMul %v4float %204 %169 + %220 = OpFAdd %v4float %218 %219 + %221 = OpCompositeExtract %v4float %134 0 + %222 = OpVectorShuffle %v3float %211 %112 0 1 2 + %223 = OpVectorShuffle %v3float %131 %131 0 1 2 + %224 = OpCompositeConstruct %v3float %156 %156 %156 + %225 = OpFMul %v3float %223 %224 + %226 = OpFAdd %v3float %222 %225 + %227 = OpVectorShuffle %v4float %113 %226 4 5 6 3 + %228 = OpFMul %v4float %132 %174 + %229 = OpFAdd %v4float %214 %228 + %230 = OpFMul %v4float %133 %174 + %231 = OpFAdd %v4float %217 %230 + %232 = OpFMul %v4float %221 %174 + %233 = OpFAdd %v4float %220 %232 + %234 = OpCompositeConstruct %_arr_v4float_uint_1 %233 + %235 = OpVectorShuffle %v2float %233 %233 2 3 + %236 = OpVectorShuffle %v3float %229 %229 0 1 2 + %237 = OpAccessChain %_ptr_Uniform_float %View %int_79 + %238 = OpLoad %float %237 + %239 = OpFMul %float %238 %float_0_200000003 + %240 = OpFMul %float %238 %float_n0_699999988 + %241 = OpFMul %v2float %235 %63 + %242 = OpCompositeConstruct %v2float %239 %240 + %243 = OpFAdd %v2float %242 %241 + %244 = OpLoad %type_2d_image %Material_Texture2D_3 + %245 = OpLoad %type_sampler %Material_Texture2D_3Sampler + %246 = OpSampledImage %type_sampled_image %244 %245 + %247 = OpImageSampleExplicitLod %v4float %246 %243 Lod %float_n1 + %248 = OpCompositeExtract %float %247 0 + %249 = OpFMul %float %248 %float_10 + %250 = OpCompositeExtract %float %231 0 + %251 = OpFSub %float %float_1 %250 + %252 = OpFMul %float %249 %251 + %253 = OpCompositeConstruct %v3float %252 %252 %252 + %254 = OpFMul %v3float %253 %236 + %255 = OpFMul %v3float %254 %67 + %256 = OpFMul %float %138 %154 + %257 = OpFMul %float %140 %155 + %258 = OpFAdd %float %256 %257 + %259 = OpFMul %float %142 %156 + %260 = OpFAdd %float %258 %259 + %261 = OpCompositeConstruct %v3float %260 %260 %260 + %262 = OpFMul %v3float %255 %261 + %263 = OpVectorShuffle %v3float %202 %202 0 1 2 + %264 = OpFAdd %v3float %263 %262 + %265 = OpVectorShuffle %v4float %202 %264 4 5 6 3 + %266 = OpAccessChain %_ptr_Uniform_mat4v4float %ShadowDepthPass %int_88 + %267 = OpLoad %mat4v4float %266 + %268 = OpAccessChain %_ptr_Uniform_mat4v4float %ShadowDepthPass %int_89 + %269 = OpLoad %mat4v4float %268 + OpStore %116 %269 + %270 = OpMatrixTimesVector %v4float %267 %265 + %271 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_91 + %272 = OpLoad %float %271 + %273 = OpFOrdGreaterThan %bool %272 %float_0 + %274 = OpCompositeExtract %float %270 2 + %275 = OpFOrdLessThan %bool %274 %float_0 + %276 = OpLogicalAnd %bool %273 %275 + OpSelectionMerge %277 None + OpBranchConditional %276 %278 %277 + %278 = OpLabel + %279 = OpCompositeInsert %v4float %float_9_99999997en07 %270 2 + %280 = OpCompositeInsert %v4float %float_1 %279 3 + OpBranch %277 + %277 = OpLabel + %281 = OpPhi %v4float %270 %115 %280 %278 + %282 = OpAccessChain %_ptr_Function_float %116 %uint_0 %int_2 + %283 = OpLoad %float %282 + %284 = OpAccessChain %_ptr_Function_float %116 %uint_1 %int_2 + %285 = OpLoad %float %284 + %286 = OpAccessChain %_ptr_Function_float %116 %uint_2 %int_2 + %287 = OpLoad %float %286 + %288 = OpCompositeConstruct %v3float %283 %285 %287 + %289 = OpDot %float %288 %236 + %290 = OpExtInst %float %1 FAbs %289 + %291 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_2 + %292 = OpLoad %float %291 + %293 = OpExtInst %float %1 FAbs %290 + %294 = OpFOrdGreaterThan %bool %293 %float_0 + %295 = OpFMul %float %290 %290 + %296 = OpFSub %float %float_1 %295 + %297 = OpExtInst %float %1 FClamp %296 %float_0 %float_1 + %298 = OpExtInst %float %1 Sqrt %297 + %299 = OpFDiv %float %298 %290 + %300 = OpSelect %float %294 %299 %292 + %301 = OpExtInst %float %1 FClamp %300 %float_0 %292 + %302 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_1 + %303 = OpLoad %float %302 + %304 = OpFMul %float %303 %301 + %305 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_0 + %306 = OpLoad %float %305 + %307 = OpFAdd %float %304 %306 + %308 = OpCompositeExtract %float %281 2 + %309 = OpVectorShuffle %v3float %264 %112 0 1 2 + OpStore %out_var_TEXCOORD10_centroid %227 + OpStore %out_var_TEXCOORD11_centroid %229 + OpStore %out_var_COLOR0 %231 + OpStore %out_var_TEXCOORD0 %234 + OpStore %out_var_PRIMITIVE_ID %122 + OpStore %out_var_TEXCOORD6 %308 + OpStore %out_var_TEXCOORD8 %307 + OpStore %out_var_TEXCOORD7 %309 + OpStore %gl_Position %281 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese new file mode 100644 index 0000000000..cb55bb4250 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese @@ -0,0 +1,1175 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 581 +; Schema: 0 + OpCapability Tessellation + OpCapability ClipDistance + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %MainDomain "main" %gl_ClipDistance %in_var_TEXCOORD6 %in_var_TEXCOORD8 %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_VS_To_DS_Position %in_var_VS_To_DS_VertexID %in_var_PN_POSITION %in_var_PN_DisplacementScales %in_var_PN_TessellationMultiplier %in_var_PN_WorldDisplacementMultiplier %in_var_PN_DominantVertex %in_var_PN_DominantVertex1 %in_var_PN_DominantVertex2 %in_var_PN_DominantEdge %in_var_PN_DominantEdge1 %in_var_PN_DominantEdge2 %in_var_PN_DominantEdge3 %in_var_PN_DominantEdge4 %in_var_PN_DominantEdge5 %gl_TessLevelOuter %gl_TessLevelInner %in_var_PN_POSITION9 %gl_TessCoord %gl_Position %out_var_TEXCOORD6 %out_var_TEXCOORD7 %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid + OpExecutionMode %MainDomain Triangles + OpExecutionMode %MainDomain SpacingFractionalOdd + OpExecutionMode %MainDomain VertexOrderCw + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_ClipToWorld" + OpMemberName %type_View 3 "View_TranslatedWorldToView" + OpMemberName %type_View 4 "View_ViewToTranslatedWorld" + OpMemberName %type_View 5 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 6 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 7 "View_ViewToClip" + OpMemberName %type_View 8 "View_ViewToClipNoAA" + OpMemberName %type_View 9 "View_ClipToView" + OpMemberName %type_View 10 "View_ClipToTranslatedWorld" + OpMemberName %type_View 11 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 12 "View_ScreenToWorld" + OpMemberName %type_View 13 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 14 "View_ViewForward" + OpMemberName %type_View 15 "PrePadding_View_908" + OpMemberName %type_View 16 "View_ViewUp" + OpMemberName %type_View 17 "PrePadding_View_924" + OpMemberName %type_View 18 "View_ViewRight" + OpMemberName %type_View 19 "PrePadding_View_940" + OpMemberName %type_View 20 "View_HMDViewNoRollUp" + OpMemberName %type_View 21 "PrePadding_View_956" + OpMemberName %type_View 22 "View_HMDViewNoRollRight" + OpMemberName %type_View 23 "PrePadding_View_972" + OpMemberName %type_View 24 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 25 "View_ScreenPositionScaleBias" + OpMemberName %type_View 26 "View_WorldCameraOrigin" + OpMemberName %type_View 27 "PrePadding_View_1020" + OpMemberName %type_View 28 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 29 "PrePadding_View_1036" + OpMemberName %type_View 30 "View_WorldViewOrigin" + OpMemberName %type_View 31 "PrePadding_View_1052" + OpMemberName %type_View 32 "View_PreViewTranslation" + OpMemberName %type_View 33 "PrePadding_View_1068" + OpMemberName %type_View 34 "View_PrevProjection" + OpMemberName %type_View 35 "View_PrevViewProj" + OpMemberName %type_View 36 "View_PrevViewRotationProj" + OpMemberName %type_View 37 "View_PrevViewToClip" + OpMemberName %type_View 38 "View_PrevClipToView" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 40 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 41 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 42 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 43 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 44 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 45 "PrePadding_View_1724" + OpMemberName %type_View 46 "View_PrevWorldViewOrigin" + OpMemberName %type_View 47 "PrePadding_View_1740" + OpMemberName %type_View 48 "View_PrevPreViewTranslation" + OpMemberName %type_View 49 "PrePadding_View_1756" + OpMemberName %type_View 50 "View_PrevInvViewProj" + OpMemberName %type_View 51 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 52 "View_ClipToPrevClip" + OpMemberName %type_View 53 "View_TemporalAAJitter" + OpMemberName %type_View 54 "View_GlobalClippingPlane" + OpMemberName %type_View 55 "View_FieldOfViewWideAngles" + OpMemberName %type_View 56 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 57 "View_ViewRectMin" + OpMemberName %type_View 58 "View_ViewSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferSizeAndInvSize" + OpMemberName %type_View 60 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 61 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 62 "View_PreExposure" + OpMemberName %type_View 63 "View_OneOverPreExposure" + OpMemberName %type_View 64 "PrePadding_View_2076" + OpMemberName %type_View 65 "View_DiffuseOverrideParameter" + OpMemberName %type_View 66 "View_SpecularOverrideParameter" + OpMemberName %type_View 67 "View_NormalOverrideParameter" + OpMemberName %type_View 68 "View_RoughnessOverrideParameter" + OpMemberName %type_View 69 "View_PrevFrameGameTime" + OpMemberName %type_View 70 "View_PrevFrameRealTime" + OpMemberName %type_View 71 "View_OutOfBoundsMask" + OpMemberName %type_View 72 "PrePadding_View_2148" + OpMemberName %type_View 73 "PrePadding_View_2152" + OpMemberName %type_View 74 "PrePadding_View_2156" + OpMemberName %type_View 75 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 76 "View_CullingSign" + OpMemberName %type_View 77 "View_NearPlane" + OpMemberName %type_View 78 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 79 "View_GameTime" + OpMemberName %type_View 80 "View_RealTime" + OpMemberName %type_View 81 "View_DeltaTime" + OpMemberName %type_View 82 "View_MaterialTextureMipBias" + OpMemberName %type_View 83 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 84 "View_Random" + OpMemberName %type_View 85 "View_FrameNumber" + OpMemberName %type_View 86 "View_StateFrameIndexMod8" + OpMemberName %type_View 87 "View_StateFrameIndex" + OpMemberName %type_View 88 "View_CameraCut" + OpMemberName %type_View 89 "View_UnlitViewmodeMask" + OpMemberName %type_View 90 "PrePadding_View_2228" + OpMemberName %type_View 91 "PrePadding_View_2232" + OpMemberName %type_View 92 "PrePadding_View_2236" + OpMemberName %type_View 93 "View_DirectionalLightColor" + OpMemberName %type_View 94 "View_DirectionalLightDirection" + OpMemberName %type_View 95 "PrePadding_View_2268" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 97 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 98 "View_TemporalAAParams" + OpMemberName %type_View 99 "View_CircleDOFParams" + OpMemberName %type_View 100 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 101 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 102 "View_DepthOfFieldScale" + OpMemberName %type_View 103 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 104 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 105 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 106 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 107 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 108 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 109 "View_GeneralPurposeTweak" + OpMemberName %type_View 110 "View_DemosaicVposOffset" + OpMemberName %type_View 111 "PrePadding_View_2412" + OpMemberName %type_View 112 "View_IndirectLightingColorScale" + OpMemberName %type_View 113 "View_HDR32bppEncodingMode" + OpMemberName %type_View 114 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 115 "View_AtmosphericFogSunPower" + OpMemberName %type_View 116 "View_AtmosphericFogPower" + OpMemberName %type_View 117 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 118 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 119 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 120 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 121 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 122 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 123 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 124 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 125 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 126 "View_AtmosphericFogSunDiscHalfApexAngleRadian" + OpMemberName %type_View 127 "PrePadding_View_2492" + OpMemberName %type_View 128 "View_AtmosphericFogSunDiscLuminance" + OpMemberName %type_View 129 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 130 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 131 "PrePadding_View_2520" + OpMemberName %type_View 132 "PrePadding_View_2524" + OpMemberName %type_View 133 "View_AtmosphericFogSunColor" + OpMemberName %type_View 134 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 135 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 136 "View_AmbientCubemapTint" + OpMemberName %type_View 137 "View_AmbientCubemapIntensity" + OpMemberName %type_View 138 "View_SkyLightParameters" + OpMemberName %type_View 139 "PrePadding_View_2584" + OpMemberName %type_View 140 "PrePadding_View_2588" + OpMemberName %type_View 141 "View_SkyLightColor" + OpMemberName %type_View 142 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 143 "View_MobilePreviewMode" + OpMemberName %type_View 144 "View_HMDEyePaddingOffset" + OpMemberName %type_View 145 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 146 "View_ShowDecalsMask" + OpMemberName %type_View 147 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 148 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 149 "PrePadding_View_2744" + OpMemberName %type_View 150 "PrePadding_View_2748" + OpMemberName %type_View 151 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 152 "View_StereoPassIndex" + OpMemberName %type_View 153 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 154 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 155 "View_GlobalVolumeDimension" + OpMemberName %type_View 156 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 157 "View_MaxGlobalDistance" + OpMemberName %type_View 158 "PrePadding_View_2908" + OpMemberName %type_View 159 "View_CursorPosition" + OpMemberName %type_View 160 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 161 "PrePadding_View_2924" + OpMemberName %type_View 162 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 163 "PrePadding_View_2940" + OpMemberName %type_View 164 "View_VolumetricFogGridZParams" + OpMemberName %type_View 165 "PrePadding_View_2956" + OpMemberName %type_View 166 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 167 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 168 "PrePadding_View_2972" + OpMemberName %type_View 169 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 170 "PrePadding_View_2988" + OpMemberName %type_View 171 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 172 "PrePadding_View_3004" + OpMemberName %type_View 173 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 174 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 175 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 176 "View_StereoIPD" + OpMemberName %type_View 177 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 178 "View_EyeToPixelSpreadAngle" + OpMemberName %type_View 179 "PrePadding_View_3048" + OpMemberName %type_View 180 "PrePadding_View_3052" + OpMemberName %type_View 181 "View_WorldToVirtualTexture" + OpMemberName %type_View 182 "View_VirtualTextureParams" + OpMemberName %type_View 183 "View_XRPassthroughCameraUVs" + OpName %View "View" + OpName %type_sampler "type.sampler" + OpName %type_3d_image "type.3d.image" + OpName %View_GlobalDistanceFieldTexture0 "View_GlobalDistanceFieldTexture0" + OpName %View_GlobalDistanceFieldSampler0 "View_GlobalDistanceFieldSampler0" + OpName %View_GlobalDistanceFieldTexture1 "View_GlobalDistanceFieldTexture1" + OpName %View_GlobalDistanceFieldTexture2 "View_GlobalDistanceFieldTexture2" + OpName %View_GlobalDistanceFieldTexture3 "View_GlobalDistanceFieldTexture3" + OpName %type_Material "type.Material" + OpMemberName %type_Material 0 "Material_VectorExpressions" + OpMemberName %type_Material 1 "Material_ScalarExpressions" + OpName %Material "Material" + OpName %in_var_TEXCOORD6 "in.var.TEXCOORD6" + OpName %in_var_TEXCOORD8 "in.var.TEXCOORD8" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_VS_To_DS_Position "in.var.VS_To_DS_Position" + OpName %in_var_VS_To_DS_VertexID "in.var.VS_To_DS_VertexID" + OpName %in_var_PN_POSITION "in.var.PN_POSITION" + OpName %in_var_PN_DisplacementScales "in.var.PN_DisplacementScales" + OpName %in_var_PN_TessellationMultiplier "in.var.PN_TessellationMultiplier" + OpName %in_var_PN_WorldDisplacementMultiplier "in.var.PN_WorldDisplacementMultiplier" + OpName %in_var_PN_DominantVertex "in.var.PN_DominantVertex" + OpName %in_var_PN_DominantVertex1 "in.var.PN_DominantVertex1" + OpName %in_var_PN_DominantVertex2 "in.var.PN_DominantVertex2" + OpName %in_var_PN_DominantEdge "in.var.PN_DominantEdge" + OpName %in_var_PN_DominantEdge1 "in.var.PN_DominantEdge1" + OpName %in_var_PN_DominantEdge2 "in.var.PN_DominantEdge2" + OpName %in_var_PN_DominantEdge3 "in.var.PN_DominantEdge3" + OpName %in_var_PN_DominantEdge4 "in.var.PN_DominantEdge4" + OpName %in_var_PN_DominantEdge5 "in.var.PN_DominantEdge5" + OpName %in_var_PN_POSITION9 "in.var.PN_POSITION9" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %out_var_TEXCOORD7 "out.var.TEXCOORD7" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %MainDomain "MainDomain" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_ClipDistance BuiltIn ClipDistance + OpDecorateString %gl_ClipDistance UserSemantic "SV_ClipDistance" + OpDecorateString %in_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %in_var_TEXCOORD8 UserSemantic "TEXCOORD8" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_VS_To_DS_Position UserSemantic "VS_To_DS_Position" + OpDecorateString %in_var_VS_To_DS_VertexID UserSemantic "VS_To_DS_VertexID" + OpDecorateString %in_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %in_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %in_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %in_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorateString %in_var_PN_DominantVertex UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantVertex1 UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantVertex2 UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantEdge UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge1 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge2 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge3 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge4 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge5 UserSemantic "PN_DominantEdge" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %in_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %in_var_PN_POSITION9 Patch + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorateString %gl_TessCoord UserSemantic "SV_DomainLocation" + OpDecorate %gl_TessCoord Patch + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %out_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorate %in_var_PN_DisplacementScales Location 0 + OpDecorate %in_var_PN_DominantEdge Location 1 + OpDecorate %in_var_PN_DominantEdge1 Location 2 + OpDecorate %in_var_PN_DominantEdge2 Location 3 + OpDecorate %in_var_PN_DominantEdge3 Location 4 + OpDecorate %in_var_PN_DominantEdge4 Location 5 + OpDecorate %in_var_PN_DominantEdge5 Location 6 + OpDecorate %in_var_PN_DominantVertex Location 7 + OpDecorate %in_var_PN_DominantVertex1 Location 8 + OpDecorate %in_var_PN_DominantVertex2 Location 9 + OpDecorate %in_var_PN_POSITION Location 10 + OpDecorate %in_var_PN_POSITION9 Location 13 + OpDecorate %in_var_PN_TessellationMultiplier Location 14 + OpDecorate %in_var_PN_WorldDisplacementMultiplier Location 15 + OpDecorate %in_var_TEXCOORD10_centroid Location 16 + OpDecorate %in_var_TEXCOORD11_centroid Location 17 + OpDecorate %in_var_TEXCOORD6 Location 18 + OpDecorate %in_var_TEXCOORD8 Location 19 + OpDecorate %in_var_VS_To_DS_Position Location 20 + OpDecorate %in_var_VS_To_DS_VertexID Location 21 + OpDecorate %out_var_TEXCOORD6 Location 0 + OpDecorate %out_var_TEXCOORD7 Location 1 + OpDecorate %out_var_TEXCOORD10_centroid Location 2 + OpDecorate %out_var_TEXCOORD11_centroid Location 3 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %View_GlobalDistanceFieldTexture0 DescriptorSet 0 + OpDecorate %View_GlobalDistanceFieldTexture0 Binding 0 + OpDecorate %View_GlobalDistanceFieldSampler0 DescriptorSet 0 + OpDecorate %View_GlobalDistanceFieldSampler0 Binding 0 + OpDecorate %View_GlobalDistanceFieldTexture1 DescriptorSet 0 + OpDecorate %View_GlobalDistanceFieldTexture1 Binding 1 + OpDecorate %View_GlobalDistanceFieldTexture2 DescriptorSet 0 + OpDecorate %View_GlobalDistanceFieldTexture2 Binding 2 + OpDecorate %View_GlobalDistanceFieldTexture3 DescriptorSet 0 + OpDecorate %View_GlobalDistanceFieldTexture3 Binding 3 + OpDecorate %Material DescriptorSet 0 + OpDecorate %Material Binding 1 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 13 MatrixStride 16 + OpMemberDecorate %type_View 13 ColMajor + OpMemberDecorate %type_View 14 Offset 896 + OpMemberDecorate %type_View 15 Offset 908 + OpMemberDecorate %type_View 16 Offset 912 + OpMemberDecorate %type_View 17 Offset 924 + OpMemberDecorate %type_View 18 Offset 928 + OpMemberDecorate %type_View 19 Offset 940 + OpMemberDecorate %type_View 20 Offset 944 + OpMemberDecorate %type_View 21 Offset 956 + OpMemberDecorate %type_View 22 Offset 960 + OpMemberDecorate %type_View 23 Offset 972 + OpMemberDecorate %type_View 24 Offset 976 + OpMemberDecorate %type_View 25 Offset 992 + OpMemberDecorate %type_View 26 Offset 1008 + OpMemberDecorate %type_View 27 Offset 1020 + OpMemberDecorate %type_View 28 Offset 1024 + OpMemberDecorate %type_View 29 Offset 1036 + OpMemberDecorate %type_View 30 Offset 1040 + OpMemberDecorate %type_View 31 Offset 1052 + OpMemberDecorate %type_View 32 Offset 1056 + OpMemberDecorate %type_View 33 Offset 1068 + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 43 MatrixStride 16 + OpMemberDecorate %type_View 43 ColMajor + OpMemberDecorate %type_View 44 Offset 1712 + OpMemberDecorate %type_View 45 Offset 1724 + OpMemberDecorate %type_View 46 Offset 1728 + OpMemberDecorate %type_View 47 Offset 1740 + OpMemberDecorate %type_View 48 Offset 1744 + OpMemberDecorate %type_View 49 Offset 1756 + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 52 MatrixStride 16 + OpMemberDecorate %type_View 52 ColMajor + OpMemberDecorate %type_View 53 Offset 1952 + OpMemberDecorate %type_View 54 Offset 1968 + OpMemberDecorate %type_View 55 Offset 1984 + OpMemberDecorate %type_View 56 Offset 1992 + OpMemberDecorate %type_View 57 Offset 2000 + OpMemberDecorate %type_View 58 Offset 2016 + OpMemberDecorate %type_View 59 Offset 2032 + OpMemberDecorate %type_View 60 Offset 2048 + OpMemberDecorate %type_View 61 Offset 2064 + OpMemberDecorate %type_View 62 Offset 2068 + OpMemberDecorate %type_View 63 Offset 2072 + OpMemberDecorate %type_View 64 Offset 2076 + OpMemberDecorate %type_View 65 Offset 2080 + OpMemberDecorate %type_View 66 Offset 2096 + OpMemberDecorate %type_View 67 Offset 2112 + OpMemberDecorate %type_View 68 Offset 2128 + OpMemberDecorate %type_View 69 Offset 2136 + OpMemberDecorate %type_View 70 Offset 2140 + OpMemberDecorate %type_View 71 Offset 2144 + OpMemberDecorate %type_View 72 Offset 2148 + OpMemberDecorate %type_View 73 Offset 2152 + OpMemberDecorate %type_View 74 Offset 2156 + OpMemberDecorate %type_View 75 Offset 2160 + OpMemberDecorate %type_View 76 Offset 2172 + OpMemberDecorate %type_View 77 Offset 2176 + OpMemberDecorate %type_View 78 Offset 2180 + OpMemberDecorate %type_View 79 Offset 2184 + OpMemberDecorate %type_View 80 Offset 2188 + OpMemberDecorate %type_View 81 Offset 2192 + OpMemberDecorate %type_View 82 Offset 2196 + OpMemberDecorate %type_View 83 Offset 2200 + OpMemberDecorate %type_View 84 Offset 2204 + OpMemberDecorate %type_View 85 Offset 2208 + OpMemberDecorate %type_View 86 Offset 2212 + OpMemberDecorate %type_View 87 Offset 2216 + OpMemberDecorate %type_View 88 Offset 2220 + OpMemberDecorate %type_View 89 Offset 2224 + OpMemberDecorate %type_View 90 Offset 2228 + OpMemberDecorate %type_View 91 Offset 2232 + OpMemberDecorate %type_View 92 Offset 2236 + OpMemberDecorate %type_View 93 Offset 2240 + OpMemberDecorate %type_View 94 Offset 2256 + OpMemberDecorate %type_View 95 Offset 2268 + OpMemberDecorate %type_View 96 Offset 2272 + OpMemberDecorate %type_View 97 Offset 2304 + OpMemberDecorate %type_View 98 Offset 2336 + OpMemberDecorate %type_View 99 Offset 2352 + OpMemberDecorate %type_View 100 Offset 2368 + OpMemberDecorate %type_View 101 Offset 2372 + OpMemberDecorate %type_View 102 Offset 2376 + OpMemberDecorate %type_View 103 Offset 2380 + OpMemberDecorate %type_View 104 Offset 2384 + OpMemberDecorate %type_View 105 Offset 2388 + OpMemberDecorate %type_View 106 Offset 2392 + OpMemberDecorate %type_View 107 Offset 2396 + OpMemberDecorate %type_View 108 Offset 2400 + OpMemberDecorate %type_View 109 Offset 2404 + OpMemberDecorate %type_View 110 Offset 2408 + OpMemberDecorate %type_View 111 Offset 2412 + OpMemberDecorate %type_View 112 Offset 2416 + OpMemberDecorate %type_View 113 Offset 2428 + OpMemberDecorate %type_View 114 Offset 2432 + OpMemberDecorate %type_View 115 Offset 2444 + OpMemberDecorate %type_View 116 Offset 2448 + OpMemberDecorate %type_View 117 Offset 2452 + OpMemberDecorate %type_View 118 Offset 2456 + OpMemberDecorate %type_View 119 Offset 2460 + OpMemberDecorate %type_View 120 Offset 2464 + OpMemberDecorate %type_View 121 Offset 2468 + OpMemberDecorate %type_View 122 Offset 2472 + OpMemberDecorate %type_View 123 Offset 2476 + OpMemberDecorate %type_View 124 Offset 2480 + OpMemberDecorate %type_View 125 Offset 2484 + OpMemberDecorate %type_View 126 Offset 2488 + OpMemberDecorate %type_View 127 Offset 2492 + OpMemberDecorate %type_View 128 Offset 2496 + OpMemberDecorate %type_View 129 Offset 2512 + OpMemberDecorate %type_View 130 Offset 2516 + OpMemberDecorate %type_View 131 Offset 2520 + OpMemberDecorate %type_View 132 Offset 2524 + OpMemberDecorate %type_View 133 Offset 2528 + OpMemberDecorate %type_View 134 Offset 2544 + OpMemberDecorate %type_View 135 Offset 2556 + OpMemberDecorate %type_View 136 Offset 2560 + OpMemberDecorate %type_View 137 Offset 2576 + OpMemberDecorate %type_View 138 Offset 2580 + OpMemberDecorate %type_View 139 Offset 2584 + OpMemberDecorate %type_View 140 Offset 2588 + OpMemberDecorate %type_View 141 Offset 2592 + OpMemberDecorate %type_View 142 Offset 2608 + OpMemberDecorate %type_View 143 Offset 2720 + OpMemberDecorate %type_View 144 Offset 2724 + OpMemberDecorate %type_View 145 Offset 2728 + OpMemberDecorate %type_View 146 Offset 2732 + OpMemberDecorate %type_View 147 Offset 2736 + OpMemberDecorate %type_View 148 Offset 2740 + OpMemberDecorate %type_View 149 Offset 2744 + OpMemberDecorate %type_View 150 Offset 2748 + OpMemberDecorate %type_View 151 Offset 2752 + OpMemberDecorate %type_View 152 Offset 2764 + OpMemberDecorate %type_View 153 Offset 2768 + OpMemberDecorate %type_View 154 Offset 2832 + OpMemberDecorate %type_View 155 Offset 2896 + OpMemberDecorate %type_View 156 Offset 2900 + OpMemberDecorate %type_View 157 Offset 2904 + OpMemberDecorate %type_View 158 Offset 2908 + OpMemberDecorate %type_View 159 Offset 2912 + OpMemberDecorate %type_View 160 Offset 2920 + OpMemberDecorate %type_View 161 Offset 2924 + OpMemberDecorate %type_View 162 Offset 2928 + OpMemberDecorate %type_View 163 Offset 2940 + OpMemberDecorate %type_View 164 Offset 2944 + OpMemberDecorate %type_View 165 Offset 2956 + OpMemberDecorate %type_View 166 Offset 2960 + OpMemberDecorate %type_View 167 Offset 2968 + OpMemberDecorate %type_View 168 Offset 2972 + OpMemberDecorate %type_View 169 Offset 2976 + OpMemberDecorate %type_View 170 Offset 2988 + OpMemberDecorate %type_View 171 Offset 2992 + OpMemberDecorate %type_View 172 Offset 3004 + OpMemberDecorate %type_View 173 Offset 3008 + OpMemberDecorate %type_View 174 Offset 3020 + OpMemberDecorate %type_View 175 Offset 3024 + OpMemberDecorate %type_View 176 Offset 3036 + OpMemberDecorate %type_View 177 Offset 3040 + OpMemberDecorate %type_View 178 Offset 3044 + OpMemberDecorate %type_View 179 Offset 3048 + OpMemberDecorate %type_View 180 Offset 3052 + OpMemberDecorate %type_View 181 Offset 3056 + OpMemberDecorate %type_View 181 MatrixStride 16 + OpMemberDecorate %type_View 181 ColMajor + OpMemberDecorate %type_View 182 Offset 3120 + OpMemberDecorate %type_View 183 Offset 3136 + OpDecorate %type_View Block + OpDecorate %_arr_v4float_uint_5 ArrayStride 16 + OpMemberDecorate %type_Material 0 Offset 0 + OpMemberDecorate %type_Material 1 Offset 80 + OpDecorate %type_Material Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %v2int = OpTypeVector %int 2 +%float_0_00100000005 = OpConstant %float 0.00100000005 + %uint_0 = OpConstant %uint 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_3 = OpConstant %float 3 + %uint_1 = OpConstant %uint 1 + %float_6 = OpConstant %float 6 + %67 = OpConstantComposite %v4float %float_6 %float_6 %float_6 %float_6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %float_2 = OpConstant %float 2 + %int_26 = OpConstant %int 26 + %int_32 = OpConstant %int 32 + %int_54 = OpConstant %int 54 + %int_153 = OpConstant %int 153 + %int_154 = OpConstant %int 154 + %int_156 = OpConstant %int 156 + %int_157 = OpConstant %int 157 + %float_10 = OpConstant %float 10 + %uint_3 = OpConstant %uint 3 + %81 = OpConstantComposite %v3float %float_0 %float_0 %float_0 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %float %float %v4float %uint %uint %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v2int %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float %float %float %mat4v4float %v4float %_arr_v4float_uint_2 +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%type_3d_image = OpTypeImage %float 3D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_3d_image = OpTypePointer UniformConstant %type_3d_image + %uint_5 = OpConstant %uint 5 +%_arr_v4float_uint_5 = OpTypeArray %v4float %uint_5 +%type_Material = OpTypeStruct %_arr_v4float_uint_5 %_arr_v4float_uint_2 +%_ptr_Uniform_type_Material = OpTypePointer Uniform %type_Material +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Input__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Input %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Input__arr_v3float_uint_3 = OpTypePointer Input %_arr_v3float_uint_3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Input__arr_float_uint_3 = OpTypePointer Input %_arr_float_uint_3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Input__arr_v2float_uint_3 = OpTypePointer Input %_arr_v2float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %109 = OpTypeFunction %void +%_ptr_Output_float = OpTypePointer Output %float +%mat3v3float = OpTypeMatrix %v3float 3 + %bool = OpTypeBool +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%type_sampled_image = OpTypeSampledImage %type_3d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform +%View_GlobalDistanceFieldTexture0 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant +%View_GlobalDistanceFieldSampler0 = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%View_GlobalDistanceFieldTexture1 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant +%View_GlobalDistanceFieldTexture2 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant +%View_GlobalDistanceFieldTexture3 = OpVariable %_ptr_UniformConstant_type_3d_image UniformConstant + %Material = OpVariable %_ptr_Uniform_type_Material Uniform +%gl_ClipDistance = OpVariable %_ptr_Output__arr_float_uint_1 Output +%in_var_TEXCOORD6 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD8 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_VS_To_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_VS_To_DS_VertexID = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%in_var_PN_POSITION = OpVariable %_ptr_Input__arr__arr_v4float_uint_3_uint_3 Input +%in_var_PN_DisplacementScales = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_TessellationMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_PN_DominantVertex = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantVertex1 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantVertex2 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_DominantEdge = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantEdge1 = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantEdge2 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantEdge3 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantEdge4 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_DominantEdge5 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input +%in_var_PN_POSITION9 = OpVariable %_ptr_Input_v4float Input +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input +%gl_Position = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD7 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output_v4float Output + %117 = OpConstantNull %v4float + %118 = OpUndef %v4float + %MainDomain = OpFunction %void None %109 + %119 = OpLabel + %120 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD6 + %121 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD8 + %122 = OpCompositeExtract %v4float %120 0 + %123 = OpCompositeExtract %v4float %121 0 + %124 = OpCompositeExtract %v4float %120 1 + %125 = OpCompositeExtract %v4float %121 1 + %126 = OpCompositeExtract %v4float %120 2 + %127 = OpCompositeExtract %v4float %121 2 + %128 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD10_centroid + %129 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD11_centroid + %130 = OpCompositeExtract %v4float %128 0 + %131 = OpCompositeExtract %v4float %129 0 + %132 = OpCompositeExtract %v4float %128 1 + %133 = OpCompositeExtract %v4float %129 1 + %134 = OpCompositeExtract %v4float %128 2 + %135 = OpCompositeExtract %v4float %129 2 + %136 = OpLoad %_arr__arr_v4float_uint_3_uint_3 %in_var_PN_POSITION + %137 = OpLoad %_arr_float_uint_3 %in_var_PN_WorldDisplacementMultiplier + %138 = OpLoad %_arr_v4float_uint_3 %in_var_PN_DominantVertex1 + %139 = OpLoad %_arr_v3float_uint_3 %in_var_PN_DominantVertex2 + %140 = OpCompositeExtract %v4float %138 0 + %141 = OpCompositeExtract %v3float %139 0 + %142 = OpCompositeExtract %v4float %138 1 + %143 = OpCompositeExtract %v3float %139 1 + %144 = OpCompositeExtract %v4float %138 2 + %145 = OpCompositeExtract %v3float %139 2 + %146 = OpLoad %_arr_v4float_uint_3 %in_var_PN_DominantEdge2 + %147 = OpLoad %_arr_v4float_uint_3 %in_var_PN_DominantEdge3 + %148 = OpLoad %_arr_v3float_uint_3 %in_var_PN_DominantEdge4 + %149 = OpLoad %_arr_v3float_uint_3 %in_var_PN_DominantEdge5 + %150 = OpCompositeExtract %v4float %146 0 + %151 = OpCompositeExtract %v4float %147 0 + %152 = OpCompositeExtract %v3float %148 0 + %153 = OpCompositeExtract %v3float %149 0 + %154 = OpCompositeExtract %v4float %146 1 + %155 = OpCompositeExtract %v4float %147 1 + %156 = OpCompositeExtract %v3float %148 1 + %157 = OpCompositeExtract %v3float %149 1 + %158 = OpCompositeExtract %v4float %146 2 + %159 = OpCompositeExtract %v4float %147 2 + %160 = OpCompositeExtract %v3float %148 2 + %161 = OpCompositeExtract %v3float %149 2 + %162 = OpCompositeExtract %_arr_v4float_uint_3 %136 0 + %163 = OpCompositeExtract %float %137 0 + %164 = OpCompositeExtract %_arr_v4float_uint_3 %136 1 + %165 = OpCompositeExtract %float %137 1 + %166 = OpCompositeExtract %_arr_v4float_uint_3 %136 2 + %167 = OpCompositeExtract %float %137 2 + %168 = OpCompositeExtract %v4float %162 0 + %169 = OpCompositeExtract %v4float %162 1 + %170 = OpCompositeExtract %v4float %162 2 + %171 = OpCompositeExtract %v4float %164 0 + %172 = OpCompositeExtract %v4float %164 1 + %173 = OpCompositeExtract %v4float %164 2 + %174 = OpCompositeExtract %v4float %166 0 + %175 = OpCompositeExtract %v4float %166 1 + %176 = OpCompositeExtract %v4float %166 2 + %177 = OpLoad %v4float %in_var_PN_POSITION9 + %178 = OpLoad %v3float %gl_TessCoord + %179 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %180 = OpLoad %mat4v4float %179 + %181 = OpAccessChain %_ptr_Uniform_v3float %View %int_26 + %182 = OpLoad %v3float %181 + %183 = OpAccessChain %_ptr_Uniform_v3float %View %int_32 + %184 = OpLoad %v3float %183 + %185 = OpAccessChain %_ptr_Uniform_v4float %View %int_54 + %186 = OpLoad %v4float %185 + %187 = OpCompositeExtract %float %178 0 + %188 = OpCompositeExtract %float %178 1 + %189 = OpCompositeExtract %float %178 2 + %190 = OpFMul %float %187 %187 + %191 = OpFMul %float %188 %188 + %192 = OpFMul %float %189 %189 + %193 = OpFMul %float %190 %float_3 + %194 = OpFMul %float %191 %float_3 + %195 = OpFMul %float %192 %float_3 + %196 = OpCompositeConstruct %v4float %190 %190 %190 %190 + %197 = OpFMul %v4float %168 %196 + %198 = OpCompositeConstruct %v4float %187 %187 %187 %187 + %199 = OpFMul %v4float %197 %198 + %200 = OpCompositeConstruct %v4float %191 %191 %191 %191 + %201 = OpFMul %v4float %171 %200 + %202 = OpCompositeConstruct %v4float %188 %188 %188 %188 + %203 = OpFMul %v4float %201 %202 + %204 = OpFAdd %v4float %199 %203 + %205 = OpCompositeConstruct %v4float %192 %192 %192 %192 + %206 = OpFMul %v4float %174 %205 + %207 = OpCompositeConstruct %v4float %189 %189 %189 %189 + %208 = OpFMul %v4float %206 %207 + %209 = OpFAdd %v4float %204 %208 + %210 = OpCompositeConstruct %v4float %193 %193 %193 %193 + %211 = OpFMul %v4float %169 %210 + %212 = OpFMul %v4float %211 %202 + %213 = OpFAdd %v4float %209 %212 + %214 = OpCompositeConstruct %v4float %194 %194 %194 %194 + %215 = OpFMul %v4float %170 %214 + %216 = OpFMul %v4float %215 %198 + %217 = OpFAdd %v4float %213 %216 + %218 = OpFMul %v4float %172 %214 + %219 = OpFMul %v4float %218 %207 + %220 = OpFAdd %v4float %217 %219 + %221 = OpCompositeConstruct %v4float %195 %195 %195 %195 + %222 = OpFMul %v4float %173 %221 + %223 = OpFMul %v4float %222 %202 + %224 = OpFAdd %v4float %220 %223 + %225 = OpFMul %v4float %175 %221 + %226 = OpFMul %v4float %225 %198 + %227 = OpFAdd %v4float %224 %226 + %228 = OpFMul %v4float %176 %210 + %229 = OpFMul %v4float %228 %207 + %230 = OpFAdd %v4float %227 %229 + %231 = OpFMul %v4float %177 %67 + %232 = OpFMul %v4float %231 %207 + %233 = OpFMul %v4float %232 %198 + %234 = OpFMul %v4float %233 %202 + %235 = OpFAdd %v4float %230 %234 + %236 = OpVectorShuffle %v3float %130 %130 0 1 2 + %237 = OpCompositeConstruct %v3float %187 %187 %187 + %238 = OpFMul %v3float %236 %237 + %239 = OpVectorShuffle %v3float %132 %132 0 1 2 + %240 = OpCompositeConstruct %v3float %188 %188 %188 + %241 = OpFMul %v3float %239 %240 + %242 = OpFAdd %v3float %238 %241 + %243 = OpFMul %v4float %131 %198 + %244 = OpFMul %v4float %133 %202 + %245 = OpFAdd %v4float %243 %244 + %246 = OpFMul %v4float %122 %198 + %247 = OpFMul %v4float %124 %202 + %248 = OpFAdd %v4float %246 %247 + %249 = OpFMul %v4float %123 %198 + %250 = OpFMul %v4float %125 %202 + %251 = OpFAdd %v4float %249 %250 + %252 = OpVectorShuffle %v3float %242 %117 0 1 2 + %253 = OpVectorShuffle %v3float %134 %134 0 1 2 + %254 = OpCompositeConstruct %v3float %189 %189 %189 + %255 = OpFMul %v3float %253 %254 + %256 = OpFAdd %v3float %252 %255 + %257 = OpVectorShuffle %v4float %118 %256 4 5 6 3 + %258 = OpFMul %v4float %135 %207 + %259 = OpFAdd %v4float %245 %258 + %260 = OpFMul %v4float %126 %207 + %261 = OpFAdd %v4float %248 %260 + %262 = OpFMul %v4float %127 %207 + %263 = OpFAdd %v4float %251 %262 + %264 = OpVectorShuffle %v3float %235 %235 0 1 2 + %265 = OpVectorShuffle %v3float %256 %117 0 1 2 + %266 = OpVectorShuffle %v3float %259 %259 0 1 2 + %267 = OpExtInst %v3float %1 Cross %266 %265 + %268 = OpCompositeExtract %float %259 3 + %269 = OpCompositeConstruct %v3float %268 %268 %268 + %270 = OpFMul %v3float %267 %269 + %271 = OpCompositeConstruct %mat3v3float %265 %270 %266 + %272 = OpFAdd %v3float %264 %182 + %273 = OpCompositeExtract %float %259 0 + %274 = OpCompositeExtract %float %259 1 + %275 = OpCompositeExtract %float %259 2 + %276 = OpCompositeConstruct %v4float %273 %274 %275 %float_0 + %277 = OpFOrdEqual %bool %187 %float_0 + %278 = OpSelect %int %277 %int_1 %int_0 + %279 = OpConvertSToF %float %278 + %280 = OpFOrdEqual %bool %188 %float_0 + %281 = OpSelect %int %280 %int_1 %int_0 + %282 = OpConvertSToF %float %281 + %283 = OpFOrdEqual %bool %189 %float_0 + %284 = OpSelect %int %283 %int_1 %int_0 + %285 = OpConvertSToF %float %284 + %286 = OpFAdd %float %279 %282 + %287 = OpFAdd %float %286 %285 + %288 = OpFOrdEqual %bool %287 %float_2 + %289 = OpSelect %int %288 %int_1 %int_0 + %290 = OpConvertSToF %float %289 + %291 = OpFOrdEqual %bool %287 %float_1 + %292 = OpSelect %int %291 %int_1 %int_0 + %293 = OpConvertSToF %float %292 + %294 = OpFOrdEqual %bool %287 %float_0 + %295 = OpSelect %int %294 %int_1 %int_0 + %296 = OpConvertSToF %float %295 + %297 = OpFOrdEqual %bool %290 %float_1 + OpSelectionMerge %298 None + OpBranchConditional %297 %299 %300 + %300 = OpLabel + %301 = OpFOrdNotEqual %bool %293 %float_0 + OpSelectionMerge %302 None + OpBranchConditional %301 %303 %302 + %303 = OpLabel + %304 = OpCompositeConstruct %v4float %279 %279 %279 %279 + %305 = OpFMul %v4float %304 %150 + %306 = OpCompositeConstruct %v4float %282 %282 %282 %282 + %307 = OpFMul %v4float %306 %154 + %308 = OpFAdd %v4float %305 %307 + %309 = OpCompositeConstruct %v4float %285 %285 %285 %285 + %310 = OpFMul %v4float %309 %158 + %311 = OpFAdd %v4float %308 %310 + %312 = OpFMul %v4float %304 %151 + %313 = OpFMul %v4float %306 %155 + %314 = OpFAdd %v4float %312 %313 + %315 = OpFMul %v4float %309 %159 + %316 = OpFAdd %v4float %314 %315 + %317 = OpFMul %v4float %202 %311 + %318 = OpFMul %v4float %207 %316 + %319 = OpFAdd %v4float %317 %318 + %320 = OpFMul %v4float %304 %319 + %321 = OpFMul %v4float %207 %311 + %322 = OpFMul %v4float %198 %316 + %323 = OpFAdd %v4float %321 %322 + %324 = OpFMul %v4float %306 %323 + %325 = OpFAdd %v4float %320 %324 + %326 = OpFMul %v4float %198 %311 + %327 = OpFMul %v4float %202 %316 + %328 = OpFAdd %v4float %326 %327 + %329 = OpFMul %v4float %309 %328 + %330 = OpFAdd %v4float %325 %329 + %331 = OpCompositeConstruct %v3float %279 %279 %279 + %332 = OpFMul %v3float %331 %152 + %333 = OpCompositeConstruct %v3float %282 %282 %282 + %334 = OpFMul %v3float %333 %156 + %335 = OpFAdd %v3float %332 %334 + %336 = OpCompositeConstruct %v3float %285 %285 %285 + %337 = OpFMul %v3float %336 %160 + %338 = OpFAdd %v3float %335 %337 + %339 = OpFMul %v3float %331 %153 + %340 = OpFMul %v3float %333 %157 + %341 = OpFAdd %v3float %339 %340 + %342 = OpFMul %v3float %336 %161 + %343 = OpFAdd %v3float %341 %342 + %344 = OpFMul %v3float %240 %338 + %345 = OpFMul %v3float %254 %343 + %346 = OpFAdd %v3float %344 %345 + %347 = OpFMul %v3float %331 %346 + %348 = OpFMul %v3float %254 %338 + %349 = OpFMul %v3float %237 %343 + %350 = OpFAdd %v3float %348 %349 + %351 = OpFMul %v3float %333 %350 + %352 = OpFAdd %v3float %347 %351 + %353 = OpFMul %v3float %237 %338 + %354 = OpFMul %v3float %240 %343 + %355 = OpFAdd %v3float %353 %354 + %356 = OpFMul %v3float %336 %355 + %357 = OpFAdd %v3float %352 %356 + OpBranch %302 + %302 = OpLabel + %358 = OpPhi %v4float %276 %300 %330 %303 + %359 = OpPhi %v3float %265 %300 %357 %303 + OpBranch %298 + %299 = OpLabel + %360 = OpFAdd %float %282 %285 + %361 = OpFOrdEqual %bool %360 %float_2 + %362 = OpSelect %int %361 %int_1 %int_0 + %363 = OpConvertSToF %float %362 + %364 = OpFAdd %float %285 %279 + %365 = OpFOrdEqual %bool %364 %float_2 + %366 = OpSelect %int %365 %int_1 %int_0 + %367 = OpConvertSToF %float %366 + %368 = OpFOrdEqual %bool %286 %float_2 + %369 = OpSelect %int %368 %int_1 %int_0 + %370 = OpConvertSToF %float %369 + %371 = OpCompositeConstruct %v4float %363 %363 %363 %363 + %372 = OpFMul %v4float %371 %140 + %373 = OpCompositeConstruct %v4float %367 %367 %367 %367 + %374 = OpFMul %v4float %373 %142 + %375 = OpFAdd %v4float %372 %374 + %376 = OpCompositeConstruct %v4float %370 %370 %370 %370 + %377 = OpFMul %v4float %376 %144 + %378 = OpFAdd %v4float %375 %377 + %379 = OpCompositeConstruct %v3float %363 %363 %363 + %380 = OpFMul %v3float %379 %141 + %381 = OpCompositeConstruct %v3float %367 %367 %367 + %382 = OpFMul %v3float %381 %143 + %383 = OpFAdd %v3float %380 %382 + %384 = OpCompositeConstruct %v3float %370 %370 %370 + %385 = OpFMul %v3float %384 %145 + %386 = OpFAdd %v3float %383 %385 + OpBranch %298 + %298 = OpLabel + %387 = OpPhi %v4float %378 %299 %358 %302 + %388 = OpPhi %v3float %386 %299 %359 %302 + %389 = OpFOrdEqual %bool %296 %float_0 + OpSelectionMerge %390 None + OpBranchConditional %389 %391 %390 + %391 = OpLabel + %392 = OpVectorShuffle %v3float %387 %387 0 1 2 + %393 = OpExtInst %v3float %1 Cross %392 %388 + %394 = OpCompositeExtract %float %387 3 + %395 = OpCompositeConstruct %v3float %394 %394 %394 + %396 = OpFMul %v3float %393 %395 + %397 = OpCompositeConstruct %mat3v3float %388 %396 %392 + OpBranch %390 + %390 = OpLabel + %398 = OpPhi %mat3v3float %271 %298 %397 %391 + %399 = OpAccessChain %_ptr_Uniform_float %View %int_157 + %400 = OpLoad %float %399 + %401 = OpAccessChain %_ptr_Uniform_v4float %View %int_153 %int_0 + %402 = OpLoad %v4float %401 + %403 = OpVectorShuffle %v3float %402 %402 0 1 2 + %404 = OpVectorShuffle %v3float %402 %402 3 3 3 + %405 = OpFSub %v3float %272 %403 + %406 = OpFAdd %v3float %405 %404 + %407 = OpExtInst %v3float %1 FMax %406 %81 + %408 = OpFAdd %v3float %403 %404 + %409 = OpFSub %v3float %408 %272 + %410 = OpExtInst %v3float %1 FMax %409 %81 + %411 = OpExtInst %v3float %1 FMin %407 %410 + %412 = OpCompositeExtract %float %411 0 + %413 = OpCompositeExtract %float %411 1 + %414 = OpCompositeExtract %float %411 2 + %415 = OpExtInst %float %1 FMin %413 %414 + %416 = OpExtInst %float %1 FMin %412 %415 + %417 = OpAccessChain %_ptr_Uniform_float %View %int_153 %int_0 %int_3 + %418 = OpLoad %float %417 + %419 = OpAccessChain %_ptr_Uniform_float %View %int_156 + %420 = OpLoad %float %419 + %421 = OpFMul %float %418 %420 + %422 = OpFOrdGreaterThan %bool %416 %421 + OpSelectionMerge %423 DontFlatten + OpBranchConditional %422 %424 %425 + %425 = OpLabel + %426 = OpAccessChain %_ptr_Uniform_v4float %View %int_153 %int_1 + %427 = OpLoad %v4float %426 + %428 = OpVectorShuffle %v3float %427 %427 0 1 2 + %429 = OpVectorShuffle %v3float %427 %427 3 3 3 + %430 = OpFSub %v3float %272 %428 + %431 = OpFAdd %v3float %430 %429 + %432 = OpExtInst %v3float %1 FMax %431 %81 + %433 = OpFAdd %v3float %428 %429 + %434 = OpFSub %v3float %433 %272 + %435 = OpExtInst %v3float %1 FMax %434 %81 + %436 = OpExtInst %v3float %1 FMin %432 %435 + %437 = OpCompositeExtract %float %436 0 + %438 = OpCompositeExtract %float %436 1 + %439 = OpCompositeExtract %float %436 2 + %440 = OpExtInst %float %1 FMin %438 %439 + %441 = OpExtInst %float %1 FMin %437 %440 + %442 = OpAccessChain %_ptr_Uniform_float %View %int_153 %int_1 %int_3 + %443 = OpLoad %float %442 + %444 = OpFMul %float %443 %420 + %445 = OpFOrdGreaterThan %bool %441 %444 + OpSelectionMerge %446 DontFlatten + OpBranchConditional %445 %447 %448 + %448 = OpLabel + %449 = OpAccessChain %_ptr_Uniform_v4float %View %int_153 %int_2 + %450 = OpLoad %v4float %449 + %451 = OpVectorShuffle %v3float %450 %450 0 1 2 + %452 = OpVectorShuffle %v3float %450 %450 3 3 3 + %453 = OpFSub %v3float %272 %451 + %454 = OpFAdd %v3float %453 %452 + %455 = OpExtInst %v3float %1 FMax %454 %81 + %456 = OpFAdd %v3float %451 %452 + %457 = OpFSub %v3float %456 %272 + %458 = OpExtInst %v3float %1 FMax %457 %81 + %459 = OpExtInst %v3float %1 FMin %455 %458 + %460 = OpCompositeExtract %float %459 0 + %461 = OpCompositeExtract %float %459 1 + %462 = OpCompositeExtract %float %459 2 + %463 = OpExtInst %float %1 FMin %461 %462 + %464 = OpExtInst %float %1 FMin %460 %463 + %465 = OpAccessChain %_ptr_Uniform_v4float %View %int_153 %int_3 + %466 = OpLoad %v4float %465 + %467 = OpVectorShuffle %v3float %466 %466 0 1 2 + %468 = OpVectorShuffle %v3float %466 %466 3 3 3 + %469 = OpFSub %v3float %272 %467 + %470 = OpFAdd %v3float %469 %468 + %471 = OpExtInst %v3float %1 FMax %470 %81 + %472 = OpFAdd %v3float %467 %468 + %473 = OpFSub %v3float %472 %272 + %474 = OpExtInst %v3float %1 FMax %473 %81 + %475 = OpExtInst %v3float %1 FMin %471 %474 + %476 = OpCompositeExtract %float %475 0 + %477 = OpCompositeExtract %float %475 1 + %478 = OpCompositeExtract %float %475 2 + %479 = OpExtInst %float %1 FMin %477 %478 + %480 = OpExtInst %float %1 FMin %476 %479 + %481 = OpAccessChain %_ptr_Uniform_float %View %int_153 %int_2 %int_3 + %482 = OpLoad %float %481 + %483 = OpFMul %float %482 %420 + %484 = OpFOrdGreaterThan %bool %464 %483 + OpSelectionMerge %485 DontFlatten + OpBranchConditional %484 %486 %487 + %487 = OpLabel + %488 = OpAccessChain %_ptr_Uniform_float %View %int_153 %int_3 %int_3 + %489 = OpLoad %float %488 + %490 = OpFMul %float %489 %420 + %491 = OpFOrdGreaterThan %bool %480 %490 + OpSelectionMerge %492 None + OpBranchConditional %491 %493 %492 + %493 = OpLabel + %494 = OpFMul %float %480 %float_10 + %495 = OpAccessChain %_ptr_Uniform_float %View %int_154 %int_3 %int_3 + %496 = OpLoad %float %495 + %497 = OpFMul %float %494 %496 + %498 = OpExtInst %float %1 FClamp %497 %float_0 %float_1 + %499 = OpAccessChain %_ptr_Uniform_v4float %View %int_154 %uint_3 + %500 = OpLoad %v4float %499 + %501 = OpVectorShuffle %v3float %500 %500 3 3 3 + %502 = OpFMul %v3float %272 %501 + %503 = OpVectorShuffle %v3float %500 %500 0 1 2 + %504 = OpFAdd %v3float %502 %503 + %505 = OpLoad %type_3d_image %View_GlobalDistanceFieldTexture3 + %506 = OpLoad %type_sampler %View_GlobalDistanceFieldSampler0 + %507 = OpSampledImage %type_sampled_image %505 %506 + %508 = OpImageSampleExplicitLod %v4float %507 %504 Lod %float_0 + %509 = OpCompositeExtract %float %508 0 + %510 = OpExtInst %float %1 FMix %400 %509 %498 + OpBranch %492 + %492 = OpLabel + %511 = OpPhi %float %400 %487 %510 %493 + OpBranch %485 + %486 = OpLabel + %512 = OpAccessChain %_ptr_Uniform_v4float %View %int_154 %uint_2 + %513 = OpLoad %v4float %512 + %514 = OpVectorShuffle %v3float %513 %513 3 3 3 + %515 = OpFMul %v3float %272 %514 + %516 = OpVectorShuffle %v3float %513 %513 0 1 2 + %517 = OpFAdd %v3float %515 %516 + %518 = OpLoad %type_3d_image %View_GlobalDistanceFieldTexture2 + %519 = OpLoad %type_sampler %View_GlobalDistanceFieldSampler0 + %520 = OpSampledImage %type_sampled_image %518 %519 + %521 = OpImageSampleExplicitLod %v4float %520 %517 Lod %float_0 + %522 = OpCompositeExtract %float %521 0 + OpBranch %485 + %485 = OpLabel + %523 = OpPhi %float %522 %486 %511 %492 + OpBranch %446 + %447 = OpLabel + %524 = OpAccessChain %_ptr_Uniform_v4float %View %int_154 %uint_1 + %525 = OpLoad %v4float %524 + %526 = OpVectorShuffle %v3float %525 %525 3 3 3 + %527 = OpFMul %v3float %272 %526 + %528 = OpVectorShuffle %v3float %525 %525 0 1 2 + %529 = OpFAdd %v3float %527 %528 + %530 = OpLoad %type_3d_image %View_GlobalDistanceFieldTexture1 + %531 = OpLoad %type_sampler %View_GlobalDistanceFieldSampler0 + %532 = OpSampledImage %type_sampled_image %530 %531 + %533 = OpImageSampleExplicitLod %v4float %532 %529 Lod %float_0 + %534 = OpCompositeExtract %float %533 0 + OpBranch %446 + %446 = OpLabel + %535 = OpPhi %float %534 %447 %523 %485 + OpBranch %423 + %424 = OpLabel + %536 = OpAccessChain %_ptr_Uniform_v4float %View %int_154 %uint_0 + %537 = OpLoad %v4float %536 + %538 = OpVectorShuffle %v3float %537 %537 3 3 3 + %539 = OpFMul %v3float %272 %538 + %540 = OpVectorShuffle %v3float %537 %537 0 1 2 + %541 = OpFAdd %v3float %539 %540 + %542 = OpLoad %type_3d_image %View_GlobalDistanceFieldTexture0 + %543 = OpLoad %type_sampler %View_GlobalDistanceFieldSampler0 + %544 = OpSampledImage %type_sampled_image %542 %543 + %545 = OpImageSampleExplicitLod %v4float %544 %541 Lod %float_0 + %546 = OpCompositeExtract %float %545 0 + OpBranch %423 + %423 = OpLabel + %547 = OpPhi %float %546 %424 %535 %446 + %548 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_2 + %549 = OpLoad %float %548 + %550 = OpFAdd %float %547 %549 + %551 = OpExtInst %float %1 FMin %550 %float_0 + %552 = OpAccessChain %_ptr_Uniform_float %Material %int_1 %int_0 %int_3 + %553 = OpLoad %float %552 + %554 = OpFMul %float %551 %553 + %555 = OpCompositeExtract %v3float %398 2 + %556 = OpCompositeConstruct %v3float %554 %554 %554 + %557 = OpFMul %v3float %555 %556 + %558 = OpFMul %float %163 %187 + %559 = OpFMul %float %165 %188 + %560 = OpFAdd %float %558 %559 + %561 = OpFMul %float %167 %189 + %562 = OpFAdd %float %560 %561 + %563 = OpCompositeConstruct %v3float %562 %562 %562 + %564 = OpFMul %v3float %557 %563 + %565 = OpFAdd %v3float %264 %564 + %566 = OpVectorShuffle %v4float %235 %565 4 5 6 3 + %567 = OpVectorShuffle %v3float %565 %117 0 1 2 + %568 = OpFSub %v3float %567 %184 + %569 = OpCompositeExtract %float %568 0 + %570 = OpCompositeExtract %float %568 1 + %571 = OpCompositeExtract %float %568 2 + %572 = OpCompositeConstruct %v4float %569 %570 %571 %float_1 + %573 = OpDot %float %186 %572 + %574 = OpMatrixTimesVector %v4float %180 %566 + %575 = OpCompositeExtract %float %574 3 + %576 = OpFMul %float %float_0_00100000005 %575 + %577 = OpCompositeExtract %float %574 2 + %578 = OpFAdd %float %577 %576 + %579 = OpCompositeInsert %v4float %578 %574 2 + OpStore %gl_Position %579 + OpStore %out_var_TEXCOORD6 %261 + OpStore %out_var_TEXCOORD7 %263 + OpStore %out_var_TEXCOORD10_centroid %257 + OpStore %out_var_TEXCOORD11_centroid %259 + %580 = OpAccessChain %_ptr_Output_float %gl_ClipDistance %uint_0 + OpStore %580 %573 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese new file mode 100644 index 0000000000..e792c7e116 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese @@ -0,0 +1,547 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 236 +; Schema: 0 + OpCapability Tessellation + OpCapability SampledBuffer + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %MainDomain "main" %in_var_TEXCOORD10_centroid %in_var_TEXCOORD11_centroid %in_var_VS_to_DS_Position %in_var_VS_To_DS_VertexID %in_var_PN_POSITION %in_var_PN_DisplacementScales %in_var_PN_TessellationMultiplier %in_var_PN_WorldDisplacementMultiplier %in_var_PN_DominantVertex %in_var_PN_DominantVertex1 %in_var_PN_DominantVertex2 %in_var_PN_DominantEdge %in_var_PN_DominantEdge1 %in_var_PN_DominantEdge2 %in_var_PN_DominantEdge3 %in_var_PN_DominantEdge4 %in_var_PN_DominantEdge5 %gl_TessLevelOuter %gl_TessLevelInner %in_var_PN_POSITION9 %gl_TessCoord %out_var_TEXCOORD10_centroid %out_var_TEXCOORD11_centroid %out_var_TEXCOORD6 %out_var_TEXCOORD7 %gl_Position + OpExecutionMode %MainDomain Triangles + OpSource HLSL 600 + OpName %type_ShadowDepthPass "type.ShadowDepthPass" + OpMemberName %type_ShadowDepthPass 0 "PrePadding_ShadowDepthPass_LPV_0" + OpMemberName %type_ShadowDepthPass 1 "PrePadding_ShadowDepthPass_LPV_4" + OpMemberName %type_ShadowDepthPass 2 "PrePadding_ShadowDepthPass_LPV_8" + OpMemberName %type_ShadowDepthPass 3 "PrePadding_ShadowDepthPass_LPV_12" + OpMemberName %type_ShadowDepthPass 4 "PrePadding_ShadowDepthPass_LPV_16" + OpMemberName %type_ShadowDepthPass 5 "PrePadding_ShadowDepthPass_LPV_20" + OpMemberName %type_ShadowDepthPass 6 "PrePadding_ShadowDepthPass_LPV_24" + OpMemberName %type_ShadowDepthPass 7 "PrePadding_ShadowDepthPass_LPV_28" + OpMemberName %type_ShadowDepthPass 8 "PrePadding_ShadowDepthPass_LPV_32" + OpMemberName %type_ShadowDepthPass 9 "PrePadding_ShadowDepthPass_LPV_36" + OpMemberName %type_ShadowDepthPass 10 "PrePadding_ShadowDepthPass_LPV_40" + OpMemberName %type_ShadowDepthPass 11 "PrePadding_ShadowDepthPass_LPV_44" + OpMemberName %type_ShadowDepthPass 12 "PrePadding_ShadowDepthPass_LPV_48" + OpMemberName %type_ShadowDepthPass 13 "PrePadding_ShadowDepthPass_LPV_52" + OpMemberName %type_ShadowDepthPass 14 "PrePadding_ShadowDepthPass_LPV_56" + OpMemberName %type_ShadowDepthPass 15 "PrePadding_ShadowDepthPass_LPV_60" + OpMemberName %type_ShadowDepthPass 16 "PrePadding_ShadowDepthPass_LPV_64" + OpMemberName %type_ShadowDepthPass 17 "PrePadding_ShadowDepthPass_LPV_68" + OpMemberName %type_ShadowDepthPass 18 "PrePadding_ShadowDepthPass_LPV_72" + OpMemberName %type_ShadowDepthPass 19 "PrePadding_ShadowDepthPass_LPV_76" + OpMemberName %type_ShadowDepthPass 20 "PrePadding_ShadowDepthPass_LPV_80" + OpMemberName %type_ShadowDepthPass 21 "PrePadding_ShadowDepthPass_LPV_84" + OpMemberName %type_ShadowDepthPass 22 "PrePadding_ShadowDepthPass_LPV_88" + OpMemberName %type_ShadowDepthPass 23 "PrePadding_ShadowDepthPass_LPV_92" + OpMemberName %type_ShadowDepthPass 24 "PrePadding_ShadowDepthPass_LPV_96" + OpMemberName %type_ShadowDepthPass 25 "PrePadding_ShadowDepthPass_LPV_100" + OpMemberName %type_ShadowDepthPass 26 "PrePadding_ShadowDepthPass_LPV_104" + OpMemberName %type_ShadowDepthPass 27 "PrePadding_ShadowDepthPass_LPV_108" + OpMemberName %type_ShadowDepthPass 28 "PrePadding_ShadowDepthPass_LPV_112" + OpMemberName %type_ShadowDepthPass 29 "PrePadding_ShadowDepthPass_LPV_116" + OpMemberName %type_ShadowDepthPass 30 "PrePadding_ShadowDepthPass_LPV_120" + OpMemberName %type_ShadowDepthPass 31 "PrePadding_ShadowDepthPass_LPV_124" + OpMemberName %type_ShadowDepthPass 32 "PrePadding_ShadowDepthPass_LPV_128" + OpMemberName %type_ShadowDepthPass 33 "PrePadding_ShadowDepthPass_LPV_132" + OpMemberName %type_ShadowDepthPass 34 "PrePadding_ShadowDepthPass_LPV_136" + OpMemberName %type_ShadowDepthPass 35 "PrePadding_ShadowDepthPass_LPV_140" + OpMemberName %type_ShadowDepthPass 36 "PrePadding_ShadowDepthPass_LPV_144" + OpMemberName %type_ShadowDepthPass 37 "PrePadding_ShadowDepthPass_LPV_148" + OpMemberName %type_ShadowDepthPass 38 "PrePadding_ShadowDepthPass_LPV_152" + OpMemberName %type_ShadowDepthPass 39 "PrePadding_ShadowDepthPass_LPV_156" + OpMemberName %type_ShadowDepthPass 40 "PrePadding_ShadowDepthPass_LPV_160" + OpMemberName %type_ShadowDepthPass 41 "PrePadding_ShadowDepthPass_LPV_164" + OpMemberName %type_ShadowDepthPass 42 "PrePadding_ShadowDepthPass_LPV_168" + OpMemberName %type_ShadowDepthPass 43 "PrePadding_ShadowDepthPass_LPV_172" + OpMemberName %type_ShadowDepthPass 44 "PrePadding_ShadowDepthPass_LPV_176" + OpMemberName %type_ShadowDepthPass 45 "PrePadding_ShadowDepthPass_LPV_180" + OpMemberName %type_ShadowDepthPass 46 "PrePadding_ShadowDepthPass_LPV_184" + OpMemberName %type_ShadowDepthPass 47 "PrePadding_ShadowDepthPass_LPV_188" + OpMemberName %type_ShadowDepthPass 48 "PrePadding_ShadowDepthPass_LPV_192" + OpMemberName %type_ShadowDepthPass 49 "PrePadding_ShadowDepthPass_LPV_196" + OpMemberName %type_ShadowDepthPass 50 "PrePadding_ShadowDepthPass_LPV_200" + OpMemberName %type_ShadowDepthPass 51 "PrePadding_ShadowDepthPass_LPV_204" + OpMemberName %type_ShadowDepthPass 52 "PrePadding_ShadowDepthPass_LPV_208" + OpMemberName %type_ShadowDepthPass 53 "PrePadding_ShadowDepthPass_LPV_212" + OpMemberName %type_ShadowDepthPass 54 "PrePadding_ShadowDepthPass_LPV_216" + OpMemberName %type_ShadowDepthPass 55 "PrePadding_ShadowDepthPass_LPV_220" + OpMemberName %type_ShadowDepthPass 56 "PrePadding_ShadowDepthPass_LPV_224" + OpMemberName %type_ShadowDepthPass 57 "PrePadding_ShadowDepthPass_LPV_228" + OpMemberName %type_ShadowDepthPass 58 "PrePadding_ShadowDepthPass_LPV_232" + OpMemberName %type_ShadowDepthPass 59 "PrePadding_ShadowDepthPass_LPV_236" + OpMemberName %type_ShadowDepthPass 60 "PrePadding_ShadowDepthPass_LPV_240" + OpMemberName %type_ShadowDepthPass 61 "PrePadding_ShadowDepthPass_LPV_244" + OpMemberName %type_ShadowDepthPass 62 "PrePadding_ShadowDepthPass_LPV_248" + OpMemberName %type_ShadowDepthPass 63 "PrePadding_ShadowDepthPass_LPV_252" + OpMemberName %type_ShadowDepthPass 64 "PrePadding_ShadowDepthPass_LPV_256" + OpMemberName %type_ShadowDepthPass 65 "PrePadding_ShadowDepthPass_LPV_260" + OpMemberName %type_ShadowDepthPass 66 "PrePadding_ShadowDepthPass_LPV_264" + OpMemberName %type_ShadowDepthPass 67 "PrePadding_ShadowDepthPass_LPV_268" + OpMemberName %type_ShadowDepthPass 68 "ShadowDepthPass_LPV_mRsmToWorld" + OpMemberName %type_ShadowDepthPass 69 "ShadowDepthPass_LPV_mLightColour" + OpMemberName %type_ShadowDepthPass 70 "ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection" + OpMemberName %type_ShadowDepthPass 71 "ShadowDepthPass_LPV_mEyePos" + OpMemberName %type_ShadowDepthPass 72 "ShadowDepthPass_LPV_mOldGridOffset" + OpMemberName %type_ShadowDepthPass 73 "PrePadding_ShadowDepthPass_LPV_396" + OpMemberName %type_ShadowDepthPass 74 "ShadowDepthPass_LPV_mLpvGridOffset" + OpMemberName %type_ShadowDepthPass 75 "ShadowDepthPass_LPV_ClearMultiplier" + OpMemberName %type_ShadowDepthPass 76 "ShadowDepthPass_LPV_LpvScale" + OpMemberName %type_ShadowDepthPass 77 "ShadowDepthPass_LPV_OneOverLpvScale" + OpMemberName %type_ShadowDepthPass 78 "ShadowDepthPass_LPV_DirectionalOcclusionIntensity" + OpMemberName %type_ShadowDepthPass 79 "ShadowDepthPass_LPV_DirectionalOcclusionRadius" + OpMemberName %type_ShadowDepthPass 80 "ShadowDepthPass_LPV_RsmAreaIntensityMultiplier" + OpMemberName %type_ShadowDepthPass 81 "ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier" + OpMemberName %type_ShadowDepthPass 82 "ShadowDepthPass_LPV_SecondaryOcclusionStrength" + OpMemberName %type_ShadowDepthPass 83 "ShadowDepthPass_LPV_SecondaryBounceStrength" + OpMemberName %type_ShadowDepthPass 84 "ShadowDepthPass_LPV_VplInjectionBias" + OpMemberName %type_ShadowDepthPass 85 "ShadowDepthPass_LPV_GeometryVolumeInjectionBias" + OpMemberName %type_ShadowDepthPass 86 "ShadowDepthPass_LPV_EmissiveInjectionMultiplier" + OpMemberName %type_ShadowDepthPass 87 "ShadowDepthPass_LPV_PropagationIndex" + OpMemberName %type_ShadowDepthPass 88 "ShadowDepthPass_ProjectionMatrix" + OpMemberName %type_ShadowDepthPass 89 "ShadowDepthPass_ViewMatrix" + OpMemberName %type_ShadowDepthPass 90 "ShadowDepthPass_ShadowParams" + OpMemberName %type_ShadowDepthPass 91 "ShadowDepthPass_bClampToNearPlane" + OpMemberName %type_ShadowDepthPass 92 "PrePadding_ShadowDepthPass_612" + OpMemberName %type_ShadowDepthPass 93 "PrePadding_ShadowDepthPass_616" + OpMemberName %type_ShadowDepthPass 94 "PrePadding_ShadowDepthPass_620" + OpMemberName %type_ShadowDepthPass 95 "ShadowDepthPass_ShadowViewProjectionMatrices" + OpMemberName %type_ShadowDepthPass 96 "ShadowDepthPass_ShadowViewMatrices" + OpName %ShadowDepthPass "ShadowDepthPass" + OpName %in_var_TEXCOORD10_centroid "in.var.TEXCOORD10_centroid" + OpName %in_var_TEXCOORD11_centroid "in.var.TEXCOORD11_centroid" + OpName %in_var_VS_to_DS_Position "in.var.VS_to_DS_Position" + OpName %in_var_VS_To_DS_VertexID "in.var.VS_To_DS_VertexID" + OpName %in_var_PN_POSITION "in.var.PN_POSITION" + OpName %in_var_PN_DisplacementScales "in.var.PN_DisplacementScales" + OpName %in_var_PN_TessellationMultiplier "in.var.PN_TessellationMultiplier" + OpName %in_var_PN_WorldDisplacementMultiplier "in.var.PN_WorldDisplacementMultiplier" + OpName %in_var_PN_DominantVertex "in.var.PN_DominantVertex" + OpName %in_var_PN_DominantVertex1 "in.var.PN_DominantVertex1" + OpName %in_var_PN_DominantVertex2 "in.var.PN_DominantVertex2" + OpName %in_var_PN_DominantEdge "in.var.PN_DominantEdge" + OpName %in_var_PN_DominantEdge1 "in.var.PN_DominantEdge1" + OpName %in_var_PN_DominantEdge2 "in.var.PN_DominantEdge2" + OpName %in_var_PN_DominantEdge3 "in.var.PN_DominantEdge3" + OpName %in_var_PN_DominantEdge4 "in.var.PN_DominantEdge4" + OpName %in_var_PN_DominantEdge5 "in.var.PN_DominantEdge5" + OpName %in_var_PN_POSITION9 "in.var.PN_POSITION9" + OpName %out_var_TEXCOORD10_centroid "out.var.TEXCOORD10_centroid" + OpName %out_var_TEXCOORD11_centroid "out.var.TEXCOORD11_centroid" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %out_var_TEXCOORD7 "out.var.TEXCOORD7" + OpName %MainDomain "MainDomain" + OpDecorateString %in_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %in_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %in_var_VS_to_DS_Position UserSemantic "VS_to_DS_Position" + OpDecorateString %in_var_VS_To_DS_VertexID UserSemantic "VS_To_DS_VertexID" + OpDecorateString %in_var_PN_POSITION UserSemantic "PN_POSITION" + OpDecorateString %in_var_PN_DisplacementScales UserSemantic "PN_DisplacementScales" + OpDecorateString %in_var_PN_TessellationMultiplier UserSemantic "PN_TessellationMultiplier" + OpDecorateString %in_var_PN_WorldDisplacementMultiplier UserSemantic "PN_WorldDisplacementMultiplier" + OpDecorateString %in_var_PN_DominantVertex UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantVertex1 UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantVertex2 UserSemantic "PN_DominantVertex" + OpDecorateString %in_var_PN_DominantEdge UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge1 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge2 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge3 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge4 UserSemantic "PN_DominantEdge" + OpDecorateString %in_var_PN_DominantEdge5 UserSemantic "PN_DominantEdge" + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorateString %gl_TessLevelOuter UserSemantic "SV_TessFactor" + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorateString %gl_TessLevelInner UserSemantic "SV_InsideTessFactor" + OpDecorate %gl_TessLevelInner Patch + OpDecorateString %in_var_PN_POSITION9 UserSemantic "PN_POSITION9" + OpDecorate %in_var_PN_POSITION9 Patch + OpDecorate %gl_TessCoord BuiltIn TessCoord + OpDecorateString %gl_TessCoord UserSemantic "SV_DomainLocation" + OpDecorate %gl_TessCoord Patch + OpDecorateString %out_var_TEXCOORD10_centroid UserSemantic "TEXCOORD10_centroid" + OpDecorateString %out_var_TEXCOORD11_centroid UserSemantic "TEXCOORD11_centroid" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorateString %out_var_TEXCOORD7 UserSemantic "TEXCOORD7" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %in_var_PN_DisplacementScales Location 0 + OpDecorate %in_var_PN_DominantEdge Location 1 + OpDecorate %in_var_PN_DominantEdge1 Location 2 + OpDecorate %in_var_PN_DominantEdge2 Location 3 + OpDecorate %in_var_PN_DominantEdge3 Location 4 + OpDecorate %in_var_PN_DominantEdge4 Location 5 + OpDecorate %in_var_PN_DominantEdge5 Location 6 + OpDecorate %in_var_PN_DominantVertex Location 7 + OpDecorate %in_var_PN_DominantVertex1 Location 8 + OpDecorate %in_var_PN_DominantVertex2 Location 9 + OpDecorate %in_var_PN_POSITION Location 10 + OpDecorate %in_var_PN_POSITION9 Location 13 + OpDecorate %in_var_PN_TessellationMultiplier Location 14 + OpDecorate %in_var_PN_WorldDisplacementMultiplier Location 15 + OpDecorate %in_var_TEXCOORD10_centroid Location 16 + OpDecorate %in_var_TEXCOORD11_centroid Location 17 + OpDecorate %in_var_VS_To_DS_VertexID Location 18 + OpDecorate %in_var_VS_to_DS_Position Location 19 + OpDecorate %out_var_TEXCOORD10_centroid Location 0 + OpDecorate %out_var_TEXCOORD11_centroid Location 1 + OpDecorate %out_var_TEXCOORD6 Location 2 + OpDecorate %out_var_TEXCOORD7 Location 3 + OpDecorate %ShadowDepthPass DescriptorSet 0 + OpDecorate %ShadowDepthPass Binding 0 + OpDecorate %_arr_mat4v4float_uint_6 ArrayStride 64 + OpMemberDecorate %type_ShadowDepthPass 0 Offset 0 + OpMemberDecorate %type_ShadowDepthPass 1 Offset 4 + OpMemberDecorate %type_ShadowDepthPass 2 Offset 8 + OpMemberDecorate %type_ShadowDepthPass 3 Offset 12 + OpMemberDecorate %type_ShadowDepthPass 4 Offset 16 + OpMemberDecorate %type_ShadowDepthPass 5 Offset 20 + OpMemberDecorate %type_ShadowDepthPass 6 Offset 24 + OpMemberDecorate %type_ShadowDepthPass 7 Offset 28 + OpMemberDecorate %type_ShadowDepthPass 8 Offset 32 + OpMemberDecorate %type_ShadowDepthPass 9 Offset 36 + OpMemberDecorate %type_ShadowDepthPass 10 Offset 40 + OpMemberDecorate %type_ShadowDepthPass 11 Offset 44 + OpMemberDecorate %type_ShadowDepthPass 12 Offset 48 + OpMemberDecorate %type_ShadowDepthPass 13 Offset 52 + OpMemberDecorate %type_ShadowDepthPass 14 Offset 56 + OpMemberDecorate %type_ShadowDepthPass 15 Offset 60 + OpMemberDecorate %type_ShadowDepthPass 16 Offset 64 + OpMemberDecorate %type_ShadowDepthPass 17 Offset 68 + OpMemberDecorate %type_ShadowDepthPass 18 Offset 72 + OpMemberDecorate %type_ShadowDepthPass 19 Offset 76 + OpMemberDecorate %type_ShadowDepthPass 20 Offset 80 + OpMemberDecorate %type_ShadowDepthPass 21 Offset 84 + OpMemberDecorate %type_ShadowDepthPass 22 Offset 88 + OpMemberDecorate %type_ShadowDepthPass 23 Offset 92 + OpMemberDecorate %type_ShadowDepthPass 24 Offset 96 + OpMemberDecorate %type_ShadowDepthPass 25 Offset 100 + OpMemberDecorate %type_ShadowDepthPass 26 Offset 104 + OpMemberDecorate %type_ShadowDepthPass 27 Offset 108 + OpMemberDecorate %type_ShadowDepthPass 28 Offset 112 + OpMemberDecorate %type_ShadowDepthPass 29 Offset 116 + OpMemberDecorate %type_ShadowDepthPass 30 Offset 120 + OpMemberDecorate %type_ShadowDepthPass 31 Offset 124 + OpMemberDecorate %type_ShadowDepthPass 32 Offset 128 + OpMemberDecorate %type_ShadowDepthPass 33 Offset 132 + OpMemberDecorate %type_ShadowDepthPass 34 Offset 136 + OpMemberDecorate %type_ShadowDepthPass 35 Offset 140 + OpMemberDecorate %type_ShadowDepthPass 36 Offset 144 + OpMemberDecorate %type_ShadowDepthPass 37 Offset 148 + OpMemberDecorate %type_ShadowDepthPass 38 Offset 152 + OpMemberDecorate %type_ShadowDepthPass 39 Offset 156 + OpMemberDecorate %type_ShadowDepthPass 40 Offset 160 + OpMemberDecorate %type_ShadowDepthPass 41 Offset 164 + OpMemberDecorate %type_ShadowDepthPass 42 Offset 168 + OpMemberDecorate %type_ShadowDepthPass 43 Offset 172 + OpMemberDecorate %type_ShadowDepthPass 44 Offset 176 + OpMemberDecorate %type_ShadowDepthPass 45 Offset 180 + OpMemberDecorate %type_ShadowDepthPass 46 Offset 184 + OpMemberDecorate %type_ShadowDepthPass 47 Offset 188 + OpMemberDecorate %type_ShadowDepthPass 48 Offset 192 + OpMemberDecorate %type_ShadowDepthPass 49 Offset 196 + OpMemberDecorate %type_ShadowDepthPass 50 Offset 200 + OpMemberDecorate %type_ShadowDepthPass 51 Offset 204 + OpMemberDecorate %type_ShadowDepthPass 52 Offset 208 + OpMemberDecorate %type_ShadowDepthPass 53 Offset 212 + OpMemberDecorate %type_ShadowDepthPass 54 Offset 216 + OpMemberDecorate %type_ShadowDepthPass 55 Offset 220 + OpMemberDecorate %type_ShadowDepthPass 56 Offset 224 + OpMemberDecorate %type_ShadowDepthPass 57 Offset 228 + OpMemberDecorate %type_ShadowDepthPass 58 Offset 232 + OpMemberDecorate %type_ShadowDepthPass 59 Offset 236 + OpMemberDecorate %type_ShadowDepthPass 60 Offset 240 + OpMemberDecorate %type_ShadowDepthPass 61 Offset 244 + OpMemberDecorate %type_ShadowDepthPass 62 Offset 248 + OpMemberDecorate %type_ShadowDepthPass 63 Offset 252 + OpMemberDecorate %type_ShadowDepthPass 64 Offset 256 + OpMemberDecorate %type_ShadowDepthPass 65 Offset 260 + OpMemberDecorate %type_ShadowDepthPass 66 Offset 264 + OpMemberDecorate %type_ShadowDepthPass 67 Offset 268 + OpMemberDecorate %type_ShadowDepthPass 68 Offset 272 + OpMemberDecorate %type_ShadowDepthPass 68 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 68 ColMajor + OpMemberDecorate %type_ShadowDepthPass 69 Offset 336 + OpMemberDecorate %type_ShadowDepthPass 70 Offset 352 + OpMemberDecorate %type_ShadowDepthPass 71 Offset 368 + OpMemberDecorate %type_ShadowDepthPass 72 Offset 384 + OpMemberDecorate %type_ShadowDepthPass 73 Offset 396 + OpMemberDecorate %type_ShadowDepthPass 74 Offset 400 + OpMemberDecorate %type_ShadowDepthPass 75 Offset 412 + OpMemberDecorate %type_ShadowDepthPass 76 Offset 416 + OpMemberDecorate %type_ShadowDepthPass 77 Offset 420 + OpMemberDecorate %type_ShadowDepthPass 78 Offset 424 + OpMemberDecorate %type_ShadowDepthPass 79 Offset 428 + OpMemberDecorate %type_ShadowDepthPass 80 Offset 432 + OpMemberDecorate %type_ShadowDepthPass 81 Offset 436 + OpMemberDecorate %type_ShadowDepthPass 82 Offset 440 + OpMemberDecorate %type_ShadowDepthPass 83 Offset 444 + OpMemberDecorate %type_ShadowDepthPass 84 Offset 448 + OpMemberDecorate %type_ShadowDepthPass 85 Offset 452 + OpMemberDecorate %type_ShadowDepthPass 86 Offset 456 + OpMemberDecorate %type_ShadowDepthPass 87 Offset 460 + OpMemberDecorate %type_ShadowDepthPass 88 Offset 464 + OpMemberDecorate %type_ShadowDepthPass 88 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 88 ColMajor + OpMemberDecorate %type_ShadowDepthPass 89 Offset 528 + OpMemberDecorate %type_ShadowDepthPass 89 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 89 ColMajor + OpMemberDecorate %type_ShadowDepthPass 90 Offset 592 + OpMemberDecorate %type_ShadowDepthPass 91 Offset 608 + OpMemberDecorate %type_ShadowDepthPass 92 Offset 612 + OpMemberDecorate %type_ShadowDepthPass 93 Offset 616 + OpMemberDecorate %type_ShadowDepthPass 94 Offset 620 + OpMemberDecorate %type_ShadowDepthPass 95 Offset 624 + OpMemberDecorate %type_ShadowDepthPass 95 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 95 ColMajor + OpMemberDecorate %type_ShadowDepthPass 96 Offset 1008 + OpMemberDecorate %type_ShadowDepthPass 96 MatrixStride 16 + OpMemberDecorate %type_ShadowDepthPass 96 ColMajor + OpDecorate %type_ShadowDepthPass Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_4 = OpConstant %uint 4 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %float_3 = OpConstant %float 3 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_6 = OpConstant %float 6 + %48 = OpConstantComposite %v4float %float_6 %float_6 %float_6 %float_6 + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %int_3 = OpConstant %int 3 + %int_88 = OpConstant %int 88 + %int_89 = OpConstant %int 89 + %int_90 = OpConstant %int 90 + %int_91 = OpConstant %int 91 +%float_9_99999997en07 = OpConstant %float 9.99999997e-07 + %uint_6 = OpConstant %uint 6 +%_arr_mat4v4float_uint_6 = OpTypeArray %mat4v4float %uint_6 + %v3int = OpTypeVector %int 3 +%type_ShadowDepthPass = OpTypeStruct %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %mat4v4float %v4float %v4float %v4float %v3int %int %v3int %float %float %float %float %float %float %float %float %float %float %float %float %int %mat4v4float %mat4v4float %v4float %float %float %float %float %_arr_mat4v4float_uint_6 %_arr_mat4v4float_uint_6 +%_ptr_Uniform_type_ShadowDepthPass = OpTypePointer Uniform %type_ShadowDepthPass + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%_arr_uint_uint_3 = OpTypeArray %uint %uint_3 +%_ptr_Input__arr_uint_uint_3 = OpTypePointer Input %_arr_uint_uint_3 +%_arr__arr_v4float_uint_3_uint_3 = OpTypeArray %_arr_v4float_uint_3 %uint_3 +%_ptr_Input__arr__arr_v4float_uint_3_uint_3 = OpTypePointer Input %_arr__arr_v4float_uint_3_uint_3 +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Input__arr_v3float_uint_3 = OpTypePointer Input %_arr_v3float_uint_3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Input__arr_float_uint_3 = OpTypePointer Input %_arr_float_uint_3 +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Input__arr_v2float_uint_3 = OpTypePointer Input %_arr_v2float_uint_3 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Input__arr_float_uint_4 = OpTypePointer Input %_arr_float_uint_4 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input_v3float = OpTypePointer Input %v3float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v3float = OpTypePointer Output %v3float + %void = OpTypeVoid + %83 = OpTypeFunction %void +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%ShadowDepthPass = OpVariable %_ptr_Uniform_type_ShadowDepthPass Uniform +%in_var_TEXCOORD10_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_TEXCOORD11_centroid = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_VS_to_DS_Position = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_VS_To_DS_VertexID = OpVariable %_ptr_Input__arr_uint_uint_3 Input +%in_var_PN_POSITION = OpVariable %_ptr_Input__arr__arr_v4float_uint_3_uint_3 Input +%in_var_PN_DisplacementScales = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_TessellationMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_PN_WorldDisplacementMultiplier = OpVariable %_ptr_Input__arr_float_uint_3 Input +%in_var_PN_DominantVertex = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantVertex1 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantVertex2 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_DominantEdge = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantEdge1 = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%in_var_PN_DominantEdge2 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantEdge3 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%in_var_PN_DominantEdge4 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%in_var_PN_DominantEdge5 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%gl_TessLevelOuter = OpVariable %_ptr_Input__arr_float_uint_4 Input +%gl_TessLevelInner = OpVariable %_ptr_Input__arr_float_uint_2 Input +%in_var_PN_POSITION9 = OpVariable %_ptr_Input_v4float Input +%gl_TessCoord = OpVariable %_ptr_Input_v3float Input +%out_var_TEXCOORD10_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD11_centroid = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_float Output +%out_var_TEXCOORD7 = OpVariable %_ptr_Output_v3float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output + %89 = OpConstantNull %v4float + %90 = OpUndef %v4float + %MainDomain = OpFunction %void None %83 + %91 = OpLabel + %92 = OpVariable %_ptr_Function_mat4v4float Function + %93 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD10_centroid + %94 = OpLoad %_arr_v4float_uint_3 %in_var_TEXCOORD11_centroid + %95 = OpCompositeExtract %v4float %93 0 + %96 = OpCompositeExtract %v4float %94 0 + %97 = OpCompositeExtract %v4float %93 1 + %98 = OpCompositeExtract %v4float %94 1 + %99 = OpCompositeExtract %v4float %93 2 + %100 = OpCompositeExtract %v4float %94 2 + %101 = OpLoad %_arr__arr_v4float_uint_3_uint_3 %in_var_PN_POSITION + %102 = OpCompositeExtract %_arr_v4float_uint_3 %101 0 + %103 = OpCompositeExtract %_arr_v4float_uint_3 %101 1 + %104 = OpCompositeExtract %_arr_v4float_uint_3 %101 2 + %105 = OpCompositeExtract %v4float %102 0 + %106 = OpCompositeExtract %v4float %102 1 + %107 = OpCompositeExtract %v4float %102 2 + %108 = OpCompositeExtract %v4float %103 0 + %109 = OpCompositeExtract %v4float %103 1 + %110 = OpCompositeExtract %v4float %103 2 + %111 = OpCompositeExtract %v4float %104 0 + %112 = OpCompositeExtract %v4float %104 1 + %113 = OpCompositeExtract %v4float %104 2 + %114 = OpLoad %v4float %in_var_PN_POSITION9 + %115 = OpLoad %v3float %gl_TessCoord + %116 = OpCompositeExtract %float %115 0 + %117 = OpCompositeExtract %float %115 1 + %118 = OpCompositeExtract %float %115 2 + %119 = OpFMul %float %116 %116 + %120 = OpFMul %float %117 %117 + %121 = OpFMul %float %118 %118 + %122 = OpFMul %float %119 %float_3 + %123 = OpFMul %float %120 %float_3 + %124 = OpFMul %float %121 %float_3 + %125 = OpCompositeConstruct %v4float %119 %119 %119 %119 + %126 = OpFMul %v4float %105 %125 + %127 = OpCompositeConstruct %v4float %116 %116 %116 %116 + %128 = OpFMul %v4float %126 %127 + %129 = OpCompositeConstruct %v4float %120 %120 %120 %120 + %130 = OpFMul %v4float %108 %129 + %131 = OpCompositeConstruct %v4float %117 %117 %117 %117 + %132 = OpFMul %v4float %130 %131 + %133 = OpFAdd %v4float %128 %132 + %134 = OpCompositeConstruct %v4float %121 %121 %121 %121 + %135 = OpFMul %v4float %111 %134 + %136 = OpCompositeConstruct %v4float %118 %118 %118 %118 + %137 = OpFMul %v4float %135 %136 + %138 = OpFAdd %v4float %133 %137 + %139 = OpCompositeConstruct %v4float %122 %122 %122 %122 + %140 = OpFMul %v4float %106 %139 + %141 = OpFMul %v4float %140 %131 + %142 = OpFAdd %v4float %138 %141 + %143 = OpCompositeConstruct %v4float %123 %123 %123 %123 + %144 = OpFMul %v4float %107 %143 + %145 = OpFMul %v4float %144 %127 + %146 = OpFAdd %v4float %142 %145 + %147 = OpFMul %v4float %109 %143 + %148 = OpFMul %v4float %147 %136 + %149 = OpFAdd %v4float %146 %148 + %150 = OpCompositeConstruct %v4float %124 %124 %124 %124 + %151 = OpFMul %v4float %110 %150 + %152 = OpFMul %v4float %151 %131 + %153 = OpFAdd %v4float %149 %152 + %154 = OpFMul %v4float %112 %150 + %155 = OpFMul %v4float %154 %127 + %156 = OpFAdd %v4float %153 %155 + %157 = OpFMul %v4float %113 %139 + %158 = OpFMul %v4float %157 %136 + %159 = OpFAdd %v4float %156 %158 + %160 = OpFMul %v4float %114 %48 + %161 = OpFMul %v4float %160 %136 + %162 = OpFMul %v4float %161 %127 + %163 = OpFMul %v4float %162 %131 + %164 = OpFAdd %v4float %159 %163 + %165 = OpVectorShuffle %v3float %95 %95 0 1 2 + %166 = OpCompositeConstruct %v3float %116 %116 %116 + %167 = OpFMul %v3float %165 %166 + %168 = OpVectorShuffle %v3float %97 %97 0 1 2 + %169 = OpCompositeConstruct %v3float %117 %117 %117 + %170 = OpFMul %v3float %168 %169 + %171 = OpFAdd %v3float %167 %170 + %172 = OpFMul %v4float %96 %127 + %173 = OpFMul %v4float %98 %131 + %174 = OpFAdd %v4float %172 %173 + %175 = OpVectorShuffle %v3float %171 %89 0 1 2 + %176 = OpVectorShuffle %v3float %99 %99 0 1 2 + %177 = OpCompositeConstruct %v3float %118 %118 %118 + %178 = OpFMul %v3float %176 %177 + %179 = OpFAdd %v3float %175 %178 + %180 = OpVectorShuffle %v4float %90 %179 4 5 6 3 + %181 = OpFMul %v4float %100 %136 + %182 = OpFAdd %v4float %174 %181 + %183 = OpVectorShuffle %v3float %182 %182 0 1 2 + %184 = OpVectorShuffle %v4float %164 %164 4 5 6 3 + %185 = OpAccessChain %_ptr_Uniform_mat4v4float %ShadowDepthPass %int_88 + %186 = OpLoad %mat4v4float %185 + %187 = OpAccessChain %_ptr_Uniform_mat4v4float %ShadowDepthPass %int_89 + %188 = OpLoad %mat4v4float %187 + OpStore %92 %188 + %189 = OpMatrixTimesVector %v4float %186 %184 + %190 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_91 + %191 = OpLoad %float %190 + %192 = OpFOrdGreaterThan %bool %191 %float_0 + %193 = OpCompositeExtract %float %189 2 + %194 = OpFOrdLessThan %bool %193 %float_0 + %195 = OpLogicalAnd %bool %192 %194 + OpSelectionMerge %196 None + OpBranchConditional %195 %197 %196 + %197 = OpLabel + %198 = OpCompositeInsert %v4float %float_9_99999997en07 %189 2 + %199 = OpCompositeInsert %v4float %float_1 %198 3 + OpBranch %196 + %196 = OpLabel + %200 = OpPhi %v4float %189 %91 %199 %197 + %201 = OpAccessChain %_ptr_Function_float %92 %uint_0 %int_2 + %202 = OpLoad %float %201 + %203 = OpAccessChain %_ptr_Function_float %92 %uint_1 %int_2 + %204 = OpLoad %float %203 + %205 = OpAccessChain %_ptr_Function_float %92 %uint_2 %int_2 + %206 = OpLoad %float %205 + %207 = OpCompositeConstruct %v3float %202 %204 %206 + %208 = OpDot %float %207 %183 + %209 = OpExtInst %float %1 FAbs %208 + %210 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_2 + %211 = OpLoad %float %210 + %212 = OpExtInst %float %1 FAbs %209 + %213 = OpFOrdGreaterThan %bool %212 %float_0 + %214 = OpFMul %float %209 %209 + %215 = OpFSub %float %float_1 %214 + %216 = OpExtInst %float %1 FClamp %215 %float_0 %float_1 + %217 = OpExtInst %float %1 Sqrt %216 + %218 = OpFDiv %float %217 %209 + %219 = OpSelect %float %213 %218 %211 + %220 = OpExtInst %float %1 FClamp %219 %float_0 %211 + %221 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_1 + %222 = OpLoad %float %221 + %223 = OpFMul %float %222 %220 + %224 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_0 + %225 = OpLoad %float %224 + %226 = OpFAdd %float %223 %225 + %227 = OpAccessChain %_ptr_Uniform_float %ShadowDepthPass %int_90 %int_3 + %228 = OpLoad %float %227 + %229 = OpCompositeExtract %float %200 2 + %230 = OpFMul %float %229 %228 + %231 = OpFAdd %float %230 %226 + %232 = OpCompositeExtract %float %200 3 + %233 = OpFMul %float %231 %232 + %234 = OpCompositeInsert %v4float %233 %200 2 + %235 = OpVectorShuffle %v3float %164 %89 0 1 2 + OpStore %out_var_TEXCOORD10_centroid %180 + OpStore %out_var_TEXCOORD11_centroid %182 + OpStore %out_var_TEXCOORD6 %float_0 + OpStore %out_var_TEXCOORD7 %235 + OpStore %gl_Position %234 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/vert/array-missing-copies.asm.vert b/third_party/spirv-cross/shaders-ue4/asm/vert/array-missing-copies.asm.vert new file mode 100644 index 0000000000..23dc727560 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/vert/array-missing-copies.asm.vert @@ -0,0 +1,1131 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 487 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %Main "main" %in_var_ATTRIBUTE0 %in_var_ATTRIBUTE1 %out_var_TEXCOORD0 %out_var_TEXCOORD1 %out_var_TEXCOORD2 %out_var_TEXCOORD3 %out_var_TEXCOORD8 %gl_Position + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_MobileBasePass "type.MobileBasePass" + OpMemberName %type_MobileBasePass 0 "MobileBasePass_Fog_ExponentialFogParameters" + OpMemberName %type_MobileBasePass 1 "MobileBasePass_Fog_ExponentialFogParameters2" + OpMemberName %type_MobileBasePass 2 "MobileBasePass_Fog_ExponentialFogColorParameter" + OpMemberName %type_MobileBasePass 3 "MobileBasePass_Fog_ExponentialFogParameters3" + OpMemberName %type_MobileBasePass 4 "MobileBasePass_Fog_InscatteringLightDirection" + OpMemberName %type_MobileBasePass 5 "MobileBasePass_Fog_DirectionalInscatteringColor" + OpMemberName %type_MobileBasePass 6 "MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation" + OpMemberName %type_MobileBasePass 7 "PrePadding_MobileBasePass_Fog_104" + OpMemberName %type_MobileBasePass 8 "PrePadding_MobileBasePass_Fog_108" + OpMemberName %type_MobileBasePass 9 "MobileBasePass_Fog_FogInscatteringTextureParameters" + OpMemberName %type_MobileBasePass 10 "MobileBasePass_Fog_ApplyVolumetricFog" + OpMemberName %type_MobileBasePass 11 "PrePadding_MobileBasePass_PlanarReflection_128" + OpMemberName %type_MobileBasePass 12 "PrePadding_MobileBasePass_PlanarReflection_132" + OpMemberName %type_MobileBasePass 13 "PrePadding_MobileBasePass_PlanarReflection_136" + OpMemberName %type_MobileBasePass 14 "PrePadding_MobileBasePass_PlanarReflection_140" + OpMemberName %type_MobileBasePass 15 "PrePadding_MobileBasePass_PlanarReflection_144" + OpMemberName %type_MobileBasePass 16 "PrePadding_MobileBasePass_PlanarReflection_148" + OpMemberName %type_MobileBasePass 17 "PrePadding_MobileBasePass_PlanarReflection_152" + OpMemberName %type_MobileBasePass 18 "PrePadding_MobileBasePass_PlanarReflection_156" + OpMemberName %type_MobileBasePass 19 "MobileBasePass_PlanarReflection_ReflectionPlane" + OpMemberName %type_MobileBasePass 20 "MobileBasePass_PlanarReflection_PlanarReflectionOrigin" + OpMemberName %type_MobileBasePass 21 "MobileBasePass_PlanarReflection_PlanarReflectionXAxis" + OpMemberName %type_MobileBasePass 22 "MobileBasePass_PlanarReflection_PlanarReflectionYAxis" + OpMemberName %type_MobileBasePass 23 "MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix" + OpMemberName %type_MobileBasePass 24 "MobileBasePass_PlanarReflection_PlanarReflectionParameters" + OpMemberName %type_MobileBasePass 25 "PrePadding_MobileBasePass_PlanarReflection_284" + OpMemberName %type_MobileBasePass 26 "MobileBasePass_PlanarReflection_PlanarReflectionParameters2" + OpMemberName %type_MobileBasePass 27 "PrePadding_MobileBasePass_PlanarReflection_296" + OpMemberName %type_MobileBasePass 28 "PrePadding_MobileBasePass_PlanarReflection_300" + OpMemberName %type_MobileBasePass 29 "MobileBasePass_PlanarReflection_ProjectionWithExtraFOV" + OpMemberName %type_MobileBasePass 30 "MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias" + OpMemberName %type_MobileBasePass 31 "MobileBasePass_PlanarReflection_PlanarReflectionScreenBound" + OpMemberName %type_MobileBasePass 32 "MobileBasePass_PlanarReflection_bIsStereo" + OpName %MobileBasePass "MobileBasePass" + OpName %type_Primitive "type.Primitive" + OpMemberName %type_Primitive 0 "Primitive_LocalToWorld" + OpMemberName %type_Primitive 1 "Primitive_InvNonUniformScaleAndDeterminantSign" + OpMemberName %type_Primitive 2 "Primitive_ObjectWorldPositionAndRadius" + OpMemberName %type_Primitive 3 "Primitive_WorldToLocal" + OpMemberName %type_Primitive 4 "Primitive_PreviousLocalToWorld" + OpMemberName %type_Primitive 5 "Primitive_PreviousWorldToLocal" + OpMemberName %type_Primitive 6 "Primitive_ActorWorldPosition" + OpMemberName %type_Primitive 7 "Primitive_UseSingleSampleShadowFromStationaryLights" + OpMemberName %type_Primitive 8 "Primitive_ObjectBounds" + OpMemberName %type_Primitive 9 "Primitive_LpvBiasMultiplier" + OpMemberName %type_Primitive 10 "Primitive_DecalReceiverMask" + OpMemberName %type_Primitive 11 "Primitive_PerObjectGBufferData" + OpMemberName %type_Primitive 12 "Primitive_UseVolumetricLightmapShadowFromStationaryLights" + OpMemberName %type_Primitive 13 "Primitive_UseEditorDepthTest" + OpMemberName %type_Primitive 14 "Primitive_ObjectOrientation" + OpMemberName %type_Primitive 15 "Primitive_NonUniformScale" + OpMemberName %type_Primitive 16 "Primitive_LocalObjectBoundsMin" + OpMemberName %type_Primitive 17 "PrePadding_Primitive_380" + OpMemberName %type_Primitive 18 "Primitive_LocalObjectBoundsMax" + OpMemberName %type_Primitive 19 "Primitive_LightingChannelMask" + OpMemberName %type_Primitive 20 "Primitive_LightmapDataIndex" + OpMemberName %type_Primitive 21 "Primitive_SingleCaptureIndex" + OpName %Primitive "Primitive" + OpName %type_LandscapeParameters "type.LandscapeParameters" + OpMemberName %type_LandscapeParameters 0 "LandscapeParameters_HeightmapUVScaleBias" + OpMemberName %type_LandscapeParameters 1 "LandscapeParameters_WeightmapUVScaleBias" + OpMemberName %type_LandscapeParameters 2 "LandscapeParameters_LandscapeLightmapScaleBias" + OpMemberName %type_LandscapeParameters 3 "LandscapeParameters_SubsectionSizeVertsLayerUVPan" + OpMemberName %type_LandscapeParameters 4 "LandscapeParameters_SubsectionOffsetParams" + OpMemberName %type_LandscapeParameters 5 "LandscapeParameters_LightmapSubsectionOffsetParams" + OpMemberName %type_LandscapeParameters 6 "LandscapeParameters_LocalToWorldNoScaling" + OpName %LandscapeParameters "LandscapeParameters" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "LodBias" + OpMemberName %type__Globals 1 "LodValues" + OpMemberName %type__Globals 2 "SectionLods" + OpMemberName %type__Globals 3 "NeighborSectionLod" + OpName %_Globals "$Globals" + OpName %in_var_ATTRIBUTE0 "in.var.ATTRIBUTE0" + OpName %in_var_ATTRIBUTE1 "in.var.ATTRIBUTE1" + OpName %out_var_TEXCOORD0 "out.var.TEXCOORD0" + OpName %out_var_TEXCOORD1 "out.var.TEXCOORD1" + OpName %out_var_TEXCOORD2 "out.var.TEXCOORD2" + OpName %out_var_TEXCOORD3 "out.var.TEXCOORD3" + OpName %out_var_TEXCOORD8 "out.var.TEXCOORD8" + OpName %Main "Main" + OpDecorateString %in_var_ATTRIBUTE0 UserSemantic "ATTRIBUTE0" + OpDecorateString %in_var_ATTRIBUTE1 UserSemantic "ATTRIBUTE1" + OpDecorateString %out_var_TEXCOORD0 UserSemantic "TEXCOORD0" + OpDecorateString %out_var_TEXCOORD1 UserSemantic "TEXCOORD1" + OpDecorateString %out_var_TEXCOORD2 UserSemantic "TEXCOORD2" + OpDecorateString %out_var_TEXCOORD3 UserSemantic "TEXCOORD3" + OpDecorateString %out_var_TEXCOORD8 UserSemantic "TEXCOORD8" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %in_var_ATTRIBUTE0 Location 0 + OpDecorate %in_var_ATTRIBUTE1 Location 1 + OpDecorate %out_var_TEXCOORD0 Location 0 + OpDecorate %out_var_TEXCOORD1 Location 1 + OpDecorate %out_var_TEXCOORD2 Location 2 + OpDecorate %out_var_TEXCOORD3 Location 3 + OpDecorate %out_var_TEXCOORD8 Location 4 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 0 + OpDecorate %MobileBasePass DescriptorSet 0 + OpDecorate %MobileBasePass Binding 1 + OpDecorate %Primitive DescriptorSet 0 + OpDecorate %Primitive Binding 2 + OpDecorate %LandscapeParameters DescriptorSet 0 + OpDecorate %LandscapeParameters Binding 3 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 4 + OpDecorate %_arr_v4float_uint_2_0 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpDecorate %_arr_mat4v4float_uint_2 ArrayStride 64 + OpMemberDecorate %type_MobileBasePass 0 Offset 0 + OpMemberDecorate %type_MobileBasePass 1 Offset 16 + OpMemberDecorate %type_MobileBasePass 2 Offset 32 + OpMemberDecorate %type_MobileBasePass 3 Offset 48 + OpMemberDecorate %type_MobileBasePass 4 Offset 64 + OpMemberDecorate %type_MobileBasePass 5 Offset 80 + OpMemberDecorate %type_MobileBasePass 6 Offset 96 + OpMemberDecorate %type_MobileBasePass 7 Offset 104 + OpMemberDecorate %type_MobileBasePass 8 Offset 108 + OpMemberDecorate %type_MobileBasePass 9 Offset 112 + OpMemberDecorate %type_MobileBasePass 10 Offset 124 + OpMemberDecorate %type_MobileBasePass 11 Offset 128 + OpMemberDecorate %type_MobileBasePass 12 Offset 132 + OpMemberDecorate %type_MobileBasePass 13 Offset 136 + OpMemberDecorate %type_MobileBasePass 14 Offset 140 + OpMemberDecorate %type_MobileBasePass 15 Offset 144 + OpMemberDecorate %type_MobileBasePass 16 Offset 148 + OpMemberDecorate %type_MobileBasePass 17 Offset 152 + OpMemberDecorate %type_MobileBasePass 18 Offset 156 + OpMemberDecorate %type_MobileBasePass 19 Offset 160 + OpMemberDecorate %type_MobileBasePass 20 Offset 176 + OpMemberDecorate %type_MobileBasePass 21 Offset 192 + OpMemberDecorate %type_MobileBasePass 22 Offset 208 + OpMemberDecorate %type_MobileBasePass 23 Offset 224 + OpMemberDecorate %type_MobileBasePass 23 MatrixStride 16 + OpMemberDecorate %type_MobileBasePass 23 ColMajor + OpMemberDecorate %type_MobileBasePass 24 Offset 272 + OpMemberDecorate %type_MobileBasePass 25 Offset 284 + OpMemberDecorate %type_MobileBasePass 26 Offset 288 + OpMemberDecorate %type_MobileBasePass 27 Offset 296 + OpMemberDecorate %type_MobileBasePass 28 Offset 300 + OpMemberDecorate %type_MobileBasePass 29 Offset 304 + OpMemberDecorate %type_MobileBasePass 29 MatrixStride 16 + OpMemberDecorate %type_MobileBasePass 29 ColMajor + OpMemberDecorate %type_MobileBasePass 30 Offset 432 + OpMemberDecorate %type_MobileBasePass 31 Offset 464 + OpMemberDecorate %type_MobileBasePass 32 Offset 472 + OpDecorate %type_MobileBasePass Block + OpMemberDecorate %type_Primitive 0 Offset 0 + OpMemberDecorate %type_Primitive 0 MatrixStride 16 + OpMemberDecorate %type_Primitive 0 ColMajor + OpMemberDecorate %type_Primitive 1 Offset 64 + OpMemberDecorate %type_Primitive 2 Offset 80 + OpMemberDecorate %type_Primitive 3 Offset 96 + OpMemberDecorate %type_Primitive 3 MatrixStride 16 + OpMemberDecorate %type_Primitive 3 ColMajor + OpMemberDecorate %type_Primitive 4 Offset 160 + OpMemberDecorate %type_Primitive 4 MatrixStride 16 + OpMemberDecorate %type_Primitive 4 ColMajor + OpMemberDecorate %type_Primitive 5 Offset 224 + OpMemberDecorate %type_Primitive 5 MatrixStride 16 + OpMemberDecorate %type_Primitive 5 ColMajor + OpMemberDecorate %type_Primitive 6 Offset 288 + OpMemberDecorate %type_Primitive 7 Offset 300 + OpMemberDecorate %type_Primitive 8 Offset 304 + OpMemberDecorate %type_Primitive 9 Offset 316 + OpMemberDecorate %type_Primitive 10 Offset 320 + OpMemberDecorate %type_Primitive 11 Offset 324 + OpMemberDecorate %type_Primitive 12 Offset 328 + OpMemberDecorate %type_Primitive 13 Offset 332 + OpMemberDecorate %type_Primitive 14 Offset 336 + OpMemberDecorate %type_Primitive 15 Offset 352 + OpMemberDecorate %type_Primitive 16 Offset 368 + OpMemberDecorate %type_Primitive 17 Offset 380 + OpMemberDecorate %type_Primitive 18 Offset 384 + OpMemberDecorate %type_Primitive 19 Offset 396 + OpMemberDecorate %type_Primitive 20 Offset 400 + OpMemberDecorate %type_Primitive 21 Offset 404 + OpDecorate %type_Primitive Block + OpMemberDecorate %type_LandscapeParameters 0 Offset 0 + OpMemberDecorate %type_LandscapeParameters 1 Offset 16 + OpMemberDecorate %type_LandscapeParameters 2 Offset 32 + OpMemberDecorate %type_LandscapeParameters 3 Offset 48 + OpMemberDecorate %type_LandscapeParameters 4 Offset 64 + OpMemberDecorate %type_LandscapeParameters 5 Offset 80 + OpMemberDecorate %type_LandscapeParameters 6 Offset 96 + OpMemberDecorate %type_LandscapeParameters 6 MatrixStride 16 + OpMemberDecorate %type_LandscapeParameters 6 ColMajor + OpDecorate %type_LandscapeParameters Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpMemberDecorate %type__Globals 1 Offset 16 + OpMemberDecorate %type__Globals 2 Offset 32 + OpMemberDecorate %type__Globals 3 Offset 48 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 +%float_0_00999999978 = OpConstant %float 0.00999999978 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_0 = OpConstant %float 0 + %40 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %float_255 = OpConstant %float 255 + %44 = OpConstantComposite %v4float %float_255 %float_255 %float_255 %float_255 + %float_0_5 = OpConstant %float 0.5 + %46 = OpConstantComposite %v2float %float_0_5 %float_0_5 + %float_2 = OpConstant %float 2 + %48 = OpConstantComposite %v2float %float_2 %float_2 + %float_1 = OpConstant %float 1 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %float_3 = OpConstant %float 3 + %float_0_25 = OpConstant %float 0.25 + %uint_3 = OpConstant %uint 3 + %float_4 = OpConstant %float 4 +%float_0_125 = OpConstant %float 0.125 + %float_5 = OpConstant %float 5 +%float_0_0625 = OpConstant %float 0.0625 +%float_0_03125 = OpConstant %float 0.03125 + %60 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %int_5 = OpConstant %int 5 + %int_4 = OpConstant %int 4 + %63 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int_25 = OpConstant %int 25 + %int_27 = OpConstant %int 27 + %int_31 = OpConstant %int 31 + %67 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2 +%float_32768 = OpConstant %float 32768 +%_arr_v4float_uint_2_0 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2_0 %_arr_v4float_uint_2_0 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%mat3v4float = OpTypeMatrix %v4float 3 +%_arr_mat4v4float_uint_2 = OpTypeArray %mat4v4float %uint_2 +%type_MobileBasePass = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float %v2float %float %float %v3float %float %float %float %float %float %float %float %float %float %v4float %v4float %v4float %v4float %mat3v4float %v3float %float %v2float %float %float %_arr_mat4v4float_uint_2 %_arr_v4float_uint_2_0 %v2float %uint +%_ptr_Uniform_type_MobileBasePass = OpTypePointer Uniform %type_MobileBasePass +%type_Primitive = OpTypeStruct %mat4v4float %v4float %v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %float %float %float %float %v4float %v4float %v3float %float %v3float %uint %uint %int +%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive +%type_LandscapeParameters = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float %mat4v4float +%_ptr_Uniform_type_LandscapeParameters = OpTypePointer Uniform %type_LandscapeParameters +%type__Globals = OpTypeStruct %v4float %v4float %v4float %_arr_v4float_uint_4 +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Input__arr_v4float_uint_2 = OpTypePointer Input %_arr_v4float_uint_2 +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %80 = OpTypeFunction %void +%_arr_v4float_uint_1 = OpTypeArray %v4float %uint_1 +%_ptr_Function__arr_v4float_uint_1 = OpTypePointer Function %_arr_v4float_uint_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %bool = OpTypeBool +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %v3bool = OpTypeVector %bool 3 +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %View = OpVariable %_ptr_Uniform_type_View Uniform +%MobileBasePass = OpVariable %_ptr_Uniform_type_MobileBasePass Uniform + %Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform +%LandscapeParameters = OpVariable %_ptr_Uniform_type_LandscapeParameters Uniform + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%in_var_ATTRIBUTE0 = OpVariable %_ptr_Input_v4float Input +%in_var_ATTRIBUTE1 = OpVariable %_ptr_Input__arr_v4float_uint_2 Input +%out_var_TEXCOORD0 = OpVariable %_ptr_Output_v2float Output +%out_var_TEXCOORD1 = OpVariable %_ptr_Output_v2float Output +%out_var_TEXCOORD2 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD3 = OpVariable %_ptr_Output_v4float Output +%out_var_TEXCOORD8 = OpVariable %_ptr_Output_v4float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output +%float_0_0078125 = OpConstant %float 0.0078125 + %float_n127 = OpConstant %float -127 + %92 = OpConstantNull %v4float +%float_0_00392156886 = OpConstant %float 0.00392156886 + %94 = OpConstantComposite %v2float %float_0_00392156886 %float_0_00392156886 +%float_65280 = OpConstant %float 65280 + %Main = OpFunction %void None %80 + %96 = OpLabel + %97 = OpVariable %_ptr_Function__arr_v4float_uint_1 Function + %98 = OpLoad %v4float %in_var_ATTRIBUTE0 + %99 = OpLoad %_arr_v4float_uint_2 %in_var_ATTRIBUTE1 + %100 = OpAccessChain %_ptr_Uniform_mat4v4float %View %int_0 + %101 = OpLoad %mat4v4float %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %View %int_27 + %103 = OpLoad %v3float %102 + %104 = OpAccessChain %_ptr_Uniform_v3float %View %int_31 + %105 = OpLoad %v3float %104 + OpBranch %106 + %106 = OpLabel + %107 = OpPhi %int %int_0 %96 %108 %109 + %110 = OpSLessThan %bool %107 %int_1 + OpLoopMerge %111 %109 Unroll + OpBranchConditional %110 %109 %111 + %109 = OpLabel + %112 = OpAccessChain %_ptr_Function_v4float %97 %107 + OpStore %112 %40 + %108 = OpIAdd %int %107 %int_1 + OpBranch %106 + %111 = OpLabel + %113 = OpCompositeExtract %v4float %99 0 + %114 = OpCompositeExtract %v4float %99 1 + %115 = OpFMul %v4float %98 %44 + %116 = OpVectorShuffle %v2float %115 %115 2 3 + %117 = OpFMul %v2float %116 %46 + %118 = OpExtInst %v2float %1 Fract %117 + %119 = OpFMul %v2float %118 %48 + %120 = OpFSub %v2float %116 %119 + %121 = OpFMul %v2float %120 %94 + %122 = OpVectorShuffle %v2float %115 %92 0 1 + %123 = OpAccessChain %_ptr_Uniform_float %_Globals %int_1 %int_3 + %124 = OpLoad %float %123 + %125 = OpCompositeConstruct %v2float %124 %124 + %126 = OpFMul %v2float %122 %125 + %127 = OpCompositeExtract %float %126 1 + %128 = OpCompositeExtract %float %126 0 + %129 = OpFSub %float %float_1 %128 + %130 = OpFSub %float %float_1 %127 + %131 = OpCompositeConstruct %v4float %127 %128 %129 %130 + %132 = OpFMul %v4float %131 %67 + %133 = OpCompositeExtract %float %119 1 + %134 = OpFOrdGreaterThan %bool %133 %float_0_5 + OpSelectionMerge %135 None + OpBranchConditional %134 %136 %137 + %136 = OpLabel + %138 = OpCompositeExtract %float %119 0 + %139 = OpFOrdGreaterThan %bool %138 %float_0_5 + OpSelectionMerge %140 None + OpBranchConditional %139 %141 %142 + %141 = OpLabel + %143 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 %int_3 + %144 = OpLoad %float %143 + %145 = OpCompositeConstruct %v4float %144 %144 %144 %144 + %146 = OpFMul %v4float %132 %145 + %147 = OpFSub %v4float %60 %132 + %148 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 %int_3 + %149 = OpLoad %v4float %148 + %150 = OpFMul %v4float %147 %149 + %151 = OpFAdd %v4float %146 %150 + OpBranch %140 + %142 = OpLabel + %152 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 %int_2 + %153 = OpLoad %float %152 + %154 = OpCompositeConstruct %v4float %153 %153 %153 %153 + %155 = OpFMul %v4float %132 %154 + %156 = OpFSub %v4float %60 %132 + %157 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 %int_2 + %158 = OpLoad %v4float %157 + %159 = OpFMul %v4float %156 %158 + %160 = OpFAdd %v4float %155 %159 + OpBranch %140 + %140 = OpLabel + %161 = OpPhi %v4float %151 %141 %160 %142 + OpBranch %135 + %137 = OpLabel + %162 = OpCompositeExtract %float %119 0 + %163 = OpFOrdGreaterThan %bool %162 %float_0_5 + OpSelectionMerge %164 None + OpBranchConditional %163 %165 %166 + %165 = OpLabel + %167 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 %int_1 + %168 = OpLoad %float %167 + %169 = OpCompositeConstruct %v4float %168 %168 %168 %168 + %170 = OpFMul %v4float %132 %169 + %171 = OpFSub %v4float %60 %132 + %172 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 %int_1 + %173 = OpLoad %v4float %172 + %174 = OpFMul %v4float %171 %173 + %175 = OpFAdd %v4float %170 %174 + OpBranch %164 + %166 = OpLabel + %176 = OpAccessChain %_ptr_Uniform_float %_Globals %int_2 %int_0 + %177 = OpLoad %float %176 + %178 = OpCompositeConstruct %v4float %177 %177 %177 %177 + %179 = OpFMul %v4float %132 %178 + %180 = OpFSub %v4float %60 %132 + %181 = OpAccessChain %_ptr_Uniform_v4float %_Globals %int_3 %int_0 + %182 = OpLoad %v4float %181 + %183 = OpFMul %v4float %180 %182 + %184 = OpFAdd %v4float %179 %183 + OpBranch %164 + %164 = OpLabel + %185 = OpPhi %v4float %175 %165 %184 %166 + OpBranch %135 + %135 = OpLabel + %186 = OpPhi %v4float %161 %140 %185 %164 + %187 = OpFAdd %float %128 %127 + %188 = OpFOrdGreaterThan %bool %187 %float_1 + OpSelectionMerge %189 None + OpBranchConditional %188 %190 %191 + %190 = OpLabel + %192 = OpFOrdLessThan %bool %128 %127 + OpSelectionMerge %193 None + OpBranchConditional %192 %194 %195 + %194 = OpLabel + %196 = OpCompositeExtract %float %186 3 + OpBranch %193 + %195 = OpLabel + %197 = OpCompositeExtract %float %186 2 + OpBranch %193 + %193 = OpLabel + %198 = OpPhi %float %196 %194 %197 %195 + OpBranch %189 + %191 = OpLabel + %199 = OpFOrdLessThan %bool %128 %127 + OpSelectionMerge %200 None + OpBranchConditional %199 %201 %202 + %201 = OpLabel + %203 = OpCompositeExtract %float %186 1 + OpBranch %200 + %202 = OpLabel + %204 = OpCompositeExtract %float %186 0 + OpBranch %200 + %200 = OpLabel + %205 = OpPhi %float %203 %201 %204 %202 + OpBranch %189 + %189 = OpLabel + %206 = OpPhi %float %198 %193 %205 %200 + %207 = OpExtInst %float %1 Floor %206 + %208 = OpFSub %float %206 %207 + %209 = OpFOrdLessThan %bool %207 %float_1 + %210 = OpCompositeExtract %float %114 0 + %211 = OpCompositeExtract %float %114 1 + %212 = OpCompositeConstruct %v3float %float_1 %210 %211 + %213 = OpFOrdLessThan %bool %207 %float_2 + %214 = OpCompositeExtract %float %114 2 + %215 = OpCompositeConstruct %v3float %float_0_5 %211 %214 + %216 = OpFOrdLessThan %bool %207 %float_3 + %217 = OpCompositeExtract %float %114 3 + %218 = OpCompositeConstruct %v3float %float_0_25 %214 %217 + %219 = OpFOrdLessThan %bool %207 %float_4 + %220 = OpCompositeExtract %float %121 0 + %221 = OpCompositeConstruct %v3float %float_0_125 %217 %220 + %222 = OpFOrdLessThan %bool %207 %float_5 + %223 = OpCompositeExtract %float %121 1 + %224 = OpCompositeConstruct %v3float %float_0_0625 %220 %223 + %225 = OpCompositeConstruct %v3float %float_0_03125 %223 %223 + %226 = OpCompositeConstruct %v3bool %222 %222 %222 + %227 = OpSelect %v3float %226 %224 %225 + %228 = OpCompositeConstruct %v3bool %219 %219 %219 + %229 = OpSelect %v3float %228 %221 %227 + %230 = OpCompositeConstruct %v3bool %216 %216 %216 + %231 = OpSelect %v3float %230 %218 %229 + %232 = OpCompositeConstruct %v3bool %213 %213 %213 + %233 = OpSelect %v3float %232 %215 %231 + %234 = OpCompositeConstruct %v3bool %209 %209 %209 + %235 = OpSelect %v3float %234 %212 %233 + %236 = OpCompositeExtract %float %235 0 + %237 = OpCompositeExtract %float %235 1 + %238 = OpCompositeExtract %float %235 2 + %239 = OpCompositeExtract %float %113 0 + %240 = OpFMul %float %239 %float_65280 + %241 = OpCompositeExtract %float %113 1 + %242 = OpFMul %float %241 %float_255 + %243 = OpFAdd %float %240 %242 + %244 = OpFSub %float %243 %float_32768 + %245 = OpFMul %float %244 %float_0_0078125 + %246 = OpCompositeExtract %float %113 2 + %247 = OpFMul %float %246 %float_65280 + %248 = OpCompositeExtract %float %113 3 + %249 = OpFMul %float %248 %float_255 + %250 = OpFAdd %float %247 %249 + %251 = OpFSub %float %250 %float_32768 + %252 = OpFMul %float %251 %float_0_0078125 + %253 = OpExtInst %float %1 FMix %245 %252 %237 + %254 = OpExtInst %float %1 FMix %245 %252 %238 + %255 = OpCompositeConstruct %v2float %236 %236 + %256 = OpFMul %v2float %122 %255 + %257 = OpExtInst %v2float %1 Floor %256 + %258 = OpAccessChain %_ptr_Uniform_v4float %LandscapeParameters %int_3 + %259 = OpAccessChain %_ptr_Uniform_float %LandscapeParameters %int_3 %int_0 + %260 = OpLoad %float %259 + %261 = OpFMul %float %260 %236 + %262 = OpFSub %float %261 %float_1 + %263 = OpFMul %float %260 %float_0_5 + %264 = OpFMul %float %263 %236 + %265 = OpExtInst %float %1 FMax %264 %float_2 + %266 = OpFSub %float %265 %float_1 + %267 = OpCompositeConstruct %v2float %262 %266 + %268 = OpAccessChain %_ptr_Uniform_float %LandscapeParameters %int_3 %int_1 + %269 = OpLoad %float %268 + %270 = OpCompositeConstruct %v2float %269 %269 + %271 = OpFMul %v2float %267 %270 + %272 = OpCompositeExtract %float %271 0 + %273 = OpCompositeConstruct %v2float %272 %272 + %274 = OpFDiv %v2float %257 %273 + %275 = OpFMul %v2float %257 %46 + %276 = OpExtInst %v2float %1 Floor %275 + %277 = OpCompositeExtract %float %271 1 + %278 = OpCompositeConstruct %v2float %277 %277 + %279 = OpFDiv %v2float %276 %278 + %280 = OpCompositeExtract %float %274 0 + %281 = OpCompositeExtract %float %274 1 + %282 = OpCompositeConstruct %v3float %280 %281 %253 + %283 = OpCompositeExtract %float %279 0 + %284 = OpCompositeExtract %float %279 1 + %285 = OpCompositeConstruct %v3float %283 %284 %254 + %286 = OpCompositeConstruct %v3float %208 %208 %208 + %287 = OpExtInst %v3float %1 FMix %282 %285 %286 + %288 = OpVectorShuffle %v2float %119 %92 0 1 + %289 = OpAccessChain %_ptr_Uniform_v4float %LandscapeParameters %int_4 + %290 = OpLoad %v4float %289 + %291 = OpVectorShuffle %v2float %290 %290 3 3 + %292 = OpFMul %v2float %288 %291 + %293 = OpCompositeExtract %float %292 0 + %294 = OpCompositeExtract %float %292 1 + %295 = OpCompositeConstruct %v3float %293 %294 %float_0 + %296 = OpFAdd %v3float %287 %295 + %297 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_0 + %298 = OpLoad %v4float %297 + %299 = OpVectorShuffle %v3float %298 %298 0 1 2 + %300 = OpVectorShuffle %v3float %296 %296 0 0 0 + %301 = OpFMul %v3float %299 %300 + %302 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_1 + %303 = OpLoad %v4float %302 + %304 = OpVectorShuffle %v3float %303 %303 0 1 2 + %305 = OpVectorShuffle %v3float %296 %296 1 1 1 + %306 = OpFMul %v3float %304 %305 + %307 = OpFAdd %v3float %301 %306 + %308 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_2 + %309 = OpLoad %v4float %308 + %310 = OpVectorShuffle %v3float %309 %309 0 1 2 + %311 = OpVectorShuffle %v3float %296 %296 2 2 2 + %312 = OpFMul %v3float %310 %311 + %313 = OpFAdd %v3float %307 %312 + %314 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_3 + %315 = OpLoad %v4float %314 + %316 = OpVectorShuffle %v3float %315 %315 0 1 2 + %317 = OpFAdd %v3float %316 %105 + %318 = OpFAdd %v3float %313 %317 + %319 = OpCompositeExtract %float %318 0 + %320 = OpCompositeExtract %float %318 1 + %321 = OpCompositeExtract %float %318 2 + %322 = OpCompositeConstruct %v4float %319 %320 %321 %float_1 + %323 = OpVectorShuffle %v2float %287 %287 0 1 + %324 = OpLoad %v4float %258 + %325 = OpVectorShuffle %v2float %324 %324 2 3 + %326 = OpFAdd %v2float %323 %325 + %327 = OpFAdd %v2float %326 %292 + %328 = OpAccessChain %_ptr_Uniform_v4float %LandscapeParameters %int_1 + %329 = OpLoad %v4float %328 + %330 = OpVectorShuffle %v2float %329 %329 0 1 + %331 = OpFMul %v2float %323 %330 + %332 = OpVectorShuffle %v2float %329 %329 2 3 + %333 = OpFAdd %v2float %331 %332 + %334 = OpVectorShuffle %v2float %290 %290 2 2 + %335 = OpFMul %v2float %288 %334 + %336 = OpFAdd %v2float %333 %335 + %337 = OpVectorShuffle %v2float %327 %92 0 1 + %338 = OpVectorShuffle %v4float %322 %322 4 5 6 3 + %339 = OpMatrixTimesVector %v4float %101 %338 + %340 = OpVectorShuffle %v3float %322 %92 0 1 2 + %341 = OpFSub %v3float %340 %103 + %342 = OpAccessChain %_ptr_Uniform_v4float %MobileBasePass %int_2 + %343 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_2 %int_3 + %344 = OpLoad %float %343 + %345 = OpDot %float %341 %341 + %346 = OpExtInst %float %1 InverseSqrt %345 + %347 = OpFMul %float %345 %346 + %348 = OpCompositeConstruct %v3float %346 %346 %346 + %349 = OpFMul %v3float %341 %348 + %350 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_0 %int_0 + %351 = OpLoad %float %350 + %352 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_1 %int_0 + %353 = OpLoad %float %352 + %354 = OpCompositeExtract %float %341 2 + %355 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_0 %int_3 + %356 = OpLoad %float %355 + %357 = OpExtInst %float %1 FMax %float_0 %356 + %358 = OpFOrdGreaterThan %bool %357 %float_0 + OpSelectionMerge %359 None + OpBranchConditional %358 %360 %359 + %360 = OpLabel + %361 = OpFMul %float %357 %346 + %362 = OpFMul %float %361 %354 + %363 = OpAccessChain %_ptr_Uniform_float %View %int_25 %int_2 + %364 = OpLoad %float %363 + %365 = OpFAdd %float %364 %362 + %366 = OpFSub %float %354 %362 + %367 = OpFSub %float %float_1 %361 + %368 = OpFMul %float %367 %347 + %369 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_0 %int_1 + %370 = OpLoad %float %369 + %371 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_3 %int_1 + %372 = OpLoad %float %371 + %373 = OpFSub %float %365 %372 + %374 = OpFMul %float %370 %373 + %375 = OpExtInst %float %1 FMax %float_n127 %374 + %376 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_3 %int_0 + %377 = OpLoad %float %376 + %378 = OpFNegate %float %375 + %379 = OpExtInst %float %1 Exp2 %378 + %380 = OpFMul %float %377 %379 + %381 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_1 %int_1 + %382 = OpLoad %float %381 + %383 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_1 %int_3 + %384 = OpLoad %float %383 + %385 = OpFSub %float %365 %384 + %386 = OpFMul %float %382 %385 + %387 = OpExtInst %float %1 FMax %float_n127 %386 + %388 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_1 %int_2 + %389 = OpLoad %float %388 + %390 = OpFNegate %float %387 + %391 = OpExtInst %float %1 Exp2 %390 + %392 = OpFMul %float %389 %391 + OpBranch %359 + %359 = OpLabel + %393 = OpPhi %float %347 %189 %368 %360 + %394 = OpPhi %float %353 %189 %392 %360 + %395 = OpPhi %float %351 %189 %380 %360 + %396 = OpPhi %float %354 %189 %366 %360 + %397 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_0 %int_1 + %398 = OpLoad %float %397 + %399 = OpFMul %float %398 %396 + %400 = OpExtInst %float %1 FMax %float_n127 %399 + %401 = OpFNegate %float %400 + %402 = OpExtInst %float %1 Exp2 %401 + %403 = OpFSub %float %float_1 %402 + %404 = OpFDiv %float %403 %400 + %405 = OpExtInst %float %1 Log %float_2 + %406 = OpFMul %float %405 %405 + %407 = OpFMul %float %float_0_5 %406 + %408 = OpFMul %float %407 %400 + %409 = OpFSub %float %405 %408 + %410 = OpExtInst %float %1 FAbs %400 + %411 = OpFOrdGreaterThan %bool %410 %float_0_00999999978 + %412 = OpSelect %float %411 %404 %409 + %413 = OpFMul %float %395 %412 + %414 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_1 %int_1 + %415 = OpLoad %float %414 + %416 = OpFMul %float %415 %396 + %417 = OpExtInst %float %1 FMax %float_n127 %416 + %418 = OpFNegate %float %417 + %419 = OpExtInst %float %1 Exp2 %418 + %420 = OpFSub %float %float_1 %419 + %421 = OpFDiv %float %420 %417 + %422 = OpFMul %float %407 %417 + %423 = OpFSub %float %405 %422 + %424 = OpExtInst %float %1 FAbs %417 + %425 = OpFOrdGreaterThan %bool %424 %float_0_00999999978 + %426 = OpSelect %float %425 %421 %423 + %427 = OpFMul %float %394 %426 + %428 = OpFAdd %float %413 %427 + %429 = OpFMul %float %428 %393 + %430 = OpLoad %v4float %342 + %431 = OpVectorShuffle %v3float %430 %430 0 1 2 + %432 = OpAccessChain %_ptr_Uniform_v4float %MobileBasePass %int_4 + %433 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_4 %int_3 + %434 = OpLoad %float %433 + %435 = OpFOrdGreaterThanEqual %bool %434 %float_0 + OpSelectionMerge %436 DontFlatten + OpBranchConditional %435 %437 %436 + %437 = OpLabel + %438 = OpAccessChain %_ptr_Uniform_v4float %MobileBasePass %int_5 + %439 = OpLoad %v4float %438 + %440 = OpVectorShuffle %v3float %439 %439 0 1 2 + %441 = OpLoad %v4float %432 + %442 = OpVectorShuffle %v3float %441 %441 0 1 2 + %443 = OpDot %float %349 %442 + %444 = OpExtInst %float %1 FClamp %443 %float_0 %float_1 + %445 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_5 %int_3 + %446 = OpLoad %float %445 + %447 = OpExtInst %float %1 Pow %444 %446 + %448 = OpCompositeConstruct %v3float %447 %447 %447 + %449 = OpFMul %v3float %440 %448 + %450 = OpFSub %float %393 %434 + %451 = OpExtInst %float %1 FMax %450 %float_0 + %452 = OpFMul %float %428 %451 + %453 = OpFNegate %float %452 + %454 = OpExtInst %float %1 Exp2 %453 + %455 = OpExtInst %float %1 FClamp %454 %float_0 %float_1 + %456 = OpFSub %float %float_1 %455 + %457 = OpCompositeConstruct %v3float %456 %456 %456 + %458 = OpFMul %v3float %449 %457 + OpBranch %436 + %436 = OpLabel + %459 = OpPhi %v3float %63 %359 %458 %437 + %460 = OpFNegate %float %429 + %461 = OpExtInst %float %1 Exp2 %460 + %462 = OpExtInst %float %1 FClamp %461 %float_0 %float_1 + %463 = OpExtInst %float %1 FMax %462 %344 + %464 = OpAccessChain %_ptr_Uniform_float %MobileBasePass %int_3 %int_3 + %465 = OpLoad %float %464 + %466 = OpFOrdGreaterThan %bool %465 %float_0 + %467 = OpFOrdGreaterThan %bool %347 %465 + %468 = OpLogicalAnd %bool %466 %467 + %469 = OpCompositeConstruct %v3bool %468 %468 %468 + %470 = OpSelect %v3float %469 %63 %459 + %471 = OpSelect %float %468 %float_1 %463 + %472 = OpFSub %float %float_1 %471 + %473 = OpCompositeConstruct %v3float %472 %472 %472 + %474 = OpFMul %v3float %431 %473 + %475 = OpFAdd %v3float %474 %470 + %476 = OpCompositeExtract %float %475 0 + %477 = OpCompositeExtract %float %475 1 + %478 = OpCompositeExtract %float %475 2 + %479 = OpCompositeConstruct %v4float %476 %477 %478 %471 + %480 = OpAccessChain %_ptr_Function_v4float %97 %int_0 + OpStore %480 %479 + %481 = OpCompositeExtract %float %339 3 + %482 = OpCompositeInsert %v4float %481 %338 3 + %483 = OpLoad %_arr_v4float_uint_1 %97 + %484 = OpCompositeExtract %v4float %483 0 + %485 = OpVectorShuffle %v4float %92 %484 0 1 4 5 + %486 = OpVectorShuffle %v4float %92 %484 0 1 6 7 + OpStore %out_var_TEXCOORD0 %337 + OpStore %out_var_TEXCOORD1 %336 + OpStore %out_var_TEXCOORD2 %485 + OpStore %out_var_TEXCOORD3 %486 + OpStore %out_var_TEXCOORD8 %482 + OpStore %gl_Position %339 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders-ue4/asm/vert/texture-buffer.asm.vert b/third_party/spirv-cross/shaders-ue4/asm/vert/texture-buffer.asm.vert new file mode 100644 index 0000000000..6d52623a14 --- /dev/null +++ b/third_party/spirv-cross/shaders-ue4/asm/vert/texture-buffer.asm.vert @@ -0,0 +1,1054 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 397 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %Main "main" %gl_VertexIndex %gl_InstanceIndex %in_var_ATTRIBUTE0 %out_var_TEXCOORD6 %gl_Position + OpSource HLSL 600 + OpName %type_View "type.View" + OpMemberName %type_View 0 "View_TranslatedWorldToClip" + OpMemberName %type_View 1 "View_WorldToClip" + OpMemberName %type_View 2 "View_TranslatedWorldToView" + OpMemberName %type_View 3 "View_ViewToTranslatedWorld" + OpMemberName %type_View 4 "View_TranslatedWorldToCameraView" + OpMemberName %type_View 5 "View_CameraViewToTranslatedWorld" + OpMemberName %type_View 6 "View_ViewToClip" + OpMemberName %type_View 7 "View_ViewToClipNoAA" + OpMemberName %type_View 8 "View_ClipToView" + OpMemberName %type_View 9 "View_ClipToTranslatedWorld" + OpMemberName %type_View 10 "View_SVPositionToTranslatedWorld" + OpMemberName %type_View 11 "View_ScreenToWorld" + OpMemberName %type_View 12 "View_ScreenToTranslatedWorld" + OpMemberName %type_View 13 "View_ViewForward" + OpMemberName %type_View 14 "PrePadding_View_844" + OpMemberName %type_View 15 "View_ViewUp" + OpMemberName %type_View 16 "PrePadding_View_860" + OpMemberName %type_View 17 "View_ViewRight" + OpMemberName %type_View 18 "PrePadding_View_876" + OpMemberName %type_View 19 "View_HMDViewNoRollUp" + OpMemberName %type_View 20 "PrePadding_View_892" + OpMemberName %type_View 21 "View_HMDViewNoRollRight" + OpMemberName %type_View 22 "PrePadding_View_908" + OpMemberName %type_View 23 "View_InvDeviceZToWorldZTransform" + OpMemberName %type_View 24 "View_ScreenPositionScaleBias" + OpMemberName %type_View 25 "View_WorldCameraOrigin" + OpMemberName %type_View 26 "PrePadding_View_956" + OpMemberName %type_View 27 "View_TranslatedWorldCameraOrigin" + OpMemberName %type_View 28 "PrePadding_View_972" + OpMemberName %type_View 29 "View_WorldViewOrigin" + OpMemberName %type_View 30 "PrePadding_View_988" + OpMemberName %type_View 31 "View_PreViewTranslation" + OpMemberName %type_View 32 "PrePadding_View_1004" + OpMemberName %type_View 33 "View_PrevProjection" + OpMemberName %type_View 34 "View_PrevViewProj" + OpMemberName %type_View 35 "View_PrevViewRotationProj" + OpMemberName %type_View 36 "View_PrevViewToClip" + OpMemberName %type_View 37 "View_PrevClipToView" + OpMemberName %type_View 38 "View_PrevTranslatedWorldToClip" + OpMemberName %type_View 39 "View_PrevTranslatedWorldToView" + OpMemberName %type_View 40 "View_PrevViewToTranslatedWorld" + OpMemberName %type_View 41 "View_PrevTranslatedWorldToCameraView" + OpMemberName %type_View 42 "View_PrevCameraViewToTranslatedWorld" + OpMemberName %type_View 43 "View_PrevWorldCameraOrigin" + OpMemberName %type_View 44 "PrePadding_View_1660" + OpMemberName %type_View 45 "View_PrevWorldViewOrigin" + OpMemberName %type_View 46 "PrePadding_View_1676" + OpMemberName %type_View 47 "View_PrevPreViewTranslation" + OpMemberName %type_View 48 "PrePadding_View_1692" + OpMemberName %type_View 49 "View_PrevInvViewProj" + OpMemberName %type_View 50 "View_PrevScreenToTranslatedWorld" + OpMemberName %type_View 51 "View_ClipToPrevClip" + OpMemberName %type_View 52 "View_TemporalAAJitter" + OpMemberName %type_View 53 "View_GlobalClippingPlane" + OpMemberName %type_View 54 "View_FieldOfViewWideAngles" + OpMemberName %type_View 55 "View_PrevFieldOfViewWideAngles" + OpMemberName %type_View 56 "View_ViewRectMin" + OpMemberName %type_View 57 "View_ViewSizeAndInvSize" + OpMemberName %type_View 58 "View_BufferSizeAndInvSize" + OpMemberName %type_View 59 "View_BufferBilinearUVMinMax" + OpMemberName %type_View 60 "View_NumSceneColorMSAASamples" + OpMemberName %type_View 61 "View_PreExposure" + OpMemberName %type_View 62 "View_OneOverPreExposure" + OpMemberName %type_View 63 "PrePadding_View_2012" + OpMemberName %type_View 64 "View_DiffuseOverrideParameter" + OpMemberName %type_View 65 "View_SpecularOverrideParameter" + OpMemberName %type_View 66 "View_NormalOverrideParameter" + OpMemberName %type_View 67 "View_RoughnessOverrideParameter" + OpMemberName %type_View 68 "View_PrevFrameGameTime" + OpMemberName %type_View 69 "View_PrevFrameRealTime" + OpMemberName %type_View 70 "View_OutOfBoundsMask" + OpMemberName %type_View 71 "PrePadding_View_2084" + OpMemberName %type_View 72 "PrePadding_View_2088" + OpMemberName %type_View 73 "PrePadding_View_2092" + OpMemberName %type_View 74 "View_WorldCameraMovementSinceLastFrame" + OpMemberName %type_View 75 "View_CullingSign" + OpMemberName %type_View 76 "View_NearPlane" + OpMemberName %type_View 77 "View_AdaptiveTessellationFactor" + OpMemberName %type_View 78 "View_GameTime" + OpMemberName %type_View 79 "View_RealTime" + OpMemberName %type_View 80 "View_DeltaTime" + OpMemberName %type_View 81 "View_MaterialTextureMipBias" + OpMemberName %type_View 82 "View_MaterialTextureDerivativeMultiply" + OpMemberName %type_View 83 "View_Random" + OpMemberName %type_View 84 "View_FrameNumber" + OpMemberName %type_View 85 "View_StateFrameIndexMod8" + OpMemberName %type_View 86 "View_StateFrameIndex" + OpMemberName %type_View 87 "View_CameraCut" + OpMemberName %type_View 88 "View_UnlitViewmodeMask" + OpMemberName %type_View 89 "PrePadding_View_2164" + OpMemberName %type_View 90 "PrePadding_View_2168" + OpMemberName %type_View 91 "PrePadding_View_2172" + OpMemberName %type_View 92 "View_DirectionalLightColor" + OpMemberName %type_View 93 "View_DirectionalLightDirection" + OpMemberName %type_View 94 "PrePadding_View_2204" + OpMemberName %type_View 95 "View_TranslucencyLightingVolumeMin" + OpMemberName %type_View 96 "View_TranslucencyLightingVolumeInvSize" + OpMemberName %type_View 97 "View_TemporalAAParams" + OpMemberName %type_View 98 "View_CircleDOFParams" + OpMemberName %type_View 99 "View_DepthOfFieldSensorWidth" + OpMemberName %type_View 100 "View_DepthOfFieldFocalDistance" + OpMemberName %type_View 101 "View_DepthOfFieldScale" + OpMemberName %type_View 102 "View_DepthOfFieldFocalLength" + OpMemberName %type_View 103 "View_DepthOfFieldFocalRegion" + OpMemberName %type_View 104 "View_DepthOfFieldNearTransitionRegion" + OpMemberName %type_View 105 "View_DepthOfFieldFarTransitionRegion" + OpMemberName %type_View 106 "View_MotionBlurNormalizedToPixel" + OpMemberName %type_View 107 "View_bSubsurfacePostprocessEnabled" + OpMemberName %type_View 108 "View_GeneralPurposeTweak" + OpMemberName %type_View 109 "View_DemosaicVposOffset" + OpMemberName %type_View 110 "PrePadding_View_2348" + OpMemberName %type_View 111 "View_IndirectLightingColorScale" + OpMemberName %type_View 112 "View_HDR32bppEncodingMode" + OpMemberName %type_View 113 "View_AtmosphericFogSunDirection" + OpMemberName %type_View 114 "View_AtmosphericFogSunPower" + OpMemberName %type_View 115 "View_AtmosphericFogPower" + OpMemberName %type_View 116 "View_AtmosphericFogDensityScale" + OpMemberName %type_View 117 "View_AtmosphericFogDensityOffset" + OpMemberName %type_View 118 "View_AtmosphericFogGroundOffset" + OpMemberName %type_View 119 "View_AtmosphericFogDistanceScale" + OpMemberName %type_View 120 "View_AtmosphericFogAltitudeScale" + OpMemberName %type_View 121 "View_AtmosphericFogHeightScaleRayleigh" + OpMemberName %type_View 122 "View_AtmosphericFogStartDistance" + OpMemberName %type_View 123 "View_AtmosphericFogDistanceOffset" + OpMemberName %type_View 124 "View_AtmosphericFogSunDiscScale" + OpMemberName %type_View 125 "View_AtmosphericFogRenderMask" + OpMemberName %type_View 126 "View_AtmosphericFogInscatterAltitudeSampleNum" + OpMemberName %type_View 127 "View_AtmosphericFogSunColor" + OpMemberName %type_View 128 "View_NormalCurvatureToRoughnessScaleBias" + OpMemberName %type_View 129 "View_RenderingReflectionCaptureMask" + OpMemberName %type_View 130 "View_AmbientCubemapTint" + OpMemberName %type_View 131 "View_AmbientCubemapIntensity" + OpMemberName %type_View 132 "View_SkyLightParameters" + OpMemberName %type_View 133 "PrePadding_View_2488" + OpMemberName %type_View 134 "PrePadding_View_2492" + OpMemberName %type_View 135 "View_SkyLightColor" + OpMemberName %type_View 136 "View_SkyIrradianceEnvironmentMap" + OpMemberName %type_View 137 "View_MobilePreviewMode" + OpMemberName %type_View 138 "View_HMDEyePaddingOffset" + OpMemberName %type_View 139 "View_ReflectionCubemapMaxMip" + OpMemberName %type_View 140 "View_ShowDecalsMask" + OpMemberName %type_View 141 "View_DistanceFieldAOSpecularOcclusionMode" + OpMemberName %type_View 142 "View_IndirectCapsuleSelfShadowingIntensity" + OpMemberName %type_View 143 "PrePadding_View_2648" + OpMemberName %type_View 144 "PrePadding_View_2652" + OpMemberName %type_View 145 "View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight" + OpMemberName %type_View 146 "View_StereoPassIndex" + OpMemberName %type_View 147 "View_GlobalVolumeCenterAndExtent" + OpMemberName %type_View 148 "View_GlobalVolumeWorldToUVAddAndMul" + OpMemberName %type_View 149 "View_GlobalVolumeDimension" + OpMemberName %type_View 150 "View_GlobalVolumeTexelSize" + OpMemberName %type_View 151 "View_MaxGlobalDistance" + OpMemberName %type_View 152 "View_bCheckerboardSubsurfaceProfileRendering" + OpMemberName %type_View 153 "View_VolumetricFogInvGridSize" + OpMemberName %type_View 154 "PrePadding_View_2828" + OpMemberName %type_View 155 "View_VolumetricFogGridZParams" + OpMemberName %type_View 156 "PrePadding_View_2844" + OpMemberName %type_View 157 "View_VolumetricFogSVPosToVolumeUV" + OpMemberName %type_View 158 "View_VolumetricFogMaxDistance" + OpMemberName %type_View 159 "PrePadding_View_2860" + OpMemberName %type_View 160 "View_VolumetricLightmapWorldToUVScale" + OpMemberName %type_View 161 "PrePadding_View_2876" + OpMemberName %type_View 162 "View_VolumetricLightmapWorldToUVAdd" + OpMemberName %type_View 163 "PrePadding_View_2892" + OpMemberName %type_View 164 "View_VolumetricLightmapIndirectionTextureSize" + OpMemberName %type_View 165 "View_VolumetricLightmapBrickSize" + OpMemberName %type_View 166 "View_VolumetricLightmapBrickTexelSize" + OpMemberName %type_View 167 "View_StereoIPD" + OpMemberName %type_View 168 "View_IndirectLightingCacheShowFlag" + OpMemberName %type_View 169 "View_EyeToPixelSpreadAngle" + OpName %View "View" + OpName %type_Primitive "type.Primitive" + OpMemberName %type_Primitive 0 "Primitive_LocalToWorld" + OpMemberName %type_Primitive 1 "Primitive_InvNonUniformScaleAndDeterminantSign" + OpMemberName %type_Primitive 2 "Primitive_ObjectWorldPositionAndRadius" + OpMemberName %type_Primitive 3 "Primitive_WorldToLocal" + OpMemberName %type_Primitive 4 "Primitive_PreviousLocalToWorld" + OpMemberName %type_Primitive 5 "Primitive_PreviousWorldToLocal" + OpMemberName %type_Primitive 6 "Primitive_ActorWorldPosition" + OpMemberName %type_Primitive 7 "Primitive_UseSingleSampleShadowFromStationaryLights" + OpMemberName %type_Primitive 8 "Primitive_ObjectBounds" + OpMemberName %type_Primitive 9 "Primitive_LpvBiasMultiplier" + OpMemberName %type_Primitive 10 "Primitive_DecalReceiverMask" + OpMemberName %type_Primitive 11 "Primitive_PerObjectGBufferData" + OpMemberName %type_Primitive 12 "Primitive_UseVolumetricLightmapShadowFromStationaryLights" + OpMemberName %type_Primitive 13 "Primitive_UseEditorDepthTest" + OpMemberName %type_Primitive 14 "Primitive_ObjectOrientation" + OpMemberName %type_Primitive 15 "Primitive_NonUniformScale" + OpMemberName %type_Primitive 16 "Primitive_LocalObjectBoundsMin" + OpMemberName %type_Primitive 17 "PrePadding_Primitive_380" + OpMemberName %type_Primitive 18 "Primitive_LocalObjectBoundsMax" + OpMemberName %type_Primitive 19 "Primitive_LightingChannelMask" + OpMemberName %type_Primitive 20 "Primitive_LightmapDataIndex" + OpMemberName %type_Primitive 21 "Primitive_SingleCaptureIndex" + OpName %Primitive "Primitive" + OpName %type_MobileShadowDepthPass "type.MobileShadowDepthPass" + OpMemberName %type_MobileShadowDepthPass 0 "PrePadding_MobileShadowDepthPass_0" + OpMemberName %type_MobileShadowDepthPass 1 "PrePadding_MobileShadowDepthPass_4" + OpMemberName %type_MobileShadowDepthPass 2 "PrePadding_MobileShadowDepthPass_8" + OpMemberName %type_MobileShadowDepthPass 3 "PrePadding_MobileShadowDepthPass_12" + OpMemberName %type_MobileShadowDepthPass 4 "PrePadding_MobileShadowDepthPass_16" + OpMemberName %type_MobileShadowDepthPass 5 "PrePadding_MobileShadowDepthPass_20" + OpMemberName %type_MobileShadowDepthPass 6 "PrePadding_MobileShadowDepthPass_24" + OpMemberName %type_MobileShadowDepthPass 7 "PrePadding_MobileShadowDepthPass_28" + OpMemberName %type_MobileShadowDepthPass 8 "PrePadding_MobileShadowDepthPass_32" + OpMemberName %type_MobileShadowDepthPass 9 "PrePadding_MobileShadowDepthPass_36" + OpMemberName %type_MobileShadowDepthPass 10 "PrePadding_MobileShadowDepthPass_40" + OpMemberName %type_MobileShadowDepthPass 11 "PrePadding_MobileShadowDepthPass_44" + OpMemberName %type_MobileShadowDepthPass 12 "PrePadding_MobileShadowDepthPass_48" + OpMemberName %type_MobileShadowDepthPass 13 "PrePadding_MobileShadowDepthPass_52" + OpMemberName %type_MobileShadowDepthPass 14 "PrePadding_MobileShadowDepthPass_56" + OpMemberName %type_MobileShadowDepthPass 15 "PrePadding_MobileShadowDepthPass_60" + OpMemberName %type_MobileShadowDepthPass 16 "PrePadding_MobileShadowDepthPass_64" + OpMemberName %type_MobileShadowDepthPass 17 "PrePadding_MobileShadowDepthPass_68" + OpMemberName %type_MobileShadowDepthPass 18 "PrePadding_MobileShadowDepthPass_72" + OpMemberName %type_MobileShadowDepthPass 19 "PrePadding_MobileShadowDepthPass_76" + OpMemberName %type_MobileShadowDepthPass 20 "MobileShadowDepthPass_ProjectionMatrix" + OpMemberName %type_MobileShadowDepthPass 21 "MobileShadowDepthPass_ShadowParams" + OpMemberName %type_MobileShadowDepthPass 22 "MobileShadowDepthPass_bClampToNearPlane" + OpMemberName %type_MobileShadowDepthPass 23 "PrePadding_MobileShadowDepthPass_156" + OpMemberName %type_MobileShadowDepthPass 24 "MobileShadowDepthPass_ShadowViewProjectionMatrices" + OpName %MobileShadowDepthPass "MobileShadowDepthPass" + OpName %type_EmitterDynamicUniforms "type.EmitterDynamicUniforms" + OpMemberName %type_EmitterDynamicUniforms 0 "EmitterDynamicUniforms_LocalToWorldScale" + OpMemberName %type_EmitterDynamicUniforms 1 "EmitterDynamicUniforms_EmitterInstRandom" + OpMemberName %type_EmitterDynamicUniforms 2 "PrePadding_EmitterDynamicUniforms_12" + OpMemberName %type_EmitterDynamicUniforms 3 "EmitterDynamicUniforms_AxisLockRight" + OpMemberName %type_EmitterDynamicUniforms 4 "EmitterDynamicUniforms_AxisLockUp" + OpMemberName %type_EmitterDynamicUniforms 5 "EmitterDynamicUniforms_DynamicColor" + OpMemberName %type_EmitterDynamicUniforms 6 "EmitterDynamicUniforms_MacroUVParameters" + OpName %EmitterDynamicUniforms "EmitterDynamicUniforms" + OpName %type_EmitterUniforms "type.EmitterUniforms" + OpMemberName %type_EmitterUniforms 0 "EmitterUniforms_ColorCurve" + OpMemberName %type_EmitterUniforms 1 "EmitterUniforms_ColorScale" + OpMemberName %type_EmitterUniforms 2 "EmitterUniforms_ColorBias" + OpMemberName %type_EmitterUniforms 3 "EmitterUniforms_MiscCurve" + OpMemberName %type_EmitterUniforms 4 "EmitterUniforms_MiscScale" + OpMemberName %type_EmitterUniforms 5 "EmitterUniforms_MiscBias" + OpMemberName %type_EmitterUniforms 6 "EmitterUniforms_SizeBySpeed" + OpMemberName %type_EmitterUniforms 7 "EmitterUniforms_SubImageSize" + OpMemberName %type_EmitterUniforms 8 "EmitterUniforms_TangentSelector" + OpMemberName %type_EmitterUniforms 9 "EmitterUniforms_CameraFacingBlend" + OpMemberName %type_EmitterUniforms 10 "EmitterUniforms_RemoveHMDRoll" + OpMemberName %type_EmitterUniforms 11 "EmitterUniforms_RotationRateScale" + OpMemberName %type_EmitterUniforms 12 "EmitterUniforms_RotationBias" + OpMemberName %type_EmitterUniforms 13 "EmitterUniforms_CameraMotionBlurAmount" + OpMemberName %type_EmitterUniforms 14 "PrePadding_EmitterUniforms_172" + OpMemberName %type_EmitterUniforms 15 "EmitterUniforms_PivotOffset" + OpName %EmitterUniforms "EmitterUniforms" + OpName %type_buffer_image "type.buffer.image" + OpName %ParticleIndices "ParticleIndices" + OpName %type__Globals "type.$Globals" + OpMemberName %type__Globals 0 "ParticleIndicesOffset" + OpName %_Globals "$Globals" + OpName %type_2d_image "type.2d.image" + OpName %PositionTexture "PositionTexture" + OpName %type_sampler "type.sampler" + OpName %PositionTextureSampler "PositionTextureSampler" + OpName %VelocityTexture "VelocityTexture" + OpName %VelocityTextureSampler "VelocityTextureSampler" + OpName %AttributesTexture "AttributesTexture" + OpName %AttributesTextureSampler "AttributesTextureSampler" + OpName %CurveTexture "CurveTexture" + OpName %CurveTextureSampler "CurveTextureSampler" + OpName %in_var_ATTRIBUTE0 "in.var.ATTRIBUTE0" + OpName %out_var_TEXCOORD6 "out.var.TEXCOORD6" + OpName %Main "Main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorateString %gl_VertexIndex UserSemantic "SV_VertexID" + OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex + OpDecorateString %gl_InstanceIndex UserSemantic "SV_InstanceID" + OpDecorateString %in_var_ATTRIBUTE0 UserSemantic "ATTRIBUTE0" + OpDecorateString %out_var_TEXCOORD6 UserSemantic "TEXCOORD6" + OpDecorate %gl_Position BuiltIn Position + OpDecorateString %gl_Position UserSemantic "SV_POSITION" + OpDecorate %in_var_ATTRIBUTE0 Location 0 + OpDecorate %out_var_TEXCOORD6 Location 0 + OpDecorate %View DescriptorSet 0 + OpDecorate %View Binding 1 + OpDecorate %Primitive DescriptorSet 0 + OpDecorate %Primitive Binding 2 + OpDecorate %MobileShadowDepthPass DescriptorSet 0 + OpDecorate %MobileShadowDepthPass Binding 3 + OpDecorate %EmitterDynamicUniforms DescriptorSet 0 + OpDecorate %EmitterDynamicUniforms Binding 4 + OpDecorate %EmitterUniforms DescriptorSet 0 + OpDecorate %EmitterUniforms Binding 5 + OpDecorate %ParticleIndices DescriptorSet 0 + OpDecorate %ParticleIndices Binding 0 + OpDecorate %_Globals DescriptorSet 0 + OpDecorate %_Globals Binding 6 + OpDecorate %PositionTexture DescriptorSet 0 + OpDecorate %PositionTexture Binding 1 + OpDecorate %PositionTextureSampler DescriptorSet 0 + OpDecorate %PositionTextureSampler Binding 0 + OpDecorate %VelocityTexture DescriptorSet 0 + OpDecorate %VelocityTexture Binding 2 + OpDecorate %VelocityTextureSampler DescriptorSet 0 + OpDecorate %VelocityTextureSampler Binding 1 + OpDecorate %AttributesTexture DescriptorSet 0 + OpDecorate %AttributesTexture Binding 3 + OpDecorate %AttributesTextureSampler DescriptorSet 0 + OpDecorate %AttributesTextureSampler Binding 2 + OpDecorate %CurveTexture DescriptorSet 0 + OpDecorate %CurveTexture Binding 4 + OpDecorate %CurveTextureSampler DescriptorSet 0 + OpDecorate %CurveTextureSampler Binding 3 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr_v4float_uint_7 ArrayStride 16 + OpDecorate %_arr_v4float_uint_4 ArrayStride 16 + OpMemberDecorate %type_View 0 Offset 0 + OpMemberDecorate %type_View 0 MatrixStride 16 + OpMemberDecorate %type_View 0 ColMajor + OpMemberDecorate %type_View 1 Offset 64 + OpMemberDecorate %type_View 1 MatrixStride 16 + OpMemberDecorate %type_View 1 ColMajor + OpMemberDecorate %type_View 2 Offset 128 + OpMemberDecorate %type_View 2 MatrixStride 16 + OpMemberDecorate %type_View 2 ColMajor + OpMemberDecorate %type_View 3 Offset 192 + OpMemberDecorate %type_View 3 MatrixStride 16 + OpMemberDecorate %type_View 3 ColMajor + OpMemberDecorate %type_View 4 Offset 256 + OpMemberDecorate %type_View 4 MatrixStride 16 + OpMemberDecorate %type_View 4 ColMajor + OpMemberDecorate %type_View 5 Offset 320 + OpMemberDecorate %type_View 5 MatrixStride 16 + OpMemberDecorate %type_View 5 ColMajor + OpMemberDecorate %type_View 6 Offset 384 + OpMemberDecorate %type_View 6 MatrixStride 16 + OpMemberDecorate %type_View 6 ColMajor + OpMemberDecorate %type_View 7 Offset 448 + OpMemberDecorate %type_View 7 MatrixStride 16 + OpMemberDecorate %type_View 7 ColMajor + OpMemberDecorate %type_View 8 Offset 512 + OpMemberDecorate %type_View 8 MatrixStride 16 + OpMemberDecorate %type_View 8 ColMajor + OpMemberDecorate %type_View 9 Offset 576 + OpMemberDecorate %type_View 9 MatrixStride 16 + OpMemberDecorate %type_View 9 ColMajor + OpMemberDecorate %type_View 10 Offset 640 + OpMemberDecorate %type_View 10 MatrixStride 16 + OpMemberDecorate %type_View 10 ColMajor + OpMemberDecorate %type_View 11 Offset 704 + OpMemberDecorate %type_View 11 MatrixStride 16 + OpMemberDecorate %type_View 11 ColMajor + OpMemberDecorate %type_View 12 Offset 768 + OpMemberDecorate %type_View 12 MatrixStride 16 + OpMemberDecorate %type_View 12 ColMajor + OpMemberDecorate %type_View 13 Offset 832 + OpMemberDecorate %type_View 14 Offset 844 + OpMemberDecorate %type_View 15 Offset 848 + OpMemberDecorate %type_View 16 Offset 860 + OpMemberDecorate %type_View 17 Offset 864 + OpMemberDecorate %type_View 18 Offset 876 + OpMemberDecorate %type_View 19 Offset 880 + OpMemberDecorate %type_View 20 Offset 892 + OpMemberDecorate %type_View 21 Offset 896 + OpMemberDecorate %type_View 22 Offset 908 + OpMemberDecorate %type_View 23 Offset 912 + OpMemberDecorate %type_View 24 Offset 928 + OpMemberDecorate %type_View 25 Offset 944 + OpMemberDecorate %type_View 26 Offset 956 + OpMemberDecorate %type_View 27 Offset 960 + OpMemberDecorate %type_View 28 Offset 972 + OpMemberDecorate %type_View 29 Offset 976 + OpMemberDecorate %type_View 30 Offset 988 + OpMemberDecorate %type_View 31 Offset 992 + OpMemberDecorate %type_View 32 Offset 1004 + OpMemberDecorate %type_View 33 Offset 1008 + OpMemberDecorate %type_View 33 MatrixStride 16 + OpMemberDecorate %type_View 33 ColMajor + OpMemberDecorate %type_View 34 Offset 1072 + OpMemberDecorate %type_View 34 MatrixStride 16 + OpMemberDecorate %type_View 34 ColMajor + OpMemberDecorate %type_View 35 Offset 1136 + OpMemberDecorate %type_View 35 MatrixStride 16 + OpMemberDecorate %type_View 35 ColMajor + OpMemberDecorate %type_View 36 Offset 1200 + OpMemberDecorate %type_View 36 MatrixStride 16 + OpMemberDecorate %type_View 36 ColMajor + OpMemberDecorate %type_View 37 Offset 1264 + OpMemberDecorate %type_View 37 MatrixStride 16 + OpMemberDecorate %type_View 37 ColMajor + OpMemberDecorate %type_View 38 Offset 1328 + OpMemberDecorate %type_View 38 MatrixStride 16 + OpMemberDecorate %type_View 38 ColMajor + OpMemberDecorate %type_View 39 Offset 1392 + OpMemberDecorate %type_View 39 MatrixStride 16 + OpMemberDecorate %type_View 39 ColMajor + OpMemberDecorate %type_View 40 Offset 1456 + OpMemberDecorate %type_View 40 MatrixStride 16 + OpMemberDecorate %type_View 40 ColMajor + OpMemberDecorate %type_View 41 Offset 1520 + OpMemberDecorate %type_View 41 MatrixStride 16 + OpMemberDecorate %type_View 41 ColMajor + OpMemberDecorate %type_View 42 Offset 1584 + OpMemberDecorate %type_View 42 MatrixStride 16 + OpMemberDecorate %type_View 42 ColMajor + OpMemberDecorate %type_View 43 Offset 1648 + OpMemberDecorate %type_View 44 Offset 1660 + OpMemberDecorate %type_View 45 Offset 1664 + OpMemberDecorate %type_View 46 Offset 1676 + OpMemberDecorate %type_View 47 Offset 1680 + OpMemberDecorate %type_View 48 Offset 1692 + OpMemberDecorate %type_View 49 Offset 1696 + OpMemberDecorate %type_View 49 MatrixStride 16 + OpMemberDecorate %type_View 49 ColMajor + OpMemberDecorate %type_View 50 Offset 1760 + OpMemberDecorate %type_View 50 MatrixStride 16 + OpMemberDecorate %type_View 50 ColMajor + OpMemberDecorate %type_View 51 Offset 1824 + OpMemberDecorate %type_View 51 MatrixStride 16 + OpMemberDecorate %type_View 51 ColMajor + OpMemberDecorate %type_View 52 Offset 1888 + OpMemberDecorate %type_View 53 Offset 1904 + OpMemberDecorate %type_View 54 Offset 1920 + OpMemberDecorate %type_View 55 Offset 1928 + OpMemberDecorate %type_View 56 Offset 1936 + OpMemberDecorate %type_View 57 Offset 1952 + OpMemberDecorate %type_View 58 Offset 1968 + OpMemberDecorate %type_View 59 Offset 1984 + OpMemberDecorate %type_View 60 Offset 2000 + OpMemberDecorate %type_View 61 Offset 2004 + OpMemberDecorate %type_View 62 Offset 2008 + OpMemberDecorate %type_View 63 Offset 2012 + OpMemberDecorate %type_View 64 Offset 2016 + OpMemberDecorate %type_View 65 Offset 2032 + OpMemberDecorate %type_View 66 Offset 2048 + OpMemberDecorate %type_View 67 Offset 2064 + OpMemberDecorate %type_View 68 Offset 2072 + OpMemberDecorate %type_View 69 Offset 2076 + OpMemberDecorate %type_View 70 Offset 2080 + OpMemberDecorate %type_View 71 Offset 2084 + OpMemberDecorate %type_View 72 Offset 2088 + OpMemberDecorate %type_View 73 Offset 2092 + OpMemberDecorate %type_View 74 Offset 2096 + OpMemberDecorate %type_View 75 Offset 2108 + OpMemberDecorate %type_View 76 Offset 2112 + OpMemberDecorate %type_View 77 Offset 2116 + OpMemberDecorate %type_View 78 Offset 2120 + OpMemberDecorate %type_View 79 Offset 2124 + OpMemberDecorate %type_View 80 Offset 2128 + OpMemberDecorate %type_View 81 Offset 2132 + OpMemberDecorate %type_View 82 Offset 2136 + OpMemberDecorate %type_View 83 Offset 2140 + OpMemberDecorate %type_View 84 Offset 2144 + OpMemberDecorate %type_View 85 Offset 2148 + OpMemberDecorate %type_View 86 Offset 2152 + OpMemberDecorate %type_View 87 Offset 2156 + OpMemberDecorate %type_View 88 Offset 2160 + OpMemberDecorate %type_View 89 Offset 2164 + OpMemberDecorate %type_View 90 Offset 2168 + OpMemberDecorate %type_View 91 Offset 2172 + OpMemberDecorate %type_View 92 Offset 2176 + OpMemberDecorate %type_View 93 Offset 2192 + OpMemberDecorate %type_View 94 Offset 2204 + OpMemberDecorate %type_View 95 Offset 2208 + OpMemberDecorate %type_View 96 Offset 2240 + OpMemberDecorate %type_View 97 Offset 2272 + OpMemberDecorate %type_View 98 Offset 2288 + OpMemberDecorate %type_View 99 Offset 2304 + OpMemberDecorate %type_View 100 Offset 2308 + OpMemberDecorate %type_View 101 Offset 2312 + OpMemberDecorate %type_View 102 Offset 2316 + OpMemberDecorate %type_View 103 Offset 2320 + OpMemberDecorate %type_View 104 Offset 2324 + OpMemberDecorate %type_View 105 Offset 2328 + OpMemberDecorate %type_View 106 Offset 2332 + OpMemberDecorate %type_View 107 Offset 2336 + OpMemberDecorate %type_View 108 Offset 2340 + OpMemberDecorate %type_View 109 Offset 2344 + OpMemberDecorate %type_View 110 Offset 2348 + OpMemberDecorate %type_View 111 Offset 2352 + OpMemberDecorate %type_View 112 Offset 2364 + OpMemberDecorate %type_View 113 Offset 2368 + OpMemberDecorate %type_View 114 Offset 2380 + OpMemberDecorate %type_View 115 Offset 2384 + OpMemberDecorate %type_View 116 Offset 2388 + OpMemberDecorate %type_View 117 Offset 2392 + OpMemberDecorate %type_View 118 Offset 2396 + OpMemberDecorate %type_View 119 Offset 2400 + OpMemberDecorate %type_View 120 Offset 2404 + OpMemberDecorate %type_View 121 Offset 2408 + OpMemberDecorate %type_View 122 Offset 2412 + OpMemberDecorate %type_View 123 Offset 2416 + OpMemberDecorate %type_View 124 Offset 2420 + OpMemberDecorate %type_View 125 Offset 2424 + OpMemberDecorate %type_View 126 Offset 2428 + OpMemberDecorate %type_View 127 Offset 2432 + OpMemberDecorate %type_View 128 Offset 2448 + OpMemberDecorate %type_View 129 Offset 2460 + OpMemberDecorate %type_View 130 Offset 2464 + OpMemberDecorate %type_View 131 Offset 2480 + OpMemberDecorate %type_View 132 Offset 2484 + OpMemberDecorate %type_View 133 Offset 2488 + OpMemberDecorate %type_View 134 Offset 2492 + OpMemberDecorate %type_View 135 Offset 2496 + OpMemberDecorate %type_View 136 Offset 2512 + OpMemberDecorate %type_View 137 Offset 2624 + OpMemberDecorate %type_View 138 Offset 2628 + OpMemberDecorate %type_View 139 Offset 2632 + OpMemberDecorate %type_View 140 Offset 2636 + OpMemberDecorate %type_View 141 Offset 2640 + OpMemberDecorate %type_View 142 Offset 2644 + OpMemberDecorate %type_View 143 Offset 2648 + OpMemberDecorate %type_View 144 Offset 2652 + OpMemberDecorate %type_View 145 Offset 2656 + OpMemberDecorate %type_View 146 Offset 2668 + OpMemberDecorate %type_View 147 Offset 2672 + OpMemberDecorate %type_View 148 Offset 2736 + OpMemberDecorate %type_View 149 Offset 2800 + OpMemberDecorate %type_View 150 Offset 2804 + OpMemberDecorate %type_View 151 Offset 2808 + OpMemberDecorate %type_View 152 Offset 2812 + OpMemberDecorate %type_View 153 Offset 2816 + OpMemberDecorate %type_View 154 Offset 2828 + OpMemberDecorate %type_View 155 Offset 2832 + OpMemberDecorate %type_View 156 Offset 2844 + OpMemberDecorate %type_View 157 Offset 2848 + OpMemberDecorate %type_View 158 Offset 2856 + OpMemberDecorate %type_View 159 Offset 2860 + OpMemberDecorate %type_View 160 Offset 2864 + OpMemberDecorate %type_View 161 Offset 2876 + OpMemberDecorate %type_View 162 Offset 2880 + OpMemberDecorate %type_View 163 Offset 2892 + OpMemberDecorate %type_View 164 Offset 2896 + OpMemberDecorate %type_View 165 Offset 2908 + OpMemberDecorate %type_View 166 Offset 2912 + OpMemberDecorate %type_View 167 Offset 2924 + OpMemberDecorate %type_View 168 Offset 2928 + OpMemberDecorate %type_View 169 Offset 2932 + OpDecorate %type_View Block + OpMemberDecorate %type_Primitive 0 Offset 0 + OpMemberDecorate %type_Primitive 0 MatrixStride 16 + OpMemberDecorate %type_Primitive 0 ColMajor + OpMemberDecorate %type_Primitive 1 Offset 64 + OpMemberDecorate %type_Primitive 2 Offset 80 + OpMemberDecorate %type_Primitive 3 Offset 96 + OpMemberDecorate %type_Primitive 3 MatrixStride 16 + OpMemberDecorate %type_Primitive 3 ColMajor + OpMemberDecorate %type_Primitive 4 Offset 160 + OpMemberDecorate %type_Primitive 4 MatrixStride 16 + OpMemberDecorate %type_Primitive 4 ColMajor + OpMemberDecorate %type_Primitive 5 Offset 224 + OpMemberDecorate %type_Primitive 5 MatrixStride 16 + OpMemberDecorate %type_Primitive 5 ColMajor + OpMemberDecorate %type_Primitive 6 Offset 288 + OpMemberDecorate %type_Primitive 7 Offset 300 + OpMemberDecorate %type_Primitive 8 Offset 304 + OpMemberDecorate %type_Primitive 9 Offset 316 + OpMemberDecorate %type_Primitive 10 Offset 320 + OpMemberDecorate %type_Primitive 11 Offset 324 + OpMemberDecorate %type_Primitive 12 Offset 328 + OpMemberDecorate %type_Primitive 13 Offset 332 + OpMemberDecorate %type_Primitive 14 Offset 336 + OpMemberDecorate %type_Primitive 15 Offset 352 + OpMemberDecorate %type_Primitive 16 Offset 368 + OpMemberDecorate %type_Primitive 17 Offset 380 + OpMemberDecorate %type_Primitive 18 Offset 384 + OpMemberDecorate %type_Primitive 19 Offset 396 + OpMemberDecorate %type_Primitive 20 Offset 400 + OpMemberDecorate %type_Primitive 21 Offset 404 + OpDecorate %type_Primitive Block + OpDecorate %_arr_mat4v4float_uint_6 ArrayStride 64 + OpMemberDecorate %type_MobileShadowDepthPass 0 Offset 0 + OpMemberDecorate %type_MobileShadowDepthPass 1 Offset 4 + OpMemberDecorate %type_MobileShadowDepthPass 2 Offset 8 + OpMemberDecorate %type_MobileShadowDepthPass 3 Offset 12 + OpMemberDecorate %type_MobileShadowDepthPass 4 Offset 16 + OpMemberDecorate %type_MobileShadowDepthPass 5 Offset 20 + OpMemberDecorate %type_MobileShadowDepthPass 6 Offset 24 + OpMemberDecorate %type_MobileShadowDepthPass 7 Offset 28 + OpMemberDecorate %type_MobileShadowDepthPass 8 Offset 32 + OpMemberDecorate %type_MobileShadowDepthPass 9 Offset 36 + OpMemberDecorate %type_MobileShadowDepthPass 10 Offset 40 + OpMemberDecorate %type_MobileShadowDepthPass 11 Offset 44 + OpMemberDecorate %type_MobileShadowDepthPass 12 Offset 48 + OpMemberDecorate %type_MobileShadowDepthPass 13 Offset 52 + OpMemberDecorate %type_MobileShadowDepthPass 14 Offset 56 + OpMemberDecorate %type_MobileShadowDepthPass 15 Offset 60 + OpMemberDecorate %type_MobileShadowDepthPass 16 Offset 64 + OpMemberDecorate %type_MobileShadowDepthPass 17 Offset 68 + OpMemberDecorate %type_MobileShadowDepthPass 18 Offset 72 + OpMemberDecorate %type_MobileShadowDepthPass 19 Offset 76 + OpMemberDecorate %type_MobileShadowDepthPass 20 Offset 80 + OpMemberDecorate %type_MobileShadowDepthPass 20 MatrixStride 16 + OpMemberDecorate %type_MobileShadowDepthPass 20 ColMajor + OpMemberDecorate %type_MobileShadowDepthPass 21 Offset 144 + OpMemberDecorate %type_MobileShadowDepthPass 22 Offset 152 + OpMemberDecorate %type_MobileShadowDepthPass 23 Offset 156 + OpMemberDecorate %type_MobileShadowDepthPass 24 Offset 160 + OpMemberDecorate %type_MobileShadowDepthPass 24 MatrixStride 16 + OpMemberDecorate %type_MobileShadowDepthPass 24 ColMajor + OpDecorate %type_MobileShadowDepthPass Block + OpMemberDecorate %type_EmitterDynamicUniforms 0 Offset 0 + OpMemberDecorate %type_EmitterDynamicUniforms 1 Offset 8 + OpMemberDecorate %type_EmitterDynamicUniforms 2 Offset 12 + OpMemberDecorate %type_EmitterDynamicUniforms 3 Offset 16 + OpMemberDecorate %type_EmitterDynamicUniforms 4 Offset 32 + OpMemberDecorate %type_EmitterDynamicUniforms 5 Offset 48 + OpMemberDecorate %type_EmitterDynamicUniforms 6 Offset 64 + OpDecorate %type_EmitterDynamicUniforms Block + OpMemberDecorate %type_EmitterUniforms 0 Offset 0 + OpMemberDecorate %type_EmitterUniforms 1 Offset 16 + OpMemberDecorate %type_EmitterUniforms 2 Offset 32 + OpMemberDecorate %type_EmitterUniforms 3 Offset 48 + OpMemberDecorate %type_EmitterUniforms 4 Offset 64 + OpMemberDecorate %type_EmitterUniforms 5 Offset 80 + OpMemberDecorate %type_EmitterUniforms 6 Offset 96 + OpMemberDecorate %type_EmitterUniforms 7 Offset 112 + OpMemberDecorate %type_EmitterUniforms 8 Offset 128 + OpMemberDecorate %type_EmitterUniforms 9 Offset 144 + OpMemberDecorate %type_EmitterUniforms 10 Offset 156 + OpMemberDecorate %type_EmitterUniforms 11 Offset 160 + OpMemberDecorate %type_EmitterUniforms 12 Offset 164 + OpMemberDecorate %type_EmitterUniforms 13 Offset 168 + OpMemberDecorate %type_EmitterUniforms 14 Offset 172 + OpMemberDecorate %type_EmitterUniforms 15 Offset 176 + OpDecorate %type_EmitterUniforms Block + OpMemberDecorate %type__Globals 0 Offset 0 + OpDecorate %type__Globals Block + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %uint_7 = OpConstant %uint 7 + %uint_4 = OpConstant %uint 4 + %float_0 = OpConstant %float 0 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %uint_16 = OpConstant %uint 16 + %int_3 = OpConstant %int 3 + %float_1 = OpConstant %float 1 +%float_9_99999975en05 = OpConstant %float 9.99999975e-05 + %54 = OpConstantComposite %v3float %float_0 %float_0 %float_9_99999975en05 + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %int_4 = OpConstant %int 4 + %float_0_5 = OpConstant %float 0.5 + %float_n0_5 = OpConstant %float -0.5 + %float_2 = OpConstant %float 2 + %61 = OpConstantComposite %v2float %float_2 %float_2 + %int_6 = OpConstant %int 6 + %63 = OpConstantComposite %v2float %float_1 %float_1 + %int_11 = OpConstant %int 11 + %int_15 = OpConstant %int 15 + %int_8 = OpConstant %int 8 + %int_9 = OpConstant %int 9 + %int_10 = OpConstant %int 10 + %int_12 = OpConstant %int 12 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%mat3v3float = OpTypeMatrix %v3float 3 + %int_20 = OpConstant %int 20 + %int_22 = OpConstant %int 22 +%float_9_99999997en07 = OpConstant %float 9.99999997e-07 + %int_21 = OpConstant %int 21 + %int_17 = OpConstant %int 17 + %int_19 = OpConstant %int 19 + %int_27 = OpConstant %int 27 + %int_31 = OpConstant %int 31 + %uint_3 = OpConstant %uint 3 + %82 = OpConstantComposite %v3float %float_0 %float_0 %float_1 +%float_0_00999999978 = OpConstant %float 0.00999999978 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr_v4float_uint_7 = OpTypeArray %v4float %uint_7 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 + %type_View = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v4float %v4float %v3float %float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %v3float %float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %v2float %v2float %v4float %v4float %v4float %v4float %int %float %float %float %v4float %v4float %v4float %v2float %float %float %float %float %float %float %v3float %float %float %float %float %float %float %float %float %uint %uint %uint %uint %float %float %float %float %float %v4float %v3float %float %_arr_v4float_uint_2 %_arr_v4float_uint_2 %v4float %v4float %float %float %float %float %float %float %float %float %float %float %float %float %v3float %float %v3float %float %float %float %float %float %float %float %float %float %float %float %uint %uint %v4float %v3float %float %v4float %float %float %float %float %v4float %_arr_v4float_uint_7 %float %float %float %float %uint %float %float %float %v3float %int %_arr_v4float_uint_4 %_arr_v4float_uint_4 %float %float %float %float %v3float %float %v3float %float %v2float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float +%_ptr_Uniform_type_View = OpTypePointer Uniform %type_View +%type_Primitive = OpTypeStruct %mat4v4float %v4float %v4float %mat4v4float %mat4v4float %mat4v4float %v3float %float %v3float %float %float %float %float %float %v4float %v4float %v3float %float %v3float %uint %uint %int +%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive + %uint_6 = OpConstant %uint 6 +%_arr_mat4v4float_uint_6 = OpTypeArray %mat4v4float %uint_6 +%type_MobileShadowDepthPass = OpTypeStruct %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %float %mat4v4float %v2float %float %float %_arr_mat4v4float_uint_6 +%_ptr_Uniform_type_MobileShadowDepthPass = OpTypePointer Uniform %type_MobileShadowDepthPass +%type_EmitterDynamicUniforms = OpTypeStruct %v2float %float %float %v4float %v4float %v4float %v4float +%_ptr_Uniform_type_EmitterDynamicUniforms = OpTypePointer Uniform %type_EmitterDynamicUniforms +%type_EmitterUniforms = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v4float %v3float %float %float %float %float %float %v2float +%_ptr_Uniform_type_EmitterUniforms = OpTypePointer Uniform %type_EmitterUniforms +%type_buffer_image = OpTypeImage %float Buffer 2 0 0 1 Rg32f +%_ptr_UniformConstant_type_buffer_image = OpTypePointer UniformConstant %type_buffer_image +%type__Globals = OpTypeStruct %uint +%_ptr_Uniform_type__Globals = OpTypePointer Uniform %type__Globals +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler +%_ptr_Input_uint = OpTypePointer Input %uint +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %99 = OpTypeFunction %void +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %bool = OpTypeBool +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %View = OpVariable %_ptr_Uniform_type_View Uniform + %Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform +%MobileShadowDepthPass = OpVariable %_ptr_Uniform_type_MobileShadowDepthPass Uniform +%EmitterDynamicUniforms = OpVariable %_ptr_Uniform_type_EmitterDynamicUniforms Uniform +%EmitterUniforms = OpVariable %_ptr_Uniform_type_EmitterUniforms Uniform +%ParticleIndices = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant + %_Globals = OpVariable %_ptr_Uniform_type__Globals Uniform +%PositionTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%PositionTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%VelocityTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%VelocityTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%AttributesTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%AttributesTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%CurveTexture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant +%CurveTextureSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%gl_VertexIndex = OpVariable %_ptr_Input_uint Input +%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input +%in_var_ATTRIBUTE0 = OpVariable %_ptr_Input_v2float Input +%out_var_TEXCOORD6 = OpVariable %_ptr_Output_float Output +%gl_Position = OpVariable %_ptr_Output_v4float Output +%float_6_28318548 = OpConstant %float 6.28318548 + %108 = OpConstantNull %v3float + %Main = OpFunction %void None %99 + %109 = OpLabel + %110 = OpLoad %uint %gl_VertexIndex + %111 = OpLoad %uint %gl_InstanceIndex + %112 = OpLoad %v2float %in_var_ATTRIBUTE0 + %113 = OpAccessChain %_ptr_Uniform_v3float %View %int_15 + %114 = OpLoad %v3float %113 + %115 = OpAccessChain %_ptr_Uniform_v3float %View %int_17 + %116 = OpLoad %v3float %115 + %117 = OpAccessChain %_ptr_Uniform_v3float %View %int_19 + %118 = OpLoad %v3float %117 + %119 = OpAccessChain %_ptr_Uniform_v3float %View %int_21 + %120 = OpLoad %v3float %119 + %121 = OpAccessChain %_ptr_Uniform_v3float %View %int_27 + %122 = OpLoad %v3float %121 + %123 = OpAccessChain %_ptr_Uniform_v3float %View %int_31 + %124 = OpLoad %v3float %123 + %125 = OpIMul %uint %111 %uint_16 + %126 = OpUDiv %uint %110 %uint_4 + %127 = OpIAdd %uint %125 %126 + %128 = OpAccessChain %_ptr_Uniform_uint %_Globals %int_0 + %129 = OpLoad %uint %128 + %130 = OpIAdd %uint %129 %127 + %131 = OpLoad %type_buffer_image %ParticleIndices + %132 = OpImageFetch %v4float %131 %130 None + %133 = OpVectorShuffle %v2float %132 %132 0 1 + %134 = OpLoad %type_2d_image %PositionTexture + %135 = OpLoad %type_sampler %PositionTextureSampler + %136 = OpSampledImage %type_sampled_image %134 %135 + %137 = OpImageSampleExplicitLod %v4float %136 %133 Lod %float_0 + %138 = OpLoad %type_2d_image %VelocityTexture + %139 = OpLoad %type_sampler %VelocityTextureSampler + %140 = OpSampledImage %type_sampled_image %138 %139 + %141 = OpImageSampleExplicitLod %v4float %140 %133 Lod %float_0 + %142 = OpLoad %type_2d_image %AttributesTexture + %143 = OpLoad %type_sampler %AttributesTextureSampler + %144 = OpSampledImage %type_sampled_image %142 %143 + %145 = OpImageSampleExplicitLod %v4float %144 %133 Lod %float_0 + %146 = OpCompositeExtract %float %137 3 + %147 = OpExtInst %float %1 Step %146 %float_1 + %148 = OpVectorShuffle %v3float %141 %141 0 1 2 + %149 = OpAccessChain %_ptr_Uniform_mat4v4float %Primitive %int_0 + %150 = OpLoad %mat4v4float %149 + %151 = OpCompositeExtract %v4float %150 0 + %152 = OpVectorShuffle %v3float %151 %151 0 1 2 + %153 = OpCompositeExtract %v4float %150 1 + %154 = OpVectorShuffle %v3float %153 %153 0 1 2 + %155 = OpCompositeExtract %v4float %150 2 + %156 = OpVectorShuffle %v3float %155 %155 0 1 2 + %157 = OpCompositeConstruct %mat3v3float %152 %154 %156 + %158 = OpMatrixTimesVector %v3float %157 %148 + %159 = OpFAdd %v3float %158 %54 + %160 = OpExtInst %v3float %1 Normalize %159 + %161 = OpExtInst %float %1 Length %158 + %162 = OpAccessChain %_ptr_Uniform_v4float %EmitterUniforms %int_3 + %163 = OpLoad %v4float %162 + %164 = OpVectorShuffle %v2float %163 %163 0 1 + %165 = OpVectorShuffle %v2float %163 %163 2 3 + %166 = OpCompositeConstruct %v2float %146 %146 + %167 = OpFMul %v2float %165 %166 + %168 = OpFAdd %v2float %164 %167 + %169 = OpLoad %type_2d_image %CurveTexture + %170 = OpLoad %type_sampler %CurveTextureSampler + %171 = OpSampledImage %type_sampled_image %169 %170 + %172 = OpImageSampleExplicitLod %v4float %171 %168 Lod %float_0 + %173 = OpAccessChain %_ptr_Uniform_v4float %EmitterUniforms %int_4 + %174 = OpLoad %v4float %173 + %175 = OpFMul %v4float %172 %174 + %176 = OpAccessChain %_ptr_Uniform_v4float %EmitterUniforms %int_5 + %177 = OpLoad %v4float %176 + %178 = OpFAdd %v4float %175 %177 + %179 = OpCompositeExtract %float %145 0 + %180 = OpFOrdLessThan %bool %179 %float_0_5 + %181 = OpSelect %float %180 %float_0 %float_n0_5 + %182 = OpCompositeExtract %float %145 1 + %183 = OpFOrdLessThan %bool %182 %float_0_5 + %184 = OpSelect %float %183 %float_0 %float_n0_5 + %185 = OpCompositeConstruct %v2float %181 %184 + %186 = OpVectorShuffle %v2float %145 %145 0 1 + %187 = OpFAdd %v2float %186 %185 + %188 = OpFMul %v2float %187 %61 + %189 = OpVectorShuffle %v2float %178 %178 0 1 + %190 = OpAccessChain %_ptr_Uniform_v2float %EmitterDynamicUniforms %int_0 + %191 = OpLoad %v2float %190 + %192 = OpFMul %v2float %189 %191 + %193 = OpAccessChain %_ptr_Uniform_v4float %EmitterUniforms %int_6 + %194 = OpLoad %v4float %193 + %195 = OpVectorShuffle %v2float %194 %194 0 1 + %196 = OpCompositeConstruct %v2float %161 %161 + %197 = OpFMul %v2float %195 %196 + %198 = OpExtInst %v2float %1 FMax %197 %63 + %199 = OpVectorShuffle %v2float %194 %194 2 3 + %200 = OpExtInst %v2float %1 FMin %198 %199 + %201 = OpFMul %v2float %188 %192 + %202 = OpFMul %v2float %201 %200 + %203 = OpCompositeConstruct %v2float %147 %147 + %204 = OpFMul %v2float %202 %203 + %205 = OpCompositeExtract %float %145 3 + %206 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_11 + %207 = OpLoad %float %206 + %208 = OpFMul %float %205 %207 + %209 = OpCompositeExtract %float %145 2 + %210 = OpFMul %float %208 %146 + %211 = OpFAdd %float %209 %210 + %212 = OpFMul %float %211 %float_6_28318548 + %213 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_0 + %214 = OpLoad %v4float %213 + %215 = OpVectorShuffle %v3float %214 %214 0 1 2 + %216 = OpVectorShuffle %v3float %137 %108 0 0 0 + %217 = OpFMul %v3float %215 %216 + %218 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_1 + %219 = OpLoad %v4float %218 + %220 = OpVectorShuffle %v3float %219 %219 0 1 2 + %221 = OpVectorShuffle %v3float %137 %108 1 1 1 + %222 = OpFMul %v3float %220 %221 + %223 = OpFAdd %v3float %217 %222 + %224 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_2 + %225 = OpLoad %v4float %224 + %226 = OpVectorShuffle %v3float %225 %225 0 1 2 + %227 = OpVectorShuffle %v3float %137 %108 2 2 2 + %228 = OpFMul %v3float %226 %227 + %229 = OpFAdd %v3float %223 %228 + %230 = OpAccessChain %_ptr_Uniform_v4float %Primitive %int_0 %uint_3 + %231 = OpLoad %v4float %230 + %232 = OpVectorShuffle %v3float %231 %231 0 1 2 + %233 = OpFAdd %v3float %232 %124 + %234 = OpFAdd %v3float %229 %233 + %235 = OpCompositeExtract %float %234 0 + %236 = OpCompositeExtract %float %234 1 + %237 = OpCompositeExtract %float %234 2 + %238 = OpCompositeConstruct %v4float %235 %236 %237 %float_1 + %239 = OpVectorShuffle %v3float %238 %238 0 1 2 + %240 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_10 + %241 = OpLoad %float %240 + %242 = OpCompositeConstruct %v3float %241 %241 %241 + %243 = OpExtInst %v3float %1 FMix %116 %120 %242 + %244 = OpExtInst %v3float %1 FMix %114 %118 %242 + %245 = OpAccessChain %_ptr_Uniform_v4float %EmitterDynamicUniforms %int_3 + %246 = OpLoad %v4float %245 + %247 = OpVectorShuffle %v3float %246 %246 0 1 2 + %248 = OpAccessChain %_ptr_Uniform_float %EmitterDynamicUniforms %int_3 %int_3 + %249 = OpLoad %float %248 + %250 = OpCompositeConstruct %v3float %249 %249 %249 + %251 = OpExtInst %v3float %1 FMix %243 %247 %250 + %252 = OpFNegate %v3float %244 + %253 = OpAccessChain %_ptr_Uniform_v4float %EmitterDynamicUniforms %int_4 + %254 = OpLoad %v4float %253 + %255 = OpVectorShuffle %v3float %254 %254 0 1 2 + %256 = OpAccessChain %_ptr_Uniform_float %EmitterDynamicUniforms %int_4 %int_3 + %257 = OpLoad %float %256 + %258 = OpCompositeConstruct %v3float %257 %257 %257 + %259 = OpExtInst %v3float %1 FMix %252 %255 %258 + %260 = OpFSub %v3float %122 %239 + %261 = OpDot %float %260 %260 + %262 = OpExtInst %float %1 FMax %261 %float_0_00999999978 + %263 = OpExtInst %float %1 Sqrt %262 + %264 = OpCompositeConstruct %v3float %263 %263 %263 + %265 = OpFDiv %v3float %260 %264 + %266 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_9 %int_0 + %267 = OpLoad %float %266 + %268 = OpFOrdGreaterThan %bool %267 %float_0 + OpSelectionMerge %269 DontFlatten + OpBranchConditional %268 %270 %271 + %270 = OpLabel + %272 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_9 %int_1 + %273 = OpLoad %float %272 + %274 = OpFMul %float %261 %273 + %275 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_9 %int_2 + %276 = OpLoad %float %275 + %277 = OpFSub %float %274 %276 + %278 = OpExtInst %float %1 FClamp %277 %float_0 %float_1 + %279 = OpExtInst %v3float %1 Cross %265 %82 + %280 = OpDot %float %279 %279 + %281 = OpExtInst %float %1 FMax %280 %float_0_00999999978 + %282 = OpExtInst %float %1 Sqrt %281 + %283 = OpCompositeConstruct %v3float %282 %282 %282 + %284 = OpFDiv %v3float %279 %283 + %285 = OpExtInst %v3float %1 Cross %265 %284 + %286 = OpCompositeConstruct %v3float %278 %278 %278 + %287 = OpExtInst %v3float %1 FMix %251 %284 %286 + %288 = OpExtInst %v3float %1 Normalize %287 + %289 = OpExtInst %v3float %1 FMix %259 %285 %286 + %290 = OpExtInst %v3float %1 Normalize %289 + OpBranch %269 + %271 = OpLabel + %291 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_8 %int_1 + %292 = OpLoad %float %291 + %293 = OpFOrdGreaterThan %bool %292 %float_0 + OpSelectionMerge %294 Flatten + OpBranchConditional %293 %295 %296 + %295 = OpLabel + %297 = OpExtInst %v3float %1 Cross %265 %160 + %298 = OpDot %float %297 %297 + %299 = OpExtInst %float %1 FMax %298 %float_0_00999999978 + %300 = OpExtInst %float %1 Sqrt %299 + %301 = OpCompositeConstruct %v3float %300 %300 %300 + %302 = OpFDiv %v3float %297 %301 + %303 = OpFNegate %v3float %160 + OpBranch %294 + %296 = OpLabel + %304 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_8 %int_2 + %305 = OpLoad %float %304 + %306 = OpFOrdGreaterThan %bool %305 %float_0 + OpSelectionMerge %307 None + OpBranchConditional %306 %308 %309 + %308 = OpLabel + %310 = OpExtInst %v3float %1 Cross %247 %265 + %311 = OpDot %float %310 %310 + %312 = OpExtInst %float %1 FMax %311 %float_0_00999999978 + %313 = OpExtInst %float %1 Sqrt %312 + %314 = OpCompositeConstruct %v3float %313 %313 %313 + %315 = OpFDiv %v3float %310 %314 + %316 = OpFNegate %v3float %315 + OpBranch %307 + %309 = OpLabel + %317 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_8 %int_3 + %318 = OpLoad %float %317 + %319 = OpFOrdGreaterThan %bool %318 %float_0 + OpSelectionMerge %320 None + OpBranchConditional %319 %321 %320 + %321 = OpLabel + %322 = OpExtInst %v3float %1 Cross %265 %82 + %323 = OpDot %float %322 %322 + %324 = OpExtInst %float %1 FMax %323 %float_0_00999999978 + %325 = OpExtInst %float %1 Sqrt %324 + %326 = OpCompositeConstruct %v3float %325 %325 %325 + %327 = OpFDiv %v3float %322 %326 + %328 = OpExtInst %v3float %1 Cross %265 %327 + OpBranch %320 + %320 = OpLabel + %329 = OpPhi %v3float %251 %309 %327 %321 + %330 = OpPhi %v3float %259 %309 %328 %321 + OpBranch %307 + %307 = OpLabel + %331 = OpPhi %v3float %247 %308 %329 %320 + %332 = OpPhi %v3float %316 %308 %330 %320 + OpBranch %294 + %294 = OpLabel + %333 = OpPhi %v3float %302 %295 %331 %307 + %334 = OpPhi %v3float %303 %295 %332 %307 + OpBranch %269 + %269 = OpLabel + %335 = OpPhi %v3float %288 %270 %333 %294 + %336 = OpPhi %v3float %290 %270 %334 %294 + %337 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_12 + %338 = OpLoad %float %337 + %339 = OpFAdd %float %212 %338 + %340 = OpExtInst %float %1 Sin %339 + %341 = OpExtInst %float %1 Cos %339 + %342 = OpCompositeConstruct %v3float %340 %340 %340 + %343 = OpFMul %v3float %342 %336 + %344 = OpCompositeConstruct %v3float %341 %341 %341 + %345 = OpFMul %v3float %344 %335 + %346 = OpFAdd %v3float %343 %345 + %347 = OpFMul %v3float %344 %336 + %348 = OpFMul %v3float %342 %335 + %349 = OpFSub %v3float %347 %348 + %350 = OpCompositeExtract %float %204 0 + %351 = OpCompositeExtract %float %112 0 + %352 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_15 %int_0 + %353 = OpLoad %float %352 + %354 = OpFAdd %float %351 %353 + %355 = OpFMul %float %350 %354 + %356 = OpCompositeConstruct %v3float %355 %355 %355 + %357 = OpFMul %v3float %356 %346 + %358 = OpCompositeExtract %float %204 1 + %359 = OpCompositeExtract %float %112 1 + %360 = OpAccessChain %_ptr_Uniform_float %EmitterUniforms %int_15 %int_1 + %361 = OpLoad %float %360 + %362 = OpFAdd %float %359 %361 + %363 = OpFMul %float %358 %362 + %364 = OpCompositeConstruct %v3float %363 %363 %363 + %365 = OpFMul %v3float %364 %349 + %366 = OpFAdd %v3float %357 %365 + %367 = OpFAdd %v3float %239 %366 + %368 = OpCompositeExtract %float %367 0 + %369 = OpCompositeExtract %float %367 1 + %370 = OpCompositeExtract %float %367 2 + %371 = OpCompositeConstruct %v4float %368 %369 %370 %float_1 + %372 = OpVectorShuffle %v4float %371 %371 4 5 6 3 + %373 = OpAccessChain %_ptr_Uniform_mat4v4float %MobileShadowDepthPass %int_20 + %374 = OpLoad %mat4v4float %373 + %375 = OpMatrixTimesVector %v4float %374 %372 + %376 = OpAccessChain %_ptr_Uniform_float %MobileShadowDepthPass %int_22 + %377 = OpLoad %float %376 + %378 = OpFOrdGreaterThan %bool %377 %float_0 + %379 = OpCompositeExtract %float %375 2 + %380 = OpFOrdLessThan %bool %379 %float_0 + %381 = OpLogicalAnd %bool %378 %380 + OpSelectionMerge %382 None + OpBranchConditional %381 %383 %382 + %383 = OpLabel + %384 = OpCompositeInsert %v4float %float_9_99999997en07 %375 2 + %385 = OpCompositeInsert %v4float %float_1 %384 3 + OpBranch %382 + %382 = OpLabel + %386 = OpPhi %v4float %375 %269 %385 %383 + %387 = OpAccessChain %_ptr_Uniform_float %MobileShadowDepthPass %int_21 %int_0 + %388 = OpLoad %float %387 + %389 = OpAccessChain %_ptr_Uniform_float %MobileShadowDepthPass %int_21 %int_1 + %390 = OpLoad %float %389 + %391 = OpCompositeExtract %float %386 2 + %392 = OpFMul %float %391 %390 + %393 = OpFAdd %float %392 %388 + %394 = OpCompositeExtract %float %386 3 + %395 = OpFMul %float %393 %394 + %396 = OpCompositeInsert %v4float %395 %386 2 + OpStore %out_var_TEXCOORD6 %float_0 + OpStore %gl_Position %396 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/amd/gcn_shader.comp b/third_party/spirv-cross/shaders/amd/gcn_shader.comp new file mode 100644 index 0000000000..037cdde6b6 --- /dev/null +++ b/third_party/spirv-cross/shaders/amd/gcn_shader.comp @@ -0,0 +1,13 @@ +#version 450 +#extension GL_AMD_gcn_shader : require +#extension GL_ARB_gpu_shader_int64 : require + +layout (local_size_x = 64) in; + +void main () +{ + float cubeFace = cubeFaceIndexAMD(vec3(0.0)); + vec2 cubeFaceCoord = cubeFaceCoordAMD(vec3(1.0)); + + uint64_t time = timeAMD(); +} diff --git a/third_party/spirv-cross/shaders/amd/shader_ballot.comp b/third_party/spirv-cross/shaders/amd/shader_ballot.comp new file mode 100644 index 0000000000..d2a7271128 --- /dev/null +++ b/third_party/spirv-cross/shaders/amd/shader_ballot.comp @@ -0,0 +1,33 @@ +#version 450 +#extension GL_AMD_shader_ballot : require +#extension GL_ARB_shader_ballot : require + +layout (local_size_x = 64) in; +layout (std430, binding = 0) buffer inputData +{ + float inputDataArray[]; +}; + +layout (std430, binding = 1) buffer outputData +{ + float outputDataArray[]; +}; + +void main () +{ + float thisLaneData = inputDataArray [gl_LocalInvocationID.x]; + bool laneActive = (thisLaneData > 0); + + uint thisLaneOutputSlot = mbcntAMD (ballotARB (laneActive)); + + int firstInvocation = readFirstInvocationARB(1); + int invocation = readInvocationARB(1, 0); + + vec3 swizzleInvocations = swizzleInvocationsAMD(vec3(0.0, 2.0, 1.0), uvec4(3)); + vec3 swizzelInvocationsMasked = swizzleInvocationsMaskedAMD(vec3(0.0, 2.0, 1.0), uvec3(2)); + vec3 writeInvocation = writeInvocationAMD(swizzleInvocations, swizzelInvocationsMasked, 0); + + if (laneActive) { + outputDataArray[thisLaneOutputSlot] = thisLaneData; + } +} diff --git a/third_party/spirv-cross/shaders/amd/shader_group_vote.comp b/third_party/spirv-cross/shaders/amd/shader_group_vote.comp new file mode 100644 index 0000000000..d24aa92f84 --- /dev/null +++ b/third_party/spirv-cross/shaders/amd/shader_group_vote.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_ARB_shader_group_vote : require + +layout (local_size_x = 64) in; +layout (std430, binding = 0) buffer inputData +{ + float inputDataArray[]; +}; + +void main () +{ + float thisLaneData = inputDataArray [gl_LocalInvocationID.x]; + bool laneActive = (thisLaneData > 0); + + bool allInvocations = allInvocationsARB(laneActive); + bool anyInvocations = anyInvocationARB(laneActive); + bool allInvocationsEqual = allInvocationsEqualARB(laneActive); +} diff --git a/third_party/spirv-cross/shaders/amd/shader_trinary_minmax.comp b/third_party/spirv-cross/shaders/amd/shader_trinary_minmax.comp new file mode 100644 index 0000000000..f836146a17 --- /dev/null +++ b/third_party/spirv-cross/shaders/amd/shader_trinary_minmax.comp @@ -0,0 +1,11 @@ +#version 450 +#extension GL_AMD_shader_trinary_minmax : require + +layout (local_size_x = 64) in; + +void main () +{ + int t11 = min3(0, 3, 2); + int t12 = max3(0, 3, 2); + int t13 = mid3(0, 3, 2); +} diff --git a/third_party/spirv-cross/shaders/asm/comp/atomic-decrement.asm.comp b/third_party/spirv-cross/shaders/asm/comp/atomic-decrement.asm.comp new file mode 100644 index 0000000000..a87b931880 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/atomic-decrement.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 0 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIDecrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/atomic-increment.asm.comp b/third_party/spirv-cross/shaders/asm/comp/atomic-increment.asm.comp new file mode 100644 index 0000000000..3acb7115f5 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/atomic-increment.asm.comp @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "main" %15 + OpExecutionMode %3 LocalSize 4 1 1 + OpName %3 "main" + OpName %8 "u0" + OpName %9 "u0_counters" + OpMemberName %9 0 "c" + OpName %11 "u0_counter" + OpName %15 "vThreadID" + OpName %19 "r0" + OpDecorate %8 DescriptorSet 0 + OpDecorate %8 Binding 0 + OpMemberDecorate %9 0 Offset 0 + OpDecorate %9 BufferBlock + OpDecorate %11 DescriptorSet 1 + OpDecorate %11 Binding 0 + OpDecorate %15 BuiltIn GlobalInvocationId + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %5 = OpTypeInt 32 0 + %6 = OpTypeImage %5 Buffer 0 0 0 2 R32ui + %7 = OpTypePointer UniformConstant %6 + %8 = OpVariable %7 UniformConstant + %9 = OpTypeStruct %5 + %10 = OpTypePointer Uniform %9 + %11 = OpVariable %10 Uniform + %12 = OpTypeInt 32 1 + %13 = OpTypeVector %12 3 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %16 = OpTypeFloat 32 + %17 = OpTypeVector %16 4 + %18 = OpTypePointer Function %17 + %20 = OpTypePointer Uniform %5 + %21 = OpConstant %5 0 + %23 = OpConstant %5 1 + %26 = OpTypePointer Function %16 + %33 = OpConstant %12 0 + %34 = OpConstant %5 2 + %37 = OpTypePointer Input %12 + %41 = OpTypeVector %5 4 + %3 = OpFunction %1 None %2 + %4 = OpLabel + %19 = OpVariable %18 Function + %22 = OpAccessChain %20 %11 %21 + %24 = OpAtomicIIncrement %5 %22 %23 %21 + %25 = OpBitcast %16 %24 + %27 = OpInBoundsAccessChain %26 %19 %21 + OpStore %27 %25 + %28 = OpLoad %6 %8 + %29 = OpInBoundsAccessChain %26 %19 %21 + %30 = OpLoad %16 %29 + %31 = OpBitcast %12 %30 + %32 = OpIMul %5 %31 %23 + %35 = OpShiftRightLogical %5 %33 %34 + %36 = OpIAdd %5 %32 %35 + %38 = OpInBoundsAccessChain %37 %15 %21 + %39 = OpLoad %12 %38 + %40 = OpBitcast %5 %39 + %42 = OpCompositeConstruct %41 %40 %40 %40 %40 + OpImageWrite %28 %36 %42 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_iadd.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_iadd.asm.comp new file mode 100644 index 0000000000..3b31ab2851 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_iadd.asm.comp @@ -0,0 +1,79 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of IAdd + %result_iadd_0 = OpIAdd %uvec4 %input0 %input1 + %result_iadd_1 = OpIAdd %uvec4 %input1 %input0 + %result_iadd_2 = OpIAdd %uvec4 %input0 %input0 + %result_iadd_3 = OpIAdd %uvec4 %input1 %input1 + %result_iadd_4 = OpIAdd %ivec4 %input0 %input0 + %result_iadd_5 = OpIAdd %ivec4 %input1 %input1 + %result_iadd_6 = OpIAdd %ivec4 %input0 %input1 + %result_iadd_7 = OpIAdd %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_icmp.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_icmp.asm.comp new file mode 100644 index 0000000000..b7b4e0b2e1 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_icmp.asm.comp @@ -0,0 +1,101 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %bool = OpTypeBool + %bvec4 = OpTypeVector %bool 4 + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + %uzero = OpConstant %uint 0 + %uone = OpConstant %uint 1 + %utrue = OpConstantComposite %uvec4 %uone %uone %uone %uone + %ufalse = OpConstantComposite %uvec4 %uzero %uzero %uzero %uzero + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + + %result_slt = OpSLessThan %bvec4 %input0 %input1 + %result_sle = OpSLessThanEqual %bvec4 %input0 %input1 + %result_ult = OpULessThan %bvec4 %input0 %input1 + %result_ule = OpULessThanEqual %bvec4 %input0 %input1 + %result_sgt = OpSGreaterThan %bvec4 %input0 %input1 + %result_sge = OpSGreaterThanEqual %bvec4 %input0 %input1 + %result_ugt = OpUGreaterThan %bvec4 %input0 %input1 + %result_uge = OpUGreaterThanEqual %bvec4 %input0 %input1 + + %int_slt = OpSelect %uvec4 %result_slt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_slt + + %int_sle = OpSelect %uvec4 %result_sle %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sle + + %int_ult = OpSelect %uvec4 %result_ult %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ult + + %int_ule = OpSelect %uvec4 %result_ule %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ule + + %int_sgt = OpSelect %uvec4 %result_sgt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sgt + + %int_sge = OpSelect %uvec4 %result_sge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_sge + + %int_ugt = OpSelect %uvec4 %result_ugt %utrue %ufalse + OpStore %output_ptr_uvec4 %int_ugt + + %int_uge = OpSelect %uvec4 %result_uge %utrue %ufalse + OpStore %output_ptr_uvec4 %int_uge + + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_iequal.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_iequal.asm.comp new file mode 100644 index 0000000000..c98f52c5ad --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_iequal.asm.comp @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + %bool = OpTypeBool + %bvec4 = OpTypeVector %bool 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + %uone = OpConstant %uint 1 + %uzero = OpConstant %uint 0 + %uvec41 = OpConstantComposite %uvec4 %uone %uone %uone %uone + %ivec41 = OpConstantComposite %ivec4 %one %one %one %one + %uvec40 = OpConstantComposite %uvec4 %uzero %uzero %uzero %uzero + %ivec40 = OpConstantComposite %ivec4 %zero %zero %zero %zero + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of IEqual + %result_iequal0 = OpIEqual %bvec4 %input0 %input1 + %result_iequal1 = OpIEqual %bvec4 %input1 %input0 + %result_iequal2 = OpIEqual %bvec4 %input0 %input0 + %result_iequal3 = OpIEqual %bvec4 %input1 %input1 + %result_0 = OpSelect %uvec4 %result_iequal0 %uvec41 %uvec40 + %result_1 = OpSelect %uvec4 %result_iequal1 %uvec41 %uvec40 + %result_2 = OpSelect %uvec4 %result_iequal2 %uvec41 %uvec40 + %result_3 = OpSelect %uvec4 %result_iequal3 %uvec41 %uvec40 + %result_4 = OpSelect %ivec4 %result_iequal0 %ivec41 %ivec40 + %result_5 = OpSelect %ivec4 %result_iequal1 %ivec41 %ivec40 + %result_6 = OpSelect %ivec4 %result_iequal2 %ivec41 %ivec40 + %result_7 = OpSelect %ivec4 %result_iequal3 %ivec41 %ivec40 + + OpStore %output_ptr_uvec4 %result_0 + OpStore %output_ptr_uvec4 %result_1 + OpStore %output_ptr_uvec4 %result_2 + OpStore %output_ptr_uvec4 %result_3 + OpStore %output_ptr_ivec4 %result_4 + OpStore %output_ptr_ivec4 %result_5 + OpStore %output_ptr_ivec4 %result_6 + OpStore %output_ptr_ivec4 %result_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_sar.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_sar.asm.comp new file mode 100644 index 0000000000..64f19fc349 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_sar.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of ShiftRightArithmetic + %result_iadd_0 = OpShiftRightArithmetic %uvec4 %input0 %input1 + %result_iadd_1 = OpShiftRightArithmetic %uvec4 %input1 %input0 + %result_iadd_2 = OpShiftRightArithmetic %uvec4 %input0 %input0 + %result_iadd_3 = OpShiftRightArithmetic %uvec4 %input1 %input1 + %result_iadd_4 = OpShiftRightArithmetic %ivec4 %input0 %input0 + %result_iadd_5 = OpShiftRightArithmetic %ivec4 %input1 %input1 + %result_iadd_6 = OpShiftRightArithmetic %ivec4 %input0 %input1 + %result_iadd_7 = OpShiftRightArithmetic %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_sdiv.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_sdiv.asm.comp new file mode 100644 index 0000000000..ab73ec83df --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_sdiv.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of SDiv + %result_iadd_0 = OpSDiv %uvec4 %input0 %input1 + %result_iadd_1 = OpSDiv %uvec4 %input1 %input0 + %result_iadd_2 = OpSDiv %uvec4 %input0 %input0 + %result_iadd_3 = OpSDiv %uvec4 %input1 %input1 + %result_iadd_4 = OpSDiv %ivec4 %input0 %input0 + %result_iadd_5 = OpSDiv %ivec4 %input1 %input1 + %result_iadd_6 = OpSDiv %ivec4 %input0 %input1 + %result_iadd_7 = OpSDiv %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/bitcast_slr.asm.comp b/third_party/spirv-cross/shaders/asm/comp/bitcast_slr.asm.comp new file mode 100644 index 0000000000..6741f5cb58 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/bitcast_slr.asm.comp @@ -0,0 +1,77 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of ShiftRightLogical + %result_iadd_0 = OpShiftRightLogical %uvec4 %input0 %input1 + %result_iadd_1 = OpShiftRightLogical %uvec4 %input1 %input0 + %result_iadd_2 = OpShiftRightLogical %uvec4 %input0 %input0 + %result_iadd_3 = OpShiftRightLogical %uvec4 %input1 %input1 + %result_iadd_4 = OpShiftRightLogical %ivec4 %input0 %input0 + %result_iadd_5 = OpShiftRightLogical %ivec4 %input1 %input1 + %result_iadd_6 = OpShiftRightLogical %ivec4 %input0 %input1 + %result_iadd_7 = OpShiftRightLogical %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/block-name-alias-global.asm.comp b/third_party/spirv-cross/shaders/asm/comp/block-name-alias-global.asm.comp new file mode 100644 index 0000000000..85f6cc0414 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/block-name-alias-global.asm.comp @@ -0,0 +1,119 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 59 +; Schema: 0 + 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 %Foo "A" + OpMemberName %Foo 0 "a" + OpMemberName %Foo 1 "b" + OpName %A "A" + OpMemberName %A 0 "Data" + OpName %C1 "C1" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpName %Foo_0 "A" + OpMemberName %Foo_0 0 "a" + OpMemberName %Foo_0 1 "b" + OpName %A_0 "A" + OpMemberName %A_0 0 "Data" + OpName %C2 "C2" + OpName %B "B" + OpMemberName %B 0 "Data" + OpName %C3 "C3" + OpName %B_0 "B" + OpMemberName %B_0 0 "Data" + OpName %C4 "C4" + OpMemberDecorate %Foo 0 Offset 0 + OpMemberDecorate %Foo 1 Offset 4 + OpDecorate %_runtimearr_Foo ArrayStride 8 + OpMemberDecorate %A 0 Offset 0 + OpDecorate %A BufferBlock + OpDecorate %C1 DescriptorSet 0 + OpDecorate %C1 Binding 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpMemberDecorate %Foo_0 0 Offset 0 + OpMemberDecorate %Foo_0 1 Offset 4 + OpDecorate %_arr_Foo_0_uint_1024 ArrayStride 16 + OpMemberDecorate %A_0 0 Offset 0 + OpDecorate %A_0 Block + OpDecorate %C2 DescriptorSet 0 + OpDecorate %C2 Binding 2 + OpDecorate %_runtimearr_Foo_0 ArrayStride 8 + OpMemberDecorate %B 0 Offset 0 + OpDecorate %B BufferBlock + OpDecorate %C3 DescriptorSet 0 + OpDecorate %C3 Binding 0 + OpDecorate %_arr_Foo_0_uint_1024_0 ArrayStride 16 + OpMemberDecorate %B_0 0 Offset 0 + OpDecorate %B_0 Block + OpDecorate %C4 DescriptorSet 0 + OpDecorate %C4 Binding 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %Foo = OpTypeStruct %int %int +%_runtimearr_Foo = OpTypeRuntimeArray %Foo + %A = OpTypeStruct %_runtimearr_Foo +%_ptr_Uniform_A = OpTypePointer Uniform %A + %C1 = OpVariable %_ptr_Uniform_A Uniform + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %Foo_0 = OpTypeStruct %int %int + %uint_1024 = OpConstant %uint 1024 +%_arr_Foo_0_uint_1024 = OpTypeArray %Foo_0 %uint_1024 + %A_0 = OpTypeStruct %_arr_Foo_0_uint_1024 +%_ptr_Uniform_A_0 = OpTypePointer Uniform %A_0 + %C2 = OpVariable %_ptr_Uniform_A_0 Uniform +%_ptr_Uniform_Foo_0 = OpTypePointer Uniform %Foo_0 +%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 +%_runtimearr_Foo_0 = OpTypeRuntimeArray %Foo + %B = OpTypeStruct %_runtimearr_Foo_0 +%_ptr_Uniform_B = OpTypePointer Uniform %B + %C3 = OpVariable %_ptr_Uniform_B Uniform +%_arr_Foo_0_uint_1024_0 = OpTypeArray %Foo_0 %uint_1024 + %B_0 = OpTypeStruct %_arr_Foo_0_uint_1024_0 +%_ptr_Uniform_B_0 = OpTypePointer Uniform %B_0 + %C4 = OpVariable %_ptr_Uniform_B_0 Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %20 = OpLoad %uint %19 + %27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %28 = OpLoad %uint %27 + %30 = OpAccessChain %_ptr_Uniform_Foo_0 %C2 %int_0 %28 + %31 = OpLoad %Foo_0 %30 + %33 = OpAccessChain %_ptr_Uniform_Foo %C1 %int_0 %20 + %34 = OpCompositeExtract %int %31 0 + %36 = OpAccessChain %_ptr_Uniform_int %33 %int_0 + OpStore %36 %34 + %37 = OpCompositeExtract %int %31 1 + %39 = OpAccessChain %_ptr_Uniform_int %33 %int_1 + OpStore %39 %37 + %44 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %45 = OpLoad %uint %44 + %50 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %51 = OpLoad %uint %50 + %52 = OpAccessChain %_ptr_Uniform_Foo_0 %C4 %int_0 %51 + %53 = OpLoad %Foo_0 %52 + %54 = OpAccessChain %_ptr_Uniform_Foo %C3 %int_0 %45 + %55 = OpCompositeExtract %int %53 0 + %56 = OpAccessChain %_ptr_Uniform_int %54 %int_0 + OpStore %56 %55 + %57 = OpCompositeExtract %int %53 1 + %58 = OpAccessChain %_ptr_Uniform_int %54 %int_1 + OpStore %58 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/builtin-compute-bitcast.asm.comp b/third_party/spirv-cross/shaders/asm/comp/builtin-compute-bitcast.asm.comp new file mode 100644 index 0000000000..4bc9202fc7 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/builtin-compute-bitcast.asm.comp @@ -0,0 +1,50 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_WorkGroupID %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %BUF "BUF" + OpMemberName %BUF 0 "values" + OpName %_ "" + OpName %gl_WorkGroupID "gl_WorkGroupID" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %_runtimearr_int ArrayStride 4 + OpMemberDecorate %BUF 0 Offset 0 + OpDecorate %BUF BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + %void = OpTypeVoid + %int = OpTypeInt 32 1 +%_runtimearr_int = OpTypeRuntimeArray %int + %3 = OpTypeFunction %void + %BUF = OpTypeStruct %_runtimearr_int +%_ptr_Uniform_BUF = OpTypePointer Uniform %BUF + %_ = OpVariable %_ptr_Uniform_BUF Uniform + %int_0 = OpConstant %int 0 + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int +%gl_WorkGroupID = OpVariable %_ptr_Input_v3int Input + %int_1 = OpConstant %int 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3int Input + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_int %gl_WorkGroupID %int_1 + %19 = OpLoad %int %18 + %22 = OpAccessChain %_ptr_Input_int %gl_GlobalInvocationID %int_2 + %23 = OpLoad %int %22 + %25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %19 + OpStore %25 %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/control-flow-hints.asm.comp b/third_party/spirv-cross/shaders/asm/comp/control-flow-hints.asm.comp new file mode 100644 index 0000000000..74a15955c2 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/control-flow-hints.asm.comp @@ -0,0 +1,146 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 85 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %i "i" + OpName %bar "bar" + OpMemberName %bar 0 "@data" + OpName %bar_0 "bar" + OpName %foo "foo" + OpName %i_0 "i" + OpName %v "v" + OpName %w "w" + OpName %value "value" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %bar 0 Offset 0 + OpDecorate %bar BufferBlock + OpDecorate %bar_0 DescriptorSet 0 + OpDecorate %bar_0 Binding 0 + OpDecorate %foo DescriptorSet 0 + OpDecorate %foo Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %bar = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_bar = OpTypePointer Uniform %bar + %bar_0 = OpVariable %_ptr_Uniform_bar Uniform + %foo = OpVariable %_ptr_Uniform_bar Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %int_15 = OpConstant %int 15 +%_ptr_Function_float = OpTypePointer Function %float + %int_10 = OpConstant %int 10 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_10 = OpConstant %float 10 + %int_20 = OpConstant %int 20 + %float_5 = OpConstant %float 5 + %72 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %float_20 = OpConstant %float 20 + %float_40 = OpConstant %float 40 + %main = OpFunction %void None %3 + %5 = OpLabel + %84 = OpFunctionCall %void %_main_ + OpReturn + OpFunctionEnd + %_main_ = OpFunction %void None %3 + %7 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %i_0 = OpVariable %_ptr_Function_int Function + %v = OpVariable %_ptr_Function_float Function + %w = OpVariable %_ptr_Function_float Function + %value = OpVariable %_ptr_Function_float Function + OpStore %i %int_0 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 Unroll + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %int %i + %20 = OpSLessThan %bool %17 %int_16 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %27 = OpLoad %int %i + %29 = OpLoad %int %i + %31 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %29 + %32 = OpLoad %v4float %31 + %33 = OpAccessChain %_ptr_Uniform_v4float %bar_0 %int_0 %27 + OpStore %33 %32 + OpBranch %15 + %15 = OpLabel + %34 = OpLoad %int %i + %36 = OpIAdd %int %34 %int_1 + OpStore %i %36 + OpBranch %12 + %14 = OpLabel + OpStore %i_0 %int_0 + OpBranch %38 + %38 = OpLabel + OpLoopMerge %40 %41 DontUnroll + OpBranch %42 + %42 = OpLabel + %43 = OpLoad %int %i_0 + %44 = OpSLessThan %bool %43 %int_16 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + %46 = OpLoad %int %i_0 + %47 = OpISub %int %int_15 %46 + %48 = OpLoad %int %i_0 + %49 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %48 + %50 = OpLoad %v4float %49 + %51 = OpAccessChain %_ptr_Uniform_v4float %bar_0 %int_0 %47 + OpStore %51 %50 + OpBranch %41 + %41 = OpLabel + %52 = OpLoad %int %i_0 + %53 = OpIAdd %int %52 %int_1 + OpStore %i_0 %53 + OpBranch %38 + %40 = OpLabel + %60 = OpAccessChain %_ptr_Uniform_float %bar_0 %int_0 %int_10 %uint_0 + %61 = OpLoad %float %60 + OpStore %v %61 + %63 = OpAccessChain %_ptr_Uniform_float %foo %int_0 %int_10 %uint_0 + %64 = OpLoad %float %63 + OpStore %w %64 + %65 = OpLoad %float %v + %67 = OpFOrdGreaterThan %bool %65 %float_10 + OpSelectionMerge %69 DontFlatten + OpBranchConditional %67 %68 %69 + %68 = OpLabel + %73 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %int_20 + OpStore %73 %72 + OpBranch %69 + %69 = OpLabel + OpStore %value %float_20 + %76 = OpLoad %float %w + %78 = OpFOrdGreaterThan %bool %76 %float_40 + OpSelectionMerge %80 Flatten + OpBranchConditional %78 %79 %80 + %79 = OpLabel + OpStore %value %float_20 + OpBranch %80 + %80 = OpLabel + %81 = OpLoad %float %value + %82 = OpCompositeConstruct %v4float %81 %81 %81 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %foo %int_0 %int_20 + OpStore %83 %82 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/decoration-group.asm.comp b/third_party/spirv-cross/shaders/asm/comp/decoration-group.asm.comp new file mode 100644 index 0000000000..b597b4bd83 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/decoration-group.asm.comp @@ -0,0 +1,99 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" %2 + OpExecutionMode %1 LocalSize 1 1 1 + OpSource GLSL 430 + OpName %1 "main" + OpName %2 "gl_GlobalInvocationID" + OpDecorate %2 BuiltIn GlobalInvocationId + OpDecorate %3 ArrayStride 4 + OpDecorate %4 BufferBlock + OpDecorate %5 Offset 0 + %4 = OpDecorationGroup + %5 = OpDecorationGroup + OpGroupDecorate %4 %6 %7 %8 %9 %10 %11 + OpGroupMemberDecorate %5 %6 0 %7 0 %8 0 %9 0 %10 0 %11 0 + OpDecorate %12 DescriptorSet 0 + OpDecorate %13 DescriptorSet 0 + OpDecorate %13 NonWritable + OpDecorate %13 Restrict + %14 = OpDecorationGroup + %12 = OpDecorationGroup + %13 = OpDecorationGroup + OpGroupDecorate %12 %15 + OpGroupDecorate %12 %15 + OpGroupDecorate %12 %15 + OpDecorate %15 DescriptorSet 0 + OpDecorate %15 Binding 5 + OpGroupDecorate %14 %16 + OpDecorate %16 DescriptorSet 0 + OpDecorate %16 Binding 0 + OpGroupDecorate %12 %17 + OpDecorate %17 Binding 1 + OpGroupDecorate %13 %18 %19 + OpDecorate %18 Binding 2 + OpDecorate %19 Binding 3 + OpGroupDecorate %14 %20 + OpGroupDecorate %12 %20 + OpGroupDecorate %13 %20 + OpDecorate %20 Binding 4 + %21 = OpTypeBool + %22 = OpTypeVoid + %23 = OpTypeFunction %22 + %24 = OpTypeInt 32 0 + %25 = OpTypeInt 32 1 + %26 = OpTypeFloat 32 + %27 = OpTypeVector %24 3 + %28 = OpTypeVector %26 3 + %29 = OpTypePointer Input %27 + %30 = OpTypePointer Uniform %25 + %31 = OpTypePointer Uniform %26 + %32 = OpTypeRuntimeArray %25 + %3 = OpTypeRuntimeArray %26 + %2 = OpVariable %29 Input + %33 = OpConstant %25 0 + %6 = OpTypeStruct %3 + %34 = OpTypePointer Uniform %6 + %15 = OpVariable %34 Uniform + %7 = OpTypeStruct %3 + %35 = OpTypePointer Uniform %7 + %16 = OpVariable %35 Uniform + %8 = OpTypeStruct %3 + %36 = OpTypePointer Uniform %8 + %17 = OpVariable %36 Uniform + %9 = OpTypeStruct %3 + %37 = OpTypePointer Uniform %9 + %18 = OpVariable %37 Uniform + %10 = OpTypeStruct %3 + %38 = OpTypePointer Uniform %10 + %19 = OpVariable %38 Uniform + %11 = OpTypeStruct %3 + %39 = OpTypePointer Uniform %11 + %20 = OpVariable %39 Uniform + %1 = OpFunction %22 None %23 + %40 = OpLabel + %41 = OpLoad %27 %2 + %42 = OpCompositeExtract %24 %41 0 + %43 = OpAccessChain %31 %16 %33 %42 + %44 = OpAccessChain %31 %17 %33 %42 + %45 = OpAccessChain %31 %18 %33 %42 + %46 = OpAccessChain %31 %19 %33 %42 + %47 = OpAccessChain %31 %20 %33 %42 + %48 = OpAccessChain %31 %15 %33 %42 + %49 = OpLoad %26 %43 + %50 = OpLoad %26 %44 + %51 = OpLoad %26 %45 + %52 = OpLoad %26 %46 + %53 = OpLoad %26 %47 + %54 = OpFAdd %26 %49 %50 + %55 = OpFAdd %26 %54 %51 + %56 = OpFAdd %26 %55 %52 + %57 = OpFAdd %26 %56 %53 + OpStore %48 %57 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/global-parameter-name-alias.asm.comp b/third_party/spirv-cross/shaders/asm/comp/global-parameter-name-alias.asm.comp new file mode 100644 index 0000000000..78b1dc74e8 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/global-parameter-name-alias.asm.comp @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 61 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %id_1 + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %Load_u1_ "Load(u1;" + OpName %size "size" + OpName %_main_vu3_ "@main(vu3;" + OpName %id "id" + OpName %data "data" + OpName %byteAddrTemp "byteAddrTemp" + OpName %ssbo "ssbo" + OpMemberName %ssbo 0 "@data" + OpName %ssbo_0 "ssbo" + OpName %param "param" + OpName %id_0 "id" + OpName %id_1 "id" + OpName %param_0 "param" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %ssbo 0 NonWritable + OpMemberDecorate %ssbo 0 Offset 0 + OpDecorate %ssbo BufferBlock + OpDecorate %ssbo_0 DescriptorSet 0 + OpDecorate %ssbo_0 Binding 1 + OpDecorate %id_1 BuiltIn GlobalInvocationId + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %8 = OpTypeFunction %void %_ptr_Function_uint + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %14 = OpTypeFunction %void %_ptr_Function_v3uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_2 = OpConstant %int 2 +%_runtimearr_uint = OpTypeRuntimeArray %uint + %ssbo = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo + %ssbo_0 = OpVariable %_ptr_Uniform_ssbo Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %uint_4 = OpConstant %uint 4 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint + %id_1 = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %id_0 = OpVariable %_ptr_Function_v3uint Function + %param_0 = OpVariable %_ptr_Function_v3uint Function + %57 = OpLoad %v3uint %id_1 + OpStore %id_0 %57 + %59 = OpLoad %v3uint %id_0 + OpStore %param_0 %59 + %60 = OpFunctionCall %void %_main_vu3_ %param_0 + OpReturn + OpFunctionEnd + %Load_u1_ = OpFunction %void None %8 + %size = OpFunctionParameter %_ptr_Function_uint + %11 = OpLabel + %data = OpVariable %_ptr_Function_v4uint Function +%byteAddrTemp = OpVariable %_ptr_Function_int Function + %24 = OpLoad %uint %size + %26 = OpShiftRightLogical %int %24 %int_2 + OpStore %byteAddrTemp %26 + %32 = OpLoad %int %byteAddrTemp + %34 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %32 + %35 = OpLoad %uint %34 + %36 = OpLoad %int %byteAddrTemp + %38 = OpIAdd %int %36 %int_1 + %39 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %38 + %40 = OpLoad %uint %39 + %41 = OpLoad %int %byteAddrTemp + %42 = OpIAdd %int %41 %int_2 + %43 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %42 + %44 = OpLoad %uint %43 + %45 = OpLoad %int %byteAddrTemp + %47 = OpIAdd %int %45 %int_3 + %48 = OpAccessChain %_ptr_Uniform_uint %ssbo_0 %int_0 %47 + %49 = OpLoad %uint %48 + %50 = OpCompositeConstruct %v4uint %35 %40 %44 %49 + OpStore %data %50 + OpReturn + OpFunctionEnd + %_main_vu3_ = OpFunction %void None %14 + %id = OpFunctionParameter %_ptr_Function_v3uint + %17 = OpLabel + %param = OpVariable %_ptr_Function_uint Function + OpStore %param %uint_4 + %53 = OpFunctionCall %void %Load_u1_ %param + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp b/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp new file mode 100644 index 0000000000..d431113972 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/hlsl-functionality.asm.comp @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 31 +; Schema: 0 + OpCapability Shader + OpExtension "SPV_GOOGLE_hlsl_functionality1" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %Buf "Buf" + OpMemberName %Buf 0 "@data" + OpName %Buf_0 "Buf" + OpName %Buf_count "Buf@count" + OpMemberName %Buf_count 0 "@count" + OpName %Buf_count_0 "Buf@count" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %Buf 0 Offset 0 + OpDecorate %Buf BufferBlock + OpDecorate %Buf_0 DescriptorSet 0 + OpDecorate %Buf_0 Binding 0 + OpMemberDecorate %Buf_count 0 Offset 0 + OpDecorate %Buf_count BufferBlock + OpDecorate %Buf_count_0 DescriptorSet 0 + OpDecorate %Buf_count_0 Binding 1 + OpDecorateId %Buf_0 HlslCounterBufferGOOGLE %Buf_count_0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %Buf = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_Buf = OpTypePointer Uniform %Buf + %Buf_0 = OpVariable %_ptr_Uniform_Buf Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %Buf_count = OpTypeStruct %int +%_ptr_Uniform_Buf_count = OpTypePointer Uniform %Buf_count +%Buf_count_0 = OpVariable %_ptr_Uniform_Buf_count Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_1 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %30 = OpFunctionCall %void %_main_ + OpReturn + OpFunctionEnd + %_main_ = OpFunction %void None %3 + %7 = OpLabel + %20 = OpAccessChain %_ptr_Uniform_int %Buf_count_0 %int_0 + %25 = OpAtomicIAdd %int %20 %uint_1 %uint_0 %int_1 + %29 = OpAccessChain %_ptr_Uniform_v4float %Buf_0 %int_0 %25 + OpStore %29 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/logical.asm.comp b/third_party/spirv-cross/shaders/asm/comp/logical.asm.comp new file mode 100644 index 0000000000..4174e77f3d --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/logical.asm.comp @@ -0,0 +1,191 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 152 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource ESSL 310 + OpName %main "main" + OpName %and_b1_b1_ "and(b1;b1;" + OpName %a "a" + OpName %b "b" + OpName %and_vb2_vb2_ "and(vb2;vb2;" + OpName %a_0 "a" + OpName %b_0 "b" + OpName %and_vb3_vb3_ "and(vb3;vb3;" + OpName %a_1 "a" + OpName %b_1 "b" + OpName %and_vb4_vb4_ "and(vb4;vb4;" + OpName %a_2 "a" + OpName %b_2 "b" + OpName %b0 "b0" + OpName %SSBO0 "SSBO0" + OpMemberName %SSBO0 0 "a" + OpMemberName %SSBO0 1 "b" + OpMemberName %SSBO0 2 "c" + OpMemberName %SSBO0 3 "d" + OpName %s0 "s0" + OpName %SSBO1 "SSBO1" + OpMemberName %SSBO1 0 "a" + OpMemberName %SSBO1 1 "b" + OpMemberName %SSBO1 2 "c" + OpMemberName %SSBO1 3 "d" + OpName %s1 "s1" + OpName %param "param" + OpName %param_0 "param" + OpName %b1 "b1" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %b2 "b2" + OpName %param_3 "param" + OpName %param_4 "param" + OpName %b3 "b3" + OpName %param_5 "param" + OpName %param_6 "param" + OpMemberDecorate %SSBO0 0 Offset 0 + OpMemberDecorate %SSBO0 1 Offset 8 + OpMemberDecorate %SSBO0 2 Offset 16 + OpMemberDecorate %SSBO0 3 Offset 32 + OpDecorate %SSBO0 BufferBlock + OpDecorate %s0 DescriptorSet 0 + OpDecorate %s0 Binding 0 + OpMemberDecorate %SSBO1 0 Offset 0 + OpMemberDecorate %SSBO1 1 Offset 8 + OpMemberDecorate %SSBO1 2 Offset 16 + OpMemberDecorate %SSBO1 3 Offset 32 + OpDecorate %SSBO1 BufferBlock + OpDecorate %s1 DescriptorSet 0 + OpDecorate %s1 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %8 = OpTypeFunction %bool %_ptr_Function_bool %_ptr_Function_bool + %v2bool = OpTypeVector %bool 2 +%_ptr_Function_v2bool = OpTypePointer Function %v2bool + %15 = OpTypeFunction %v2bool %_ptr_Function_v2bool %_ptr_Function_v2bool + %v3bool = OpTypeVector %bool 3 +%_ptr_Function_v3bool = OpTypePointer Function %v3bool + %22 = OpTypeFunction %v3bool %_ptr_Function_v3bool %_ptr_Function_v3bool + %v4bool = OpTypeVector %bool 4 +%_ptr_Function_v4bool = OpTypePointer Function %v4bool + %29 = OpTypeFunction %v4bool %_ptr_Function_v4bool %_ptr_Function_v4bool + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %SSBO0 = OpTypeStruct %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO0 = OpTypePointer Uniform %SSBO0 + %s0 = OpVariable %_ptr_Uniform_SSBO0 Uniform + %int = OpTypeInt 32 1 + %102 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %SSBO1 = OpTypeStruct %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO1 = OpTypePointer Uniform %SSBO1 + %s1 = OpVariable %_ptr_Uniform_SSBO1 Uniform + %117 = OpConstant %int 1 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %129 = OpConstant %int 2 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %141 = OpConstant %int 3 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %b0 = OpVariable %_ptr_Function_bool Function + %param = OpVariable %_ptr_Function_bool Function + %param_0 = OpVariable %_ptr_Function_bool Function + %b1 = OpVariable %_ptr_Function_v2bool Function + %param_1 = OpVariable %_ptr_Function_v2bool Function + %param_2 = OpVariable %_ptr_Function_v2bool Function + %b2 = OpVariable %_ptr_Function_v3bool Function + %param_3 = OpVariable %_ptr_Function_v3bool Function + %param_4 = OpVariable %_ptr_Function_v3bool Function + %b3 = OpVariable %_ptr_Function_v4bool Function + %param_5 = OpVariable %_ptr_Function_v4bool Function + %param_6 = OpVariable %_ptr_Function_v4bool Function + %104 = OpAccessChain %_ptr_Uniform_float %s0 %102 + %105 = OpLoad %float %104 + %106 = OpIsInf %bool %105 + %110 = OpAccessChain %_ptr_Uniform_float %s1 %102 + %111 = OpLoad %float %110 + %112 = OpIsNan %bool %111 + OpStore %param %106 + OpStore %param_0 %112 + %115 = OpFunctionCall %bool %and_b1_b1_ %param %param_0 + OpStore %b0 %115 + %119 = OpAccessChain %_ptr_Uniform_v2float %s0 %117 + %120 = OpLoad %v2float %119 + %121 = OpIsInf %v2bool %120 + %122 = OpAccessChain %_ptr_Uniform_v2float %s1 %117 + %123 = OpLoad %v2float %122 + %124 = OpIsNan %v2bool %123 + OpStore %param_1 %121 + OpStore %param_2 %124 + %127 = OpFunctionCall %v2bool %and_vb2_vb2_ %param_1 %param_2 + OpStore %b1 %127 + %131 = OpAccessChain %_ptr_Uniform_v3float %s0 %129 + %132 = OpLoad %v3float %131 + %133 = OpIsInf %v3bool %132 + %134 = OpAccessChain %_ptr_Uniform_v3float %s1 %129 + %135 = OpLoad %v3float %134 + %136 = OpIsNan %v3bool %135 + OpStore %param_3 %133 + OpStore %param_4 %136 + %139 = OpFunctionCall %v3bool %and_vb3_vb3_ %param_3 %param_4 + OpStore %b2 %139 + %143 = OpAccessChain %_ptr_Uniform_v4float %s0 %141 + %144 = OpLoad %v4float %143 + %145 = OpIsInf %v4bool %144 + %146 = OpAccessChain %_ptr_Uniform_v4float %s1 %141 + %147 = OpLoad %v4float %146 + %148 = OpIsNan %v4bool %147 + OpStore %param_5 %145 + OpStore %param_6 %148 + %151 = OpFunctionCall %v4bool %and_vb4_vb4_ %param_5 %param_6 + OpStore %b3 %151 + OpReturn + OpFunctionEnd + %and_b1_b1_ = OpFunction %bool None %8 + %a = OpFunctionParameter %_ptr_Function_bool + %b = OpFunctionParameter %_ptr_Function_bool + %12 = OpLabel + %34 = OpLoad %bool %a + %35 = OpLoad %bool %b + %36 = OpLogicalAnd %bool %34 %35 + %37 = OpLogicalOr %bool %36 %35 + %38 = OpLogicalNot %bool %37 + OpReturnValue %38 + OpFunctionEnd +%and_vb2_vb2_ = OpFunction %v2bool None %15 + %a_0 = OpFunctionParameter %_ptr_Function_v2bool + %b_0 = OpFunctionParameter %_ptr_Function_v2bool + %19 = OpLabel + %39 = OpLoad %v2bool %a_0 + %41 = OpLoad %v2bool %b_0 + %48 = OpLogicalAnd %v2bool %39 %41 + %49 = OpLogicalOr %v2bool %48 %41 + %50 = OpLogicalNot %v2bool %49 + OpReturnValue %50 + OpFunctionEnd +%and_vb3_vb3_ = OpFunction %v3bool None %22 + %a_1 = OpFunctionParameter %_ptr_Function_v3bool + %b_1 = OpFunctionParameter %_ptr_Function_v3bool + %26 = OpLabel + %52 = OpLoad %v3bool %a_1 + %54 = OpLoad %v3bool %b_1 + %66 = OpLogicalAnd %v3bool %52 %54 + OpReturnValue %66 + OpFunctionEnd +%and_vb4_vb4_ = OpFunction %v4bool None %29 + %a_2 = OpFunctionParameter %_ptr_Function_v4bool + %b_2 = OpFunctionParameter %_ptr_Function_v4bool + %33 = OpLabel + %70 = OpLoad %v4bool %a_2 + %72 = OpLoad %v4bool %b_2 + %74 = OpLogicalAnd %v4bool %70 %72 + OpReturnValue %74 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/multiple-entry.asm.comp b/third_party/spirv-cross/shaders/asm/comp/multiple-entry.asm.comp new file mode 100644 index 0000000000..9ddc07bccf --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/multiple-entry.asm.comp @@ -0,0 +1,98 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 30 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %func_alt "main2" %frag_in %frag_out + OpEntryPoint GLCompute %func "main" + OpExecutionMode %func LocalSize 1 1 1 + OpExecutionMode %func_alt OriginUpperLeft + OpSource ESSL 310 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpMemberDecorate %input_struct 0 Offset 0 + OpMemberDecorate %input_struct 1 Offset 16 + OpMemberDecorate %output_struct 0 Offset 0 + OpMemberDecorate %output_struct 1 Offset 16 + OpDecorate %input_struct BufferBlock + OpDecorate %inputs DescriptorSet 0 + OpDecorate %inputs Binding 0 + OpDecorate %inputs Restrict + OpDecorate %output_struct BufferBlock + OpDecorate %outputs DescriptorSet 0 + OpDecorate %outputs Binding 1 + OpDecorate %outputs Restrict + OpDecorate %frag_in Location 0 + OpDecorate %frag_out Location 0 + + %void = OpTypeVoid + %main_func = OpTypeFunction %void + + %uint = OpTypeInt 32 0 + %uvec4 = OpTypeVector %uint 4 + + %int = OpTypeInt 32 1 + %ivec4 = OpTypeVector %int 4 + + %ivec4_ptr = OpTypePointer Uniform %ivec4 + %uvec4_ptr = OpTypePointer Uniform %uvec4 + + %float = OpTypeFloat 32 + %vec4 = OpTypeVector %float 4 + %vec4_input_ptr = OpTypePointer Input %vec4 + %vec4_output_ptr = OpTypePointer Output %vec4 + + %zero = OpConstant %int 0 + %one = OpConstant %int 1 + + %input_struct = OpTypeStruct %ivec4 %uvec4 + %input_struct_ptr = OpTypePointer Uniform %input_struct + %inputs = OpVariable %input_struct_ptr Uniform + %output_struct = OpTypeStruct %uvec4 %ivec4 + %output_struct_ptr = OpTypePointer Uniform %output_struct + %outputs = OpVariable %output_struct_ptr Uniform + + %frag_in = OpVariable %vec4_input_ptr Input + %frag_out = OpVariable %vec4_output_ptr Output + + %func = OpFunction %void None %main_func + %block = OpLabel + + %input1_ptr = OpAccessChain %ivec4_ptr %inputs %zero + %input0_ptr = OpAccessChain %uvec4_ptr %inputs %one + %input1 = OpLoad %ivec4 %input1_ptr + %input0 = OpLoad %uvec4 %input0_ptr + + %output_ptr_uvec4 = OpAccessChain %uvec4_ptr %outputs %zero + %output_ptr_ivec4 = OpAccessChain %ivec4_ptr %outputs %one + +; Test all variants of IAdd + %result_iadd_0 = OpIAdd %uvec4 %input0 %input1 + %result_iadd_1 = OpIAdd %uvec4 %input1 %input0 + %result_iadd_2 = OpIAdd %uvec4 %input0 %input0 + %result_iadd_3 = OpIAdd %uvec4 %input1 %input1 + %result_iadd_4 = OpIAdd %ivec4 %input0 %input0 + %result_iadd_5 = OpIAdd %ivec4 %input1 %input1 + %result_iadd_6 = OpIAdd %ivec4 %input0 %input1 + %result_iadd_7 = OpIAdd %ivec4 %input1 %input0 + OpStore %output_ptr_uvec4 %result_iadd_0 + OpStore %output_ptr_uvec4 %result_iadd_1 + OpStore %output_ptr_uvec4 %result_iadd_2 + OpStore %output_ptr_uvec4 %result_iadd_3 + OpStore %output_ptr_ivec4 %result_iadd_4 + OpStore %output_ptr_ivec4 %result_iadd_5 + OpStore %output_ptr_ivec4 %result_iadd_6 + OpStore %output_ptr_ivec4 %result_iadd_7 + + OpReturn + OpFunctionEnd + + %func_alt = OpFunction %void None %main_func + %block_alt = OpLabel + %frag_input_value = OpLoad %vec4 %frag_in + OpStore %frag_out %frag_input_value + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.asm.comp b/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.asm.comp new file mode 100644 index 0000000000..6c060eedad --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.asm.comp @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a1" + OpMemberName %SSBO 1 "a2" + OpMemberName %SSBO 2 "a3" + OpMemberName %SSBO 3 "a4" + OpMemberName %SSBO 4 "b1" + OpMemberName %SSBO 5 "b2" + OpMemberName %SSBO 6 "b3" + OpMemberName %SSBO 7 "b4" + OpMemberName %SSBO 8 "c1" + OpMemberName %SSBO 9 "c2" + OpMemberName %SSBO 10 "c3" + OpMemberName %SSBO 11 "c4" + OpName %_ "" + OpName %i "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 8 + OpMemberDecorate %SSBO 2 Offset 16 + OpMemberDecorate %SSBO 3 Offset 32 + OpMemberDecorate %SSBO 4 Offset 48 + OpMemberDecorate %SSBO 5 Offset 56 + OpMemberDecorate %SSBO 6 Offset 64 + OpMemberDecorate %SSBO 7 Offset 80 + OpMemberDecorate %SSBO 8 Offset 96 + OpMemberDecorate %SSBO 9 Offset 104 + OpMemberDecorate %SSBO 10 Offset 112 + OpMemberDecorate %SSBO 11 Offset 128 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %SSBO = OpTypeStruct %float %v2float %v3float %v4float %float %v2float %v3float %v4float %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_7 = OpConstant %int 7 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_11 = OpConstant %int 11 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %7 + %35 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %39 = OpLoad %float %38 + %40 = OpExtInst %float %1 NMin %37 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %43 = OpLoad %v2float %42 + %44 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %45 = OpLoad %v2float %44 + %46 = OpExtInst %v2float %1 NMin %43 %45 + %47 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %47 %46 + %48 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %49 = OpLoad %v3float %48 + %50 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %51 = OpLoad %v3float %50 + %52 = OpExtInst %v3float %1 NMin %49 %51 + %53 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %53 %52 + %54 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %55 = OpLoad %v4float %54 + %56 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %57 = OpLoad %v4float %56 + %58 = OpExtInst %v4float %1 NMin %55 %57 + %59 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %63 = OpLoad %float %62 + %64 = OpExtInst %float %1 NMax %61 %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %65 %64 + %66 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %67 = OpLoad %v2float %66 + %68 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %69 = OpLoad %v2float %68 + %70 = OpExtInst %v2float %1 NMax %67 %69 + %71 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %71 %70 + %72 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %73 = OpLoad %v3float %72 + %74 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %75 = OpLoad %v3float %74 + %76 = OpExtInst %v3float %1 NMax %73 %75 + %77 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %77 %76 + %78 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %79 = OpLoad %v4float %78 + %80 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %81 = OpLoad %v4float %80 + %82 = OpExtInst %v4float %1 NMax %79 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %83 %82 + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %89 = OpLoad %float %88 + %90 = OpExtInst %float %1 NClamp %85 %87 %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %91 %90 + %92 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + %93 = OpLoad %v2float %92 + %94 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %95 = OpLoad %v2float %94 + %96 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %97 = OpLoad %v2float %96 + %98 = OpExtInst %v2float %1 NClamp %93 %95 %97 + %99 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %99 %98 + %100 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %101 = OpLoad %v3float %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %103 = OpLoad %v3float %102 + %104 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %105 = OpLoad %v3float %104 + %106 = OpExtInst %v3float %1 NClamp %101 %103 %105 + %107 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + %109 = OpLoad %v4float %108 + %110 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %111 = OpLoad %v4float %110 + %112 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %113 = OpLoad %v4float %112 + %114 = OpExtInst %v4float %1 NClamp %109 %111 %113 + %115 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %115 %114 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %121 = OpSLessThan %bool %120 %int_2 + OpBranchConditional %121 %122 %117 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %124 = OpLoad %v2float %123 + %125 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %126 = OpLoad %v2float %125 + %127 = OpExtInst %v2float %1 NMin %124 %126 + %128 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %128 %127 + OpBranch %118 + %118 = OpLabel + %129 = OpLoad %int %i + %130 = OpIAdd %int %129 %int_1 + OpStore %i %130 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %132 = OpLoad %float %131 + %133 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_1 + %136 = OpLoad %float %135 + %137 = OpExtInst %float %1 NClamp %132 %134 %136 + %138 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %138 %137 + OpBranch %116 + %117 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp b/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp new file mode 100644 index 0000000000..6c060eedad --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/nmin-max-clamp.relax-nan.asm.comp @@ -0,0 +1,203 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 139 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a1" + OpMemberName %SSBO 1 "a2" + OpMemberName %SSBO 2 "a3" + OpMemberName %SSBO 3 "a4" + OpMemberName %SSBO 4 "b1" + OpMemberName %SSBO 5 "b2" + OpMemberName %SSBO 6 "b3" + OpMemberName %SSBO 7 "b4" + OpMemberName %SSBO 8 "c1" + OpMemberName %SSBO 9 "c2" + OpMemberName %SSBO 10 "c3" + OpMemberName %SSBO 11 "c4" + OpName %_ "" + OpName %i "i" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 8 + OpMemberDecorate %SSBO 2 Offset 16 + OpMemberDecorate %SSBO 3 Offset 32 + OpMemberDecorate %SSBO 4 Offset 48 + OpMemberDecorate %SSBO 5 Offset 56 + OpMemberDecorate %SSBO 6 Offset 64 + OpMemberDecorate %SSBO 7 Offset 80 + OpMemberDecorate %SSBO 8 Offset 96 + OpMemberDecorate %SSBO 9 Offset 104 + OpMemberDecorate %SSBO 10 Offset 112 + OpMemberDecorate %SSBO 11 Offset 128 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %SSBO = OpTypeStruct %float %v2float %v3float %v4float %float %v2float %v3float %v4float %float %v2float %v3float %v4float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %int_8 = OpConstant %int 8 + %int_1 = OpConstant %int 1 + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float + %int_9 = OpConstant %int 9 + %int_2 = OpConstant %int 2 + %int_6 = OpConstant %int 6 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %int_10 = OpConstant %int 10 + %int_3 = OpConstant %int 3 + %int_7 = OpConstant %int 7 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_11 = OpConstant %int 11 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %main = OpFunction %void None %7 + %35 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %36 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %39 = OpLoad %float %38 + %40 = OpExtInst %float %1 NMin %37 %39 + %41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %41 %40 + %42 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %43 = OpLoad %v2float %42 + %44 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %45 = OpLoad %v2float %44 + %46 = OpExtInst %v2float %1 NMin %43 %45 + %47 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %47 %46 + %48 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %49 = OpLoad %v3float %48 + %50 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %51 = OpLoad %v3float %50 + %52 = OpExtInst %v3float %1 NMin %49 %51 + %53 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %53 %52 + %54 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %55 = OpLoad %v4float %54 + %56 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %57 = OpLoad %v4float %56 + %58 = OpExtInst %v4float %1 NMin %55 %57 + %59 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %59 %58 + %60 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %61 = OpLoad %float %60 + %62 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %63 = OpLoad %float %62 + %64 = OpExtInst %float %1 NMax %61 %63 + %65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %65 %64 + %66 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %67 = OpLoad %v2float %66 + %68 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %69 = OpLoad %v2float %68 + %70 = OpExtInst %v2float %1 NMax %67 %69 + %71 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %71 %70 + %72 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %73 = OpLoad %v3float %72 + %74 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %75 = OpLoad %v3float %74 + %76 = OpExtInst %v3float %1 NMax %73 %75 + %77 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %77 %76 + %78 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %79 = OpLoad %v4float %78 + %80 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %81 = OpLoad %v4float %80 + %82 = OpExtInst %v4float %1 NMax %79 %81 + %83 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %83 %82 + %84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %85 = OpLoad %float %84 + %86 = OpAccessChain %_ptr_Uniform_float %_ %int_4 + %87 = OpLoad %float %86 + %88 = OpAccessChain %_ptr_Uniform_float %_ %int_8 + %89 = OpLoad %float %88 + %90 = OpExtInst %float %1 NClamp %85 %87 %89 + %91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %91 %90 + %92 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + %93 = OpLoad %v2float %92 + %94 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %95 = OpLoad %v2float %94 + %96 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %97 = OpLoad %v2float %96 + %98 = OpExtInst %v2float %1 NClamp %93 %95 %97 + %99 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %99 %98 + %100 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + %101 = OpLoad %v3float %100 + %102 = OpAccessChain %_ptr_Uniform_v3float %_ %int_6 + %103 = OpLoad %v3float %102 + %104 = OpAccessChain %_ptr_Uniform_v3float %_ %int_10 + %105 = OpLoad %v3float %104 + %106 = OpExtInst %v3float %1 NClamp %101 %103 %105 + %107 = OpAccessChain %_ptr_Uniform_v3float %_ %int_2 + OpStore %107 %106 + %108 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + %109 = OpLoad %v4float %108 + %110 = OpAccessChain %_ptr_Uniform_v4float %_ %int_7 + %111 = OpLoad %v4float %110 + %112 = OpAccessChain %_ptr_Uniform_v4float %_ %int_11 + %113 = OpLoad %v4float %112 + %114 = OpExtInst %v4float %1 NClamp %109 %111 %113 + %115 = OpAccessChain %_ptr_Uniform_v4float %_ %int_3 + OpStore %115 %114 + OpStore %i %int_0 + OpBranch %116 + %116 = OpLabel + OpLoopMerge %117 %118 None + OpBranch %119 + %119 = OpLabel + %120 = OpLoad %int %i + %121 = OpSLessThan %bool %120 %int_2 + OpBranchConditional %121 %122 %117 + %122 = OpLabel + %123 = OpAccessChain %_ptr_Uniform_v2float %_ %int_5 + %124 = OpLoad %v2float %123 + %125 = OpAccessChain %_ptr_Uniform_v2float %_ %int_9 + %126 = OpLoad %v2float %125 + %127 = OpExtInst %v2float %1 NMin %124 %126 + %128 = OpAccessChain %_ptr_Uniform_v2float %_ %int_1 + OpStore %128 %127 + OpBranch %118 + %118 = OpLabel + %129 = OpLoad %int %i + %130 = OpIAdd %int %129 %int_1 + OpStore %i %130 + %131 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %132 = OpLoad %float %131 + %133 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_0 + %134 = OpLoad %float %133 + %135 = OpAccessChain %_ptr_Uniform_float %_ %int_5 %uint_1 + %136 = OpLoad %float %135 + %137 = OpExtInst %float %1 NClamp %132 %134 %136 + %138 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %138 %137 + OpBranch %116 + %117 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/op-phi-swap.asm.comp b/third_party/spirv-cross/shaders/asm/comp/op-phi-swap.asm.comp new file mode 100644 index 0000000000..dc18d6972f --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/op-phi-swap.asm.comp @@ -0,0 +1,63 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 39 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpName %main "main" + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_struct_3 BufferBlock + OpDecorate %4 DescriptorSet 0 + OpDecorate %4 Binding 0 + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 1 + OpDecorate %_runtimearr_float ArrayStride 4 + OpMemberDecorate %_struct_3 0 Offset 0 + %bool = OpTypeBool + %void = OpTypeVoid + %9 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %v3uint = OpTypeVector %uint 3 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Uniform_int = OpTypePointer Uniform %int +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_runtimearr_int = OpTypeRuntimeArray %int +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_3 = OpTypeStruct %_runtimearr_float +%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3 + %4 = OpVariable %_ptr_Uniform__struct_3 Uniform + %5 = OpVariable %_ptr_Uniform__struct_3 Uniform +%_ptr_Function_float = OpTypePointer Function %float +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %int_0 = OpConstant %int 0 + %float_8_5 = OpConstant %float 8.5 + %main = OpFunction %void None %9 + %25 = OpLabel + %26 = OpVariable %_ptr_Function_float Function %float_8_5 + %27 = OpLoad %v3uint %gl_GlobalInvocationID + %28 = OpCompositeExtract %uint %27 0 + %29 = OpAccessChain %_ptr_Uniform_float %4 %int_0 %28 + %30 = OpAccessChain %_ptr_Uniform_float %5 %int_0 %28 + %31 = OpLoad %float %29 + %32 = OpLoad %float %26 + OpBranch %33 + %33 = OpLabel + %34 = OpPhi %bool %true %25 %false %33 + %35 = OpPhi %float %31 %25 %36 %33 + %36 = OpPhi %float %32 %25 %35 %33 + OpLoopMerge %37 %33 None + OpBranchConditional %34 %33 %37 + %37 = OpLabel + %38 = OpFSub %float %35 %36 + OpStore %30 %38 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/quantize.asm.comp b/third_party/spirv-cross/shaders/asm/comp/quantize.asm.comp new file mode 100644 index 0000000000..f5afc6570c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/quantize.asm.comp @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpSource ESSL 310 + OpName %4 "main" + OpName %10 "SSBO0" + OpMemberName %10 0 "scalar" + OpMemberName %10 1 "vec2_val" + OpMemberName %10 2 "vec3_val" + OpMemberName %10 3 "vec4_val" + OpName %12 "" + OpMemberDecorate %10 0 Offset 0 + OpMemberDecorate %10 1 Offset 8 + OpMemberDecorate %10 2 Offset 16 + OpMemberDecorate %10 3 Offset 32 + OpDecorate %10 BufferBlock + OpDecorate %12 DescriptorSet 0 + OpDecorate %12 Binding 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeVector %6 3 + %9 = OpTypeVector %6 4 + %10 = OpTypeStruct %6 %7 %8 %9 + %11 = OpTypePointer Uniform %10 + %12 = OpVariable %11 Uniform + %13 = OpTypeInt 32 1 + %14 = OpConstant %13 0 + %15 = OpTypePointer Uniform %6 + %20 = OpConstant %13 1 + %21 = OpTypePointer Uniform %7 + %26 = OpConstant %13 2 + %27 = OpTypePointer Uniform %8 + %32 = OpConstant %13 3 + %33 = OpTypePointer Uniform %9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %6 %16 + %18 = OpQuantizeToF16 %6 %17 + %19 = OpAccessChain %15 %12 %14 + OpStore %19 %18 + %22 = OpAccessChain %21 %12 %20 + %23 = OpLoad %7 %22 + %24 = OpQuantizeToF16 %7 %23 + %25 = OpAccessChain %21 %12 %20 + OpStore %25 %24 + %28 = OpAccessChain %27 %12 %26 + %29 = OpLoad %8 %28 + %30 = OpQuantizeToF16 %8 %29 + %31 = OpAccessChain %27 %12 %26 + OpStore %31 %30 + %34 = OpAccessChain %33 %12 %32 + %35 = OpLoad %9 %34 + %36 = OpQuantizeToF16 %9 %35 + %37 = OpAccessChain %33 %12 %32 + OpStore %37 %36 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/recompile-block-naming.asm.comp b/third_party/spirv-cross/shaders/asm/comp/recompile-block-naming.asm.comp new file mode 100644 index 0000000000..227a82b18e --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/recompile-block-naming.asm.comp @@ -0,0 +1,140 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 97 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %a "a" + OpName %byteAddrTemp "byteAddrTemp" + OpName %MyFirstBuffer "MyFirstBuffer" + OpMemberName %MyFirstBuffer 0 "@data" + OpName %MyFirstBuffer_0 "MyFirstBuffer" + OpName %b "b" + OpName %byteAddrTemp_0 "byteAddrTemp" + OpName %MySecondBuffer "MySecondBuffer" + OpName %byteAddrTemp_1 "byteAddrTemp" + OpName %MyThirdBuffer "MyThirdBuffer" + OpDecorate %_runtimearr_uint ArrayStride 4 + OpMemberDecorate %MyFirstBuffer 0 Offset 0 + OpDecorate %MyFirstBuffer BufferBlock + OpDecorate %MyFirstBuffer_0 DescriptorSet 0 + OpDecorate %MyFirstBuffer_0 Binding 0 + OpDecorate %MySecondBuffer DescriptorSet 0 + OpDecorate %MySecondBuffer Binding 0 + OpDecorate %MyThirdBuffer DescriptorSet 0 + OpDecorate %MyThirdBuffer Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_2 = OpConstant %int 2 +%_runtimearr_uint = OpTypeRuntimeArray %uint +%MyFirstBuffer = OpTypeStruct %_runtimearr_uint +%_ptr_Uniform_MyFirstBuffer = OpTypePointer Uniform %MyFirstBuffer +%MyFirstBuffer_0 = OpVariable %_ptr_Uniform_MyFirstBuffer Uniform +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 +%MySecondBuffer = OpVariable %_ptr_Uniform_MyFirstBuffer Uniform +%MyThirdBuffer = OpVariable %_ptr_Uniform_MyFirstBuffer Uniform + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %uint_3 = OpConstant %uint 3 + %main = OpFunction %void None %3 + %5 = OpLabel + %96 = OpFunctionCall %void %_main_ + OpReturn + OpFunctionEnd + %_main_ = OpFunction %void None %3 + %7 = OpLabel + %a = OpVariable %_ptr_Function_v4uint Function +%byteAddrTemp = OpVariable %_ptr_Function_int Function + %b = OpVariable %_ptr_Function_v4uint Function +%byteAddrTemp_0 = OpVariable %_ptr_Function_int Function +%byteAddrTemp_1 = OpVariable %_ptr_Function_int Function + %17 = OpShiftRightArithmetic %int %int_0 %int_2 + OpStore %byteAddrTemp %17 + %22 = OpLoad %int %byteAddrTemp + %24 = OpAccessChain %_ptr_Uniform_uint %MyFirstBuffer_0 %int_0 %22 + %25 = OpLoad %uint %24 + %26 = OpLoad %int %byteAddrTemp + %28 = OpIAdd %int %26 %int_1 + %29 = OpAccessChain %_ptr_Uniform_uint %MyFirstBuffer_0 %int_0 %28 + %30 = OpLoad %uint %29 + %31 = OpLoad %int %byteAddrTemp + %32 = OpIAdd %int %31 %int_2 + %33 = OpAccessChain %_ptr_Uniform_uint %MyFirstBuffer_0 %int_0 %32 + %34 = OpLoad %uint %33 + %35 = OpLoad %int %byteAddrTemp + %37 = OpIAdd %int %35 %int_3 + %38 = OpAccessChain %_ptr_Uniform_uint %MyFirstBuffer_0 %int_0 %37 + %39 = OpLoad %uint %38 + %40 = OpCompositeConstruct %v4uint %25 %30 %34 %39 + OpStore %a %40 + %44 = OpShiftRightArithmetic %int %int_4 %int_2 + OpStore %byteAddrTemp_0 %44 + %46 = OpLoad %int %byteAddrTemp_0 + %47 = OpAccessChain %_ptr_Uniform_uint %MySecondBuffer %int_0 %46 + %48 = OpLoad %uint %47 + %49 = OpLoad %int %byteAddrTemp_0 + %50 = OpIAdd %int %49 %int_1 + %51 = OpAccessChain %_ptr_Uniform_uint %MySecondBuffer %int_0 %50 + %52 = OpLoad %uint %51 + %53 = OpLoad %int %byteAddrTemp_0 + %54 = OpIAdd %int %53 %int_2 + %55 = OpAccessChain %_ptr_Uniform_uint %MySecondBuffer %int_0 %54 + %56 = OpLoad %uint %55 + %57 = OpLoad %int %byteAddrTemp_0 + %58 = OpIAdd %int %57 %int_3 + %59 = OpAccessChain %_ptr_Uniform_uint %MySecondBuffer %int_0 %58 + %60 = OpLoad %uint %59 + %61 = OpCompositeConstruct %v4uint %48 %52 %56 %60 + OpStore %b %61 + %63 = OpShiftRightArithmetic %int %int_0 %int_2 + OpStore %byteAddrTemp_1 %63 + %65 = OpLoad %int %byteAddrTemp_1 + %66 = OpLoad %v4uint %a + %67 = OpLoad %v4uint %b + %68 = OpIAdd %v4uint %66 %67 + %70 = OpCompositeExtract %uint %68 0 + %71 = OpAccessChain %_ptr_Uniform_uint %MyThirdBuffer %int_0 %65 + OpStore %71 %70 + %72 = OpLoad %int %byteAddrTemp_1 + %73 = OpIAdd %int %72 %int_1 + %74 = OpLoad %v4uint %a + %75 = OpLoad %v4uint %b + %76 = OpIAdd %v4uint %74 %75 + %78 = OpCompositeExtract %uint %76 1 + %79 = OpAccessChain %_ptr_Uniform_uint %MyThirdBuffer %int_0 %73 + OpStore %79 %78 + %80 = OpLoad %int %byteAddrTemp_1 + %81 = OpIAdd %int %80 %int_2 + %82 = OpLoad %v4uint %a + %83 = OpLoad %v4uint %b + %84 = OpIAdd %v4uint %82 %83 + %86 = OpCompositeExtract %uint %84 2 + %87 = OpAccessChain %_ptr_Uniform_uint %MyThirdBuffer %int_0 %81 + OpStore %87 %86 + %88 = OpLoad %int %byteAddrTemp_1 + %89 = OpIAdd %int %88 %int_3 + %90 = OpLoad %v4uint %a + %91 = OpLoad %v4uint %b + %92 = OpIAdd %v4uint %90 %91 + %94 = OpCompositeExtract %uint %92 3 + %95 = OpAccessChain %_ptr_Uniform_uint %MyThirdBuffer %int_0 %89 + OpStore %95 %94 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/specialization-constant-workgroup.asm.comp b/third_party/spirv-cross/shaders/asm/comp/specialization-constant-workgroup.asm.comp new file mode 100644 index 0000000000..188e3fec36 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/specialization-constant-workgroup.asm.comp @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 24 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 20 1 + OpSource ESSL 310 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "a" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %19 SpecId 10 + OpDecorate %21 SpecId 12 + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %SSBO = OpTypeStruct %float +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint = OpTypeInt 32 0 + %19 = OpSpecConstant %uint 9 + %uint_20 = OpConstant %uint 20 + %21 = OpSpecConstant %uint 4 + %v3uint = OpTypeVector %uint 3 +%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %19 %uint_20 %21 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + %15 = OpLoad %float %14 + %16 = OpFAdd %float %15 %float_1 + %17 = OpAccessChain %_ptr_Uniform_float %_ %int_0 + OpStore %17 %16 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/switch-break-ladder.asm.invalid.comp b/third_party/spirv-cross/shaders/asm/comp/switch-break-ladder.asm.invalid.comp new file mode 100644 index 0000000000..a32c9ef988 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/switch-break-ladder.asm.invalid.comp @@ -0,0 +1,92 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %c "c" + OpName %BUF "BUF" + OpMemberName %BUF 0 "a" + OpMemberName %BUF 1 "b" + OpMemberName %BUF 2 "d" + OpName %o "o" + OpName %a "a" + OpMemberDecorate %BUF 0 Offset 0 + OpMemberDecorate %BUF 1 Offset 4 + OpMemberDecorate %BUF 2 Offset 8 + OpDecorate %BUF BufferBlock + OpDecorate %o DescriptorSet 0 + OpDecorate %o Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %BUF = OpTypeStruct %int %int %int +%_ptr_Uniform_BUF = OpTypePointer Uniform %BUF + %o = OpVariable %_ptr_Uniform_BUF Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %c = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function_int Function + %14 = OpAccessChain %_ptr_Uniform_int %o %int_0 + %15 = OpLoad %int %14 + OpStore %c %15 + OpBranch %16 + %16 = OpLabel + OpLoopMerge %18 %19 None + OpBranch %17 + %17 = OpLabel + %20 = OpLoad %int %c + OpSelectionMerge %23 None + OpSwitch %20 %23 5 %21 1 %22 2 %22 3 %22 + %21 = OpLabel + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %25 + %25 = OpLabel + %29 = OpAccessChain %_ptr_Uniform_int %o %int_2 + %30 = OpLoad %int %29 + OpSelectionMerge %33 None + OpSwitch %30 %32 10 %31 20 %31 + %32 = OpLabel + OpBranch %27 + %31 = OpLabel + %34 = OpLoad %int %c + %35 = OpLoad %int %c + %36 = OpIAdd %int %35 %34 + OpStore %c %36 + OpBranch %26 + %33 = OpLabel + OpUnreachable + %27 = OpLabel + OpBranch %24 + %26 = OpLabel + OpBranch %23 + %22 = OpLabel + %42 = OpLoad %int %c + OpStore %a %42 + OpBranch %18 + %23 = OpLabel + %45 = OpLoad %int %c + %47 = OpIAdd %int %45 %int_1 + OpStore %c %47 + OpBranch %19 + %19 = OpLabel + OpBranch %16 + %18 = OpLabel + %48 = OpLoad %int %a + %49 = OpAccessChain %_ptr_Uniform_int %o %int_1 + OpStore %49 %48 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/comp/undefined-constant-composite.asm.comp b/third_party/spirv-cross/shaders/asm/comp/undefined-constant-composite.asm.comp new file mode 100644 index 0000000000..9de0501fe2 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/comp/undefined-constant-composite.asm.comp @@ -0,0 +1,102 @@ +; +; The shader below is based on the following GLSL shader: +; +; #version 450 +; +; struct Pair { +; int first; +; int second; +; }; +; +; const Pair constant_pair = { 100, 200 }; +; +; layout(set=0, binding=0, std430) buffer InputBlock { +; int array[10]; +; } inputValues; +; +; layout(set=0, binding=1, std430) buffer OutputBlock { +; int array[10]; +; } outputValues; +; +; int add_second (int value, Pair pair) { +; return value + pair.second; +; } +; +; void main() { +; uint idx = gl_GlobalInvocationID.x; +; outputValues.array[idx] = add_second(inputValues.array[idx], constant_pair); +; } +; +; However, the first element of constant_pair has been modified to be undefined. +; + OpCapability Shader + %std450 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %_arr_int_uint_10 ArrayStride 4 + OpMemberDecorate %OutputBlock 0 Offset 0 + OpDecorate %OutputBlock BufferBlock + OpDecorate %outputValues DescriptorSet 0 + OpDecorate %outputValues Binding 1 + OpMemberDecorate %InputBlock 0 Offset 0 + OpDecorate %InputBlock BufferBlock + OpDecorate %inputValues DescriptorSet 0 + OpDecorate %inputValues Binding 0 + %void = OpTypeVoid + %void_func = OpTypeFunction %void + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_200 = OpConstant %int 200 + %uint_0 = OpConstant %uint 0 + %uint_10 = OpConstant %uint 10 + %_ptr_Function_int = OpTypePointer Function %int + %Pair = OpTypeStruct %int %int + %_ptr_Function_Pair = OpTypePointer Function %Pair + %add_second_func_type = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_Pair + %_ptr_Function_uint = OpTypePointer Function %uint + %_ptr_Input_v3uint = OpTypePointer Input %v3uint + %_ptr_Input_uint = OpTypePointer Input %uint + %_arr_int_uint_10 = OpTypeArray %int %uint_10 + %OutputBlock = OpTypeStruct %_arr_int_uint_10 +%_ptr_Uniform_OutputBlock = OpTypePointer Uniform %OutputBlock + %outputValues = OpVariable %_ptr_Uniform_OutputBlock Uniform + %InputBlock = OpTypeStruct %_arr_int_uint_10 + %_ptr_Uniform_InputBlock = OpTypePointer Uniform %InputBlock + %inputValues = OpVariable %_ptr_Uniform_InputBlock Uniform + ; Replaced %int_100 with an undefined int. + %undef_int = OpUndef %int + ; Composed a constant Pair with the undefined int in the first member. + %const_Pair = OpConstantComposite %Pair %undef_int %int_200 + %_ptr_Uniform_int = OpTypePointer Uniform %int + %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %main = OpFunction %void None %void_func + %main_label = OpLabel + %param_1 = OpVariable %_ptr_Function_int Function + %param_2 = OpVariable %_ptr_Function_Pair Function + %gidx_ptr = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 + %gidx = OpLoad %uint %gidx_ptr + %input_value_ptr = OpAccessChain %_ptr_Uniform_int %inputValues %int_0 %gidx + %input_value = OpLoad %int %input_value_ptr + OpStore %param_1 %input_value + OpStore %param_2 %const_Pair + %retval = OpFunctionCall %int %add_second %param_1 %param_2 + %output_value_ptr = OpAccessChain %_ptr_Uniform_int %outputValues %int_0 %gidx + OpStore %output_value_ptr %retval + OpReturn + OpFunctionEnd + %add_second = OpFunction %int None %add_second_func_type + %value_ptr = OpFunctionParameter %_ptr_Function_int + %pair = OpFunctionParameter %_ptr_Function_Pair + %add_second_label = OpLabel + %value = OpLoad %int %value_ptr + ; Access the second struct member, which is defined. + %pair_second_ptr = OpAccessChain %_ptr_Function_int %pair %int_1 + %pair_second = OpLoad %int %pair_second_ptr + %add_result = OpIAdd %int %value %pair_second + OpReturnValue %add_result + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag b/third_party/spirv-cross/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag new file mode 100644 index 0000000000..ba2f95b234 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/combined-sampler-reuse.vk.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vUV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTex "uTex" + OpName %uSampler "uSampler" + OpName %vUV "vUV" + OpDecorate %FragColor Location 0 + OpDecorate %uTex DescriptorSet 0 + OpDecorate %uTex Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 0 + OpDecorate %vUV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %uTex = OpVariable %_ptr_UniformConstant_10 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 + %uSampler = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeSampledImage %10 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %vUV = OpVariable %_ptr_Input_v2float Input + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_1 = OpConstant %int 1 + %32 = OpConstantComposite %v2int %int_1 %int_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %10 %uTex + %17 = OpLoad %14 %uSampler + %19 = OpSampledImage %18 %13 %17 + %23 = OpLoad %v2float %vUV + %24 = OpImageSampleImplicitLod %v4float %19 %23 + OpStore %FragColor %24 + %28 = OpLoad %v2float %vUV + %33 = OpImageSampleImplicitLod %v4float %19 %28 ConstOffset %32 + %34 = OpLoad %v4float %FragColor + %35 = OpFAdd %v4float %34 %33 + OpStore %FragColor %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/complex-name-workarounds.asm.frag b/third_party/spirv-cross/shaders/asm/frag/complex-name-workarounds.asm.frag new file mode 100644 index 0000000000..59a67730a6 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/complex-name-workarounds.asm.frag @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %a %b %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %func__vf4_ "fu__nc_" + OpName %a_ "a_" + OpName %func_2_vf4_ "fu__nc_" + OpName %a_2 "___" + OpName %c0 "___" + OpName %a "__" + OpName %b "a" + OpName %param "b" + OpName %c1 "b" + OpName %param_0 "b" + OpName %FragColor "b" + OpDecorate %a Location 0 + OpDecorate %b Location 1 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %9 = OpTypeFunction %v4float %_ptr_Function_v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %a = OpVariable %_ptr_Input_v4float Input + %b = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %c0 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_v4float Function + %c1 = OpVariable %_ptr_Function_v4float Function + %param_0 = OpVariable %_ptr_Function_v4float Function + %25 = OpLoad %v4float %a + %27 = OpLoad %v4float %b + %28 = OpFAdd %v4float %25 %27 + %30 = OpLoad %v4float %a + OpStore %param %30 + %31 = OpFunctionCall %v4float %func__vf4_ %param + %32 = OpFAdd %v4float %28 %31 + OpStore %c0 %32 + %34 = OpLoad %v4float %a + %35 = OpLoad %v4float %b + %36 = OpFSub %v4float %34 %35 + %38 = OpLoad %v4float %b + OpStore %param_0 %38 + %39 = OpFunctionCall %v4float %func_2_vf4_ %param_0 + %40 = OpFAdd %v4float %36 %39 + OpStore %c1 %40 + %43 = OpLoad %v4float %c0 + OpStore %FragColor %43 + %44 = OpLoad %v4float %c1 + OpStore %FragColor %44 + %45 = OpLoad %v4float %c0 + OpStore %FragColor %45 + %46 = OpLoad %v4float %c1 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd + %func__vf4_ = OpFunction %v4float None %9 + %a_ = OpFunctionParameter %_ptr_Function_v4float + %12 = OpLabel + %16 = OpLoad %v4float %a_ + OpReturnValue %16 + OpFunctionEnd +%func_2_vf4_ = OpFunction %v4float None %9 + %a_2 = OpFunctionParameter %_ptr_Function_v4float + %15 = OpLabel + %19 = OpLoad %v4float %a_2 + OpReturnValue %19 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag b/third_party/spirv-cross/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag new file mode 100644 index 0000000000..f33c48617a --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/composite-construct-struct-no-swizzle.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 39 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %foo %FooOut + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %foo "foo" + OpName %SwizzleTest "SwizzleTest" + OpMemberName %SwizzleTest 0 "a" + OpMemberName %SwizzleTest 1 "b" + OpName %FooOut "FooOut" + OpDecorate %foo RelaxedPrecision + OpDecorate %foo Location 0 + OpDecorate %12 RelaxedPrecision + OpMemberDecorate %SwizzleTest 0 RelaxedPrecision + OpMemberDecorate %SwizzleTest 1 RelaxedPrecision + OpDecorate %FooOut RelaxedPrecision + OpDecorate %FooOut Location 0 + OpDecorate %34 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float + %foo = OpVariable %_ptr_Input_v2float Input +%SwizzleTest = OpTypeStruct %float %float +%_ptr_Function_SwizzleTest = OpTypePointer Function %SwizzleTest + %uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %FooOut = OpVariable %_ptr_Output_float Output + %int = OpTypeInt 32 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v2float %foo + %36 = OpCompositeExtract %float %12 0 + %38 = OpCompositeExtract %float %12 1 + %test0 = OpCompositeConstruct %SwizzleTest %36 %38 + %new0 = OpCompositeExtract %float %test0 0 + %new1 = OpCompositeExtract %float %test0 1 + %34 = OpFAdd %float %new0 %new1 + OpStore %FooOut %34 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/default-member-names.asm.frag b/third_party/spirv-cross/shaders/asm/frag/default-member-names.asm.frag new file mode 100644 index 0000000000..ba493c0f91 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/default-member-names.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 43 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpDecorate %3 Location 0 + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %12 = OpTypeFunction %v4float + %_struct_5 = OpTypeStruct %float + %_struct_6 = OpTypeStruct %float %float %float %float %float %float %float %float %float %float %float %float %_struct_5 +%_ptr_Function__struct_6 = OpTypePointer Function %_struct_6 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %2 = OpFunction %void None %9 + %22 = OpLabel + %23 = OpVariable %_ptr_Function__struct_6 Function + %24 = OpAccessChain %_ptr_Function_float %23 %int_0 + %25 = OpLoad %float %24 + %26 = OpAccessChain %_ptr_Function_float %23 %int_1 + %27 = OpLoad %float %26 + %28 = OpAccessChain %_ptr_Function_float %23 %int_2 + %29 = OpLoad %float %28 + %30 = OpAccessChain %_ptr_Function_float %23 %int_3 + %31 = OpLoad %float %30 + %32 = OpCompositeConstruct %v4float %25 %27 %29 %31 + OpStore %3 %32 + OpReturn + OpFunctionEnd + %4 = OpFunction %v4float None %12 + %33 = OpLabel + %7 = OpVariable %_ptr_Function__struct_6 Function + %34 = OpAccessChain %_ptr_Function_float %7 %int_0 + %35 = OpLoad %float %34 + %36 = OpAccessChain %_ptr_Function_float %7 %int_1 + %37 = OpLoad %float %36 + %38 = OpAccessChain %_ptr_Function_float %7 %int_2 + %39 = OpLoad %float %38 + %40 = OpAccessChain %_ptr_Function_float %7 %int_3 + %41 = OpLoad %float %40 + %42 = OpCompositeConstruct %v4float %35 %37 %39 %41 + OpReturnValue %42 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/do-while-statement-fallback.asm.frag b/third_party/spirv-cross/shaders/asm/frag/do-while-statement-fallback.asm.frag new file mode 100644 index 0000000000..08de3ef203 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/do-while-statement-fallback.asm.frag @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 35 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %foo "foo" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %float_5 = OpConstant %float 5 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %foo = OpVariable %_ptr_Function_float Function + OpStore %foo %float_1 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + OpStore %foo %float_2 + OpBranchConditional %false %10 %12 + %12 = OpLabel + OpBranch %17 + %17 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %18 + %18 = OpLabel + OpBranch %20 + %20 = OpLabel + OpStore %foo %float_3 + OpBranchConditional %false %17 %19 + %19 = OpLabel + OpBranch %22 + %22 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %23 + %23 = OpLabel + OpBranch %25 + %25 = OpLabel + OpStore %foo %float_4 + OpBranchConditional %false %22 %24 + %24 = OpLabel + OpBranch %27 + %27 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %28 + %28 = OpLabel + OpBranch %30 + %30 = OpLabel + OpStore %foo %float_5 + OpBranchConditional %false %27 %29 + %29 = OpLabel + %34 = OpLoad %float %foo + OpStore %FragColor %34 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/empty-struct.asm.frag b/third_party/spirv-cross/shaders/asm/frag/empty-struct.asm.frag new file mode 100644 index 0000000000..0efd3158cb --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/empty-struct.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 43 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %EmptyStructTest "EmptyStructTest" + OpName %GetValue "GetValue" + OpName %GetValue2 "GetValue" + OpName %self "self" + OpName %self2 "self" + OpName %emptyStruct "emptyStruct" + OpName %value "value" + OpName %EntryPoint_Main "EntryPoint_Main" + +%EmptyStructTest = OpTypeStruct +%_ptr_Function_EmptyStructTest = OpTypePointer Function %EmptyStructTest + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %5 = OpTypeFunction %float %_ptr_Function_EmptyStructTest + %6 = OpTypeFunction %float %EmptyStructTest + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %8 = OpTypeFunction %void %_ptr_Function_EmptyStructTest + %9 = OpTypeFunction %void + %float_0 = OpConstant %float 0 + + %GetValue = OpFunction %float None %5 + %self = OpFunctionParameter %_ptr_Function_EmptyStructTest + %13 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + + %GetValue2 = OpFunction %float None %6 + %self2 = OpFunctionParameter %EmptyStructTest + %14 = OpLabel + OpReturnValue %float_0 + OpFunctionEnd + +%EntryPoint_Main = OpFunction %void None %9 + %37 = OpLabel + %emptyStruct = OpVariable %_ptr_Function_EmptyStructTest Function + %18 = OpVariable %_ptr_Function_EmptyStructTest Function + %value = OpVariable %_ptr_Function_float Function + %value2 = OpCompositeConstruct %EmptyStructTest + %22 = OpFunctionCall %float %GetValue %emptyStruct + %23 = OpFunctionCall %float %GetValue2 %value2 + OpStore %value %22 + OpStore %value %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag new file mode 100644 index 0000000000..ae84b30b41 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -0,0 +1,48 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 51 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_16 = OpConstant %int 16 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %float_2 = OpConstant %float 2 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %14 + %14 = OpLabel + %50 = OpPhi %float %float_0 %5 %25 %15 + %47 = OpPhi %int %int_0 %5 %28 %15 + %22 = OpSLessThan %bool %47 %int_16 + OpLoopMerge %16 %15 None + OpBranchConditional %22 %body1 %16 + %body1 = OpLabel + %25 = OpFAdd %float %50 %float_1 + %28 = OpIAdd %int %47 %int_1 + OpBranch %15 + %15 = OpLabel + OpBranch %14 + %16 = OpLabel + %46 = OpCompositeConstruct %v4float %50 %50 %50 %50 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/frem.asm.frag b/third_party/spirv-cross/shaders/asm/frag/frem.asm.frag new file mode 100644 index 0000000000..8350c75c04 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/frem.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 16 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA RelaxedPrecision + OpDecorate %vA Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %vB RelaxedPrecision + OpDecorate %vB Location 1 + OpDecorate %14 RelaxedPrecision + OpDecorate %15 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %vA = OpVariable %_ptr_Input_v4float Input + %vB = OpVariable %_ptr_Input_v4float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %vA + %14 = OpLoad %v4float %vB + %15 = OpFRem %v4float %12 %14 + OpStore %FragColor %15 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/function-overload-alias.asm.frag b/third_party/spirv-cross/shaders/asm/frag/function-overload-alias.asm.frag new file mode 100644 index 0000000000..397aa98ce2 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/function-overload-alias.asm.frag @@ -0,0 +1,153 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 76 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %foobar_vf4_ "foo" + OpName %a "foo" + OpName %foobar_vf3_ "foo" + OpName %a_0 "foo" + OpName %foobaz_vf4_ "foo" + OpName %a_1 "foo" + OpName %foobaz_vf2_ "foo" + OpName %a_2 "foo" + OpName %a_3 "foo" + OpName %param "foo" + OpName %b "foo" + OpName %param_0 "foo" + OpName %c "foo" + OpName %param_1 "foo" + OpName %d "foo" + OpName %param_2 "foo" + OpName %FragColor "FragColor" + OpDecorate %foobar_vf4_ RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %foobar_vf3_ RelaxedPrecision + OpDecorate %a_0 RelaxedPrecision + OpDecorate %foobaz_vf4_ RelaxedPrecision + OpDecorate %a_1 RelaxedPrecision + OpDecorate %foobaz_vf2_ RelaxedPrecision + OpDecorate %a_2 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %30 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %49 RelaxedPrecision + OpDecorate %a_3 RelaxedPrecision + OpDecorate %55 RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %59 RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %d RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %74 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %9 = OpTypeFunction %v4float %_ptr_Function_v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %15 = OpTypeFunction %v4float %_ptr_Function_v3float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %24 = OpTypeFunction %v4float %_ptr_Function_v2float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %53 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %57 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %64 = OpConstantComposite %v2float %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a_3 = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_v4float Function + %b = OpVariable %_ptr_Function_v4float Function + %param_0 = OpVariable %_ptr_Function_v3float Function + %c = OpVariable %_ptr_Function_v4float Function + %param_1 = OpVariable %_ptr_Function_v4float Function + %d = OpVariable %_ptr_Function_v4float Function + %param_2 = OpVariable %_ptr_Function_v2float Function + OpStore %param %53 + %55 = OpFunctionCall %v4float %foobar_vf4_ %param + OpStore %a_3 %55 + OpStore %param_0 %57 + %59 = OpFunctionCall %v4float %foobar_vf3_ %param_0 + OpStore %b %59 + OpStore %param_1 %53 + %62 = OpFunctionCall %v4float %foobaz_vf4_ %param_1 + OpStore %c %62 + OpStore %param_2 %64 + %66 = OpFunctionCall %v4float %foobaz_vf2_ %param_2 + OpStore %d %66 + %69 = OpLoad %v4float %a_3 + %70 = OpLoad %v4float %b + %71 = OpFAdd %v4float %69 %70 + %72 = OpLoad %v4float %c + %73 = OpFAdd %v4float %71 %72 + %74 = OpLoad %v4float %d + %75 = OpFAdd %v4float %73 %74 + OpStore %FragColor %75 + OpReturn + OpFunctionEnd +%foobar_vf4_ = OpFunction %v4float None %9 + %a = OpFunctionParameter %_ptr_Function_v4float + %12 = OpLabel + %28 = OpLoad %v4float %a + %30 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %31 = OpFAdd %v4float %28 %30 + OpReturnValue %31 + OpFunctionEnd +%foobar_vf3_ = OpFunction %v4float None %15 + %a_0 = OpFunctionParameter %_ptr_Function_v3float + %18 = OpLabel + %34 = OpLoad %v3float %a_0 + %35 = OpVectorShuffle %v4float %34 %34 0 1 2 2 + %36 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 + %37 = OpFAdd %v4float %35 %36 + OpReturnValue %37 + OpFunctionEnd +%foobaz_vf4_ = OpFunction %v4float None %9 + %a_1 = OpFunctionParameter %_ptr_Function_v4float + %21 = OpLabel + %40 = OpLoad %v4float %a_1 + %42 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %43 = OpFAdd %v4float %40 %42 + OpReturnValue %43 + OpFunctionEnd +%foobaz_vf2_ = OpFunction %v4float None %24 + %a_2 = OpFunctionParameter %_ptr_Function_v2float + %27 = OpLabel + %46 = OpLoad %v2float %a_2 + %47 = OpVectorShuffle %v4float %46 %46 0 1 0 1 + %48 = OpCompositeConstruct %v4float %float_2 %float_2 %float_2 %float_2 + %49 = OpFAdd %v4float %47 %48 + OpReturnValue %49 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag b/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag new file mode 100644 index 0000000000..75ce80bfd4 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero-cube.asm.frag @@ -0,0 +1,60 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 38 +; Schema: 0 + 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 %_main_ "@main(" + OpName %pointLightShadowMap "pointLightShadowMap" + OpName %shadowSamplerPCF "shadowSamplerPCF" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %pointLightShadowMap DescriptorSet 0 + OpDecorate %shadowSamplerPCF DescriptorSet 0 + OpDecorate %pointLightShadowMap Binding 0 + OpDecorate %shadowSamplerPCF Binding 1 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float + %10 = OpTypeImage %float Cube 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 +%pointLightShadowMap = OpVariable %_ptr_UniformConstant_10 UniformConstant + %14 = OpTypeSampler +%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14 +%shadowSamplerPCF = OpVariable %_ptr_UniformConstant_14 UniformConstant + %18 = OpTypeImage %float Cube 1 0 0 1 Unknown + %19 = OpTypeSampledImage %18 + %v3float = OpTypeVector %float 3 + %float_0_1 = OpConstant %float 0.1 + %23 = OpConstantComposite %v3float %float_0_1 %float_0_1 %float_0_1 + %float_0_5 = OpConstant %float 0.5 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 +%_ptr_Output_float = OpTypePointer Output %float +%_entryPointOutput = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %37 = OpFunctionCall %float %_main_ + OpStore %_entryPointOutput %37 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %float None %7 + %9 = OpLabel + %13 = OpLoad %10 %pointLightShadowMap + %17 = OpLoad %14 %shadowSamplerPCF + %20 = OpSampledImage %19 %13 %17 + %26 = OpCompositeExtract %float %23 0 + %27 = OpCompositeExtract %float %23 1 + %28 = OpCompositeExtract %float %23 2 + %29 = OpCompositeConstruct %v4float %26 %27 %28 %float_0_5 + %31 = OpCompositeExtract %float %29 3 + %32 = OpImageSampleDrefExplicitLod %float %20 %29 %31 Lod %float_0 + OpReturnValue %32 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag b/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag new file mode 100644 index 0000000000..bb0a1ea313 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/hlsl-sample-cmp-level-zero.asm.frag @@ -0,0 +1,115 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 70 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %texCoords_1 %cascadeIndex_1 %fragDepth_1 %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %_main_vf2_f1_f1_ "@main(vf2;f1;f1;" + OpName %texCoords "texCoords" + OpName %cascadeIndex "cascadeIndex" + OpName %fragDepth "fragDepth" + OpName %c "c" + OpName %ShadowMap "ShadowMap" + OpName %ShadowSamplerPCF "ShadowSamplerPCF" + OpName %texCoords_0 "texCoords" + OpName %texCoords_1 "texCoords" + OpName %cascadeIndex_0 "cascadeIndex" + OpName %cascadeIndex_1 "cascadeIndex" + OpName %fragDepth_0 "fragDepth" + OpName %fragDepth_1 "fragDepth" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpDecorate %ShadowMap DescriptorSet 0 + OpDecorate %ShadowSamplerPCF DescriptorSet 0 + OpDecorate %ShadowMap Binding 0 + OpDecorate %ShadowSamplerPCF Binding 1 + OpDecorate %texCoords_1 Location 0 + OpDecorate %cascadeIndex_1 Location 1 + OpDecorate %fragDepth_1 Location 2 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 + %11 = OpTypeFunction %v4float %_ptr_Function_v2float %_ptr_Function_float %_ptr_Function_float + %18 = OpTypeImage %float 2D 0 1 0 1 Unknown +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 + %ShadowMap = OpVariable %_ptr_UniformConstant_18 UniformConstant + %22 = OpTypeSampler +%_ptr_UniformConstant_22 = OpTypePointer UniformConstant %22 +%ShadowSamplerPCF = OpVariable %_ptr_UniformConstant_22 UniformConstant + %26 = OpTypeImage %float 2D 1 1 0 1 Unknown + %27 = OpTypeSampledImage %26 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords_1 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_float = OpTypePointer Input %float +%cascadeIndex_1 = OpVariable %_ptr_Input_float Input +%fragDepth_1 = OpVariable %_ptr_Input_float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel +%texCoords_0 = OpVariable %_ptr_Function_v2float Function +%cascadeIndex_0 = OpVariable %_ptr_Function_float Function +%fragDepth_0 = OpVariable %_ptr_Function_float Function + %param = OpVariable %_ptr_Function_v2float Function + %param_0 = OpVariable %_ptr_Function_float Function + %param_1 = OpVariable %_ptr_Function_float Function + %53 = OpLoad %v2float %texCoords_1 + OpStore %texCoords_0 %53 + %57 = OpLoad %float %cascadeIndex_1 + OpStore %cascadeIndex_0 %57 + %60 = OpLoad %float %fragDepth_1 + OpStore %fragDepth_0 %60 + %64 = OpLoad %v2float %texCoords_0 + OpStore %param %64 + %66 = OpLoad %float %cascadeIndex_0 + OpStore %param_0 %66 + %68 = OpLoad %float %fragDepth_0 + OpStore %param_1 %68 + %69 = OpFunctionCall %v4float %_main_vf2_f1_f1_ %param %param_0 %param_1 + OpStore %_entryPointOutput %69 + OpReturn + OpFunctionEnd +%_main_vf2_f1_f1_ = OpFunction %v4float None %11 + %texCoords = OpFunctionParameter %_ptr_Function_v2float +%cascadeIndex = OpFunctionParameter %_ptr_Function_float + %fragDepth = OpFunctionParameter %_ptr_Function_float + %16 = OpLabel + %c = OpVariable %_ptr_Function_float Function + %21 = OpLoad %18 %ShadowMap + %25 = OpLoad %22 %ShadowSamplerPCF + %28 = OpSampledImage %27 %21 %25 + %29 = OpLoad %v2float %texCoords + %30 = OpLoad %float %cascadeIndex + %32 = OpCompositeExtract %float %29 0 + %33 = OpCompositeExtract %float %29 1 + %34 = OpCompositeConstruct %v3float %32 %33 %30 + %35 = OpLoad %float %fragDepth + %36 = OpCompositeExtract %float %34 0 + %37 = OpCompositeExtract %float %34 1 + %38 = OpCompositeExtract %float %34 2 + %39 = OpCompositeConstruct %v4float %36 %37 %38 %35 + %41 = OpCompositeExtract %float %39 3 + %42 = OpImageSampleDrefExplicitLod %float %28 %39 %41 Lod %float_0 + OpStore %c %42 + %43 = OpLoad %float %c + %44 = OpLoad %float %c + %45 = OpLoad %float %c + %46 = OpLoad %float %c + %47 = OpCompositeConstruct %v4float %43 %44 %45 %46 + OpReturnValue %47 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/image-extract-reuse.asm.frag b/third_party/spirv-cross/shaders/asm/frag/image-extract-reuse.asm.frag new file mode 100644 index 0000000000..63c8ab57a5 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/image-extract-reuse.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %Size + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %Size "Size" + OpName %uTexture "uTexture" + OpDecorate %Size Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Output_v2int = OpTypePointer Output %v2int + %Size = OpVariable %_ptr_Output_v2int Output + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %17 = OpImage %11 %15 + %18 = OpImageQuerySizeLod %v2int %17 %int_0 + %19 = OpImageQuerySizeLod %v2int %17 %int_1 + %20 = OpIAdd %v2int %18 %19 + OpStore %Size %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag b/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag new file mode 100644 index 0000000000..a3d64c09d7 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.asm.vk.frag @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %xIn_1 %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %sample_fetch_t21_vi3_ "sample_fetch(t21;vi3;" + OpName %tex "tex" + OpName %UV "UV" + OpName %sample_sampler_t21_vf2_ "sample_sampler(t21;vf2;" + OpName %tex_0 "tex" + OpName %UV_0 "UV" + OpName %_main_vf4_ "@main(vf4;" + OpName %xIn "xIn" + OpName %Sampler "Sampler" + OpName %coord "coord" + OpName %value "value" + OpName %SampledImage "SampledImage" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %xIn_0 "xIn" + OpName %xIn_1 "xIn" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param_3 "param" + OpDecorate %Sampler DescriptorSet 0 + OpDecorate %Sampler Binding 0 + OpDecorate %SampledImage DescriptorSet 0 + OpDecorate %SampledImage Binding 0 + OpDecorate %xIn_1 BuiltIn FragCoord + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_Function_7 = OpTypePointer Function %7 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4float = OpTypeVector %float 4 + %13 = OpTypeFunction %v4float %_ptr_Function_7 %_ptr_Function_v3int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpTypeFunction %v4float %_ptr_Function_7 %_ptr_Function_v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpTypeFunction %v4float %_ptr_Function_v4float + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Function_int = OpTypePointer Function %int + %43 = OpTypeSampler +%_ptr_UniformConstant_43 = OpTypePointer UniformConstant %43 + %Sampler = OpVariable %_ptr_UniformConstant_43 UniformConstant + %47 = OpTypeSampledImage %7 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1280 = OpConstant %float 1280 + %uint_1 = OpConstant %uint 1 + %float_720 = OpConstant %float 720 + %int_0 = OpConstant %int 0 +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%SampledImage = OpVariable %_ptr_UniformConstant_7 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float + %xIn_1 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %xIn_0 = OpVariable %_ptr_Function_v4float Function + %param_3 = OpVariable %_ptr_Function_v4float Function + %107 = OpLoad %v4float %xIn_1 + OpStore %xIn_0 %107 + %111 = OpLoad %v4float %xIn_0 + OpStore %param_3 %111 + %112 = OpFunctionCall %v4float %_main_vf4_ %param_3 + OpStore %_entryPointOutput %112 + OpReturn + OpFunctionEnd +%sample_fetch_t21_vi3_ = OpFunction %v4float None %13 + %tex = OpFunctionParameter %_ptr_Function_7 + %UV = OpFunctionParameter %_ptr_Function_v3int + %17 = OpLabel + %30 = OpLoad %7 %tex + %32 = OpLoad %v3int %UV + %33 = OpVectorShuffle %v2int %32 %32 0 1 + %37 = OpAccessChain %_ptr_Function_int %UV %uint_2 + %38 = OpLoad %int %37 + %39 = OpImageFetch %v4float %30 %33 Lod %38 + OpReturnValue %39 + OpFunctionEnd +%sample_sampler_t21_vf2_ = OpFunction %v4float None %20 + %tex_0 = OpFunctionParameter %_ptr_Function_7 + %UV_0 = OpFunctionParameter %_ptr_Function_v2float + %24 = OpLabel + %42 = OpLoad %7 %tex_0 + %46 = OpLoad %43 %Sampler + %48 = OpSampledImage %47 %42 %46 + %49 = OpLoad %v2float %UV_0 + %50 = OpImageSampleImplicitLod %v4float %48 %49 + OpReturnValue %50 + OpFunctionEnd + %_main_vf4_ = OpFunction %v4float None %26 + %xIn = OpFunctionParameter %_ptr_Function_v4float + %29 = OpLabel + %coord = OpVariable %_ptr_Function_v3int Function + %value = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_7 Function + %param_0 = OpVariable %_ptr_Function_v3int Function + %param_1 = OpVariable %_ptr_Function_7 Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %56 = OpAccessChain %_ptr_Function_float %xIn %uint_0 + %57 = OpLoad %float %56 + %59 = OpFMul %float %57 %float_1280 + %60 = OpConvertFToS %int %59 + %62 = OpAccessChain %_ptr_Function_float %xIn %uint_1 + %63 = OpLoad %float %62 + %65 = OpFMul %float %63 %float_720 + %66 = OpConvertFToS %int %65 + %68 = OpCompositeConstruct %v3int %60 %66 %int_0 + OpStore %coord %68 + %73 = OpLoad %7 %SampledImage + OpStore %param %73 + %75 = OpLoad %v3int %coord + OpStore %param_0 %75 + %76 = OpFunctionCall %v4float %sample_fetch_t21_vi3_ %param %param_0 + OpStore %value %76 + %77 = OpLoad %7 %SampledImage + %78 = OpLoad %v3int %coord + %79 = OpVectorShuffle %v2int %78 %78 0 1 + %80 = OpAccessChain %_ptr_Function_int %coord %uint_2 + %81 = OpLoad %int %80 + %82 = OpImageFetch %v4float %77 %79 Lod %81 + %83 = OpLoad %v4float %value + %84 = OpFAdd %v4float %83 %82 + OpStore %value %84 + %86 = OpLoad %7 %SampledImage + OpStore %param_1 %86 + %88 = OpLoad %v4float %xIn + %89 = OpVectorShuffle %v2float %88 %88 0 1 + OpStore %param_2 %89 + %90 = OpFunctionCall %v4float %sample_sampler_t21_vf2_ %param_1 %param_2 + %91 = OpLoad %v4float %value + %92 = OpFAdd %v4float %91 %90 + OpStore %value %92 + %93 = OpLoad %7 %SampledImage + %94 = OpLoad %43 %Sampler + %95 = OpSampledImage %47 %93 %94 + %96 = OpLoad %v4float %xIn + %97 = OpVectorShuffle %v2float %96 %96 0 1 + %98 = OpImageSampleImplicitLod %v4float %95 %97 + %99 = OpLoad %v4float %value + %100 = OpFAdd %v4float %99 %98 + OpStore %value %100 + %101 = OpLoad %v4float %value + OpReturnValue %101 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag b/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag new file mode 100644 index 0000000000..a3d64c09d7 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/image-fetch-no-sampler.no-samplerless.asm.vk.frag @@ -0,0 +1,163 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 113 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %xIn_1 %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %sample_fetch_t21_vi3_ "sample_fetch(t21;vi3;" + OpName %tex "tex" + OpName %UV "UV" + OpName %sample_sampler_t21_vf2_ "sample_sampler(t21;vf2;" + OpName %tex_0 "tex" + OpName %UV_0 "UV" + OpName %_main_vf4_ "@main(vf4;" + OpName %xIn "xIn" + OpName %Sampler "Sampler" + OpName %coord "coord" + OpName %value "value" + OpName %SampledImage "SampledImage" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpName %param_2 "param" + OpName %xIn_0 "xIn" + OpName %xIn_1 "xIn" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param_3 "param" + OpDecorate %Sampler DescriptorSet 0 + OpDecorate %Sampler Binding 0 + OpDecorate %SampledImage DescriptorSet 0 + OpDecorate %SampledImage Binding 0 + OpDecorate %xIn_1 BuiltIn FragCoord + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_Function_7 = OpTypePointer Function %7 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int + %v4float = OpTypeVector %float 4 + %13 = OpTypeFunction %v4float %_ptr_Function_7 %_ptr_Function_v3int + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %20 = OpTypeFunction %v4float %_ptr_Function_7 %_ptr_Function_v2float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %26 = OpTypeFunction %v4float %_ptr_Function_v4float + %v2int = OpTypeVector %int 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_ptr_Function_int = OpTypePointer Function %int + %43 = OpTypeSampler +%_ptr_UniformConstant_43 = OpTypePointer UniformConstant %43 + %Sampler = OpVariable %_ptr_UniformConstant_43 UniformConstant + %47 = OpTypeSampledImage %7 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_1280 = OpConstant %float 1280 + %uint_1 = OpConstant %uint 1 + %float_720 = OpConstant %float 720 + %int_0 = OpConstant %int 0 +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 +%SampledImage = OpVariable %_ptr_UniformConstant_7 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float + %xIn_1 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %xIn_0 = OpVariable %_ptr_Function_v4float Function + %param_3 = OpVariable %_ptr_Function_v4float Function + %107 = OpLoad %v4float %xIn_1 + OpStore %xIn_0 %107 + %111 = OpLoad %v4float %xIn_0 + OpStore %param_3 %111 + %112 = OpFunctionCall %v4float %_main_vf4_ %param_3 + OpStore %_entryPointOutput %112 + OpReturn + OpFunctionEnd +%sample_fetch_t21_vi3_ = OpFunction %v4float None %13 + %tex = OpFunctionParameter %_ptr_Function_7 + %UV = OpFunctionParameter %_ptr_Function_v3int + %17 = OpLabel + %30 = OpLoad %7 %tex + %32 = OpLoad %v3int %UV + %33 = OpVectorShuffle %v2int %32 %32 0 1 + %37 = OpAccessChain %_ptr_Function_int %UV %uint_2 + %38 = OpLoad %int %37 + %39 = OpImageFetch %v4float %30 %33 Lod %38 + OpReturnValue %39 + OpFunctionEnd +%sample_sampler_t21_vf2_ = OpFunction %v4float None %20 + %tex_0 = OpFunctionParameter %_ptr_Function_7 + %UV_0 = OpFunctionParameter %_ptr_Function_v2float + %24 = OpLabel + %42 = OpLoad %7 %tex_0 + %46 = OpLoad %43 %Sampler + %48 = OpSampledImage %47 %42 %46 + %49 = OpLoad %v2float %UV_0 + %50 = OpImageSampleImplicitLod %v4float %48 %49 + OpReturnValue %50 + OpFunctionEnd + %_main_vf4_ = OpFunction %v4float None %26 + %xIn = OpFunctionParameter %_ptr_Function_v4float + %29 = OpLabel + %coord = OpVariable %_ptr_Function_v3int Function + %value = OpVariable %_ptr_Function_v4float Function + %param = OpVariable %_ptr_Function_7 Function + %param_0 = OpVariable %_ptr_Function_v3int Function + %param_1 = OpVariable %_ptr_Function_7 Function + %param_2 = OpVariable %_ptr_Function_v2float Function + %56 = OpAccessChain %_ptr_Function_float %xIn %uint_0 + %57 = OpLoad %float %56 + %59 = OpFMul %float %57 %float_1280 + %60 = OpConvertFToS %int %59 + %62 = OpAccessChain %_ptr_Function_float %xIn %uint_1 + %63 = OpLoad %float %62 + %65 = OpFMul %float %63 %float_720 + %66 = OpConvertFToS %int %65 + %68 = OpCompositeConstruct %v3int %60 %66 %int_0 + OpStore %coord %68 + %73 = OpLoad %7 %SampledImage + OpStore %param %73 + %75 = OpLoad %v3int %coord + OpStore %param_0 %75 + %76 = OpFunctionCall %v4float %sample_fetch_t21_vi3_ %param %param_0 + OpStore %value %76 + %77 = OpLoad %7 %SampledImage + %78 = OpLoad %v3int %coord + %79 = OpVectorShuffle %v2int %78 %78 0 1 + %80 = OpAccessChain %_ptr_Function_int %coord %uint_2 + %81 = OpLoad %int %80 + %82 = OpImageFetch %v4float %77 %79 Lod %81 + %83 = OpLoad %v4float %value + %84 = OpFAdd %v4float %83 %82 + OpStore %value %84 + %86 = OpLoad %7 %SampledImage + OpStore %param_1 %86 + %88 = OpLoad %v4float %xIn + %89 = OpVectorShuffle %v2float %88 %88 0 1 + OpStore %param_2 %89 + %90 = OpFunctionCall %v4float %sample_sampler_t21_vf2_ %param_1 %param_2 + %91 = OpLoad %v4float %value + %92 = OpFAdd %v4float %91 %90 + OpStore %value %92 + %93 = OpLoad %7 %SampledImage + %94 = OpLoad %43 %Sampler + %95 = OpSampledImage %47 %93 %94 + %96 = OpLoad %v4float %xIn + %97 = OpVectorShuffle %v2float %96 %96 0 1 + %98 = OpImageSampleImplicitLod %v4float %95 %97 + %99 = OpLoad %v4float %value + %100 = OpFAdd %v4float %99 %98 + OpStore %value %100 + %101 = OpLoad %v4float %value + OpReturnValue %101 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag b/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag new file mode 100644 index 0000000000..a232bd4898 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.no-samplerless.vk.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %b "b" + OpName %uSampler2D "uSampler2D" + OpName %c "c" + OpName %uSampler2DMS "uSampler2DMS" + OpName %l1 "l1" + OpName %s0 "s0" + OpDecorate %uSampler2D DescriptorSet 0 + OpDecorate %uSampler2D Binding 0 + OpDecorate %uSampler2DMS DescriptorSet 0 + OpDecorate %uSampler2DMS Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %11 + %uSampler2D = OpVariable %_ptr_UniformConstant_12 UniformConstant + %int_0 = OpConstant %int 0 + %20 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %20 +%uSampler2DMS = OpVariable %_ptr_UniformConstant_21 UniformConstant +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %5 = OpLabel + %b = OpVariable %_ptr_Function_v2int Function + %c = OpVariable %_ptr_Function_v2int Function + %l1 = OpVariable %_ptr_Function_int Function + %s0 = OpVariable %_ptr_Function_int Function + %15 = OpLoad %11 %uSampler2D + %18 = OpImageQuerySizeLod %v2int %15 %int_0 + OpStore %b %18 + %24 = OpLoad %20 %uSampler2DMS + %26 = OpImageQuerySize %v2int %24 + OpStore %c %26 + %29 = OpLoad %11 %uSampler2D + %31 = OpImageQueryLevels %int %29 + OpStore %l1 %31 + %33 = OpLoad %20 %uSampler2DMS + %35 = OpImageQuerySamples %int %33 + OpStore %s0 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.vk.asm.frag b/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.vk.asm.frag new file mode 100644 index 0000000000..a232bd4898 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/image-query-no-sampler.vk.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %b "b" + OpName %uSampler2D "uSampler2D" + OpName %c "c" + OpName %uSampler2DMS "uSampler2DMS" + OpName %l1 "l1" + OpName %s0 "s0" + OpDecorate %uSampler2D DescriptorSet 0 + OpDecorate %uSampler2D Binding 0 + OpDecorate %uSampler2DMS DescriptorSet 0 + OpDecorate %uSampler2DMS Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 +%_ptr_Function_v2int = OpTypePointer Function %v2int + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %11 + %uSampler2D = OpVariable %_ptr_UniformConstant_12 UniformConstant + %int_0 = OpConstant %int 0 + %20 = OpTypeImage %float 2D 0 0 1 1 Unknown +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %20 +%uSampler2DMS = OpVariable %_ptr_UniformConstant_21 UniformConstant +%_ptr_Function_int = OpTypePointer Function %int + %main = OpFunction %void None %3 + %5 = OpLabel + %b = OpVariable %_ptr_Function_v2int Function + %c = OpVariable %_ptr_Function_v2int Function + %l1 = OpVariable %_ptr_Function_int Function + %s0 = OpVariable %_ptr_Function_int Function + %15 = OpLoad %11 %uSampler2D + %18 = OpImageQuerySizeLod %v2int %15 %int_0 + OpStore %b %18 + %24 = OpLoad %20 %uSampler2DMS + %26 = OpImageQuerySize %v2int %24 + OpStore %c %26 + %29 = OpLoad %11 %uSampler2D + %31 = OpImageQueryLevels %int %29 + OpStore %l1 %31 + %33 = OpLoad %20 %uSampler2DMS + %35 = OpImageQuerySamples %int %33 + OpStore %s0 %35 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/implicit-read-dep-phi.asm.frag b/third_party/spirv-cross/shaders/asm/frag/implicit-read-dep-phi.asm.frag new file mode 100644 index 0000000000..ccdfeef58d --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/implicit-read-dep-phi.asm.frag @@ -0,0 +1,81 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 60 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %v0 %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %phi "phi" + OpName %i "i" + OpName %v0 "v0" + OpName %FragColor "FragColor" + OpName %uImage "uImage" + OpDecorate %v0 Location 0 + OpDecorate %FragColor Location 0 + OpDecorate %uImage DescriptorSet 0 + OpDecorate %uImage Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %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 + %v0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %36 = OpTypeImage %float 2D 0 0 0 1 Unknown + %37 = OpTypeSampledImage %36 +%_ptr_UniformConstant_37 = OpTypePointer UniformConstant %37 + %uImage = OpVariable %_ptr_UniformConstant_37 UniformConstant + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float_2 = OpConstant %float 2 + %int_1 = OpConstant %int 1 + %float_1_vec = OpConstantComposite %v4float %float_1 %float_2 %float_1 %float_2 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %i %int_0 + OpBranch %loop_header + %loop_header = OpLabel + %phi = OpPhi %float %float_1 %5 %phi_plus_2 %continue_block + %tex_phi = OpPhi %v4float %float_1_vec %5 %texture_load_result %continue_block + OpLoopMerge %merge_block %continue_block None + OpBranch %loop_body + %loop_body = OpLabel + OpStore %FragColor %tex_phi + %19 = OpLoad %int %i + %22 = OpSLessThan %bool %19 %int_4 + OpBranchConditional %22 %15 %merge_block + %15 = OpLabel + %26 = OpLoad %int %i + %28 = OpAccessChain %_ptr_Input_float %v0 %26 + %29 = OpLoad %float %28 + %31 = OpFOrdGreaterThan %bool %29 %float_0 + OpBranchConditional %31 %continue_block %merge_block + %continue_block = OpLabel + %40 = OpLoad %37 %uImage + %43 = OpCompositeConstruct %v2float %phi %phi + %texture_load_result = OpImageSampleExplicitLod %v4float %40 %43 Lod %float_0 + %phi_plus_2 = OpFAdd %float %phi %float_2 + %54 = OpLoad %int %i + %56 = OpIAdd %int %54 %int_1 + OpStore %i %56 + OpBranch %loop_header + %merge_block = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant-double.asm.frag b/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant-double.asm.frag new file mode 100644 index 0000000000..2d0c18a9d3 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant-double.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 22 +; Schema: 0 + OpCapability Shader + OpCapability Float64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vTmp + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vTmp "vTmp" + OpDecorate %FragColor Location 0 + OpDecorate %vTmp Flat + OpDecorate %vTmp Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %FragColor = OpVariable %_ptr_Output_v3float Output + %double = OpTypeFloat 64 + %v3double = OpTypeVector %double 3 +%double_0x1p_1024 = OpConstant %double 0x1p+1024 +%double_n0x1p_1024 = OpConstant %double -0x1p+1024 +%double_0x1_8p_1024 = OpConstant %double 0x1.8p+1024 + %15 = OpConstantComposite %v3double %double_0x1p_1024 %double_n0x1p_1024 %double_0x1_8p_1024 +%_ptr_Input_double = OpTypePointer Input %double + %vTmp = OpVariable %_ptr_Input_double Input + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %double %vTmp + %19 = OpCompositeConstruct %v3double %18 %18 %18 + %20 = OpFAdd %v3double %15 %19 + %21 = OpFConvert %v3float %20 + OpStore %FragColor %21 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant.asm.frag b/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant.asm.frag new file mode 100644 index 0000000000..40e5d3a89c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/inf-nan-constant.asm.frag @@ -0,0 +1,29 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 14 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %FragColor = OpVariable %_ptr_Output_v3float Output +%float_0x1p_128 = OpConstant %float 0x1p+128 +%float_n0x1p_128 = OpConstant %float -0x1p+128 +%float_0x1_8p_128 = OpConstant %float 0x1.8p+128 + %13 = OpConstantComposite %v3float %float_0x1p_128 %float_n0x1p_128 %float_0x1_8p_128 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %FragColor %13 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/invalidation.asm.frag b/third_party/spirv-cross/shaders/asm/frag/invalidation.asm.frag new file mode 100644 index 0000000000..8e753d50fe --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/invalidation.asm.frag @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %v0 %v1 %FragColor + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 450 + OpName %4 "main" + OpName %a "a" + OpName %v0 "v0" + OpName %b "b" + OpName %v1 "v1" + OpName %FragColor "FragColor" + OpDecorate %v0 Location 0 + OpDecorate %v1 Location 1 + OpDecorate %FragColor Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %float = OpTypeFloat 32 + %pfloat = OpTypePointer Function %float + %9 = OpTypePointer Input %float + %v0 = OpVariable %9 Input + %v1 = OpVariable %9 Input + %25 = OpTypePointer Output %float + %FragColor = OpVariable %25 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %a = OpVariable %pfloat Function + %b = OpVariable %pfloat Function + %v0_tmp = OpLoad %float %v0 + %v1_tmp = OpLoad %float %v1 + OpStore %a %v0_tmp + OpStore %b %v1_tmp + + %a_tmp = OpLoad %float %a + %b_tmp = OpLoad %float %b + %res = OpFAdd %float %a_tmp %b_tmp + %res1 = OpFMul %float %res %b_tmp + OpStore %a %v1_tmp + OpStore %FragColor %res1 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/line-directive.line.asm.frag b/third_party/spirv-cross/shaders/asm/frag/line-directive.line.asm.frag new file mode 100644 index 0000000000..9e08e9a891 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/line-directive.line.asm.frag @@ -0,0 +1,221 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 7 +; Bound: 83 +; Schema: 0 + OpCapability Shader + %2 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vColor + OpExecutionMode %main OriginUpperLeft + %1 = OpString "test.frag" + OpSource GLSL 450 %1 "// OpModuleProcessed entry-point main +// OpModuleProcessed client vulkan100 +// OpModuleProcessed target-env vulkan1.0 +// OpModuleProcessed entry-point main +#line 1 +#version 450 + +layout(location = 0) in float vColor; +layout(location = 0) out float FragColor; + +void func() +{ + FragColor = 1.0; + FragColor = 2.0; + if (vColor < 0.0) + { + FragColor = 3.0; + } + else + { + FragColor = 4.0; + } + + for (int i = 0; i < 40 + vColor; i += int(vColor) + 5) + { + FragColor += 0.2; + FragColor += 0.3; + } + + switch (int(vColor)) + { + case 0: + FragColor += 0.2; + break; + + case 1: + FragColor += 0.4; + break; + + default: + FragColor += 0.8; + break; + } + + do + { + FragColor += 10.0 + vColor; + } while(FragColor < 100.0); +} + +void main() +{ + func(); +} +" + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %func_ "func(" + OpName %FragColor "FragColor" + OpName %vColor "vColor" + OpName %i "i" + OpDecorate %FragColor Location 0 + OpDecorate %vColor Location 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 +%_ptr_Input_float = OpTypePointer Input %float + %vColor = OpVariable %_ptr_Input_float Input + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %int = OpTypeInt 32 1 + + ; Should be ignored + OpLine %1 5 0 + +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float_40 = OpConstant %float 40 +%float_0_200000003 = OpConstant %float 0.200000003 +%float_0_300000012 = OpConstant %float 0.300000012 + %int_5 = OpConstant %int 5 + + ; Should be ignored + OpLine %1 5 0 + +%float_0_400000006 = OpConstant %float 0.400000006 +%float_0_800000012 = OpConstant %float 0.800000012 + %float_10 = OpConstant %float 10 + %float_100 = OpConstant %float 100 + %main = OpFunction %void None %4 + OpLine %1 46 0 + %6 = OpLabel + OpLine %1 48 0 + %82 = OpFunctionCall %void %func_ + OpReturn + OpFunctionEnd + + ; Should be ignored + OpLine %1 5 0 + + %func_ = OpFunction %void None %4 + OpLine %1 6 0 + %8 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpLine %1 8 0 + OpStore %FragColor %float_1 + OpLine %1 9 0 + OpStore %FragColor %float_2 + OpLine %1 10 0 + %16 = OpLoad %float %vColor + %19 = OpFOrdLessThan %bool %16 %float_0 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %23 + %20 = OpLabel + OpLine %1 12 0 + OpStore %FragColor %float_3 + OpBranch %21 + %23 = OpLabel + OpLine %1 16 0 + OpStore %FragColor %float_4 + OpBranch %21 + %21 = OpLabel + OpLine %1 19 0 + OpStore %i %int_0 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %int %i + %35 = OpConvertSToF %float %34 + %37 = OpLoad %float %vColor + %38 = OpFAdd %float %float_40 %37 + %39 = OpFOrdLessThan %bool %35 %38 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + OpLine %1 21 0 + %41 = OpLoad %float %FragColor + %42 = OpFAdd %float %41 %float_0_200000003 + OpStore %FragColor %42 + OpLine %1 22 0 + %44 = OpLoad %float %FragColor + %45 = OpFAdd %float %44 %float_0_300000012 + OpStore %FragColor %45 + OpBranch %32 + %32 = OpLabel + OpLine %1 19 0 + %46 = OpLoad %float %vColor + %47 = OpConvertFToS %int %46 + %49 = OpIAdd %int %47 %int_5 + %50 = OpLoad %int %i + %51 = OpIAdd %int %50 %49 + OpStore %i %51 + OpBranch %29 + %31 = OpLabel + OpLine %1 25 0 + %52 = OpLoad %float %vColor + %53 = OpConvertFToS %int %52 + OpSelectionMerge %57 None + OpSwitch %53 %56 0 %54 1 %55 + %56 = OpLabel + OpLine %1 36 0 + %66 = OpLoad %float %FragColor + %67 = OpFAdd %float %66 %float_0_800000012 + OpStore %FragColor %67 + OpLine %1 37 0 + OpBranch %57 + %54 = OpLabel + OpLine %1 28 0 + %58 = OpLoad %float %FragColor + %59 = OpFAdd %float %58 %float_0_200000003 + OpStore %FragColor %59 + OpLine %1 29 0 + OpBranch %57 + %55 = OpLabel + OpLine %1 32 0 + %62 = OpLoad %float %FragColor + %63 = OpFAdd %float %62 %float_0_400000006 + OpStore %FragColor %63 + OpLine %1 33 0 + OpBranch %57 + %57 = OpLabel + OpBranch %70 + OpLine %1 43 0 + %70 = OpLabel + OpLoopMerge %72 %73 None + OpBranch %71 + %71 = OpLabel + OpLine %1 42 0 + %75 = OpLoad %float %vColor + %76 = OpFAdd %float %float_10 %75 + %77 = OpLoad %float %FragColor + %78 = OpFAdd %float %77 %76 + OpStore %FragColor %78 + OpBranch %73 + %73 = OpLabel + OpLine %1 43 0 + %79 = OpLoad %float %FragColor + %81 = OpFOrdLessThan %bool %79 %float_100 + OpBranchConditional %81 %70 %72 + %72 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/locations-components.asm.frag b/third_party/spirv-cross/shaders/asm/frag/locations-components.asm.frag new file mode 100644 index 0000000000..16bfc525bc --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/locations-components.asm.frag @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.0 +; Generator: Wine VKD3D Shader Compiler; 0 +; Bound: 67 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %8 %16 %22 %28 %33 %o0 + OpExecutionMode %main OriginUpperLeft + OpName %main "main" + OpName %v1 "v1" + OpName %v2 "v2" + OpName %o0 "o0" + OpName %r0 "r0" + OpDecorate %8 Location 1 + OpDecorate %16 Location 1 + OpDecorate %16 Component 2 + OpDecorate %22 Location 2 + OpDecorate %22 Flat + OpDecorate %28 Location 2 + OpDecorate %28 Component 1 + OpDecorate %28 Flat + OpDecorate %33 Location 2 + OpDecorate %33 Component 2 + OpDecorate %33 Flat + OpDecorate %o0 Location 0 + %void = OpTypeVoid + %2 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %8 = OpVariable %_ptr_Input_v2float Input + %v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float + %v1 = OpVariable %_ptr_Private_v4float Private +%_ptr_Input_float = OpTypePointer Input %float + %16 = OpVariable %_ptr_Input_float Input +%_ptr_Private_float = OpTypePointer Private %float + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 + %22 = OpVariable %_ptr_Input_float Input + %v2 = OpVariable %_ptr_Private_v4float Private + %uint_0 = OpConstant %uint 0 +%_ptr_Input_uint = OpTypePointer Input %uint + %28 = OpVariable %_ptr_Input_uint Input + %uint_1 = OpConstant %uint 1 + %33 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o0 = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int = OpTypeInt 32 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_float = OpTypePointer Output %float + %main = OpFunction %void None %2 + %4 = OpLabel + %r0 = OpVariable %_ptr_Function_v4float Function + %12 = OpLoad %v2float %8 + %13 = OpLoad %v4float %v1 + %14 = OpVectorShuffle %v4float %13 %12 4 5 2 3 + OpStore %v1 %14 + %17 = OpLoad %float %16 + %21 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_2 + OpStore %21 %17 + %24 = OpLoad %float %22 + %26 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0 + OpStore %26 %24 + %29 = OpLoad %uint %28 + %30 = OpBitcast %float %29 + %32 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1 + OpStore %32 %30 + %34 = OpLoad %uint %33 + %35 = OpBitcast %float %34 + %36 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2 + OpStore %36 %35 + %42 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_1 + %43 = OpLoad %float %42 + %44 = OpBitcast %int %43 + %45 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_2 + %46 = OpLoad %float %45 + %47 = OpBitcast %int %46 + %48 = OpIAdd %int %44 %47 + %49 = OpBitcast %float %48 + %51 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + OpStore %51 %49 + %52 = OpInBoundsAccessChain %_ptr_Function_float %r0 %uint_0 + %53 = OpLoad %float %52 + %54 = OpBitcast %uint %53 + %55 = OpConvertUToF %float %54 + %57 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_1 + OpStore %57 %55 + %58 = OpInBoundsAccessChain %_ptr_Private_float %v1 %uint_1 + %59 = OpLoad %float %58 + %60 = OpInBoundsAccessChain %_ptr_Private_float %v2 %uint_0 + %61 = OpLoad %float %60 + %62 = OpFAdd %float %59 %61 + %63 = OpInBoundsAccessChain %_ptr_Output_float %o0 %uint_0 + OpStore %63 %62 + %64 = OpLoad %v4float %v1 + %65 = OpLoad %v4float %o0 + %66 = OpVectorShuffle %v4float %65 %64 0 1 6 4 + OpStore %o0 %66 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag b/third_party/spirv-cross/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag new file mode 100644 index 0000000000..fa53940b14 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/loop-body-dominator-continue-access.asm.frag @@ -0,0 +1,190 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 131 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %fragWorld_1 %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %GetClip2TexMatrix_ "GetClip2TexMatrix(" + OpName %GetCascade_vf3_ "GetCascade(vf3;" + OpName %fragWorldPosition "fragWorldPosition" + OpName %_main_vf3_ "@main(vf3;" + OpName %fragWorld "fragWorld" + OpName %Foo "Foo" + OpMemberName %Foo 0 "lightVP" + OpMemberName %Foo 1 "shadowCascadesNum" + OpMemberName %Foo 2 "test" + OpName %_ "" + OpName %cascadeIndex "cascadeIndex" + OpName %worldToShadowMap "worldToShadowMap" + OpName %fragShadowMapPos "fragShadowMapPos" + OpName %param "param" + OpName %fragWorld_0 "fragWorld" + OpName %fragWorld_1 "fragWorld" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param_0 "param" + OpDecorate %_arr_mat4v4float_uint_64 ArrayStride 64 + OpMemberDecorate %Foo 0 RowMajor + OpMemberDecorate %Foo 0 Offset 0 + OpMemberDecorate %Foo 0 MatrixStride 16 + OpMemberDecorate %Foo 1 Offset 4096 + OpMemberDecorate %Foo 2 Offset 4100 + OpDecorate %Foo Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %fragWorld_1 Location 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 + %9 = OpTypeFunction %mat4v4float + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %int = OpTypeInt 32 1 + %15 = OpTypeFunction %int %_ptr_Function_v3float + %uint = OpTypeInt 32 0 + %uint_64 = OpConstant %uint 64 +%_arr_mat4v4float_uint_64 = OpTypeArray %mat4v4float %uint_64 + %Foo = OpTypeStruct %_arr_mat4v4float_uint_64 %uint %int +%_ptr_Uniform_Foo = OpTypePointer Uniform %Foo + %_ = OpVariable %_ptr_Uniform_Foo Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_0_5 = OpConstant %float 0.5 + %float_0 = OpConstant %float 0 + %39 = OpConstantComposite %v4float %float_0_5 %float_0 %float_0 %float_0 + %40 = OpConstantComposite %v4float %float_0 %float_0_5 %float_0 %float_0 + %41 = OpConstantComposite %v4float %float_0 %float_0 %float_0_5 %float_0 + %float_1 = OpConstant %float 1 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 + %44 = OpConstantComposite %mat4v4float %39 %40 %41 %43 + %46 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0 + %47 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0 + %48 = OpConstantComposite %v4float %float_0 %float_0 %float_1 %float_0 + %49 = OpConstantComposite %mat4v4float %46 %47 %48 %43 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_0 = OpConstant %uint 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%_ptr_Uniform_mat4v4float = OpTypePointer Uniform %mat4v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint_2 = OpConstant %uint 2 +%_ptr_Function_float = OpTypePointer Function %float + %uint_1 = OpConstant %uint 1 + %int_n1 = OpConstant %int -1 +%_ptr_Input_v3float = OpTypePointer Input %v3float +%fragWorld_1 = OpVariable %_ptr_Input_v3float Input +%_ptr_Output_int = OpTypePointer Output %int +%_entryPointOutput = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %5 = OpLabel +%fragWorld_0 = OpVariable %_ptr_Function_v3float Function + %param_0 = OpVariable %_ptr_Function_v3float Function + %125 = OpLoad %v3float %fragWorld_1 + OpStore %fragWorld_0 %125 + %129 = OpLoad %v3float %fragWorld_0 + OpStore %param_0 %129 + %130 = OpFunctionCall %int %_main_vf3_ %param_0 + OpStore %_entryPointOutput %130 + OpReturn + OpFunctionEnd +%GetClip2TexMatrix_ = OpFunction %mat4v4float None %9 + %11 = OpLabel + %30 = OpAccessChain %_ptr_Uniform_int %_ %int_2 + %31 = OpLoad %int %30 + %34 = OpIEqual %bool %31 %int_0 + OpSelectionMerge %36 None + OpBranchConditional %34 %35 %36 + %35 = OpLabel + OpReturnValue %44 + %36 = OpLabel + OpReturnValue %49 + OpFunctionEnd +%GetCascade_vf3_ = OpFunction %int None %15 +%fragWorldPosition = OpFunctionParameter %_ptr_Function_v3float + %18 = OpLabel +%cascadeIndex = OpVariable %_ptr_Function_uint Function +%worldToShadowMap = OpVariable %_ptr_Function_mat4v4float Function +%fragShadowMapPos = OpVariable %_ptr_Function_v4float Function + OpStore %cascadeIndex %uint_0 + OpBranch %55 + %55 = OpLabel + OpLoopMerge %57 %58 Unroll + OpBranch %59 + %59 = OpLabel + %60 = OpLoad %uint %cascadeIndex + %63 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 + %64 = OpLoad %uint %63 + %65 = OpULessThan %bool %60 %64 + OpBranchConditional %65 %56 %57 + %56 = OpLabel + %68 = OpFunctionCall %mat4v4float %GetClip2TexMatrix_ + %69 = OpLoad %uint %cascadeIndex + %71 = OpAccessChain %_ptr_Uniform_mat4v4float %_ %int_0 %69 + %72 = OpLoad %mat4v4float %71 + %73 = OpMatrixTimesMatrix %mat4v4float %68 %72 + OpStore %worldToShadowMap %73 + %76 = OpLoad %mat4v4float %worldToShadowMap + %77 = OpLoad %v3float %fragWorldPosition + %78 = OpCompositeExtract %float %77 0 + %79 = OpCompositeExtract %float %77 1 + %80 = OpCompositeExtract %float %77 2 + %81 = OpCompositeConstruct %v4float %78 %79 %80 %float_1 + %82 = OpMatrixTimesVector %v4float %76 %81 + OpStore %fragShadowMapPos %82 + %85 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_2 + %86 = OpLoad %float %85 + %87 = OpFOrdGreaterThanEqual %bool %86 %float_0 + %88 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_2 + %89 = OpLoad %float %88 + %90 = OpFOrdLessThanEqual %bool %89 %float_1 + %91 = OpLogicalAnd %bool %87 %90 + %92 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_0 + %93 = OpLoad %float %92 + %95 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_1 + %96 = OpLoad %float %95 + %97 = OpExtInst %float %1 FMax %93 %96 + %98 = OpFOrdLessThanEqual %bool %97 %float_1 + %99 = OpLogicalAnd %bool %91 %98 + %100 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_0 + %101 = OpLoad %float %100 + %102 = OpAccessChain %_ptr_Function_float %fragShadowMapPos %uint_1 + %103 = OpLoad %float %102 + %104 = OpExtInst %float %1 FMin %101 %103 + %105 = OpFOrdGreaterThanEqual %bool %104 %float_0 + %106 = OpLogicalAnd %bool %99 %105 + OpSelectionMerge %108 None + OpBranchConditional %106 %107 %108 + %107 = OpLabel + %109 = OpLoad %uint %cascadeIndex + %110 = OpBitcast %int %109 + OpReturnValue %110 + %108 = OpLabel + OpBranch %58 + %58 = OpLabel + %112 = OpLoad %uint %cascadeIndex + %113 = OpIAdd %uint %112 %int_1 + OpStore %cascadeIndex %113 + OpBranch %55 + %57 = OpLabel + OpReturnValue %int_n1 + OpFunctionEnd + %_main_vf3_ = OpFunction %int None %15 + %fragWorld = OpFunctionParameter %_ptr_Function_v3float + %21 = OpLabel + %param = OpVariable %_ptr_Function_v3float Function + %118 = OpLoad %v3float %fragWorld + OpStore %param %118 + %119 = OpFunctionCall %int %GetCascade_vf3_ %param + OpReturnValue %119 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/loop-header-to-continue.asm.frag b/third_party/spirv-cross/shaders/asm/frag/loop-header-to-continue.asm.frag new file mode 100644 index 0000000000..54807d911c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/loop-header-to-continue.asm.frag @@ -0,0 +1,132 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 279 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %IN_p %IN_uv %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %Params "Params" + OpMemberName %Params 0 "TextureSize" + OpMemberName %Params 1 "Params1" + OpMemberName %Params 2 "Params2" + OpMemberName %Params 3 "Params3" + OpMemberName %Params 4 "Params4" + OpMemberName %Params 5 "Bloom" + OpName %CB1 "CB1" + OpMemberName %CB1 0 "CB1" + OpName %_ "" + OpName %mapSampler "mapSampler" + OpName %mapTexture "mapTexture" + OpName %IN_p "IN.p" + OpName %IN_uv "IN.uv" + OpName %_entryPointOutput "@entryPointOutput" + OpMemberDecorate %Params 0 Offset 0 + OpMemberDecorate %Params 1 Offset 16 + OpMemberDecorate %Params 2 Offset 32 + OpMemberDecorate %Params 3 Offset 48 + OpMemberDecorate %Params 4 Offset 64 + OpMemberDecorate %Params 5 Offset 80 + OpMemberDecorate %CB1 0 Offset 0 + OpDecorate %CB1 Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 1 + OpDecorate %mapSampler DescriptorSet 1 + OpDecorate %mapSampler Binding 2 + OpDecorate %mapTexture DescriptorSet 1 + OpDecorate %mapTexture Binding 2 + OpDecorate %IN_p BuiltIn FragCoord + OpDecorate %IN_uv Location 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %9 = OpTypeSampler + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %v4float = OpTypeVector %float 4 +%float_0_222222 = OpConstant %float 0.222222 + %33 = OpTypeSampledImage %11 + %uint = OpTypeInt 32 0 + %float_80 = OpConstant %float 80 +%float_0_0008 = OpConstant %float 0.0008 +%float_8en05 = OpConstant %float 8e-05 +%float_0_008 = OpConstant %float 0.008 + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 + %int_n3 = OpConstant %int -3 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %Params = OpTypeStruct %v4float %v4float %v4float %v4float %v4float %v4float + %CB1 = OpTypeStruct %Params +%_ptr_Uniform_CB1 = OpTypePointer Uniform %CB1 + %_ = OpVariable %_ptr_Uniform_CB1 Uniform + %int_0 = OpConstant %int 0 + %uint_3 = OpConstant %uint 3 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9 + %mapSampler = OpVariable %_ptr_UniformConstant_9 UniformConstant +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %mapTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float + %IN_p = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_v2float = OpTypePointer Input %v2float + %IN_uv = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %158 = OpLoad %v2float %IN_uv + %178 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 %uint_3 + %179 = OpLoad %float %178 + %180 = OpCompositeConstruct %v2float %float_0 %179 + %184 = OpLoad %9 %mapSampler + %185 = OpLoad %11 %mapTexture + %204 = OpSampledImage %33 %185 %184 + %206 = OpImageSampleImplicitLod %v4float %204 %158 + %207 = OpCompositeExtract %float %206 1 + %209 = OpFMul %float %207 %float_80 + %210 = OpFMul %float %209 %float_0_0008 + %211 = OpExtInst %float %1 FClamp %210 %float_8en05 %float_0_008 + OpBranch %212 + %212 = OpLabel + %276 = OpPhi %float %float_0 %5 %252 %218 + %277 = OpPhi %float %float_0 %5 %255 %218 + %278 = OpPhi %int %int_n3 %5 %257 %218 + %217 = OpSLessThanEqual %bool %278 %int_3 + OpLoopMerge %213 %218 None + OpBranchConditional %217 %218 %213 + %218 = OpLabel + %220 = OpConvertSToF %float %278 + %222 = OpFNegate %float %220 + %224 = OpFMul %float %222 %220 + %226 = OpFMul %float %224 %float_0_222222 + %227 = OpExtInst %float %1 Exp %226 + %230 = OpSampledImage %33 %185 %184 + %234 = OpVectorTimesScalar %v2float %180 %220 + %235 = OpFAdd %v2float %158 %234 + %236 = OpImageSampleImplicitLod %v4float %230 %235 + %273 = OpCompositeExtract %float %236 1 + %241 = OpFSub %float %273 %207 + %242 = OpExtInst %float %1 FAbs %241 + %244 = OpFOrdLessThan %bool %242 %211 + %245 = OpSelect %float %244 %float_1 %float_0 + %246 = OpFMul %float %227 %245 + %275 = OpCompositeExtract %float %236 0 + %250 = OpFMul %float %275 %246 + %252 = OpFAdd %float %276 %250 + %255 = OpFAdd %float %277 %246 + %257 = OpIAdd %int %278 %int_1 + OpBranch %212 + %213 = OpLabel + %260 = OpFDiv %float %276 %277 + %190 = OpCompositeConstruct %v4float %260 %207 %float_0 %float_1 + OpStore %_entryPointOutput %190 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/lut-promotion-initializer.asm.frag b/third_party/spirv-cross/shaders/asm/frag/lut-promotion-initializer.asm.frag new file mode 100644 index 0000000000..320e5ebfbd --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/lut-promotion-initializer.asm.frag @@ -0,0 +1,195 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 111 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %index + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %index "index" + OpName %indexable "indexable" + OpName %indexable_0 "indexable" + OpName %indexable_1 "indexable" + OpName %foo "foo" + OpName %foobar "foobar" + OpName %baz "baz" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %index RelaxedPrecision + OpDecorate %index Flat + OpDecorate %index Location 0 + OpDecorate %20 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + OpDecorate %42 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %foo RelaxedPrecision + OpDecorate %61 RelaxedPrecision + OpDecorate %66 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %72 RelaxedPrecision + OpDecorate %73 RelaxedPrecision + OpDecorate %75 RelaxedPrecision + OpDecorate %76 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %81 RelaxedPrecision + OpDecorate %foobar RelaxedPrecision + OpDecorate %83 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %baz RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpDecorate %106 RelaxedPrecision + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %16 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %uint = OpTypeInt 32 0 + %uint_16 = OpConstant %uint 16 +%_arr_float_uint_16 = OpTypeArray %float %uint_16 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %16 = OpConstantComposite %_arr_float_uint_16 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 %float_1 %float_2 %float_3 %float_4 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %index = OpVariable %_ptr_Input_int Input +%_ptr_Function__arr_float_uint_16 = OpTypePointer Function %_arr_float_uint_16 +%_ptr_Function_float = OpTypePointer Function %float + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 + %float_0 = OpConstant %float 0 + %54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %55 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_8 = OpConstant %float 8 + %57 = OpConstantComposite %v4float %float_8 %float_8 %float_8 %float_8 + %float_5 = OpConstant %float 5 + %59 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %60 = OpConstantComposite %_arr_v4float_uint_4 %54 %55 %57 %59 + %int_30 = OpConstant %int 30 + %int_3 = OpConstant %int 3 + %uint_1 = OpConstant %uint 1 + %uint_0 = OpConstant %uint 0 + %float_20 = OpConstant %float 20 + %uint_2 = OpConstant %uint 2 + %97 = OpConstantComposite %v4float %float_20 %float_20 %float_20 %float_20 + %float_30 = OpConstant %float 30 + %99 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 + %float_50 = OpConstant %float 50 + %101 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50 + %float_60 = OpConstant %float 60 + %103 = OpConstantComposite %v4float %float_60 %float_60 %float_60 %float_60 + %104 = OpConstantComposite %_arr_v4float_uint_4 %97 %99 %101 %103 + %main = OpFunction %void None %3 + %5 = OpLabel + %indexable = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_0 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 +%indexable_1 = OpVariable %_ptr_Function__arr_float_uint_16 Function %16 + %foo = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %foobar = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %baz = OpVariable %_ptr_Function__arr_v4float_uint_4 Function %60 + %20 = OpLoad %int %index + %24 = OpAccessChain %_ptr_Function_float %indexable %20 + %25 = OpLoad %float %24 + OpStore %FragColor %25 + %26 = OpLoad %int %index + %29 = OpSLessThan %bool %26 %int_10 + OpSelectionMerge %31 None + OpBranchConditional %29 %30 %40 + %30 = OpLabel + %32 = OpLoad %int %index + %34 = OpBitwiseXor %int %32 %int_1 + %36 = OpAccessChain %_ptr_Function_float %indexable_0 %34 + %37 = OpLoad %float %36 + %38 = OpLoad %float %FragColor + %39 = OpFAdd %float %38 %37 + OpStore %FragColor %39 + OpBranch %31 + %40 = OpLabel + %41 = OpLoad %int %index + %42 = OpBitwiseAnd %int %41 %int_1 + %44 = OpAccessChain %_ptr_Function_float %indexable_1 %42 + %45 = OpLoad %float %44 + %46 = OpLoad %float %FragColor + %47 = OpFAdd %float %46 %45 + OpStore %FragColor %47 + OpBranch %31 + %31 = OpLabel + %61 = OpLoad %int %index + %63 = OpSGreaterThan %bool %61 %int_30 + OpSelectionMerge %65 None + OpBranchConditional %63 %64 %74 + %64 = OpLabel + %66 = OpLoad %int %index + %68 = OpBitwiseAnd %int %66 %int_3 + %70 = OpAccessChain %_ptr_Function_float %foo %68 %uint_1 + %71 = OpLoad %float %70 + %72 = OpLoad %float %FragColor + %73 = OpFAdd %float %72 %71 + OpStore %FragColor %73 + OpBranch %65 + %74 = OpLabel + %75 = OpLoad %int %index + %76 = OpBitwiseAnd %int %75 %int_1 + %78 = OpAccessChain %_ptr_Function_float %foo %76 %uint_0 + %79 = OpLoad %float %78 + %80 = OpLoad %float %FragColor + %81 = OpFAdd %float %80 %79 + OpStore %FragColor %81 + OpBranch %65 + %65 = OpLabel + %83 = OpLoad %int %index + %84 = OpSGreaterThan %bool %83 %int_30 + OpSelectionMerge %86 None + OpBranchConditional %84 %85 %86 + %85 = OpLabel + %89 = OpAccessChain %_ptr_Function_float %foobar %int_1 %uint_2 + OpStore %89 %float_20 + OpBranch %86 + %86 = OpLabel + %90 = OpLoad %int %index + %91 = OpBitwiseAnd %int %90 %int_3 + %92 = OpAccessChain %_ptr_Function_float %foobar %91 %uint_2 + %93 = OpLoad %float %92 + %94 = OpLoad %float %FragColor + %95 = OpFAdd %float %94 %93 + OpStore %FragColor %95 + OpStore %baz %104 + %105 = OpLoad %int %index + %106 = OpBitwiseAnd %int %105 %int_3 + %107 = OpAccessChain %_ptr_Function_float %baz %106 %uint_2 + %108 = OpLoad %float %107 + %109 = OpLoad %float %FragColor + %110 = OpFAdd %float %109 %108 + OpStore %FragColor %110 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/multi-for-loop-init.asm.frag b/third_party/spirv-cross/shaders/asm/frag/multi-for-loop-init.asm.frag new file mode 100644 index 0000000000..d74f7ce568 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/multi-for-loop-init.asm.frag @@ -0,0 +1,111 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 52 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %counter %ucounter + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %i "i" + OpName %j "j" + OpName %counter "counter" + OpName %ucounter "ucounter" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %i RelaxedPrecision + OpDecorate %j RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %31 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %35 RelaxedPrecision + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %counter RelaxedPrecision + OpDecorate %counter Flat + OpDecorate %counter Location 0 + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %48 RelaxedPrecision + OpDecorate %ucounter RelaxedPrecision + OpDecorate %ucounter Flat + OpDecorate %ucounter Location 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %uint 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_20 = OpConstant %uint 20 +%_ptr_Input_int = OpTypePointer Input %int + %counter = OpVariable %_ptr_Input_int Input +%_ptr_Input_uint = OpTypePointer Input %uint + %ucounter = OpVariable %_ptr_Input_uint Input + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_uint Function + OpStore %FragColor %11 + OpStore %i %int_0 + OpStore %j %int_1 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %23 = OpLoad %int %i + %26 = OpSLessThan %bool %23 %int_10 + %27 = OpLoad %uint %j + %29 = OpSLessThan %bool %27 %int_20 + %30 = OpLogicalAnd %bool %26 %29 + OpBranchConditional %30 %19 %20 + %19 = OpLabel + %31 = OpLoad %int %i + %32 = OpConvertSToF %float %31 + %33 = OpCompositeConstruct %v4float %32 %32 %32 %32 + %34 = OpLoad %v4float %FragColor + %35 = OpFAdd %v4float %34 %33 + OpStore %FragColor %35 + %36 = OpLoad %uint %j + %37 = OpConvertUToF %float %36 + %38 = OpCompositeConstruct %v4float %37 %37 %37 %37 + %39 = OpLoad %v4float %FragColor + %40 = OpFAdd %v4float %39 %38 + OpStore %FragColor %40 + OpBranch %21 + %21 = OpLabel + %43 = OpLoad %int %counter + %44 = OpLoad %int %i + %45 = OpIAdd %int %44 %43 + OpStore %i %45 + %46 = OpLoad %int %counter + %47 = OpLoad %uint %j + %48 = OpIAdd %uint %47 %46 + OpStore %j %48 + OpBranch %18 + %20 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/op-constant-null.asm.frag b/third_party/spirv-cross/shaders/asm/frag/op-constant-null.asm.frag new file mode 100644 index 0000000000..61d2e579c8 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/op-constant-null.asm.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 45 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %a "a" + OpName %b "b" + OpName %c "c" + OpName %D "D" + OpMemberName %D 0 "a" + OpMemberName %D 1 "b" + OpName %d "d" + OpName %e "e" + OpName %FragColor "FragColor" + OpDecorate %a RelaxedPrecision + OpDecorate %b RelaxedPrecision + OpDecorate %c RelaxedPrecision + OpMemberDecorate %D 0 RelaxedPrecision + OpMemberDecorate %D 1 RelaxedPrecision + OpDecorate %e RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %44 RelaxedPrecision + OpDecorate %float_1 RelaxedPrecision + OpDecorate %14 RelaxedPrecision + OpDecorate %23 RelaxedPrecision + OpDecorate %41 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstantNull %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_2 = OpConstantNull %float + %14 = OpConstantNull %v4float + %v3float = OpTypeVector %float 3 +%mat2v3float = OpTypeMatrix %v3float 2 +%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float + %float_4 = OpConstantNull %float + %20 = OpConstantNull %v3float + %float_5 = OpConstantNull %float + %22 = OpConstantNull %v3float + %23 = OpConstantNull %mat2v3float + %D = OpTypeStruct %v4float %float +%_ptr_Function_D = OpTypePointer Function %D + %27 = OpConstantNull %D + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4 +%_ptr_Function__arr_v4float_uint_4 = OpTypePointer Function %_arr_v4float_uint_4 + %float_10 = OpConstantNull %float + %34 = OpConstantNull %v4float + %float_11 = OpConstantNull %float + %36 = OpConstantNull %v4float + %float_12 = OpConstantNull %float + %38 = OpConstantNull %v4float + %float_13 = OpConstantNull %float + %40 = OpConstantNull %v4float + %41 = OpConstantNull %_arr_v4float_uint_4 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_float Function + %b = OpVariable %_ptr_Function_v4float Function + %c = OpVariable %_ptr_Function_mat2v3float Function + %d = OpVariable %_ptr_Function_D Function + %e = OpVariable %_ptr_Function__arr_v4float_uint_4 Function + OpStore %a %float_1 + OpStore %b %14 + OpStore %c %23 + OpStore %d %27 + OpStore %e %41 + %44 = OpLoad %float %a + OpStore %FragColor %44 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/op-phi-swap-continue-block.asm.frag b/third_party/spirv-cross/shaders/asm/frag/op-phi-swap-continue-block.asm.frag new file mode 100644 index 0000000000..afae32519c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/op-phi-swap-continue-block.asm.frag @@ -0,0 +1,69 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 55 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %UBO "UBO" + OpMemberName %UBO 0 "uCount" + OpMemberName %UBO 1 "uJ" + OpMemberName %UBO 2 "uK" + OpName %_ "" + OpName %FragColor "FragColor" + OpMemberDecorate %UBO 0 Offset 0 + OpMemberDecorate %UBO 1 Offset 4 + OpMemberDecorate %UBO 2 Offset 8 + OpDecorate %UBO Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %UBO = OpTypeStruct %int %int %int +%_ptr_Uniform_UBO = OpTypePointer Uniform %UBO + %_ = OpVariable %_ptr_Uniform_UBO Uniform + %int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int + %int_2 = OpConstant %int 2 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpAccessChain %_ptr_Uniform_int %_ %int_1 + %15 = OpLoad %int %14 + %18 = OpAccessChain %_ptr_Uniform_int %_ %int_2 + %19 = OpLoad %int %18 + OpBranch %22 + %22 = OpLabel + %54 = OpPhi %int %19 %5 %53 %23 + %53 = OpPhi %int %15 %5 %54 %23 + %52 = OpPhi %int %int_0 %5 %37 %23 + %28 = OpAccessChain %_ptr_Uniform_int %_ %int_0 + %29 = OpLoad %int %28 + %31 = OpSLessThan %bool %52 %29 + OpLoopMerge %24 %23 None + OpBranchConditional %31 %inbetween %24 + %inbetween = OpLabel + OpBranch %23 + %23 = OpLabel + %37 = OpIAdd %int %52 %int_1 + OpBranch %22 + %24 = OpLabel + %43 = OpISub %int %53 %54 + %44 = OpConvertSToF %float %43 + %49 = OpIMul %int %15 %19 + %50 = OpConvertSToF %float %49 + %51 = OpFMul %float %44 %50 + OpStore %FragColor %51 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag b/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag new file mode 100644 index 0000000000..628a9f5ba9 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access-opspecconstant.asm.frag @@ -0,0 +1,42 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 10 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %v "v" + OpDecorate %v RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_99 = OpConstant %float 99 + %uint = OpTypeInt 32 0 +%uint_spec_3 = OpSpecConstant %uint 3 +%_ptr_Function_float = OpTypePointer Function %float + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function + OpStore %v %11 + OpSelectionMerge %15 None + OpBranchConditional %false %14 %15 + %14 = OpLabel + %20 = OpAccessChain %_ptr_Function_float %v %uint_spec_3 + OpStore %20 %float_99 + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access.asm.frag b/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access.asm.frag new file mode 100644 index 0000000000..542b74b2fd --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/out-of-bounds-access.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 10 +; Bound: 21 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 320 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %v "v" + OpDecorate %v RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_0 = OpConstant %float 0 + %11 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %bool = OpTypeBool + %false = OpConstantFalse %bool + %float_99 = OpConstant %float 99 + %float_88 = OpConstant %float 88 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %sint = OpTypeInt 32 1 + %sint_3 = OpConstant %sint -1 +%_ptr_Function_float = OpTypePointer Function %float + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v3float Function + OpStore %v %11 + OpSelectionMerge %15 None + OpBranchConditional %false %14 %15 + %14 = OpLabel + %20 = OpAccessChain %_ptr_Function_float %v %uint_3 + OpStore %20 %float_99 + %99 = OpAccessChain %_ptr_Function_float %v %sint_3 + OpStore %99 %float_88 + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/pack-and-unpack-uint2.asm.frag b/third_party/spirv-cross/shaders/asm/frag/pack-and-unpack-uint2.asm.frag new file mode 100644 index 0000000000..43d0970e8d --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/pack-and-unpack-uint2.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 34 +; Schema: 0 + OpCapability Shader + OpCapability Int64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_ARB_gpu_shader_int64" + OpName %main "main" + OpName %packed "packed" + OpName %unpacked "unpacked" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %ulong = OpTypeInt 64 0 +%_ptr_Function_ulong = OpTypePointer Function %ulong + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_18 = OpConstant %uint 18 + %uint_52 = OpConstant %uint 52 + %13 = OpConstantComposite %v2uint %uint_18 %uint_52 +%_ptr_Function_v2uint = OpTypePointer Function %v2uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %uint_0 = OpConstant %uint 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %uint_1 = OpConstant %uint 1 + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %packed = OpVariable %_ptr_Function_ulong Function + %unpacked = OpVariable %_ptr_Function_v2uint Function + %14 = OpBitcast %ulong %13 + OpStore %packed %14 + %17 = OpLoad %ulong %packed + %18 = OpBitcast %v2uint %17 + OpStore %unpacked %18 + %25 = OpAccessChain %_ptr_Function_uint %unpacked %uint_0 + %26 = OpLoad %uint %25 + %27 = OpConvertUToF %float %26 + %29 = OpAccessChain %_ptr_Function_uint %unpacked %uint_1 + %30 = OpLoad %uint %29 + %31 = OpConvertUToF %float %30 + %33 = OpCompositeConstruct %v4float %27 %31 %float_1 %float_1 + OpStore %FragColor %33 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag b/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag new file mode 100644 index 0000000000..083c85d9b0 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/pass-by-value.asm.frag @@ -0,0 +1,51 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 32 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %add_value_f1_f1_ "add_value(f1;f1;" + OpName %v "v" + OpName %w "w" + OpName %FragColor "FragColor" + OpName %Registers "Registers" + OpMemberName %Registers 0 "foo" + OpName %registers "registers" + OpDecorate %FragColor Location 0 + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %8 = OpTypeFunction %float %float %float +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %float_10 = OpConstant %float 10 + %Registers = OpTypeStruct %float +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_float = OpTypePointer PushConstant %float + %main = OpFunction %void None %3 + %5 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_float %registers %int_0 + %30 = OpLoad %float %29 + %31 = OpFunctionCall %float %add_value_f1_f1_ %float_10 %30 + OpStore %FragColor %31 + OpReturn + OpFunctionEnd +%add_value_f1_f1_ = OpFunction %float None %8 + %v = OpFunctionParameter %float + %w = OpFunctionParameter %float + %12 = OpLabel + %15 = OpFAdd %float %v %w + OpReturnValue %15 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/phi-loop-variable.asm.frag b/third_party/spirv-cross/shaders/asm/frag/phi-loop-variable.asm.frag new file mode 100644 index 0000000000..74c46b4af8 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/phi-loop-variable.asm.frag @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 59 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %v3float = OpTypeVector %float 3 + %11 = OpTypeFunction %v3float %_ptr_Function_mat2v2float +%_ptr_Function_v3float = OpTypePointer Function %v3float + %float_1 = OpConstant %float 1 + %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_35 = OpConstant %int 35 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %4 = OpFunction %void None %3 + %5 = OpLabel + OpBranch %48 + %48 = OpLabel + %58 = OpPhi %int %int_35 %5 %56 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %53 = OpSGreaterThanEqual %bool %58 %int_0 + OpBranchConditional %53 %54 %49 + %54 = OpLabel + OpBranch %50 + %50 = OpLabel + %56 = OpISub %int %58 %int_1 + OpBranch %48 + %49 = OpLabel + OpReturn + OpFunctionEnd + %13 = OpFunction %v3float None %11 + %12 = OpFunctionParameter %_ptr_Function_mat2v2float + %14 = OpLabel + %16 = OpVariable %_ptr_Function_v3float Function + %21 = OpVariable %_ptr_Function_int Function + OpStore %16 %18 + OpStore %21 %int_35 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %21 + %31 = OpSGreaterThanEqual %bool %28 %int_0 + OpBranchConditional %31 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %32 = OpLoad %int %21 + %34 = OpISub %int %32 %int_1 + OpStore %21 %34 + OpBranch %23 + %25 = OpLabel + %35 = OpLoad %v3float %16 + OpReturnValue %35 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/sample-and-compare.asm.frag b/third_party/spirv-cross/shaders/asm/frag/sample-and-compare.asm.frag new file mode 100644 index 0000000000..16dcd0d6e0 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/sample-and-compare.asm.frag @@ -0,0 +1,61 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 32 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_TEXCOORD0 %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_2d_image "type.2d.image" + OpName %g_Texture "g_Texture" + OpName %type_sampler "type.sampler" + OpName %g_Sampler "g_Sampler" + OpName %g_CompareSampler "g_CompareSampler" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_Target "out.var.SV_Target" + OpName %main "main" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_TEXCOORD0 Location 0 + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %g_Texture DescriptorSet 0 + OpDecorate %g_Texture Binding 0 + OpDecorate %g_Sampler DescriptorSet 0 + OpDecorate %g_Sampler Binding 0 + OpDecorate %g_CompareSampler DescriptorSet 0 + OpDecorate %g_CompareSampler Binding 1 + %float = OpTypeFloat 32 + %float_0_5 = OpConstant %float 0.5 + %float_0 = OpConstant %float 0 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_float = OpTypePointer Output %float + %void = OpTypeVoid + %19 = OpTypeFunction %void +%type_sampled_image = OpTypeSampledImage %type_2d_image + %v4float = OpTypeVector %float 4 + %g_Texture = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %g_Sampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%g_CompareSampler = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_Target = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %19 + %21 = OpLabel + %22 = OpLoad %v2float %in_var_TEXCOORD0 + %23 = OpLoad %type_2d_image %g_Texture + %24 = OpLoad %type_sampler %g_Sampler + %25 = OpSampledImage %type_sampled_image %23 %24 + %26 = OpImageSampleImplicitLod %v4float %25 %22 None + %27 = OpCompositeExtract %float %26 0 + %28 = OpLoad %type_sampler %g_CompareSampler + %29 = OpSampledImage %type_sampled_image %23 %28 + %30 = OpImageSampleDrefExplicitLod %float %29 %22 %float_0_5 Lod %float_0 + %31 = OpFAdd %float %27 %30 + OpStore %out_var_SV_Target %31 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag b/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag new file mode 100644 index 0000000000..0c3833e7ec --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-array-without-sampler.asm.frag @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 63 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %sample_from_func_s21_4__ "sample_from_func(s21[4];" + OpName %uSampler "uSampler" + OpName %sample_one_from_func_s21_ "sample_one_from_func(s21;" + OpName %uSampler_0 "uSampler" + OpName %Registers "Registers" + OpMemberName %Registers 0 "index" + OpName %registers "registers" + OpName %FragColor "FragColor" + OpName %uSampler_1 "uSampler" + OpMemberDecorate %Registers 0 Offset 0 + OpDecorate %Registers Block + OpDecorate %FragColor Location 0 + OpDecorate %uSampler_1 DescriptorSet 0 + OpDecorate %uSampler_1 Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeImage %float 2D 0 0 0 1 Unknown + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_8_uint_4 = OpTypeArray %7 %uint_4 +%_ptr_UniformConstant__arr_8_uint_4 = OpTypePointer UniformConstant %_arr_8_uint_4 + %v4float = OpTypeVector %float 4 + %14 = OpTypeFunction %v4float %_ptr_UniformConstant__arr_8_uint_4 +%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %7 + %19 = OpTypeFunction %v4float %_ptr_UniformConstant_8 + %int = OpTypeInt 32 1 + %Registers = OpTypeStruct %int +%_ptr_PushConstant_Registers = OpTypePointer PushConstant %Registers + %registers = OpVariable %_ptr_PushConstant_Registers PushConstant + %int_0 = OpConstant %int 0 +%_ptr_PushConstant_int = OpTypePointer PushConstant %int + %v2int = OpTypeVector %int 2 + %int_4 = OpConstant %int 4 + %35 = OpConstantComposite %v2int %int_4 %int_4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %uSampler_1 = OpVariable %_ptr_UniformConstant__arr_8_uint_4 UniformConstant + %int_10 = OpConstant %int 10 + %53 = OpConstantComposite %v2int %int_10 %int_10 + %main = OpFunction %void None %3 + %5 = OpLabel + %48 = OpAccessChain %_ptr_PushConstant_int %registers %int_0 + %49 = OpLoad %int %48 + %50 = OpAccessChain %_ptr_UniformConstant_8 %uSampler_1 %49 + %51 = OpLoad %7 %50 + %55 = OpImageFetch %v4float %51 %53 Lod %int_0 + %56 = OpFunctionCall %v4float %sample_from_func_s21_4__ %uSampler_1 + %57 = OpFAdd %v4float %55 %56 + %58 = OpAccessChain %_ptr_PushConstant_int %registers %int_0 + %59 = OpLoad %int %58 + %60 = OpAccessChain %_ptr_UniformConstant_8 %uSampler_1 %59 + %61 = OpFunctionCall %v4float %sample_one_from_func_s21_ %60 + %62 = OpFAdd %v4float %57 %61 + OpStore %FragColor %62 + OpReturn + OpFunctionEnd +%sample_from_func_s21_4__ = OpFunction %v4float None %14 + %uSampler = OpFunctionParameter %_ptr_UniformConstant__arr_8_uint_4 + %17 = OpLabel + %29 = OpAccessChain %_ptr_PushConstant_int %registers %int_0 + %30 = OpLoad %int %29 + %31 = OpAccessChain %_ptr_UniformConstant_8 %uSampler %30 + %32 = OpLoad %7 %31 + %37 = OpImageFetch %v4float %32 %35 Lod %int_0 + OpReturnValue %37 + OpFunctionEnd +%sample_one_from_func_s21_ = OpFunction %v4float None %19 + %uSampler_0 = OpFunctionParameter %_ptr_UniformConstant_8 + %22 = OpLabel + %40 = OpLoad %7 %uSampler_0 + %42 = OpImageFetch %v4float %40 %35 Lod %int_0 + OpReturnValue %42 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag b/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag new file mode 100644 index 0000000000..e6776eaf5e --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/sampler-buffer-without-sampler.asm.frag @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 36 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpName %main "main" + OpName %_main_ "@main(" + OpName %storeTemp "storeTemp" + OpName %RWTex "RWTex" + OpName %Tex "Tex" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %RWTex DescriptorSet 0 + OpDecorate %Tex DescriptorSet 0 + OpDecorate %RWTex Binding 0 + OpDecorate %Tex Binding 1 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %13 = OpConstant %float 1 + %14 = OpConstant %float 2 + %15 = OpConstant %float 3 + %16 = OpConstant %float 4 + %17 = OpConstantComposite %v4float %13 %14 %15 %16 + %18 = OpTypeImage %float Buffer 0 0 0 2 Rgba32f +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 + %RWTex = OpVariable %_ptr_UniformConstant_18 UniformConstant + %int = OpTypeInt 32 1 + %23 = OpConstant %int 20 + %25 = OpTypeImage %float Buffer 0 0 0 1 Rgba32f +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25 + %Tex = OpVariable %_ptr_UniformConstant_25 UniformConstant + %29 = OpConstant %int 10 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %35 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %35 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + %storeTemp = OpVariable %_ptr_Function_v4float Function + OpStore %storeTemp %17 + %21 = OpLoad %18 %RWTex + %24 = OpLoad %v4float %storeTemp + OpImageWrite %21 %23 %24 + %28 = OpLoad %25 %Tex + %30 = OpImageFetch %v4float %28 %29 + OpReturnValue %30 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/single-function-private-lut.asm.frag b/third_party/spirv-cross/shaders/asm/frag/single-function-private-lut.asm.frag new file mode 100644 index 0000000000..0d5b29c638 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/single-function-private-lut.asm.frag @@ -0,0 +1,86 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %o_color + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 460 + OpName %main "main" + OpName %myType "myType" + OpMemberName %myType 0 "data" + OpName %myData "myData" + OpName %uv "uv" + OpName %gl_FragCoord "gl_FragCoord" + OpName %index "index" + OpName %elt "elt" + OpName %o_color "o_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %o_color Location 0 + %void = OpTypeVoid + %11 = OpTypeFunction %void + %float = OpTypeFloat 32 + %myType = OpTypeStruct %float + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_myType_uint_5 = OpTypeArray %myType %uint_5 +%_ptr_Private__arr_myType_uint_5 = OpTypePointer Private %_arr_myType_uint_5 + %myData = OpVariable %_ptr_Private__arr_myType_uint_5 Private + %float_0 = OpConstant %float 0 + %18 = OpConstantComposite %myType %float_0 + %float_1 = OpConstant %float 1 + %20 = OpConstantComposite %myType %float_1 + %21 = OpConstantComposite %_arr_myType_uint_5 %18 %20 %18 %20 %18 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %float_4 = OpConstant %float 4 +%_ptr_Function_myType = OpTypePointer Function %myType +%_ptr_Private_myType = OpTypePointer Private %myType + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float + %o_color = OpVariable %_ptr_Output_v4float Output + %36 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1 + %37 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %11 + %38 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + %index = OpVariable %_ptr_Function_int Function + %elt = OpVariable %_ptr_Function_myType Function + OpStore %myData %21 + %39 = OpLoad %v4float %gl_FragCoord + %40 = OpVectorShuffle %v2float %39 %39 0 1 + OpStore %uv %40 + %41 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %42 = OpLoad %float %41 + %43 = OpFMod %float %42 %float_4 + %44 = OpConvertFToS %int %43 + OpStore %index %44 + %45 = OpLoad %int %index + %46 = OpAccessChain %_ptr_Private_myType %myData %45 + %47 = OpLoad %myType %46 + OpStore %elt %47 + %48 = OpAccessChain %_ptr_Function_float %elt %int_0 + %49 = OpLoad %float %48 + %50 = OpFOrdGreaterThan %bool %49 %float_0 + OpSelectionMerge %51 None + OpBranchConditional %50 %52 %53 + %52 = OpLabel + OpStore %o_color %36 + OpBranch %51 + %53 = OpLabel + OpStore %o_color %37 + OpBranch %51 + %51 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/srem.asm.frag b/third_party/spirv-cross/shaders/asm/frag/srem.asm.frag new file mode 100644 index 0000000000..c6f8e27cbd --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/srem.asm.frag @@ -0,0 +1,43 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 23 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %vA %vB + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %vA "vA" + OpName %vB "vB" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %vA Flat + OpDecorate %vA Location 0 + OpDecorate %vB Flat + OpDecorate %vB Location 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %vA = OpVariable %_ptr_Input_v4int Input + %vB = OpVariable %_ptr_Input_v4int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %v4int %vA + %16 = OpLoad %v4int %vB + %17 = OpLoad %v4int %vA + %18 = OpLoad %v4int %vB + %19 = OpSRem %v4int %17 %18 + %20 = OpConvertSToF %v4float %19 + OpStore %FragColor %20 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/storage-class-output-initializer.asm.frag b/third_party/spirv-cross/shaders/asm/frag/storage-class-output-initializer.asm.frag new file mode 100644 index 0000000000..7763b7c17c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/storage-class-output-initializer.asm.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColors %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColors "FragColors" + OpName %FragColor "FragColor" + OpDecorate %FragColors Location 0 + OpDecorate %FragColor Location 2 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_ptr_Output__arr_v4float_uint_2 = OpTypePointer Output %_arr_v4float_uint_2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %float_10 = OpConstant %float 10 + %19 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %20 = OpConstantComposite %_arr_v4float_uint_2 %17 %19 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %float_5 = OpConstant %float 5 + %24 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5 + %FragColors = OpVariable %_ptr_Output__arr_v4float_uint_2 Output %20 + %FragColor = OpVariable %_ptr_Output_v4float Output %24 + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag b/third_party/spirv-cross/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag new file mode 100644 index 0000000000..33bd1c9163 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/struct-composite-extract-swizzle.asm.frag @@ -0,0 +1,55 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 34 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uSampler "uSampler" + OpName %Foo "Foo" + OpMemberName %Foo 0 "var1" + OpMemberName %Foo 1 "var2" + OpName %foo "foo" + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + OpDecorate %uSampler RelaxedPrecision + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 0 + OpDecorate %14 RelaxedPrecision + OpMemberDecorate %Foo 0 RelaxedPrecision + OpMemberDecorate %Foo 1 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uSampler = OpVariable %_ptr_UniformConstant_11 UniformConstant + %Foo = OpTypeStruct %float %float +%_ptr_Function_Foo = OpTypePointer Function %Foo + %int = OpTypeInt 32 1 +%_ptr_Function_float = OpTypePointer Function %float + %v2float = OpTypeVector %float 2 + %33 = OpUndef %Foo + %main = OpFunction %void None %3 + %5 = OpLabel + %foo = OpVariable %_ptr_Function_Foo Function + %14 = OpLoad %11 %uSampler + %30 = OpCompositeExtract %float %33 0 + %32 = OpCompositeExtract %float %33 1 + %27 = OpCompositeConstruct %v2float %30 %32 + %28 = OpImageSampleImplicitLod %v4float %14 %27 + OpStore %FragColor %28 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/switch-label-shared-block.asm.frag b/third_party/spirv-cross/shaders/asm/frag/switch-label-shared-block.asm.frag new file mode 100644 index 0000000000..8f55bcf536 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/switch-label-shared-block.asm.frag @@ -0,0 +1,45 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 28 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vIndex %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %vIndex "vIndex" + OpName %FragColor "FragColor" + OpDecorate %vIndex RelaxedPrecision + OpDecorate %vIndex Flat + OpDecorate %vIndex Location 0 + OpDecorate %13 RelaxedPrecision + OpDecorate %FragColor RelaxedPrecision + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_8 = OpConstant %float 8 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %vIndex = OpVariable %_ptr_Input_int Input + %float_1 = OpConstant %float 1 + %float_3 = OpConstant %float 3 +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %13 = OpLoad %int %vIndex + OpSelectionMerge %17 None + OpSwitch %13 %15 0 %14 2 %14 1 %15 8 %17 + %15 = OpLabel + OpBranch %17 + %14 = OpLabel + OpBranch %17 + %17 = OpLabel + %27 = OpPhi %float %float_3 %15 %float_1 %14 %float_8 %5 + OpStore %FragColor %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/switch-preserve-sign-extension.asm.frag b/third_party/spirv-cross/shaders/asm/frag/switch-preserve-sign-extension.asm.frag new file mode 100644 index 0000000000..97140ee553 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/switch-preserve-sign-extension.asm.frag @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google Shaderc over Glslang; 10 +; Bound: 19 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %sw "sw" + OpName %result "result" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_42 = OpConstant %int 42 + %int_0 = OpConstant %int 0 + %int_420 = OpConstant %int 420 + %main = OpFunction %void None %3 + %5 = OpLabel + %sw = OpVariable %_ptr_Function_int Function + %result = OpVariable %_ptr_Function_int Function + OpStore %sw %int_42 + OpStore %result %int_0 + %12 = OpLoad %int %sw + OpSelectionMerge %16 None + OpSwitch %12 %16 -42 %13 420 %14 -1234 %15 + %13 = OpLabel + OpStore %result %int_42 + OpBranch %14 + %14 = OpLabel + OpStore %result %int_420 + OpBranch %15 + %15 = OpLabel + OpStore %result %int_420 + OpBranch %16 + %16 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/temporary-name-alias.asm.frag b/third_party/spirv-cross/shaders/asm/frag/temporary-name-alias.asm.frag new file mode 100644 index 0000000000..6ea359b24c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/temporary-name-alias.asm.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.2 +; Generator: Khronos; 0 +; Bound: 51 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %EntryPoint_Main "main" + OpExecutionMode %EntryPoint_Main OriginUpperLeft + OpSource Unknown 100 + OpName %mat3 "mat3" + OpName %constituent "constituent" + OpName %constituent_0 "constituent" + OpName %constituent_1 "constituent" + OpName %constituent_2 "constituent" + OpName %constituent_3 "constituent" + OpName %constituent_4 "constituent" + OpName %constituent_5 "constituent" + OpName %constituent_6 "constituent" + OpName %EntryPoint_Main "EntryPoint_Main" + %void = OpTypeVoid +%_ptr_Function_void = OpTypePointer Function %void + %float = OpTypeFloat 32 + %int = OpTypeInt 32 1 + %v3float = OpTypeVector %float 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float + %14 = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 +%EntryPoint_Main = OpFunction %void None %14 + %45 = OpLabel + %mat3 = OpVariable %_ptr_Function_mat3v3float Function +%constituent = OpConvertSToF %float %int_0 +%constituent_0 = OpCompositeConstruct %v3float %constituent %constituent %constituent +%constituent_1 = OpCompositeConstruct %v3float %constituent %constituent %constituent +%constituent_2 = OpCompositeConstruct %v3float %constituent %constituent %constituent + %25 = OpCompositeConstruct %mat3v3float %constituent_0 %constituent_1 %constituent_2 + OpStore %mat3 %25 +%constituent_3 = OpConvertSToF %float %int_1 +%constituent_4 = OpCompositeConstruct %v3float %constituent_3 %constituent_3 %constituent_3 +%constituent_5 = OpCompositeConstruct %v3float %constituent_3 %constituent_3 %constituent_3 +%constituent_6 = OpCompositeConstruct %v3float %constituent_3 %constituent_3 %constituent_3 + %30 = OpCompositeConstruct %mat3v3float %constituent_4 %constituent_5 %constituent_6 + OpStore %mat3 %30 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/temporary-phi-hoisting.asm.frag b/third_party/spirv-cross/shaders/asm/frag/temporary-phi-hoisting.asm.frag new file mode 100644 index 0000000000..977c20ac37 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/temporary-phi-hoisting.asm.frag @@ -0,0 +1,76 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 87 +; Schema: 0 + 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 %MyStruct "MyStruct" + OpMemberName %MyStruct 0 "color" + OpName %MyStruct_CB "MyStruct_CB" + OpMemberName %MyStruct_CB 0 "g_MyStruct" + OpName %_ "" + OpName %_entryPointOutput "@entryPointOutput" + OpMemberDecorate %MyStruct 0 Offset 0 + OpDecorate %_arr_MyStruct_uint_4 ArrayStride 16 + OpMemberDecorate %MyStruct_CB 0 Offset 0 + OpDecorate %MyStruct_CB Block + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v3float %float_0 %float_0 %float_0 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %MyStruct = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_MyStruct_uint_4 = OpTypeArray %MyStruct %uint_4 +%MyStruct_CB = OpTypeStruct %_arr_MyStruct_uint_4 +%_ptr_Uniform_MyStruct_CB = OpTypePointer Uniform %MyStruct_CB + %_ = OpVariable %_ptr_Uniform_MyStruct_CB Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %64 + %64 = OpLabel + %85 = OpPhi %v3float %15 %5 %77 %66 + %86 = OpPhi %int %int_0 %5 %79 %66 + OpLoopMerge %65 %66 None + OpBranch %67 + %67 = OpLabel + %69 = OpSLessThan %bool %86 %int_4 + OpBranchConditional %69 %70 %65 + %70 = OpLabel + %72 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %86 %int_0 + %73 = OpLoad %v4float %72 + %74 = OpVectorShuffle %v3float %73 %73 0 1 2 + %77 = OpFAdd %v3float %85 %74 + OpBranch %66 + %66 = OpLabel + %79 = OpIAdd %int %86 %int_1 + OpBranch %64 + %65 = OpLabel + %81 = OpCompositeExtract %float %85 0 + %82 = OpCompositeExtract %float %85 1 + %83 = OpCompositeExtract %float %85 2 + %84 = OpCompositeConstruct %v4float %81 %82 %83 %float_1 + OpStore %_entryPointOutput %84 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/texel-fetch-no-lod.asm.frag b/third_party/spirv-cross/shaders/asm/frag/texel-fetch-no-lod.asm.frag new file mode 100644 index 0000000000..53dc63809c --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/texel-fetch-no-lod.asm.frag @@ -0,0 +1,46 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 26 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %gl_FragCoord + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %gl_FragCoord "gl_FragCoord" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %uTexture = OpVariable %_ptr_UniformConstant_11 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %v2float = OpTypeVector %float 2 + %int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %14 = OpLoad %11 %uTexture + %18 = OpLoad %v4float %gl_FragCoord + %19 = OpVectorShuffle %v2float %18 %18 0 1 + %22 = OpConvertFToS %v2int %19 + %24 = OpImage %10 %14 + %25 = OpImageFetch %v4float %24 %22 + OpStore %FragColor %25 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag b/third_party/spirv-cross/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag new file mode 100644 index 0000000000..e7e6f37ea2 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/texture-sampling-fp16.asm.vk.frag @@ -0,0 +1,47 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 25 +; Schema: 0 + OpCapability Shader + OpCapability StorageInputOutput16 + OpCapability Float16 + OpExtension "SPV_KHR_16bit_storage" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor %UV + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_shader_explicit_arithmetic_types_float16" + OpName %main "main" + OpName %FragColor "FragColor" + OpName %uTexture "uTexture" + OpName %UV "UV" + OpDecorate %FragColor Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 0 + OpDecorate %UV Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %half = OpTypeFloat 16 + %float = OpTypeFloat 32 + %v4half = OpTypeVector %half 4 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4half = OpTypePointer Output %v4half + %FragColor = OpVariable %_ptr_Output_v4half Output + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown + %12 = OpTypeSampledImage %11 +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_12 UniformConstant + %v2half = OpTypeVector %half 2 +%_ptr_Input_v2half = OpTypePointer Input %v2half + %UV = OpVariable %_ptr_Input_v2half Input + %main = OpFunction %void None %3 + %5 = OpLabel + %15 = OpLoad %12 %uTexture + %19 = OpLoad %v2half %UV + %23 = OpImageSampleImplicitLod %v4float %15 %19 + %24 = OpFConvert %v4half %23 + OpStore %FragColor %24 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/undef-variable-store.asm.frag b/third_party/spirv-cross/shaders/asm/frag/undef-variable-store.asm.frag new file mode 100644 index 0000000000..966c2d9d5a --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/undef-variable-store.asm.frag @@ -0,0 +1,85 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 50 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %fragmentProgram "main" %_entryPointOutput + OpExecutionMode %fragmentProgram OriginUpperLeft + OpSource HLSL 500 + OpName %fragmentProgram "fragmentProgram" + OpName %_fragmentProgram_ "@fragmentProgram(" + OpName %uv "uv" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %float_0 = OpConstant %float 0 + %15 = OpConstantComposite %v2float %float_0 %float_0 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %26 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %29 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %false = OpConstantFalse %bool +%fragmentProgram = OpFunction %void None %3 + %5 = OpLabel + %35 = OpVariable %_ptr_Function_v2float Function + %37 = OpVariable %_ptr_Function_v4float Function + OpBranch %38 + %38 = OpLabel + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + OpStore %35 %15 + %42 = OpAccessChain %_ptr_Function_float %35 %uint_0 + %43 = OpLoad %float %42 + %44 = OpFOrdNotEqual %bool %43 %float_0 + OpSelectionMerge %45 None + OpBranchConditional %44 %46 %47 + %46 = OpLabel + OpStore %37 %26 + OpBranch %39 + %47 = OpLabel + OpStore %37 %29 + OpBranch %39 + %45 = OpLabel + %48 = OpUndef %v4float + OpStore %37 %48 + OpBranch %39 + %40 = OpLabel + OpBranchConditional %false %38 %39 + %39 = OpLabel + %34 = OpLoad %v4float %37 + OpStore %_entryPointOutput %34 + OpReturn + OpFunctionEnd +%_fragmentProgram_ = OpFunction %v4float None %8 + %10 = OpLabel + %uv = OpVariable %_ptr_Function_v2float Function + OpStore %uv %15 + %19 = OpAccessChain %_ptr_Function_float %uv %uint_0 + %20 = OpLoad %float %19 + %22 = OpFOrdNotEqual %bool %20 %float_0 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %28 + %23 = OpLabel + OpReturnValue %26 + %28 = OpLabel + OpReturnValue %29 + %24 = OpLabel + %31 = OpUndef %v4float + OpReturnValue %31 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/unknown-depth-state.asm.vk.frag b/third_party/spirv-cross/shaders/asm/frag/unknown-depth-state.asm.vk.frag new file mode 100644 index 0000000000..89036f0eb2 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/unknown-depth-state.asm.vk.frag @@ -0,0 +1,71 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 44 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %vUV %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %sample_combined_ "sample_combined(" + OpName %sample_separate_ "sample_separate(" + OpName %uShadow "uShadow" + OpName %vUV "vUV" + OpName %uTexture "uTexture" + OpName %uSampler "uSampler" + OpName %FragColor "FragColor" + OpDecorate %uShadow DescriptorSet 0 + OpDecorate %uShadow Binding 0 + OpDecorate %vUV Location 0 + OpDecorate %uTexture DescriptorSet 0 + OpDecorate %uTexture Binding 1 + OpDecorate %uSampler DescriptorSet 0 + OpDecorate %uSampler Binding 2 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float + %12 = OpTypeImage %float 2D 2 0 0 1 Unknown + %13 = OpTypeSampledImage %12 +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %uShadow = OpVariable %_ptr_UniformConstant_13 UniformConstant + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %vUV = OpVariable %_ptr_Input_v3float Input +%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %12 + %uTexture = OpVariable %_ptr_UniformConstant_25 UniformConstant + %29 = OpTypeSampler +%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29 + %uSampler = OpVariable %_ptr_UniformConstant_29 UniformConstant +%_ptr_Output_float = OpTypePointer Output %float + %FragColor = OpVariable %_ptr_Output_float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %41 = OpFunctionCall %float %sample_combined_ + %42 = OpFunctionCall %float %sample_separate_ + %43 = OpFAdd %float %41 %42 + OpStore %FragColor %43 + OpReturn + OpFunctionEnd +%sample_combined_ = OpFunction %float None %7 + %9 = OpLabel + %16 = OpLoad %13 %uShadow + %20 = OpLoad %v3float %vUV + %21 = OpCompositeExtract %float %20 2 + %22 = OpImageSampleDrefImplicitLod %float %16 %20 %21 + OpReturnValue %22 + OpFunctionEnd +%sample_separate_ = OpFunction %float None %7 + %11 = OpLabel + %28 = OpLoad %12 %uTexture + %32 = OpLoad %29 %uSampler + %33 = OpSampledImage %13 %28 %32 + %34 = OpLoad %v3float %vUV + %35 = OpCompositeExtract %float %34 2 + %36 = OpImageSampleDrefImplicitLod %float %33 %34 %35 + OpReturnValue %36 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/unreachable.asm.frag b/third_party/spirv-cross/shaders/asm/frag/unreachable.asm.frag new file mode 100644 index 0000000000..e2ce2eb56a --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/unreachable.asm.frag @@ -0,0 +1,61 @@ +; 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 %main "main" %counter %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %counter "counter" + OpName %FragColor "FragColor" + OpDecorate %counter Flat + OpDecorate %counter Location 0 + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %counter = OpVariable %_ptr_Input_int Input + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %float_10 = OpConstant %float 10 + %21 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10 + %float_30 = OpConstant %float 30 + %25 = OpConstantComposite %v4float %float_30 %float_30 %float_30 %float_30 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Function_v4float = OpTypePointer Function %v4float + %false = OpConstantFalse %bool + %44 = OpUndef %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %33 + %33 = OpLabel + %45 = OpPhi %v4float %44 %5 %44 %35 + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %37 = OpLoad %int %counter + %38 = OpIEqual %bool %37 %int_10 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + OpBranch %34 + %41 = OpLabel + OpBranch %34 + %39 = OpLabel + OpUnreachable + %35 = OpLabel + OpBranchConditional %false %33 %34 + %34 = OpLabel + %46 = OpPhi %v4float %21 %40 %25 %41 %44 %35 + OpStore %FragColor %46 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/frag/vector-shuffle-oom.asm.frag b/third_party/spirv-cross/shaders/asm/frag/vector-shuffle-oom.asm.frag new file mode 100644 index 0000000000..d60c6f52d4 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/frag/vector-shuffle-oom.asm.frag @@ -0,0 +1,886 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 25007 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %5663 "main" %5800 %gl_FragCoord %4317 + OpExecutionMode %5663 OriginUpperLeft + OpMemberDecorate %_struct_1116 0 Offset 0 + OpMemberDecorate %_struct_1116 1 Offset 16 + OpMemberDecorate %_struct_1116 2 Offset 32 + OpDecorate %_struct_1116 Block + OpDecorate %22044 DescriptorSet 0 + OpDecorate %22044 Binding 0 + OpDecorate %5785 DescriptorSet 0 + OpDecorate %5785 Binding 140 + OpDecorate %5688 DescriptorSet 0 + OpDecorate %5688 Binding 60 + OpMemberDecorate %_struct_994 0 Offset 0 + OpMemberDecorate %_struct_994 1 Offset 16 + OpMemberDecorate %_struct_994 2 Offset 28 + OpMemberDecorate %_struct_994 3 Offset 32 + OpMemberDecorate %_struct_994 4 Offset 44 + OpMemberDecorate %_struct_994 5 Offset 48 + OpMemberDecorate %_struct_994 6 Offset 60 + OpMemberDecorate %_struct_994 7 Offset 64 + OpMemberDecorate %_struct_994 8 Offset 76 + OpMemberDecorate %_struct_994 9 Offset 80 + OpMemberDecorate %_struct_994 10 Offset 92 + OpMemberDecorate %_struct_994 11 Offset 96 + OpMemberDecorate %_struct_994 12 Offset 108 + OpMemberDecorate %_struct_994 13 Offset 112 + OpMemberDecorate %_struct_994 14 Offset 120 + OpMemberDecorate %_struct_994 15 Offset 128 + OpMemberDecorate %_struct_994 16 Offset 140 + OpMemberDecorate %_struct_994 17 Offset 144 + OpMemberDecorate %_struct_994 18 Offset 148 + OpMemberDecorate %_struct_994 19 Offset 152 + OpMemberDecorate %_struct_994 20 Offset 156 + OpMemberDecorate %_struct_994 21 Offset 160 + OpMemberDecorate %_struct_994 22 Offset 176 + OpMemberDecorate %_struct_994 23 RowMajor + OpMemberDecorate %_struct_994 23 Offset 192 + OpMemberDecorate %_struct_994 23 MatrixStride 16 + OpMemberDecorate %_struct_994 24 Offset 256 + OpDecorate %_struct_994 Block + OpDecorate %12348 DescriptorSet 0 + OpDecorate %12348 Binding 2 + OpDecorate %3312 DescriptorSet 0 + OpDecorate %3312 Binding 142 + OpDecorate %4646 DescriptorSet 0 + OpDecorate %4646 Binding 62 + OpDecorate %4862 DescriptorSet 0 + OpDecorate %4862 Binding 141 + OpDecorate %3594 DescriptorSet 0 + OpDecorate %3594 Binding 61 + OpDecorate %_arr_mat4v4float_uint_2 ArrayStride 64 + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpMemberDecorate %_struct_408 0 RowMajor + OpMemberDecorate %_struct_408 0 Offset 0 + OpMemberDecorate %_struct_408 0 MatrixStride 16 + OpMemberDecorate %_struct_408 1 RowMajor + OpMemberDecorate %_struct_408 1 Offset 64 + OpMemberDecorate %_struct_408 1 MatrixStride 16 + OpMemberDecorate %_struct_408 2 RowMajor + OpMemberDecorate %_struct_408 2 Offset 128 + OpMemberDecorate %_struct_408 2 MatrixStride 16 + OpMemberDecorate %_struct_408 3 RowMajor + OpMemberDecorate %_struct_408 3 Offset 192 + OpMemberDecorate %_struct_408 3 MatrixStride 16 + OpMemberDecorate %_struct_408 4 Offset 256 + OpMemberDecorate %_struct_408 5 Offset 272 + OpMemberDecorate %_struct_408 6 Offset 288 + OpMemberDecorate %_struct_408 7 Offset 292 + OpMemberDecorate %_struct_408 8 Offset 296 + OpMemberDecorate %_struct_408 9 Offset 300 + OpMemberDecorate %_struct_408 10 Offset 304 + OpMemberDecorate %_struct_408 11 Offset 316 + OpMemberDecorate %_struct_408 12 Offset 320 + OpMemberDecorate %_struct_408 13 Offset 332 + OpMemberDecorate %_struct_408 14 Offset 336 + OpMemberDecorate %_struct_408 15 Offset 348 + OpMemberDecorate %_struct_408 16 Offset 352 + OpMemberDecorate %_struct_408 17 Offset 364 + OpMemberDecorate %_struct_408 18 Offset 368 + OpMemberDecorate %_struct_408 19 Offset 372 + OpMemberDecorate %_struct_408 20 Offset 376 + OpMemberDecorate %_struct_408 21 Offset 384 + OpMemberDecorate %_struct_408 22 Offset 392 + OpMemberDecorate %_struct_408 23 Offset 400 + OpMemberDecorate %_struct_408 24 Offset 416 + OpMemberDecorate %_struct_408 25 Offset 424 + OpMemberDecorate %_struct_408 26 Offset 432 + OpMemberDecorate %_struct_408 27 Offset 448 + OpMemberDecorate %_struct_408 28 Offset 460 + OpMemberDecorate %_struct_408 29 Offset 464 + OpMemberDecorate %_struct_408 30 Offset 468 + OpMemberDecorate %_struct_408 31 Offset 472 + OpMemberDecorate %_struct_408 32 Offset 476 + OpMemberDecorate %_struct_408 33 Offset 480 + OpMemberDecorate %_struct_408 34 Offset 488 + OpMemberDecorate %_struct_408 35 Offset 492 + OpMemberDecorate %_struct_408 36 Offset 496 + OpMemberDecorate %_struct_408 37 RowMajor + OpMemberDecorate %_struct_408 37 Offset 512 + OpMemberDecorate %_struct_408 37 MatrixStride 16 + OpMemberDecorate %_struct_408 38 Offset 640 + OpDecorate %_struct_408 Block + OpDecorate %15259 DescriptorSet 0 + OpDecorate %15259 Binding 1 + OpDecorate %5800 Location 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %4317 Location 0 + OpMemberDecorate %_struct_1395 0 Offset 0 + OpMemberDecorate %_struct_1395 1 Offset 16 + OpMemberDecorate %_struct_1395 2 Offset 32 + OpMemberDecorate %_struct_1395 3 Offset 40 + OpMemberDecorate %_struct_1395 4 Offset 48 + OpMemberDecorate %_struct_1395 5 Offset 60 + OpMemberDecorate %_struct_1395 6 Offset 64 + OpMemberDecorate %_struct_1395 7 Offset 76 + OpMemberDecorate %_struct_1395 8 Offset 80 + OpMemberDecorate %_struct_1395 9 Offset 96 + OpMemberDecorate %_struct_1395 10 Offset 112 + OpMemberDecorate %_struct_1395 11 Offset 128 + OpMemberDecorate %_struct_1395 12 Offset 140 + OpMemberDecorate %_struct_1395 13 Offset 144 + OpMemberDecorate %_struct_1395 14 Offset 156 + OpMemberDecorate %_struct_1395 15 Offset 160 + OpMemberDecorate %_struct_1395 16 Offset 176 + OpMemberDecorate %_struct_1395 17 Offset 192 + OpMemberDecorate %_struct_1395 18 Offset 204 + OpMemberDecorate %_struct_1395 19 Offset 208 + OpMemberDecorate %_struct_1395 20 Offset 224 + OpDecorate %_struct_1395 Block + OpMemberDecorate %_struct_1018 0 Offset 0 + OpDecorate %_struct_1018 Block + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 +%_struct_1017 = OpTypeStruct %v4float +%_struct_1116 = OpTypeStruct %v4float %float %v4float +%_ptr_Uniform__struct_1116 = OpTypePointer Uniform %_struct_1116 + %22044 = OpVariable %_ptr_Uniform__struct_1116 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %150 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_150 = OpTypePointer UniformConstant %150 + %5785 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %508 = OpTypeSampler +%_ptr_UniformConstant_508 = OpTypePointer UniformConstant %508 + %5688 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %510 = OpTypeSampledImage %150 + %float_0 = OpConstant %float 0 + %uint = OpTypeInt 32 0 + %int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %float_1 = OpConstant %float 1 +%mat4v4float = OpTypeMatrix %v4float 4 +%_struct_994 = OpTypeStruct %v3float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v3float %float %v2float %v2float %v3float %float %float %float %float %float %v4float %v4float %mat4v4float %v4float +%_ptr_Uniform__struct_994 = OpTypePointer Uniform %_struct_994 + %12348 = OpVariable %_ptr_Uniform__struct_994 Uniform + %int_5 = OpConstant %int 5 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float + %3312 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %4646 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %bool = OpTypeBool + %4862 = OpVariable %_ptr_UniformConstant_150 UniformConstant + %3594 = OpVariable %_ptr_UniformConstant_508 UniformConstant + %uint_2 = OpConstant %uint 2 + %2938 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_arr_mat4v4float_uint_2 = OpTypeArray %mat4v4float %uint_2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_struct_408 = OpTypeStruct %mat4v4float %mat4v4float %mat4v4float %mat4v4float %v4float %v4float %float %float %float %float %v3float %float %v3float %float %v3float %float %v3float %float %float %float %v2float %v2float %v2float %v4float %v2float %v2float %v2float %v3float %float %float %float %float %float %v2float %float %float %v3float %_arr_mat4v4float_uint_2 %_arr_v4float_uint_2 +%_ptr_Uniform__struct_408 = OpTypePointer Uniform %_struct_408 + %15259 = OpVariable %_ptr_Uniform__struct_408 Uniform + %int_23 = OpConstant %int 23 + %int_2 = OpConstant %int 2 + %float_n2 = OpConstant %float -2 + %float_0_5 = OpConstant %float 0.5 + %1196 = OpConstantComposite %v3float %float_0 %float_n2 %float_0_5 + %float_n1 = OpConstant %float -1 + %836 = OpConstantComposite %v3float %float_n1 %float_n1 %float_0_5 + %float_0_75 = OpConstant %float 0.75 + %1367 = OpConstantComposite %v3float %float_0 %float_n1 %float_0_75 + %141 = OpConstantComposite %v3float %float_1 %float_n1 %float_0_5 + %38 = OpConstantComposite %v3float %float_n2 %float_0 %float_0_5 + %95 = OpConstantComposite %v3float %float_n1 %float_0 %float_0_75 + %626 = OpConstantComposite %v3float %float_0 %float_0 %float_1 + %2411 = OpConstantComposite %v3float %float_1 %float_0 %float_0_75 + %float_2 = OpConstant %float 2 + %2354 = OpConstantComposite %v3float %float_2 %float_0 %float_0_5 + %837 = OpConstantComposite %v3float %float_n1 %float_1 %float_0_5 + %1368 = OpConstantComposite %v3float %float_0 %float_1 %float_0_75 + %142 = OpConstantComposite %v3float %float_1 %float_1 %float_0_5 + %1197 = OpConstantComposite %v3float %float_0 %float_2 %float_0_5 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %5800 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %4317 = OpVariable %_ptr_Output_v4float Output +%_struct_1395 = OpTypeStruct %v4float %v4float %v2float %v2float %v3float %float %v3float %float %v4float %v4float %v4float %v3float %float %v3float %float %v3float %v4float %v3float %float %v3float %v2float +%_struct_1018 = OpTypeStruct %v4float + %10264 = OpUndef %_struct_1017 + %5663 = OpFunction %void None %1282 + %25006 = OpLabel + %17463 = OpLoad %v4float %gl_FragCoord + %13863 = OpCompositeInsert %_struct_1017 %2938 %10264 0 + %22969 = OpVectorShuffle %v2float %17463 %17463 0 1 + %13206 = OpAccessChain %_ptr_Uniform_v4float %15259 %int_23 + %10343 = OpLoad %v4float %13206 + %7422 = OpVectorShuffle %v2float %10343 %10343 0 1 + %19927 = OpFMul %v2float %22969 %7422 + %18174 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_2 + %16206 = OpLoad %v4float %18174 + %20420 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %21354 = OpLoad %v4float %20420 + %7688 = OpVectorShuffle %v4float %21354 %21354 0 1 0 1 + %17581 = OpFMul %v4float %16206 %7688 + %10673 = OpVectorShuffle %v2float %1196 %1196 0 1 + %18824 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10344 = OpLoad %v4float %18824 + %8638 = OpVectorShuffle %v2float %10344 %10344 0 1 + %9197 = OpFMul %v2float %10673 %8638 + %18505 = OpFAdd %v2float %19927 %9197 + %7011 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21058 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13149 = OpExtInst %v2float %1 FClamp %18505 %7011 %21058 + %23584 = OpLoad %150 %5785 + %10339 = OpLoad %508 %5688 + %12147 = OpSampledImage %510 %23584 %10339 + %15371 = OpImageSampleExplicitLod %v4float %12147 %13149 Lod %float_0 + %15266 = OpCompositeExtract %float %15371 3 + %12116 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12972 = OpLoad %float %12116 + %15710 = OpFMul %float %15266 %12972 + %15279 = OpExtInst %float %1 FClamp %15710 %float_0 %float_1 + %22213 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11756 = OpLoad %v3float %22213 + %12103 = OpVectorTimesScalar %v3float %11756 %15279 + %15516 = OpLoad %150 %3312 + %24569 = OpLoad %508 %4646 + %12148 = OpSampledImage %510 %15516 %24569 + %17670 = OpImageSampleExplicitLod %v4float %12148 %13149 Lod %float_0 + %16938 = OpCompositeExtract %float %17670 1 + %14185 = OpFOrdGreaterThan %bool %16938 %float_0 + OpSelectionMerge %22307 DontFlatten + OpBranchConditional %14185 %12821 %22307 + %12821 = OpLabel + %13239 = OpLoad %150 %4862 + %19960 = OpLoad %508 %3594 + %12149 = OpSampledImage %510 %13239 %19960 + %15675 = OpImageSampleExplicitLod %v4float %12149 %13149 Lod %float_0 + %13866 = OpCompositeExtract %float %17670 1 + %12427 = OpCompositeExtract %float %17670 2 + %23300 = OpFMul %float %13866 %12427 + %17612 = OpExtInst %float %1 FClamp %23300 %float_0 %float_1 + %20291 = OpVectorShuffle %v3float %15675 %15675 0 1 2 + %11186 = OpVectorTimesScalar %v3float %20291 %17612 + %15293 = OpFAdd %v3float %12103 %11186 + OpBranch %22307 + %22307 = OpLabel + %7719 = OpPhi %v3float %12103 %25006 %15293 %12821 + %23399 = OpVectorTimesScalar %v3float %7719 %float_0_5 + %9339 = OpFAdd %float %float_0 %float_0_5 + %16235 = OpVectorShuffle %v3float %2938 %2938 0 1 2 + %22177 = OpFAdd %v3float %16235 %23399 + %15527 = OpVectorShuffle %v4float %2938 %22177 4 5 6 3 + %6434 = OpCompositeInsert %_struct_1017 %15527 %13863 0 + %24572 = OpVectorShuffle %v2float %836 %836 0 1 + %13207 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10345 = OpLoad %v4float %13207 + %8639 = OpVectorShuffle %v2float %10345 %10345 0 1 + %9198 = OpFMul %v2float %24572 %8639 + %18506 = OpFAdd %v2float %19927 %9198 + %7012 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21059 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13150 = OpExtInst %v2float %1 FClamp %18506 %7012 %21059 + %23585 = OpLoad %150 %5785 + %10340 = OpLoad %508 %5688 + %12150 = OpSampledImage %510 %23585 %10340 + %15372 = OpImageSampleExplicitLod %v4float %12150 %13150 Lod %float_0 + %15267 = OpCompositeExtract %float %15372 3 + %12117 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12973 = OpLoad %float %12117 + %15711 = OpFMul %float %15267 %12973 + %15280 = OpExtInst %float %1 FClamp %15711 %float_0 %float_1 + %22214 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11757 = OpLoad %v3float %22214 + %12104 = OpVectorTimesScalar %v3float %11757 %15280 + %15517 = OpLoad %150 %3312 + %24570 = OpLoad %508 %4646 + %12151 = OpSampledImage %510 %15517 %24570 + %17671 = OpImageSampleExplicitLod %v4float %12151 %13150 Lod %float_0 + %16939 = OpCompositeExtract %float %17671 1 + %14186 = OpFOrdGreaterThan %bool %16939 %float_0 + OpSelectionMerge %22308 DontFlatten + OpBranchConditional %14186 %12822 %22308 + %12822 = OpLabel + %13240 = OpLoad %150 %4862 + %19961 = OpLoad %508 %3594 + %12152 = OpSampledImage %510 %13240 %19961 + %15676 = OpImageSampleExplicitLod %v4float %12152 %13150 Lod %float_0 + %13867 = OpCompositeExtract %float %17671 1 + %12428 = OpCompositeExtract %float %17671 2 + %23301 = OpFMul %float %13867 %12428 + %17613 = OpExtInst %float %1 FClamp %23301 %float_0 %float_1 + %20292 = OpVectorShuffle %v3float %15676 %15676 0 1 2 + %11187 = OpVectorTimesScalar %v3float %20292 %17613 + %15294 = OpFAdd %v3float %12104 %11187 + OpBranch %22308 + %22308 = OpLabel + %7720 = OpPhi %v3float %12104 %22307 %15294 %12822 + %23400 = OpVectorTimesScalar %v3float %7720 %float_0_5 + %9340 = OpFAdd %float %9339 %float_0_5 + %16236 = OpVectorShuffle %v3float %15527 %15527 0 1 2 + %22178 = OpFAdd %v3float %16236 %23400 + %15528 = OpVectorShuffle %v4float %15527 %22178 4 5 6 3 + %6435 = OpCompositeInsert %_struct_1017 %15528 %6434 0 + %24573 = OpVectorShuffle %v2float %1367 %1367 0 1 + %13208 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10346 = OpLoad %v4float %13208 + %8640 = OpVectorShuffle %v2float %10346 %10346 0 1 + %9199 = OpFMul %v2float %24573 %8640 + %18507 = OpFAdd %v2float %19927 %9199 + %7013 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21060 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13151 = OpExtInst %v2float %1 FClamp %18507 %7013 %21060 + %23586 = OpLoad %150 %5785 + %10341 = OpLoad %508 %5688 + %12153 = OpSampledImage %510 %23586 %10341 + %15373 = OpImageSampleExplicitLod %v4float %12153 %13151 Lod %float_0 + %15268 = OpCompositeExtract %float %15373 3 + %12118 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12974 = OpLoad %float %12118 + %15712 = OpFMul %float %15268 %12974 + %15281 = OpExtInst %float %1 FClamp %15712 %float_0 %float_1 + %22215 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11758 = OpLoad %v3float %22215 + %12105 = OpVectorTimesScalar %v3float %11758 %15281 + %15518 = OpLoad %150 %3312 + %24571 = OpLoad %508 %4646 + %12154 = OpSampledImage %510 %15518 %24571 + %17672 = OpImageSampleExplicitLod %v4float %12154 %13151 Lod %float_0 + %16940 = OpCompositeExtract %float %17672 1 + %14187 = OpFOrdGreaterThan %bool %16940 %float_0 + OpSelectionMerge %22309 DontFlatten + OpBranchConditional %14187 %12823 %22309 + %12823 = OpLabel + %13241 = OpLoad %150 %4862 + %19962 = OpLoad %508 %3594 + %12155 = OpSampledImage %510 %13241 %19962 + %15677 = OpImageSampleExplicitLod %v4float %12155 %13151 Lod %float_0 + %13868 = OpCompositeExtract %float %17672 1 + %12429 = OpCompositeExtract %float %17672 2 + %23302 = OpFMul %float %13868 %12429 + %17614 = OpExtInst %float %1 FClamp %23302 %float_0 %float_1 + %20293 = OpVectorShuffle %v3float %15677 %15677 0 1 2 + %11188 = OpVectorTimesScalar %v3float %20293 %17614 + %15295 = OpFAdd %v3float %12105 %11188 + OpBranch %22309 + %22309 = OpLabel + %7721 = OpPhi %v3float %12105 %22308 %15295 %12823 + %23401 = OpVectorTimesScalar %v3float %7721 %float_0_75 + %9341 = OpFAdd %float %9340 %float_0_75 + %16237 = OpVectorShuffle %v3float %15528 %15528 0 1 2 + %22179 = OpFAdd %v3float %16237 %23401 + %15529 = OpVectorShuffle %v4float %15528 %22179 4 5 6 3 + %6436 = OpCompositeInsert %_struct_1017 %15529 %6435 0 + %24574 = OpVectorShuffle %v2float %141 %141 0 1 + %13209 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10347 = OpLoad %v4float %13209 + %8641 = OpVectorShuffle %v2float %10347 %10347 0 1 + %9200 = OpFMul %v2float %24574 %8641 + %18508 = OpFAdd %v2float %19927 %9200 + %7014 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21061 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13152 = OpExtInst %v2float %1 FClamp %18508 %7014 %21061 + %23587 = OpLoad %150 %5785 + %10342 = OpLoad %508 %5688 + %12156 = OpSampledImage %510 %23587 %10342 + %15374 = OpImageSampleExplicitLod %v4float %12156 %13152 Lod %float_0 + %15269 = OpCompositeExtract %float %15374 3 + %12119 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12975 = OpLoad %float %12119 + %15713 = OpFMul %float %15269 %12975 + %15282 = OpExtInst %float %1 FClamp %15713 %float_0 %float_1 + %22216 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11759 = OpLoad %v3float %22216 + %12106 = OpVectorTimesScalar %v3float %11759 %15282 + %15519 = OpLoad %150 %3312 + %24575 = OpLoad %508 %4646 + %12157 = OpSampledImage %510 %15519 %24575 + %17673 = OpImageSampleExplicitLod %v4float %12157 %13152 Lod %float_0 + %16941 = OpCompositeExtract %float %17673 1 + %14188 = OpFOrdGreaterThan %bool %16941 %float_0 + OpSelectionMerge %22310 DontFlatten + OpBranchConditional %14188 %12824 %22310 + %12824 = OpLabel + %13242 = OpLoad %150 %4862 + %19963 = OpLoad %508 %3594 + %12158 = OpSampledImage %510 %13242 %19963 + %15678 = OpImageSampleExplicitLod %v4float %12158 %13152 Lod %float_0 + %13869 = OpCompositeExtract %float %17673 1 + %12430 = OpCompositeExtract %float %17673 2 + %23303 = OpFMul %float %13869 %12430 + %17615 = OpExtInst %float %1 FClamp %23303 %float_0 %float_1 + %20294 = OpVectorShuffle %v3float %15678 %15678 0 1 2 + %11189 = OpVectorTimesScalar %v3float %20294 %17615 + %15296 = OpFAdd %v3float %12106 %11189 + OpBranch %22310 + %22310 = OpLabel + %7722 = OpPhi %v3float %12106 %22309 %15296 %12824 + %23402 = OpVectorTimesScalar %v3float %7722 %float_0_5 + %9342 = OpFAdd %float %9341 %float_0_5 + %16238 = OpVectorShuffle %v3float %15529 %15529 0 1 2 + %22180 = OpFAdd %v3float %16238 %23402 + %15530 = OpVectorShuffle %v4float %15529 %22180 4 5 6 3 + %6437 = OpCompositeInsert %_struct_1017 %15530 %6436 0 + %24576 = OpVectorShuffle %v2float %38 %38 0 1 + %13210 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10348 = OpLoad %v4float %13210 + %8642 = OpVectorShuffle %v2float %10348 %10348 0 1 + %9201 = OpFMul %v2float %24576 %8642 + %18509 = OpFAdd %v2float %19927 %9201 + %7015 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21062 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13153 = OpExtInst %v2float %1 FClamp %18509 %7015 %21062 + %23588 = OpLoad %150 %5785 + %10349 = OpLoad %508 %5688 + %12159 = OpSampledImage %510 %23588 %10349 + %15375 = OpImageSampleExplicitLod %v4float %12159 %13153 Lod %float_0 + %15270 = OpCompositeExtract %float %15375 3 + %12120 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12976 = OpLoad %float %12120 + %15714 = OpFMul %float %15270 %12976 + %15283 = OpExtInst %float %1 FClamp %15714 %float_0 %float_1 + %22217 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11760 = OpLoad %v3float %22217 + %12107 = OpVectorTimesScalar %v3float %11760 %15283 + %15520 = OpLoad %150 %3312 + %24577 = OpLoad %508 %4646 + %12160 = OpSampledImage %510 %15520 %24577 + %17674 = OpImageSampleExplicitLod %v4float %12160 %13153 Lod %float_0 + %16942 = OpCompositeExtract %float %17674 1 + %14189 = OpFOrdGreaterThan %bool %16942 %float_0 + OpSelectionMerge %22311 DontFlatten + OpBranchConditional %14189 %12825 %22311 + %12825 = OpLabel + %13243 = OpLoad %150 %4862 + %19964 = OpLoad %508 %3594 + %12161 = OpSampledImage %510 %13243 %19964 + %15679 = OpImageSampleExplicitLod %v4float %12161 %13153 Lod %float_0 + %13870 = OpCompositeExtract %float %17674 1 + %12431 = OpCompositeExtract %float %17674 2 + %23304 = OpFMul %float %13870 %12431 + %17616 = OpExtInst %float %1 FClamp %23304 %float_0 %float_1 + %20295 = OpVectorShuffle %v3float %15679 %15679 0 1 2 + %11190 = OpVectorTimesScalar %v3float %20295 %17616 + %15297 = OpFAdd %v3float %12107 %11190 + OpBranch %22311 + %22311 = OpLabel + %7723 = OpPhi %v3float %12107 %22310 %15297 %12825 + %23403 = OpVectorTimesScalar %v3float %7723 %float_0_5 + %9343 = OpFAdd %float %9342 %float_0_5 + %16239 = OpVectorShuffle %v3float %15530 %15530 0 1 2 + %22181 = OpFAdd %v3float %16239 %23403 + %15531 = OpVectorShuffle %v4float %15530 %22181 4 5 6 3 + %6438 = OpCompositeInsert %_struct_1017 %15531 %6437 0 + %24578 = OpVectorShuffle %v2float %95 %95 0 1 + %13211 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10350 = OpLoad %v4float %13211 + %8643 = OpVectorShuffle %v2float %10350 %10350 0 1 + %9202 = OpFMul %v2float %24578 %8643 + %18510 = OpFAdd %v2float %19927 %9202 + %7016 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21063 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13154 = OpExtInst %v2float %1 FClamp %18510 %7016 %21063 + %23589 = OpLoad %150 %5785 + %10351 = OpLoad %508 %5688 + %12162 = OpSampledImage %510 %23589 %10351 + %15376 = OpImageSampleExplicitLod %v4float %12162 %13154 Lod %float_0 + %15271 = OpCompositeExtract %float %15376 3 + %12121 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12977 = OpLoad %float %12121 + %15715 = OpFMul %float %15271 %12977 + %15284 = OpExtInst %float %1 FClamp %15715 %float_0 %float_1 + %22218 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11761 = OpLoad %v3float %22218 + %12108 = OpVectorTimesScalar %v3float %11761 %15284 + %15521 = OpLoad %150 %3312 + %24579 = OpLoad %508 %4646 + %12163 = OpSampledImage %510 %15521 %24579 + %17675 = OpImageSampleExplicitLod %v4float %12163 %13154 Lod %float_0 + %16943 = OpCompositeExtract %float %17675 1 + %14190 = OpFOrdGreaterThan %bool %16943 %float_0 + OpSelectionMerge %22312 DontFlatten + OpBranchConditional %14190 %12826 %22312 + %12826 = OpLabel + %13244 = OpLoad %150 %4862 + %19965 = OpLoad %508 %3594 + %12164 = OpSampledImage %510 %13244 %19965 + %15680 = OpImageSampleExplicitLod %v4float %12164 %13154 Lod %float_0 + %13871 = OpCompositeExtract %float %17675 1 + %12432 = OpCompositeExtract %float %17675 2 + %23305 = OpFMul %float %13871 %12432 + %17617 = OpExtInst %float %1 FClamp %23305 %float_0 %float_1 + %20296 = OpVectorShuffle %v3float %15680 %15680 0 1 2 + %11191 = OpVectorTimesScalar %v3float %20296 %17617 + %15298 = OpFAdd %v3float %12108 %11191 + OpBranch %22312 + %22312 = OpLabel + %7724 = OpPhi %v3float %12108 %22311 %15298 %12826 + %23404 = OpVectorTimesScalar %v3float %7724 %float_0_75 + %9344 = OpFAdd %float %9343 %float_0_75 + %16240 = OpVectorShuffle %v3float %15531 %15531 0 1 2 + %22182 = OpFAdd %v3float %16240 %23404 + %15532 = OpVectorShuffle %v4float %15531 %22182 4 5 6 3 + %6439 = OpCompositeInsert %_struct_1017 %15532 %6438 0 + %24580 = OpVectorShuffle %v2float %626 %626 0 1 + %13212 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10352 = OpLoad %v4float %13212 + %8644 = OpVectorShuffle %v2float %10352 %10352 0 1 + %9203 = OpFMul %v2float %24580 %8644 + %18511 = OpFAdd %v2float %19927 %9203 + %7017 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21064 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13155 = OpExtInst %v2float %1 FClamp %18511 %7017 %21064 + %23590 = OpLoad %150 %5785 + %10353 = OpLoad %508 %5688 + %12165 = OpSampledImage %510 %23590 %10353 + %15377 = OpImageSampleExplicitLod %v4float %12165 %13155 Lod %float_0 + %15272 = OpCompositeExtract %float %15377 3 + %12122 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12978 = OpLoad %float %12122 + %15716 = OpFMul %float %15272 %12978 + %15285 = OpExtInst %float %1 FClamp %15716 %float_0 %float_1 + %22219 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11762 = OpLoad %v3float %22219 + %12109 = OpVectorTimesScalar %v3float %11762 %15285 + %15522 = OpLoad %150 %3312 + %24581 = OpLoad %508 %4646 + %12166 = OpSampledImage %510 %15522 %24581 + %17676 = OpImageSampleExplicitLod %v4float %12166 %13155 Lod %float_0 + %16944 = OpCompositeExtract %float %17676 1 + %14191 = OpFOrdGreaterThan %bool %16944 %float_0 + OpSelectionMerge %22313 DontFlatten + OpBranchConditional %14191 %12827 %22313 + %12827 = OpLabel + %13245 = OpLoad %150 %4862 + %19966 = OpLoad %508 %3594 + %12167 = OpSampledImage %510 %13245 %19966 + %15681 = OpImageSampleExplicitLod %v4float %12167 %13155 Lod %float_0 + %13872 = OpCompositeExtract %float %17676 1 + %12433 = OpCompositeExtract %float %17676 2 + %23306 = OpFMul %float %13872 %12433 + %17618 = OpExtInst %float %1 FClamp %23306 %float_0 %float_1 + %20297 = OpVectorShuffle %v3float %15681 %15681 0 1 2 + %11192 = OpVectorTimesScalar %v3float %20297 %17618 + %15299 = OpFAdd %v3float %12109 %11192 + OpBranch %22313 + %22313 = OpLabel + %7725 = OpPhi %v3float %12109 %22312 %15299 %12827 + %23405 = OpVectorTimesScalar %v3float %7725 %float_1 + %9345 = OpFAdd %float %9344 %float_1 + %16241 = OpVectorShuffle %v3float %15532 %15532 0 1 2 + %22183 = OpFAdd %v3float %16241 %23405 + %15533 = OpVectorShuffle %v4float %15532 %22183 4 5 6 3 + %6440 = OpCompositeInsert %_struct_1017 %15533 %6439 0 + %24582 = OpVectorShuffle %v2float %2411 %2411 0 1 + %13213 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10354 = OpLoad %v4float %13213 + %8645 = OpVectorShuffle %v2float %10354 %10354 0 1 + %9204 = OpFMul %v2float %24582 %8645 + %18512 = OpFAdd %v2float %19927 %9204 + %7018 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21065 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13156 = OpExtInst %v2float %1 FClamp %18512 %7018 %21065 + %23591 = OpLoad %150 %5785 + %10355 = OpLoad %508 %5688 + %12168 = OpSampledImage %510 %23591 %10355 + %15378 = OpImageSampleExplicitLod %v4float %12168 %13156 Lod %float_0 + %15273 = OpCompositeExtract %float %15378 3 + %12123 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12979 = OpLoad %float %12123 + %15717 = OpFMul %float %15273 %12979 + %15286 = OpExtInst %float %1 FClamp %15717 %float_0 %float_1 + %22220 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11763 = OpLoad %v3float %22220 + %12110 = OpVectorTimesScalar %v3float %11763 %15286 + %15523 = OpLoad %150 %3312 + %24583 = OpLoad %508 %4646 + %12169 = OpSampledImage %510 %15523 %24583 + %17677 = OpImageSampleExplicitLod %v4float %12169 %13156 Lod %float_0 + %16945 = OpCompositeExtract %float %17677 1 + %14192 = OpFOrdGreaterThan %bool %16945 %float_0 + OpSelectionMerge %22314 DontFlatten + OpBranchConditional %14192 %12828 %22314 + %12828 = OpLabel + %13246 = OpLoad %150 %4862 + %19967 = OpLoad %508 %3594 + %12170 = OpSampledImage %510 %13246 %19967 + %15682 = OpImageSampleExplicitLod %v4float %12170 %13156 Lod %float_0 + %13873 = OpCompositeExtract %float %17677 1 + %12434 = OpCompositeExtract %float %17677 2 + %23307 = OpFMul %float %13873 %12434 + %17619 = OpExtInst %float %1 FClamp %23307 %float_0 %float_1 + %20298 = OpVectorShuffle %v3float %15682 %15682 0 1 2 + %11193 = OpVectorTimesScalar %v3float %20298 %17619 + %15300 = OpFAdd %v3float %12110 %11193 + OpBranch %22314 + %22314 = OpLabel + %7726 = OpPhi %v3float %12110 %22313 %15300 %12828 + %23406 = OpVectorTimesScalar %v3float %7726 %float_0_75 + %9346 = OpFAdd %float %9345 %float_0_75 + %16242 = OpVectorShuffle %v3float %15533 %15533 0 1 2 + %22184 = OpFAdd %v3float %16242 %23406 + %15534 = OpVectorShuffle %v4float %15533 %22184 4 5 6 3 + %6441 = OpCompositeInsert %_struct_1017 %15534 %6440 0 + %24584 = OpVectorShuffle %v2float %2354 %2354 0 1 + %13214 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10356 = OpLoad %v4float %13214 + %8646 = OpVectorShuffle %v2float %10356 %10356 0 1 + %9205 = OpFMul %v2float %24584 %8646 + %18513 = OpFAdd %v2float %19927 %9205 + %7019 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21066 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13157 = OpExtInst %v2float %1 FClamp %18513 %7019 %21066 + %23592 = OpLoad %150 %5785 + %10357 = OpLoad %508 %5688 + %12171 = OpSampledImage %510 %23592 %10357 + %15379 = OpImageSampleExplicitLod %v4float %12171 %13157 Lod %float_0 + %15274 = OpCompositeExtract %float %15379 3 + %12124 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12980 = OpLoad %float %12124 + %15718 = OpFMul %float %15274 %12980 + %15287 = OpExtInst %float %1 FClamp %15718 %float_0 %float_1 + %22221 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11764 = OpLoad %v3float %22221 + %12111 = OpVectorTimesScalar %v3float %11764 %15287 + %15524 = OpLoad %150 %3312 + %24585 = OpLoad %508 %4646 + %12172 = OpSampledImage %510 %15524 %24585 + %17678 = OpImageSampleExplicitLod %v4float %12172 %13157 Lod %float_0 + %16946 = OpCompositeExtract %float %17678 1 + %14193 = OpFOrdGreaterThan %bool %16946 %float_0 + OpSelectionMerge %22315 DontFlatten + OpBranchConditional %14193 %12829 %22315 + %12829 = OpLabel + %13247 = OpLoad %150 %4862 + %19968 = OpLoad %508 %3594 + %12173 = OpSampledImage %510 %13247 %19968 + %15683 = OpImageSampleExplicitLod %v4float %12173 %13157 Lod %float_0 + %13874 = OpCompositeExtract %float %17678 1 + %12435 = OpCompositeExtract %float %17678 2 + %23308 = OpFMul %float %13874 %12435 + %17620 = OpExtInst %float %1 FClamp %23308 %float_0 %float_1 + %20299 = OpVectorShuffle %v3float %15683 %15683 0 1 2 + %11194 = OpVectorTimesScalar %v3float %20299 %17620 + %15301 = OpFAdd %v3float %12111 %11194 + OpBranch %22315 + %22315 = OpLabel + %7727 = OpPhi %v3float %12111 %22314 %15301 %12829 + %23407 = OpVectorTimesScalar %v3float %7727 %float_0_5 + %9347 = OpFAdd %float %9346 %float_0_5 + %16243 = OpVectorShuffle %v3float %15534 %15534 0 1 2 + %22185 = OpFAdd %v3float %16243 %23407 + %15535 = OpVectorShuffle %v4float %15534 %22185 4 5 6 3 + %6442 = OpCompositeInsert %_struct_1017 %15535 %6441 0 + %24586 = OpVectorShuffle %v2float %837 %837 0 1 + %13215 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10358 = OpLoad %v4float %13215 + %8647 = OpVectorShuffle %v2float %10358 %10358 0 1 + %9206 = OpFMul %v2float %24586 %8647 + %18514 = OpFAdd %v2float %19927 %9206 + %7020 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21067 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13158 = OpExtInst %v2float %1 FClamp %18514 %7020 %21067 + %23593 = OpLoad %150 %5785 + %10359 = OpLoad %508 %5688 + %12174 = OpSampledImage %510 %23593 %10359 + %15380 = OpImageSampleExplicitLod %v4float %12174 %13158 Lod %float_0 + %15275 = OpCompositeExtract %float %15380 3 + %12125 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12981 = OpLoad %float %12125 + %15719 = OpFMul %float %15275 %12981 + %15288 = OpExtInst %float %1 FClamp %15719 %float_0 %float_1 + %22222 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11765 = OpLoad %v3float %22222 + %12112 = OpVectorTimesScalar %v3float %11765 %15288 + %15525 = OpLoad %150 %3312 + %24587 = OpLoad %508 %4646 + %12175 = OpSampledImage %510 %15525 %24587 + %17679 = OpImageSampleExplicitLod %v4float %12175 %13158 Lod %float_0 + %16947 = OpCompositeExtract %float %17679 1 + %14194 = OpFOrdGreaterThan %bool %16947 %float_0 + OpSelectionMerge %22316 DontFlatten + OpBranchConditional %14194 %12830 %22316 + %12830 = OpLabel + %13248 = OpLoad %150 %4862 + %19969 = OpLoad %508 %3594 + %12176 = OpSampledImage %510 %13248 %19969 + %15684 = OpImageSampleExplicitLod %v4float %12176 %13158 Lod %float_0 + %13875 = OpCompositeExtract %float %17679 1 + %12436 = OpCompositeExtract %float %17679 2 + %23309 = OpFMul %float %13875 %12436 + %17621 = OpExtInst %float %1 FClamp %23309 %float_0 %float_1 + %20300 = OpVectorShuffle %v3float %15684 %15684 0 1 2 + %11195 = OpVectorTimesScalar %v3float %20300 %17621 + %15302 = OpFAdd %v3float %12112 %11195 + OpBranch %22316 + %22316 = OpLabel + %7728 = OpPhi %v3float %12112 %22315 %15302 %12830 + %23408 = OpVectorTimesScalar %v3float %7728 %float_0_5 + %9348 = OpFAdd %float %9347 %float_0_5 + %16244 = OpVectorShuffle %v3float %15535 %15535 0 1 2 + %22186 = OpFAdd %v3float %16244 %23408 + %15536 = OpVectorShuffle %v4float %15535 %22186 4 5 6 3 + %6443 = OpCompositeInsert %_struct_1017 %15536 %6442 0 + %24588 = OpVectorShuffle %v2float %1368 %1368 0 1 + %13216 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10360 = OpLoad %v4float %13216 + %8648 = OpVectorShuffle %v2float %10360 %10360 0 1 + %9207 = OpFMul %v2float %24588 %8648 + %18515 = OpFAdd %v2float %19927 %9207 + %7021 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21068 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13159 = OpExtInst %v2float %1 FClamp %18515 %7021 %21068 + %23594 = OpLoad %150 %5785 + %10361 = OpLoad %508 %5688 + %12177 = OpSampledImage %510 %23594 %10361 + %15381 = OpImageSampleExplicitLod %v4float %12177 %13159 Lod %float_0 + %15276 = OpCompositeExtract %float %15381 3 + %12126 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12982 = OpLoad %float %12126 + %15720 = OpFMul %float %15276 %12982 + %15289 = OpExtInst %float %1 FClamp %15720 %float_0 %float_1 + %22223 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11766 = OpLoad %v3float %22223 + %12113 = OpVectorTimesScalar %v3float %11766 %15289 + %15526 = OpLoad %150 %3312 + %24589 = OpLoad %508 %4646 + %12178 = OpSampledImage %510 %15526 %24589 + %17680 = OpImageSampleExplicitLod %v4float %12178 %13159 Lod %float_0 + %16948 = OpCompositeExtract %float %17680 1 + %14195 = OpFOrdGreaterThan %bool %16948 %float_0 + OpSelectionMerge %22317 DontFlatten + OpBranchConditional %14195 %12831 %22317 + %12831 = OpLabel + %13249 = OpLoad %150 %4862 + %19970 = OpLoad %508 %3594 + %12179 = OpSampledImage %510 %13249 %19970 + %15685 = OpImageSampleExplicitLod %v4float %12179 %13159 Lod %float_0 + %13876 = OpCompositeExtract %float %17680 1 + %12437 = OpCompositeExtract %float %17680 2 + %23310 = OpFMul %float %13876 %12437 + %17622 = OpExtInst %float %1 FClamp %23310 %float_0 %float_1 + %20301 = OpVectorShuffle %v3float %15685 %15685 0 1 2 + %11196 = OpVectorTimesScalar %v3float %20301 %17622 + %15303 = OpFAdd %v3float %12113 %11196 + OpBranch %22317 + %22317 = OpLabel + %7729 = OpPhi %v3float %12113 %22316 %15303 %12831 + %23409 = OpVectorTimesScalar %v3float %7729 %float_0_75 + %9349 = OpFAdd %float %9348 %float_0_75 + %16245 = OpVectorShuffle %v3float %15536 %15536 0 1 2 + %22187 = OpFAdd %v3float %16245 %23409 + %15537 = OpVectorShuffle %v4float %15536 %22187 4 5 6 3 + %6444 = OpCompositeInsert %_struct_1017 %15537 %6443 0 + %24590 = OpVectorShuffle %v2float %142 %142 0 1 + %13217 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10362 = OpLoad %v4float %13217 + %8649 = OpVectorShuffle %v2float %10362 %10362 0 1 + %9208 = OpFMul %v2float %24590 %8649 + %18516 = OpFAdd %v2float %19927 %9208 + %7022 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21069 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13160 = OpExtInst %v2float %1 FClamp %18516 %7022 %21069 + %23595 = OpLoad %150 %5785 + %10363 = OpLoad %508 %5688 + %12180 = OpSampledImage %510 %23595 %10363 + %15382 = OpImageSampleExplicitLod %v4float %12180 %13160 Lod %float_0 + %15277 = OpCompositeExtract %float %15382 3 + %12127 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12983 = OpLoad %float %12127 + %15721 = OpFMul %float %15277 %12983 + %15290 = OpExtInst %float %1 FClamp %15721 %float_0 %float_1 + %22224 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11767 = OpLoad %v3float %22224 + %12114 = OpVectorTimesScalar %v3float %11767 %15290 + %15538 = OpLoad %150 %3312 + %24591 = OpLoad %508 %4646 + %12181 = OpSampledImage %510 %15538 %24591 + %17681 = OpImageSampleExplicitLod %v4float %12181 %13160 Lod %float_0 + %16949 = OpCompositeExtract %float %17681 1 + %14196 = OpFOrdGreaterThan %bool %16949 %float_0 + OpSelectionMerge %22318 DontFlatten + OpBranchConditional %14196 %12832 %22318 + %12832 = OpLabel + %13250 = OpLoad %150 %4862 + %19971 = OpLoad %508 %3594 + %12182 = OpSampledImage %510 %13250 %19971 + %15686 = OpImageSampleExplicitLod %v4float %12182 %13160 Lod %float_0 + %13877 = OpCompositeExtract %float %17681 1 + %12438 = OpCompositeExtract %float %17681 2 + %23311 = OpFMul %float %13877 %12438 + %17623 = OpExtInst %float %1 FClamp %23311 %float_0 %float_1 + %20302 = OpVectorShuffle %v3float %15686 %15686 0 1 2 + %11197 = OpVectorTimesScalar %v3float %20302 %17623 + %15304 = OpFAdd %v3float %12114 %11197 + OpBranch %22318 + %22318 = OpLabel + %7730 = OpPhi %v3float %12114 %22317 %15304 %12832 + %23410 = OpVectorTimesScalar %v3float %7730 %float_0_5 + %9350 = OpFAdd %float %9349 %float_0_5 + %16246 = OpVectorShuffle %v3float %15537 %15537 0 1 2 + %22188 = OpFAdd %v3float %16246 %23410 + %15539 = OpVectorShuffle %v4float %15537 %22188 4 5 6 3 + %6445 = OpCompositeInsert %_struct_1017 %15539 %6444 0 + %24592 = OpVectorShuffle %v2float %1197 %1197 0 1 + %13218 = OpAccessChain %_ptr_Uniform_v4float %22044 %int_0 + %10364 = OpLoad %v4float %13218 + %8650 = OpVectorShuffle %v2float %10364 %10364 0 1 + %9209 = OpFMul %v2float %24592 %8650 + %18517 = OpFAdd %v2float %19927 %9209 + %7023 = OpVectorShuffle %v2float %17581 %17581 0 1 + %21070 = OpVectorShuffle %v2float %17581 %17581 2 3 + %13161 = OpExtInst %v2float %1 FClamp %18517 %7023 %21070 + %23596 = OpLoad %150 %5785 + %10365 = OpLoad %508 %5688 + %12183 = OpSampledImage %510 %23596 %10365 + %15383 = OpImageSampleExplicitLod %v4float %12183 %13161 Lod %float_0 + %15278 = OpCompositeExtract %float %15383 3 + %12128 = OpAccessChain %_ptr_Uniform_float %22044 %int_1 + %12984 = OpLoad %float %12128 + %15722 = OpFMul %float %15278 %12984 + %15291 = OpExtInst %float %1 FClamp %15722 %float_0 %float_1 + %22225 = OpAccessChain %_ptr_Uniform_v3float %12348 %int_5 + %11768 = OpLoad %v3float %22225 + %12115 = OpVectorTimesScalar %v3float %11768 %15291 + %15540 = OpLoad %150 %3312 + %24593 = OpLoad %508 %4646 + %12184 = OpSampledImage %510 %15540 %24593 + %17682 = OpImageSampleExplicitLod %v4float %12184 %13161 Lod %float_0 + %16950 = OpCompositeExtract %float %17682 1 + %14197 = OpFOrdGreaterThan %bool %16950 %float_0 + OpSelectionMerge %22319 DontFlatten + OpBranchConditional %14197 %12833 %22319 + %12833 = OpLabel + %13251 = OpLoad %150 %4862 + %19972 = OpLoad %508 %3594 + %12185 = OpSampledImage %510 %13251 %19972 + %15687 = OpImageSampleExplicitLod %v4float %12185 %13161 Lod %float_0 + %13878 = OpCompositeExtract %float %17682 1 + %12439 = OpCompositeExtract %float %17682 2 + %23312 = OpFMul %float %13878 %12439 + %17624 = OpExtInst %float %1 FClamp %23312 %float_0 %float_1 + %20303 = OpVectorShuffle %v3float %15687 %15687 0 1 2 + %11198 = OpVectorTimesScalar %v3float %20303 %17624 + %15305 = OpFAdd %v3float %12115 %11198 + OpBranch %22319 + %22319 = OpLabel + %7731 = OpPhi %v3float %12115 %22318 %15305 %12833 + %23411 = OpVectorTimesScalar %v3float %7731 %float_0_5 + %9351 = OpFAdd %float %9350 %float_0_5 + %16247 = OpVectorShuffle %v3float %15539 %15539 0 1 2 + %22189 = OpFAdd %v3float %16247 %23411 + %15541 = OpVectorShuffle %v4float %15539 %22189 4 5 6 3 + %6719 = OpCompositeInsert %_struct_1017 %15541 %6445 0 + %23412 = OpVectorShuffle %v3float %15541 %15541 0 1 2 + %10833 = OpCompositeConstruct %v3float %9351 %9351 %9351 + %13750 = OpFDiv %v3float %23412 %10833 + %24033 = OpVectorShuffle %v4float %15541 %13750 4 5 6 3 + %8636 = OpCompositeInsert %_struct_1017 %24033 %6719 0 + %16315 = OpCompositeInsert %_struct_1017 %float_1 %8636 0 3 + %11544 = OpCompositeExtract %v4float %16315 0 + OpStore %4317 %11544 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/geom/block-name-namespace.asm.geom b/third_party/spirv-cross/shaders/asm/geom/block-name-namespace.asm.geom new file mode 100644 index 0000000000..b3744a3032 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/geom/block-name-namespace.asm.geom @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 48 +; Schema: 0 + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %_ %VertexOutput %vin + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 4 + OpSource GLSL 450 + OpName %main "main" + OpName %VertexInput3 "VertexInput" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpName %VertexInput "VertexInput" + OpMemberName %VertexInput 0 "a" + OpName %VertexInput4 "VertexInput" + OpName %VertexInput_0 "VertexInput" + OpMemberName %VertexInput_0 0 "b" + OpName %VertexInput2 "VertexInput" + OpName %VertexInput_1 "VertexInput" + OpMemberName %VertexInput_1 0 "vColor" + OpName %VertexOutput "VertexInput" + OpName %VertexInput_2 "VertexInput" + OpMemberName %VertexInput_2 0 "vColor" + OpName %vin "vin" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %VertexInput 0 Offset 0 + OpDecorate %VertexInput Block + OpDecorate %VertexInput4 DescriptorSet 0 + OpDecorate %VertexInput4 Binding 0 + OpMemberDecorate %VertexInput_0 0 Offset 0 + OpDecorate %VertexInput_0 BufferBlock + OpDecorate %VertexInput2 DescriptorSet 0 + OpDecorate %VertexInput2 Binding 0 + OpDecorate %VertexInput_1 Block + OpDecorate %VertexOutput Location 0 + OpDecorate %VertexInput_2 Block + OpDecorate %vin 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 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%VertexInput = OpTypeStruct %v4float +%_ptr_Uniform_VertexInput = OpTypePointer Uniform %VertexInput +%VertexInput4 = OpVariable %_ptr_Uniform_VertexInput Uniform +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%VertexInput_0 = OpTypeStruct %v4float +%_ptr_Uniform_VertexInput_0 = OpTypePointer Uniform %VertexInput_0 +%VertexInput2 = OpVariable %_ptr_Uniform_VertexInput_0 Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%VertexInput_1 = OpTypeStruct %v4float +%_ptr_Output_VertexInput_1 = OpTypePointer Output %VertexInput_1 +%VertexOutput = OpVariable %_ptr_Output_VertexInput_1 Output +%VertexInput_2 = OpTypeStruct %v4float + %uint_3 = OpConstant %uint 3 +%_arr_VertexInput_2_uint_3 = OpTypeArray %VertexInput_2 %uint_3 +%_ptr_Input__arr_VertexInput_2_uint_3 = OpTypePointer Input %_arr_VertexInput_2_uint_3 + %vin = OpVariable %_ptr_Input__arr_VertexInput_2_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel +%VertexInput3 = OpVariable %_ptr_Function_v4float Function + OpStore %VertexInput3 %11 + %20 = OpLoad %v4float %VertexInput3 + %25 = OpAccessChain %_ptr_Uniform_v4float %VertexInput4 %int_0 + %26 = OpLoad %v4float %25 + %27 = OpFAdd %v4float %20 %26 + %31 = OpAccessChain %_ptr_Uniform_v4float %VertexInput2 %int_0 + %32 = OpLoad %v4float %31 + %33 = OpFAdd %v4float %27 %32 + %35 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %35 %33 + %45 = OpAccessChain %_ptr_Input_v4float %vin %int_0 %int_0 + %46 = OpLoad %v4float %45 + %47 = OpAccessChain %_ptr_Output_v4float %VertexOutput %int_0 + OpStore %47 %46 + OpEmitVertex + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/geom/inout-split-access-chain-handle.asm.geom b/third_party/spirv-cross/shaders/asm/geom/inout-split-access-chain-handle.asm.geom new file mode 100644 index 0000000000..d011cc6967 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/geom/inout-split-access-chain-handle.asm.geom @@ -0,0 +1,90 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 42 +; Schema: 0 + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %gl_in %_ + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 5 + OpSource GLSL 440 + OpName %main "main" + OpName %Data "Data" + OpMemberName %Data 0 "ApiPerspectivePosition" + OpName %Copy_struct_Data_vf41_3__ "Copy(struct-Data-vf41[3];" + OpName %inputStream "inputStream" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %gl_in "gl_in" + OpName %inputStream_0 "inputStream" + OpName %param "param" + OpName %gl_PerVertex_0 "gl_PerVertex" + OpMemberName %gl_PerVertex_0 0 "gl_Position" + OpMemberName %gl_PerVertex_0 1 "gl_PointSize" + OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex_0 Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %Data = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_Data_uint_3 = OpTypeArray %Data %uint_3 +%_ptr_Function__Data = OpTypePointer Function %Data +%_ptr_Function__arr_Data_uint_3 = OpTypePointer Function %_arr_Data_uint_3 + %13 = OpTypeFunction %void %_ptr_Function__arr_Data_uint_3 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0 + %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel +%inputStream_0 = OpVariable %_ptr_Function__arr_Data_uint_3 Function + %param = OpVariable %_ptr_Function__arr_Data_uint_3 Function + %32 = OpLoad %_arr_Data_uint_3 %inputStream_0 + OpStore %param %32 + %33 = OpFunctionCall %void %Copy_struct_Data_vf41_3__ %param + %34 = OpLoad %_arr_Data_uint_3 %param + OpStore %inputStream_0 %34 + %59 = OpAccessChain %_ptr_Function__Data %inputStream_0 %int_0 + %38 = OpAccessChain %_ptr_Function_v4float %59 %int_0 + %39 = OpLoad %v4float %38 + %41 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %41 %39 + OpReturn + OpFunctionEnd +%Copy_struct_Data_vf41_3__ = OpFunction %void None %13 +%inputStream = OpFunctionParameter %_ptr_Function__arr_Data_uint_3 + %16 = OpLabel + %26 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0 + %27 = OpLoad %v4float %26 + %28 = OpAccessChain %_ptr_Function__Data %inputStream %int_0 + %29 = OpAccessChain %_ptr_Function_v4float %28 %int_0 + OpStore %29 %27 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/geom/split-access-chain-input.asm.geom b/third_party/spirv-cross/shaders/asm/geom/split-access-chain-input.asm.geom new file mode 100644 index 0000000000..5e477fa33a --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/geom/split-access-chain-input.asm.geom @@ -0,0 +1,52 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 23 +; Schema: 0 + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %gl_in %position + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource GLSL 440 + OpName %main "main" + OpName %position "position" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpName %gl_in "gl_in" + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpDecorate %gl_PerVertex Block + OpDecorate %position BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Output %v4float + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 + %uint_3 = OpConstant %uint 3 +%_arr_gl_PerVertex_uint_3 = OpTypeArray %gl_PerVertex %uint_3 +%ptr_Input_gl_PerVertex = OpTypePointer Input %gl_PerVertex +%_ptr_Input__arr_gl_PerVertex_uint_3 = OpTypePointer Input %_arr_gl_PerVertex_uint_3 + %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_3 Input + %position = OpVariable %_ptr_Function_v4float Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %ptr_Input_gl_PerVertex %gl_in %int_0 + %22 = OpAccessChain %_ptr_Input_v4float %21 %int_0 + %23 = OpLoad %v4float %22 + OpStore %position %23 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/geom/unroll-glposition-load.asm.geom b/third_party/spirv-cross/shaders/asm/geom/unroll-glposition-load.asm.geom new file mode 100644 index 0000000000..8c10de397b --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/geom/unroll-glposition-load.asm.geom @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 55 +; Schema: 0 + OpCapability Geometry + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %OUT_pos %positions_1 + OpExecutionMode %main Triangles + OpExecutionMode %main Invocations 1 + OpExecutionMode %main OutputTriangleStrip + OpExecutionMode %main OutputVertices 3 + OpSource HLSL 500 + OpName %main "main" + OpName %SceneOut "SceneOut" + OpMemberName %SceneOut 0 "pos" + OpName %_main_vf4_3__struct_SceneOut_vf41_ "@main(vf4[3];struct-SceneOut-vf41;" + OpName %positions "positions" + OpName %OUT "OUT" + OpName %i "i" + OpName %o "o" + OpName %OUT_pos "OUT.pos" + OpName %positions_0 "positions" + OpName %positions_1 "positions" + OpName %OUT_0 "OUT" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %OUT_pos BuiltIn Position + OpDecorate %positions_1 BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Function__arr_v4float_uint_3 = OpTypePointer Function %_arr_v4float_uint_3 + %SceneOut = OpTypeStruct %v4float +%_ptr_Function_SceneOut = OpTypePointer Function %SceneOut + %14 = OpTypeFunction %void %_ptr_Function__arr_v4float_uint_3 %_ptr_Function_SceneOut + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_3 = OpConstant %int 3 + %bool = OpTypeBool +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OUT_pos = OpVariable %_ptr_Output_v4float Output + %int_1 = OpConstant %int 1 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 +%positions_1 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input + %main = OpFunction %void None %3 + %5 = OpLabel +%positions_0 = OpVariable %_ptr_Function__arr_v4float_uint_3 Function + %OUT_0 = OpVariable %_ptr_Function_SceneOut Function + %param = OpVariable %_ptr_Function__arr_v4float_uint_3 Function + %param_0 = OpVariable %_ptr_Function_SceneOut Function + %48 = OpLoad %_arr_v4float_uint_3 %positions_1 + OpStore %positions_0 %48 + %51 = OpLoad %_arr_v4float_uint_3 %positions_0 + OpStore %param %51 + %53 = OpFunctionCall %void %_main_vf4_3__struct_SceneOut_vf41_ %param %param_0 + %54 = OpLoad %SceneOut %param_0 + OpStore %OUT_0 %54 + OpReturn + OpFunctionEnd +%_main_vf4_3__struct_SceneOut_vf41_ = OpFunction %void None %14 + %positions = OpFunctionParameter %_ptr_Function__arr_v4float_uint_3 + %OUT = OpFunctionParameter %_ptr_Function_SceneOut + %18 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %o = OpVariable %_ptr_Function_SceneOut Function + OpStore %i %int_0 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %28 = OpLoad %int %i + %31 = OpSLessThan %bool %28 %int_3 + OpBranchConditional %31 %24 %25 + %24 = OpLabel + %33 = OpLoad %int %i + %35 = OpAccessChain %_ptr_Function_v4float %positions %33 + %36 = OpLoad %v4float %35 + %37 = OpAccessChain %_ptr_Function_v4float %o %int_0 + OpStore %37 %36 + %40 = OpAccessChain %_ptr_Function_v4float %o %int_0 + %41 = OpLoad %v4float %40 + OpStore %OUT_pos %41 + OpEmitVertex + OpBranch %26 + %26 = OpLabel + %42 = OpLoad %int %i + %44 = OpIAdd %int %42 %int_1 + OpStore %i %44 + OpBranch %23 + %25 = OpLabel + OpEndPrimitive + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/tese/unroll-input-array-load.asm.tese b/third_party/spirv-cross/shaders/asm/tese/unroll-input-array-load.asm.tese new file mode 100644 index 0000000000..960b8fa2de --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/tese/unroll-input-array-load.asm.tese @@ -0,0 +1,131 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 79 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationEvaluation %main "main" %input_foo %input_bar %uv_1 %CPData_1 %_entryPointOutput_pos + OpExecutionMode %main Quads + OpSource HLSL 500 + OpName %main "main" + OpName %HS_INPUT "HS_INPUT" + OpMemberName %HS_INPUT 0 "foo" + OpMemberName %HS_INPUT 1 "bar" + OpName %ControlPoint "ControlPoint" + OpMemberName %ControlPoint 0 "baz" + OpName %DS_OUTPUT "DS_OUTPUT" + OpMemberName %DS_OUTPUT 0 "pos" + OpName %_main_struct_HS_INPUT_vf4_vf41_vf2_struct_ControlPoint_vf41_4__ "@main(struct-HS_INPUT-vf4-vf41;vf2;struct-ControlPoint-vf41[4];" + OpName %input "input" + OpName %uv "uv" + OpName %CPData "CPData" + OpName %o "o" + OpName %input_0 "input" + OpName %input_foo "input.foo" + OpName %input_bar "input.bar" + OpName %uv_0 "uv" + OpName %uv_1 "uv" + OpName %CPData_0 "CPData" + OpName %CPData_1 "CPData" + OpName %_entryPointOutput_pos "@entryPointOutput.pos" + OpName %param "param" + OpName %param_0 "param" + OpName %param_1 "param" + OpDecorate %input_foo Patch + OpDecorate %input_foo Location 0 + OpDecorate %input_bar Patch + OpDecorate %input_bar Location 1 + OpDecorate %uv_1 Patch + OpDecorate %uv_1 BuiltIn TessCoord + OpDecorate %CPData_1 Location 2 + OpDecorate %_entryPointOutput_pos BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %HS_INPUT = OpTypeStruct %v4float %v4float +%_ptr_Function_HS_INPUT = OpTypePointer Function %HS_INPUT + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%ControlPoint = OpTypeStruct %v4float + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_ControlPoint_uint_4 = OpTypeArray %ControlPoint %uint_4 +%_ptr_Function__arr_ControlPoint_uint_4 = OpTypePointer Function %_arr_ControlPoint_uint_4 + %DS_OUTPUT = OpTypeStruct %v4float + %18 = OpTypeFunction %DS_OUTPUT %_ptr_Function_HS_INPUT %_ptr_Function_v2float %_ptr_Function__arr_ControlPoint_uint_4 +%_ptr_Function_DS_OUTPUT = OpTypePointer Function %DS_OUTPUT + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %int_1 = OpConstant %int 1 + %int_3 = OpConstant %int 3 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %input_foo = OpVariable %_ptr_Input_v4float Input + %input_bar = OpVariable %_ptr_Input_v4float Input + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %uv_1 = OpVariable %_ptr_Input_v3float Input +%_ptr_Input__arr_ControlPoint_uint_4 = OpTypePointer Input %_arr_ControlPoint_uint_4 + %CPData_1 = OpVariable %_ptr_Input__arr_ControlPoint_uint_4 Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_pos = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %input_0 = OpVariable %_ptr_Function_HS_INPUT Function + %uv_0 = OpVariable %_ptr_Function_v2float Function + %CPData_0 = OpVariable %_ptr_Function__arr_ControlPoint_uint_4 Function + %param = OpVariable %_ptr_Function_HS_INPUT Function + %param_0 = OpVariable %_ptr_Function_v2float Function + %param_1 = OpVariable %_ptr_Function__arr_ControlPoint_uint_4 Function + %52 = OpLoad %v4float %input_foo + %53 = OpAccessChain %_ptr_Function_v4float %input_0 %int_0 + OpStore %53 %52 + %55 = OpLoad %v4float %input_bar + %56 = OpAccessChain %_ptr_Function_v4float %input_0 %int_1 + OpStore %56 %55 + %61 = OpLoad %v3float %uv_1 + %62 = OpCompositeExtract %float %61 0 + %63 = OpCompositeExtract %float %61 1 + %64 = OpCompositeConstruct %v2float %62 %63 + OpStore %uv_0 %64 + %68 = OpLoad %_arr_ControlPoint_uint_4 %CPData_1 + OpStore %CPData_0 %68 + %72 = OpLoad %HS_INPUT %input_0 + OpStore %param %72 + %74 = OpLoad %v2float %uv_0 + OpStore %param_0 %74 + %76 = OpLoad %_arr_ControlPoint_uint_4 %CPData_0 + OpStore %param_1 %76 + %77 = OpFunctionCall %DS_OUTPUT %_main_struct_HS_INPUT_vf4_vf41_vf2_struct_ControlPoint_vf41_4__ %param %param_0 %param_1 + %78 = OpCompositeExtract %v4float %77 0 + OpStore %_entryPointOutput_pos %78 + OpReturn + OpFunctionEnd +%_main_struct_HS_INPUT_vf4_vf41_vf2_struct_ControlPoint_vf41_4__ = OpFunction %DS_OUTPUT None %18 + %input = OpFunctionParameter %_ptr_Function_HS_INPUT + %uv = OpFunctionParameter %_ptr_Function_v2float + %CPData = OpFunctionParameter %_ptr_Function__arr_ControlPoint_uint_4 + %23 = OpLabel + %o = OpVariable %_ptr_Function_DS_OUTPUT Function + %29 = OpAccessChain %_ptr_Function_v4float %input %int_0 + %30 = OpLoad %v4float %29 + %32 = OpAccessChain %_ptr_Function_v4float %input %int_1 + %33 = OpLoad %v4float %32 + %34 = OpFAdd %v4float %30 %33 + %35 = OpLoad %v2float %uv + %36 = OpVectorShuffle %v4float %35 %35 0 1 0 1 + %37 = OpFAdd %v4float %34 %36 + %38 = OpAccessChain %_ptr_Function_v4float %CPData %int_0 %int_0 + %39 = OpLoad %v4float %38 + %40 = OpFAdd %v4float %37 %39 + %42 = OpAccessChain %_ptr_Function_v4float %CPData %int_3 %int_0 + %43 = OpLoad %v4float %42 + %44 = OpFAdd %v4float %40 %43 + %45 = OpAccessChain %_ptr_Function_v4float %o %int_0 + OpStore %45 %44 + %46 = OpLoad %DS_OUTPUT %o + OpReturnValue %46 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/empty-io.asm.vert b/third_party/spirv-cross/shaders/asm/vert/empty-io.asm.vert new file mode 100644 index 0000000000..0ba6cb7963 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/empty-io.asm.vert @@ -0,0 +1,70 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %position %_entryPointOutput_position %_entryPointOutput + OpName %main "main" + OpName %VSInput "VSInput" + OpMemberName %VSInput 0 "position" + OpName %VSOutput "VSOutput" + OpMemberName %VSOutput 0 "position" + OpName %_main_struct_VSInput_vf41_ "@main(struct-VSInput-vf41;" + OpName %_input "_input" + OpName %_out "_out" + OpName %_input_0 "_input" + OpName %position "position" + OpName %_entryPointOutput_position "@entryPointOutput_position" + OpName %param "param" + OpName %VSOutput_0 "VSOutput" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %position Location 0 + OpDecorate %_entryPointOutput_position BuiltIn Position + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %VSInput = OpTypeStruct %v4float +%_ptr_Function_VSInput = OpTypePointer Function %VSInput + %VSOutput = OpTypeStruct %v4float + %11 = OpTypeFunction %VSOutput %_ptr_Function_VSInput +%_ptr_Function_VSOutput = OpTypePointer Function %VSOutput + %int = OpTypeInt 32 1 + %18 = OpConstant %int 0 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %position = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_position = OpVariable %_ptr_Output_v4float Output + %VSOutput_0 = OpTypeStruct +%_ptr_Output_VSOutput_0 = OpTypePointer Output %VSOutput_0 +%_entryPointOutput = OpVariable %_ptr_Output_VSOutput_0 Output + %main = OpFunction %void None %3 + %5 = OpLabel + %_input_0 = OpVariable %_ptr_Function_VSInput Function + %param = OpVariable %_ptr_Function_VSInput Function + %29 = OpLoad %v4float %position + %30 = OpAccessChain %_ptr_Function_v4float %_input_0 %18 + OpStore %30 %29 + %34 = OpLoad %VSInput %_input_0 + OpStore %param %34 + %35 = OpFunctionCall %VSOutput %_main_struct_VSInput_vf41_ %param + %36 = OpCompositeExtract %v4float %35 0 + OpStore %_entryPointOutput_position %36 + OpReturn + OpFunctionEnd +%_main_struct_VSInput_vf41_ = OpFunction %VSOutput None %11 + %_input = OpFunctionParameter %_ptr_Function_VSInput + %14 = OpLabel + %_out = OpVariable %_ptr_Function_VSOutput Function + %20 = OpAccessChain %_ptr_Function_v4float %_input %18 + %21 = OpLoad %v4float %20 + %22 = OpAccessChain %_ptr_Function_v4float %_out %18 + OpStore %22 %21 + %23 = OpLoad %VSOutput %_out + OpReturnValue %23 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/third_party/spirv-cross/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert new file mode 100644 index 0000000000..89edeaa731 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -0,0 +1,141 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 79 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %VS "main" %PosL_1 %instanceID_1 %_entryPointOutput_Position %_entryPointOutput_Color + OpSource HLSL 500 + OpName %VS "VS" + OpName %V2F "V2F" + OpMemberName %V2F 0 "Position" + OpMemberName %V2F 1 "Color" + OpName %_VS_vf3_u1_ "@VS(vf3;u1;" + OpName %PosL "PosL" + OpName %instanceID "instanceID" + OpName %InstanceData "InstanceData" + OpMemberName %InstanceData 0 "MATRIX_MVP" + OpMemberName %InstanceData 1 "Color" + OpName %instData "instData" + OpName %InstanceData_0 "InstanceData" + OpMemberName %InstanceData_0 0 "MATRIX_MVP" + OpMemberName %InstanceData_0 1 "Color" + OpName %gInstanceData "gInstanceData" + OpMemberName %gInstanceData 0 "@data" + OpName %gInstanceData_0 "gInstanceData" + OpName %v2f "v2f" + OpName %PosL_0 "PosL" + OpName %PosL_1 "PosL" + OpName %instanceID_0 "instanceID" + OpName %instanceID_1 "instanceID" + OpName %flattenTemp "flattenTemp" + OpName %param "param" + OpName %param_0 "param" + OpName %_entryPointOutput_Position "@entryPointOutput.Position" + OpName %_entryPointOutput_Color "@entryPointOutput.Color" + OpMemberDecorate %InstanceData_0 0 RowMajor + OpMemberDecorate %InstanceData_0 0 Offset 0 + OpMemberDecorate %InstanceData_0 0 MatrixStride 16 + OpMemberDecorate %InstanceData_0 1 Offset 64 + OpDecorate %_runtimearr_InstanceData_0 ArrayStride 80 + OpMemberDecorate %gInstanceData 0 NonWritable + OpMemberDecorate %gInstanceData 0 Offset 0 + OpDecorate %gInstanceData BufferBlock + OpDecorate %gInstanceData_0 DescriptorSet 1 + OpDecorate %gInstanceData_0 Binding 0 + OpDecorate %PosL_1 Location 0 + OpDecorate %instanceID_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput_Position BuiltIn Position + OpDecorate %_entryPointOutput_Color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %v4float = OpTypeVector %float 4 + %V2F = OpTypeStruct %v4float %v4float + %13 = OpTypeFunction %V2F %_ptr_Function_v3float %_ptr_Function_uint +%mat4v4float = OpTypeMatrix %v4float 4 +%InstanceData = OpTypeStruct %mat4v4float %v4float +%_ptr_Function_InstanceData = OpTypePointer Function %InstanceData +%InstanceData_0 = OpTypeStruct %mat4v4float %v4float +%_runtimearr_InstanceData_0 = OpTypeRuntimeArray %InstanceData_0 +%gInstanceData = OpTypeStruct %_runtimearr_InstanceData_0 +%_ptr_Uniform_gInstanceData = OpTypePointer Uniform %gInstanceData +%gInstanceData_0 = OpVariable %_ptr_Uniform_gInstanceData Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_InstanceData_0 = OpTypePointer Uniform %InstanceData_0 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %int_1 = OpConstant %int 1 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_V2F = OpTypePointer Function %V2F + %float_1 = OpConstant %float 1 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %PosL_1 = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_uint = OpTypePointer Input %uint +%instanceID_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_Position = OpVariable %_ptr_Output_v4float Output +%_entryPointOutput_Color = OpVariable %_ptr_Output_v4float Output + %VS = OpFunction %void None %3 + %5 = OpLabel + %PosL_0 = OpVariable %_ptr_Function_v3float Function +%instanceID_0 = OpVariable %_ptr_Function_uint Function +%flattenTemp = OpVariable %_ptr_Function_V2F Function + %param = OpVariable %_ptr_Function_v3float Function + %param_0 = OpVariable %_ptr_Function_uint Function + %61 = OpLoad %v3float %PosL_1 + OpStore %PosL_0 %61 + %65 = OpLoad %uint %instanceID_1 + OpStore %instanceID_0 %65 + %68 = OpLoad %v3float %PosL_0 + OpStore %param %68 + %70 = OpLoad %uint %instanceID_0 + OpStore %param_0 %70 + %71 = OpFunctionCall %V2F %_VS_vf3_u1_ %param %param_0 + OpStore %flattenTemp %71 + %74 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_0 + %75 = OpLoad %v4float %74 + OpStore %_entryPointOutput_Position %75 + %77 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_1 + %78 = OpLoad %v4float %77 + OpStore %_entryPointOutput_Color %78 + OpReturn + OpFunctionEnd +%_VS_vf3_u1_ = OpFunction %V2F None %13 + %PosL = OpFunctionParameter %_ptr_Function_v3float + %instanceID = OpFunctionParameter %_ptr_Function_uint + %17 = OpLabel + %instData = OpVariable %_ptr_Function_InstanceData Function + %v2f = OpVariable %_ptr_Function_V2F Function + %29 = OpLoad %uint %instanceID + %31 = OpAccessChain %_ptr_Uniform_InstanceData_0 %gInstanceData_0 %int_0 %29 + %32 = OpLoad %InstanceData_0 %31 + %33 = OpCompositeExtract %mat4v4float %32 0 + %35 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + OpStore %35 %33 + %36 = OpCompositeExtract %v4float %32 1 + %39 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + OpStore %39 %36 + %42 = OpAccessChain %_ptr_Function_mat4v4float %instData %int_0 + %43 = OpLoad %mat4v4float %42 + %44 = OpLoad %v3float %PosL + %46 = OpCompositeExtract %float %44 0 + %47 = OpCompositeExtract %float %44 1 + %48 = OpCompositeExtract %float %44 2 + %49 = OpCompositeConstruct %v4float %46 %47 %48 %float_1 + %50 = OpMatrixTimesVector %v4float %43 %49 + %51 = OpAccessChain %_ptr_Function_v4float %v2f %int_0 + OpStore %51 %50 + %52 = OpAccessChain %_ptr_Function_v4float %instData %int_1 + %53 = OpLoad %v4float %52 + %54 = OpAccessChain %_ptr_Function_v4float %v2f %int_1 + OpStore %54 %53 + %55 = OpLoad %V2F %v2f + OpReturnValue %55 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/global-builtin.sso.asm.vert b/third_party/spirv-cross/shaders/asm/vert/global-builtin.sso.asm.vert new file mode 100644 index 0000000000..d7306deb24 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/global-builtin.sso.asm.vert @@ -0,0 +1,68 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 40 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_entryPointOutput %_entryPointOutput_pos + OpSource HLSL 500 + OpName %main "main" + OpName %VSOut "VSOut" + OpMemberName %VSOut 0 "a" + OpMemberName %VSOut 1 "pos" + OpName %_main_ "@main(" + OpName %vout "vout" + OpName %flattenTemp "flattenTemp" + OpName %VSOut_0 "VSOut" + OpMemberName %VSOut_0 0 "a" + OpName %_entryPointOutput "@entryPointOutput" + OpName %_entryPointOutput_pos "@entryPointOutput_pos" + OpDecorate %_entryPointOutput Location 0 + OpDecorate %_entryPointOutput_pos BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %VSOut = OpTypeStruct %float %v4float + %9 = OpTypeFunction %VSOut +%_ptr_Function_VSOut = OpTypePointer Function %VSOut + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_40 = OpConstant %float 40 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %21 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %VSOut_0 = OpTypeStruct %float +%_ptr_Output_VSOut_0 = OpTypePointer Output %VSOut_0 +%_entryPointOutput = OpVariable %_ptr_Output_VSOut_0 Output +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput_pos = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel +%flattenTemp = OpVariable %_ptr_Function_VSOut Function + %28 = OpFunctionCall %VSOut %_main_ + OpStore %flattenTemp %28 + %32 = OpAccessChain %_ptr_Function_float %flattenTemp %int_0 + %33 = OpLoad %float %32 + %35 = OpAccessChain %_ptr_Output_float %_entryPointOutput %int_0 + OpStore %35 %33 + %38 = OpAccessChain %_ptr_Function_v4float %flattenTemp %int_1 + %39 = OpLoad %v4float %38 + OpStore %_entryPointOutput_pos %39 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %VSOut None %9 + %11 = OpLabel + %vout = OpVariable %_ptr_Function_VSOut Function + %18 = OpAccessChain %_ptr_Function_float %vout %int_0 + OpStore %18 %float_40 + %23 = OpAccessChain %_ptr_Function_v4float %vout %int_1 + OpStore %23 %21 + %24 = OpLoad %VSOut %vout + OpReturnValue %24 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/invariant-block.asm.vert b/third_party/spirv-cross/shaders/asm/vert/invariant-block.asm.vert new file mode 100644 index 0000000000..5984935c7b --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/invariant-block.asm.vert @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 Invariant + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/invariant-block.sso.asm.vert b/third_party/spirv-cross/shaders/asm/vert/invariant-block.sso.asm.vert new file mode 100644 index 0000000000..5984935c7b --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/invariant-block.sso.asm.vert @@ -0,0 +1,44 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_ + OpSource GLSL 450 + OpName %main "main" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpMemberName %gl_PerVertex 1 "gl_PointSize" + OpMemberName %gl_PerVertex 2 "gl_ClipDistance" + OpMemberName %gl_PerVertex 3 "gl_CullDistance" + OpName %_ "" + OpMemberDecorate %gl_PerVertex 0 Invariant + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize + OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance + OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float_1 = OpConstant %float 1 + %17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %main = OpFunction %void None %3 + %5 = OpLabel + %19 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %19 %17 + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/invariant.asm.vert b/third_party/spirv-cross/shaders/asm/vert/invariant.asm.vert new file mode 100644 index 0000000000..c0d381ee23 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/invariant.asm.vert @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 18 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_entryPointOutput Invariant + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %17 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + OpReturnValue %12 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/invariant.sso.asm.vert b/third_party/spirv-cross/shaders/asm/vert/invariant.sso.asm.vert new file mode 100644 index 0000000000..c0d381ee23 --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/invariant.sso.asm.vert @@ -0,0 +1,34 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 18 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_entryPointOutput Invariant + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 + %12 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %17 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + OpReturnValue %12 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/third_party/spirv-cross/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert new file mode 100644 index 0000000000..1ff67798bd --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -0,0 +1,100 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 58 +; Schema: 0 + OpCapability Shader + OpCapability ClipDistance + OpCapability CullDistance + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" %52 %output + OpSource GLSL 450 + OpName %4 "main" + OpName %9 "pos" + OpName %50 "gl_PerVertex" + OpMemberName %50 0 "gl_Position" + OpMemberName %50 1 "gl_PointSize" + OpMemberName %50 2 "gl_ClipDistance" + OpMemberName %50 3 "gl_CullDistance" + OpName %52 "" + OpDecorate %13 SpecId 201 + OpDecorate %24 SpecId 202 + OpMemberDecorate %50 0 BuiltIn Position + OpMemberDecorate %50 1 BuiltIn PointSize + OpMemberDecorate %50 2 BuiltIn ClipDistance + OpMemberDecorate %50 3 BuiltIn CullDistance + OpDecorate %50 Block + OpDecorate %57 SpecId 200 + OpDecorate %output Flat + OpDecorate %output Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpConstant %6 0 + %11 = OpConstantComposite %7 %10 %10 %10 %10 + %12 = OpTypeInt 32 1 + %int_ptr = OpTypePointer Output %12 + %13 = OpSpecConstant %12 -10 + %14 = OpConstant %12 2 + %15 = OpSpecConstantOp %12 IAdd %13 %14 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 1 + %19 = OpTypePointer Function %6 + %24 = OpSpecConstant %17 100 + %25 = OpConstant %17 5 + %26 = OpSpecConstantOp %17 UMod %24 %25 + %28 = OpConstant %17 2 + %33 = OpConstant %12 20 + %34 = OpConstant %12 30 + %int_3 = OpConstant %12 -3 + %bar = OpSpecConstantOp %12 SRem %13 %int_3 + %35 = OpTypeVector %12 4 + %36 = OpSpecConstantComposite %35 %33 %34 %15 %bar + %40 = OpTypeVector %12 2 + %41 = OpSpecConstantOp %40 VectorShuffle %36 %36 1 0 + %foo = OpSpecConstantOp %12 CompositeExtract %36 1 + %42 = OpTypeVector %6 2 + %49 = OpTypeArray %6 %18 + %50 = OpTypeStruct %7 %6 %49 %49 + %51 = OpTypePointer Output %50 + %52 = OpVariable %51 Output + %output = OpVariable %int_ptr Output + %53 = OpConstant %12 0 + %55 = OpTypePointer Output %7 + %57 = OpSpecConstant %6 3.14159 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %9 = OpVariable %8 Function + OpStore %9 %11 + %16 = OpConvertSToF %6 %15 + %20 = OpAccessChain %19 %9 %18 + %21 = OpLoad %6 %20 + %22 = OpFAdd %6 %21 %16 + %23 = OpAccessChain %19 %9 %18 + OpStore %23 %22 + %27 = OpConvertUToF %6 %26 + %29 = OpAccessChain %19 %9 %28 + %30 = OpLoad %6 %29 + %31 = OpFAdd %6 %30 %27 + %32 = OpAccessChain %19 %9 %28 + OpStore %32 %31 + %37 = OpConvertSToF %7 %36 + %38 = OpLoad %7 %9 + %39 = OpFAdd %7 %38 %37 + OpStore %9 %39 + %43 = OpConvertSToF %42 %41 + %44 = OpLoad %7 %9 + %45 = OpVectorShuffle %42 %44 %44 0 1 + %46 = OpFAdd %42 %45 %43 + %47 = OpLoad %7 %9 + %48 = OpVectorShuffle %7 %47 %46 4 5 2 3 + OpStore %9 %48 + %54 = OpLoad %7 %9 + %56 = OpAccessChain %55 %52 %53 + OpStore %56 %54 + OpStore %output %foo + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert b/third_party/spirv-cross/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert new file mode 100644 index 0000000000..29b0076a1e --- /dev/null +++ b/third_party/spirv-cross/shaders/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 6 +; Bound: 36 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %vid_1 %iid_1 %_entryPointOutput + OpSource HLSL 500 + OpName %main "main" + OpName %_main_u1_u1_ "@main(u1;u1;" + OpName %vid "vid" + OpName %iid "iid" + OpName %vid_0 "vid" + OpName %vid_1 "vid" + OpName %iid_0 "iid" + OpName %iid_1 "iid" + OpName %_entryPointOutput "@entryPointOutput" + OpName %param "param" + OpName %param_0 "param" + OpDecorate %vid_1 BuiltIn VertexIndex + OpDecorate %iid_1 BuiltIn InstanceIndex + OpDecorate %_entryPointOutput BuiltIn Position + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %10 = OpTypeFunction %v4float %_ptr_Function_uint %_ptr_Function_uint +%_ptr_Input_uint = OpTypePointer Input %uint + %vid_1 = OpVariable %_ptr_Input_uint Input + %iid_1 = OpVariable %_ptr_Input_uint Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %vid_0 = OpVariable %_ptr_Function_uint Function + %iid_0 = OpVariable %_ptr_Function_uint Function + %param = OpVariable %_ptr_Function_uint Function + %param_0 = OpVariable %_ptr_Function_uint Function + %25 = OpLoad %uint %vid_1 + OpStore %vid_0 %25 + %28 = OpLoad %uint %iid_1 + OpStore %iid_0 %28 + %32 = OpLoad %uint %vid_0 + OpStore %param %32 + %34 = OpLoad %uint %iid_0 + OpStore %param_0 %34 + %35 = OpFunctionCall %v4float %_main_u1_u1_ %param %param_0 + OpStore %_entryPointOutput %35 + OpReturn + OpFunctionEnd +%_main_u1_u1_ = OpFunction %v4float None %10 + %vid = OpFunctionParameter %_ptr_Function_uint + %iid = OpFunctionParameter %_ptr_Function_uint + %14 = OpLabel + %15 = OpLoad %uint %vid + %16 = OpLoad %uint %iid + %17 = OpIAdd %uint %15 %16 + %18 = OpConvertUToF %float %17 + %19 = OpCompositeConstruct %v4float %18 %18 %18 %18 + OpReturnValue %19 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/comp/atomic.comp b/third_party/spirv-cross/shaders/comp/atomic.comp new file mode 100644 index 0000000000..703256d879 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/atomic.comp @@ -0,0 +1,56 @@ +#version 310 es +#extension GL_OES_shader_image_atomic : require +layout(local_size_x = 1) in; + +layout(r32ui, binding = 0) uniform highp uimage2D uImage; +layout(r32i, binding = 1) uniform highp iimage2D iImage; +layout(binding = 2, std430) buffer SSBO +{ + uint u32; + int i32; +} ssbo; + +void main() +{ + imageAtomicAdd(uImage, ivec2(1, 5), 1u); + + // Test that we do not invalidate OpImage variables which are loaded from UniformConstant + // address space. + imageStore(iImage, ivec2(1, 6), ivec4(imageAtomicAdd(uImage, ivec2(1, 5), 1u))); + + imageAtomicOr(uImage, ivec2(1, 5), 1u); + imageAtomicXor(uImage, ivec2(1, 5), 1u); + imageAtomicAnd(uImage, ivec2(1, 5), 1u); + imageAtomicMin(uImage, ivec2(1, 5), 1u); + imageAtomicMax(uImage, ivec2(1, 5), 1u); + //imageAtomicExchange(uImage, ivec2(1, 5), 1u); + imageAtomicCompSwap(uImage, ivec2(1, 5), 10u, 2u); + + imageAtomicAdd(iImage, ivec2(1, 6), 1); + imageAtomicOr(iImage, ivec2(1, 6), 1); + imageAtomicXor(iImage, ivec2(1, 6), 1); + imageAtomicAnd(iImage, ivec2(1, 6), 1); + imageAtomicMin(iImage, ivec2(1, 6), 1); + imageAtomicMax(iImage, ivec2(1, 6), 1); + //imageAtomicExchange(iImage, ivec2(1, 5), 1u); + imageAtomicCompSwap(iImage, ivec2(1, 5), 10, 2); + + atomicAdd(ssbo.u32, 1u); + atomicOr(ssbo.u32, 1u); + atomicXor(ssbo.u32, 1u); + atomicAnd(ssbo.u32, 1u); + atomicMin(ssbo.u32, 1u); + atomicMax(ssbo.u32, 1u); + atomicExchange(ssbo.u32, 1u); + atomicCompSwap(ssbo.u32, 10u, 2u); + + atomicAdd(ssbo.i32, 1); + atomicOr(ssbo.i32, 1); + atomicXor(ssbo.i32, 1); + atomicAnd(ssbo.i32, 1); + atomicMin(ssbo.i32, 1); + atomicMax(ssbo.i32, 1); + atomicExchange(ssbo.i32, 1); + atomicCompSwap(ssbo.i32, 10, 2); +} + diff --git a/third_party/spirv-cross/shaders/comp/bake_gradient.comp b/third_party/spirv-cross/shaders/comp/bake_gradient.comp new file mode 100644 index 0000000000..4885ff00bc --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/bake_gradient.comp @@ -0,0 +1,55 @@ +#version 310 es + +layout(local_size_x = 8, local_size_y = 8) in; + +layout(binding = 0) uniform sampler2D uHeight; +layout(binding = 1) uniform sampler2D uDisplacement; +layout(rgba16f, binding = 2) uniform writeonly mediump image2D iHeightDisplacement; +layout(rgba16f, binding = 3) uniform writeonly mediump image2D iGradJacobian; + +layout(binding = 4) uniform UBO +{ + vec4 uInvSize; + vec4 uScale; +}; + +mediump float jacobian(mediump vec2 dDdx, mediump vec2 dDdy) +{ + return (1.0 + dDdx.x) * (1.0 + dDdy.y) - dDdx.y * dDdy.x; +} +#define LAMBDA 1.2 + +void main() +{ + vec4 uv = (vec2(gl_GlobalInvocationID.xy) * uInvSize.xy).xyxy + 0.5 * uInvSize; + + float h = textureLod(uHeight, uv.xy, 0.0).x; + + // Compute the heightmap gradient by simple differentiation. + float x0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(-1, 0)).x; + float x1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(+1, 0)).x; + float y0 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, -1)).x; + float y1 = textureLodOffset(uHeight, uv.xy, 0.0, ivec2(0, +1)).x; + vec2 grad = uScale.xy * 0.5 * vec2(x1 - x0, y1 - y0); + + // Displacement map must be sampled with a different offset since it's a smaller texture. + vec2 displacement = LAMBDA * textureLod(uDisplacement, uv.zw, 0.0).xy; + + // Compute jacobian. + vec2 dDdx = 0.5 * LAMBDA * ( + textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(+1, 0)).xy - + textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(-1, 0)).xy); + vec2 dDdy = 0.5 * LAMBDA * ( + textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, +1)).xy - + textureLodOffset(uDisplacement, uv.zw, 0.0, ivec2(0, -1)).xy); + float j = jacobian(dDdx * uScale.z, dDdy * uScale.z); + + displacement = vec2(0.0); + + // Read by vertex shader/tess shader. + imageStore(iHeightDisplacement, ivec2(gl_GlobalInvocationID.xy), vec4(h, displacement, 0.0)); + + // Read by fragment shader. + imageStore(iGradJacobian, ivec2(gl_GlobalInvocationID.xy), vec4(grad, j, 0.0)); +} + diff --git a/third_party/spirv-cross/shaders/comp/barriers.comp b/third_party/spirv-cross/shaders/comp/barriers.comp new file mode 100644 index 0000000000..7e0ea42d4e --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/barriers.comp @@ -0,0 +1,79 @@ +#version 310 es +layout(local_size_x = 4) in; + +void barrier_shared() +{ + memoryBarrierShared(); +} + +void full_barrier() +{ + memoryBarrier(); +} + +void image_barrier() +{ + memoryBarrierImage(); +} + +void buffer_barrier() +{ + memoryBarrierBuffer(); +} + +void group_barrier() +{ + groupMemoryBarrier(); +} + +void barrier_shared_exec() +{ + memoryBarrierShared(); + barrier(); +} + +void full_barrier_exec() +{ + memoryBarrier(); + barrier(); +} + +void image_barrier_exec() +{ + memoryBarrierImage(); + barrier(); +} + +void buffer_barrier_exec() +{ + memoryBarrierBuffer(); + barrier(); +} + +void group_barrier_exec() +{ + groupMemoryBarrier(); + barrier(); +} + +void exec_barrier() +{ + barrier(); +} + +void main() +{ + barrier_shared(); + full_barrier(); + image_barrier(); + buffer_barrier(); + group_barrier(); + + barrier_shared_exec(); + full_barrier_exec(); + image_barrier_exec(); + buffer_barrier_exec(); + group_barrier_exec(); + + exec_barrier(); +} diff --git a/third_party/spirv-cross/shaders/comp/basic.comp b/third_party/spirv-cross/shaders/comp/basic.comp new file mode 100644 index 0000000000..f9bf55670f --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/basic.comp @@ -0,0 +1,28 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint counter; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idata = in_data[ident]; + if (dot(idata, vec4(1.0, 5.0, 6.0, 2.0)) > 8.2) + { + out_data[atomicAdd(counter, 1u)] = idata; + } +} + diff --git a/third_party/spirv-cross/shaders/comp/casts.comp b/third_party/spirv-cross/shaders/comp/casts.comp new file mode 100644 index 0000000000..6be539d7be --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/casts.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO0 +{ + ivec4 inputs[]; +}; + +layout(binding = 1, std430) buffer SSBO1 +{ + ivec4 outputs[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + outputs[ident] = ivec4(bvec4(inputs[ident] & 0x3)); +} diff --git a/third_party/spirv-cross/shaders/comp/cfg-preserve-parameter.comp b/third_party/spirv-cross/shaders/comp/cfg-preserve-parameter.comp new file mode 100644 index 0000000000..9ef9092005 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/cfg-preserve-parameter.comp @@ -0,0 +1,54 @@ +#version 310 es + +// We write in all paths (and no reads), so should just be out. +void out_test_0(int cond, inout int i) +{ + if (cond == 0) + i = 40; + else + i = 60; +} + +// We write in all paths (and no reads), so should just be out. +void out_test_1(int cond, inout int i) +{ + switch (cond) + { + case 40: + i = 40; + break; + + default: + i = 70; + break; + } +} + +// We don't write in all paths, so should be inout. +void inout_test_0(int cond, inout int i) +{ + if (cond == 0) + i = 40; +} + +void inout_test_1(int cond, inout int i) +{ + switch (cond) + { + case 40: + i = 40; + break; + } +} + + +void main() +{ + int cond = 40; + int i = 50; + + out_test_0(cond, i); + out_test_1(cond, i); + inout_test_0(cond, i); + inout_test_1(cond, i); +} diff --git a/third_party/spirv-cross/shaders/comp/cfg.comp b/third_party/spirv-cross/shaders/comp/cfg.comp new file mode 100644 index 0000000000..4f4e6c0ea8 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/cfg.comp @@ -0,0 +1,91 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float data; +}; + +void test() +{ + // Test that variables local to a scope stay local. + if (data != 0.0) + { + float tmp = 10.0; + data = tmp; + } + else + { + float tmp = 15.0; + data = tmp; + } + + // Test that variable access propagates up to dominator + if (data != 0.0) + { + float e; + if (data != 5.0) + { + if (data != 6.0) + e = 10.0; + } + else + e = 20.0; + } + + // Test that variables local to a switch block stay local. + switch (int(data)) + { + case 0: + { + float tmp = 20.0; + data = tmp; + break; + } + + case 1: + { + float tmp = 30.0; + data = tmp; + break; + } + } + + // Check that multibranches propagate up to dominator. + float f; + switch (int(data)) + { + case 0: + { + f = 30.0; + break; + } + + case 1: + { + f = 40.0; + break; + } + } + + // Check that loops work. + // Interesting case here is propagating variable access from the continue block. + float h; + for (int i = 0; i < 20; i++, h += 10.0) + ; + data = h; + + // Do the same with do-while, gotta test all the hard cases. + float m; + do + { + } while (m != 20.0); + data = m; +} + +void main() +{ + // Test that we do the CFG analysis for all functions. + test(); +} + diff --git a/third_party/spirv-cross/shaders/comp/coherent-block.comp b/third_party/spirv-cross/shaders/comp/coherent-block.comp new file mode 100644 index 0000000000..0a174e8ef0 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/coherent-block.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 1) coherent restrict writeonly buffer SSBO +{ + vec4 value; +}; + +void main() +{ + value = vec4(20.0); +} diff --git a/third_party/spirv-cross/shaders/comp/coherent-image.comp b/third_party/spirv-cross/shaders/comp/coherent-image.comp new file mode 100644 index 0000000000..fd6e280182 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/coherent-image.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 1) coherent restrict writeonly buffer SSBO +{ + ivec4 value; +}; + +layout(r32i, binding = 3) coherent readonly restrict uniform mediump iimage2D uImage; + +void main() +{ + value = imageLoad(uImage, ivec2(10)); +} diff --git a/third_party/spirv-cross/shaders/comp/composite-array-initialization.comp b/third_party/spirv-cross/shaders/comp/composite-array-initialization.comp new file mode 100644 index 0000000000..fa9b611480 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/composite-array-initialization.comp @@ -0,0 +1,29 @@ +#version 310 es +#extension GL_EXT_shader_non_constant_global_initializers : require +layout(local_size_x = 2) in; + +struct Data +{ + float a; + float b; +}; + +layout(std430, binding = 0) buffer SSBO +{ + Data outdata[]; +}; + +layout(constant_id = 0) const float X = 4.0; + +Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); +Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); + +Data combine(Data a, Data b) +{ + return Data(a.a + b.a, a.b + b.b); +} + +void main() +{ + outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]); +} diff --git a/third_party/spirv-cross/shaders/comp/composite-construct.comp b/third_party/spirv-cross/shaders/comp/composite-construct.comp new file mode 100644 index 0000000000..859c56f51f --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/composite-construct.comp @@ -0,0 +1,40 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO0 +{ + vec4 as[]; +}; + +layout(std430, binding = 1) buffer SSBO1 +{ + vec4 bs[]; +}; + +vec4 summe(vec4 values[3][2]) +{ + return values[0][0] + values[2][1] + values[0][1] + values[1][0]; +} + +struct Composite +{ + vec4 a[2]; + vec4 b[2]; +}; + +void main() +{ + vec4 values[2] = vec4[](as[gl_GlobalInvocationID.x], bs[gl_GlobalInvocationID.x]); + vec4 const_values[2] = vec4[](vec4(10.0), vec4(30.0)); + vec4 copy_values[2]; + copy_values = const_values; + vec4 copy_values2[2] = values; + as[gl_GlobalInvocationID.x] = summe(vec4[][](values, copy_values, copy_values2)); + + Composite c = Composite(values, copy_values); + + float arrayofarray[2][3] = float[][](float[](1.0, 1.0, 1.0), float[](2.0, 2.0, 2.0)); + + float b = 10.0; + float values_scalar[4] = float[](b, b, b, b); +} diff --git a/third_party/spirv-cross/shaders/comp/culling.comp b/third_party/spirv-cross/shaders/comp/culling.comp new file mode 100644 index 0000000000..9f8331b10b --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/culling.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 4) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + float in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + float out_data[]; +}; + +layout(std430, binding = 2) buffer SSBO3 +{ + uint count; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = in_data[ident]; + if (idata > 12.0) + out_data[atomicAdd(count, 1u)] = idata; +} + diff --git a/third_party/spirv-cross/shaders/comp/defer-parens.comp b/third_party/spirv-cross/shaders/comp/defer-parens.comp new file mode 100644 index 0000000000..4e8ea6b399 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/defer-parens.comp @@ -0,0 +1,30 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + vec4 data; + int index; +}; + +void main() +{ + // Tests defer-parens behavior where a binary expression is OpCompositeExtracted chained together + // with an OpCompositeConstruct optimization. + vec4 d = data; + data = vec4(d.x, d.yz + 10.0, d.w); + + // Verify binary ops. + data = d + d + d; + + // Verify swizzles. + data = (d.yz + 10.0).xxyy; + + // OpCompositeExtract + float t = (d.yz + 10.0).y; + data = vec4(t); + + // OpVectorExtractDynamic + t = (d.zw + 10.0)[index]; + data = vec4(t); +} diff --git a/third_party/spirv-cross/shaders/comp/dowhile.comp b/third_party/spirv-cross/shaders/comp/dowhile.comp new file mode 100644 index 0000000000..709db75a17 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/dowhile.comp @@ -0,0 +1,31 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +int i; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + + i = 0; + vec4 idat = in_data[ident]; + do + { + idat = mvp * idat; + i++; + } while(i < 16); + + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders/comp/generate_height.comp b/third_party/spirv-cross/shaders/comp/generate_height.comp new file mode 100644 index 0000000000..16cef4de78 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/generate_height.comp @@ -0,0 +1,97 @@ +#version 310 es + +layout(local_size_x = 64) in; + +layout(std430, binding = 0) readonly buffer Distribution +{ + vec2 distribution[]; +}; + +layout(std430, binding = 1) writeonly buffer HeightmapFFT +{ + uint heights[]; +}; + +layout(binding = 2, std140) uniform UBO +{ + vec4 uModTime; +}; + +vec2 alias(vec2 i, vec2 N) +{ + return mix(i, i - N, greaterThan(i, 0.5 * N)); +} + +vec4 cmul(vec4 a, vec4 b) +{ + vec4 r3 = a.yxwz; + vec4 r1 = b.xxzz; + vec4 R0 = a * r1; + vec4 r2 = b.yyww; + vec4 R1 = r2 * r3; + return R0 + vec4(-R1.x, R1.y, -R1.z, R1.w); +} + +vec2 cmul(vec2 a, vec2 b) +{ + vec2 r3 = a.yx; + vec2 r1 = b.xx; + vec2 R0 = a * r1; + vec2 r2 = b.yy; + vec2 R1 = r2 * r3; + return R0 + vec2(-R1.x, R1.y); +} + +uint pack2(vec2 v) +{ + return packHalf2x16(v); +} + +uvec2 pack4(vec4 v) +{ + return uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); +} + +uvec2 workaround_mix(uvec2 a, uvec2 b, bvec2 sel) +{ + return uvec2(sel.x ? b.x : a.x, sel.y ? b.y : a.y); +} + +void generate_heightmap() +{ + uvec2 N = gl_WorkGroupSize.xy * gl_NumWorkGroups.xy; + uvec2 i = gl_GlobalInvocationID.xy; + // Pick out the negative frequency variant. + uvec2 wi = workaround_mix(N - i, uvec2(0u), equal(i, uvec2(0u))); + + // Pick out positive and negative travelling waves. + vec2 a = distribution[i.y * N.x + i.x]; + vec2 b = distribution[wi.y * N.x + wi.x]; + + vec2 k = uModTime.xy * alias(vec2(i), vec2(N)); + float k_len = length(k); + + const float G = 9.81; + + // If this sample runs for hours on end, the cosines of very large numbers will eventually become unstable. + // It is fairly easy to fix this by wrapping uTime, + // and quantizing w such that wrapping uTime does not change the result. + // See Tessendorf's paper for how to do it. + // The sqrt(G * k_len) factor represents how fast ocean waves at different frequencies propagate. + float w = sqrt(G * k_len) * uModTime.z; + float cw = cos(w); + float sw = sin(w); + + // Complex multiply to rotate our frequency samples. + a = cmul(a, vec2(cw, sw)); + b = cmul(b, vec2(cw, sw)); + b = vec2(b.x, -b.y); // Complex conjugate since we picked a frequency with the opposite direction. + vec2 res = a + b; // Sum up forward and backwards travelling waves. + heights[i.y * N.x + i.x] = pack2(res); +} + +void main() +{ + generate_heightmap(); +} + diff --git a/third_party/spirv-cross/shaders/comp/image.comp b/third_party/spirv-cross/shaders/comp/image.comp new file mode 100644 index 0000000000..e375534a51 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/image.comp @@ -0,0 +1,12 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(rgba8, binding = 0) uniform readonly mediump image2D uImageIn; +layout(rgba8, binding = 1) uniform writeonly mediump image2D uImageOut; + +void main() +{ + vec4 v = imageLoad(uImageIn, ivec2(gl_GlobalInvocationID.xy) + imageSize(uImageIn)); + imageStore(uImageOut, ivec2(gl_GlobalInvocationID.xy), v); +} + diff --git a/third_party/spirv-cross/shaders/comp/insert.comp b/third_party/spirv-cross/shaders/comp/insert.comp new file mode 100644 index 0000000000..07c1f8d7aa --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/insert.comp @@ -0,0 +1,18 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) writeonly buffer SSBO +{ + vec4 out_data[]; +}; + +void main() +{ + vec4 v; + v.x = 10.0; + v.y = 30.0; + v.z = 70.0; + v.w = 90.0; + out_data[gl_GlobalInvocationID.x] = v; + out_data[gl_GlobalInvocationID.x].y = 20.0; +} diff --git a/third_party/spirv-cross/shaders/comp/mat3.comp b/third_party/spirv-cross/shaders/comp/mat3.comp new file mode 100644 index 0000000000..7c5bb1e4f5 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/mat3.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + mat3 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + out_data[ident] = mat3(vec3(10.0), vec3(20.0), vec3(40.0)); +} + diff --git a/third_party/spirv-cross/shaders/comp/mod.comp b/third_party/spirv-cross/shaders/comp/mod.comp new file mode 100644 index 0000000000..1631456e30 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/mod.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 v = mod(in_data[ident], out_data[ident]); + out_data[ident] = v; + + uvec4 vu = floatBitsToUint(in_data[ident]) % floatBitsToUint(out_data[ident]); + out_data[ident] = uintBitsToFloat(vu); + + ivec4 vi = floatBitsToInt(in_data[ident]) % floatBitsToInt(out_data[ident]); + out_data[ident] = intBitsToFloat(vi); +} + diff --git a/third_party/spirv-cross/shaders/comp/modf.comp b/third_party/spirv-cross/shaders/comp/modf.comp new file mode 100644 index 0000000000..edadefcf05 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/modf.comp @@ -0,0 +1,23 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 i; + //vec4 v = frexp(in_data[ident], i); + //out_data[ident] = ldexp(v, i); + vec4 v = modf(in_data[ident], i); + out_data[ident] = v; +} + diff --git a/third_party/spirv-cross/shaders/comp/outer-product.comp b/third_party/spirv-cross/shaders/comp/outer-product.comp new file mode 100644 index 0000000000..9aba2a54b7 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/outer-product.comp @@ -0,0 +1,37 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(set = 0, binding = 0, std430) writeonly buffer SSBO +{ + mat2 m22; + mat2x3 m23; + mat2x4 m24; + mat3x2 m32; + mat3 m33; + mat3x4 m34; + mat4x2 m42; + mat4x3 m43; + mat4 m44; +}; + +layout(set = 0, binding = 1, std430) readonly buffer ReadSSBO +{ + vec2 v2; + vec3 v3; + vec4 v4; +}; + +void main() +{ + m22 = outerProduct(v2, v2); + m23 = outerProduct(v3, v2); + m24 = outerProduct(v4, v2); + + m32 = outerProduct(v2, v3); + m33 = outerProduct(v3, v3); + m34 = outerProduct(v4, v3); + + m42 = outerProduct(v2, v4); + m43 = outerProduct(v3, v4); + m44 = outerProduct(v4, v4); +} diff --git a/third_party/spirv-cross/shaders/comp/read-write-only.comp b/third_party/spirv-cross/shaders/comp/read-write-only.comp new file mode 100644 index 0000000000..b224b6f121 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/read-write-only.comp @@ -0,0 +1,26 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(binding = 0, std430) readonly buffer SSBO0 +{ + vec4 data0; + vec4 data1; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + vec4 data2; + vec4 data3; +}; + +layout(binding = 2, std430) restrict writeonly buffer SSBO2 +{ + vec4 data4; + vec4 data5; +}; + +void main() +{ + data4 = data0 + data2; + data5 = data1 + data3; +} diff --git a/third_party/spirv-cross/shaders/comp/rmw-matrix.comp b/third_party/spirv-cross/shaders/comp/rmw-matrix.comp new file mode 100644 index 0000000000..c158ab4ddd --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/rmw-matrix.comp @@ -0,0 +1,20 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + float a; + vec4 b; + mat4 c; + + float a1; + vec4 b1; + mat4 c1; +}; + +void main() +{ + a *= a1; + b *= b1; + c *= c1; +} diff --git a/third_party/spirv-cross/shaders/comp/rmw-opt.comp b/third_party/spirv-cross/shaders/comp/rmw-opt.comp new file mode 100644 index 0000000000..a6e1e7fe75 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/rmw-opt.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + int a; +}; + +void main() +{ + a += 10; + a -= 10; + a *= 10; + a /= 10; + a <<= 2; + a >>= 3; + a &= 40; + a ^= 10; + a %= 40; + a |= 1; + + bool c = false; + bool d = true; + c = c && d; + d = d || c; + a = c && d ? 1 : 0; +} diff --git a/third_party/spirv-cross/shaders/comp/scalar-std450-distance-length-normalize.comp b/third_party/spirv-cross/shaders/comp/scalar-std450-distance-length-normalize.comp new file mode 100644 index 0000000000..37414737fd --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/scalar-std450-distance-length-normalize.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std430, set = 0, binding = 0) buffer SSBO +{ + float a; + float b; + float c; + float d; + float e; +}; + +void main() +{ + c = distance(a, b); + d = length(a); + e = normalize(a); +} diff --git a/third_party/spirv-cross/shaders/comp/shared.comp b/third_party/spirv-cross/shaders/comp/shared.comp new file mode 100644 index 0000000000..4deff93597 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/shared.comp @@ -0,0 +1,27 @@ +#version 310 es +layout(local_size_x = 4) in; + +shared float sShared[gl_WorkGroupSize.x]; + +layout(std430, binding = 0) readonly buffer SSBO +{ + float in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + float out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + float idata = in_data[ident]; + + sShared[gl_LocalInvocationIndex] = idata; + memoryBarrierShared(); + barrier(); + + out_data[ident] = sShared[gl_WorkGroupSize.x - gl_LocalInvocationIndex - 1u]; +} + diff --git a/third_party/spirv-cross/shaders/comp/ssbo-array-length.comp b/third_party/spirv-cross/shaders/comp/ssbo-array-length.comp new file mode 100644 index 0000000000..3ad4b95159 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/ssbo-array-length.comp @@ -0,0 +1,12 @@ +#version 450 +layout(local_size_x = 1) in; +layout(set = 0, binding = 1, std140) buffer SSBO +{ + uint size; + float v[]; +}; + +void main() +{ + size = v.length(); +} diff --git a/third_party/spirv-cross/shaders/comp/ssbo-array.comp b/third_party/spirv-cross/shaders/comp/ssbo-array.comp new file mode 100644 index 0000000000..da0eae0889 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/ssbo-array.comp @@ -0,0 +1,14 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + vec4 data[]; +} ssbos[2]; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + ssbos[1].data[ident] = ssbos[0].data[ident]; +} + diff --git a/third_party/spirv-cross/shaders/comp/struct-layout.comp b/third_party/spirv-cross/shaders/comp/struct-layout.comp new file mode 100644 index 0000000000..5a2b7802df --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/struct-layout.comp @@ -0,0 +1,24 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct Foo +{ + mat4 m; +}; + +layout(std430, binding = 0) readonly buffer SSBO +{ + Foo in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + Foo out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + out_data[ident].m = in_data[ident].m * in_data[ident].m; +} + diff --git a/third_party/spirv-cross/shaders/comp/struct-packing.comp b/third_party/spirv-cross/shaders/comp/struct-packing.comp new file mode 100644 index 0000000000..7a1be0478d --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/struct-packing.comp @@ -0,0 +1,86 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct S0 +{ + vec2 a[1]; + float b; +}; + +struct S1 +{ + vec3 a; + float b; +}; + +struct S2 +{ + vec3 a[1]; + float b; +}; + +struct S3 +{ + vec2 a; + float b; +}; + +struct S4 +{ + vec2 c; +}; + +struct Content +{ + S0 m0s[1]; + S1 m1s[1]; + S2 m2s[1]; + S0 m0; + S1 m1; + S2 m2; + S3 m3; + float m4; + + S4 m3s[8]; +}; + +layout(binding = 1, std430) restrict buffer SSBO1 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + float array[]; +} ssbo_430; + +layout(binding = 0, std140) restrict buffer SSBO0 +{ + Content content; + Content content1[2]; + Content content2; + + layout(column_major) mat2 m0; + layout(column_major) mat2 m1; + layout(column_major) mat2x3 m2[4]; + layout(column_major) mat3x2 m3; + layout(row_major) mat2 m4; + layout(row_major) mat2 m5[9]; + layout(row_major) mat2x3 m6[4][2]; + layout(row_major) mat3x2 m7; + + float array[]; +} ssbo_140; + +void main() +{ + ssbo_430.content = ssbo_140.content; +} + diff --git a/third_party/spirv-cross/shaders/comp/torture-loop.comp b/third_party/spirv-cross/shaders/comp/torture-loop.comp new file mode 100644 index 0000000000..54a1221a15 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/torture-loop.comp @@ -0,0 +1,40 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) readonly buffer SSBO +{ + mat4 mvp; + vec4 in_data[]; +}; + +layout(std430, binding = 1) writeonly buffer SSBO2 +{ + vec4 out_data[]; +}; + +void main() +{ + uint ident = gl_GlobalInvocationID.x; + vec4 idat = in_data[ident]; + + int k = 0; + + // Continue with side effects. + while (++k < 10) + { + idat *= 2.0; + k++; + } + + // Again used here ... + for (uint i = 0u; i < 16u; i++, k++) + for (uint j = 0u; j < 30u; j++) + idat = mvp * idat; + + do + { + k++; + } while (k > 10); + out_data[ident] = idat; +} + diff --git a/third_party/spirv-cross/shaders/comp/type-alias.comp b/third_party/spirv-cross/shaders/comp/type-alias.comp new file mode 100644 index 0000000000..343d350a2f --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/type-alias.comp @@ -0,0 +1,45 @@ +#version 310 es +layout(local_size_x = 1) in; + +struct S0 +{ + vec4 a; +}; + +struct S1 +{ + vec4 a; +}; + +vec4 overload(S0 s0) +{ + return s0.a; +} + +vec4 overload(S1 s1) +{ + return s1.a; +} + +layout(std430, binding = 0) buffer SSBO0 +{ + S0 s0s[]; +}; + +layout(std430, binding = 1) buffer SSBO1 +{ + S1 s1s[]; +}; + +layout(std430, binding = 2) buffer SSBO2 +{ + vec4 outputs[]; +}; + + +void main() +{ + S0 s0 = s0s[gl_GlobalInvocationID.x]; + S1 s1 = s1s[gl_GlobalInvocationID.x]; + outputs[gl_GlobalInvocationID.x] = overload(s0) + overload(s1); +} diff --git a/third_party/spirv-cross/shaders/comp/udiv.comp b/third_party/spirv-cross/shaders/comp/udiv.comp new file mode 100644 index 0000000000..33fe564f07 --- /dev/null +++ b/third_party/spirv-cross/shaders/comp/udiv.comp @@ -0,0 +1,17 @@ +#version 310 es +layout(local_size_x = 1) in; + +layout(std430, binding = 0) buffer SSBO +{ + uint inputs[]; +}; + +layout(std430, binding = 0) buffer SSBO2 +{ + uint outputs[]; +}; + +void main() +{ + outputs[gl_GlobalInvocationID.x] = inputs[gl_GlobalInvocationID.x] / 29u; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/comp/enhanced-layouts.comp b/third_party/spirv-cross/shaders/desktop-only/comp/enhanced-layouts.comp new file mode 100644 index 0000000000..470b73e9bd --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/comp/enhanced-layouts.comp @@ -0,0 +1,39 @@ +#version 450 + +struct Foo +{ + int a; + int b; + int c; +}; + +layout(std140, binding = 0) uniform UBO +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ubo; + +layout(std140, binding = 1) buffer SSBO1 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo1; + +layout(std430, binding = 2) buffer SSBO2 +{ + layout(offset = 4) int a; + layout(offset = 8) int b; + layout(offset = 16) Foo foo; + layout(offset = 48) int c[8]; +} ssbo2; + +void main() +{ + ssbo1.a = ssbo2.a; + ssbo1.b = ubo.b; +} + diff --git a/third_party/spirv-cross/shaders/desktop-only/comp/extended-arithmetic.desktop.comp b/third_party/spirv-cross/shaders/desktop-only/comp/extended-arithmetic.desktop.comp new file mode 100644 index 0000000000..9623751b61 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/comp/extended-arithmetic.desktop.comp @@ -0,0 +1,41 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(binding = 0, std430) buffer SSBOUint +{ + uint a, b, c, d; + uvec2 a2, b2, c2, d2; + uvec3 a3, b3, c3, d3; + uvec4 a4, b4, c4, d4; +} u; + +layout(binding = 1, std430) buffer SSBOInt +{ + int a, b, c, d; + ivec2 a2, b2, c2, d2; + ivec3 a3, b3, c3, d3; + ivec4 a4, b4, c4, d4; +} i; + +void main() +{ + u.c = uaddCarry(u.a, u.b, u.d); + u.c2 = uaddCarry(u.a2, u.b2, u.d2); + u.c3 = uaddCarry(u.a3, u.b3, u.d3); + u.c4 = uaddCarry(u.a4, u.b4, u.d4); + + u.c = usubBorrow(u.a, u.b, u.d); + u.c2 = usubBorrow(u.a2, u.b2, u.d2); + u.c3 = usubBorrow(u.a3, u.b3, u.d3); + u.c4 = usubBorrow(u.a4, u.b4, u.d4); + + umulExtended(u.a, u.b, u.c, u.d); + umulExtended(u.a2, u.b2, u.c2, u.d2); + umulExtended(u.a3, u.b3, u.c3, u.d3); + umulExtended(u.a4, u.b4, u.c4, u.d4); + + imulExtended(i.a, i.b, i.c, i.d); + imulExtended(i.a2, i.b2, i.c2, i.d2); + imulExtended(i.a3, i.b3, i.c3, i.d3); + imulExtended(i.a4, i.b4, i.c4, i.d4); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/comp/fp64.desktop.comp b/third_party/spirv-cross/shaders/desktop-only/comp/fp64.desktop.comp new file mode 100644 index 0000000000..2c2d5018d1 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/comp/fp64.desktop.comp @@ -0,0 +1,91 @@ +#version 450 +layout(local_size_x = 1) in; + +struct M0 +{ + double v; + dvec2 b[2]; + dmat2x3 c; + dmat3x2 d; +}; + +// Test buffer layout handling. +layout(std430, binding = 0) buffer SSBO0 +{ + dvec4 a; + M0 m0; + dmat4 b; +} ssbo_0; + +layout(std430, binding = 1) buffer SSBO1 +{ + dmat4 a; + dvec4 b; + M0 m0; +} ssbo_1; + +layout(std430, binding = 2) buffer SSBO2 +{ + double a[4]; + dvec2 b[4]; +} ssbo_2; + +layout(std140, binding = 3) buffer SSBO3 +{ + double a[4]; + dvec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += dvec4(10, 20, 30, 40); + ssbo_0.a += 20; + + dvec4 a = ssbo_0.a; + dmat4 amat = ssbo_0.b; + + ssbo_0.a = abs(a); + ssbo_0.a = sign(a); + ssbo_0.a = floor(a); + ssbo_0.a = trunc(a); + ssbo_0.a = round(a); + ssbo_0.a = roundEven(a); + ssbo_0.a = ceil(a); + ssbo_0.a = fract(a); + ssbo_0.a = mod(a, 20.0); + ssbo_0.a = mod(a, a); + ssbo_0.a = min(a, a); + ssbo_0.a = max(a, a); + ssbo_0.a = clamp(a, a, a); + ssbo_0.a = mix(a, a, a); + ssbo_0.a = step(a, a); + ssbo_0.a = smoothstep(a, a, a); + bvec4 b = isnan(a); + bvec4 c = isinf(a); + + double f = packDouble2x32(uvec2(10, 40)); + uvec2 g = unpackDouble2x32(f); + + double d = length(a); + d = distance(a, a); + d = dot(a, a); + dvec3 e = cross(a.xyz, a.yzw); + a = faceforward(a, a, a); + a = reflect(a, a); + //a = refract(a, a, 1.45); + + dmat4 l = matrixCompMult(amat, amat); + l = outerProduct(a, a); + l = transpose(l); + double m = determinant(l); + l = inverse(l); + + bvec4 k = lessThan(a, a); + k = lessThanEqual(a, a); + k = greaterThan(a, a); + k = greaterThanEqual(a, a); + + ssbo_1.b.x += 1.0lf; + ssbo_2.b[0].x += 1.0lf; + ssbo_3.b[0].x += 1.0lf; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp b/third_party/spirv-cross/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp new file mode 100644 index 0000000000..5a70623c85 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/comp/image-formats.desktop.noeliminate.comp @@ -0,0 +1,48 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(rgba32f, binding = 0) uniform image2D uImg00; +layout(rgba16f, binding = 1) uniform image2D uImg01; +layout(rg32f, binding = 2) uniform image2D uImg02; +layout(rg16f, binding = 3) uniform image2D uImg03; +layout(r11f_g11f_b10f, binding = 4) uniform image2D uImg04; +layout(r32f, binding = 5) uniform image2D uImg05; +layout(r16f, binding = 6) uniform image2D uImg06; +layout(rgba16, binding = 7) uniform image2D uImg07; +layout(rgb10_a2, binding = 8) uniform image2D uImg08; +layout(rgba8, binding = 9) uniform image2D uImg09; +layout(rg16, binding = 10) uniform image2D uImg10; +layout(rg8, binding = 11) uniform image2D uImg11; +layout(r16, binding = 12) uniform image2D uImg12; +layout(r8, binding = 13) uniform image2D uImg13; +layout(rgba16_snorm, binding = 14) uniform image2D uImg14; +layout(rgba8_snorm, binding = 15) uniform image2D uImg15; +layout(rg16_snorm, binding = 16) uniform image2D uImg16; +layout(rg8_snorm, binding = 17) uniform image2D uImg17; +layout(r16_snorm, binding = 18) uniform image2D uImg18; +layout(r8_snorm, binding = 19) uniform image2D uImg19; + +layout(rgba32i, binding = 20) uniform iimage2D uImage20; +layout(rgba16i, binding = 21) uniform iimage2D uImage21; +layout(rgba8i, binding = 22) uniform iimage2D uImage22; +layout(rg32i, binding = 23) uniform iimage2D uImage23; +layout(rg16i, binding = 24) uniform iimage2D uImage24; +layout(rg8i, binding = 25) uniform iimage2D uImage25; +layout(r32i, binding = 26) uniform iimage2D uImage26; +layout(r16i, binding = 27) uniform iimage2D uImage27; +layout(r8i, binding = 28) uniform iimage2D uImage28; + +layout(rgba32ui, binding = 29) uniform uimage2D uImage29; +layout(rgba16ui, binding = 30) uniform uimage2D uImage30; +layout(rgb10_a2ui, binding = 31) uniform uimage2D uImage31; +layout(rgba8ui, binding = 32) uniform uimage2D uImage32; +layout(rg32ui, binding = 33) uniform uimage2D uImage33; +layout(rg16ui, binding = 34) uniform uimage2D uImage34; +layout(rg8ui, binding = 35) uniform uimage2D uImage35; +layout(r32ui, binding = 36) uniform uimage2D uImage36; +layout(r16ui, binding = 37) uniform uimage2D uImage37; +layout(r8ui, binding = 38) uniform uimage2D uImage38; + +void main() +{ +} diff --git a/third_party/spirv-cross/shaders/desktop-only/comp/int64.desktop.comp b/third_party/spirv-cross/shaders/desktop-only/comp/int64.desktop.comp new file mode 100644 index 0000000000..81004d4ad6 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/comp/int64.desktop.comp @@ -0,0 +1,55 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require +layout(local_size_x = 1) in; + +struct M0 +{ + int64_t v; + i64vec2 b[2]; + uint64_t c; + uint64_t d[5]; +}; + +// Test buffer layout handling. +layout(std430, binding = 0) buffer SSBO0 +{ + i64vec4 a; + M0 m0; +} ssbo_0; + +layout(std430, binding = 1) buffer SSBO1 +{ + u64vec4 b; + M0 m0; +} ssbo_1; + +layout(std430, binding = 2) buffer SSBO2 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_2; + +layout(std140, binding = 3) buffer SSBO3 +{ + int64_t a[4]; + i64vec2 b[4]; +} ssbo_3; + +void main() +{ + ssbo_0.a += i64vec4(10, 20, 30, 40); + ssbo_1.b += u64vec4(999999999999999999ul, 8888888888888888ul, 77777777777777777ul, 6666666666666666ul); + ssbo_0.a += 20; + ssbo_0.a = abs(ssbo_0.a + i64vec4(ssbo_1.b)); + + ssbo_0.a++; + ssbo_1.b++; + ssbo_0.a--; + ssbo_1.b--; + + ssbo_1.b = doubleBitsToUint64(int64BitsToDouble(ssbo_0.a)); + ssbo_0.a = doubleBitsToInt64(uint64BitsToDouble(ssbo_1.b)); + + ssbo_2.a[0] += 1l; + ssbo_3.a[0] += 2l; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/clip-cull-distance.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/clip-cull-distance.desktop.frag new file mode 100644 index 0000000000..5212fd6448 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/clip-cull-distance.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +in float gl_ClipDistance[4]; +in float gl_CullDistance[3]; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = gl_ClipDistance[0] + gl_CullDistance[0]; +} + diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag new file mode 100644 index 0000000000..7c75ffe1bd --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/control-dependent-in-branch.desktop.frag @@ -0,0 +1,36 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) in vec4 vInput; + +void main() +{ + FragColor = vInput; + vec4 t = texture(uSampler, vInput.xy); + vec4 d0 = dFdx(vInput); + vec4 d1 = dFdy(vInput); + vec4 d2 = fwidth(vInput); + vec4 d3 = dFdxCoarse(vInput); + vec4 d4 = dFdyCoarse(vInput); + vec4 d5 = fwidthCoarse(vInput); + vec4 d6 = dFdxFine(vInput); + vec4 d7 = dFdyFine(vInput); + vec4 d8 = fwidthFine(vInput); + vec2 lod = textureQueryLod(uSampler, vInput.zw); + if (vInput.y > 10.0) + { + FragColor += t; + FragColor += d0; + FragColor += d1; + FragColor += d2; + FragColor += d3; + FragColor += d4; + FragColor += d5; + FragColor += d6; + FragColor += d7; + FragColor += d8; + FragColor += lod.xyxy; + } +} + diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/depth-greater-than.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/depth-greater-than.desktop.frag new file mode 100644 index 0000000000..88f9a4214f --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/depth-greater-than.desktop.frag @@ -0,0 +1,8 @@ +#version 450 +layout(early_fragment_tests) in; +layout(depth_greater) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/depth-less-than.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/depth-less-than.desktop.frag new file mode 100644 index 0000000000..87fdd4620c --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/depth-less-than.desktop.frag @@ -0,0 +1,8 @@ +#version 450 +layout(early_fragment_tests) in; +layout(depth_less) out float gl_FragDepth; + +void main() +{ + gl_FragDepth = 0.5; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/dual-source-blending.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/dual-source-blending.desktop.frag new file mode 100644 index 0000000000..f322cf4c38 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/dual-source-blending.desktop.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0, index = 0) out vec4 FragColor0; +layout(location = 0, index = 1) out vec4 FragColor1; + +void main() +{ + FragColor0 = vec4(1.0); + FragColor1 = vec4(2.0); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag b/third_party/spirv-cross/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag new file mode 100644 index 0000000000..1c6dd7b8b7 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/hlsl-uav-block-alias.asm.frag @@ -0,0 +1,56 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 29 +; Schema: 0 + 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 %_main_ "@main(" + OpName %Foobar "Foobar" + OpMemberName %Foobar 0 "@data" + OpName %Foobar_0 "Foobar" + OpName %Foobaz "Foobaz" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %_runtimearr_v4float ArrayStride 16 + OpMemberDecorate %Foobar 0 Offset 0 + OpDecorate %Foobar BufferBlock + OpDecorate %Foobar_0 DescriptorSet 0 + OpDecorate %Foobar_0 Binding 0 + OpDecorate %Foobaz DescriptorSet 0 + OpDecorate %Foobaz Binding 1 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float +%_runtimearr_v4float = OpTypeRuntimeArray %v4float + %Foobar = OpTypeStruct %_runtimearr_v4float +%_ptr_Uniform_Foobar = OpTypePointer Uniform %Foobar + %Foobar_0 = OpVariable %_ptr_Uniform_Foobar Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %Foobaz = OpVariable %_ptr_Uniform_Foobar Uniform +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %28 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %28 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + %18 = OpAccessChain %_ptr_Uniform_v4float %Foobar_0 %int_0 %int_0 + %19 = OpLoad %v4float %18 + %21 = OpAccessChain %_ptr_Uniform_v4float %Foobaz %int_0 %int_0 + %22 = OpLoad %v4float %21 + %23 = OpFAdd %v4float %19 %22 + OpReturnValue %23 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/image-ms.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/image-ms.desktop.frag new file mode 100644 index 0000000000..d3acc3081a --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/image-ms.desktop.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(rgba8, binding = 0) uniform image2DMS uImage; +layout(rgba8, binding = 1) uniform image2DMSArray uImageArray; + +void main() +{ + vec4 a = imageLoad(uImage, ivec2(1, 2), 2); + vec4 b = imageLoad(uImageArray, ivec3(1, 2, 4), 3); + imageStore(uImage, ivec2(2, 3), 1, a); + imageStore(uImageArray, ivec3(2, 3, 7), 1, b); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/image-query.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/image-query.desktop.frag new file mode 100644 index 0000000000..a5cbe011e2 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/image-query.desktop.frag @@ -0,0 +1,56 @@ +#version 450 + +layout(binding = 0) uniform sampler1D uSampler1D; +layout(binding = 1) uniform sampler2D uSampler2D; +layout(binding = 2) uniform sampler2DArray uSampler2DArray; +layout(binding = 3) uniform sampler3D uSampler3D; +layout(binding = 4) uniform samplerCube uSamplerCube; +layout(binding = 5) uniform samplerCubeArray uSamplerCubeArray; +layout(binding = 6) uniform samplerBuffer uSamplerBuffer; +layout(binding = 7) uniform sampler2DMS uSamplerMS; +layout(binding = 8) uniform sampler2DMSArray uSamplerMSArray; + +layout(r32f, binding = 9) uniform image1D uImage1D; +layout(r32f, binding = 10) uniform image2D uImage2D; +layout(r32f, binding = 11) uniform image2DArray uImage2DArray; +layout(r32f, binding = 12) uniform image3D uImage3D; +layout(r32f, binding = 13) uniform imageCube uImageCube; +layout(r32f, binding = 14) uniform imageCubeArray uImageCubeArray; +layout(r32f, binding = 15) uniform imageBuffer uImageBuffer; +layout(r32f, binding = 16) uniform image2DMS uImageMS; +layout(r32f, binding = 17) uniform image2DMSArray uImageMSArray; + +void main() +{ + int a = textureSize(uSampler1D, 0); + ivec2 b = textureSize(uSampler2D, 0); + ivec3 c = textureSize(uSampler2DArray, 0); + ivec3 d = textureSize(uSampler3D, 0); + ivec2 e = textureSize(uSamplerCube, 0); + ivec3 f = textureSize(uSamplerCubeArray, 0); + int g = textureSize(uSamplerBuffer); + ivec2 h = textureSize(uSamplerMS); + ivec3 i = textureSize(uSamplerMSArray); + + int l0 = textureQueryLevels(uSampler1D); + int l1 = textureQueryLevels(uSampler2D); + int l2 = textureQueryLevels(uSampler2DArray); + int l3 = textureQueryLevels(uSampler3D); + int l4 = textureQueryLevels(uSamplerCube); + int l5 = textureQueryLevels(uSamplerCubeArray); + + a = imageSize(uImage1D); + b = imageSize(uImage2D); + c = imageSize(uImage2DArray); + d = imageSize(uImage3D); + e = imageSize(uImageCube); + f = imageSize(uImageCubeArray); + g = imageSize(uImageBuffer); + h = imageSize(uImageMS); + i = imageSize(uImageMSArray); + + int s0 = textureSamples(uSamplerMS); + int s1 = textureSamples(uSamplerMSArray); + int s2 = imageSamples(uImageMS); + int s3 = imageSamples(uImageMSArray); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/image-size.frag b/third_party/spirv-cross/shaders/desktop-only/frag/image-size.frag new file mode 100644 index 0000000000..ffd0bfa20d --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/image-size.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(r32f, set = 0, binding = 0) uniform image2D uImage1; +layout(r32f, set = 0, binding = 1) uniform image2D uImage2; + +void main() +{ + FragColor = vec4(imageSize(uImage1), imageSize(uImage2)); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag b/third_party/spirv-cross/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag new file mode 100644 index 0000000000..ffd0bfa20d --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/image-size.no-qualifier-deduction.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(r32f, set = 0, binding = 0) uniform image2D uImage1; +layout(r32f, set = 0, binding = 1) uniform image2D uImage2; + +void main() +{ + FragColor = vec4(imageSize(uImage1), imageSize(uImage2)); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/in-block-qualifiers.frag b/third_party/spirv-cross/shaders/desktop-only/frag/in-block-qualifiers.frag new file mode 100644 index 0000000000..f22096e6d1 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/in-block-qualifiers.frag @@ -0,0 +1,20 @@ +#version 450 + +layout(location = 0) in VertexData { + flat float f; + centroid vec4 g; + flat int h; + float i; +} vin; + +layout(location = 4) in flat float f; +layout(location = 5) in centroid vec4 g; +layout(location = 6) in flat int h; +layout(location = 7) in sample float i; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vin.f + vin.g + float(vin.h) + vin.i + f + g + float(h) + i; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/layout-component.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/layout-component.desktop.frag new file mode 100644 index 0000000000..fade67ba69 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/layout-component.desktop.frag @@ -0,0 +1,14 @@ +#version 450 +layout(location = 0, component = 0) in vec2 v0; +layout(location = 0, component = 2) in float v1; +layout(location = 0) out vec2 FragColor; + +in Vertex +{ + layout(location = 1, component = 2) in float v3; +}; + +void main() +{ + FragColor = v0 + v1 + v3; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/query-levels.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/query-levels.desktop.frag new file mode 100644 index 0000000000..3a6977611b --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/query-levels.desktop.frag @@ -0,0 +1,9 @@ +#version 450 + +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(textureQueryLevels(uSampler)); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/query-lod.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/query-lod.desktop.frag new file mode 100644 index 0000000000..0cb160402f --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/query-lod.desktop.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(location = 0) in vec2 vTexCoord; +layout(binding = 0) uniform sampler2D uSampler; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureQueryLod(uSampler, vTexCoord).xyxy; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/sampler-ms-query.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/sampler-ms-query.desktop.frag new file mode 100644 index 0000000000..f707ed5c41 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/sampler-ms-query.desktop.frag @@ -0,0 +1,17 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2DMS uSampler; +layout(binding = 1) uniform sampler2DMSArray uSamplerArray; +layout(rgba8, binding = 2) uniform image2DMS uImage; +layout(rgba8, binding = 3) uniform image2DMSArray uImageArray; + +void main() +{ + FragColor = + vec4( + textureSamples(uSampler) + + textureSamples(uSamplerArray) + + imageSamples(uImage) + + imageSamples(uImageArray)); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/stencil-export.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/stencil-export.desktop.frag new file mode 100644 index 0000000000..ebe753fb28 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/stencil-export.desktop.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_ARB_shader_stencil_export : require + +layout(location = 0) out vec4 MRT0; +layout(location = 1) out vec4 MRT1; +void main() +{ + MRT0 = vec4(1.0); + MRT1 = vec4(1.0, 0.0, 1.0, 1.0); + gl_FragStencilRefARB = 100; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag b/third_party/spirv-cross/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag new file mode 100644 index 0000000000..0c4cf8f5a8 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/frag/texture-proj-shadow.desktop.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(binding = 0) uniform sampler1DShadow uShadow1D; +layout(binding = 1) uniform sampler2DShadow uShadow2D; +layout(binding = 2) uniform sampler1D uSampler1D; +layout(binding = 3) uniform sampler2D uSampler2D; +layout(binding = 4) uniform sampler3D uSampler3D; + +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vClip3; +layout(location = 1) in vec4 vClip4; +layout(location = 2) in vec2 vClip2; + +void main() +{ + FragColor = textureProj(uShadow1D, vClip4); + FragColor = textureProj(uShadow2D, vClip4); + FragColor = textureProj(uSampler1D, vClip2).x; + FragColor = textureProj(uSampler2D, vClip3).x; + FragColor = textureProj(uSampler3D, vClip4).x; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/geom/basic.desktop.sso.geom b/third_party/spirv-cross/shaders/desktop-only/geom/basic.desktop.sso.geom new file mode 100644 index 0000000000..f3d331dd15 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/geom/basic.desktop.sso.geom @@ -0,0 +1,37 @@ +#version 450 + +layout(triangles, invocations = 4) in; +layout(triangle_strip, max_vertices = 3) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal + float(gl_InvocationID); + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + 4.0 * float(gl_InvocationID); + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + 2.0 * float(gl_InvocationID); + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/geom/viewport-index.desktop.geom b/third_party/spirv-cross/shaders/desktop-only/geom/viewport-index.desktop.geom new file mode 100644 index 0000000000..e02e81daf6 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/geom/viewport-index.desktop.geom @@ -0,0 +1,11 @@ +#version 450 + +layout(triangles) in; +layout(triangle_strip) out; +layout(max_vertices = 4) out; + +void main() +{ + gl_ViewportIndex = 1; +} + diff --git a/third_party/spirv-cross/shaders/desktop-only/tesc/basic.desktop.sso.tesc b/third_party/spirv-cross/shaders/desktop-only/tesc/basic.desktop.sso.tesc new file mode 100644 index 0000000000..8ff739b0af --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/tesc/basic.desktop.sso.tesc @@ -0,0 +1,28 @@ +#version 450 +layout(vertices = 1) out; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[gl_MaxPatchVertices]; + +out gl_PerVertex +{ + vec4 gl_Position; +} gl_out[1]; + +layout(location = 0) patch out vec3 vFoo; + + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); + + gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/tese/triangle.desktop.sso.tese b/third_party/spirv-cross/shaders/desktop-only/tese/triangle.desktop.sso.tese new file mode 100644 index 0000000000..c964fbe263 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/tese/triangle.desktop.sso.tese @@ -0,0 +1,22 @@ +#version 450 + +layout(cw, triangles, fractional_even_spacing) in; + +in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[gl_MaxPatchVertices]; + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = + gl_in[0].gl_Position * gl_TessCoord.x + + gl_in[1].gl_Position * gl_TessCoord.y + + gl_in[2].gl_Position * gl_TessCoord.z; +} + diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/basic.desktop.sso.vert b/third_party/spirv-cross/shaders/desktop-only/vert/basic.desktop.sso.vert new file mode 100644 index 0000000000..9ddab08cda --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/basic.desktop.sso.vert @@ -0,0 +1,20 @@ +#version 450 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; +}; +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert b/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert new file mode 100644 index 0000000000..1489cc7a15 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.sso.vert @@ -0,0 +1,13 @@ +#version 450 +out float gl_ClipDistance[4]; +out float gl_CullDistance[3]; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.vert b/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.vert new file mode 100644 index 0000000000..1489cc7a15 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/clip-cull-distance.desktop.vert @@ -0,0 +1,13 @@ +#version 450 +out float gl_ClipDistance[4]; +out float gl_CullDistance[3]; + +void main() +{ + gl_Position = vec4(1.0); + gl_ClipDistance[0] = 0.0; + gl_ClipDistance[1] = 0.0; + gl_ClipDistance[2] = 0.0; + gl_ClipDistance[3] = 0.0; + gl_CullDistance[1] = 4.0; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/out-block-qualifiers.vert b/third_party/spirv-cross/shaders/desktop-only/vert/out-block-qualifiers.vert new file mode 100644 index 0000000000..c1e409fb4c --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/out-block-qualifiers.vert @@ -0,0 +1,26 @@ +#version 450 + +layout(location = 0) out VertexData { + flat float f; + centroid vec4 g; + flat int h; + float i; +} vout; + +layout(location = 4) out flat float f; +layout(location = 5) out centroid vec4 g; +layout(location = 6) out flat int h; +layout(location = 7) out float i; + +void main() +{ + vout.f = 10.0; + vout.g = vec4(20.0); + vout.h = 20; + vout.i = 30.0; + + f = 10.0; + g = vec4(20.0); + h = 20; + i = 30.0; +} diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert b/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert new file mode 100644 index 0000000000..b5cde02705 --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters-450.desktop.vk.vert @@ -0,0 +1,12 @@ +#version 450 +#extension GL_ARB_shader_draw_parameters : enable + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(gl_BaseVertexARB, gl_BaseInstanceARB, gl_DrawIDARB, 1); +} diff --git a/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert b/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert new file mode 100644 index 0000000000..997804eceb --- /dev/null +++ b/third_party/spirv-cross/shaders/desktop-only/vert/shader-draw-parameters.desktop.vk.vert @@ -0,0 +1,11 @@ +#version 460 + +out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(gl_BaseVertex, gl_BaseInstance, gl_DrawID, 1); +} diff --git a/third_party/spirv-cross/shaders/flatten/array.flatten.vert b/third_party/spirv-cross/shaders/flatten/array.flatten.vert new file mode 100644 index 0000000000..fa6da076c9 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/array.flatten.vert @@ -0,0 +1,19 @@ +#version 310 es + +layout(std140) uniform UBO +{ + vec4 A4[5][4][2]; + mat4 uMVP; + vec4 A1[2]; + vec4 A2[2][3]; + float A3[3]; + vec4 Offset; +}; +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec4 a4 = A4[2][3][1]; // 2 * (4 * 2) + 3 * 2 + 1 = 16 + 6 + 1 = 23. + vec4 offset = A2[1][1] + A1[1] + A3[2]; + gl_Position = uMVP * aVertex + Offset + offset; +} diff --git a/third_party/spirv-cross/shaders/flatten/basic.flatten.vert b/third_party/spirv-cross/shaders/flatten/basic.flatten.vert new file mode 100644 index 0000000000..e60a9067b1 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/basic.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders/flatten/copy.flatten.vert b/third_party/spirv-cross/shaders/flatten/copy.flatten.vert new file mode 100644 index 0000000000..4f1b8805e7 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/copy.flatten.vert @@ -0,0 +1,34 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + Light light = lights[i]; + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders/flatten/dynamic.flatten.vert b/third_party/spirv-cross/shaders/flatten/dynamic.flatten.vert new file mode 100644 index 0000000000..a341d45288 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/dynamic.flatten.vert @@ -0,0 +1,33 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light lights[4]; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + for (int i = 0; i < 4; ++i) + { + vec3 L = aVertex.xyz - lights[i].Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / lights[i].Radius, 0.0, 1.0) * lights[i].Color); + } +} diff --git a/third_party/spirv-cross/shaders/flatten/matrix-conversion.flatten.frag b/third_party/spirv-cross/shaders/flatten/matrix-conversion.flatten.frag new file mode 100644 index 0000000000..427825c340 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/matrix-conversion.flatten.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec3 FragColor; +layout(location = 0) flat in vec3 vNormal; + +layout(binding = 0, std140) uniform UBO +{ + mat4 m; +}; + +void main() +{ + FragColor = mat3(m) * vNormal; +} diff --git a/third_party/spirv-cross/shaders/flatten/matrixindex.flatten.vert b/third_party/spirv-cross/shaders/flatten/matrixindex.flatten.vert new file mode 100644 index 0000000000..0ee7838432 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/matrixindex.flatten.vert @@ -0,0 +1,25 @@ +#version 310 es + +layout(std140) uniform UBO +{ + layout(column_major) mat4 M1C; + layout(row_major) mat4 M1R; + layout(column_major) mat2x4 M2C; + layout(row_major) mat2x4 M2R; +}; + +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; + +void main() +{ + gl_Position = vec4(0.0); + oA = M1C[1]; + oB = M1R[1]; + oC = M2C[1]; + oD = M2R[0]; + oE = vec4(M1C[1][2], M1R[1][2], M2C[1][2], M2R[1][2]); +} diff --git a/third_party/spirv-cross/shaders/flatten/multiindex.flatten.vert b/third_party/spirv-cross/shaders/flatten/multiindex.flatten.vert new file mode 100644 index 0000000000..0b471d86e0 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/multiindex.flatten.vert @@ -0,0 +1,13 @@ +#version 310 es + +layout(std140) uniform UBO +{ + vec4 Data[3][5]; +}; + +layout(location = 0) in ivec2 aIndex; + +void main() +{ + gl_Position = Data[aIndex.x][aIndex.y]; +} diff --git a/third_party/spirv-cross/shaders/flatten/push-constant.flatten.vert b/third_party/spirv-cross/shaders/flatten/push-constant.flatten.vert new file mode 100644 index 0000000000..c7b1b42e1b --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/push-constant.flatten.vert @@ -0,0 +1,17 @@ +#version 310 es + +layout(push_constant, std430) uniform PushMe +{ + mat4 MVP; + mat2 Rot; // The MatrixStride will be 8 here. + float Arr[4]; +} registers; + +layout(location = 0) in vec2 Rot; +layout(location = 1) in vec4 Pos; +layout(location = 0) out vec2 vRot; +void main() +{ + gl_Position = registers.MVP * Pos; + vRot = registers.Rot * Rot + registers.Arr[2]; // Constant access should work even if array stride is just 4 here. +} diff --git a/third_party/spirv-cross/shaders/flatten/rowmajor.flatten.vert b/third_party/spirv-cross/shaders/flatten/rowmajor.flatten.vert new file mode 100644 index 0000000000..88c468c8f2 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/rowmajor.flatten.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + layout(column_major) mat4 uMVPR; + layout(row_major) mat4 uMVPC; + layout(row_major) mat2x4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; + +void main() +{ + vec2 v = aVertex * uMVP; + gl_Position = uMVPR * aVertex + uMVPC * aVertex; +} diff --git a/third_party/spirv-cross/shaders/flatten/struct.flatten.vert b/third_party/spirv-cross/shaders/flatten/struct.flatten.vert new file mode 100644 index 0000000000..936bb41b85 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/struct.flatten.vert @@ -0,0 +1,30 @@ +#version 310 es + +struct Light +{ + vec3 Position; + float Radius; + + vec4 Color; +}; + +layout(std140) uniform UBO +{ + mat4 uMVP; + + Light light; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec4 vColor; + +void main() +{ + gl_Position = uMVP * aVertex; + + vColor = vec4(0.0); + + vec3 L = aVertex.xyz - light.Position; + vColor += dot(aNormal, normalize(L)) * (clamp(1.0 - length(L) / light.Radius, 0.0, 1.0) * light.Color); +} diff --git a/third_party/spirv-cross/shaders/flatten/struct.rowmajor.flatten.vert b/third_party/spirv-cross/shaders/flatten/struct.rowmajor.flatten.vert new file mode 100644 index 0000000000..231389b8f4 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/struct.rowmajor.flatten.vert @@ -0,0 +1,26 @@ +#version 310 es + +struct Foo +{ + mat3x4 MVP0; + mat3x4 MVP1; +}; + +layout(std140, binding = 0) uniform UBO +{ + layout(row_major) Foo foo; +}; + +layout(location = 0) in vec4 v0; +layout(location = 1) in vec4 v1; +layout(location = 0) out vec3 V0; +layout(location = 1) out vec3 V1; + +void main() +{ + Foo f = foo; + vec3 a = v0 * f.MVP0; + vec3 b = v1 * f.MVP1; + V0 = a; + V1 = b; +} diff --git a/third_party/spirv-cross/shaders/flatten/swizzle.flatten.vert b/third_party/spirv-cross/shaders/flatten/swizzle.flatten.vert new file mode 100644 index 0000000000..fafff7734e --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/swizzle.flatten.vert @@ -0,0 +1,47 @@ +#version 310 es + +// comments note the 16b alignment boundaries (see GL spec 7.6.2.2 Standard Uniform Block Layout) +layout(std140, binding = 0) uniform UBO +{ + // 16b boundary + vec4 A; + // 16b boundary + vec2 B0; + vec2 B1; + // 16b boundary + float C0; + // 16b boundary (vec3 is aligned to 16b) + vec3 C1; + // 16b boundary + vec3 D0; + float D1; + // 16b boundary + float E0; + float E1; + float E2; + float E3; + // 16b boundary + float F0; + vec2 F1; + // 16b boundary (vec2 before us is aligned to 8b) + float F2; +}; + +layout(location = 0) out vec4 oA; +layout(location = 1) out vec4 oB; +layout(location = 2) out vec4 oC; +layout(location = 3) out vec4 oD; +layout(location = 4) out vec4 oE; +layout(location = 5) out vec4 oF; + +void main() +{ + gl_Position = vec4(0.0); + + oA = A; + oB = vec4(B0, B1); + oC = vec4(C0, C1); + oD = vec4(D0, D1); + oE = vec4(E0, E1, E2, E3); + oF = vec4(F0, F1, F2); +} diff --git a/third_party/spirv-cross/shaders/flatten/types.flatten.frag b/third_party/spirv-cross/shaders/flatten/types.flatten.frag new file mode 100644 index 0000000000..faab5b7e05 --- /dev/null +++ b/third_party/spirv-cross/shaders/flatten/types.flatten.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(std140, binding = 0) uniform UBO0 +{ + vec4 a; + vec4 b; +}; + +layout(std140, binding = 0) uniform UBO1 +{ + ivec4 c; + ivec4 d; +}; + +layout(std140, binding = 0) uniform UBO2 +{ + uvec4 e; + uvec4 f; +}; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(c) + vec4(d) + vec4(e) + vec4(f) + a + b; +} diff --git a/third_party/spirv-cross/shaders/frag/array-lut-no-loop-variable.frag b/third_party/spirv-cross/shaders/frag/array-lut-no-loop-variable.frag new file mode 100644 index 0000000000..3493e0cccc --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/array-lut-no-loop-variable.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 v0; + +void main() +{ + float lut[5] = float[](1.0, 2.0, 3.0, 4.0, 5.0); + for (int i = 0; i < 4; i++, FragColor += lut[i]) + { + } +} diff --git a/third_party/spirv-cross/shaders/frag/avoid-expression-lowering-to-loop.frag b/third_party/spirv-cross/shaders/frag/avoid-expression-lowering-to-loop.frag new file mode 100644 index 0000000000..3473875a40 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/avoid-expression-lowering-to-loop.frag @@ -0,0 +1,23 @@ +#version 310 es +precision mediump float; +precision mediump int; + +layout(binding = 0) uniform mediump sampler2D tex; +layout(binding = 1) uniform Count +{ + float count; +}; + +layout(location = 0) in highp vec4 vertex; +layout(location = 0) out vec4 fragColor; + +void main() { + + highp float size = 1.0 / float(textureSize(tex, 0).x); + float r = 0.0; + float d = dFdx(vertex.x); + for (float i = 0.0; i < count ; i += 1.0) + r += size * d; + + fragColor = vec4(r); +} diff --git a/third_party/spirv-cross/shaders/frag/barycentric-khr.frag b/third_party/spirv-cross/shaders/frag/barycentric-khr.frag new file mode 100644 index 0000000000..fcaca04e23 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/barycentric-khr.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_EXT_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexEXT in vec2 vUV[3]; +layout(location = 3) pervertexEXT in vec2 vUV2[3]; + +void main () { + value = gl_BaryCoordEXT.x * vUV[0] + gl_BaryCoordEXT.y * vUV[1] + gl_BaryCoordEXT.z * vUV[2]; + value += gl_BaryCoordNoPerspEXT.x * vUV2[0] + gl_BaryCoordNoPerspEXT.y * vUV2[1] + gl_BaryCoordNoPerspEXT.z * vUV2[2]; +} diff --git a/third_party/spirv-cross/shaders/frag/barycentric-nv.frag b/third_party/spirv-cross/shaders/frag/barycentric-nv.frag new file mode 100644 index 0000000000..38d651a780 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/barycentric-nv.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) out vec2 value; +layout(location = 0) pervertexNV in vec2 vUV[3]; +layout(location = 1) pervertexNV in vec2 vUV2[3]; + +void main () { + value = gl_BaryCoordNV.x * vUV[0] + gl_BaryCoordNV.y * vUV[1] + gl_BaryCoordNV.z * vUV[2]; + value += gl_BaryCoordNoPerspNV.x * vUV2[0] + gl_BaryCoordNoPerspNV.y * vUV2[1] + gl_BaryCoordNoPerspNV.z * vUV2[2]; +} diff --git a/third_party/spirv-cross/shaders/frag/basic.frag b/third_party/spirv-cross/shaders/frag/basic.frag new file mode 100644 index 0000000000..dd9a8f8507 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/basic.frag @@ -0,0 +1,13 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor * texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders/frag/complex-expression-in-access-chain.frag b/third_party/spirv-cross/shaders/frag/complex-expression-in-access-chain.frag new file mode 100644 index 0000000000..47f93931ce --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/complex-expression-in-access-chain.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +struct Foo +{ + vec4 a; + vec4 b; +}; + +layout(binding = 0) buffer UBO +{ + vec4 results[1024]; +}; + +layout(binding = 1) uniform highp isampler2D Buf; +layout(location = 0) flat in int vIn; +layout(location = 1) flat in int vIn2; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec4 coords = texelFetch(Buf, ivec2(gl_FragCoord.xy), 0); + vec4 foo = results[coords.x % 16]; + + int c = vIn * vIn; + int d = vIn2 * vIn2; + FragColor = foo + foo + results[c + d]; +} diff --git a/third_party/spirv-cross/shaders/frag/composite-extract-forced-temporary.frag b/third_party/spirv-cross/shaders/frag/composite-extract-forced-temporary.frag new file mode 100644 index 0000000000..35fdbe8624 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/composite-extract-forced-temporary.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +layout(binding = 0) uniform sampler2D Texture; +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTexCoord; + +void main() +{ + float f = texture(Texture, vTexCoord).x; + FragColor = vec4(f * f); +} diff --git a/third_party/spirv-cross/shaders/frag/constant-array.frag b/third_party/spirv-cross/shaders/frag/constant-array.frag new file mode 100644 index 0000000000..b862cb1dbf --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/constant-array.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; + +layout(location = 0) flat in int index; + +struct Foobar { float a; float b; }; + +vec4 resolve(Foobar f) +{ + return vec4(f.a + f.b); +} + +void main() +{ + const vec4 foo[3] = vec4[](vec4(1.0), vec4(2.0), vec4(3.0)); + const vec4 foobars[2][2] = vec4[][](vec4[](vec4(1.0), vec4(2.0)), vec4[](vec4(8.0), vec4(10.0))); + const Foobar foos[2] = Foobar[](Foobar(10.0, 40.0), Foobar(90.0, 70.0)); + + FragColor = foo[index] + foobars[index][index + 1] + resolve(Foobar(10.0, 20.0)) + resolve(foos[index]); +} diff --git a/third_party/spirv-cross/shaders/frag/constant-composites.frag b/third_party/spirv-cross/shaders/frag/constant-composites.frag new file mode 100644 index 0000000000..a12e22ff4f --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/constant-composites.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +float lut[4] = float[](1.0, 4.0, 3.0, 2.0); + +struct Foo +{ + float a; + float b; +}; +Foo foos[2] = Foo[](Foo(10.0, 20.0), Foo(30.0, 40.0)); + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int line; + +void main() +{ + FragColor = vec4(lut[line]); + FragColor += foos[line].a * foos[1 - line].a; +} diff --git a/third_party/spirv-cross/shaders/frag/false-loop-init.frag b/third_party/spirv-cross/shaders/frag/false-loop-init.frag new file mode 100644 index 0000000000..7ce5b52bd7 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/false-loop-init.frag @@ -0,0 +1,19 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 accum; +layout(location = 0) out vec4 result; + +void main() +{ + result = vec4(0.0); + uint j; + for (int i = 0; i < 4; i += int(j)) + { + if (accum.y > 10.0) + j = 40u; + else + j = 30u; + result += accum; + } +} diff --git a/third_party/spirv-cross/shaders/frag/flush_params.frag b/third_party/spirv-cross/shaders/frag/flush_params.frag new file mode 100644 index 0000000000..8a26ad3a28 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/flush_params.frag @@ -0,0 +1,27 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; + +struct Structy +{ + vec4 c; +}; + +void foo2(out Structy f) +{ + f.c = vec4(10.0); +} + +Structy foo() +{ + Structy f; + foo2(f); + return f; +} + +void main() +{ + Structy s = foo(); + FragColor = s.c; +} diff --git a/third_party/spirv-cross/shaders/frag/for-loop-continue-control-flow.frag b/third_party/spirv-cross/shaders/frag/for-loop-continue-control-flow.frag new file mode 100644 index 0000000000..1f91cca2a4 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/for-loop-continue-control-flow.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +void main() +{ + FragColor = vec4(0.0); + for (int i = 0; i < 3; (0 > 1) ? 1 : i ++) + { + int a = i; + FragColor[a] += float(i); + } +} diff --git a/third_party/spirv-cross/shaders/frag/for-loop-init.frag b/third_party/spirv-cross/shaders/frag/for-loop-init.frag new file mode 100644 index 0000000000..0cde26765e --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/for-loop-init.frag @@ -0,0 +1,52 @@ +#version 310 es +precision mediump float; +layout(location = 0) out int FragColor; + +void main() +{ + FragColor = 16; + + // Basic loop variable. + for (int i = 0; i < 25; i++) + FragColor += 10; + + // Multiple loop variables. + for (int i = 1, j = 4; i < 30; i++, j += 4) + FragColor += 11; + + // A potential loop variables, but we access it outside the loop, + // so cannot be one. + int k = 0; + for (; k < 20; k++) + FragColor += 12; + k += 3; + FragColor += k; + + // Potential loop variables, but the dominator is not trivial. + int l; + if (k == 40) + { + for (l = 0; l < 40; l++) + FragColor += 13; + return; + } + else + { + l = k; + FragColor += l; + } + + // Vectors cannot be loop variables + for (ivec2 i = ivec2(0); i.x < 10; i.x += 4) + { + FragColor += i.y; + } + + // Check that static expressions can be used before the loop header. + int m = 0; + m = k; + int o = m; + for (; m < 40; m++) + FragColor += m; + FragColor += o; +} diff --git a/third_party/spirv-cross/shaders/frag/frexp-modf.frag b/third_party/spirv-cross/shaders/frag/frexp-modf.frag new file mode 100644 index 0000000000..6a26a4175f --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/frexp-modf.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out float FragColor; +layout(location = 0) in float v0; +layout(location = 1) in vec2 v1; + +void main() +{ + int e0; + float f0 = frexp(v0, e0); + f0 = frexp(v0 + 1.0, e0); + + ivec2 e1; + vec2 f1 = frexp(v1, e1); + + float r0; + float m0 = modf(v0, r0); + vec2 r1; + vec2 m1 = modf(v1, r1); + + FragColor = f0 + f1.x + f1.y + m0 + m1.x + m1.y; +} + diff --git a/third_party/spirv-cross/shaders/frag/front-facing.frag b/third_party/spirv-cross/shaders/frag/front-facing.frag new file mode 100644 index 0000000000..90ca1abf4e --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/front-facing.frag @@ -0,0 +1,14 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; + +void main() +{ + if (gl_FrontFacing) + FragColor = vA; + else + FragColor = vB; +} diff --git a/third_party/spirv-cross/shaders/frag/gather-dref.frag b/third_party/spirv-cross/shaders/frag/gather-dref.frag new file mode 100644 index 0000000000..a8aac56cb5 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/gather-dref.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(binding = 0) uniform mediump sampler2DShadow uT; +layout(location = 0) in vec3 vUV; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureGather(uT, vUV.xy, vUV.z); +} diff --git a/third_party/spirv-cross/shaders/frag/ground.frag b/third_party/spirv-cross/shaders/frag/ground.frag new file mode 100755 index 0000000000..d1fcfd4907 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/ground.frag @@ -0,0 +1,162 @@ +#version 310 es +precision mediump float; + +#define DEBUG_NONE 0 +#define DEBUG_DIFFUSE 1 +#define DEBUG_SPECULAR 2 +#define DEBUG_LIGHTING 3 +#define DEBUG_FOG 4 +#define DEBUG DEBUG_NONE + +#define FORWARD 0 +#define DEFERRED 1 +#define DEFERRED_VTEX 2 + +float saturate(float x) { return clamp(x, 0.0, 1.0); } + +layout(std140, binding = 4) uniform GlobalPSData +{ + vec4 g_CamPos; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_ResolutionParams; + vec4 g_TimeParams; + vec4 g_FogColor_Distance; +}; + +vec4 ComputeFogFactor(vec3 WorldPos) +{ + vec4 FogData; + vec3 vEye = WorldPos - g_CamPos.xyz; + vec3 nEye = normalize(vEye); + FogData.w = exp(-dot(vEye, vEye) * g_FogColor_Distance.w * 0.75); + + float fog_sun_factor = pow(saturate(dot(nEye, g_SunDir.xyz)), 8.0); + FogData.xyz = mix(vec3(1.0, 1.0, 1.0), vec3(0.6, 0.6, 0.9), nEye.y * 0.5 + 0.5); + FogData.xyz = mix(FogData.xyz, vec3(0.95, 0.87, 0.78), fog_sun_factor); + return FogData; +} + +void ApplyFog(inout vec3 Color, vec4 FogData) +{ + Color = mix(FogData.xyz, Color, FogData.w); +} + +void ApplyLighting(inout mediump vec3 Color, mediump float DiffuseFactor) +{ + mediump vec3 DiffuseLight = g_SunColor.xyz * DiffuseFactor; + mediump vec3 AmbientLight = vec3(0.2, 0.35, 0.55) * 0.5; + mediump vec3 Lighting = DiffuseLight + AmbientLight; +#if DEBUG == DEBUG_LIGHTING + Color = Lighting; +#else + Color *= Lighting; +#endif +} + +#define SPECULAR 0 +#define GLOSSMAP 0 + +void ApplySpecular(inout mediump vec3 Color, mediump vec3 EyeVec, mediump vec3 Normal, mediump vec3 SpecularColor, mediump float Shininess, mediump float FresnelAmount) +{ + mediump vec3 HalfAngle = normalize(-EyeVec + g_SunDir.xyz); + + mediump float v_dot_h = saturate(dot(HalfAngle, -EyeVec)); + mediump float n_dot_l = saturate(dot(Normal, g_SunDir.xyz)); + mediump float n_dot_h = saturate(dot(Normal, HalfAngle)); + mediump float n_dot_v = saturate(dot(-EyeVec, Normal)); + mediump float h_dot_l = saturate(dot(g_SunDir.xyz, HalfAngle)); + + const mediump float roughness_value = 0.25; + + mediump float r_sq = roughness_value * roughness_value; + mediump float n_dot_h_sq = n_dot_h * n_dot_h; + mediump float roughness_a = 1.0 / (4.0 * r_sq * n_dot_h_sq * n_dot_h_sq); + mediump float roughness_b = n_dot_h_sq - 1.0; + mediump float roughness_c = r_sq * n_dot_h_sq; + mediump float roughness = saturate(roughness_a * exp(roughness_b / roughness_c)); + + FresnelAmount = 0.5; + mediump float fresnel_term = pow(1.0 - n_dot_v, 5.0) * (1.0 - FresnelAmount) + FresnelAmount; + + mediump float geo_numerator = 2.0 * n_dot_h; + mediump float geo_denominator = 1.0 / v_dot_h; + mediump float geo_term = min(1.0, min(n_dot_v, n_dot_l) * geo_numerator * geo_denominator); + +#if SPECULAR || GLOSSMAP + Color += SpecularColor * g_SunColor.xyz * fresnel_term * roughness * n_dot_l * geo_term / (n_dot_v * n_dot_l + 0.0001); +#endif + + //Color = vec3(0.025 * 1.0 / (n_dot_v * n_dot_l)); +} +layout(location = 0) in vec2 TexCoord; +layout(location = 1) in vec3 EyeVec; + +layout(binding = 2) uniform sampler2D TexNormalmap; +//layout(binding = 3) uniform sampler2D TexScatteringLUT; + +#define DIFFUSE_ONLY 0 +#define GLOBAL_RENDERER DEFERRED +#define OUTPUT_FEEDBACK_TEXTURE 0 + +#if DIFFUSE_ONLY +layout(location = 0) out vec4 ColorOut; +layout(location = 1) out vec4 NormalOut; +#else +layout(location = 0) out vec4 AlbedoOut; +layout(location = 1) out vec4 SpecularOut; +layout(location = 2) out vec4 NormalOut; +layout(location = 3) out vec4 LightingOut; +#endif + +void Resolve(vec3 Albedo, vec3 Normal, float Roughness, float Metallic) +{ +#if (GLOBAL_RENDERER == FORWARD) || OUTPUT_FEEDBACK_TEXTURE + float Lighting = saturate(dot(Normal, normalize(vec3(1.0, 0.5, 1.0)))); + ColorOut.xyz = Albedo * Lighting; + ColorOut.w = 1.0; +#elif DIFFUSE_ONLY + ColorOut = vec4(Albedo, 0.0); + NormalOut.xyz = Normal * 0.5 + 0.5; + NormalOut.w = 1.0; + + // linearize and map to 0..255 range + ColorOut.w = -0.003921569 / (gl_FragCoord.z - 1.003921569); + ColorOut.w = log2(1.0 + saturate(length(EyeVec.xyz) / 200.0)); + ColorOut.w -= 1.0 / 255.0; +#else + LightingOut = vec4(0.0); + NormalOut = vec4(Normal * 0.5 + 0.5, 0.0); + SpecularOut = vec4(Roughness, Metallic, 0.0, 0.0); + AlbedoOut = vec4(Albedo, 1.0); +#endif +} + +void main() +{ + vec3 Normal = texture(TexNormalmap, TexCoord).xyz * 2.0 - 1.0; + Normal = normalize(Normal); + + vec2 scatter_uv; + scatter_uv.x = saturate(length(EyeVec) / 1000.0); + + vec3 nEye = normalize(EyeVec); + scatter_uv.y = 0.0; //nEye.x * 0.5 + 0.5; + + vec3 Color = vec3(0.1, 0.3, 0.1); + vec3 grass = vec3(0.1, 0.3, 0.1); + vec3 dirt = vec3(0.1, 0.1, 0.1); + vec3 snow = vec3(0.8, 0.8, 0.8); + + float grass_snow = smoothstep(0.0, 0.15, (g_CamPos.y + EyeVec.y) / 200.0); + vec3 base = mix(grass, snow, grass_snow); + + float edge = smoothstep(0.7, 0.75, Normal.y); + Color = mix(dirt, base, edge); + Color *= Color; + + float Roughness = 1.0 - edge * grass_snow; + + Resolve(Color, Normal, Roughness, 0.0); +} + diff --git a/third_party/spirv-cross/shaders/frag/helper-invocation.frag b/third_party/spirv-cross/shaders/frag/helper-invocation.frag new file mode 100644 index 0000000000..1da8c57631 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/helper-invocation.frag @@ -0,0 +1,21 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vUV; +layout(binding = 0) uniform sampler2D uSampler; + +vec4 foo() +{ + vec4 color; + if (!gl_HelperInvocation) + color = textureLod(uSampler, vUV, 0.0); + else + color = vec4(1.0); + return color; +} + +void main() +{ + FragColor = foo(); +} diff --git a/third_party/spirv-cross/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag b/third_party/spirv-cross/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag new file mode 100644 index 0000000000..cc8a648358 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int vA; +layout(location = 1) flat in int vB; + +void main() +{ + FragColor = vec4(0.0); + + int k = 0; + int j; + for (int i = 0; i < vA; i += j) + { + if ((vA + i) == 20) + k = 50; + else if ((vB + i) == 40) + k = 60; + + j = k + 10; + FragColor += 1.0; + } +} diff --git a/third_party/spirv-cross/shaders/frag/image-load-store-uint-coord.asm.frag b/third_party/spirv-cross/shaders/frag/image-load-store-uint-coord.asm.frag new file mode 100644 index 0000000000..a9bf1a7497 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/image-load-store-uint-coord.asm.frag @@ -0,0 +1,103 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 2 +; Bound: 63 +; Schema: 0 + OpCapability Shader + OpCapability SampledBuffer + OpCapability ImageBuffer + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_entryPointOutput + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + OpName %_main_ "@main(" + OpName %storeTemp "storeTemp" + OpName %RWIm "RWIm" + OpName %v "v" + OpName %RWBuf "RWBuf" + OpName %ROIm "ROIm" + OpName %ROBuf "ROBuf" + OpName %_entryPointOutput "@entryPointOutput" + OpDecorate %RWIm DescriptorSet 0 + OpDecorate %RWIm Binding 1 + OpDecorate %RWBuf DescriptorSet 0 + OpDecorate %RWBuf Binding 0 + OpDecorate %ROIm DescriptorSet 0 + OpDecorate %ROIm Binding 1 + OpDecorate %ROBuf DescriptorSet 0 + OpDecorate %ROBuf Binding 0 + OpDecorate %_entryPointOutput Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %8 = OpTypeFunction %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_10 = OpConstant %float 10 + %float_0_5 = OpConstant %float 0.5 + %float_8 = OpConstant %float 8 + %float_2 = OpConstant %float 2 + %17 = OpConstantComposite %v4float %float_10 %float_0_5 %float_8 %float_2 + %18 = OpTypeImage %float 2D 0 0 0 2 Rgba32f +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 + %RWIm = OpVariable %_ptr_UniformConstant_18 UniformConstant + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_10 = OpConstant %uint 10 + %25 = OpConstantComposite %v2uint %uint_10 %uint_10 + %uint_30 = OpConstant %uint 30 + %30 = OpConstantComposite %v2uint %uint_30 %uint_30 + %32 = OpTypeImage %float Buffer 0 0 0 2 Rgba32f +%_ptr_UniformConstant_32 = OpTypePointer UniformConstant %32 + %RWBuf = OpVariable %_ptr_UniformConstant_32 UniformConstant + %uint_80 = OpConstant %uint 80 + %38 = OpTypeImage %float 2D 0 0 0 1 Unknown + %SampledImage = OpTypeSampledImage %38 +%_ptr_UniformConstant_38 = OpTypePointer UniformConstant %SampledImage + %ROIm = OpVariable %_ptr_UniformConstant_38 UniformConstant + %uint_50 = OpConstant %uint 50 + %uint_60 = OpConstant %uint 60 + %44 = OpConstantComposite %v2uint %uint_50 %uint_60 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %50 = OpTypeImage %float Buffer 0 0 0 1 Rgba32f +%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50 + %ROBuf = OpVariable %_ptr_UniformConstant_50 UniformConstant +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %62 = OpFunctionCall %v4float %_main_ + OpStore %_entryPointOutput %62 + OpReturn + OpFunctionEnd + %_main_ = OpFunction %v4float None %8 + %10 = OpLabel + %storeTemp = OpVariable %_ptr_Function_v4float Function + %v = OpVariable %_ptr_Function_v4float Function + OpStore %storeTemp %17 + %21 = OpLoad %18 %RWIm + %26 = OpLoad %v4float %storeTemp + OpImageWrite %21 %25 %26 + %28 = OpLoad %18 %RWIm + %31 = OpImageRead %v4float %28 %30 + OpStore %v %31 + %35 = OpLoad %32 %RWBuf + %37 = OpLoad %v4float %v + OpImageWrite %35 %uint_80 %37 + %41 = OpLoad %SampledImage %ROIm + %ROImage = OpImage %38 %41 + %47 = OpImageFetch %v4float %ROImage %44 Lod %int_0 + %48 = OpLoad %v4float %v + %49 = OpFAdd %v4float %48 %47 + OpStore %v %49 + %53 = OpLoad %50 %ROBuf + %54 = OpImageFetch %v4float %53 %uint_80 + %55 = OpLoad %v4float %v + %56 = OpFAdd %v4float %55 %54 + OpStore %v %56 + %57 = OpLoad %v4float %v + OpReturnValue %57 + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/frag/inside-loop-dominated-variable-preservation.frag b/third_party/spirv-cross/shaders/frag/inside-loop-dominated-variable-preservation.frag new file mode 100644 index 0000000000..695bcaea81 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/inside-loop-dominated-variable-preservation.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; + +void main() +{ + float v; + bool written = false; + for (int j = 0; j < 10; j++) + { + for (int i = 0; i < 4; i++) + { + float w = 0.0; + if (written) + w += v; + else + v = 20.0; + + v += float(i); + written = true; + } + } + FragColor = vec4(1.0); +} diff --git a/third_party/spirv-cross/shaders/frag/loop-dominator-and-switch-default.frag b/third_party/spirv-cross/shaders/frag/loop-dominator-and-switch-default.frag new file mode 100644 index 0000000000..344d895bf6 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/loop-dominator-and-switch-default.frag @@ -0,0 +1,34 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 fragColor; + +void main() +{ + vec4 f4; + int c = int(f4.x); + + for (int j = 0; j < c; j++) + { + switch (c) + { + case 0: + f4.y = 0.0; + break; + case 1: + f4.y = 1.0; + break; + default: + { + int i = 0; + while (i++ < c) { + f4.y += 0.5; + } + continue; + } + } + f4.y += 0.5; + } + + fragColor = f4; +} diff --git a/third_party/spirv-cross/shaders/frag/lut-promotion.frag b/third_party/spirv-cross/shaders/frag/lut-promotion.frag new file mode 100644 index 0000000000..0cdc8148f9 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/lut-promotion.frag @@ -0,0 +1,44 @@ +#version 310 es +precision mediump float; +layout(location = 0) out float FragColor; +layout(location = 0) flat in int index; + +const float LUT[16] = float[]( + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0, + 1.0, 2.0, 3.0, 4.0); + +void main() +{ + // Try reading LUTs, both in branches and not branch. + FragColor = LUT[index]; + if (index < 10) + FragColor += LUT[index ^ 1]; + else + FragColor += LUT[index & 1]; + + // Not declared as a LUT, but can be promoted to one. + vec4 foo[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + FragColor += foo[index & 3].y; + } + else + { + FragColor += foo[index & 1].x; + } + + // Not declared as a LUT, but this cannot be promoted, because we have a partial write. + vec4 foobar[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + if (index > 30) + { + foobar[1].z = 20.0; + } + FragColor += foobar[index & 3].z; + + // Not declared as a LUT, but this cannot be promoted, because we have two complete writes. + vec4 baz[4] = vec4[](vec4(0.0), vec4(1.0), vec4(8.0), vec4(5.0)); + baz = vec4[](vec4(20.0), vec4(30.0), vec4(50.0), vec4(60.0)); + FragColor += baz[index & 3].z; +} diff --git a/third_party/spirv-cross/shaders/frag/mix.frag b/third_party/spirv-cross/shaders/frag/mix.frag new file mode 100644 index 0000000000..a5d589dd08 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/mix.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vIn0; +layout(location = 1) in vec4 vIn1; +layout(location = 2) in float vIn2; +layout(location = 3) in float vIn3; +layout(location = 0) out vec4 FragColor; + +void main() +{ + bvec4 l = bvec4(false, true, false, false); + FragColor = mix(vIn0, vIn1, l); + + bool f = true; + FragColor = vec4(mix(vIn2, vIn3, f)); + + FragColor = f ? vIn0 : vIn1; + FragColor = vec4(f ? vIn2 : vIn3); +} diff --git a/third_party/spirv-cross/shaders/frag/modf-pointer-function-analysis.frag b/third_party/spirv-cross/shaders/frag/modf-pointer-function-analysis.frag new file mode 100644 index 0000000000..21e51262f0 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/modf-pointer-function-analysis.frag @@ -0,0 +1,25 @@ +#version 450 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec4 vo0; +layout(location = 1) out vec4 vo1; + +vec4 modf_inner(out vec4 tmp) +{ + return modf(v, tmp); +} + +float modf_inner_partial(inout vec4 tmp) +{ + return modf(v.x, tmp.x); +} + +void main() +{ + vec4 tmp; + vo0 = modf_inner(tmp); + vo1 = tmp; + + vo0.x += modf_inner_partial(tmp); + vo1.x += tmp.x; +} diff --git a/third_party/spirv-cross/shaders/frag/partial-write-preserve.frag b/third_party/spirv-cross/shaders/frag/partial-write-preserve.frag new file mode 100644 index 0000000000..227df95086 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/partial-write-preserve.frag @@ -0,0 +1,95 @@ +#version 310 es +precision mediump float; + +layout(std140, binding = 0) uniform UBO +{ + int some_value; +}; + +struct B +{ + float a; + float b; +}; + +void partial_inout(inout vec4 x) +{ + x.x = 10.0; +} + +void partial_inout(inout B b) +{ + b.b = 40.0; +} + +// Make a complete write, but only conditionally ... +void branchy_inout(inout vec4 v) +{ + v.y = 20.0; + if (some_value == 20) + { + v = vec4(50.0); + } +} + +void branchy_inout(inout B b) +{ + b.b = 20.0; + if (some_value == 20) + { + b = B(10.0, 40.0); + } +} + +void branchy_inout_2(out vec4 v) +{ + if (some_value == 20) + { + v = vec4(50.0); + } + else + { + v = vec4(70.0); + } + v.y = 20.0; +} + +void branchy_inout_2(out B b) +{ + if (some_value == 20) + { + b = B(10.0, 40.0); + } + else + { + b = B(70.0, 70.0); + } + b.b = 20.0; +} + + +void complete_inout(out vec4 x) +{ + x = vec4(50.0); +} + +void complete_inout(out B b) +{ + b = B(100.0, 200.0); +} + +void main() +{ + vec4 a = vec4(10.0); + partial_inout(a); + complete_inout(a); + branchy_inout(a); + branchy_inout_2(a); + + B b = B(10.0, 20.0); + partial_inout(b); + complete_inout(b); + branchy_inout(b); + branchy_inout_2(b); +} + diff --git a/third_party/spirv-cross/shaders/frag/pixel-interlock-ordered.frag b/third_party/spirv-cross/shaders/frag/pixel-interlock-ordered.frag new file mode 100644 index 0000000000..4439f0672b --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/pixel-interlock-ordered.frag @@ -0,0 +1,22 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(pixel_interlock_ordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2) coherent buffer Buffer +{ + int foo; + uint bar; +}; + +void main() +{ + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, 0xff); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders/frag/pixel-interlock-unordered.frag b/third_party/spirv-cross/shaders/frag/pixel-interlock-unordered.frag new file mode 100644 index 0000000000..f8fd468c1b --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/pixel-interlock-unordered.frag @@ -0,0 +1,22 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(pixel_interlock_unordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2) coherent buffer Buffer +{ + int foo; + uint bar; +}; + +void main() +{ + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, 0xff); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders/frag/pls.frag b/third_party/spirv-cross/shaders/frag/pls.frag new file mode 100644 index 0000000000..e3863e4e0e --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/pls.frag @@ -0,0 +1,20 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 PLSIn0; +layout(location = 1) in vec4 PLSIn1; +layout(location = 2) in vec4 PLSIn2; +layout(location = 3) in vec4 PLSIn3; + +layout(location = 0) out vec4 PLSOut0; +layout(location = 1) out vec4 PLSOut1; +layout(location = 2) out vec4 PLSOut2; +layout(location = 3) out vec4 PLSOut3; + +void main() +{ + PLSOut0 = 2.0 * PLSIn0; + PLSOut1 = 6.0 * PLSIn1; + PLSOut2 = 7.0 * PLSIn2; + PLSOut3 = 4.0 * PLSIn3; +} diff --git a/third_party/spirv-cross/shaders/frag/post-depth-coverage-es.frag b/third_party/spirv-cross/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 0000000000..ecc57e4a8f --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; + +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SampleMaskIn[0]); +} diff --git a/third_party/spirv-cross/shaders/frag/post-depth-coverage.frag b/third_party/spirv-cross/shaders/frag/post-depth-coverage.frag new file mode 100644 index 0000000000..4f134b4f3b --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/post-depth-coverage.frag @@ -0,0 +1,11 @@ +#version 450 +#extension GL_ARB_post_depth_coverage : require + +layout(post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SampleMaskIn[0]); +} diff --git a/third_party/spirv-cross/shaders/frag/round-even.frag b/third_party/spirv-cross/shaders/frag/round-even.frag new file mode 100644 index 0000000000..594ac16293 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/round-even.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = roundEven(vA); + FragColor *= roundEven(vB); +} diff --git a/third_party/spirv-cross/shaders/frag/round.frag b/third_party/spirv-cross/shaders/frag/round.frag new file mode 100644 index 0000000000..c87b0abbff --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/round.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = round(vA); + FragColor *= round(vB); +} diff --git a/third_party/spirv-cross/shaders/frag/sample-interlock-ordered.frag b/third_party/spirv-cross/shaders/frag/sample-interlock-ordered.frag new file mode 100644 index 0000000000..fa80dc9f82 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sample-interlock-ordered.frag @@ -0,0 +1,22 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(sample_interlock_ordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2) coherent buffer Buffer +{ + int foo; + uint bar; +}; + +void main() +{ + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, gl_SampleMaskIn[0]); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders/frag/sample-interlock-unordered.frag b/third_party/spirv-cross/shaders/frag/sample-interlock-unordered.frag new file mode 100644 index 0000000000..6fe5437f3a --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sample-interlock-unordered.frag @@ -0,0 +1,22 @@ +#version 450 +#extension GL_ARB_fragment_shader_interlock : require + +layout(sample_interlock_unordered) in; + +layout(binding = 0, rgba8) uniform writeonly image2D img; +layout(binding = 1, r32ui) uniform uimage2D img2; +layout(binding = 2) coherent buffer Buffer +{ + int foo; + uint bar; +}; + +void main() +{ + beginInvocationInterlockARB(); + imageStore(img, ivec2(0, 0), vec4(1.0, 0.0, 0.0, 1.0)); + imageAtomicAdd(img2, ivec2(0, 0), 1u); + foo += 42; + atomicAnd(bar, 0xff); + endInvocationInterlockARB(); +} diff --git a/third_party/spirv-cross/shaders/frag/sample-parameter.frag b/third_party/spirv-cross/shaders/frag/sample-parameter.frag new file mode 100644 index 0000000000..8470bfd672 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sample-parameter.frag @@ -0,0 +1,11 @@ +#version 310 es +#extension GL_OES_sample_variables : require +precision mediump float; + +layout(location = 0) out vec2 FragColor; + +void main() +{ + FragColor = gl_SamplePosition + vec2(gl_SampleMaskIn[0]) + float(gl_SampleID); + gl_SampleMask[0] = 1; +} diff --git a/third_party/spirv-cross/shaders/frag/sampler-ms.frag b/third_party/spirv-cross/shaders/frag/sampler-ms.frag new file mode 100644 index 0000000000..6593928271 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sampler-ms.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(binding = 0) uniform mediump sampler2DMS uSampler; +layout(location = 0) out vec4 FragColor; + +void main() +{ + ivec2 coord = ivec2(gl_FragCoord.xy); + FragColor = + texelFetch(uSampler, coord, 0) + + texelFetch(uSampler, coord, 1) + + texelFetch(uSampler, coord, 2) + + texelFetch(uSampler, coord, 3); +} diff --git a/third_party/spirv-cross/shaders/frag/sampler-proj.frag b/third_party/spirv-cross/shaders/frag/sampler-proj.frag new file mode 100644 index 0000000000..21fa5c0260 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sampler-proj.frag @@ -0,0 +1,12 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureProj(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders/frag/sampler.frag b/third_party/spirv-cross/shaders/frag/sampler.frag new file mode 100644 index 0000000000..e38f76886a --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/sampler.frag @@ -0,0 +1,18 @@ +#version 310 es +precision mediump float; + +layout(location = 0) in vec4 vColor; +layout(location = 1) in vec2 vTex; +layout(binding = 0) uniform sampler2D uTex; +layout(location = 0) out vec4 FragColor; + +vec4 sample_texture(sampler2D tex, vec2 uv) +{ + return texture(tex, uv); +} + +void main() +{ + FragColor = vColor * sample_texture(uTex, vTex); +} + diff --git a/third_party/spirv-cross/shaders/frag/scalar-refract-reflect.frag b/third_party/spirv-cross/shaders/frag/scalar-refract-reflect.frag new file mode 100644 index 0000000000..486ed90bd5 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/scalar-refract-reflect.frag @@ -0,0 +1,11 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(location = 0) in vec3 vRefract; + +void main() +{ + FragColor = refract(vRefract.x, vRefract.y, vRefract.z); + FragColor += reflect(vRefract.x, vRefract.y); + FragColor += refract(vRefract.xy, vRefract.yz, vRefract.z).y; + FragColor += reflect(vRefract.xy, vRefract.zy).y; +} diff --git a/third_party/spirv-cross/shaders/frag/selection-block-dominator.frag b/third_party/spirv-cross/shaders/frag/selection-block-dominator.frag new file mode 100644 index 0000000000..257f4e6934 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/selection-block-dominator.frag @@ -0,0 +1,18 @@ +#version 450 +layout(location = 0) out vec4 FragColor; +layout(location = 0) flat in int vIndex; + +void main() +{ + int v; + if (vIndex != 1) + { + FragColor = vec4(1.0); + return; + } + else + { + v = 10; + } + FragColor = vec4(v); +} diff --git a/third_party/spirv-cross/shaders/frag/shader-clock.frag b/third_party/spirv-cross/shaders/frag/shader-clock.frag new file mode 100644 index 0000000000..fb8b0d5fd5 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/shader-clock.frag @@ -0,0 +1,17 @@ +#version 450 + +#extension GL_EXT_shader_realtime_clock : enable +#extension GL_EXT_shader_explicit_arithmetic_types_int64 : enable + +#extension GL_ARB_shader_clock : enable +#extension GL_ARB_gpu_shader_int64 : enable + +void main() { + // GL_EXT_shader_explicit_arithmetic_types_int64 + uvec2 a = clockRealtime2x32EXT(); + uint64_t b = clockRealtimeEXT(); + + // GL_ARB_shader_clock + uvec2 c = clock2x32ARB(); + uint64_t d = clockARB(); +} diff --git a/third_party/spirv-cross/shaders/frag/struct-type-unrelated-alias.frag b/third_party/spirv-cross/shaders/frag/struct-type-unrelated-alias.frag new file mode 100644 index 0000000000..d1c7905225 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/struct-type-unrelated-alias.frag @@ -0,0 +1,19 @@ +#version 450 + +layout(location = 0) out float FragColor; + +struct T +{ + float a; +}; + +void main() +{ + T foo; + struct T { float b; }; + T bar; + + foo.a = 10.0; + bar.b = 20.0; + FragColor = foo.a + bar.b; +} diff --git a/third_party/spirv-cross/shaders/frag/switch-unreachable-break.frag b/third_party/spirv-cross/shaders/frag/switch-unreachable-break.frag new file mode 100644 index 0000000000..b0421e60ef --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/switch-unreachable-break.frag @@ -0,0 +1,32 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vInput; + +layout(set = 0, binding = 0) uniform UBO +{ + int cond; + int cond2; +}; + +void main() +{ + bool frog = false; + switch (cond) + { + case 1: + if (cond2 < 50) + break; + else + discard; + + break; + + default: + frog = true; + break; + } + + FragColor = frog ? vec4(10.0) : vec4(20.0); +} + diff --git a/third_party/spirv-cross/shaders/frag/switch-unsigned-case.frag b/third_party/spirv-cross/shaders/frag/switch-unsigned-case.frag new file mode 100644 index 0000000000..d8aee43a6c --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/switch-unsigned-case.frag @@ -0,0 +1,26 @@ +#version 310 es +precision mediump float; + +#define ENUM_0 0u +#define ENUM_1 1u + +layout(set = 0, binding = 0) uniform Buff +{ + uint TestVal; +}; + +layout(location = 0) out vec4 fsout_Color; + +void main() +{ + fsout_Color = vec4(1.0); + switch (TestVal) + { + case ENUM_0: + fsout_Color = vec4(0.1); + break; + case ENUM_1: + fsout_Color = vec4(0.2); + break; + } +} diff --git a/third_party/spirv-cross/shaders/frag/swizzle.frag b/third_party/spirv-cross/shaders/frag/swizzle.frag new file mode 100644 index 0000000000..af22dd655d --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/swizzle.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +layout(binding = 0) uniform sampler2D samp; +layout(location = 0) out vec4 FragColor; +layout(location = 1) in vec3 vNormal; +layout(location = 2) in vec2 vUV; + +void main() +{ + FragColor = vec4(texture(samp, vUV).xyz, 1.0); + FragColor = vec4(texture(samp, vUV).xz, 1.0, 4.0); + FragColor = vec4(texture(samp, vUV).xx, texture(samp, vUV + vec2(0.1)).yy); + FragColor = vec4(vNormal, 1.0); + FragColor = vec4(vNormal + 1.8, 1.0); + FragColor = vec4(vUV, vUV + 1.8); +} diff --git a/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag b/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag new file mode 100644 index 0000000000..e98748b8bc --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/texel-fetch-offset.frag @@ -0,0 +1,10 @@ +#version 310 es +precision mediump float; +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uTexture; + +void main() +{ + FragColor = texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(1, 1)); + FragColor += texelFetchOffset(uTexture, ivec2(gl_FragCoord.xy), 0, ivec2(-1, 1)); +} diff --git a/third_party/spirv-cross/shaders/frag/ubo-load-row-major-workaround.frag b/third_party/spirv-cross/shaders/frag/ubo-load-row-major-workaround.frag new file mode 100644 index 0000000000..03205ee827 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/ubo-load-row-major-workaround.frag @@ -0,0 +1,44 @@ +#version 450 + +struct RowMajor +{ + mat4 B; +}; + +struct NestedRowMajor +{ + RowMajor rm; +}; + +layout(set = 0, binding = 0, row_major) uniform UBO +{ + mat4 A; + layout(column_major) mat4 C; // This should also be worked around. +}; + + +layout(set = 0, binding = 1, row_major) uniform UBO2 +{ + RowMajor rm; +}; + +layout(set = 0, binding = 2, row_major) uniform UBO3 +{ + NestedRowMajor rm2; +}; + +layout(set = 0, binding = 3) uniform UBONoWorkaround +{ + mat4 D; +}; + +layout(location = 0) in vec4 Clip; +layout(location = 0) out vec4 FragColor; + +void main() +{ + NestedRowMajor rm2_loaded = rm2; + FragColor = rm2_loaded.rm.B * rm.B * A * C * Clip; + FragColor += D * Clip; + FragColor += A[1] * Clip; +} diff --git a/third_party/spirv-cross/shaders/frag/ubo_layout.frag b/third_party/spirv-cross/shaders/frag/ubo_layout.frag new file mode 100644 index 0000000000..80f9f16d3d --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/ubo_layout.frag @@ -0,0 +1,24 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; + +struct Str +{ + mat4 foo; +}; + +layout(binding = 0, std140) uniform UBO1 +{ + layout(row_major) Str foo; +} ubo1; + +layout(binding = 1, std140) uniform UBO2 +{ + layout(column_major) Str foo; +} ubo0; + +void main() +{ + FragColor = ubo1.foo.foo[0] + ubo0.foo.foo[0]; +} diff --git a/third_party/spirv-cross/shaders/frag/unary-enclose.frag b/third_party/spirv-cross/shaders/frag/unary-enclose.frag new file mode 100644 index 0000000000..ea502e1de8 --- /dev/null +++ b/third_party/spirv-cross/shaders/frag/unary-enclose.frag @@ -0,0 +1,15 @@ +#version 310 es +precision mediump float; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec4 vIn; +layout(location = 1) flat in ivec4 vIn1; + +void main() +{ + FragColor = +(-(-vIn)); + ivec4 a = ~(~vIn1); + + bool b = false; + b = !!b; +} diff --git a/third_party/spirv-cross/shaders/geom/basic.geom b/third_party/spirv-cross/shaders/geom/basic.geom new file mode 100644 index 0000000000..80b977d114 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/basic.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(triangles, invocations = 4) in; +layout(triangle_strip, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal + float(gl_InvocationID); + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal + 4.0 * float(gl_InvocationID); + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal + 2.0 * float(gl_InvocationID); + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/geometry-passthrough.geom b/third_party/spirv-cross/shaders/geom/geometry-passthrough.geom new file mode 100644 index 0000000000..7f1997c76a --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/geometry-passthrough.geom @@ -0,0 +1,28 @@ +#version 450 +#extension GL_NV_geometry_shader_passthrough : require + +layout(triangles) in; + +layout(passthrough) in gl_PerVertex +{ + vec4 gl_Position; +} gl_in[]; + +layout(passthrough, location = 0) in VertexBlock +{ + int a; + int b; +} v1[]; + +layout(location = 2) in VertexBlock2 +{ + int a; + layout(passthrough) int b; +} v2[]; + +layout(passthrough, location = 4) in vec4 vPoint[]; + +void main() +{ + gl_Layer = gl_InvocationID + v1[0].a + v2[1].b; +} diff --git a/third_party/spirv-cross/shaders/geom/lines-adjacency.geom b/third_party/spirv-cross/shaders/geom/lines-adjacency.geom new file mode 100644 index 0000000000..4c34440737 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/lines-adjacency.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(lines_adjacency) in; +layout(line_strip, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/lines.geom b/third_party/spirv-cross/shaders/geom/lines.geom new file mode 100644 index 0000000000..c751d5cda4 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/lines.geom @@ -0,0 +1,24 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(lines) in; +layout(line_strip, max_vertices = 2) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/multi-stream.geom b/third_party/spirv-cross/shaders/geom/multi-stream.geom new file mode 100644 index 0000000000..19b3bbb9c2 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/multi-stream.geom @@ -0,0 +1,15 @@ +#version 450 + +layout(triangles) in; +layout(points, max_vertices = 2) out; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + EmitStreamVertex(0); + EndStreamPrimitive(0); + gl_Position = gl_in[0].gl_Position + 2; + EmitStreamVertex(1); + EndStreamPrimitive(1); +} + diff --git a/third_party/spirv-cross/shaders/geom/points.geom b/third_party/spirv-cross/shaders/geom/points.geom new file mode 100644 index 0000000000..f7dce10d7f --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/points.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(points) in; +layout(points, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/single-invocation.geom b/third_party/spirv-cross/shaders/geom/single-invocation.geom new file mode 100644 index 0000000000..c3c8d1526f --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/single-invocation.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/transform-feedback-streams.geom b/third_party/spirv-cross/shaders/geom/transform-feedback-streams.geom new file mode 100644 index 0000000000..1e62890756 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/transform-feedback-streams.geom @@ -0,0 +1,24 @@ +#version 450 +layout(max_vertices = 2, points) out; +layout(points) in; +layout(stream = 1, xfb_stride = 32, xfb_offset = 16, xfb_buffer = 2, location = 0) out vec4 vFoo; + +layout(stream = 1, xfb_buffer = 1, xfb_stride = 20) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(stream = 2, xfb_buffer = 3) out VertOut +{ + layout(xfb_stride = 16, xfb_offset = 0, location = 1) vec4 vBar; +}; + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + EmitStreamVertex(1); + vBar = vec4(5.0); + EmitStreamVertex(2); +} diff --git a/third_party/spirv-cross/shaders/geom/triangles-adjacency.geom b/third_party/spirv-cross/shaders/geom/triangles-adjacency.geom new file mode 100644 index 0000000000..017cef7b52 --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/triangles-adjacency.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(triangles_adjacency) in; +layout(triangle_strip, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/geom/triangles.geom b/third_party/spirv-cross/shaders/geom/triangles.geom new file mode 100644 index 0000000000..c3c8d1526f --- /dev/null +++ b/third_party/spirv-cross/shaders/geom/triangles.geom @@ -0,0 +1,28 @@ +#version 310 es +#extension GL_EXT_geometry_shader : require + +layout(triangles) in; +layout(triangle_strip, max_vertices = 3) out; + +layout(location = 0) in VertexData { + vec3 normal; +} vin[]; + +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = gl_in[0].gl_Position; + vNormal = vin[0].normal; + EmitVertex(); + + gl_Position = gl_in[1].gl_Position; + vNormal = vin[1].normal; + EmitVertex(); + + gl_Position = gl_in[2].gl_Position; + vNormal = vin[2].normal; + EmitVertex(); + + EndPrimitive(); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.frag new file mode 100644 index 0000000000..abe1ef2c30 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.frag @@ -0,0 +1,12 @@ +#version 310 es + +precision mediump float; + +layout(binding = 0) uniform sampler2D tex; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureLod(tex, vec2(0.4, 0.6), 0.0); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.vert b/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.vert new file mode 100644 index 0000000000..d2cbd5a4f9 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/explicit-lod.legacy.vert @@ -0,0 +1,12 @@ +#version 310 es + +precision mediump float; + +layout(binding = 0) uniform sampler2D tex; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = textureLod(tex, vec2(0.4, 0.6), 3.0); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/fma.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/fma.legacy.frag new file mode 100644 index 0000000000..d6da7c7f22 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/fma.legacy.frag @@ -0,0 +1,12 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = fma(vA, vB, vC); + FragColor = fma(vA, vB, vC) * fma(vB, vC, vA); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/hyperbolic.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/hyperbolic.legacy.frag new file mode 100644 index 0000000000..a52a3eeb0a --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/hyperbolic.legacy.frag @@ -0,0 +1,26 @@ +#version 450 + +layout(location=0) in float scalar; +layout(location=1) in vec3 vector; + +layout(location=0) out vec4 result; + +void main() { + result = vec4(1.0); + + result.w *= sinh(scalar); + result.w *= cosh(scalar); + result.w *= tanh(scalar); + + result.w *= asinh(scalar); + result.w *= acosh(scalar); + result.w *= atanh(scalar); + + result.xyz *= sinh(vector); + result.xyz *= cosh(vector); + result.xyz *= tanh(vector); + + result.xyz *= asinh(vector); + result.xyz *= acosh(vector); + result.xyz *= atanh(vector); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/io-blocks.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/io-blocks.legacy.frag new file mode 100644 index 0000000000..0a151dc2d6 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/io-blocks.legacy.frag @@ -0,0 +1,16 @@ +#version 310 es +#extension GL_EXT_shader_io_blocks : require +precision mediump float; + +layout(location = 1) in VertexOut +{ + vec4 color; + highp vec3 normal; +} vin; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vin.color + vin.normal.xyzz; +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/isnan-isinf.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/isnan-isinf.legacy.frag new file mode 100644 index 0000000000..a545ae3b9f --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/isnan-isinf.legacy.frag @@ -0,0 +1,14 @@ +#version 450 + +layout(location=0) in float scalar; +layout(location=1) in vec4 vector; + +layout(location=0) out vec4 result; + +void main() { + result = vec4(0.0); + if (isnan(scalar)) result.r = 1.0; + if (isinf(scalar)) result.g = 1.0; + if (any(isnan(vector))) result.b = 1.0; + if (any(isinf(vector))) result.a = 1.0; +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/modf.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/modf.legacy.frag new file mode 100644 index 0000000000..5472d029bf --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/modf.legacy.frag @@ -0,0 +1,16 @@ +#version 450 + +layout(location=0) in float scalar; +layout(location=1) in vec2 vector; + +layout(location=0) out vec4 result; + +void main() { + float sipart; + float sfpart = modf(scalar, sipart); + result.xy = vec2(sipart, sfpart); + + vec2 vipart; + vec2 vfpart = modf(vector, vipart); + result.zw = vfpart; +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag new file mode 100644 index 0000000000..b1e7d1b4f3 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/multiple-struct-flattening.legacy.frag @@ -0,0 +1,37 @@ +#version 450 + +struct Foo +{ + vec4 a; + vec4 b; +}; + +struct Bar +{ + vec4 a; + vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +layout(location = 0) in VertexIn +{ + Foo a; + Bar b; +}; + +layout(location = 4) in Baz baz; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + Baz bazzy = baz; + Foo bazzy_foo = baz.foo; + Bar bazzy_bar = baz.bar; + FragColor = a.a + b.b + bazzy.foo.b + bazzy_foo.a + bazzy_bar.b; +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/round.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/round.legacy.frag new file mode 100644 index 0000000000..c87b0abbff --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/round.legacy.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in float vB; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = round(vA); + FragColor *= round(vB); +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/struct-varying.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/struct-varying.legacy.frag new file mode 100644 index 0000000000..5df5c87704 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/struct-varying.legacy.frag @@ -0,0 +1,25 @@ +#version 310 es +precision highp float; + +struct Inputs +{ + vec4 a; + vec2 b; +}; + +layout(location = 0) in Inputs vin; +layout(location = 0) out vec4 FragColor; + +void main() +{ + // Read struct once. + Inputs v0 = vin; + // Read struct again. + Inputs v1 = vin; + + // Read members individually. + vec4 a = vin.a; + vec4 b = vin.b.xxyy; + + FragColor = v0.a + v0.b.xxyy + v1.a + v1.b.yyxx + a + b; +} diff --git a/third_party/spirv-cross/shaders/legacy/fragment/switch.legacy.frag b/third_party/spirv-cross/shaders/legacy/fragment/switch.legacy.frag new file mode 100644 index 0000000000..d511798173 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/fragment/switch.legacy.frag @@ -0,0 +1,43 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in float vIndexF; + +void main() +{ + int vIndex = int(vIndexF); + vec4 v = vec4(0.0); + switch (vIndex) + { + case 2: + v = vec4(0, 2, 3, 4); + break; + case 4: + case 5: + v = vec4(1, 2, 3, 4); + break; + case 8: + case 9: + v = vec4(40, 20, 30, 40); + break; + case 10: + v = vec4(10.0); + case 11: + v += 1.0; + case 12: + v += 2.0; + break; + default: + v = vec4(10, 20, 30, 40); + break; + } + + vec4 w = vec4(20.0); + switch (vIndex) + { + case 10: + case 20: + w = vec4(40.0); + } + FragColor = v + w; +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/implicit-lod.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/implicit-lod.legacy.vert new file mode 100644 index 0000000000..6065694274 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/implicit-lod.legacy.vert @@ -0,0 +1,8 @@ +#version 310 es + +layout(binding = 0) uniform sampler2D tex; + +void main() +{ + gl_Position = texture(tex, vec2(0.4, 0.6)); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/int-attribute.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/int-attribute.legacy.vert new file mode 100644 index 0000000000..6f88febfb9 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/int-attribute.legacy.vert @@ -0,0 +1,10 @@ +#version 310 es + +layout(location=0) in ivec4 attr_int4; +layout(location=1) in int attr_int1; + +void main() +{ + gl_Position.x = float(attr_int4[attr_int1]); + gl_Position.yzw = vec3(0.0f, 0.0f, 0.0f); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/inverse.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/inverse.legacy.vert new file mode 100644 index 0000000000..3730241ed1 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/inverse.legacy.vert @@ -0,0 +1,39 @@ +#version 310 es + +uniform Buffer +{ + mat2 m2; + mat3 m3; + mat4 m4; + mediump mat2 m2r; + mediump mat3 m3r; + mediump mat4 m4r; +}; + +layout(location = 0) in vec4 Position; + +layout(location = 0) out vec3 dets; +layout(location = 1) out mat2 o2; +layout(location = 3) out mat3 o3; +layout(location = 6) out mat4 o4; +layout(location = 10) out mat2 o2r; +layout(location = 12) out mat3 o3r; +layout(location = 15) out mat4 o4r; + +void main() +{ + dets.x = determinant(m2); + dets.y = determinant(m3); + dets.z = determinant(m4); + + o2 = inverse(m2); + o3 = inverse(m3); + o4 = inverse(m4); + + o2r = inverse(m2r); + o3r = inverse(m3r); + o4r = inverse(m4r); + + gl_Position = vec4(0.0); +} + diff --git a/third_party/spirv-cross/shaders/legacy/vert/io-block.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/io-block.legacy.vert new file mode 100644 index 0000000000..4fbc9347cf --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/io-block.legacy.vert @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_shader_io_blocks : require + +layout(location = 0) out VertexOut +{ + vec4 color; + vec3 normal; +} vout; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = Position; + vout.color = vec4(1.0); + vout.normal = vec3(0.5); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/outer-product.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/outer-product.legacy.vert new file mode 100644 index 0000000000..e8c2b55d9b --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/outer-product.legacy.vert @@ -0,0 +1,19 @@ +#version 450 + +layout(location = 0) in vec2 v2a; +layout(location = 1) in vec2 v2b; +layout(location = 2) in vec3 v3a; +layout(location = 3) in vec3 v3b; +layout(location = 4) in vec4 v4a; +layout(location = 5) in vec4 v4b; + +layout(location = 0) out mat2 m22; +layout(location = 2) out mat3 m33; +layout(location = 5) out mat4 m44; + +void main() +{ + m22 = outerProduct(v2a, v2b); + m33 = outerProduct(v3a, v3b); + m44 = outerProduct(v4a, v4b); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert new file mode 100644 index 0000000000..f6ad932eea --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-inner-array.legacy.vert @@ -0,0 +1,15 @@ +#version 450 + +struct Foo +{ + float a[4]; +}; + +layout(location = 0) out Foo foo; + +void main() +{ + gl_Position = vec4(1.0); + for (int i = 0; i < 4; i++) + foo.a[i] = float(i + 2); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert new file mode 100644 index 0000000000..57e914c1fe --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/struct-flatten-stores-multi-dimension.legacy.vert @@ -0,0 +1,40 @@ +#version 450 + +struct Foo +{ + vec4 a; + vec4 b; +}; + +struct Bar +{ + vec4 a; + vec4 b; +}; + +struct Baz +{ + Foo foo; + Bar bar; +}; + +layout(location = 0) out VertexIn +{ + Foo a; + Bar b; +}; + +layout(location = 4) out Baz baz; + +void main() +{ + a.a = vec4(10.0); + a.b = vec4(20.0); + b.a = vec4(30.0); + b.b = vec4(40.0); + a = Foo(vec4(50.0), vec4(60.0)); + b = Bar(vec4(50.0), vec4(60.0)); + baz.foo = Foo(vec4(100.0), vec4(200.0)); + baz.bar = Bar(vec4(300.0), vec4(400.0)); + baz = Baz(Foo(vec4(1000.0), vec4(2000.0)), Bar(vec4(3000.0), vec4(4000.0))); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/struct-varying.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/struct-varying.legacy.vert new file mode 100644 index 0000000000..3f491be831 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/struct-varying.legacy.vert @@ -0,0 +1,33 @@ +#version 310 es + +struct Output +{ + vec4 a; + vec2 b; +}; + +layout(location = 0) out Output vout; + +void main() +{ + Output s = Output(vec4(0.5), vec2(0.25)); + + // Write whole struct. + vout = s; + // Write whole struct again, checks for scoping. + vout = s; + + // Read it back. + Output tmp = vout; + + // Write elements individually. + vout.a = tmp.a; + vout.b = tmp.b; + + // Write individual elements. + vout.a.x = 1.0; + vout.b.y = 1.0; + + // Read individual elements. + float c = vout.a.x; +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/switch-nested.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/switch-nested.legacy.vert new file mode 100644 index 0000000000..6726c1c693 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/switch-nested.legacy.vert @@ -0,0 +1,28 @@ +#version 450 + +layout(set = 0, binding = 0) uniform UBO +{ + int func_arg; + int inner_func_arg; +}; + +vec4 test_inner_func(bool b) +{ + if (b) + return vec4(1.0); + else + return vec4(0.0); +} + +vec4 test_func(bool b) +{ + if (b) + return test_inner_func(inner_func_arg != 0); + else + return vec4(0.0); +} + +void main() +{ + gl_Position = test_func(func_arg != 0); +} diff --git a/third_party/spirv-cross/shaders/legacy/vert/transpose.legacy.vert b/third_party/spirv-cross/shaders/legacy/vert/transpose.legacy.vert new file mode 100644 index 0000000000..548a5e9818 --- /dev/null +++ b/third_party/spirv-cross/shaders/legacy/vert/transpose.legacy.vert @@ -0,0 +1,54 @@ +#version 310 es + +uniform Buffer +{ + layout(row_major) mat4 MVPRowMajor; + layout(column_major) mat4 MVPColMajor; + mat4 M; + mediump mat4 MRelaxed; +}; + +layout(location = 0) in vec4 Position; + +layout(location = 1) out mat4 OutputMat1; +layout(location = 5) out mat4 OutputMat2; +layout(location = 9) out mat4 OutputMat3; +layout(location = 13) out mat4 OutputMat4; +layout(location = 17) out highp mat4 OutputMat5; +layout(location = 21) out highp mat4 OutputMat6; +layout(location = 25) out mediump mat4 OutputMat7; +layout(location = 29) out mediump mat4 OutputMat8; + +void main() +{ + vec4 c0 = M * (MVPRowMajor * Position); + vec4 c1 = M * (MVPColMajor * Position); + vec4 c2 = M * (Position * MVPRowMajor); + vec4 c3 = M * (Position * MVPColMajor); + + vec4 c4 = transpose(MVPRowMajor) * Position; + vec4 c5 = transpose(MVPColMajor) * Position; + vec4 c6 = Position * transpose(MVPRowMajor); + vec4 c7 = Position * transpose(MVPColMajor); + + // Multiplying by scalar does not affect transposition + vec4 c8 = (MVPRowMajor * 2.0) * Position; + vec4 c9 = (transpose(MVPColMajor) * 2.0) * Position; + vec4 c10 = Position * (MVPRowMajor * 2.0); + vec4 c11 = Position * (transpose(MVPColMajor) * 2.0); + + // Outputting a matrix will trigger an actual transposition + OutputMat1 = MVPRowMajor; + OutputMat2 = MVPColMajor; + OutputMat3 = transpose(MVPRowMajor); + OutputMat4 = transpose(MVPColMajor); + + // Preserve precision of input, ignore precision of output + OutputMat5 = transpose(M); + OutputMat6 = transpose(MRelaxed); + OutputMat7 = transpose(M); + OutputMat8 = transpose(MRelaxed); + + gl_Position = c0 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11; +} + diff --git a/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..0f1beef75b --- /dev/null +++ b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-lines.spv14.vk.nocompat.mesh @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(lines, max_vertices = 24, max_primitives = 22) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +layout(location = 0) out vec4 vOut[]; +layout(location = 1) perprimitiveEXT out vec4 vPrim[]; + +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[]; + +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[]; + +shared float shared_float[16]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main() +{ + SetMeshOutputsEXT(24, 22); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(gl_GlobalInvocationID, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22) + { + vPrim[gl_LocalInvocationIndex] = vec4(gl_WorkGroupID, 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveLineIndicesEXT[gl_LocalInvocationIndex] = uvec2(0, 1) + gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = bool(gl_GlobalInvocationID.x & 1); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} diff --git a/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..3d037bcd5e --- /dev/null +++ b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-points.spv14.vk.nocompat.mesh @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(points, max_vertices = 24, max_primitives = 22) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +layout(location = 0) out vec4 vOut[]; +layout(location = 1) perprimitiveEXT out vec4 vPrim[]; + +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[]; + +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[]; + +shared float shared_float[16]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main() +{ + SetMeshOutputsEXT(24, 22); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(gl_GlobalInvocationID, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22) + { + vPrim[gl_LocalInvocationIndex] = vec4(gl_WorkGroupID, 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitivePointIndicesEXT[gl_LocalInvocationIndex] = gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = bool(gl_GlobalInvocationID.x & 1); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} diff --git a/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh new file mode 100644 index 0000000000..944525aa50 --- /dev/null +++ b/third_party/spirv-cross/shaders/mesh/mesh-shader-basic-triangle.spv14.vk.nocompat.mesh @@ -0,0 +1,63 @@ +#version 450 +#extension GL_EXT_mesh_shader : require +layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; +layout(triangles, max_vertices = 24, max_primitives = 22) out; + +out gl_MeshPerVertexEXT +{ + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[1]; + float gl_CullDistance[2]; +} gl_MeshVerticesEXT[]; + +layout(location = 0) out vec4 vOut[]; +layout(location = 1) perprimitiveEXT out vec4 vPrim[]; + +layout(location = 2) out BlockOut +{ + vec4 a; + vec4 b; +} outputs[]; + +layout(location = 4) perprimitiveEXT out BlockOutPrim +{ + vec4 a; + vec4 b; +} prim_outputs[]; + +shared float shared_float[16]; + +struct TaskPayload +{ + float a; + float b; + int c; +}; + +taskPayloadSharedEXT TaskPayload payload; + +void main() +{ + SetMeshOutputsEXT(24, 22); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_PointSize = 2.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; + vOut[gl_LocalInvocationIndex] = vec4(gl_GlobalInvocationID, 2.0); + outputs[gl_LocalInvocationIndex].a = vec4(5.0); + outputs[gl_LocalInvocationIndex].b = vec4(6.0); + barrier(); + if (gl_LocalInvocationIndex < 22) + { + vPrim[gl_LocalInvocationIndex] = vec4(gl_WorkGroupID, 3.0); + prim_outputs[gl_LocalInvocationIndex].a = vec4(payload.a); + prim_outputs[gl_LocalInvocationIndex].b = vec4(payload.b); + gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0, 1, 2) + gl_LocalInvocationIndex; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_GlobalInvocationID.x); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_Layer = int(gl_GlobalInvocationID.x) + 1; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_ViewportIndex = int(gl_GlobalInvocationID.x) + 2; + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = bool(gl_GlobalInvocationID.x & 1); + gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveShadingRateEXT = int(gl_GlobalInvocationID.x) + 3; + } +} diff --git a/third_party/spirv-cross/shaders/tesc/basic.tesc b/third_party/spirv-cross/shaders/tesc/basic.tesc new file mode 100644 index 0000000000..0a41f98c83 --- /dev/null +++ b/third_party/spirv-cross/shaders/tesc/basic.tesc @@ -0,0 +1,17 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(location = 0) patch out vec3 vFoo; + +layout(vertices = 1) out; + +void main() +{ + gl_TessLevelInner[0] = 8.9; + gl_TessLevelInner[1] = 6.9; + gl_TessLevelOuter[0] = 8.9; + gl_TessLevelOuter[1] = 6.9; + gl_TessLevelOuter[2] = 3.9; + gl_TessLevelOuter[3] = 4.9; + vFoo = vec3(1.0); +} diff --git a/third_party/spirv-cross/shaders/tesc/water_tess.tesc b/third_party/spirv-cross/shaders/tesc/water_tess.tesc new file mode 100644 index 0000000000..3ecdc3d1a9 --- /dev/null +++ b/third_party/spirv-cross/shaders/tesc/water_tess.tesc @@ -0,0 +1,115 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(vertices = 1) out; +layout(location = 0) in vec2 vPatchPosBase[]; + +layout(std140) uniform UBO +{ + vec4 uScale; + highp vec3 uCamPos; + vec2 uPatchSize; + vec2 uMaxTessLevel; + float uDistanceMod; + vec4 uFrustum[6]; +}; + +layout(location = 1) patch out vec2 vOutPatchPosBase; +layout(location = 2) patch out vec4 vPatchLods; + +float lod_factor(vec2 pos_) +{ + vec2 pos = pos_ * uScale.xy; + vec3 dist_to_cam = uCamPos - vec3(pos.x, 0.0, pos.y); + float level = log2((length(dist_to_cam) + 0.0001) * uDistanceMod); + return clamp(level, 0.0, uMaxTessLevel.x); +} + +float tess_level(float lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +vec4 tess_level(vec4 lod) +{ + return uMaxTessLevel.y * exp2(-lod); +} + +// Guard band for vertex displacement. +#define GUARD_BAND 10.0 +bool frustum_cull(vec2 p0) +{ + vec2 min_xz = (p0 - GUARD_BAND) * uScale.xy; + vec2 max_xz = (p0 + uPatchSize + GUARD_BAND) * uScale.xy; + + vec3 bb_min = vec3(min_xz.x, -GUARD_BAND, min_xz.y); + vec3 bb_max = vec3(max_xz.x, +GUARD_BAND, max_xz.y); + vec3 center = 0.5 * (bb_min + bb_max); + float radius = 0.5 * length(bb_max - bb_min); + + vec3 f0 = vec3( + dot(uFrustum[0], vec4(center, 1.0)), + dot(uFrustum[1], vec4(center, 1.0)), + dot(uFrustum[2], vec4(center, 1.0))); + + vec3 f1 = vec3( + dot(uFrustum[3], vec4(center, 1.0)), + dot(uFrustum[4], vec4(center, 1.0)), + dot(uFrustum[5], vec4(center, 1.0))); + + return !(any(lessThanEqual(f0, vec3(-radius))) || any(lessThanEqual(f1, vec3(-radius)))); +} + +void compute_tess_levels(vec2 p0) +{ + vOutPatchPosBase = p0; + + float l00 = lod_factor(p0 + vec2(-0.5, -0.5) * uPatchSize); + float l10 = lod_factor(p0 + vec2(+0.5, -0.5) * uPatchSize); + float l20 = lod_factor(p0 + vec2(+1.5, -0.5) * uPatchSize); + float l01 = lod_factor(p0 + vec2(-0.5, +0.5) * uPatchSize); + float l11 = lod_factor(p0 + vec2(+0.5, +0.5) * uPatchSize); + float l21 = lod_factor(p0 + vec2(+1.5, +0.5) * uPatchSize); + float l02 = lod_factor(p0 + vec2(-0.5, +1.5) * uPatchSize); + float l12 = lod_factor(p0 + vec2(+0.5, +1.5) * uPatchSize); + float l22 = lod_factor(p0 + vec2(+1.5, +1.5) * uPatchSize); + + vec4 lods = vec4( + dot(vec4(l01, l11, l02, l12), vec4(0.25)), + dot(vec4(l00, l10, l01, l11), vec4(0.25)), + dot(vec4(l10, l20, l11, l21), vec4(0.25)), + dot(vec4(l11, l21, l12, l22), vec4(0.25))); + + vPatchLods = lods; + + vec4 outer_lods = min(lods.xyzw, lods.yzwx); + vec4 levels = tess_level(outer_lods); + gl_TessLevelOuter[0] = levels.x; + gl_TessLevelOuter[1] = levels.y; + gl_TessLevelOuter[2] = levels.z; + gl_TessLevelOuter[3] = levels.w; + + float min_lod = min(min(lods.x, lods.y), min(lods.z, lods.w)); + float inner = tess_level(min(min_lod, l11)); + gl_TessLevelInner[0] = inner; + gl_TessLevelInner[1] = inner; +} + +void main() +{ + vec2 p0 = vPatchPosBase[0]; + if (!frustum_cull(p0)) + { + gl_TessLevelOuter[0] = -1.0; + gl_TessLevelOuter[1] = -1.0; + gl_TessLevelOuter[2] = -1.0; + gl_TessLevelOuter[3] = -1.0; + gl_TessLevelInner[0] = -1.0; + gl_TessLevelInner[1] = -1.0; + } + else + { + compute_tess_levels(p0); + } +} + diff --git a/third_party/spirv-cross/shaders/tese/ccw.tese b/third_party/spirv-cross/shaders/tese/ccw.tese new file mode 100644 index 0000000000..26e9cc698d --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/ccw.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(ccw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/cw.tese b/third_party/spirv-cross/shaders/tese/cw.tese new file mode 100644 index 0000000000..6ce7c2d6d9 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/cw.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/equal.tese b/third_party/spirv-cross/shaders/tese/equal.tese new file mode 100644 index 0000000000..08ab36ec23 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/equal.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, equal_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/fractional_even.tese b/third_party/spirv-cross/shaders/tese/fractional_even.tese new file mode 100644 index 0000000000..6ce7c2d6d9 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/fractional_even.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/fractional_odd.tese b/third_party/spirv-cross/shaders/tese/fractional_odd.tese new file mode 100644 index 0000000000..a15a32926b --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/fractional_odd.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_odd_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/input-array.tese b/third_party/spirv-cross/shaders/tese/input-array.tese new file mode 100644 index 0000000000..f1014ca5cc --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/input-array.tese @@ -0,0 +1,10 @@ +#version 450 + +layout(ccw, quads, fractional_odd_spacing) in; +layout(location = 0) in vec4 Floats[]; +layout(location = 2) in vec4 Floats2[gl_MaxPatchVertices]; + +void main() +{ + gl_Position = Floats[0] * gl_TessCoord.x + Floats2[1] * gl_TessCoord.y; +} diff --git a/third_party/spirv-cross/shaders/tese/line.tese b/third_party/spirv-cross/shaders/tese/line.tese new file mode 100644 index 0000000000..b4237ef559 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/line.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(isolines, point_mode, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/load-array-of-array.tese b/third_party/spirv-cross/shaders/tese/load-array-of-array.tese new file mode 100644 index 0000000000..7383f7086e --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/load-array-of-array.tese @@ -0,0 +1,10 @@ +#version 450 +layout(ccw, quads) in; + +layout(location = 0) in vec4 vTexCoord[][1]; + +void main() +{ + vec4 tmp[gl_MaxPatchVertices][1] = vTexCoord; + gl_Position = tmp[0][0] + tmp[2][0] + tmp[3][0]; +} diff --git a/third_party/spirv-cross/shaders/tese/patch-input-array.tese b/third_party/spirv-cross/shaders/tese/patch-input-array.tese new file mode 100644 index 0000000000..741b2c3b9b --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/patch-input-array.tese @@ -0,0 +1,9 @@ +#version 450 + +layout(quads) in; +layout(location = 0) patch in float P[4]; + +void main() +{ + gl_Position = vec4(P[0], P[1], P[2], P[3]); +} diff --git a/third_party/spirv-cross/shaders/tese/triangle.tese b/third_party/spirv-cross/shaders/tese/triangle.tese new file mode 100644 index 0000000000..6ce7c2d6d9 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/triangle.tese @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require + +layout(cw, triangles, fractional_even_spacing) in; + +void main() +{ + gl_Position = vec4(1.0); +} + diff --git a/third_party/spirv-cross/shaders/tese/water_tess.tese b/third_party/spirv-cross/shaders/tese/water_tess.tese new file mode 100644 index 0000000000..32d6bc9391 --- /dev/null +++ b/third_party/spirv-cross/shaders/tese/water_tess.tese @@ -0,0 +1,65 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +precision highp int; + +layout(cw, quads, fractional_even_spacing) in; + +layout(location = 0) patch in vec2 vOutPatchPosBase; +layout(location = 1) patch in vec4 vPatchLods; + +layout(binding = 1, std140) uniform UBO +{ + mat4 uMVP; + vec4 uScale; + vec2 uInvScale; + vec3 uCamPos; + vec2 uPatchSize; + vec2 uInvHeightmapSize; +}; +layout(binding = 0) uniform mediump sampler2D uHeightmapDisplacement; + +layout(location = 0) highp out vec3 vWorld; +layout(location = 1) highp out vec4 vGradNormalTex; + +vec2 lerp_vertex(vec2 tess_coord) +{ + return vOutPatchPosBase + tess_coord * uPatchSize; +} + +mediump vec2 lod_factor(vec2 tess_coord) +{ + mediump vec2 x = mix(vPatchLods.yx, vPatchLods.zw, tess_coord.x); + mediump float level = mix(x.x, x.y, tess_coord.y); + mediump float floor_level = floor(level); + mediump float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +mediump vec3 sample_height_displacement(vec2 uv, vec2 off, mediump vec2 lod) +{ + return mix( + textureLod(uHeightmapDisplacement, uv + 0.5 * off, lod.x).xyz, + textureLod(uHeightmapDisplacement, uv + 1.0 * off, lod.x + 1.0).xyz, + lod.y); +} + +void main() +{ + vec2 tess_coord = gl_TessCoord.xy; + vec2 pos = lerp_vertex(tess_coord); + mediump vec2 lod = lod_factor(tess_coord); + + vec2 tex = pos * uInvHeightmapSize.xy; + pos *= uScale.xy; + + mediump float delta_mod = exp2(lod.x); + vec2 off = uInvHeightmapSize.xy * delta_mod; + + vGradNormalTex = vec4(tex + 0.5 * uInvHeightmapSize.xy, tex * uScale.zw); + vec3 height_displacement = sample_height_displacement(tex, off, lod); + + pos += height_displacement.yz; + vWorld = vec3(pos.x, height_displacement.x, pos.y); + gl_Position = uMVP * vec4(vWorld, 1.0); +} + diff --git a/third_party/spirv-cross/shaders/vert/basic.vert b/third_party/spirv-cross/shaders/vert/basic.vert new file mode 100644 index 0000000000..2c75d44a43 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/basic.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(std140) uniform UBO +{ + uniform mat4 uMVP; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = uMVP * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders/vert/ground.vert b/third_party/spirv-cross/shaders/vert/ground.vert new file mode 100755 index 0000000000..2deeb5a94b --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/ground.vert @@ -0,0 +1,202 @@ +#version 310 es + +#define YFLIP 0 +#define SPECULAR 0 +#define GLOSSMAP 0 + +#define DEBUG_NONE 0 +#define DEBUG_DIFFUSE 1 +#define DEBUG_SPECULAR 2 +#define DEBUG_LIGHTING 3 +#define DEBUG_FOG 4 +#define DEBUG DEBUG_NONE + +#define FORWARD 0 +#define DEFERRED 1 +#define DEFERRED_VTEX 2 + +float saturate(float x) { return clamp(x, 0.0, 1.0); } + +layout(std140, binding = 0) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +}; + +vec4 ComputeFogFactor(vec3 WorldPos) +{ + vec4 FogData; + vec3 vEye = WorldPos - g_CamPos.xyz; + vec3 nEye = normalize(vEye); + FogData.w = exp(-dot(vEye, vEye) * g_FogColor_Distance.w * 0.75); + + float fog_sun_factor = pow(saturate(dot(nEye, g_SunDir.xyz)), 8.0); + FogData.xyz = mix(vec3(1.0, 1.0, 1.0), vec3(0.6, 0.6, 0.9), nEye.y * 0.5 + 0.5); + FogData.xyz = mix(FogData.xyz, vec3(0.95, 0.87, 0.78), fog_sun_factor); + return FogData; +} + +void ApplyFog(inout vec3 Color, vec4 FogData) +{ + Color = mix(FogData.xyz, Color, FogData.w); +} + +void ApplyLighting(inout mediump vec3 Color, mediump float DiffuseFactor) +{ + mediump vec3 DiffuseLight = g_SunColor.xyz * DiffuseFactor; + mediump vec3 AmbientLight = vec3(0.2, 0.35, 0.55) * 0.5; + mediump vec3 Lighting = DiffuseLight + AmbientLight; +#if DEBUG == DEBUG_LIGHTING + Color = Lighting; +#else + Color *= Lighting; +#endif +} + +#pragma VARIANT SPECULAR +#pragma VARIANT GLOSSMAP + +void ApplySpecular(inout mediump vec3 Color, mediump vec3 EyeVec, mediump vec3 Normal, mediump vec3 SpecularColor, mediump float Shininess, mediump float FresnelAmount) +{ + mediump vec3 HalfAngle = normalize(-EyeVec + g_SunDir.xyz); + + mediump float v_dot_h = saturate(dot(HalfAngle, -EyeVec)); + mediump float n_dot_l = saturate(dot(Normal, g_SunDir.xyz)); + mediump float n_dot_h = saturate(dot(Normal, HalfAngle)); + mediump float n_dot_v = saturate(dot(-EyeVec, Normal)); + mediump float h_dot_l = saturate(dot(g_SunDir.xyz, HalfAngle)); + + const mediump float roughness_value = 0.25; + + mediump float r_sq = roughness_value * roughness_value; + mediump float n_dot_h_sq = n_dot_h * n_dot_h; + mediump float roughness_a = 1.0 / (4.0 * r_sq * n_dot_h_sq * n_dot_h_sq); + mediump float roughness_b = n_dot_h_sq - 1.0; + mediump float roughness_c = r_sq * n_dot_h_sq; + mediump float roughness = saturate(roughness_a * exp(roughness_b / roughness_c)); + + FresnelAmount = 0.5; + mediump float fresnel_term = pow(1.0 - n_dot_v, 5.0) * (1.0 - FresnelAmount) + FresnelAmount; + + mediump float geo_numerator = 2.0 * n_dot_h; + mediump float geo_denominator = 1.0 / v_dot_h; + mediump float geo_term = min(1.0, min(n_dot_v, n_dot_l) * geo_numerator * geo_denominator); + +#if SPECULAR || GLOSSMAP + Color += SpecularColor * g_SunColor.xyz * fresnel_term * roughness * n_dot_l * geo_term / (n_dot_v * n_dot_l + 0.0001); +#endif + + //Color = vec3(0.025 * 1.0 / (n_dot_v * n_dot_l)); +} + +layout(location = 0) in vec2 Position; +layout(location = 1) in vec4 LODWeights; + +layout(location = 0) out vec2 TexCoord; +layout(location = 1) out vec3 EyeVec; + +layout(std140, binding = 2) uniform GlobalGround +{ + vec4 GroundScale; + vec4 GroundPosition; + vec4 InvGroundSize_PatchScale; +}; + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(std140, binding = 0) uniform PerPatch +{ + PatchData Patches[256]; +}; + +layout(binding = 0) uniform sampler2D TexHeightmap; +layout(binding = 1) uniform sampler2D TexLOD; + +vec2 lod_factor(vec2 uv) +{ + float level = textureLod(TexLOD, uv, 0.0).x * (255.0 / 32.0); + float floor_level = floor(level); + float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +#ifdef VULKAN +#define INSTANCE_ID gl_InstanceIndex +#else +#define INSTANCE_ID gl_InstanceID +#endif + +vec2 warp_position() +{ + float vlod = dot(LODWeights, Patches[INSTANCE_ID].LODs); + vlod = mix(vlod, Patches[INSTANCE_ID].Position.w, all(equal(LODWeights, vec4(0.0)))); + +#ifdef DEBUG_LOD_HEIGHT + LODFactor = vec4(vlod); +#endif + + float floor_lod = floor(vlod); + float fract_lod = vlod - floor_lod; + uint ufloor_lod = uint(floor_lod); + +#ifdef DEBUG_LOD_HEIGHT + LODFactor = vec4(fract_lod); +#endif + + uvec2 uPosition = uvec2(Position); + uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - 1u; + //uvec2 rounding = mix(uvec2(0u), mask, lessThan(uPosition, uvec2(32u))); + + uvec2 rounding = uvec2( + uPosition.x < 32u ? mask.x : 0u, + uPosition.y < 32u ? mask.y : 0u); + + vec4 lower_upper_snapped = vec4((uPosition + rounding).xyxy & (~mask).xxyy); + return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, fract_lod); +} + +void main() +{ + vec2 PatchPos = Patches[INSTANCE_ID].Position.xz * InvGroundSize_PatchScale.zw; + vec2 WarpedPos = warp_position(); + vec2 VertexPos = PatchPos + WarpedPos; + vec2 NormalizedPos = VertexPos * InvGroundSize_PatchScale.xy; + vec2 lod = lod_factor(NormalizedPos); + + vec2 Offset = exp2(lod.x) * InvGroundSize_PatchScale.xy; + + float Elevation = + mix(textureLod(TexHeightmap, NormalizedPos + 0.5 * Offset, lod.x).x, + textureLod(TexHeightmap, NormalizedPos + 1.0 * Offset, lod.x + 1.0).x, + lod.y); + + vec3 WorldPos = vec3(NormalizedPos.x, Elevation, NormalizedPos.y); + WorldPos *= GroundScale.xyz; + WorldPos += GroundPosition.xyz; + + EyeVec = WorldPos - g_CamPos.xyz; + TexCoord = NormalizedPos + 0.5 * InvGroundSize_PatchScale.xy; + + gl_Position = WorldPos.x * g_ViewProj_Row0 + WorldPos.y * g_ViewProj_Row1 + WorldPos.z * g_ViewProj_Row2 + g_ViewProj_Row3; +} + diff --git a/third_party/spirv-cross/shaders/vert/invariant.vert b/third_party/spirv-cross/shaders/vert/invariant.vert new file mode 100644 index 0000000000..239b985da1 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/invariant.vert @@ -0,0 +1,13 @@ +#version 310 es + +invariant gl_Position; +layout(location = 0) invariant out vec4 vColor; +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; +layout(location = 2) in vec4 vInput2; + +void main() +{ + gl_Position = vInput0 + vInput1 * vInput2; + vColor = (vInput0 - vInput1) * vInput2; +} diff --git a/third_party/spirv-cross/shaders/vert/no-contraction.vert b/third_party/spirv-cross/shaders/vert/no-contraction.vert new file mode 100644 index 0000000000..206fbf0de8 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/no-contraction.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location = 0) in vec4 vA; +layout(location = 1) in vec4 vB; +layout(location = 2) in vec4 vC; + +void main() +{ + precise vec4 mul = vA * vB; + precise vec4 add = vA + vB; + precise vec4 sub = vA - vB; + precise vec4 mad = vA * vB + vC; + precise vec4 summed = mul + add + sub + mad; + gl_Position = summed; +} diff --git a/third_party/spirv-cross/shaders/vert/ocean.vert b/third_party/spirv-cross/shaders/vert/ocean.vert new file mode 100644 index 0000000000..8a5677fa12 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/ocean.vert @@ -0,0 +1,200 @@ +#version 310 es + +#define YFLIP 0 +#define SPECULAR 0 +#define GLOSSMAP 0 + +#define DEBUG_NONE 0 +#define DEBUG_DIFFUSE 1 +#define DEBUG_SPECULAR 2 +#define DEBUG_LIGHTING 3 +#define DEBUG_FOG 4 +#define DEBUG DEBUG_NONE + +#define FORWARD 0 +#define DEFERRED 1 +#define DEFERRED_VTEX 2 + +float saturate(float x) { return clamp(x, 0.0, 1.0); } + +layout(std140, binding = 0) uniform GlobalVSData +{ + vec4 g_ViewProj_Row0; + vec4 g_ViewProj_Row1; + vec4 g_ViewProj_Row2; + vec4 g_ViewProj_Row3; + vec4 g_CamPos; + vec4 g_CamRight; + vec4 g_CamUp; + vec4 g_CamFront; + vec4 g_SunDir; + vec4 g_SunColor; + vec4 g_TimeParams; + vec4 g_ResolutionParams; + vec4 g_CamAxisRight; + vec4 g_FogColor_Distance; + vec4 g_ShadowVP_Row0; + vec4 g_ShadowVP_Row1; + vec4 g_ShadowVP_Row2; + vec4 g_ShadowVP_Row3; +}; + +vec4 ComputeFogFactor(vec3 WorldPos) +{ + vec4 FogData; + vec3 vEye = WorldPos - g_CamPos.xyz; + vec3 nEye = normalize(vEye); + FogData.w = exp(-dot(vEye, vEye) * g_FogColor_Distance.w * 0.75); + + float fog_sun_factor = pow(saturate(dot(nEye, g_SunDir.xyz)), 8.0); + FogData.xyz = mix(vec3(1.0, 1.0, 1.0), vec3(0.6, 0.6, 0.9), nEye.y * 0.5 + 0.5); + FogData.xyz = mix(FogData.xyz, vec3(0.95, 0.87, 0.78), fog_sun_factor); + return FogData; +} + +void ApplyFog(inout vec3 Color, vec4 FogData) +{ + Color = mix(FogData.xyz, Color, FogData.w); +} + +void ApplyLighting(inout mediump vec3 Color, mediump float DiffuseFactor) +{ + mediump vec3 DiffuseLight = g_SunColor.xyz * DiffuseFactor; + mediump vec3 AmbientLight = vec3(0.2, 0.35, 0.55) * 0.5; + mediump vec3 Lighting = DiffuseLight + AmbientLight; +#if DEBUG == DEBUG_LIGHTING + Color = Lighting; +#else + Color *= Lighting; +#endif +} + +void ApplySpecular(inout mediump vec3 Color, mediump vec3 EyeVec, mediump vec3 Normal, mediump vec3 SpecularColor, mediump float Shininess, mediump float FresnelAmount) +{ + mediump vec3 HalfAngle = normalize(-EyeVec + g_SunDir.xyz); + + mediump float v_dot_h = saturate(dot(HalfAngle, -EyeVec)); + mediump float n_dot_l = saturate(dot(Normal, g_SunDir.xyz)); + mediump float n_dot_h = saturate(dot(Normal, HalfAngle)); + mediump float n_dot_v = saturate(dot(-EyeVec, Normal)); + mediump float h_dot_l = saturate(dot(g_SunDir.xyz, HalfAngle)); + + const mediump float roughness_value = 0.25; + + mediump float r_sq = roughness_value * roughness_value; + mediump float n_dot_h_sq = n_dot_h * n_dot_h; + mediump float roughness_a = 1.0 / (4.0 * r_sq * n_dot_h_sq * n_dot_h_sq); + mediump float roughness_b = n_dot_h_sq - 1.0; + mediump float roughness_c = r_sq * n_dot_h_sq; + mediump float roughness = saturate(roughness_a * exp(roughness_b / roughness_c)); + + FresnelAmount = 0.5; + mediump float fresnel_term = pow(1.0 - n_dot_v, 5.0) * (1.0 - FresnelAmount) + FresnelAmount; + + mediump float geo_numerator = 2.0 * n_dot_h; + mediump float geo_denominator = 1.0 / v_dot_h; + mediump float geo_term = min(1.0, min(n_dot_v, n_dot_l) * geo_numerator * geo_denominator); + +#if SPECULAR || GLOSSMAP + Color += SpecularColor * g_SunColor.xyz * fresnel_term * roughness * n_dot_l * geo_term / (n_dot_v * n_dot_l + 0.0001); +#endif + + //Color = vec3(0.025 * 1.0 / (n_dot_v * n_dot_l)); +} + + +precision highp int; + +layout(binding = 0) uniform mediump sampler2D TexDisplacement; +layout(binding = 1) uniform mediump sampler2D TexLOD; + +layout(location = 0) in vec4 Position; +layout(location = 1) in vec4 LODWeights; + +layout(location = 0) out highp vec3 EyeVec; +layout(location = 1) out highp vec4 TexCoord; + +layout(std140, binding = 4) uniform GlobalOcean +{ + vec4 OceanScale; + vec4 OceanPosition; + vec4 InvOceanSize_PatchScale; + vec4 NormalTexCoordScale; +}; + +struct PatchData +{ + vec4 Position; + vec4 LODs; +}; + +layout(std140, binding = 0) uniform Offsets +{ + PatchData Patches[256]; +}; + +vec2 lod_factor(vec2 uv) +{ + float level = textureLod(TexLOD, uv, 0.0).x * (255.0 / 32.0); + float floor_level = floor(level); + float fract_level = level - floor_level; + return vec2(floor_level, fract_level); +} + +#ifdef VULKAN +#define INSTANCE_ID gl_InstanceIndex +#else +#define INSTANCE_ID gl_InstanceID +#endif + +vec2 warp_position() +{ + float vlod = dot(LODWeights, Patches[INSTANCE_ID].LODs); + vlod = mix(vlod, Patches[INSTANCE_ID].Position.w, all(equal(LODWeights, vec4(0.0)))); + + float floor_lod = floor(vlod); + float fract_lod = vlod - floor_lod; + uint ufloor_lod = uint(floor_lod); + + uvec4 uPosition = uvec4(Position); + uvec2 mask = (uvec2(1u) << uvec2(ufloor_lod, ufloor_lod + 1u)) - 1u; + + uvec4 rounding; + rounding.x = uPosition.x < 32u ? mask.x : 0u; + rounding.y = uPosition.y < 32u ? mask.x : 0u; + rounding.z = uPosition.x < 32u ? mask.y : 0u; + rounding.w = uPosition.y < 32u ? mask.y : 0u; + + //rounding = uPosition.xyxy * mask.xxyy; + vec4 lower_upper_snapped = vec4((uPosition.xyxy + rounding) & (~mask).xxyy); + return mix(lower_upper_snapped.xy, lower_upper_snapped.zw, fract_lod); +} + +void main() +{ + vec2 PatchPos = Patches[INSTANCE_ID].Position.xz * InvOceanSize_PatchScale.zw; + vec2 WarpedPos = warp_position(); + vec2 VertexPos = PatchPos + WarpedPos; + vec2 NormalizedPos = VertexPos * InvOceanSize_PatchScale.xy; + vec2 NormalizedTex = NormalizedPos * NormalTexCoordScale.zw; + vec2 lod = lod_factor(NormalizedPos); + vec2 Offset = exp2(lod.x) * InvOceanSize_PatchScale.xy * NormalTexCoordScale.zw; + + vec3 Displacement = + mix(textureLod(TexDisplacement, NormalizedTex + 0.5 * Offset, lod.x).yxz, + textureLod(TexDisplacement, NormalizedTex + 1.0 * Offset, lod.x + 1.0).yxz, + lod.y); + + vec3 WorldPos = vec3(NormalizedPos.x, 0.0, NormalizedPos.y) + Displacement; + WorldPos *= OceanScale.xyz; + WorldPos += OceanPosition.xyz; + + EyeVec = WorldPos - g_CamPos.xyz; + TexCoord = vec4(NormalizedTex, NormalizedTex * NormalTexCoordScale.xy) + 0.5 * InvOceanSize_PatchScale.xyxy * NormalTexCoordScale.zwzw; + + gl_Position = WorldPos.x * g_ViewProj_Row0 + WorldPos.y * g_ViewProj_Row1 + WorldPos.z * g_ViewProj_Row2 + g_ViewProj_Row3; +#if YFLIP + gl_Position *= vec4(1.0, -1.0, 1.0, 1.0); +#endif +} + diff --git a/third_party/spirv-cross/shaders/vert/read-from-row-major-array.vert b/third_party/spirv-cross/shaders/vert/read-from-row-major-array.vert new file mode 100644 index 0000000000..792fb8e36c --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/read-from-row-major-array.vert @@ -0,0 +1,20 @@ +#version 310 es +layout(location = 0) in highp vec4 a_position; +layout(location = 0) out mediump float v_vtxResult; + +layout(set = 0, binding = 0, std140, row_major) uniform Block +{ + highp mat2x3 var[3][4]; +}; + +mediump float compare_float (highp float a, highp float b) { return abs(a - b) < 0.05 ? 1.0 : 0.0; } +mediump float compare_vec3 (highp vec3 a, highp vec3 b) { return compare_float(a.x, b.x)*compare_float(a.y, b.y)*compare_float(a.z, b.z); } +mediump float compare_mat2x3 (highp mat2x3 a, highp mat2x3 b){ return compare_vec3(a[0], b[0])*compare_vec3(a[1], b[1]); } + +void main (void) +{ + gl_Position = a_position; + mediump float result = 1.0; + result *= compare_mat2x3(var[0][0], mat2x3(2.0, 6.0, -6.0, 0.0, 5.0, 5.0)); + v_vtxResult = result; +} diff --git a/third_party/spirv-cross/shaders/vert/return-array.vert b/third_party/spirv-cross/shaders/vert/return-array.vert new file mode 100644 index 0000000000..708460114e --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/return-array.vert @@ -0,0 +1,22 @@ +#version 310 es + +layout(location = 0) in vec4 vInput0; +layout(location = 1) in vec4 vInput1; + +vec4[2] test() +{ + return vec4[](vec4(10.0), vec4(20.0)); +} + +vec4[2] test2() +{ + vec4 foobar[2]; + foobar[0] = vInput0; + foobar[1] = vInput1; + return foobar; +} + +void main() +{ + gl_Position = test()[0] + test2()[1]; +} diff --git a/third_party/spirv-cross/shaders/vert/row-major-workaround.vert b/third_party/spirv-cross/shaders/vert/row-major-workaround.vert new file mode 100644 index 0000000000..edb8a842eb --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/row-major-workaround.vert @@ -0,0 +1,28 @@ +#version 310 es + +layout(binding = 0) uniform Buffer +{ + layout(row_major) highp mat4 HP; + layout(row_major) mediump mat4 MP; +}; + +layout(binding = 1) uniform Buffer2 +{ + layout(row_major) mediump mat4 MP2; +}; + + +layout(location = 0) in vec4 Hin; +layout(location = 1) in mediump vec4 Min; +layout(location = 0) out vec4 H; +layout(location = 1) out mediump vec4 M; +layout(location = 2) out mediump vec4 M2; + +void main() +{ + gl_Position = vec4(1.0); + H = HP * Hin; + M = MP * Min; + M2 = MP2 * Min; +} + diff --git a/third_party/spirv-cross/shaders/vert/texture_buffer.vert b/third_party/spirv-cross/shaders/vert/texture_buffer.vert new file mode 100644 index 0000000000..6bc7ddfae2 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/texture_buffer.vert @@ -0,0 +1,10 @@ +#version 310 es +#extension GL_OES_texture_buffer : require + +layout(binding = 4) uniform highp samplerBuffer uSamp; +layout(rgba32f, binding = 5) uniform readonly highp imageBuffer uSampo; + +void main() +{ + gl_Position = texelFetch(uSamp, 10) + imageLoad(uSampo, 100); +} diff --git a/third_party/spirv-cross/shaders/vert/transform-feedback-decorations.vert b/third_party/spirv-cross/shaders/vert/transform-feedback-decorations.vert new file mode 100644 index 0000000000..b825dd112d --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/transform-feedback-decorations.vert @@ -0,0 +1,20 @@ +#version 450 +layout(xfb_stride = 32, xfb_offset = 16, xfb_buffer = 2, location = 0) out vec4 vFoo; + +layout(xfb_buffer = 1, xfb_stride = 20) out gl_PerVertex +{ + layout(xfb_offset = 4) vec4 gl_Position; + float gl_PointSize; +}; + +layout(xfb_buffer = 3) out VertOut +{ + layout(xfb_stride = 16, xfb_offset = 0, location = 1) vec4 vBar; +}; + +void main() +{ + gl_Position = vec4(1.0); + vFoo = vec4(3.0); + vBar = vec4(5.0); +} diff --git a/third_party/spirv-cross/shaders/vert/ubo.vert b/third_party/spirv-cross/shaders/vert/ubo.vert new file mode 100644 index 0000000000..82e4626e12 --- /dev/null +++ b/third_party/spirv-cross/shaders/vert/ubo.vert @@ -0,0 +1,16 @@ +#version 310 es + +layout(binding = 0, std140) uniform UBO +{ + mat4 mvp; +}; + +layout(location = 0) in vec4 aVertex; +layout(location = 1) in vec3 aNormal; +layout(location = 0) out vec3 vNormal; + +void main() +{ + gl_Position = mvp * aVertex; + vNormal = aNormal; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp new file mode 100644 index 0000000000..f0421b292f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/array-of-buffer-reference.nocompat.vk.comp @@ -0,0 +1,23 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 1) in; + +layout(buffer_reference, buffer_reference_align = 4) buffer Block +{ + float v; +}; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + Block blocks[4]; +} ubo; + +void main() +{ + Block blocks[4]; + blocks[0] = ubo.blocks[0]; + blocks[1] = ubo.blocks[1]; + blocks[2] = ubo.blocks[2]; + blocks[3] = ubo.blocks[3]; + blocks[gl_WorkGroupID.x].v = 20.0; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp new file mode 100644 index 0000000000..cf0a8e4933 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-atomic.nocompat.vk.comp @@ -0,0 +1,24 @@ +#version 450 +#extension GL_EXT_buffer_reference : require + +layout(buffer_reference) buffer Foo +{ + uint v; +}; + +layout(buffer_reference, buffer_reference_align = 8) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(push_constant) uniform Push +{ + Bar bar; +}; + +void main() +{ + atomicAdd(bar.b, 1u); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp new file mode 100644 index 0000000000..41b44519dd --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-base-alignment-promote.nocompat.vk.comp @@ -0,0 +1,25 @@ +#version 450 +#extension GL_EXT_buffer_reference : require + +layout(buffer_reference) buffer Foo +{ + uint v; +}; + +layout(buffer_reference, buffer_reference_align = 8) buffer Bar +{ + uint a; + uint b; + Foo foo; +}; + +layout(push_constant) uniform Push +{ + Bar bar; +}; + +void main() +{ + uint v = bar.b; + atomicAdd(bar.a, v); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp new file mode 100644 index 0000000000..1afb6f772e --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2-2.nocompat.invalid.vk.comp @@ -0,0 +1,19 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require + +layout(buffer_reference) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0) buffer Buf +{ + uvec2 ptr; + PtrInt ptrint; +}; + +void main() +{ + ptr = uvec2(ptrint); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp new file mode 100644 index 0000000000..b388082368 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast-uvec2.nocompat.vk.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_EXT_buffer_reference_uvec2 : require + +layout(buffer_reference) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0) buffer Buf +{ + uvec2 ptr; +}; + +void main() +{ + PtrInt(ptr).value = 10; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp new file mode 100644 index 0000000000..eda904ee34 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-bitcast.nocompat.vk.comp @@ -0,0 +1,22 @@ +#version 450 +#extension GL_EXT_buffer_reference: require + +layout(buffer_reference) buffer PtrUint +{ + uint value; +}; + +layout(buffer_reference) buffer PtrInt +{ + int value; +}; + +layout(set = 0, binding = 0) buffer Buf +{ + PtrUint ptr; +}; + +void main() +{ + PtrInt(ptr).value = 10; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp new file mode 100644 index 0000000000..c65463168a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference-decorations.nocompat.vk.comp @@ -0,0 +1,31 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +layout(local_size_x = 64) in; + +layout(std430, buffer_reference) readonly buffer RO +{ + vec4 v[]; +}; + +layout(std430, buffer_reference) restrict buffer RW +{ + vec4 v[]; +}; + +layout(std430, buffer_reference) coherent writeonly buffer WO +{ + vec4 v[]; +}; + +layout(push_constant, std430) uniform Registers +{ + RO ro; + RW rw; + WO wo; +} registers; + +void main() +{ + registers.rw.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; + registers.wo.v[gl_GlobalInvocationID.x] = registers.ro.v[gl_GlobalInvocationID.x]; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp new file mode 100644 index 0000000000..f08e111398 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/buffer-reference.nocompat.vk.comp @@ -0,0 +1,40 @@ +#version 450 +#extension GL_EXT_buffer_reference : require +#extension GL_ARB_gpu_shader_int64 : require + +layout(buffer_reference) buffer Node; +layout(buffer_reference) buffer Node +{ + int value; + layout(offset = 16) Node next; + layout(offset = 32) Node prev; +}; + +layout(std430, set = 0, binding = 0) buffer LinkedList +{ + restrict Node head1; + restrict Node head2; +}; + +void copy_node(restrict Node dst, restrict Node a, restrict Node b) +{ + dst.value = a.value + b.value; +} + +void overwrite_node(out restrict Node dst, restrict Node src) +{ + dst = src; +} + +void main() +{ + restrict Node n = gl_WorkGroupID.x < 4u ? head1 : head2; + copy_node(n.next, head1, head2); + overwrite_node(n, head1); + int v = head2.value; + n.value = 20; + n.value = v * 10; + + uint64_t uptr = uint64_t(head2.next); + Node unode = Node(uptr); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp new file mode 100644 index 0000000000..987cb878e7 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/fp-atomic.nocompat.vk.comp @@ -0,0 +1,18 @@ +#version 450 +#extension GL_EXT_shader_atomic_float : require + +shared float shared_v; +layout(set = 0, binding = 0, r32f) uniform image2D uImage; + +layout(set = 0, binding = 1) buffer SSBO +{ + float v; +}; + +void main() +{ + float value = atomicAdd(shared_v, 2.0); + atomicAdd(v, value); + imageAtomicAdd(uImage, ivec2(gl_GlobalInvocationID.xy), value); + value = imageAtomicExchange(uImage, ivec2(gl_GlobalInvocationID.xy), value); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp new file mode 100644 index 0000000000..c7dc397e35 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/ray-query.nocompat.spv14.invalid.vk.comp @@ -0,0 +1,58 @@ +#version 460 +#extension GL_EXT_ray_query : require +#extension GL_EXT_ray_tracing : require +#extension GL_EXT_ray_flags_primitive_culling : require +layout(primitive_culling); + +layout(set = 0, binding = 0) uniform accelerationStructureEXT AS; + +layout(set = 0, binding = 1) uniform Params +{ + uint ray_flags; + uint cull_mask; + vec3 origin; + float tmin; + vec3 dir; + float tmax; + float thit; + uvec2 bda; +}; + +rayQueryEXT q2[2]; + +void main() +{ + rayQueryEXT q; + bool res; + uint type; + float fval; + vec3 fvals; + int ival; + mat4x3 matrices; + + rayQueryInitializeEXT(q, AS, ray_flags, cull_mask, origin, tmin, dir, tmax); + rayQueryInitializeEXT(q2[1], accelerationStructureEXT(bda), ray_flags, cull_mask, origin, tmin, dir, tmax); + + res = rayQueryProceedEXT(q); + rayQueryTerminateEXT(q2[0]); + rayQueryGenerateIntersectionEXT(q, thit); + rayQueryConfirmIntersectionEXT(q2[1]); + fval = rayQueryGetRayTMinEXT(q); + type = rayQueryGetRayFlagsEXT(q2[0]); + fvals = rayQueryGetWorldRayDirectionEXT(q); + fvals = rayQueryGetWorldRayOriginEXT(q); + type = rayQueryGetIntersectionTypeEXT(q2[1], true); + res = rayQueryGetIntersectionCandidateAABBOpaqueEXT(q2[1]); + fval = rayQueryGetIntersectionTEXT(q2[1], false); + ival = rayQueryGetIntersectionInstanceCustomIndexEXT(q, true); + ival = rayQueryGetIntersectionInstanceIdEXT(q2[0], false); + type = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(q, true); + ival = rayQueryGetIntersectionGeometryIndexEXT(q2[1], false); + ival = rayQueryGetIntersectionPrimitiveIndexEXT(q, true); + fvals.xy = rayQueryGetIntersectionBarycentricsEXT(q2[0], false); + res = rayQueryGetIntersectionFrontFaceEXT(q, true); + fvals = rayQueryGetIntersectionObjectRayDirectionEXT(q, false); + fvals = rayQueryGetIntersectionObjectRayOriginEXT(q2[0], true); + matrices = rayQueryGetIntersectionObjectToWorldEXT(q, false); + matrices = rayQueryGetIntersectionWorldToObjectEXT(q2[1], true); +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp new file mode 100644 index 0000000000..0b428eb0cf --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-op-member-array.vk.comp @@ -0,0 +1,33 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(constant_id = 0) const int a = 100; +layout(constant_id = 1) const int b = 200; +layout(constant_id = 2) const int c = 300; +const int d = c + 50; +layout(constant_id = 3) const int e = 400; + +struct A +{ + int member0[a]; + int member1[b]; +}; + +struct B +{ + int member0[b]; + int member1[a]; +}; + +layout(set = 1, binding = 0) buffer SSBO +{ + A member_a; + B member_b; + int v[a]; + int w[d]; +}; + +void main() +{ + w[gl_GlobalInvocationID.x] += v[gl_GlobalInvocationID.x] + e; +} diff --git a/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 0000000000..09b65dc99f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y] = b + spec_const_array_size[1 - a]; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag new file mode 100644 index 0000000000..2fabb5ea8a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler-shadow.vk.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump samplerShadow uSampler; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; +layout(set = 0, binding = 2) uniform texture2D uDepth; +layout(location = 0) out float FragColor; + +float samp2(texture2D t, mediump samplerShadow s) +{ + return texture(sampler2DShadow(t, s), vec3(1.0)); +} + +float samp3(texture2D t, mediump sampler s) +{ + return texture(sampler2D(t, s), vec2(1.0)).x; +} + +float samp(texture2D t, mediump samplerShadow s, mediump sampler s1) +{ + float r0 = samp2(t, s); + float r1 = samp3(t, s1); + return r0 + r1; +} + +void main() +{ + FragColor = samp(uDepth, uSampler, uSampler1); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler.vk.frag new file mode 100644 index 0000000000..b7de8d47e9 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/combined-texture-sampler.vk.frag @@ -0,0 +1,47 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler0; +layout(set = 0, binding = 1) uniform mediump sampler uSampler1; +layout(set = 0, binding = 2) uniform mediump texture2D uTexture0; +layout(set = 0, binding = 3) uniform mediump texture2D uTexture1; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; + +vec4 sample_dual(mediump sampler samp, mediump texture2D tex) +{ + return texture(sampler2D(tex, samp), vTex); +} + +vec4 sample_global_tex(mediump sampler samp) +{ + vec4 a = texture(sampler2D(uTexture0, samp), vTex); + vec4 b = sample_dual(samp, uTexture1); + return a + b; +} + +vec4 sample_global_sampler(mediump texture2D tex) +{ + vec4 a = texture(sampler2D(tex, uSampler0), vTex); + vec4 b = sample_dual(uSampler1, tex); + return a + b; +} + +vec4 sample_duals() +{ + vec4 a = sample_dual(uSampler0, uTexture0); + vec4 b = sample_dual(uSampler1, uTexture1); + return a + b; +} + +void main() +{ + vec4 c0 = sample_duals(); + vec4 c1 = sample_global_tex(uSampler0); + vec4 c2 = sample_global_tex(uSampler1); + vec4 c3 = sample_global_sampler(uTexture0); + vec4 c4 = sample_global_sampler(uTexture1); + + FragColor = c0 + c1 + c2 + c3 + c4; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag b/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag new file mode 100644 index 0000000000..ba57b8c5af --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper-forwarding.asm.vk.nocompat.frag @@ -0,0 +1,41 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 19 +; Schema: 0 + OpCapability Shader + OpCapability DemoteToHelperInvocationEXT + OpExtension "SPV_EXT_demote_to_helper_invocation" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %FragColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_EXT_demote_to_helper_invocation" + OpName %main "main" + OpName %FragColor "FragColor" + OpDecorate %FragColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %FragColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %float_0 = OpConstant %float 0 + %19 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %9 = OpIsHelperInvocationEXT %bool + OpDemoteToHelperInvocationEXT + %10 = OpLogicalNot %bool %9 + OpSelectionMerge %12 None + OpBranchConditional %10 %11 %12 + %11 = OpLabel + OpStore %FragColor %19 + OpBranch %12 + %12 = OpLabel + OpReturn + OpFunctionEnd diff --git a/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag b/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag new file mode 100644 index 0000000000..8b8bb61ff7 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/demote-to-helper.vk.nocompat.frag @@ -0,0 +1,8 @@ +#version 450 +#extension GL_EXT_demote_to_helper_invocation : require + +void main() +{ + demote; + bool helper = helperInvocationEXT(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/desktop-mediump.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/desktop-mediump.vk.frag new file mode 100644 index 0000000000..23fe3d3da0 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/desktop-mediump.vk.frag @@ -0,0 +1,11 @@ +#version 450 + +layout(location = 0) in mediump vec4 F; +layout(location = 1) flat in mediump ivec4 I; +layout(location = 2) flat in mediump uvec4 U; +layout(location = 0) out mediump vec4 FragColor; + +void main() +{ + FragColor = F + vec4(I) + vec4(U); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/input-attachment-ms.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/input-attachment-ms.vk.frag new file mode 100644 index 0000000000..e060738846 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/input-attachment-ms.vk.frag @@ -0,0 +1,10 @@ +#version 450 + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform subpassInputMS uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform subpassInputMS uSubpass1; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0, 1) + subpassLoad(uSubpass1, 2) + subpassLoad(uSubpass0, gl_SampleID); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/input-attachment.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/input-attachment.vk.frag new file mode 100644 index 0000000000..f082d15b2a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/input-attachment.vk.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; + +layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0; +layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = subpassLoad(uSubpass0) + subpassLoad(uSubpass1); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag b/third_party/spirv-cross/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag new file mode 100644 index 0000000000..136133eb30 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/nonuniform-qualifier.vk.nocompat.frag @@ -0,0 +1,52 @@ +#version 450 +#extension GL_EXT_nonuniform_qualifier : require +#extension GL_EXT_samplerless_texture_functions : require + +layout(binding = 0) uniform texture2D uSamplers[]; +layout(binding = 0) uniform texture2DMS uSamplersMS[]; +layout(binding = 4) uniform sampler2D uCombinedSamplers[]; +layout(binding = 1) uniform sampler uSamps[]; +layout(location = 0) flat in int vIndex; +layout(location = 1) in vec2 vUV; +layout(location = 0) out vec4 FragColor; + +layout(r32f, binding = 5) uniform image2D uImages[]; +layout(r32ui, binding = 5) uniform uimage2D uImagesU32[]; + +layout(set = 0, binding = 2) uniform UBO +{ + vec4 v[64]; +} ubos[]; + +layout(set = 0, binding = 3) buffer SSBO +{ + uint counter; + vec4 v[]; +} ssbos[]; + +void main() +{ + int i = vIndex; + FragColor = texture(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + FragColor = texture(uCombinedSamplers[nonuniformEXT(i + 10)], vUV); + FragColor += ubos[nonuniformEXT(i + 20)].v[nonuniformEXT(i + 40)]; + FragColor += ssbos[nonuniformEXT(i + 50)].v[nonuniformEXT(i + 60)]; + ssbos[nonuniformEXT(i + 60)].v[nonuniformEXT(i + 70)] = vec4(20.0); + + FragColor = texelFetch(uSamplers[nonuniformEXT(i + 10)], ivec2(vUV), 0); + atomicAdd(ssbos[nonuniformEXT(i + 100)].counter, 100u); + + vec2 queried = textureQueryLod(nonuniformEXT(sampler2D(uSamplers[i + 10], uSamps[i + 40])), vUV); + queried += textureQueryLod(uCombinedSamplers[nonuniformEXT(i + 10)], vUV); + FragColor.xy += queried; + + FragColor.x += float(textureQueryLevels(uSamplers[nonuniformEXT(i + 20)])); + FragColor.y += float(textureSamples(uSamplersMS[nonuniformEXT(i + 20)])); + FragColor.xy += vec2(textureSize(uSamplers[nonuniformEXT(i + 20)], 0)); + + FragColor += imageLoad(uImages[nonuniformEXT(i + 50)], ivec2(vUV)); + FragColor.xy += vec2(imageSize(uImages[nonuniformEXT(i + 20)])); + imageStore(uImages[nonuniformEXT(i + 60)], ivec2(vUV), vec4(50.0)); + + imageAtomicAdd(uImagesU32[nonuniformEXT(i + 70)], ivec2(vUV), 40u); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag new file mode 100644 index 0000000000..b843e266e1 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/push-constant-as-ubo.push-ubo.vk.frag @@ -0,0 +1,13 @@ +#version 450 + +layout(push_constant, std140) uniform UBO +{ + float ubo[4]; +}; + +layout(location = 0) out float FragColor; + +void main() +{ + FragColor = ubo[1]; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/push-constant.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/push-constant.vk.frag new file mode 100644 index 0000000000..6180faba31 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/push-constant.vk.frag @@ -0,0 +1,16 @@ +#version 310 es +precision mediump float; + +layout(push_constant, std430) uniform PushConstants +{ + vec4 value0; + vec4 value1; +} push; + +layout(location = 0) in vec4 vColor; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vColor + push.value0 + push.value1; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag new file mode 100644 index 0000000000..22d18a26a4 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/separate-combined-fake-overload.vk.frag @@ -0,0 +1,21 @@ +#version 450 + +layout(location = 0) out vec4 FragColor; +layout(binding = 0) uniform sampler2D uSamp; +layout(binding = 1) uniform texture2D uT; +layout(binding = 2) uniform sampler uS; + +vec4 samp(sampler2D uSamp) +{ + return texture(uSamp, vec2(0.5)); +} + +vec4 samp(texture2D T, sampler S) +{ + return texture(sampler2D(T, S), vec2(0.5)); +} + +void main() +{ + FragColor = samp(uSamp) + samp(uT, uS); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag new file mode 100644 index 0000000000..b3501c1d8d --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag @@ -0,0 +1,42 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 1) uniform mediump texture2D uTexture[4]; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D[4]; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube[4]; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray[4]; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; + +vec4 sample_func(mediump sampler samp, vec2 uv) +{ + return texture(sampler2D(uTexture[2], samp), uv); +} + +vec4 sample_func_dual(mediump sampler samp, mediump texture2D tex, vec2 uv) +{ + return texture(sampler2D(tex, samp), uv); +} + +vec4 sample_func_dual_array(mediump sampler samp, mediump texture2D tex[4], vec2 uv) +{ + return texture(sampler2D(tex[1], samp), uv); +} + +void main() +{ + vec2 off = 1.0 / vec2(textureSize(sampler2D(uTexture[1], uSampler), 0)); + vec2 off2 = 1.0 / vec2(textureSize(sampler2D(uTexture[2], uSampler), 1)); + + vec4 c0 = sample_func(uSampler, vTex + off + off2); + vec4 c1 = sample_func_dual(uSampler, uTexture[1], vTex + off + off2); + vec4 c2 = sample_func_dual_array(uSampler, uTexture, vTex + off + off2); + vec4 c3 = texture(sampler2DArray(uTextureArray[3], uSampler), vTex3); + vec4 c4 = texture(samplerCube(uTextureCube[1], uSampler), vTex3); + vec4 c5 = texture(sampler3D(uTexture3D[2], uSampler), vTex3); + + FragColor = c0 + c1 + c2 + c3 + c4 + c5; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture.vk.frag new file mode 100644 index 0000000000..cedf114ef8 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/separate-sampler-texture.vk.frag @@ -0,0 +1,36 @@ +#version 310 es +precision mediump float; + +layout(set = 0, binding = 0) uniform mediump sampler uSampler; +layout(set = 0, binding = 1) uniform mediump texture2D uTexture; +layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D; +layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube; +layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray; + +layout(location = 0) out vec4 FragColor; +layout(location = 0) in vec2 vTex; +layout(location = 1) in vec3 vTex3; + +vec4 sample_func(mediump sampler samp, vec2 uv) +{ + return texture(sampler2D(uTexture, samp), uv); +} + +vec4 sample_func_dual(mediump sampler samp, mediump texture2D tex, vec2 uv) +{ + return texture(sampler2D(tex, samp), uv); +} + +void main() +{ + vec2 off = 1.0 / vec2(textureSize(sampler2D(uTexture, uSampler), 0)); + vec2 off2 = 1.0 / vec2(textureSize(sampler2D(uTexture, uSampler), 1)); + + vec4 c0 = sample_func(uSampler, vTex + off + off2); + vec4 c1 = sample_func_dual(uSampler, uTexture, vTex + off + off2); + vec4 c2 = texture(sampler2DArray(uTextureArray, uSampler), vTex3); + vec4 c3 = texture(samplerCube(uTextureCube, uSampler), vTex3); + vec4 c4 = texture(sampler3D(uTexture3D, uSampler), vTex3); + + FragColor = c0 + c1 + c2 + c3 + c4; +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag new file mode 100644 index 0000000000..d70b0dad90 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/shader-arithmetic-8bit.nocompat.vk.frag @@ -0,0 +1,88 @@ +#version 450 +#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require +#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require + +layout(location = 0) flat in ivec4 vColor; +layout(location = 0) out ivec4 FragColorInt; +layout(location = 1) out uvec4 FragColorUint; + +layout(push_constant, std140) uniform Push +{ + int8_t i8; + uint8_t u8; +} registers; + +layout(binding = 0, std140) uniform UBO +{ + int8_t i8; + uint8_t u8; +} ubo; + +layout(binding = 1, std430) buffer SSBO +{ + int8_t i8[16]; + uint8_t u8[16]; +} ssbo; + +void packing_int8() +{ + int16_t i16 = 10s; + int i32 = 20; + + i8vec2 i8_2 = unpack8(i16); + i8vec4 i8_4 = unpack8(i32); + i16 = pack16(i8_2); + i32 = pack32(i8_4); + ssbo.i8[0] = i8_4.x; + ssbo.i8[1] = i8_4.y; + ssbo.i8[2] = i8_4.z; + ssbo.i8[3] = i8_4.w; +} + +void packing_uint8() +{ + uint16_t u16 = 10us; + uint u32 = 20u; + + u8vec2 u8_2 = unpack8(u16); + u8vec4 u8_4 = unpack8(u32); + u16 = pack16(u8_2); + u32 = pack32(u8_4); + + ssbo.u8[0] = u8_4.x; + ssbo.u8[1] = u8_4.y; + ssbo.u8[2] = u8_4.z; + ssbo.u8[3] = u8_4.w; +} + +void compute_int8() +{ + i8vec4 tmp = i8vec4(vColor); + tmp += registers.i8; + tmp += int8_t(-40); + tmp += i8vec4(-50); + tmp += i8vec4(10, 20, 30, 40); + tmp += ssbo.i8[4]; + tmp += ubo.i8; + FragColorInt = ivec4(tmp); +} + +void compute_uint8() +{ + u8vec4 tmp = u8vec4(vColor); + tmp += registers.u8; + tmp += uint8_t(-40); + tmp += u8vec4(-50); + tmp += u8vec4(10, 20, 30, 40); + tmp += ssbo.u8[4]; + tmp += ubo.u8; + FragColorUint = uvec4(tmp); +} + +void main() +{ + packing_int8(); + packing_uint8(); + compute_int8(); + compute_uint8(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-block-size.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-block-size.vk.frag new file mode 100644 index 0000000000..8d2b1f326f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-block-size.vk.frag @@ -0,0 +1,17 @@ +#version 310 es +precision mediump float; + +layout(constant_id = 10) const int Value = 2; +layout(binding = 0) uniform SpecConstArray +{ + vec4 samples[Value]; +}; + +layout(location = 0) flat in int Index; +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = samples[Index]; +} + diff --git a/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-ternary.vk.frag b/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-ternary.vk.frag new file mode 100644 index 0000000000..78dccbf044 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/frag/spec-constant-ternary.vk.frag @@ -0,0 +1,9 @@ +#version 450 +layout(location = 0) out float FragColor; +layout(constant_id = 0) const uint s = 10u; +const uint f = s > 20u ? 30u : 50u; + +void main() +{ + FragColor = float(f); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit b/third_party/spirv-cross/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit new file mode 100644 index 0000000000..dab437780d --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rahit/terminators.khr.spv14.nocompat.vk.rahit @@ -0,0 +1,17 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +rayPayloadInEXT float payload; + +void in_func() +{ + if (payload > 0.0) + ignoreIntersectionEXT; + else + terminateRayEXT; +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rahit/terminators.nocompat.vk.rahit b/third_party/spirv-cross/shaders/vulkan/rahit/terminators.nocompat.vk.rahit new file mode 100644 index 0000000000..943be33c57 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rahit/terminators.nocompat.vk.rahit @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +rayPayloadInNV float payload; + +void in_func() +{ + if (payload > 0.0) + ignoreIntersectionNV(); + else + terminateRayNV(); +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall b/third_party/spirv-cross/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall new file mode 100644 index 0000000000..53c594b6a1 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rcall/incoming-callable.khr.spv14.nocompat.vk.rcall @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 4) callableDataInEXT float c; + +void main() +{ + executeCallableEXT(10, 4); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..fd82f5bf93 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,11 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT Foo { float a; float b; } payload; +hitAttributeEXT Foo2 { float a; float b; } hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit new file mode 100644 index 0000000000..8d367e3b87 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block.nocompat.vk.rchit @@ -0,0 +1,11 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV Foo { float a; float b; } payload; +hitAttributeNV Foo2 { float a; float b; } hit; + +void main() +{ + payload.a = hit.a; + payload.b = hit.b; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..7b8d53dd8b --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT Foo { float a; float b; } payload; +hitAttributeEXT Foo2 { float a; float b; } hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit new file mode 100644 index 0000000000..23a5c6519d --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_block_in_function.nocompat.vk.rchit @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV Foo { float a; float b; } payload; +hitAttributeNV Foo2 { float a; float b; } hit; + +void in_function() +{ + payload.a = hit.a; + payload.b = hit.b; +} + +void main() +{ + in_function(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..145687739f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,10 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec2 payload; +hitAttributeEXT vec2 hit; + +void main() +{ + payload = hit; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit new file mode 100644 index 0000000000..cdbda9cb8a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_plain.nocompat.vk.rchit @@ -0,0 +1,10 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec2 payload; +hitAttributeNV vec2 hit; + +void main() +{ + payload = hit; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..f391f1ebfc --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Foo { float a; float b; }; + +layout(location = 0) rayPayloadInEXT Foo payload; +hitAttributeEXT Foo hit; + +void main() +{ + payload = hit; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit new file mode 100644 index 0000000000..625e125bc9 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_attribute_struct.nocompat.vk.rchit @@ -0,0 +1,12 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Foo { float a; float b; }; + +layout(location = 0) rayPayloadInNV Foo payload; +hitAttributeNV Foo hit; + +void main() +{ + payload = hit; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..1bf150000a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_HitKindEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit new file mode 100644 index 0000000000..39a088f46a --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_kind.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_HitKindNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..5b4fc4dd50 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_HitTEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit new file mode 100644 index 0000000000..16d6f06ea9 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/hit_t.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_HitTNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..2c28646554 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit new file mode 100644 index 0000000000..a1726d0ef4 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/incoming_ray_flags.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_IncomingRayFlagsNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..330dfcebb5 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_InstanceCustomIndexEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit new file mode 100644 index 0000000000..02ae343092 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/instance_custom_id.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_InstanceCustomIndexNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..23d1e02c75 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_InstanceID; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit new file mode 100644 index 0000000000..d6f9966811 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/instance_id.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_InstanceID; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..4d45134cb9 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit new file mode 100644 index 0000000000..257175b510 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_direction.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayDirectionNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..0964b7b566 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit new file mode 100644 index 0000000000..8b71e7d9c4 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_ray_origin.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectRayOriginNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..4377443c2b --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldEXT * vec4(payload, 1.0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit new file mode 100644 index 0000000000..53b1406fe7 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/object_to_world.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_ObjectToWorldNV * vec4(payload, 1.0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..12ed5a7d62 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/payloads.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,19 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInEXT Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/payloads.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/payloads.nocompat.vk.rchit new file mode 100644 index 0000000000..61a86663b4 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/payloads.nocompat.vk.rchit @@ -0,0 +1,19 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +struct Payload +{ + vec4 a; +}; + +layout(location = 0) rayPayloadInNV Payload payload; + +void write_incoming_payload_in_function() +{ + payload.a = vec4(10.0); +} + +void main() +{ + write_incoming_payload_in_function(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..f3798c1f42 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT uint payload; + +void main() +{ + payload = gl_PrimitiveID; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit new file mode 100644 index 0000000000..fdfa1ffa32 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/primitive_id.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV uint payload; + +void main() +{ + payload = gl_PrimitiveID; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..2f688baf9e --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTmaxEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit new file mode 100644 index 0000000000..c0e1387b3c --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmax.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTmaxNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..3f8ddf05f6 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = gl_RayTminEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit new file mode 100644 index 0000000000..896f4ffb4f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tmin.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = gl_RayTminNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..d48995b821 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit new file mode 100644 index 0000000000..44c814d708 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/ray_tracing.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 1.0 + float(gl_InstanceID); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..191905a312 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit new file mode 100644 index 0000000000..43d14f2825 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_direction.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayDirectionNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..2c86a7234c --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginEXT; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit new file mode 100644 index 0000000000..8b03e7dedf --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_ray_origin.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldRayOriginNV; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit new file mode 100644 index 0000000000..eb64bd0b41 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.khr.spv14.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT vec3 payload; + +void main() +{ + payload = gl_WorldToObjectEXT * vec4(payload, 1.0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit b/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit new file mode 100644 index 0000000000..dc67c4a90f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rchit/world_to_object.nocompat.vk.rchit @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV vec3 payload; + +void main() +{ + payload = gl_WorldToObjectNV * vec4(payload, 1.0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen new file mode 100644 index 0000000000..8d6f1f4a93 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/convert-u-to-as.spv14.vk.nocompat.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 3) rayPayloadEXT vec4 payload; + +layout(push_constant) uniform Registers +{ + uvec2 ptr; +}; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(accelerationStructureEXT(ptr), gl_RayFlagsOpaqueEXT, 0xFF, 0u, 0u, 0u, origin, 0.0, direction, 100.0f, 3); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen new file mode 100644 index 0000000000..9a4380e0a6 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.khr.spv14.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; +layout(location = 3) rayPayloadEXT vec4 payload; +layout(location = 4) callableDataEXT float blend; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, gl_RayFlagsOpaqueEXT, 0xFF, 0u, 0u, 0u, origin, 0.0, direction, 100.0f, 3); + executeCallableEXT(0u, 4); + imageStore(image, ivec2(gl_LaunchIDEXT.xy), payload + vec4(blend)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen new file mode 100644 index 0000000000..0cb8e95779 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/execute_callable.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; +layout(set = 0, binding = 1, rgba32f) uniform writeonly image2D image; +layout(location = 0) rayPayloadNV vec4 payload; +layout(location = 0) callableDataNV float blend; + +void main() +{ + vec3 origin = vec3(0.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, gl_RayFlagsOpaqueNV, 0xFF, 0u, 0u, 0u, origin, 0.0, direction, 100.0f, 0); + executeCallableNV(0u, 0); + imageStore(image, ivec2(gl_LaunchIDNV.xy), payload + vec4(blend)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..6f9983e97f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDEXT.xy), vec4(1.0)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen new file mode 100644 index 0000000000..b89792e362 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/launch_id.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchIDNV.xy), vec4(1.0)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..955f57dc40 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeEXT.xy) - 1, vec4(1.0)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen new file mode 100644 index 0000000000..1e1ff55937 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/launch_size.nocompat.vk.rgen @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0) uniform writeonly image2D uImage; + +void main() +{ + imageStore(uImage, ivec2(gl_LaunchSizeNV.xy) - 1, vec4(1.0)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..b73a2463de --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/payloads.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,49 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; + +struct Payload +{ + float a, b; +}; + +// Plain payload +layout(location = 0) rayPayloadEXT float payload1; +// Struct payload +layout(location = 1) rayPayloadEXT Payload payload2; + +// This is syntactic sugar with the struct formulation (pretty sure), spec is kinda vague. +layout(location = 2) rayPayloadEXT Block +{ + float a, b; + Payload c, d; +}; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + // Test that we can write to a payload in a function. + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + result += payload2.a; + result += payload2.b; + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + vec4 result = vec4(payload1); + + result += trace_in_function(); + + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += a + b + c.a + c.b + d.a + d.b; + + imageStore(image, ivec2(gl_LaunchIDEXT.xy), result); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/payloads.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/payloads.nocompat.vk.rgen new file mode 100644 index 0000000000..11c12d44f6 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/payloads.nocompat.vk.rgen @@ -0,0 +1,49 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureNV as; + +struct Payload +{ + float a, b; +}; + +// Plain payload +layout(location = 0) rayPayloadNV float payload1; +// Struct payload +layout(location = 1) rayPayloadNV Payload payload2; + +// This is syntactic sugar with the struct formulation (pretty sure), spec is kinda vague. +layout(location = 2) rayPayloadNV Block +{ + float a, b; + Payload c, d; +}; + +vec4 trace_in_function() +{ + vec4 result = vec4(0.0); + // Test that we can write to a payload in a function. + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 1); + result += payload2.a; + result += payload2.b; + return result; +} + +void main() +{ + vec3 origin = vec3(1.0, 0.0, 0.0); + vec3 direction = vec3(0.0, 1.0, 0.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + vec4 result = vec4(payload1); + + result += trace_in_function(); + + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 2); + result += a + b + c.a + c.b + d.a + d.b; + + imageStore(image, ivec2(gl_LaunchIDNV.xy), result); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..6763f55365 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,18 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + pure_call(vec2(gl_LaunchIDEXT.xy), vec2(gl_LaunchSizeEXT.xy)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen new file mode 100644 index 0000000000..3e362ed08e --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/pure_call.nocompat.vk.rgen @@ -0,0 +1,18 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; + +float pure_call(vec2 launchID, vec2 launchSize) +{ + vec3 origin = vec3(launchID.x / launchSize.x, launchID.y / launchSize.y, 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + return 0.0; +} + +void main() +{ + pure_call(vec2(gl_LaunchIDNV.xy), vec2(gl_LaunchSizeNV.xy)); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..40f1648901 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDEXT.xy), col); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen new file mode 100644 index 0000000000..e3f7c1ace1 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/ray_tracing.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(set = 0, binding = 0, rgba8) uniform image2D image; +layout(set = 0, binding = 1) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; + +void main() +{ + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + vec3 origin = vec3(float(gl_LaunchIDNV.x) / float(gl_LaunchSizeNV.x), float(gl_LaunchIDNV.y) / float(gl_LaunchSizeNV.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceNV(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 0); + col.y = payload; + imageStore(image, ivec2(gl_LaunchIDNV.xy), col); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen new file mode 100644 index 0000000000..39c9bf2786 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.khr.spv14.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(shaderRecordEXT, std430) buffer sbt +{ + vec3 direction; + float tmax; +}; + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 0) rayPayloadEXT float payload; + +void main() +{ + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, direction, tmax, 0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen b/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen new file mode 100644 index 0000000000..9cca9a168d --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rgen/shader_record_buffer.nocompat.vk.rgen @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(shaderRecordNV, std430) buffer sbt +{ + vec3 direction; + float tmax; +}; + +layout(set = 0, binding = 0) uniform accelerationStructureNV as; +layout(location = 0) rayPayloadNV float payload; + +void main() +{ + traceNV(as, 0u, 255u, 0u, 1u, 0u, vec3(0.0), 0.0, direction, tmax, 0); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint b/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint new file mode 100644 index 0000000000..b930e5c69f --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.khr.spv14.nocompat.vk.rint @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +void in_func() +{ + reportIntersectionEXT(0.5, 10); +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.nocompat.vk.rint b/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.nocompat.vk.rint new file mode 100644 index 0000000000..ee384fc8da --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rint/report-intersection.nocompat.vk.rint @@ -0,0 +1,12 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +void in_func() +{ + reportIntersectionNV(0.5, 10); +} + +void main() +{ + in_func(); +} diff --git a/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss new file mode 100644 index 0000000000..ee873cb96e --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.khr.spv14.nocompat.vk.rmiss @@ -0,0 +1,9 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(location = 0) rayPayloadInEXT float payload; + +void main() +{ + payload = 0.0; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss new file mode 100644 index 0000000000..ff438ce7b7 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing.nocompat.vk.rmiss @@ -0,0 +1,9 @@ +#version 460 +#extension GL_NV_ray_tracing : require + +layout(location = 0) rayPayloadInNV float payload; + +void main() +{ + payload = 0.0; +} diff --git a/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss new file mode 100644 index 0000000000..265a8f8b21 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/rmiss/ray_tracing_trace_incoming.khr.spv14.nocompat.vk.rmiss @@ -0,0 +1,12 @@ +#version 460 +#extension GL_EXT_ray_tracing : require + +layout(set = 0, binding = 0) uniform accelerationStructureEXT as; +layout(location = 3) rayPayloadInEXT float p; + +void main() +{ + vec3 origin = vec3(float(gl_LaunchIDEXT.x) / float(gl_LaunchSizeEXT.x), float(gl_LaunchIDEXT.y) / float(gl_LaunchSizeEXT.y), 1.0); + vec3 direction = vec3(0.0, 0.0, -1.0); + traceRayEXT(as, 0u, 255u, 0u, 1u, 0u, origin, 0.0, direction, 1000.0, 3); +} diff --git a/third_party/spirv-cross/shaders/vulkan/vert/device-group.nocompat.vk.vert b/third_party/spirv-cross/shaders/vulkan/vert/device-group.nocompat.vk.vert new file mode 100644 index 0000000000..16ed51b15e --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/vert/device-group.nocompat.vk.vert @@ -0,0 +1,7 @@ +#version 450 core +#extension GL_EXT_device_group : require + +void main() +{ + gl_Position = vec4(gl_DeviceIndex); +} diff --git a/third_party/spirv-cross/shaders/vulkan/vert/multiview.nocompat.vk.vert b/third_party/spirv-cross/shaders/vulkan/vert/multiview.nocompat.vk.vert new file mode 100644 index 0000000000..eb1bc766f2 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/vert/multiview.nocompat.vk.vert @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_multiview : require + +layout(std140, binding = 0) uniform MVPs +{ + mat4 MVP[2]; +}; + +layout(location = 0) in vec4 Position; + +void main() +{ + gl_Position = MVP[gl_ViewIndex] * Position; +} diff --git a/third_party/spirv-cross/shaders/vulkan/vert/small-storage.vk.vert b/third_party/spirv-cross/shaders/vulkan/vert/small-storage.vk.vert new file mode 100644 index 0000000000..195f3d5563 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/vert/small-storage.vk.vert @@ -0,0 +1,46 @@ +#version 450 core + +// GL_EXT_shader_16bit_storage doesn't support input/output. +#extension GL_EXT_shader_8bit_storage : require +#extension GL_AMD_gpu_shader_int16 : require +#extension GL_AMD_gpu_shader_half_float : require + +layout(location = 0, component = 0) in int16_t foo; +layout(location = 0, component = 1) in uint16_t bar; +layout(location = 1) in float16_t baz; + +layout(binding = 0) uniform block { + i16vec2 a; + u16vec2 b; + i8vec2 c; + u8vec2 d; + f16vec2 e; +}; + +layout(binding = 1) readonly buffer storage { + i16vec3 f; + u16vec3 g; + i8vec3 h; + u8vec3 i; + f16vec3 j; +}; + +layout(push_constant) uniform pushconst { + i16vec4 k; + u16vec4 l; + i8vec4 m; + u8vec4 n; + f16vec4 o; +}; + +layout(location = 0) out i16vec4 p; +layout(location = 1) out u16vec4 q; +layout(location = 2) out f16vec4 r; + +void main() { + p = i16vec4(int(foo) + ivec4(ivec2(a), ivec2(c)) - ivec4(ivec3(f) / ivec3(h), 1) + ivec4(k) + ivec4(m)); + q = u16vec4(uint(bar) + uvec4(uvec2(b), uvec2(d)) - uvec4(uvec3(g) / uvec3(i), 1) + uvec4(l) + uvec4(n)); + r = f16vec4(float(baz) + vec4(vec2(e), 0, 1) - vec4(vec3(j), 1) + vec4(o)); + gl_Position = vec4(0, 0, 0, 1); +} + diff --git a/third_party/spirv-cross/shaders/vulkan/vert/vulkan-vertex.vk.vert b/third_party/spirv-cross/shaders/vulkan/vert/vulkan-vertex.vk.vert new file mode 100644 index 0000000000..4d0438ace6 --- /dev/null +++ b/third_party/spirv-cross/shaders/vulkan/vert/vulkan-vertex.vk.vert @@ -0,0 +1,6 @@ +#version 310 es + +void main() +{ + gl_Position = float(gl_VertexIndex + gl_InstanceIndex) * vec4(1.0, 2.0, 3.0, 4.0); +} diff --git a/third_party/spirv-cross/spirv_common.hpp b/third_party/spirv-cross/spirv_common.hpp index 4d86e9b727..7fb23fa360 100644 --- a/third_party/spirv-cross/spirv_common.hpp +++ b/third_party/spirv-cross/spirv_common.hpp @@ -1684,6 +1684,7 @@ struct Meta std::string alias; std::string qualified_alias; std::string hlsl_semantic; + std::string user_type; Bitset decoration_flags; spv::BuiltIn builtin_type = spv::BuiltInMax; uint32_t location = 0; diff --git a/third_party/spirv-cross/spirv_common.hpp.orig b/third_party/spirv-cross/spirv_common.hpp.orig index ba420e1dbe..0264e8185e 100644 --- a/third_party/spirv-cross/spirv_common.hpp.orig +++ b/third_party/spirv-cross/spirv_common.hpp.orig @@ -1663,6 +1663,7 @@ struct Meta std::string alias; std::string qualified_alias; std::string hlsl_semantic; + std::string user_type; Bitset decoration_flags; spv::BuiltIn builtin_type = spv::BuiltInMax; uint32_t location = 0; diff --git a/third_party/spirv-cross/spirv_cross.cpp b/third_party/spirv-cross/spirv_cross.cpp index edc98f81e1..49cc838682 100644 --- a/third_party/spirv-cross/spirv_cross.cpp +++ b/third_party/spirv-cross/spirv_cross.cpp @@ -5445,18 +5445,55 @@ void Compiler::analyze_interlocked_resource_usage() } bool Compiler::type_is_array_of_pointers(const SPIRType &type) const +{ + if (!type_is_top_level_array(type)) + return false; + + // BDA types must have parent type hierarchy. + if (!type.parent_type) + return false; + + // Punch through all array layers. + auto *parent = &get(type.parent_type); + while (type_is_top_level_array(*parent)) + parent = &get(parent->parent_type); + + return type_is_top_level_pointer(*parent); +} + +bool Compiler::type_is_top_level_pointer(const SPIRType &type) const { if (!type.pointer) return false; - // If parent type has same pointer depth, we must have an array of pointers. - return type.pointer_depth == get(type.parent_type).pointer_depth; + // Function pointers, should not be hit by valid SPIR-V. + // Parent type will be SPIRFunction instead. + if (type.basetype == SPIRType::Unknown) + return false; + + // Some types are synthesized in-place without complete type hierarchy and might not have parent types, + // but these types are never array-of-pointer or any complicated BDA type, infer reasonable defaults. + if (type.parent_type) + return type.pointer_depth > get(type.parent_type).pointer_depth; + else + return true; } bool Compiler::type_is_top_level_physical_pointer(const SPIRType &type) const { - return type.pointer && type.storage == StorageClassPhysicalStorageBuffer && - type.pointer_depth > get(type.parent_type).pointer_depth; + return type_is_top_level_pointer(type) && type.storage == StorageClassPhysicalStorageBuffer; +} + +bool Compiler::type_is_top_level_array(const SPIRType &type) const +{ + if (type.array.empty()) + return false; + + // If we have pointer and array, we infer pointer-to-array as it's the only meaningful thing outside BDA. + if (type.parent_type) + return type.array.size() > get(type.parent_type).array.size(); + else + return !type.pointer; } bool Compiler::flush_phi_required(BlockID from, BlockID to) const diff --git a/third_party/spirv-cross/spirv_cross.hpp b/third_party/spirv-cross/spirv_cross.hpp index ea98ee60d3..b99b7ae7a2 100644 --- a/third_party/spirv-cross/spirv_cross.hpp +++ b/third_party/spirv-cross/spirv_cross.hpp @@ -1145,6 +1145,8 @@ protected: bool type_is_array_of_pointers(const SPIRType &type) const; bool type_is_top_level_physical_pointer(const SPIRType &type) const; + bool type_is_top_level_pointer(const SPIRType &type) const; + bool type_is_top_level_array(const SPIRType &type) const; bool type_is_block_like(const SPIRType &type) const; bool type_is_opaque_value(const SPIRType &type) const; diff --git a/third_party/spirv-cross/spirv_cross_c.cpp b/third_party/spirv-cross/spirv_cross_c.cpp index f76c14c0d8..c21fdeb6ed 100644 --- a/third_party/spirv-cross/spirv_cross_c.cpp +++ b/third_party/spirv-cross/spirv_cross_c.cpp @@ -820,6 +820,43 @@ spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char * #endif } +size_t spvc_compiler_get_num_required_extensions(spvc_compiler compiler) +{ +#if SPIRV_CROSS_C_API_GLSL + if (compiler->backend != SPVC_BACKEND_GLSL) + { + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return SPVC_ERROR_INVALID_ARGUMENT; + } + + return static_cast(compiler->compiler.get())->get_required_extensions().size(); +#else + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return 0; +#endif +} + +const char *spvc_compiler_get_required_extension(spvc_compiler compiler, size_t index) +{ +#if SPIRV_CROSS_C_API_GLSL + if (compiler->backend != SPVC_BACKEND_GLSL) + { + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return nullptr; + } + + auto &exts = static_cast(compiler->compiler.get())->get_required_extensions(); + if (index < exts.size()) + return exts[index].c_str(); + else + return nullptr; +#else + (void)index; + compiler->context->report_error("Enabled extensions can only be queried on GLSL backend."); + return nullptr; +#endif +} + spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id) { #if SPIRV_CROSS_C_API_GLSL diff --git a/third_party/spirv-cross/spirv_cross_c.h b/third_party/spirv-cross/spirv_cross_c.h index 7f8c6fad26..0d8e6e10a6 100644 --- a/third_party/spirv-cross/spirv_cross_c.h +++ b/third_party/spirv-cross/spirv_cross_c.h @@ -40,7 +40,7 @@ extern "C" { /* Bumped if ABI or API breaks backwards compatibility. */ #define SPVC_C_API_VERSION_MAJOR 0 /* Bumped if APIs or enumerations are added in a backwards compatible way. */ -#define SPVC_C_API_VERSION_MINOR 56 +#define SPVC_C_API_VERSION_MINOR 57 /* Bumped if internal implementation details change. */ #define SPVC_C_API_VERSION_PATCH 0 @@ -784,6 +784,8 @@ SPVC_PUBLIC_API spvc_result spvc_compiler_compile(spvc_compiler compiler, const /* Maps to C++ API. */ SPVC_PUBLIC_API spvc_result spvc_compiler_add_header_line(spvc_compiler compiler, const char *line); SPVC_PUBLIC_API spvc_result spvc_compiler_require_extension(spvc_compiler compiler, const char *ext); +SPVC_PUBLIC_API size_t spvc_compiler_get_num_required_extensions(spvc_compiler compiler); +SPVC_PUBLIC_API const char *spvc_compiler_get_required_extension(spvc_compiler compiler, size_t index); SPVC_PUBLIC_API spvc_result spvc_compiler_flatten_buffer_block(spvc_compiler compiler, spvc_variable_id id); SPVC_PUBLIC_API spvc_bool spvc_compiler_variable_is_depth_or_compare(spvc_compiler compiler, spvc_variable_id id); diff --git a/third_party/spirv-cross/spirv_cross_parsed_ir.cpp b/third_party/spirv-cross/spirv_cross_parsed_ir.cpp index 8d1acf69f9..c6ddb6a45e 100644 --- a/third_party/spirv-cross/spirv_cross_parsed_ir.cpp +++ b/third_party/spirv-cross/spirv_cross_parsed_ir.cpp @@ -370,6 +370,10 @@ void ParsedIR::set_decoration_string(ID id, Decoration decoration, const string dec.hlsl_semantic = argument; break; + case DecorationUserTypeGOOGLE: + dec.user_type = argument; + break; + default: break; } @@ -659,6 +663,9 @@ const string &ParsedIR::get_decoration_string(ID id, Decoration decoration) cons case DecorationHlslSemanticGOOGLE: return dec.hlsl_semantic; + case DecorationUserTypeGOOGLE: + return dec.user_type; + default: return empty_string; } diff --git a/third_party/spirv-cross/spirv_glsl.cpp b/third_party/spirv-cross/spirv_glsl.cpp index 88a82c9aaa..0d63d35f8f 100644 --- a/third_party/spirv-cross/spirv_glsl.cpp +++ b/third_party/spirv-cross/spirv_glsl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #ifndef _WIN32 #include @@ -1533,7 +1534,7 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits { // If using PhysicalStorageBufferEXT storage class, this is a pointer, // and is 64-bit. - if (type.storage == StorageClassPhysicalStorageBufferEXT) + if (type_is_top_level_physical_pointer(type)) { if (!type.pointer) SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); @@ -1548,8 +1549,7 @@ uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bits else SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); } - - if (!type.array.empty()) + else if (type_is_top_level_array(type)) { uint32_t minimum_alignment = 1; if (packing_is_vec4_padded(packing)) @@ -1655,7 +1655,19 @@ uint32_t CompilerGLSL::type_to_packed_array_stride(const SPIRType &type, const B uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing) { - if (!type.array.empty()) + // If using PhysicalStorageBufferEXT storage class, this is a pointer, + // and is 64-bit. + if (type_is_top_level_physical_pointer(type)) + { + if (!type.pointer) + SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); + + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + return 8; + else + SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); + } + else if (type_is_top_level_array(type)) { uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); @@ -1667,19 +1679,6 @@ uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &f return packed_size; } - // If using PhysicalStorageBufferEXT storage class, this is a pointer, - // and is 64-bit. - if (type.storage == StorageClassPhysicalStorageBufferEXT) - { - if (!type.pointer) - SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); - - if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) - return 8; - else - SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); - } - uint32_t size = 0; if (type.basetype == SPIRType::Struct) @@ -1798,16 +1797,17 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin packed_size = type_to_packed_size(memb_type, member_flags, packing); // We only need to care about this if we have non-array types which can straddle the vec4 boundary. + uint32_t actual_offset = type_struct_member_offset(type, i); + if (packing_is_hlsl(packing)) { // If a member straddles across a vec4 boundary, alignment is actually vec4. - uint32_t begin_word = offset / 16; - uint32_t end_word = (offset + packed_size - 1) / 16; + uint32_t begin_word = actual_offset / 16; + uint32_t end_word = (actual_offset + packed_size - 1) / 16; if (begin_word != end_word) packed_alignment = max(packed_alignment, 16u); } - uint32_t actual_offset = type_struct_member_offset(type, i); // Field is not in the specified range anymore and we can ignore any further fields. if (actual_offset >= end_offset) break; @@ -1845,8 +1845,9 @@ bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackin } // Verify array stride rules. - if (!memb_type.array.empty() && type_to_packed_array_stride(memb_type, member_flags, packing) != - type_struct_member_array_stride(type, i)) + if (type_is_top_level_array(memb_type) && + type_to_packed_array_stride(memb_type, member_flags, packing) != + type_struct_member_array_stride(type, i)) { if (failed_validation_index) *failed_validation_index = i; @@ -4004,6 +4005,169 @@ void CompilerGLSL::emit_output_variable_initializer(const SPIRVariable &var) } } +void CompilerGLSL::emit_subgroup_arithmetic_workaround(const std::string &func, Op op, GroupOperation group_op) +{ + std::string result; + switch (group_op) + { + case GroupOperationReduce: + result = "reduction"; + break; + + case GroupOperationExclusiveScan: + result = "excl_scan"; + break; + + case GroupOperationInclusiveScan: + result = "incl_scan"; + break; + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + struct TypeInfo + { + std::string type; + std::string identity; + }; + + std::vector type_infos; + switch (op) + { + case OpGroupNonUniformIAdd: + { + type_infos.emplace_back(TypeInfo{ "uint", "0u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(0u)" }); + type_infos.emplace_back(TypeInfo{ "int", "0" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(0)" }); + break; + } + + case OpGroupNonUniformFAdd: + { + type_infos.emplace_back(TypeInfo{ "float", "0.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(0.0f)" }); + // ARB_gpu_shader_fp64 is required in GL4.0 which in turn is required by NV_thread_shuffle + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(0.0LF)" }); + break; + } + + case OpGroupNonUniformIMul: + { + type_infos.emplace_back(TypeInfo{ "uint", "1u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(1u)" }); + type_infos.emplace_back(TypeInfo{ "int", "1" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(1)" }); + break; + } + + case OpGroupNonUniformFMul: + { + type_infos.emplace_back(TypeInfo{ "float", "1.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(1.0LF)" }); + break; + } + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + const bool op_is_addition = op == OpGroupNonUniformIAdd || op == OpGroupNonUniformFAdd; + const bool op_is_multiplication = op == OpGroupNonUniformIMul || op == OpGroupNonUniformFMul; + std::string op_symbol; + if (op_is_addition) + { + op_symbol = "+="; + } + else if (op_is_multiplication) + { + op_symbol = "*="; + } + + for (const TypeInfo &t : type_infos) + { + statement(t.type, " ", func, "(", t.type, " v)"); + begin_scope(); + statement(t.type, " ", result, " = ", t.identity, ";"); + statement("uvec4 active_threads = subgroupBallot(true);"); + statement("if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize)"); + begin_scope(); + statement("uint total = gl_SubgroupSize / 2u;"); + statement(result, " = v;"); + statement("for (uint i = 1u; i <= total; i <<= 1u)"); + begin_scope(); + statement("bool valid;"); + if (group_op == GroupOperationReduce) + { + statement(t.type, " s = shuffleXorNV(", result, ", i, gl_SubgroupSize, valid);"); + } + else if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement(t.type, " s = shuffleUpNV(", result, ", i, gl_SubgroupSize, valid);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement(result, " = shuffleUpNV(", result, ", 1u, gl_SubgroupSize);"); + statement("if (subgroupElect())"); + begin_scope(); + statement(result, " = ", t.identity, ";"); + end_scope(); + } + end_scope(); + statement("else"); + begin_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLtMask);"); + } + else if (group_op == GroupOperationInclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLeMask);"); + } + statement("for (uint i = 0u; i < gl_SubgroupSize; ++i)"); + begin_scope(); + statement("bool valid = subgroupBallotBitExtract(active_threads, i);"); + statement(t.type, " s = shuffleNV(v, i, gl_SubgroupSize);"); + if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement("valid = valid && (i < total);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + end_scope(); + statement("return ", result, ";"); + end_scope(); + } +} + void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) { static const char *workaround_types[] = { "int", "ivec2", "ivec3", "ivec4", "uint", "uvec2", "uvec3", "uvec4", @@ -4407,6 +4571,57 @@ void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) statement("#endif"); statement(""); } + + auto arithmetic_feature_helper = + [&](Supp::Feature feat, std::string func_name, spv::Op op, spv::GroupOperation group_op) + { + if (shader_subgroup_supporter.is_feature_requested(feat)) + { + auto exts = Supp::get_candidates_for_feature(feat, result); + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_shuffle: + emit_subgroup_arithmetic_workaround(func_name, op, group_op); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + }; + + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddReduce, "subgroupAdd", OpGroupNonUniformIAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddReduce, "subgroupAdd", OpGroupNonUniformFAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationInclusiveScan); + + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulReduce, "subgroupMul", OpGroupNonUniformIMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformIMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformIMul, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulReduce, "subgroupMul", OpGroupNonUniformFMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformFMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformFMul, GroupOperationInclusiveScan); } if (!workaround_ubo_load_overload_types.empty()) @@ -4899,8 +5114,27 @@ string CompilerGLSL::to_extract_constant_composite_expression(uint32_t result_ty return constant_expression(tmp); } -string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const SPIRType &type) +string CompilerGLSL::to_rerolled_array_expression(const SPIRType &parent_type, + const string &base_expr, const SPIRType &type) { + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + SPIRType tmp_type; + if (remapped_boolean) + { + tmp_type = get(type.parent_type); + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + } + else if (type.basetype == SPIRType::Boolean && backend.boolean_in_struct_remapped_type != SPIRType::Boolean) + { + // It's possible that we have an r-value expression that was OpLoaded from a struct. + // We have to reroll this and explicitly cast the input to bool, because the r-value is short. + tmp_type = get(type.parent_type); + remapped_boolean = true; + } + uint32_t size = to_array_size_literal(type); auto &parent = get(type.parent_type); string expr = "{ "; @@ -4908,10 +5142,14 @@ string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const for (uint32_t i = 0; i < size; i++) { auto subexpr = join(base_expr, "[", convert_to_string(i), "]"); - if (parent.array.empty()) + if (!type_is_top_level_array(parent)) + { + if (remapped_boolean) + subexpr = join(type_to_glsl(tmp_type), "(", subexpr, ")"); expr += subexpr; + } else - expr += to_rerolled_array_expression(subexpr, parent); + expr += to_rerolled_array_expression(parent_type, subexpr, parent); if (i + 1 < size) expr += ", "; @@ -4921,13 +5159,26 @@ string CompilerGLSL::to_rerolled_array_expression(const string &base_expr, const return expr; } -string CompilerGLSL::to_composite_constructor_expression(uint32_t id, bool block_like_type) +string CompilerGLSL::to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type) { auto &type = expression_type(id); - bool reroll_array = !type.array.empty() && - (!backend.array_is_value_type || - (block_like_type && !backend.array_is_value_type_in_buffer_blocks)); + bool reroll_array = false; + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + if (type_is_top_level_array(type)) + { + reroll_array = !backend.array_is_value_type || + (block_like_type && !backend.array_is_value_type_in_buffer_blocks); + + if (remapped_boolean) + { + // Forced to reroll if we have to change bool[] to short[]. + reroll_array = true; + } + } if (reroll_array) { @@ -4941,10 +5192,20 @@ string CompilerGLSL::to_composite_constructor_expression(uint32_t id, bool block // We're only triggering one read of the array expression, but this is fine since arrays have to be declared // as temporaries anyways. - return to_rerolled_array_expression(to_enclosed_expression(id), type); + return to_rerolled_array_expression(parent_type, to_enclosed_expression(id), type); } else - return to_unpacked_expression(id); + { + auto expr = to_unpacked_expression(id); + if (remapped_boolean) + { + auto tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + expr = join(type_to_glsl(tmp_type), "(", expr, ")"); + } + + return expr; + } } string CompilerGLSL::to_non_uniform_aware_expression(uint32_t id) @@ -5454,11 +5715,13 @@ string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) } } -string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_block_like_struct_scope) +string CompilerGLSL::constant_expression(const SPIRConstant &c, + bool inside_block_like_struct_scope, + bool inside_struct_scope) { auto &type = get(c.constant_type); - if (type.pointer) + if (type_is_top_level_pointer(type)) { return backend.null_pointer_literal; } @@ -5473,19 +5736,32 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc // with Offset = 0, using no ArrayStride on the enclosed array type. // A particular CTS test hits this scenario. bool array_type_decays = inside_block_like_struct_scope && - !type.array.empty() && !backend.array_is_value_type_in_buffer_blocks; + type_is_top_level_array(type) && + !backend.array_is_value_type_in_buffer_blocks; // Allow Metal to use the array template to make arrays a value type bool needs_trailing_tracket = false; if (backend.use_initializer_list && backend.use_typed_initializer_list && type.basetype == SPIRType::Struct && - type.array.empty()) + !type_is_top_level_array(type)) { res = type_to_glsl_constructor(type) + "{ "; } else if (backend.use_initializer_list && backend.use_typed_initializer_list && backend.array_is_value_type && - !type.array.empty() && !array_type_decays) + type_is_top_level_array(type) && !array_type_decays) { - res = type_to_glsl_constructor(type) + "({ "; + const auto *p_type = &type; + SPIRType tmp_type; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + p_type = &tmp_type; + } + + res = type_to_glsl_constructor(*p_type) + "({ "; needs_trailing_tracket = true; } else if (backend.use_initializer_list) @@ -5515,7 +5791,7 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc res += to_name(elem); else { - if (type.array.empty() && type.basetype == SPIRType::Struct) + if (!type_is_top_level_array(type) && type.basetype == SPIRType::Struct) { // When we get down to emitting struct members, override the block-like information. // For constants, we can freely mix and match block-like state. @@ -5523,7 +5799,10 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc has_member_decoration(type.self, subconstant_index, DecorationOffset); } - res += constant_expression(subc, inside_block_like_struct_scope); + if (type.basetype == SPIRType::Struct) + inside_struct_scope = true; + + res += constant_expression(subc, inside_block_like_struct_scope, inside_struct_scope); } } @@ -5545,19 +5824,30 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc if (backend.supports_empty_struct) return "{ }"; else if (backend.use_typed_initializer_list) - return join(type_to_glsl(get(c.constant_type)), "{ 0 }"); + return join(type_to_glsl(type), "{ 0 }"); else if (backend.use_initializer_list) return "{ 0 }"; else - return join(type_to_glsl(get(c.constant_type)), "(0)"); + return join(type_to_glsl(type), "(0)"); } else if (c.columns() == 1) { - return constant_expression_vector(c, 0); + auto res = constant_expression_vector(c, 0); + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + + return res; } else { - string res = type_to_glsl(get(c.constant_type)) + "("; + string res = type_to_glsl(type) + "("; for (uint32_t col = 0; col < c.columns(); col++) { if (c.specialization_constant_id(col) != 0) @@ -5569,6 +5859,16 @@ string CompilerGLSL::constant_expression(const SPIRConstant &c, bool inside_bloc res += ", "; } res += ")"; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + return res; } } @@ -7120,7 +7420,7 @@ string CompilerGLSL::to_combined_image_sampler(VariableID image_id, VariableID s } } -bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op) +bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops) { switch (op) { @@ -7139,6 +7439,22 @@ bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op) case OpGroupNonUniformBallotBitExtract: case OpGroupNonUniformInverseBallot: return true; + case OpGroupNonUniformIAdd: + case OpGroupNonUniformFAdd: + case OpGroupNonUniformIMul: + case OpGroupNonUniformFMul: + { + const GroupOperation operation = static_cast(ops[3]); + if (operation == GroupOperationReduce || operation == GroupOperationInclusiveScan || + operation == GroupOperationExclusiveScan) + { + return true; + } + else + { + return false; + } + } default: return false; } @@ -7533,7 +7849,7 @@ bool CompilerGLSL::expression_is_constant_null(uint32_t id) const bool CompilerGLSL::expression_is_non_value_type_array(uint32_t ptr) { auto &type = expression_type(ptr); - if (type.array.empty()) + if (!type_is_top_level_array(get_pointee_type(type))) return false; if (!backend.array_is_value_type) @@ -8736,7 +9052,7 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) const uint32_t *ops = stream(i); auto op = static_cast(i.op); - if (!options.vulkan_semantics && !is_supported_subgroup_op_in_opengl(op)) + if (!options.vulkan_semantics && !is_supported_subgroup_op_in_opengl(op, ops)) SPIRV_CROSS_THROW("This subgroup operation is only supported in Vulkan semantics."); // If we need to do implicit bitcasts, make sure we do it with the correct type. @@ -8804,12 +9120,34 @@ void CompilerGLSL::emit_subgroup_op(const Instruction &i) } break; - case OpGroupNonUniformFAdd: - case OpGroupNonUniformFMul: + // clang-format off +#define GLSL_GROUP_OP(OP)\ + case OpGroupNonUniform##OP:\ + {\ + auto operation = static_cast(ops[3]);\ + if (operation == GroupOperationClusteredReduce)\ + require_extension_internal("GL_KHR_shader_subgroup_clustered");\ + else if (operation == GroupOperationReduce)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##Reduce);\ + else if (operation == GroupOperationExclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##ExclusiveScan);\ + else if (operation == GroupOperationInclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##InclusiveScan);\ + else\ + SPIRV_CROSS_THROW("Invalid group operation.");\ + break;\ + } + + GLSL_GROUP_OP(IAdd) + GLSL_GROUP_OP(FAdd) + GLSL_GROUP_OP(IMul) + GLSL_GROUP_OP(FMul) + +#undef GLSL_GROUP_OP + // clang-format on + case OpGroupNonUniformFMin: case OpGroupNonUniformFMax: - case OpGroupNonUniformIAdd: - case OpGroupNonUniformIMul: case OpGroupNonUniformSMin: case OpGroupNonUniformSMax: case OpGroupNonUniformUMin: @@ -9617,6 +9955,9 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice bool pending_array_enclose = false; bool dimension_flatten = false; + // If we are translating access to a structured buffer, the first subscript '._m0' must be hidden + bool hide_first_subscript = count > 1 && is_user_type_structured(base); + const auto append_index = [&](uint32_t index, bool is_literal, bool is_ptr_chain = false) { AccessChainFlags mod_flags = flags; if (!is_literal) @@ -9803,32 +10144,40 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice if (index >= type->member_types.size()) SPIRV_CROSS_THROW("Member index is out of bounds!"); - BuiltIn builtin = BuiltInMax; - if (is_member_builtin(*type, index, &builtin) && access_chain_needs_stage_io_builtin_translation(base)) + if (hide_first_subscript) { - if (access_chain_is_arrayed) - { - expr += "."; - expr += builtin_to_glsl(builtin, type->storage); - } - else - expr = builtin_to_glsl(builtin, type->storage); + // First "._m0" subscript has been hidden, subsequent fields must be emitted even for structured buffers + hide_first_subscript = false; } else { - // If the member has a qualified name, use it as the entire chain - string qual_mbr_name = get_member_qualified_name(type_id, index); - if (!qual_mbr_name.empty()) - expr = qual_mbr_name; - else if (flatten_member_reference) - expr += join("_", to_member_name(*type, index)); + BuiltIn builtin = BuiltInMax; + if (is_member_builtin(*type, index, &builtin) && access_chain_needs_stage_io_builtin_translation(base)) + { + if (access_chain_is_arrayed) + { + expr += "."; + expr += builtin_to_glsl(builtin, type->storage); + } + else + expr = builtin_to_glsl(builtin, type->storage); + } else { - // Any pointer de-refences for values are handled in the first access chain. - // For pointer chains, the pointer-ness is resolved through an array access. - // The only time this is not true is when accessing array of SSBO/UBO. - // This case is explicitly handled. - expr += to_member_reference(base, *type, index, ptr_chain || i != 0); + // If the member has a qualified name, use it as the entire chain + string qual_mbr_name = get_member_qualified_name(type_id, index); + if (!qual_mbr_name.empty()) + expr = qual_mbr_name; + else if (flatten_member_reference) + expr += join("_", to_member_name(*type, index)); + else + { + // Any pointer de-refences for values are handled in the first access chain. + // For pointer chains, the pointer-ness is resolved through an array access. + // The only time this is not true is when accessing array of SSBO/UBO. + // This case is explicitly handled. + expr += to_member_reference(base, *type, index, ptr_chain || i != 0); + } } } @@ -10855,7 +11204,7 @@ string CompilerGLSL::build_composite_combiner(uint32_t return_type, const uint32 bool uses_buffer_offset = type.basetype == SPIRType::Struct && has_member_decoration(type.self, i, DecorationOffset); - subop = to_composite_constructor_expression(elems[i], uses_buffer_offset); + subop = to_composite_constructor_expression(type, elems[i], uses_buffer_offset); } base = e ? e->base_expression : ID(0); @@ -10945,8 +11294,15 @@ void CompilerGLSL::emit_block_instructions(SPIRBlock &block) if (backend.requires_relaxed_precision_analysis) { // If PHI variables are consumed in unexpected precision contexts, copy them here. - for (auto &phi : block.phi_variables) + for (size_t i = 0, n = block.phi_variables.size(); i < n; i++) { + auto &phi = block.phi_variables[i]; + + // Ensure we only copy once. We know a-priori that this array will lay out + // the same function variables together. + if (i && block.phi_variables[i - 1].function_variable == phi.function_variable) + continue; + auto itr = temporary_to_mirror_precision_alias.find(phi.function_variable); if (itr != temporary_to_mirror_precision_alias.end()) { @@ -11485,7 +11841,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // it is an array, and our backend does not support arrays as value types. // Emit the temporary, and copy it explicitly. e = &emit_uninitialized_temporary_expression(result_type, id); - emit_array_copy(to_expression(id), id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); + emit_array_copy(nullptr, id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); } else e = &emit_op(result_type, id, expr, forward, !usage_tracking); @@ -15313,6 +15669,11 @@ void CompilerGLSL::require_extension(const std::string &ext) forced_extensions.push_back(ext); } +const SmallVector &CompilerGLSL::get_required_extensions() const +{ + return forced_extensions; +} + void CompilerGLSL::require_extension_internal(const string &ext) { if (backend.supports_extensions && !has_extension(ext)) @@ -15346,6 +15707,11 @@ bool CompilerGLSL::builtin_translates_to_nonarray(spv::BuiltIn /*builtin*/) cons return false; // GLSL itself does not need to translate array builtin types to non-array builtin types } +bool CompilerGLSL::is_user_type_structured(uint32_t /*id*/) const +{ + return false; // GLSL itself does not have structured user type, but HLSL does with StructuredBuffer and RWStructuredBuffer resources. +} + bool CompilerGLSL::check_atomic_image(uint32_t id) { auto &type = expression_type(id); @@ -16300,6 +16666,24 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) if (block.merge == SPIRBlock::MergeLoop) add_loop_level(); + // If we're emitting PHI variables with precision aliases, we have to emit them as hoisted temporaries. + for (auto var_id : block.dominated_variables) + { + auto &var = get(var_id); + if (var.phi_variable) + { + auto mirrored_precision_itr = temporary_to_mirror_precision_alias.find(var_id); + if (mirrored_precision_itr != temporary_to_mirror_precision_alias.end() && + find_if(block.declare_temporary.begin(), block.declare_temporary.end(), + [mirrored_precision_itr](const std::pair &p) { + return p.second == mirrored_precision_itr->second; + }) == block.declare_temporary.end()) + { + block.declare_temporary.push_back({ var.basetype, mirrored_precision_itr->second }); + } + } + } + emit_hoisted_temporaries(block.declare_temporary); SPIRBlock::ContinueBlockType continue_type = SPIRBlock::ContinueNone; @@ -17081,9 +17465,16 @@ uint32_t CompilerGLSL::mask_relevant_memory_semantics(uint32_t semantics) MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask); } -void CompilerGLSL::emit_array_copy(const string &lhs, uint32_t, uint32_t rhs_id, StorageClass, StorageClass) +bool CompilerGLSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass, StorageClass) { + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + statement(lhs, " = ", to_expression(rhs_id), ";"); + return true; } bool CompilerGLSL::unroll_array_to_complex_store(uint32_t target_id, uint32_t source_id) @@ -17678,6 +18069,7 @@ const char *CompilerGLSL::ShaderSubgroupSupportHelper::get_extension_name(Candid static const char *const retval[CandidateCount] = { "GL_KHR_shader_subgroup_ballot", "GL_KHR_shader_subgroup_basic", "GL_KHR_shader_subgroup_vote", + "GL_KHR_shader_subgroup_arithmetic", "GL_NV_gpu_shader_5", "GL_NV_shader_thread_group", "GL_NV_shader_thread_shuffle", @@ -17726,6 +18118,21 @@ CompilerGLSL::ShaderSubgroupSupportHelper::FeatureVector CompilerGLSL::ShaderSub return { SubgroupMask }; case SubgroupBallotBitCount: return { SubgroupBallot }; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulInclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, SubgroupMask, SubgroupBallotBitExtract }; + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticFMulExclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, + SubgroupMask, SubgroupElect, SubgroupBallotBitExtract }; default: return {}; } @@ -17739,11 +18146,15 @@ CompilerGLSL::ShaderSubgroupSupportHelper::FeatureMask CompilerGLSL::ShaderSubgr bool CompilerGLSL::ShaderSubgroupSupportHelper::can_feature_be_implemented_without_extensions(Feature feature) { - static const bool retval[FeatureCount] = { false, false, false, false, false, false, - true, // SubgroupBalloFindLSB_MSB - false, false, false, false, - true, // SubgroupMemBarrier - replaced with workgroup memory barriers - false, false, true, false }; + static const bool retval[FeatureCount] = { + false, false, false, false, false, false, + true, // SubgroupBalloFindLSB_MSB + false, false, false, false, + true, // SubgroupMemBarrier - replaced with workgroup memory barriers + false, false, true, false, + false, false, false, false, false, false, // iadd, fadd + false, false, false, false, false, false, // imul , fmul + }; return retval[feature]; } @@ -17755,7 +18166,11 @@ CompilerGLSL::ShaderSubgroupSupportHelper::Candidate CompilerGLSL::ShaderSubgrou KHR_shader_subgroup_ballot, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_vote, KHR_shader_subgroup_vote, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, - KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot + KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, }; return extensions[feature]; @@ -17851,6 +18266,19 @@ CompilerGLSL::ShaderSubgroupSupportHelper::CandidateVector CompilerGLSL::ShaderS return { NV_shader_thread_group }; case SubgroupBallotBitCount: return {}; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulExclusiveScan: + case SubgroupArithmeticFMulInclusiveScan: + return { KHR_shader_subgroup_arithmetic, NV_shader_thread_shuffle }; default: return {}; } @@ -17875,6 +18303,7 @@ CompilerGLSL::ShaderSubgroupSupportHelper::Result::Result() weights[KHR_shader_subgroup_ballot] = big_num; weights[KHR_shader_subgroup_basic] = big_num; weights[KHR_shader_subgroup_vote] = big_num; + weights[KHR_shader_subgroup_arithmetic] = big_num; } void CompilerGLSL::request_workaround_wrapper_overload(TypeID id) diff --git a/third_party/spirv-cross/spirv_glsl.cpp.orig b/third_party/spirv-cross/spirv_glsl.cpp.orig new file mode 100644 index 0000000000..f2104ff856 --- /dev/null +++ b/third_party/spirv-cross/spirv_glsl.cpp.orig @@ -0,0 +1,18524 @@ +/* + * Copyright 2015-2021 Arm Limited + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * At your option, you may choose to accept this material under either: + * 1. The Apache License, Version 2.0, found at , or + * 2. The MIT License, found at . + */ + +#include "spirv_glsl.hpp" +#include "GLSL.std.450.h" +#include "spirv_common.hpp" +#include +#include +#include +#include +#include +#include +#include + +#ifndef _WIN32 +#include +#endif +#include + +using namespace spv; +using namespace SPIRV_CROSS_NAMESPACE; +using namespace std; + +enum ExtraSubExpressionType +{ + // Create masks above any legal ID range to allow multiple address spaces into the extra_sub_expressions map. + EXTRA_SUB_EXPRESSION_TYPE_STREAM_OFFSET = 0x10000000, + EXTRA_SUB_EXPRESSION_TYPE_AUX = 0x20000000 +}; + +static bool is_unsigned_opcode(Op op) +{ + // Don't have to be exhaustive, only relevant for legacy target checking ... + switch (op) + { + case OpShiftRightLogical: + case OpUGreaterThan: + case OpUGreaterThanEqual: + case OpULessThan: + case OpULessThanEqual: + case OpUConvert: + case OpUDiv: + case OpUMod: + case OpUMulExtended: + case OpConvertUToF: + case OpConvertFToU: + return true; + + default: + return false; + } +} + +static bool is_unsigned_glsl_opcode(GLSLstd450 op) +{ + // Don't have to be exhaustive, only relevant for legacy target checking ... + switch (op) + { + case GLSLstd450UClamp: + case GLSLstd450UMin: + case GLSLstd450UMax: + case GLSLstd450FindUMsb: + return true; + + default: + return false; + } +} + +static bool packing_is_vec4_padded(BufferPackingStandard packing) +{ + switch (packing) + { + case BufferPackingHLSLCbuffer: + case BufferPackingHLSLCbufferPackOffset: + case BufferPackingStd140: + case BufferPackingStd140EnhancedLayout: + return true; + + default: + return false; + } +} + +static bool packing_is_hlsl(BufferPackingStandard packing) +{ + switch (packing) + { + case BufferPackingHLSLCbuffer: + case BufferPackingHLSLCbufferPackOffset: + return true; + + default: + return false; + } +} + +static bool packing_has_flexible_offset(BufferPackingStandard packing) +{ + switch (packing) + { + case BufferPackingStd140: + case BufferPackingStd430: + case BufferPackingScalar: + case BufferPackingHLSLCbuffer: + return false; + + default: + return true; + } +} + +static bool packing_is_scalar(BufferPackingStandard packing) +{ + switch (packing) + { + case BufferPackingScalar: + case BufferPackingScalarEnhancedLayout: + return true; + + default: + return false; + } +} + +static BufferPackingStandard packing_to_substruct_packing(BufferPackingStandard packing) +{ + switch (packing) + { + case BufferPackingStd140EnhancedLayout: + return BufferPackingStd140; + case BufferPackingStd430EnhancedLayout: + return BufferPackingStd430; + case BufferPackingHLSLCbufferPackOffset: + return BufferPackingHLSLCbuffer; + case BufferPackingScalarEnhancedLayout: + return BufferPackingScalar; + default: + return packing; + } +} + +void CompilerGLSL::init() +{ + if (ir.source.known) + { + options.es = ir.source.es; + options.version = ir.source.version; + } + + // Query the locale to see what the decimal point is. + // We'll rely on fixing it up ourselves in the rare case we have a comma-as-decimal locale + // rather than setting locales ourselves. Settings locales in a safe and isolated way is rather + // tricky. +#ifdef _WIN32 + // On Windows, localeconv uses thread-local storage, so it should be fine. + const struct lconv *conv = localeconv(); + if (conv && conv->decimal_point) + current_locale_radix_character = *conv->decimal_point; +#elif defined(__ANDROID__) && __ANDROID_API__ < 26 + // nl_langinfo is not supported on this platform, fall back to the worse alternative. + const struct lconv *conv = localeconv(); + if (conv && conv->decimal_point) + current_locale_radix_character = *conv->decimal_point; +#else + // localeconv, the portable function is not MT safe ... + const char *decimal_point = nl_langinfo(RADIXCHAR); + if (decimal_point && *decimal_point != '\0') + current_locale_radix_character = *decimal_point; +#endif +} + +static const char *to_pls_layout(PlsFormat format) +{ + switch (format) + { + case PlsR11FG11FB10F: + return "layout(r11f_g11f_b10f) "; + case PlsR32F: + return "layout(r32f) "; + case PlsRG16F: + return "layout(rg16f) "; + case PlsRGB10A2: + return "layout(rgb10_a2) "; + case PlsRGBA8: + return "layout(rgba8) "; + case PlsRG16: + return "layout(rg16) "; + case PlsRGBA8I: + return "layout(rgba8i)"; + case PlsRG16I: + return "layout(rg16i) "; + case PlsRGB10A2UI: + return "layout(rgb10_a2ui) "; + case PlsRGBA8UI: + return "layout(rgba8ui) "; + case PlsRG16UI: + return "layout(rg16ui) "; + case PlsR32UI: + return "layout(r32ui) "; + default: + return ""; + } +} + +static SPIRType::BaseType pls_format_to_basetype(PlsFormat format) +{ + switch (format) + { + default: + case PlsR11FG11FB10F: + case PlsR32F: + case PlsRG16F: + case PlsRGB10A2: + case PlsRGBA8: + case PlsRG16: + return SPIRType::Float; + + case PlsRGBA8I: + case PlsRG16I: + return SPIRType::Int; + + case PlsRGB10A2UI: + case PlsRGBA8UI: + case PlsRG16UI: + case PlsR32UI: + return SPIRType::UInt; + } +} + +static uint32_t pls_format_to_components(PlsFormat format) +{ + switch (format) + { + default: + case PlsR32F: + case PlsR32UI: + return 1; + + case PlsRG16F: + case PlsRG16: + case PlsRG16UI: + case PlsRG16I: + return 2; + + case PlsR11FG11FB10F: + return 3; + + case PlsRGB10A2: + case PlsRGBA8: + case PlsRGBA8I: + case PlsRGB10A2UI: + case PlsRGBA8UI: + return 4; + } +} + +const char *CompilerGLSL::vector_swizzle(int vecsize, int index) +{ + static const char *const swizzle[4][4] = { + { ".x", ".y", ".z", ".w" }, + { ".xy", ".yz", ".zw", nullptr }, + { ".xyz", ".yzw", nullptr, nullptr }, +#if defined(__GNUC__) && (__GNUC__ == 9) + // This works around a GCC 9 bug, see details in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90947. + // This array ends up being compiled as all nullptrs, tripping the assertions below. + { "", nullptr, nullptr, "$" }, +#else + { "", nullptr, nullptr, nullptr }, +#endif + }; + + assert(vecsize >= 1 && vecsize <= 4); + assert(index >= 0 && index < 4); + assert(swizzle[vecsize - 1][index]); + + return swizzle[vecsize - 1][index]; +} + +void CompilerGLSL::reset(uint32_t iteration_count) +{ + // Sanity check the iteration count to be robust against a certain class of bugs where + // we keep forcing recompilations without making clear forward progress. + // In buggy situations we will loop forever, or loop for an unbounded number of iterations. + // Certain types of recompilations are considered to make forward progress, + // but in almost all situations, we'll never see more than 3 iterations. + // It is highly context-sensitive when we need to force recompilation, + // and it is not practical with the current architecture + // to resolve everything up front. + if (iteration_count >= options.force_recompile_max_debug_iterations && !is_force_recompile_forward_progress) + SPIRV_CROSS_THROW("Maximum compilation loops detected and no forward progress was made. Must be a SPIRV-Cross bug!"); + + // We do some speculative optimizations which should pretty much always work out, + // but just in case the SPIR-V is rather weird, recompile until it's happy. + // This typically only means one extra pass. + clear_force_recompile(); + + // Clear invalid expression tracking. + invalid_expressions.clear(); + composite_insert_overwritten.clear(); + current_function = nullptr; + + // Clear temporary usage tracking. + expression_usage_counts.clear(); + forwarded_temporaries.clear(); + suppressed_usage_tracking.clear(); + + // Ensure that we declare phi-variable copies even if the original declaration isn't deferred + flushed_phi_variables.clear(); + + current_emitting_switch_stack.clear(); + + reset_name_caches(); + + ir.for_each_typed_id([&](uint32_t, SPIRFunction &func) { + func.active = false; + func.flush_undeclared = true; + }); + + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { var.dependees.clear(); }); + + ir.reset_all_of_type(); + ir.reset_all_of_type(); + + statement_count = 0; + indent = 0; + current_loop_level = 0; +} + +void CompilerGLSL::remap_pls_variables() +{ + for (auto &input : pls_inputs) + { + auto &var = get(input.id); + + bool input_is_target = false; + if (var.storage == StorageClassUniformConstant) + { + auto &type = get(var.basetype); + input_is_target = type.image.dim == DimSubpassData; + } + + if (var.storage != StorageClassInput && !input_is_target) + SPIRV_CROSS_THROW("Can only use in and target variables for PLS inputs."); + var.remapped_variable = true; + } + + for (auto &output : pls_outputs) + { + auto &var = get(output.id); + if (var.storage != StorageClassOutput) + SPIRV_CROSS_THROW("Can only use out variables for PLS outputs."); + var.remapped_variable = true; + } +} + +void CompilerGLSL::remap_ext_framebuffer_fetch(uint32_t input_attachment_index, uint32_t color_location, bool coherent) +{ + subpass_to_framebuffer_fetch_attachment.push_back({ input_attachment_index, color_location }); + inout_color_attachments.push_back({ color_location, coherent }); +} + +bool CompilerGLSL::location_is_framebuffer_fetch(uint32_t location) const +{ + return std::find_if(begin(inout_color_attachments), end(inout_color_attachments), + [&](const std::pair &elem) { + return elem.first == location; + }) != end(inout_color_attachments); +} + +bool CompilerGLSL::location_is_non_coherent_framebuffer_fetch(uint32_t location) const +{ + return std::find_if(begin(inout_color_attachments), end(inout_color_attachments), + [&](const std::pair &elem) { + return elem.first == location && !elem.second; + }) != end(inout_color_attachments); +} + +void CompilerGLSL::find_static_extensions() +{ + ir.for_each_typed_id([&](uint32_t, const SPIRType &type) { + if (type.basetype == SPIRType::Double) + { + if (options.es) + SPIRV_CROSS_THROW("FP64 not supported in ES profile."); + if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_gpu_shader_fp64"); + } + else if (type.basetype == SPIRType::Int64 || type.basetype == SPIRType::UInt64) + { + if (options.es && options.version < 310) // GL_NV_gpu_shader5 fallback requires 310. + SPIRV_CROSS_THROW("64-bit integers not supported in ES profile before version 310."); + require_extension_internal("GL_ARB_gpu_shader_int64"); + } + else if (type.basetype == SPIRType::Half) + { + require_extension_internal("GL_EXT_shader_explicit_arithmetic_types_float16"); + if (options.vulkan_semantics) + require_extension_internal("GL_EXT_shader_16bit_storage"); + } + else if (type.basetype == SPIRType::SByte || type.basetype == SPIRType::UByte) + { + require_extension_internal("GL_EXT_shader_explicit_arithmetic_types_int8"); + if (options.vulkan_semantics) + require_extension_internal("GL_EXT_shader_8bit_storage"); + } + else if (type.basetype == SPIRType::Short || type.basetype == SPIRType::UShort) + { + require_extension_internal("GL_EXT_shader_explicit_arithmetic_types_int16"); + if (options.vulkan_semantics) + require_extension_internal("GL_EXT_shader_16bit_storage"); + } + }); + + auto &execution = get_entry_point(); + switch (execution.model) + { + case ExecutionModelGLCompute: + if (!options.es && options.version < 430) + require_extension_internal("GL_ARB_compute_shader"); + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for compute shaders."); + break; + + case ExecutionModelGeometry: + if (options.es && options.version < 320) + require_extension_internal("GL_EXT_geometry_shader"); + if (!options.es && options.version < 150) + require_extension_internal("GL_ARB_geometry_shader4"); + + if (execution.flags.get(ExecutionModeInvocations) && execution.invocations != 1) + { + // Instanced GS is part of 400 core or this extension. + if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_gpu_shader5"); + } + break; + + case ExecutionModelTessellationEvaluation: + case ExecutionModelTessellationControl: + if (options.es && options.version < 320) + require_extension_internal("GL_EXT_tessellation_shader"); + if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_tessellation_shader"); + break; + + case ExecutionModelRayGenerationKHR: + case ExecutionModelIntersectionKHR: + case ExecutionModelAnyHitKHR: + case ExecutionModelClosestHitKHR: + case ExecutionModelMissKHR: + case ExecutionModelCallableKHR: + // NV enums are aliases. + if (options.es || options.version < 460) + SPIRV_CROSS_THROW("Ray tracing shaders require non-es profile with version 460 or above."); + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Ray tracing requires Vulkan semantics."); + + // Need to figure out if we should target KHR or NV extension based on capabilities. + for (auto &cap : ir.declared_capabilities) + { + if (cap == CapabilityRayTracingKHR || cap == CapabilityRayQueryKHR || + cap == CapabilityRayTraversalPrimitiveCullingKHR) + { + ray_tracing_is_khr = true; + break; + } + } + + if (ray_tracing_is_khr) + { + // In KHR ray tracing we pass payloads by pointer instead of location, + // so make sure we assign locations properly. + ray_tracing_khr_fixup_locations(); + require_extension_internal("GL_EXT_ray_tracing"); + } + else + require_extension_internal("GL_NV_ray_tracing"); + break; + + case ExecutionModelMeshEXT: + case ExecutionModelTaskEXT: + if (options.es || options.version < 450) + SPIRV_CROSS_THROW("Mesh shaders require GLSL 450 or above."); + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Mesh shaders require Vulkan semantics."); + require_extension_internal("GL_EXT_mesh_shader"); + break; + + default: + break; + } + + if (!pls_inputs.empty() || !pls_outputs.empty()) + { + if (execution.model != ExecutionModelFragment) + SPIRV_CROSS_THROW("Can only use GL_EXT_shader_pixel_local_storage in fragment shaders."); + require_extension_internal("GL_EXT_shader_pixel_local_storage"); + } + + if (!inout_color_attachments.empty()) + { + if (execution.model != ExecutionModelFragment) + SPIRV_CROSS_THROW("Can only use GL_EXT_shader_framebuffer_fetch in fragment shaders."); + if (options.vulkan_semantics) + SPIRV_CROSS_THROW("Cannot use EXT_shader_framebuffer_fetch in Vulkan GLSL."); + + bool has_coherent = false; + bool has_incoherent = false; + + for (auto &att : inout_color_attachments) + { + if (att.second) + has_coherent = true; + else + has_incoherent = true; + } + + if (has_coherent) + require_extension_internal("GL_EXT_shader_framebuffer_fetch"); + if (has_incoherent) + require_extension_internal("GL_EXT_shader_framebuffer_fetch_non_coherent"); + } + + if (options.separate_shader_objects && !options.es && options.version < 410) + require_extension_internal("GL_ARB_separate_shader_objects"); + + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("GL_EXT_buffer_reference is only supported in Vulkan GLSL."); + if (options.es && options.version < 320) + SPIRV_CROSS_THROW("GL_EXT_buffer_reference requires ESSL 320."); + else if (!options.es && options.version < 450) + SPIRV_CROSS_THROW("GL_EXT_buffer_reference requires GLSL 450."); + require_extension_internal("GL_EXT_buffer_reference"); + } + else if (ir.addressing_model != AddressingModelLogical) + { + SPIRV_CROSS_THROW("Only Logical and PhysicalStorageBuffer64EXT addressing models are supported."); + } + + // Check for nonuniform qualifier and passthrough. + // Instead of looping over all decorations to find this, just look at capabilities. + for (auto &cap : ir.declared_capabilities) + { + switch (cap) + { + case CapabilityShaderNonUniformEXT: + if (!options.vulkan_semantics) + require_extension_internal("GL_NV_gpu_shader5"); + else + require_extension_internal("GL_EXT_nonuniform_qualifier"); + break; + case CapabilityRuntimeDescriptorArrayEXT: + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("GL_EXT_nonuniform_qualifier is only supported in Vulkan GLSL."); + require_extension_internal("GL_EXT_nonuniform_qualifier"); + break; + + case CapabilityGeometryShaderPassthroughNV: + if (execution.model == ExecutionModelGeometry) + { + require_extension_internal("GL_NV_geometry_shader_passthrough"); + execution.geometry_passthrough = true; + } + break; + + case CapabilityVariablePointers: + case CapabilityVariablePointersStorageBuffer: + SPIRV_CROSS_THROW("VariablePointers capability is not supported in GLSL."); + + case CapabilityMultiView: + if (options.vulkan_semantics) + require_extension_internal("GL_EXT_multiview"); + else + { + require_extension_internal("GL_OVR_multiview2"); + if (options.ovr_multiview_view_count == 0) + SPIRV_CROSS_THROW("ovr_multiview_view_count must be non-zero when using GL_OVR_multiview2."); + if (get_execution_model() != ExecutionModelVertex) + SPIRV_CROSS_THROW("OVR_multiview2 can only be used with Vertex shaders."); + } + break; + + case CapabilityRayQueryKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("RayQuery requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_query"); + ray_tracing_is_khr = true; + break; + + case CapabilityRayTraversalPrimitiveCullingKHR: + if (options.es || options.version < 460 || !options.vulkan_semantics) + SPIRV_CROSS_THROW("RayQuery requires Vulkan GLSL 460."); + require_extension_internal("GL_EXT_ray_flags_primitive_culling"); + ray_tracing_is_khr = true; + break; + + default: + break; + } + } + + if (options.ovr_multiview_view_count) + { + if (options.vulkan_semantics) + SPIRV_CROSS_THROW("OVR_multiview2 cannot be used with Vulkan semantics."); + if (get_execution_model() != ExecutionModelVertex) + SPIRV_CROSS_THROW("OVR_multiview2 can only be used with Vertex shaders."); + require_extension_internal("GL_OVR_multiview2"); + } + + // KHR one is likely to get promoted at some point, so if we don't see an explicit SPIR-V extension, assume KHR. + for (auto &ext : ir.declared_extensions) + if (ext == "SPV_NV_fragment_shader_barycentric") + barycentric_is_nv = true; +} + +void CompilerGLSL::require_polyfill(Polyfill polyfill, bool relaxed) +{ + uint32_t &polyfills = (relaxed && options.es) ? required_polyfills_relaxed : required_polyfills; + + if ((polyfills & polyfill) == 0) + { + polyfills |= polyfill; + force_recompile(); + } +} + +void CompilerGLSL::ray_tracing_khr_fixup_locations() +{ + uint32_t location = 0; + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + // Incoming payload storage can also be used for tracing. + if (var.storage != StorageClassRayPayloadKHR && var.storage != StorageClassCallableDataKHR && + var.storage != StorageClassIncomingRayPayloadKHR && var.storage != StorageClassIncomingCallableDataKHR) + return; + if (is_hidden_variable(var)) + return; + set_decoration(var.self, DecorationLocation, location++); + }); +} + +string CompilerGLSL::compile() +{ + ir.fixup_reserved_names(); + + if (!options.vulkan_semantics) + { + // only NV_gpu_shader5 supports divergent indexing on OpenGL, and it does so without extra qualifiers + backend.nonuniform_qualifier = ""; + backend.needs_row_major_load_workaround = options.enable_row_major_load_workaround; + } + backend.allow_precision_qualifiers = options.vulkan_semantics || options.es; + backend.force_gl_in_out_block = true; + backend.supports_extensions = true; + backend.use_array_constructor = true; + backend.workgroup_size_is_hidden = true; + backend.requires_relaxed_precision_analysis = options.es || options.vulkan_semantics; + backend.support_precise_qualifier = + (!options.es && options.version >= 400) || (options.es && options.version >= 320); + + if (is_legacy_es()) + backend.support_case_fallthrough = false; + + // Scan the SPIR-V to find trivial uses of extensions. + fixup_anonymous_struct_names(); + fixup_type_alias(); + reorder_type_alias(); + build_function_control_flow_graphs_and_analyze(); + find_static_extensions(); + fixup_image_load_store_access(); + update_active_builtins(); + analyze_image_and_sampler_usage(); + analyze_interlocked_resource_usage(); + if (!inout_color_attachments.empty()) + emit_inout_fragment_outputs_copy_to_subpass_inputs(); + + // Shaders might cast unrelated data to pointers of non-block types. + // Find all such instances and make sure we can cast the pointers to a synthesized block type. + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + analyze_non_block_pointer_types(); + + uint32_t pass_count = 0; + do + { + reset(pass_count); + + buffer.reset(); + + emit_header(); + emit_resources(); + emit_extension_workarounds(get_execution_model()); + + if (required_polyfills != 0) + emit_polyfills(required_polyfills, false); + if (options.es && required_polyfills_relaxed != 0) + emit_polyfills(required_polyfills_relaxed, true); + + emit_function(get(ir.default_entry_point), Bitset()); + + pass_count++; + } while (is_forcing_recompilation()); + + // Implement the interlocked wrapper function at the end. + // The body was implemented in lieu of main(). + if (interlocked_is_complex) + { + statement("void main()"); + begin_scope(); + statement("// Interlocks were used in a way not compatible with GLSL, this is very slow."); + statement("SPIRV_Cross_beginInvocationInterlock();"); + statement("spvMainInterlockedBody();"); + statement("SPIRV_Cross_endInvocationInterlock();"); + end_scope(); + } + + // Entry point in GLSL is always main(). + get_entry_point().name = "main"; + + return buffer.str(); +} + +std::string CompilerGLSL::get_partial_source() +{ + return buffer.str(); +} + +void CompilerGLSL::build_workgroup_size(SmallVector &arguments, const SpecializationConstant &wg_x, + const SpecializationConstant &wg_y, const SpecializationConstant &wg_z) +{ + auto &execution = get_entry_point(); + bool builtin_workgroup = execution.workgroup_size.constant != 0; + bool use_local_size_id = !builtin_workgroup && execution.flags.get(ExecutionModeLocalSizeId); + + if (wg_x.id) + { + if (options.vulkan_semantics) + arguments.push_back(join("local_size_x_id = ", wg_x.constant_id)); + else + arguments.push_back(join("local_size_x = ", get(wg_x.id).specialization_constant_macro_name)); + } + else if (use_local_size_id && execution.workgroup_size.id_x) + arguments.push_back(join("local_size_x = ", get(execution.workgroup_size.id_x).scalar())); + else + arguments.push_back(join("local_size_x = ", execution.workgroup_size.x)); + + if (wg_y.id) + { + if (options.vulkan_semantics) + arguments.push_back(join("local_size_y_id = ", wg_y.constant_id)); + else + arguments.push_back(join("local_size_y = ", get(wg_y.id).specialization_constant_macro_name)); + } + else if (use_local_size_id && execution.workgroup_size.id_y) + arguments.push_back(join("local_size_y = ", get(execution.workgroup_size.id_y).scalar())); + else + arguments.push_back(join("local_size_y = ", execution.workgroup_size.y)); + + if (wg_z.id) + { + if (options.vulkan_semantics) + arguments.push_back(join("local_size_z_id = ", wg_z.constant_id)); + else + arguments.push_back(join("local_size_z = ", get(wg_z.id).specialization_constant_macro_name)); + } + else if (use_local_size_id && execution.workgroup_size.id_z) + arguments.push_back(join("local_size_z = ", get(execution.workgroup_size.id_z).scalar())); + else + arguments.push_back(join("local_size_z = ", execution.workgroup_size.z)); +} + +void CompilerGLSL::request_subgroup_feature(ShaderSubgroupSupportHelper::Feature feature) +{ + if (options.vulkan_semantics) + { + auto khr_extension = ShaderSubgroupSupportHelper::get_KHR_extension_for_feature(feature); + require_extension_internal(ShaderSubgroupSupportHelper::get_extension_name(khr_extension)); + } + else + { + if (!shader_subgroup_supporter.is_feature_requested(feature)) + force_recompile(); + shader_subgroup_supporter.request_feature(feature); + } +} + +void CompilerGLSL::emit_header() +{ + auto &execution = get_entry_point(); + statement("#version ", options.version, options.es && options.version > 100 ? " es" : ""); + + if (!options.es && options.version < 420) + { + // Needed for binding = # on UBOs, etc. + if (options.enable_420pack_extension) + { + statement("#ifdef GL_ARB_shading_language_420pack"); + statement("#extension GL_ARB_shading_language_420pack : require"); + statement("#endif"); + } + // Needed for: layout(early_fragment_tests) in; + if (execution.flags.get(ExecutionModeEarlyFragmentTests)) + require_extension_internal("GL_ARB_shader_image_load_store"); + } + + // Needed for: layout(post_depth_coverage) in; + if (execution.flags.get(ExecutionModePostDepthCoverage)) + require_extension_internal("GL_ARB_post_depth_coverage"); + + // Needed for: layout({pixel,sample}_interlock_[un]ordered) in; + bool interlock_used = execution.flags.get(ExecutionModePixelInterlockOrderedEXT) || + execution.flags.get(ExecutionModePixelInterlockUnorderedEXT) || + execution.flags.get(ExecutionModeSampleInterlockOrderedEXT) || + execution.flags.get(ExecutionModeSampleInterlockUnorderedEXT); + + if (interlock_used) + { + if (options.es) + { + if (options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for fragment shader interlock."); + require_extension_internal("GL_NV_fragment_shader_interlock"); + } + else + { + if (options.version < 420) + require_extension_internal("GL_ARB_shader_image_load_store"); + require_extension_internal("GL_ARB_fragment_shader_interlock"); + } + } + + for (auto &ext : forced_extensions) + { + if (ext == "GL_ARB_gpu_shader_int64") + { + statement("#if defined(GL_ARB_gpu_shader_int64)"); + statement("#extension GL_ARB_gpu_shader_int64 : require"); + if (!options.vulkan_semantics || options.es) + { + statement("#elif defined(GL_NV_gpu_shader5)"); + statement("#extension GL_NV_gpu_shader5 : require"); + } + statement("#else"); + statement("#error No extension available for 64-bit integers."); + statement("#endif"); + } + else if (ext == "GL_EXT_shader_explicit_arithmetic_types_float16") + { + // Special case, this extension has a potential fallback to another vendor extension in normal GLSL. + // GL_AMD_gpu_shader_half_float is a superset, so try that first. + statement("#if defined(GL_AMD_gpu_shader_half_float)"); + statement("#extension GL_AMD_gpu_shader_half_float : require"); + if (!options.vulkan_semantics) + { + statement("#elif defined(GL_NV_gpu_shader5)"); + statement("#extension GL_NV_gpu_shader5 : require"); + } + else + { + statement("#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16)"); + statement("#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require"); + } + statement("#else"); + statement("#error No extension available for FP16."); + statement("#endif"); + } + else if (ext == "GL_EXT_shader_explicit_arithmetic_types_int8") + { + if (options.vulkan_semantics) + statement("#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require"); + else + { + statement("#if defined(GL_EXT_shader_explicit_arithmetic_types_int8)"); + statement("#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require"); + statement("#elif defined(GL_NV_gpu_shader5)"); + statement("#extension GL_NV_gpu_shader5 : require"); + statement("#else"); + statement("#error No extension available for Int8."); + statement("#endif"); + } + } + else if (ext == "GL_EXT_shader_explicit_arithmetic_types_int16") + { + if (options.vulkan_semantics) + statement("#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require"); + else + { + statement("#if defined(GL_EXT_shader_explicit_arithmetic_types_int16)"); + statement("#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require"); + statement("#elif defined(GL_AMD_gpu_shader_int16)"); + statement("#extension GL_AMD_gpu_shader_int16 : require"); + statement("#elif defined(GL_NV_gpu_shader5)"); + statement("#extension GL_NV_gpu_shader5 : require"); + statement("#else"); + statement("#error No extension available for Int16."); + statement("#endif"); + } + } + else if (ext == "GL_ARB_post_depth_coverage") + { + if (options.es) + statement("#extension GL_EXT_post_depth_coverage : require"); + else + { + statement("#if defined(GL_ARB_post_depth_coverge)"); + statement("#extension GL_ARB_post_depth_coverage : require"); + statement("#else"); + statement("#extension GL_EXT_post_depth_coverage : require"); + statement("#endif"); + } + } + else if (!options.vulkan_semantics && ext == "GL_ARB_shader_draw_parameters") + { + // Soft-enable this extension on plain GLSL. + statement("#ifdef ", ext); + statement("#extension ", ext, " : enable"); + statement("#endif"); + } + else if (ext == "GL_EXT_control_flow_attributes") + { + // These are just hints so we can conditionally enable and fallback in the shader. + statement("#if defined(GL_EXT_control_flow_attributes)"); + statement("#extension GL_EXT_control_flow_attributes : require"); + statement("#define SPIRV_CROSS_FLATTEN [[flatten]]"); + statement("#define SPIRV_CROSS_BRANCH [[dont_flatten]]"); + statement("#define SPIRV_CROSS_UNROLL [[unroll]]"); + statement("#define SPIRV_CROSS_LOOP [[dont_unroll]]"); + statement("#else"); + statement("#define SPIRV_CROSS_FLATTEN"); + statement("#define SPIRV_CROSS_BRANCH"); + statement("#define SPIRV_CROSS_UNROLL"); + statement("#define SPIRV_CROSS_LOOP"); + statement("#endif"); + } + else if (ext == "GL_NV_fragment_shader_interlock") + { + statement("#extension GL_NV_fragment_shader_interlock : require"); + statement("#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockNV()"); + statement("#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockNV()"); + } + else if (ext == "GL_ARB_fragment_shader_interlock") + { + statement("#ifdef GL_ARB_fragment_shader_interlock"); + statement("#extension GL_ARB_fragment_shader_interlock : enable"); + statement("#define SPIRV_Cross_beginInvocationInterlock() beginInvocationInterlockARB()"); + statement("#define SPIRV_Cross_endInvocationInterlock() endInvocationInterlockARB()"); + statement("#elif defined(GL_INTEL_fragment_shader_ordering)"); + statement("#extension GL_INTEL_fragment_shader_ordering : enable"); + statement("#define SPIRV_Cross_beginInvocationInterlock() beginFragmentShaderOrderingINTEL()"); + statement("#define SPIRV_Cross_endInvocationInterlock()"); + statement("#endif"); + } + else + statement("#extension ", ext, " : require"); + } + + if (!options.vulkan_semantics) + { + using Supp = ShaderSubgroupSupportHelper; + auto result = shader_subgroup_supporter.resolve(); + + for (uint32_t feature_index = 0; feature_index < Supp::FeatureCount; feature_index++) + { + auto feature = static_cast(feature_index); + if (!shader_subgroup_supporter.is_feature_requested(feature)) + continue; + + auto exts = Supp::get_candidates_for_feature(feature, result); + if (exts.empty()) + continue; + + statement(""); + + for (auto &ext : exts) + { + const char *name = Supp::get_extension_name(ext); + const char *extra_predicate = Supp::get_extra_required_extension_predicate(ext); + auto extra_names = Supp::get_extra_required_extension_names(ext); + statement(&ext != &exts.front() ? "#elif" : "#if", " defined(", name, ")", + (*extra_predicate != '\0' ? " && " : ""), extra_predicate); + for (const auto &e : extra_names) + statement("#extension ", e, " : enable"); + statement("#extension ", name, " : require"); + } + + if (!Supp::can_feature_be_implemented_without_extensions(feature)) + { + statement("#else"); + statement("#error No extensions available to emulate requested subgroup feature."); + } + + statement("#endif"); + } + } + + for (auto &header : header_lines) + statement(header); + + SmallVector inputs; + SmallVector outputs; + + switch (execution.model) + { + case ExecutionModelVertex: + if (options.ovr_multiview_view_count) + inputs.push_back(join("num_views = ", options.ovr_multiview_view_count)); + break; + case ExecutionModelGeometry: + if ((execution.flags.get(ExecutionModeInvocations)) && execution.invocations != 1) + inputs.push_back(join("invocations = ", execution.invocations)); + if (execution.flags.get(ExecutionModeInputPoints)) + inputs.push_back("points"); + if (execution.flags.get(ExecutionModeInputLines)) + inputs.push_back("lines"); + if (execution.flags.get(ExecutionModeInputLinesAdjacency)) + inputs.push_back("lines_adjacency"); + if (execution.flags.get(ExecutionModeTriangles)) + inputs.push_back("triangles"); + if (execution.flags.get(ExecutionModeInputTrianglesAdjacency)) + inputs.push_back("triangles_adjacency"); + + if (!execution.geometry_passthrough) + { + // For passthrough, these are implies and cannot be declared in shader. + outputs.push_back(join("max_vertices = ", execution.output_vertices)); + if (execution.flags.get(ExecutionModeOutputTriangleStrip)) + outputs.push_back("triangle_strip"); + if (execution.flags.get(ExecutionModeOutputPoints)) + outputs.push_back("points"); + if (execution.flags.get(ExecutionModeOutputLineStrip)) + outputs.push_back("line_strip"); + } + break; + + case ExecutionModelTessellationControl: + if (execution.flags.get(ExecutionModeOutputVertices)) + outputs.push_back(join("vertices = ", execution.output_vertices)); + break; + + case ExecutionModelTessellationEvaluation: + if (execution.flags.get(ExecutionModeQuads)) + inputs.push_back("quads"); + if (execution.flags.get(ExecutionModeTriangles)) + inputs.push_back("triangles"); + if (execution.flags.get(ExecutionModeIsolines)) + inputs.push_back("isolines"); + if (execution.flags.get(ExecutionModePointMode)) + inputs.push_back("point_mode"); + + if (!execution.flags.get(ExecutionModeIsolines)) + { + if (execution.flags.get(ExecutionModeVertexOrderCw)) + inputs.push_back("cw"); + if (execution.flags.get(ExecutionModeVertexOrderCcw)) + inputs.push_back("ccw"); + } + + if (execution.flags.get(ExecutionModeSpacingFractionalEven)) + inputs.push_back("fractional_even_spacing"); + if (execution.flags.get(ExecutionModeSpacingFractionalOdd)) + inputs.push_back("fractional_odd_spacing"); + if (execution.flags.get(ExecutionModeSpacingEqual)) + inputs.push_back("equal_spacing"); + break; + + case ExecutionModelGLCompute: + case ExecutionModelTaskEXT: + case ExecutionModelMeshEXT: + { + if (execution.workgroup_size.constant != 0 || execution.flags.get(ExecutionModeLocalSizeId)) + { + SpecializationConstant wg_x, wg_y, wg_z; + get_work_group_size_specialization_constants(wg_x, wg_y, wg_z); + + // If there are any spec constants on legacy GLSL, defer declaration, we need to set up macro + // declarations before we can emit the work group size. + if (options.vulkan_semantics || + ((wg_x.id == ConstantID(0)) && (wg_y.id == ConstantID(0)) && (wg_z.id == ConstantID(0)))) + build_workgroup_size(inputs, wg_x, wg_y, wg_z); + } + else + { + inputs.push_back(join("local_size_x = ", execution.workgroup_size.x)); + inputs.push_back(join("local_size_y = ", execution.workgroup_size.y)); + inputs.push_back(join("local_size_z = ", execution.workgroup_size.z)); + } + + if (execution.model == ExecutionModelMeshEXT) + { + outputs.push_back(join("max_vertices = ", execution.output_vertices)); + outputs.push_back(join("max_primitives = ", execution.output_primitives)); + if (execution.flags.get(ExecutionModeOutputTrianglesEXT)) + outputs.push_back("triangles"); + else if (execution.flags.get(ExecutionModeOutputLinesEXT)) + outputs.push_back("lines"); + else if (execution.flags.get(ExecutionModeOutputPoints)) + outputs.push_back("points"); + } + break; + } + + case ExecutionModelFragment: + if (options.es) + { + switch (options.fragment.default_float_precision) + { + case Options::Lowp: + statement("precision lowp float;"); + break; + + case Options::Mediump: + statement("precision mediump float;"); + break; + + case Options::Highp: + statement("precision highp float;"); + break; + + default: + break; + } + + switch (options.fragment.default_int_precision) + { + case Options::Lowp: + statement("precision lowp int;"); + break; + + case Options::Mediump: + statement("precision mediump int;"); + break; + + case Options::Highp: + statement("precision highp int;"); + break; + + default: + break; + } + } + + if (execution.flags.get(ExecutionModeEarlyFragmentTests)) + inputs.push_back("early_fragment_tests"); + if (execution.flags.get(ExecutionModePostDepthCoverage)) + inputs.push_back("post_depth_coverage"); + + if (interlock_used) + statement("#if defined(GL_ARB_fragment_shader_interlock)"); + + if (execution.flags.get(ExecutionModePixelInterlockOrderedEXT)) + statement("layout(pixel_interlock_ordered) in;"); + else if (execution.flags.get(ExecutionModePixelInterlockUnorderedEXT)) + statement("layout(pixel_interlock_unordered) in;"); + else if (execution.flags.get(ExecutionModeSampleInterlockOrderedEXT)) + statement("layout(sample_interlock_ordered) in;"); + else if (execution.flags.get(ExecutionModeSampleInterlockUnorderedEXT)) + statement("layout(sample_interlock_unordered) in;"); + + if (interlock_used) + { + statement("#elif !defined(GL_INTEL_fragment_shader_ordering)"); + statement("#error Fragment Shader Interlock/Ordering extension missing!"); + statement("#endif"); + } + + if (!options.es && execution.flags.get(ExecutionModeDepthGreater)) + statement("layout(depth_greater) out float gl_FragDepth;"); + else if (!options.es && execution.flags.get(ExecutionModeDepthLess)) + statement("layout(depth_less) out float gl_FragDepth;"); + + break; + + default: + break; + } + + for (auto &cap : ir.declared_capabilities) + if (cap == CapabilityRayTraversalPrimitiveCullingKHR) + statement("layout(primitive_culling);"); + + if (!inputs.empty()) + statement("layout(", merge(inputs), ") in;"); + if (!outputs.empty()) + statement("layout(", merge(outputs), ") out;"); + + statement(""); +} + +bool CompilerGLSL::type_is_empty(const SPIRType &type) +{ + return type.basetype == SPIRType::Struct && type.member_types.empty(); +} + +void CompilerGLSL::emit_struct(SPIRType &type) +{ + // Struct types can be stamped out multiple times + // with just different offsets, matrix layouts, etc ... + // Type-punning with these types is legal, which complicates things + // when we are storing struct and array types in an SSBO for example. + // If the type master is packed however, we can no longer assume that the struct declaration will be redundant. + if (type.type_alias != TypeID(0) && + !has_extended_decoration(type.type_alias, SPIRVCrossDecorationBufferBlockRepacked)) + return; + + add_resource_name(type.self); + auto name = type_to_glsl(type); + + statement(!backend.explicit_struct_type ? "struct " : "", name); + begin_scope(); + + type.member_name_cache.clear(); + + uint32_t i = 0; + bool emitted = false; + for (auto &member : type.member_types) + { + add_member_name(type, i); + emit_struct_member(type, member, i); + i++; + emitted = true; + } + + // Don't declare empty structs in GLSL, this is not allowed. + if (type_is_empty(type) && !backend.supports_empty_struct) + { + statement("int empty_struct_member;"); + emitted = true; + } + + if (has_extended_decoration(type.self, SPIRVCrossDecorationPaddingTarget)) + emit_struct_padding_target(type); + + end_scope_decl(); + + if (emitted) + statement(""); +} + +string CompilerGLSL::to_interpolation_qualifiers(const Bitset &flags) +{ + string res; + //if (flags & (1ull << DecorationSmooth)) + // res += "smooth "; + if (flags.get(DecorationFlat)) + res += "flat "; + if (flags.get(DecorationNoPerspective)) + { + if (options.es) + { + if (options.version < 300) + SPIRV_CROSS_THROW("noperspective requires ESSL 300."); + require_extension_internal("GL_NV_shader_noperspective_interpolation"); + } + else if (is_legacy_desktop()) + require_extension_internal("GL_EXT_gpu_shader4"); + res += "noperspective "; + } + if (flags.get(DecorationCentroid)) + res += "centroid "; + if (flags.get(DecorationPatch)) + res += "patch "; + if (flags.get(DecorationSample)) + { + if (options.es) + { + if (options.version < 300) + SPIRV_CROSS_THROW("sample requires ESSL 300."); + else if (options.version < 320) + require_extension_internal("GL_OES_shader_multisample_interpolation"); + } + res += "sample "; + } + if (flags.get(DecorationInvariant) && (options.es || options.version >= 120)) + res += "invariant "; + if (flags.get(DecorationPerPrimitiveEXT)) + res += "perprimitiveEXT "; + + if (flags.get(DecorationExplicitInterpAMD)) + { + require_extension_internal("GL_AMD_shader_explicit_vertex_parameter"); + res += "__explicitInterpAMD "; + } + + if (flags.get(DecorationPerVertexKHR)) + { + if (options.es && options.version < 320) + SPIRV_CROSS_THROW("pervertexEXT requires ESSL 320."); + else if (!options.es && options.version < 450) + SPIRV_CROSS_THROW("pervertexEXT requires GLSL 450."); + + if (barycentric_is_nv) + { + require_extension_internal("GL_NV_fragment_shader_barycentric"); + res += "pervertexNV "; + } + else + { + require_extension_internal("GL_EXT_fragment_shader_barycentric"); + res += "pervertexEXT "; + } + } + + return res; +} + +string CompilerGLSL::layout_for_member(const SPIRType &type, uint32_t index) +{ + if (is_legacy()) + return ""; + + bool is_block = has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock); + if (!is_block) + return ""; + + auto &memb = ir.meta[type.self].members; + if (index >= memb.size()) + return ""; + auto &dec = memb[index]; + + SmallVector attr; + + if (has_member_decoration(type.self, index, DecorationPassthroughNV)) + attr.push_back("passthrough"); + + // We can only apply layouts on members in block interfaces. + // This is a bit problematic because in SPIR-V decorations are applied on the struct types directly. + // This is not supported on GLSL, so we have to make the assumption that if a struct within our buffer block struct + // has a decoration, it was originally caused by a top-level layout() qualifier in GLSL. + // + // We would like to go from (SPIR-V style): + // + // struct Foo { layout(row_major) mat4 matrix; }; + // buffer UBO { Foo foo; }; + // + // to + // + // struct Foo { mat4 matrix; }; // GLSL doesn't support any layout shenanigans in raw struct declarations. + // buffer UBO { layout(row_major) Foo foo; }; // Apply the layout on top-level. + auto flags = combined_decoration_for_member(type, index); + + if (flags.get(DecorationRowMajor)) + attr.push_back("row_major"); + // We don't emit any global layouts, so column_major is default. + //if (flags & (1ull << DecorationColMajor)) + // attr.push_back("column_major"); + + if (dec.decoration_flags.get(DecorationLocation) && can_use_io_location(type.storage, true)) + attr.push_back(join("location = ", dec.location)); + + // Can only declare component if we can declare location. + if (dec.decoration_flags.get(DecorationComponent) && can_use_io_location(type.storage, true)) + { + if (!options.es) + { + if (options.version < 440 && options.version >= 140) + require_extension_internal("GL_ARB_enhanced_layouts"); + else if (options.version < 140) + SPIRV_CROSS_THROW("Component decoration is not supported in targets below GLSL 1.40."); + attr.push_back(join("component = ", dec.component)); + } + else + SPIRV_CROSS_THROW("Component decoration is not supported in ES targets."); + } + + // SPIRVCrossDecorationPacked is set by layout_for_variable earlier to mark that we need to emit offset qualifiers. + // This is only done selectively in GLSL as needed. + if (has_extended_decoration(type.self, SPIRVCrossDecorationExplicitOffset) && + dec.decoration_flags.get(DecorationOffset)) + attr.push_back(join("offset = ", dec.offset)); + else if (type.storage == StorageClassOutput && dec.decoration_flags.get(DecorationOffset)) + attr.push_back(join("xfb_offset = ", dec.offset)); + + if (attr.empty()) + return ""; + + string res = "layout("; + res += merge(attr); + res += ") "; + return res; +} + +const char *CompilerGLSL::format_to_glsl(spv::ImageFormat format) +{ + if (options.es && is_desktop_only_format(format)) + SPIRV_CROSS_THROW("Attempting to use image format not supported in ES profile."); + + switch (format) + { + case ImageFormatRgba32f: + return "rgba32f"; + case ImageFormatRgba16f: + return "rgba16f"; + case ImageFormatR32f: + return "r32f"; + case ImageFormatRgba8: + return "rgba8"; + case ImageFormatRgba8Snorm: + return "rgba8_snorm"; + case ImageFormatRg32f: + return "rg32f"; + case ImageFormatRg16f: + return "rg16f"; + case ImageFormatRgba32i: + return "rgba32i"; + case ImageFormatRgba16i: + return "rgba16i"; + case ImageFormatR32i: + return "r32i"; + case ImageFormatRgba8i: + return "rgba8i"; + case ImageFormatRg32i: + return "rg32i"; + case ImageFormatRg16i: + return "rg16i"; + case ImageFormatRgba32ui: + return "rgba32ui"; + case ImageFormatRgba16ui: + return "rgba16ui"; + case ImageFormatR32ui: + return "r32ui"; + case ImageFormatRgba8ui: + return "rgba8ui"; + case ImageFormatRg32ui: + return "rg32ui"; + case ImageFormatRg16ui: + return "rg16ui"; + case ImageFormatR11fG11fB10f: + return "r11f_g11f_b10f"; + case ImageFormatR16f: + return "r16f"; + case ImageFormatRgb10A2: + return "rgb10_a2"; + case ImageFormatR8: + return "r8"; + case ImageFormatRg8: + return "rg8"; + case ImageFormatR16: + return "r16"; + case ImageFormatRg16: + return "rg16"; + case ImageFormatRgba16: + return "rgba16"; + case ImageFormatR16Snorm: + return "r16_snorm"; + case ImageFormatRg16Snorm: + return "rg16_snorm"; + case ImageFormatRgba16Snorm: + return "rgba16_snorm"; + case ImageFormatR8Snorm: + return "r8_snorm"; + case ImageFormatRg8Snorm: + return "rg8_snorm"; + case ImageFormatR8ui: + return "r8ui"; + case ImageFormatRg8ui: + return "rg8ui"; + case ImageFormatR16ui: + return "r16ui"; + case ImageFormatRgb10a2ui: + return "rgb10_a2ui"; + case ImageFormatR8i: + return "r8i"; + case ImageFormatRg8i: + return "rg8i"; + case ImageFormatR16i: + return "r16i"; + default: + case ImageFormatUnknown: + return nullptr; + } +} + +uint32_t CompilerGLSL::type_to_packed_base_size(const SPIRType &type, BufferPackingStandard) +{ + switch (type.basetype) + { + case SPIRType::Double: + case SPIRType::Int64: + case SPIRType::UInt64: + return 8; + case SPIRType::Float: + case SPIRType::Int: + case SPIRType::UInt: + return 4; + case SPIRType::Half: + case SPIRType::Short: + case SPIRType::UShort: + return 2; + case SPIRType::SByte: + case SPIRType::UByte: + return 1; + + default: + SPIRV_CROSS_THROW("Unrecognized type in type_to_packed_base_size."); + } +} + +uint32_t CompilerGLSL::type_to_packed_alignment(const SPIRType &type, const Bitset &flags, + BufferPackingStandard packing) +{ + // If using PhysicalStorageBufferEXT storage class, this is a pointer, + // and is 64-bit. + if (type_is_top_level_physical_pointer(type)) + { + if (!type.pointer) + SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); + + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + { + if (packing_is_vec4_padded(packing) && type_is_array_of_pointers(type)) + return 16; + else + return 8; + } + else + SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); + } + else if (type_is_top_level_array(type)) + { + uint32_t minimum_alignment = 1; + if (packing_is_vec4_padded(packing)) + minimum_alignment = 16; + + auto *tmp = &get(type.parent_type); + while (!tmp->array.empty()) + tmp = &get(tmp->parent_type); + + // Get the alignment of the base type, then maybe round up. + return max(minimum_alignment, type_to_packed_alignment(*tmp, flags, packing)); + } + + if (type.basetype == SPIRType::Struct) + { + // Rule 9. Structs alignments are maximum alignment of its members. + uint32_t alignment = 1; + for (uint32_t i = 0; i < type.member_types.size(); i++) + { + auto member_flags = ir.meta[type.self].members[i].decoration_flags; + alignment = + max(alignment, type_to_packed_alignment(get(type.member_types[i]), member_flags, packing)); + } + + // In std140, struct alignment is rounded up to 16. + if (packing_is_vec4_padded(packing)) + alignment = max(alignment, 16u); + + return alignment; + } + else + { + const uint32_t base_alignment = type_to_packed_base_size(type, packing); + + // Alignment requirement for scalar block layout is always the alignment for the most basic component. + if (packing_is_scalar(packing)) + return base_alignment; + + // Vectors are *not* aligned in HLSL, but there's an extra rule where vectors cannot straddle + // a vec4, this is handled outside since that part knows our current offset. + if (type.columns == 1 && packing_is_hlsl(packing)) + return base_alignment; + + // From 7.6.2.2 in GL 4.5 core spec. + // Rule 1 + if (type.vecsize == 1 && type.columns == 1) + return base_alignment; + + // Rule 2 + if ((type.vecsize == 2 || type.vecsize == 4) && type.columns == 1) + return type.vecsize * base_alignment; + + // Rule 3 + if (type.vecsize == 3 && type.columns == 1) + return 4 * base_alignment; + + // Rule 4 implied. Alignment does not change in std430. + + // Rule 5. Column-major matrices are stored as arrays of + // vectors. + if (flags.get(DecorationColMajor) && type.columns > 1) + { + if (packing_is_vec4_padded(packing)) + return 4 * base_alignment; + else if (type.vecsize == 3) + return 4 * base_alignment; + else + return type.vecsize * base_alignment; + } + + // Rule 6 implied. + + // Rule 7. + if (flags.get(DecorationRowMajor) && type.vecsize > 1) + { + if (packing_is_vec4_padded(packing)) + return 4 * base_alignment; + else if (type.columns == 3) + return 4 * base_alignment; + else + return type.columns * base_alignment; + } + + // Rule 8 implied. + } + + SPIRV_CROSS_THROW("Did not find suitable rule for type. Bogus decorations?"); +} + +uint32_t CompilerGLSL::type_to_packed_array_stride(const SPIRType &type, const Bitset &flags, + BufferPackingStandard packing) +{ + // Array stride is equal to aligned size of the underlying type. + uint32_t parent = type.parent_type; + assert(parent); + + auto &tmp = get(parent); + + uint32_t size = type_to_packed_size(tmp, flags, packing); + uint32_t alignment = type_to_packed_alignment(type, flags, packing); + return (size + alignment - 1) & ~(alignment - 1); +} + +uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing) +{ + // If using PhysicalStorageBufferEXT storage class, this is a pointer, + // and is 64-bit. + if (type_is_top_level_physical_pointer(type)) + { + if (!type.pointer) + SPIRV_CROSS_THROW("Types in PhysicalStorageBufferEXT must be pointers."); + + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + return 8; + else + SPIRV_CROSS_THROW("AddressingModelPhysicalStorageBuffer64EXT must be used for PhysicalStorageBufferEXT."); + } + else if (type_is_top_level_array(type)) + { + uint32_t packed_size = to_array_size_literal(type) * type_to_packed_array_stride(type, flags, packing); + + // For arrays of vectors and matrices in HLSL, the last element has a size which depends on its vector size, + // so that it is possible to pack other vectors into the last element. + if (packing_is_hlsl(packing) && type.basetype != SPIRType::Struct) + packed_size -= (4 - type.vecsize) * (type.width / 8); + + return packed_size; + } + + uint32_t size = 0; + + if (type.basetype == SPIRType::Struct) + { + uint32_t pad_alignment = 1; + + for (uint32_t i = 0; i < type.member_types.size(); i++) + { + auto member_flags = ir.meta[type.self].members[i].decoration_flags; + auto &member_type = get(type.member_types[i]); + + uint32_t packed_alignment = type_to_packed_alignment(member_type, member_flags, packing); + uint32_t alignment = max(packed_alignment, pad_alignment); + + // The next member following a struct member is aligned to the base alignment of the struct that came before. + // GL 4.5 spec, 7.6.2.2. + if (member_type.basetype == SPIRType::Struct) + pad_alignment = packed_alignment; + else + pad_alignment = 1; + + size = (size + alignment - 1) & ~(alignment - 1); + size += type_to_packed_size(member_type, member_flags, packing); + } + } + else + { + const uint32_t base_alignment = type_to_packed_base_size(type, packing); + + if (packing_is_scalar(packing)) + { + size = type.vecsize * type.columns * base_alignment; + } + else + { + if (type.columns == 1) + size = type.vecsize * base_alignment; + + if (flags.get(DecorationColMajor) && type.columns > 1) + { + if (packing_is_vec4_padded(packing)) + size = type.columns * 4 * base_alignment; + else if (type.vecsize == 3) + size = type.columns * 4 * base_alignment; + else + size = type.columns * type.vecsize * base_alignment; + } + + if (flags.get(DecorationRowMajor) && type.vecsize > 1) + { + if (packing_is_vec4_padded(packing)) + size = type.vecsize * 4 * base_alignment; + else if (type.columns == 3) + size = type.vecsize * 4 * base_alignment; + else + size = type.vecsize * type.columns * base_alignment; + } + + // For matrices in HLSL, the last element has a size which depends on its vector size, + // so that it is possible to pack other vectors into the last element. + if (packing_is_hlsl(packing) && type.columns > 1) + size -= (4 - type.vecsize) * (type.width / 8); + } + } + + return size; +} + +bool CompilerGLSL::buffer_is_packing_standard(const SPIRType &type, BufferPackingStandard packing, + uint32_t *failed_validation_index, uint32_t start_offset, + uint32_t end_offset) +{ + // This is very tricky and error prone, but try to be exhaustive and correct here. + // SPIR-V doesn't directly say if we're using std430 or std140. + // SPIR-V communicates this using Offset and ArrayStride decorations (which is what really matters), + // so we have to try to infer whether or not the original GLSL source was std140 or std430 based on this information. + // We do not have to consider shared or packed since these layouts are not allowed in Vulkan SPIR-V (they are useless anyways, and custom offsets would do the same thing). + // + // It is almost certain that we're using std430, but it gets tricky with arrays in particular. + // We will assume std430, but infer std140 if we can prove the struct is not compliant with std430. + // + // The only two differences between std140 and std430 are related to padding alignment/array stride + // in arrays and structs. In std140 they take minimum vec4 alignment. + // std430 only removes the vec4 requirement. + + uint32_t offset = 0; + uint32_t pad_alignment = 1; + + bool is_top_level_block = + has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock); + + for (uint32_t i = 0; i < type.member_types.size(); i++) + { + auto &memb_type = get(type.member_types[i]); + auto member_flags = ir.meta[type.self].members[i].decoration_flags; + + // Verify alignment rules. + uint32_t packed_alignment = type_to_packed_alignment(memb_type, member_flags, packing); + + // This is a rather dirty workaround to deal with some cases of OpSpecConstantOp used as array size, e.g: + // layout(constant_id = 0) const int s = 10; + // const int S = s + 5; // SpecConstantOp + // buffer Foo { int data[S]; }; // <-- Very hard for us to deduce a fixed value here, + // we would need full implementation of compile-time constant folding. :( + // If we are the last member of a struct, there might be cases where the actual size of that member is irrelevant + // for our analysis (e.g. unsized arrays). + // This lets us simply ignore that there are spec constant op sized arrays in our buffers. + // Querying size of this member will fail, so just don't call it unless we have to. + // + // This is likely "best effort" we can support without going into unacceptably complicated workarounds. + bool member_can_be_unsized = + is_top_level_block && size_t(i + 1) == type.member_types.size() && !memb_type.array.empty(); + + uint32_t packed_size = 0; + if (!member_can_be_unsized || packing_is_hlsl(packing)) + packed_size = type_to_packed_size(memb_type, member_flags, packing); + + // We only need to care about this if we have non-array types which can straddle the vec4 boundary. + uint32_t actual_offset = type_struct_member_offset(type, i); + + if (packing_is_hlsl(packing)) + { + // If a member straddles across a vec4 boundary, alignment is actually vec4. + uint32_t begin_word = actual_offset / 16; + uint32_t end_word = (actual_offset + packed_size - 1) / 16; + if (begin_word != end_word) + packed_alignment = max(packed_alignment, 16u); + } + + // Field is not in the specified range anymore and we can ignore any further fields. + if (actual_offset >= end_offset) + break; + + uint32_t alignment = max(packed_alignment, pad_alignment); + offset = (offset + alignment - 1) & ~(alignment - 1); + + // The next member following a struct member is aligned to the base alignment of the struct that came before. + // GL 4.5 spec, 7.6.2.2. + if (memb_type.basetype == SPIRType::Struct && !memb_type.pointer) + pad_alignment = packed_alignment; + else + pad_alignment = 1; + + // Only care about packing if we are in the given range + if (actual_offset >= start_offset) + { + // We only care about offsets in std140, std430, etc ... + // For EnhancedLayout variants, we have the flexibility to choose our own offsets. + if (!packing_has_flexible_offset(packing)) + { + if (actual_offset != offset) // This cannot be the packing we're looking for. + { + if (failed_validation_index) + *failed_validation_index = i; + return false; + } + } + else if ((actual_offset & (alignment - 1)) != 0) + { + // We still need to verify that alignment rules are observed, even if we have explicit offset. + if (failed_validation_index) + *failed_validation_index = i; + return false; + } + + // Verify array stride rules. + if (type_is_top_level_array(memb_type) && + type_to_packed_array_stride(memb_type, member_flags, packing) != + type_struct_member_array_stride(type, i)) + { + if (failed_validation_index) + *failed_validation_index = i; + return false; + } + + // Verify that sub-structs also follow packing rules. + // We cannot use enhanced layouts on substructs, so they better be up to spec. + auto substruct_packing = packing_to_substruct_packing(packing); + + if (!memb_type.pointer && !memb_type.member_types.empty() && + !buffer_is_packing_standard(memb_type, substruct_packing)) + { + if (failed_validation_index) + *failed_validation_index = i; + return false; + } + } + + // Bump size. + offset = actual_offset + packed_size; + } + + return true; +} + +bool CompilerGLSL::can_use_io_location(StorageClass storage, bool block) +{ + // Location specifiers are must have in SPIR-V, but they aren't really supported in earlier versions of GLSL. + // Be very explicit here about how to solve the issue. + if ((get_execution_model() != ExecutionModelVertex && storage == StorageClassInput) || + (get_execution_model() != ExecutionModelFragment && storage == StorageClassOutput)) + { + uint32_t minimum_desktop_version = block ? 440 : 410; + // ARB_enhanced_layouts vs ARB_separate_shader_objects ... + + if (!options.es && options.version < minimum_desktop_version && !options.separate_shader_objects) + return false; + else if (options.es && options.version < 310) + return false; + } + + if ((get_execution_model() == ExecutionModelVertex && storage == StorageClassInput) || + (get_execution_model() == ExecutionModelFragment && storage == StorageClassOutput)) + { + if (options.es && options.version < 300) + return false; + else if (!options.es && options.version < 330) + return false; + } + + if (storage == StorageClassUniform || storage == StorageClassUniformConstant || storage == StorageClassPushConstant) + { + if (options.es && options.version < 310) + return false; + else if (!options.es && options.version < 430) + return false; + } + + return true; +} + +string CompilerGLSL::layout_for_variable(const SPIRVariable &var) +{ + // FIXME: Come up with a better solution for when to disable layouts. + // Having layouts depend on extensions as well as which types + // of layouts are used. For now, the simple solution is to just disable + // layouts for legacy versions. + if (is_legacy()) + return ""; + + if (subpass_input_is_framebuffer_fetch(var.self)) + return ""; + + SmallVector attr; + + auto &type = get(var.basetype); + auto &flags = get_decoration_bitset(var.self); + auto &typeflags = get_decoration_bitset(type.self); + + if (flags.get(DecorationPassthroughNV)) + attr.push_back("passthrough"); + + if (options.vulkan_semantics && var.storage == StorageClassPushConstant) + attr.push_back("push_constant"); + else if (var.storage == StorageClassShaderRecordBufferKHR) + attr.push_back(ray_tracing_is_khr ? "shaderRecordEXT" : "shaderRecordNV"); + + if (flags.get(DecorationRowMajor)) + attr.push_back("row_major"); + if (flags.get(DecorationColMajor)) + attr.push_back("column_major"); + + if (options.vulkan_semantics) + { + if (flags.get(DecorationInputAttachmentIndex)) + attr.push_back(join("input_attachment_index = ", get_decoration(var.self, DecorationInputAttachmentIndex))); + } + + bool is_block = has_decoration(type.self, DecorationBlock); + if (flags.get(DecorationLocation) && can_use_io_location(var.storage, is_block)) + { + Bitset combined_decoration; + for (uint32_t i = 0; i < ir.meta[type.self].members.size(); i++) + combined_decoration.merge_or(combined_decoration_for_member(type, i)); + + // If our members have location decorations, we don't need to + // emit location decorations at the top as well (looks weird). + if (!combined_decoration.get(DecorationLocation)) + attr.push_back(join("location = ", get_decoration(var.self, DecorationLocation))); + } + + if (get_execution_model() == ExecutionModelFragment && var.storage == StorageClassOutput && + location_is_non_coherent_framebuffer_fetch(get_decoration(var.self, DecorationLocation))) + { + attr.push_back("noncoherent"); + } + + // Transform feedback + bool uses_enhanced_layouts = false; + if (is_block && var.storage == StorageClassOutput) + { + // For blocks, there is a restriction where xfb_stride/xfb_buffer must only be declared on the block itself, + // since all members must match the same xfb_buffer. The only thing we will declare for members of the block + // is the xfb_offset. + uint32_t member_count = uint32_t(type.member_types.size()); + bool have_xfb_buffer_stride = false; + bool have_any_xfb_offset = false; + bool have_geom_stream = false; + uint32_t xfb_stride = 0, xfb_buffer = 0, geom_stream = 0; + + if (flags.get(DecorationXfbBuffer) && flags.get(DecorationXfbStride)) + { + have_xfb_buffer_stride = true; + xfb_buffer = get_decoration(var.self, DecorationXfbBuffer); + xfb_stride = get_decoration(var.self, DecorationXfbStride); + } + + if (flags.get(DecorationStream)) + { + have_geom_stream = true; + geom_stream = get_decoration(var.self, DecorationStream); + } + + // Verify that none of the members violate our assumption. + for (uint32_t i = 0; i < member_count; i++) + { + if (has_member_decoration(type.self, i, DecorationStream)) + { + uint32_t member_geom_stream = get_member_decoration(type.self, i, DecorationStream); + if (have_geom_stream && member_geom_stream != geom_stream) + SPIRV_CROSS_THROW("IO block member Stream mismatch."); + have_geom_stream = true; + geom_stream = member_geom_stream; + } + + // Only members with an Offset decoration participate in XFB. + if (!has_member_decoration(type.self, i, DecorationOffset)) + continue; + have_any_xfb_offset = true; + + if (has_member_decoration(type.self, i, DecorationXfbBuffer)) + { + uint32_t buffer_index = get_member_decoration(type.self, i, DecorationXfbBuffer); + if (have_xfb_buffer_stride && buffer_index != xfb_buffer) + SPIRV_CROSS_THROW("IO block member XfbBuffer mismatch."); + have_xfb_buffer_stride = true; + xfb_buffer = buffer_index; + } + + if (has_member_decoration(type.self, i, DecorationXfbStride)) + { + uint32_t stride = get_member_decoration(type.self, i, DecorationXfbStride); + if (have_xfb_buffer_stride && stride != xfb_stride) + SPIRV_CROSS_THROW("IO block member XfbStride mismatch."); + have_xfb_buffer_stride = true; + xfb_stride = stride; + } + } + + if (have_xfb_buffer_stride && have_any_xfb_offset) + { + attr.push_back(join("xfb_buffer = ", xfb_buffer)); + attr.push_back(join("xfb_stride = ", xfb_stride)); + uses_enhanced_layouts = true; + } + + if (have_geom_stream) + { + if (get_execution_model() != ExecutionModelGeometry) + SPIRV_CROSS_THROW("Geometry streams can only be used in geometry shaders."); + if (options.es) + SPIRV_CROSS_THROW("Multiple geometry streams not supported in ESSL."); + if (options.version < 400) + require_extension_internal("GL_ARB_transform_feedback3"); + attr.push_back(join("stream = ", get_decoration(var.self, DecorationStream))); + } + } + else if (var.storage == StorageClassOutput) + { + if (flags.get(DecorationXfbBuffer) && flags.get(DecorationXfbStride) && flags.get(DecorationOffset)) + { + // XFB for standalone variables, we can emit all decorations. + attr.push_back(join("xfb_buffer = ", get_decoration(var.self, DecorationXfbBuffer))); + attr.push_back(join("xfb_stride = ", get_decoration(var.self, DecorationXfbStride))); + attr.push_back(join("xfb_offset = ", get_decoration(var.self, DecorationOffset))); + uses_enhanced_layouts = true; + } + + if (flags.get(DecorationStream)) + { + if (get_execution_model() != ExecutionModelGeometry) + SPIRV_CROSS_THROW("Geometry streams can only be used in geometry shaders."); + if (options.es) + SPIRV_CROSS_THROW("Multiple geometry streams not supported in ESSL."); + if (options.version < 400) + require_extension_internal("GL_ARB_transform_feedback3"); + attr.push_back(join("stream = ", get_decoration(var.self, DecorationStream))); + } + } + + // Can only declare Component if we can declare location. + if (flags.get(DecorationComponent) && can_use_io_location(var.storage, is_block)) + { + uses_enhanced_layouts = true; + attr.push_back(join("component = ", get_decoration(var.self, DecorationComponent))); + } + + if (uses_enhanced_layouts) + { + if (!options.es) + { + if (options.version < 440 && options.version >= 140) + require_extension_internal("GL_ARB_enhanced_layouts"); + else if (options.version < 140) + SPIRV_CROSS_THROW("GL_ARB_enhanced_layouts is not supported in targets below GLSL 1.40."); + if (!options.es && options.version < 440) + require_extension_internal("GL_ARB_enhanced_layouts"); + } + else if (options.es) + SPIRV_CROSS_THROW("GL_ARB_enhanced_layouts is not supported in ESSL."); + } + + if (flags.get(DecorationIndex)) + attr.push_back(join("index = ", get_decoration(var.self, DecorationIndex))); + + // Do not emit set = decoration in regular GLSL output, but + // we need to preserve it in Vulkan GLSL mode. + if (var.storage != StorageClassPushConstant && var.storage != StorageClassShaderRecordBufferKHR) + { + if (flags.get(DecorationDescriptorSet) && options.vulkan_semantics) + attr.push_back(join("set = ", get_decoration(var.self, DecorationDescriptorSet))); + } + + bool push_constant_block = options.vulkan_semantics && var.storage == StorageClassPushConstant; + bool ssbo_block = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferKHR || + (var.storage == StorageClassUniform && typeflags.get(DecorationBufferBlock)); + bool emulated_ubo = var.storage == StorageClassPushConstant && options.emit_push_constant_as_uniform_buffer; + bool ubo_block = var.storage == StorageClassUniform && typeflags.get(DecorationBlock); + + // GL 3.0/GLSL 1.30 is not considered legacy, but it doesn't have UBOs ... + bool can_use_buffer_blocks = (options.es && options.version >= 300) || (!options.es && options.version >= 140); + + // pretend no UBOs when options say so + if (ubo_block && options.emit_uniform_buffer_as_plain_uniforms) + can_use_buffer_blocks = false; + + bool can_use_binding; + if (options.es) + can_use_binding = options.version >= 310; + else + can_use_binding = options.enable_420pack_extension || (options.version >= 420); + + // Make sure we don't emit binding layout for a classic uniform on GLSL 1.30. + if (!can_use_buffer_blocks && var.storage == StorageClassUniform) + can_use_binding = false; + + if (var.storage == StorageClassShaderRecordBufferKHR) + can_use_binding = false; + + if (can_use_binding && flags.get(DecorationBinding)) + attr.push_back(join("binding = ", get_decoration(var.self, DecorationBinding))); + + if (var.storage != StorageClassOutput && flags.get(DecorationOffset)) + attr.push_back(join("offset = ", get_decoration(var.self, DecorationOffset))); + + // Instead of adding explicit offsets for every element here, just assume we're using std140 or std430. + // If SPIR-V does not comply with either layout, we cannot really work around it. + if (can_use_buffer_blocks && (ubo_block || emulated_ubo)) + { + attr.push_back(buffer_to_packing_standard(type, false)); + } + else if (can_use_buffer_blocks && (push_constant_block || ssbo_block)) + { + attr.push_back(buffer_to_packing_standard(type, true)); + } + + // For images, the type itself adds a layout qualifer. + // Only emit the format for storage images. + if (type.basetype == SPIRType::Image && type.image.sampled == 2) + { + const char *fmt = format_to_glsl(type.image.format); + if (fmt) + attr.push_back(fmt); + } + + if (attr.empty()) + return ""; + + string res = "layout("; + res += merge(attr); + res += ") "; + return res; +} + +string CompilerGLSL::buffer_to_packing_standard(const SPIRType &type, bool support_std430_without_scalar_layout) +{ + if (support_std430_without_scalar_layout && buffer_is_packing_standard(type, BufferPackingStd430)) + return "std430"; + else if (buffer_is_packing_standard(type, BufferPackingStd140)) + return "std140"; + else if (options.vulkan_semantics && buffer_is_packing_standard(type, BufferPackingScalar)) + { + require_extension_internal("GL_EXT_scalar_block_layout"); + return "scalar"; + } + else if (support_std430_without_scalar_layout && + buffer_is_packing_standard(type, BufferPackingStd430EnhancedLayout)) + { + if (options.es && !options.vulkan_semantics) + SPIRV_CROSS_THROW("Push constant block cannot be expressed as neither std430 nor std140. ES-targets do " + "not support GL_ARB_enhanced_layouts."); + if (!options.es && !options.vulkan_semantics && options.version < 440) + require_extension_internal("GL_ARB_enhanced_layouts"); + + set_extended_decoration(type.self, SPIRVCrossDecorationExplicitOffset); + return "std430"; + } + else if (buffer_is_packing_standard(type, BufferPackingStd140EnhancedLayout)) + { + // Fallback time. We might be able to use the ARB_enhanced_layouts to deal with this difference, + // however, we can only use layout(offset) on the block itself, not any substructs, so the substructs better be the appropriate layout. + // Enhanced layouts seem to always work in Vulkan GLSL, so no need for extensions there. + if (options.es && !options.vulkan_semantics) + SPIRV_CROSS_THROW("Push constant block cannot be expressed as neither std430 nor std140. ES-targets do " + "not support GL_ARB_enhanced_layouts."); + if (!options.es && !options.vulkan_semantics && options.version < 440) + require_extension_internal("GL_ARB_enhanced_layouts"); + + set_extended_decoration(type.self, SPIRVCrossDecorationExplicitOffset); + return "std140"; + } + else if (options.vulkan_semantics && buffer_is_packing_standard(type, BufferPackingScalarEnhancedLayout)) + { + set_extended_decoration(type.self, SPIRVCrossDecorationExplicitOffset); + require_extension_internal("GL_EXT_scalar_block_layout"); + return "scalar"; + } + else if (!support_std430_without_scalar_layout && options.vulkan_semantics && + buffer_is_packing_standard(type, BufferPackingStd430)) + { + // UBOs can support std430 with GL_EXT_scalar_block_layout. + require_extension_internal("GL_EXT_scalar_block_layout"); + return "std430"; + } + else if (!support_std430_without_scalar_layout && options.vulkan_semantics && + buffer_is_packing_standard(type, BufferPackingStd430EnhancedLayout)) + { + // UBOs can support std430 with GL_EXT_scalar_block_layout. + set_extended_decoration(type.self, SPIRVCrossDecorationExplicitOffset); + require_extension_internal("GL_EXT_scalar_block_layout"); + return "std430"; + } + else + { + SPIRV_CROSS_THROW("Buffer block cannot be expressed as any of std430, std140, scalar, even with enhanced " + "layouts. You can try flattening this block to support a more flexible layout."); + } +} + +void CompilerGLSL::emit_push_constant_block(const SPIRVariable &var) +{ + if (flattened_buffer_blocks.count(var.self)) + emit_buffer_block_flattened(var); + else if (options.vulkan_semantics) + emit_push_constant_block_vulkan(var); + else if (options.emit_push_constant_as_uniform_buffer) + emit_buffer_block_native(var); + else + emit_push_constant_block_glsl(var); +} + +void CompilerGLSL::emit_push_constant_block_vulkan(const SPIRVariable &var) +{ + emit_buffer_block(var); +} + +void CompilerGLSL::emit_push_constant_block_glsl(const SPIRVariable &var) +{ + // OpenGL has no concept of push constant blocks, implement it as a uniform struct. + auto &type = get(var.basetype); + + unset_decoration(var.self, DecorationBinding); + unset_decoration(var.self, DecorationDescriptorSet); + +#if 0 + if (flags & ((1ull << DecorationBinding) | (1ull << DecorationDescriptorSet))) + SPIRV_CROSS_THROW("Push constant blocks cannot be compiled to GLSL with Binding or Set syntax. " + "Remap to location with reflection API first or disable these decorations."); +#endif + + // We're emitting the push constant block as a regular struct, so disable the block qualifier temporarily. + // Otherwise, we will end up emitting layout() qualifiers on naked structs which is not allowed. + bool block_flag = has_decoration(type.self, DecorationBlock); + unset_decoration(type.self, DecorationBlock); + + emit_struct(type); + + if (block_flag) + set_decoration(type.self, DecorationBlock); + + emit_uniform(var); + statement(""); +} + +void CompilerGLSL::emit_buffer_block(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + bool ubo_block = var.storage == StorageClassUniform && has_decoration(type.self, DecorationBlock); + + if (flattened_buffer_blocks.count(var.self)) + emit_buffer_block_flattened(var); + else if (is_legacy() || (!options.es && options.version == 130) || + (ubo_block && options.emit_uniform_buffer_as_plain_uniforms)) + emit_buffer_block_legacy(var); + else + emit_buffer_block_native(var); +} + +void CompilerGLSL::emit_buffer_block_legacy(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + bool ssbo = var.storage == StorageClassStorageBuffer || + ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); + if (ssbo) + SPIRV_CROSS_THROW("SSBOs not supported in legacy targets."); + + // We're emitting the push constant block as a regular struct, so disable the block qualifier temporarily. + // Otherwise, we will end up emitting layout() qualifiers on naked structs which is not allowed. + auto &block_flags = ir.meta[type.self].decoration.decoration_flags; + bool block_flag = block_flags.get(DecorationBlock); + block_flags.clear(DecorationBlock); + emit_struct(type); + if (block_flag) + block_flags.set(DecorationBlock); + emit_uniform(var); + statement(""); +} + +void CompilerGLSL::emit_buffer_reference_block(uint32_t type_id, bool forward_declaration) +{ + auto &type = get(type_id); + string buffer_name; + + if (forward_declaration) + { + // Block names should never alias, but from HLSL input they kind of can because block types are reused for UAVs ... + // Allow aliased name since we might be declaring the block twice. Once with buffer reference (forward declared) and one proper declaration. + // The names must match up. + buffer_name = to_name(type.self, false); + + // Shaders never use the block by interface name, so we don't + // have to track this other than updating name caches. + // If we have a collision for any reason, just fallback immediately. + if (ir.meta[type.self].decoration.alias.empty() || + block_ssbo_names.find(buffer_name) != end(block_ssbo_names) || + resource_names.find(buffer_name) != end(resource_names)) + { + buffer_name = join("_", type.self); + } + + // Make sure we get something unique for both global name scope and block name scope. + // See GLSL 4.5 spec: section 4.3.9 for details. + add_variable(block_ssbo_names, resource_names, buffer_name); + + // If for some reason buffer_name is an illegal name, make a final fallback to a workaround name. + // This cannot conflict with anything else, so we're safe now. + // We cannot reuse this fallback name in neither global scope (blocked by block_names) nor block name scope. + if (buffer_name.empty()) + buffer_name = join("_", type.self); + + block_names.insert(buffer_name); + block_ssbo_names.insert(buffer_name); + + // Ensure we emit the correct name when emitting non-forward pointer type. + ir.meta[type.self].decoration.alias = buffer_name; + } + else if (type.basetype != SPIRType::Struct) + buffer_name = type_to_glsl(type); + else + buffer_name = to_name(type.self, false); + + if (!forward_declaration) + { + auto itr = physical_storage_type_to_alignment.find(type_id); + uint32_t alignment = 0; + if (itr != physical_storage_type_to_alignment.end()) + alignment = itr->second.alignment; + + if (type.basetype == SPIRType::Struct) + { + SmallVector attributes; + attributes.push_back("buffer_reference"); + if (alignment) + attributes.push_back(join("buffer_reference_align = ", alignment)); + attributes.push_back(buffer_to_packing_standard(type, true)); + + auto flags = ir.get_buffer_block_type_flags(type); + string decorations; + if (flags.get(DecorationRestrict)) + decorations += " restrict"; + if (flags.get(DecorationCoherent)) + decorations += " coherent"; + if (flags.get(DecorationNonReadable)) + decorations += " writeonly"; + if (flags.get(DecorationNonWritable)) + decorations += " readonly"; + + statement("layout(", merge(attributes), ")", decorations, " buffer ", buffer_name); + } + else if (alignment) + statement("layout(buffer_reference, buffer_reference_align = ", alignment, ") buffer ", buffer_name); + else + statement("layout(buffer_reference) buffer ", buffer_name); + + begin_scope(); + + if (type.basetype == SPIRType::Struct) + { + type.member_name_cache.clear(); + + uint32_t i = 0; + for (auto &member : type.member_types) + { + add_member_name(type, i); + emit_struct_member(type, member, i); + i++; + } + } + else + { + auto &pointee_type = get_pointee_type(type); + statement(type_to_glsl(pointee_type), " value", type_to_array_glsl(pointee_type), ";"); + } + + end_scope_decl(); + statement(""); + } + else + { + statement("layout(buffer_reference) buffer ", buffer_name, ";"); + } +} + +void CompilerGLSL::emit_buffer_block_native(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + + Bitset flags = ir.get_buffer_block_flags(var); + bool ssbo = var.storage == StorageClassStorageBuffer || var.storage == StorageClassShaderRecordBufferKHR || + ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); + bool is_restrict = ssbo && flags.get(DecorationRestrict); + bool is_writeonly = ssbo && flags.get(DecorationNonReadable); + bool is_readonly = ssbo && flags.get(DecorationNonWritable); + bool is_coherent = ssbo && flags.get(DecorationCoherent); + + // Block names should never alias, but from HLSL input they kind of can because block types are reused for UAVs ... + auto buffer_name = to_name(type.self, false); + + auto &block_namespace = ssbo ? block_ssbo_names : block_ubo_names; + + // Shaders never use the block by interface name, so we don't + // have to track this other than updating name caches. + // If we have a collision for any reason, just fallback immediately. + if (ir.meta[type.self].decoration.alias.empty() || block_namespace.find(buffer_name) != end(block_namespace) || + resource_names.find(buffer_name) != end(resource_names)) + { + buffer_name = get_block_fallback_name(var.self); + } + + // Make sure we get something unique for both global name scope and block name scope. + // See GLSL 4.5 spec: section 4.3.9 for details. + add_variable(block_namespace, resource_names, buffer_name); + + // If for some reason buffer_name is an illegal name, make a final fallback to a workaround name. + // This cannot conflict with anything else, so we're safe now. + // We cannot reuse this fallback name in neither global scope (blocked by block_names) nor block name scope. + if (buffer_name.empty()) + buffer_name = join("_", get(var.basetype).self, "_", var.self); + + block_names.insert(buffer_name); + block_namespace.insert(buffer_name); + + // Save for post-reflection later. + declared_block_names[var.self] = buffer_name; + + statement(layout_for_variable(var), is_coherent ? "coherent " : "", is_restrict ? "restrict " : "", + is_writeonly ? "writeonly " : "", is_readonly ? "readonly " : "", ssbo ? "buffer " : "uniform ", + buffer_name); + + begin_scope(); + + type.member_name_cache.clear(); + + uint32_t i = 0; + for (auto &member : type.member_types) + { + add_member_name(type, i); + emit_struct_member(type, member, i); + i++; + } + + // var.self can be used as a backup name for the block name, + // so we need to make sure we don't disturb the name here on a recompile. + // It will need to be reset if we have to recompile. + preserve_alias_on_reset(var.self); + add_resource_name(var.self); + end_scope_decl(to_name(var.self) + type_to_array_glsl(type)); + statement(""); +} + +void CompilerGLSL::emit_buffer_block_flattened(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + + // Block names should never alias. + auto buffer_name = to_name(type.self, false); + size_t buffer_size = (get_declared_struct_size(type) + 15) / 16; + + SPIRType::BaseType basic_type; + if (get_common_basic_type(type, basic_type)) + { + SPIRType tmp; + tmp.basetype = basic_type; + tmp.vecsize = 4; + if (basic_type != SPIRType::Float && basic_type != SPIRType::Int && basic_type != SPIRType::UInt) + SPIRV_CROSS_THROW("Basic types in a flattened UBO must be float, int or uint."); + + auto flags = ir.get_buffer_block_flags(var); + statement("uniform ", flags_to_qualifiers_glsl(tmp, flags), type_to_glsl(tmp), " ", buffer_name, "[", + buffer_size, "];"); + } + else + SPIRV_CROSS_THROW("All basic types in a flattened block must be the same."); +} + +const char *CompilerGLSL::to_storage_qualifiers_glsl(const SPIRVariable &var) +{ + auto &execution = get_entry_point(); + + if (subpass_input_is_framebuffer_fetch(var.self)) + return ""; + + if (var.storage == StorageClassInput || var.storage == StorageClassOutput) + { + if (is_legacy() && execution.model == ExecutionModelVertex) + return var.storage == StorageClassInput ? "attribute " : "varying "; + else if (is_legacy() && execution.model == ExecutionModelFragment) + return "varying "; // Fragment outputs are renamed so they never hit this case. + else if (execution.model == ExecutionModelFragment && var.storage == StorageClassOutput) + { + uint32_t loc = get_decoration(var.self, DecorationLocation); + bool is_inout = location_is_framebuffer_fetch(loc); + if (is_inout) + return "inout "; + else + return "out "; + } + else + return var.storage == StorageClassInput ? "in " : "out "; + } + else if (var.storage == StorageClassUniformConstant || var.storage == StorageClassUniform || + var.storage == StorageClassPushConstant) + { + return "uniform "; + } + else if (var.storage == StorageClassRayPayloadKHR) + { + return ray_tracing_is_khr ? "rayPayloadEXT " : "rayPayloadNV "; + } + else if (var.storage == StorageClassIncomingRayPayloadKHR) + { + return ray_tracing_is_khr ? "rayPayloadInEXT " : "rayPayloadInNV "; + } + else if (var.storage == StorageClassHitAttributeKHR) + { + return ray_tracing_is_khr ? "hitAttributeEXT " : "hitAttributeNV "; + } + else if (var.storage == StorageClassCallableDataKHR) + { + return ray_tracing_is_khr ? "callableDataEXT " : "callableDataNV "; + } + else if (var.storage == StorageClassIncomingCallableDataKHR) + { + return ray_tracing_is_khr ? "callableDataInEXT " : "callableDataInNV "; + } + + return ""; +} + +void CompilerGLSL::emit_flattened_io_block_member(const std::string &basename, const SPIRType &type, const char *qual, + const SmallVector &indices) +{ + uint32_t member_type_id = type.self; + const SPIRType *member_type = &type; + const SPIRType *parent_type = nullptr; + auto flattened_name = basename; + for (auto &index : indices) + { + flattened_name += "_"; + flattened_name += to_member_name(*member_type, index); + parent_type = member_type; + member_type_id = member_type->member_types[index]; + member_type = &get(member_type_id); + } + + assert(member_type->basetype != SPIRType::Struct); + + // We're overriding struct member names, so ensure we do so on the primary type. + if (parent_type->type_alias) + parent_type = &get(parent_type->type_alias); + + // Sanitize underscores because joining the two identifiers might create more than 1 underscore in a row, + // which is not allowed. + ParsedIR::sanitize_underscores(flattened_name); + + uint32_t last_index = indices.back(); + + // Pass in the varying qualifier here so it will appear in the correct declaration order. + // Replace member name while emitting it so it encodes both struct name and member name. + auto backup_name = get_member_name(parent_type->self, last_index); + auto member_name = to_member_name(*parent_type, last_index); + set_member_name(parent_type->self, last_index, flattened_name); + emit_struct_member(*parent_type, member_type_id, last_index, qual); + // Restore member name. + set_member_name(parent_type->self, last_index, member_name); +} + +void CompilerGLSL::emit_flattened_io_block_struct(const std::string &basename, const SPIRType &type, const char *qual, + const SmallVector &indices) +{ + auto sub_indices = indices; + sub_indices.push_back(0); + + const SPIRType *member_type = &type; + for (auto &index : indices) + member_type = &get(member_type->member_types[index]); + + assert(member_type->basetype == SPIRType::Struct); + + if (!member_type->array.empty()) + SPIRV_CROSS_THROW("Cannot flatten array of structs in I/O blocks."); + + for (uint32_t i = 0; i < uint32_t(member_type->member_types.size()); i++) + { + sub_indices.back() = i; + if (get(member_type->member_types[i]).basetype == SPIRType::Struct) + emit_flattened_io_block_struct(basename, type, qual, sub_indices); + else + emit_flattened_io_block_member(basename, type, qual, sub_indices); + } +} + +void CompilerGLSL::emit_flattened_io_block(const SPIRVariable &var, const char *qual) +{ + auto &var_type = get(var.basetype); + if (!var_type.array.empty()) + SPIRV_CROSS_THROW("Array of varying structs cannot be flattened to legacy-compatible varyings."); + + // Emit flattened types based on the type alias. Normally, we are never supposed to emit + // struct declarations for aliased types. + auto &type = var_type.type_alias ? get(var_type.type_alias) : var_type; + + auto old_flags = ir.meta[type.self].decoration.decoration_flags; + // Emit the members as if they are part of a block to get all qualifiers. + ir.meta[type.self].decoration.decoration_flags.set(DecorationBlock); + + type.member_name_cache.clear(); + + SmallVector member_indices; + member_indices.push_back(0); + auto basename = to_name(var.self); + + uint32_t i = 0; + for (auto &member : type.member_types) + { + add_member_name(type, i); + auto &membertype = get(member); + + member_indices.back() = i; + if (membertype.basetype == SPIRType::Struct) + emit_flattened_io_block_struct(basename, type, qual, member_indices); + else + emit_flattened_io_block_member(basename, type, qual, member_indices); + i++; + } + + ir.meta[type.self].decoration.decoration_flags = old_flags; + + // Treat this variable as fully flattened from now on. + flattened_structs[var.self] = true; +} + +void CompilerGLSL::emit_interface_block(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + + if (var.storage == StorageClassInput && type.basetype == SPIRType::Double && + !options.es && options.version < 410) + { + require_extension_internal("GL_ARB_vertex_attrib_64bit"); + } + + // Either make it plain in/out or in/out blocks depending on what shader is doing ... + bool block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock); + const char *qual = to_storage_qualifiers_glsl(var); + + if (block) + { + // ESSL earlier than 310 and GLSL earlier than 150 did not support + // I/O variables which are struct types. + // To support this, flatten the struct into separate varyings instead. + if (options.force_flattened_io_blocks || (options.es && options.version < 310) || + (!options.es && options.version < 150)) + { + // I/O blocks on ES require version 310 with Android Extension Pack extensions, or core version 320. + // On desktop, I/O blocks were introduced with geometry shaders in GL 3.2 (GLSL 150). + emit_flattened_io_block(var, qual); + } + else + { + if (options.es && options.version < 320) + { + // Geometry and tessellation extensions imply this extension. + if (!has_extension("GL_EXT_geometry_shader") && !has_extension("GL_EXT_tessellation_shader")) + require_extension_internal("GL_EXT_shader_io_blocks"); + } + + // Workaround to make sure we can emit "patch in/out" correctly. + fixup_io_block_patch_primitive_qualifiers(var); + + // Block names should never alias. + auto block_name = to_name(type.self, false); + + // The namespace for I/O blocks is separate from other variables in GLSL. + auto &block_namespace = type.storage == StorageClassInput ? block_input_names : block_output_names; + + // Shaders never use the block by interface name, so we don't + // have to track this other than updating name caches. + if (block_name.empty() || block_namespace.find(block_name) != end(block_namespace)) + block_name = get_fallback_name(type.self); + else + block_namespace.insert(block_name); + + // If for some reason buffer_name is an illegal name, make a final fallback to a workaround name. + // This cannot conflict with anything else, so we're safe now. + if (block_name.empty()) + block_name = join("_", get(var.basetype).self, "_", var.self); + + // Instance names cannot alias block names. + resource_names.insert(block_name); + + const char *block_qualifier; + if (has_decoration(var.self, DecorationPatch)) + block_qualifier = "patch "; + else if (has_decoration(var.self, DecorationPerPrimitiveEXT)) + block_qualifier = "perprimitiveEXT "; + else + block_qualifier = ""; + + statement(layout_for_variable(var), block_qualifier, qual, block_name); + begin_scope(); + + type.member_name_cache.clear(); + + uint32_t i = 0; + for (auto &member : type.member_types) + { + add_member_name(type, i); + emit_struct_member(type, member, i); + i++; + } + + add_resource_name(var.self); + end_scope_decl(join(to_name(var.self), type_to_array_glsl(type))); + statement(""); + } + } + else + { + // ESSL earlier than 310 and GLSL earlier than 150 did not support + // I/O variables which are struct types. + // To support this, flatten the struct into separate varyings instead. + if (type.basetype == SPIRType::Struct && + (options.force_flattened_io_blocks || (options.es && options.version < 310) || + (!options.es && options.version < 150))) + { + emit_flattened_io_block(var, qual); + } + else + { + add_resource_name(var.self); + + // Legacy GLSL did not support int attributes, we automatically + // declare them as float and cast them on load/store + SPIRType newtype = type; + if (is_legacy() && var.storage == StorageClassInput && type.basetype == SPIRType::Int) + newtype.basetype = SPIRType::Float; + + // Tessellation control and evaluation shaders must have either + // gl_MaxPatchVertices or unsized arrays for input arrays. + // Opt for unsized as it's the more "correct" variant to use. + if (type.storage == StorageClassInput && !type.array.empty() && + !has_decoration(var.self, DecorationPatch) && + (get_entry_point().model == ExecutionModelTessellationControl || + get_entry_point().model == ExecutionModelTessellationEvaluation)) + { + newtype.array.back() = 0; + newtype.array_size_literal.back() = true; + } + + statement(layout_for_variable(var), to_qualifiers_glsl(var.self), + variable_decl(newtype, to_name(var.self), var.self), ";"); + } + } +} + +void CompilerGLSL::emit_uniform(const SPIRVariable &var) +{ + auto &type = get(var.basetype); + if (type.basetype == SPIRType::Image && type.image.sampled == 2 && type.image.dim != DimSubpassData) + { + if (!options.es && options.version < 420) + require_extension_internal("GL_ARB_shader_image_load_store"); + else if (options.es && options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for shader image load store."); + } + + add_resource_name(var.self); + statement(layout_for_variable(var), variable_decl(var), ";"); +} + +string CompilerGLSL::constant_value_macro_name(uint32_t id) +{ + return join("SPIRV_CROSS_CONSTANT_ID_", id); +} + +void CompilerGLSL::emit_specialization_constant_op(const SPIRConstantOp &constant) +{ + auto &type = get(constant.basetype); + add_resource_name(constant.self); + auto name = to_name(constant.self); + statement("const ", variable_decl(type, name), " = ", constant_op_expression(constant), ";"); +} + +int CompilerGLSL::get_constant_mapping_to_workgroup_component(const SPIRConstant &c) const +{ + auto &entry_point = get_entry_point(); + int index = -1; + + // Need to redirect specialization constants which are used as WorkGroupSize to the builtin, + // since the spec constant declarations are never explicitly declared. + if (entry_point.workgroup_size.constant == 0 && entry_point.flags.get(ExecutionModeLocalSizeId)) + { + if (c.self == entry_point.workgroup_size.id_x) + index = 0; + else if (c.self == entry_point.workgroup_size.id_y) + index = 1; + else if (c.self == entry_point.workgroup_size.id_z) + index = 2; + } + + return index; +} + +void CompilerGLSL::emit_constant(const SPIRConstant &constant) +{ + auto &type = get(constant.constant_type); + + SpecializationConstant wg_x, wg_y, wg_z; + ID workgroup_size_id = get_work_group_size_specialization_constants(wg_x, wg_y, wg_z); + + // This specialization constant is implicitly declared by emitting layout() in; + if (constant.self == workgroup_size_id) + return; + + // These specialization constants are implicitly declared by emitting layout() in; + // In legacy GLSL, we will still need to emit macros for these, so a layout() in; declaration + // later can use macro overrides for work group size. + bool is_workgroup_size_constant = ConstantID(constant.self) == wg_x.id || ConstantID(constant.self) == wg_y.id || + ConstantID(constant.self) == wg_z.id; + + if (options.vulkan_semantics && is_workgroup_size_constant) + { + // Vulkan GLSL does not need to declare workgroup spec constants explicitly, it is handled in layout(). + return; + } + else if (!options.vulkan_semantics && is_workgroup_size_constant && + !has_decoration(constant.self, DecorationSpecId)) + { + // Only bother declaring a workgroup size if it is actually a specialization constant, because we need macros. + return; + } + + add_resource_name(constant.self); + auto name = to_name(constant.self); + + // Only scalars have constant IDs. + if (has_decoration(constant.self, DecorationSpecId)) + { + if (options.vulkan_semantics) + { + statement("layout(constant_id = ", get_decoration(constant.self, DecorationSpecId), ") const ", + variable_decl(type, name), " = ", constant_expression(constant), ";"); + } + else + { + const string ¯o_name = constant.specialization_constant_macro_name; + statement("#ifndef ", macro_name); + statement("#define ", macro_name, " ", constant_expression(constant)); + statement("#endif"); + + // For workgroup size constants, only emit the macros. + if (!is_workgroup_size_constant) + statement("const ", variable_decl(type, name), " = ", macro_name, ";"); + } + } + else + { + statement("const ", variable_decl(type, name), " = ", constant_expression(constant), ";"); + } +} + +void CompilerGLSL::emit_entry_point_declarations() +{ +} + +void CompilerGLSL::replace_illegal_names(const unordered_set &keywords) +{ + ir.for_each_typed_id([&](uint32_t, const SPIRVariable &var) { + if (is_hidden_variable(var)) + return; + + auto *meta = ir.find_meta(var.self); + if (!meta) + return; + + auto &m = meta->decoration; + if (keywords.find(m.alias) != end(keywords)) + m.alias = join("_", m.alias); + }); + + ir.for_each_typed_id([&](uint32_t, const SPIRFunction &func) { + auto *meta = ir.find_meta(func.self); + if (!meta) + return; + + auto &m = meta->decoration; + if (keywords.find(m.alias) != end(keywords)) + m.alias = join("_", m.alias); + }); + + ir.for_each_typed_id([&](uint32_t, const SPIRType &type) { + auto *meta = ir.find_meta(type.self); + if (!meta) + return; + + auto &m = meta->decoration; + if (keywords.find(m.alias) != end(keywords)) + m.alias = join("_", m.alias); + + for (auto &memb : meta->members) + if (keywords.find(memb.alias) != end(keywords)) + memb.alias = join("_", memb.alias); + }); +} + +void CompilerGLSL::replace_illegal_names() +{ + // clang-format off + static const unordered_set keywords = { + "abs", "acos", "acosh", "all", "any", "asin", "asinh", "atan", "atanh", + "atomicAdd", "atomicCompSwap", "atomicCounter", "atomicCounterDecrement", "atomicCounterIncrement", + "atomicExchange", "atomicMax", "atomicMin", "atomicOr", "atomicXor", + "bitCount", "bitfieldExtract", "bitfieldInsert", "bitfieldReverse", + "ceil", "cos", "cosh", "cross", "degrees", + "dFdx", "dFdxCoarse", "dFdxFine", + "dFdy", "dFdyCoarse", "dFdyFine", + "distance", "dot", "EmitStreamVertex", "EmitVertex", "EndPrimitive", "EndStreamPrimitive", "equal", "exp", "exp2", + "faceforward", "findLSB", "findMSB", "float16BitsToInt16", "float16BitsToUint16", "floatBitsToInt", "floatBitsToUint", "floor", "fma", "fract", + "frexp", "fwidth", "fwidthCoarse", "fwidthFine", + "greaterThan", "greaterThanEqual", "groupMemoryBarrier", + "imageAtomicAdd", "imageAtomicAnd", "imageAtomicCompSwap", "imageAtomicExchange", "imageAtomicMax", "imageAtomicMin", "imageAtomicOr", "imageAtomicXor", + "imageLoad", "imageSamples", "imageSize", "imageStore", "imulExtended", "int16BitsToFloat16", "intBitsToFloat", "interpolateAtOffset", "interpolateAtCentroid", "interpolateAtSample", + "inverse", "inversesqrt", "isinf", "isnan", "ldexp", "length", "lessThan", "lessThanEqual", "log", "log2", + "matrixCompMult", "max", "memoryBarrier", "memoryBarrierAtomicCounter", "memoryBarrierBuffer", "memoryBarrierImage", "memoryBarrierShared", + "min", "mix", "mod", "modf", "noise", "noise1", "noise2", "noise3", "noise4", "normalize", "not", "notEqual", + "outerProduct", "packDouble2x32", "packHalf2x16", "packInt2x16", "packInt4x16", "packSnorm2x16", "packSnorm4x8", + "packUint2x16", "packUint4x16", "packUnorm2x16", "packUnorm4x8", "pow", + "radians", "reflect", "refract", "round", "roundEven", "sign", "sin", "sinh", "smoothstep", "sqrt", "step", + "tan", "tanh", "texelFetch", "texelFetchOffset", "texture", "textureGather", "textureGatherOffset", "textureGatherOffsets", + "textureGrad", "textureGradOffset", "textureLod", "textureLodOffset", "textureOffset", "textureProj", "textureProjGrad", + "textureProjGradOffset", "textureProjLod", "textureProjLodOffset", "textureProjOffset", "textureQueryLevels", "textureQueryLod", "textureSamples", "textureSize", + "transpose", "trunc", "uaddCarry", "uint16BitsToFloat16", "uintBitsToFloat", "umulExtended", "unpackDouble2x32", "unpackHalf2x16", "unpackInt2x16", "unpackInt4x16", + "unpackSnorm2x16", "unpackSnorm4x8", "unpackUint2x16", "unpackUint4x16", "unpackUnorm2x16", "unpackUnorm4x8", "usubBorrow", + + "active", "asm", "atomic_uint", "attribute", "bool", "break", "buffer", + "bvec2", "bvec3", "bvec4", "case", "cast", "centroid", "class", "coherent", "common", "const", "continue", "default", "discard", + "dmat2", "dmat2x2", "dmat2x3", "dmat2x4", "dmat3", "dmat3x2", "dmat3x3", "dmat3x4", "dmat4", "dmat4x2", "dmat4x3", "dmat4x4", + "do", "double", "dvec2", "dvec3", "dvec4", "else", "enum", "extern", "external", "false", "filter", "fixed", "flat", "float", + "for", "fvec2", "fvec3", "fvec4", "goto", "half", "highp", "hvec2", "hvec3", "hvec4", "if", "iimage1D", "iimage1DArray", + "iimage2D", "iimage2DArray", "iimage2DMS", "iimage2DMSArray", "iimage2DRect", "iimage3D", "iimageBuffer", "iimageCube", + "iimageCubeArray", "image1D", "image1DArray", "image2D", "image2DArray", "image2DMS", "image2DMSArray", "image2DRect", + "image3D", "imageBuffer", "imageCube", "imageCubeArray", "in", "inline", "inout", "input", "int", "interface", "invariant", + "isampler1D", "isampler1DArray", "isampler2D", "isampler2DArray", "isampler2DMS", "isampler2DMSArray", "isampler2DRect", + "isampler3D", "isamplerBuffer", "isamplerCube", "isamplerCubeArray", "ivec2", "ivec3", "ivec4", "layout", "long", "lowp", + "mat2", "mat2x2", "mat2x3", "mat2x4", "mat3", "mat3x2", "mat3x3", "mat3x4", "mat4", "mat4x2", "mat4x3", "mat4x4", "mediump", + "namespace", "noinline", "noperspective", "out", "output", "packed", "partition", "patch", "precise", "precision", "public", "readonly", + "resource", "restrict", "return", "sample", "sampler1D", "sampler1DArray", "sampler1DArrayShadow", + "sampler1DShadow", "sampler2D", "sampler2DArray", "sampler2DArrayShadow", "sampler2DMS", "sampler2DMSArray", + "sampler2DRect", "sampler2DRectShadow", "sampler2DShadow", "sampler3D", "sampler3DRect", "samplerBuffer", + "samplerCube", "samplerCubeArray", "samplerCubeArrayShadow", "samplerCubeShadow", "shared", "short", "sizeof", "smooth", "static", + "struct", "subroutine", "superp", "switch", "template", "this", "true", "typedef", "uimage1D", "uimage1DArray", "uimage2D", + "uimage2DArray", "uimage2DMS", "uimage2DMSArray", "uimage2DRect", "uimage3D", "uimageBuffer", "uimageCube", + "uimageCubeArray", "uint", "uniform", "union", "unsigned", "usampler1D", "usampler1DArray", "usampler2D", "usampler2DArray", + "usampler2DMS", "usampler2DMSArray", "usampler2DRect", "usampler3D", "usamplerBuffer", "usamplerCube", + "usamplerCubeArray", "using", "uvec2", "uvec3", "uvec4", "varying", "vec2", "vec3", "vec4", "void", "volatile", + "while", "writeonly", + }; + // clang-format on + + replace_illegal_names(keywords); +} + +void CompilerGLSL::replace_fragment_output(SPIRVariable &var) +{ + auto &m = ir.meta[var.self].decoration; + uint32_t location = 0; + if (m.decoration_flags.get(DecorationLocation)) + location = m.location; + + // If our variable is arrayed, we must not emit the array part of this as the SPIR-V will + // do the access chain part of this for us. + auto &type = get(var.basetype); + + if (type.array.empty()) + { + // Redirect the write to a specific render target in legacy GLSL. + m.alias = join("gl_FragData[", location, "]"); + + if (is_legacy_es() && location != 0) + require_extension_internal("GL_EXT_draw_buffers"); + } + else if (type.array.size() == 1) + { + // If location is non-zero, we probably have to add an offset. + // This gets really tricky since we'd have to inject an offset in the access chain. + // FIXME: This seems like an extremely odd-ball case, so it's probably fine to leave it like this for now. + m.alias = "gl_FragData"; + if (location != 0) + SPIRV_CROSS_THROW("Arrayed output variable used, but location is not 0. " + "This is unimplemented in SPIRV-Cross."); + + if (is_legacy_es()) + require_extension_internal("GL_EXT_draw_buffers"); + } + else + SPIRV_CROSS_THROW("Array-of-array output variable used. This cannot be implemented in legacy GLSL."); + + var.compat_builtin = true; // We don't want to declare this variable, but use the name as-is. +} + +void CompilerGLSL::replace_fragment_outputs() +{ + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + + if (!is_builtin_variable(var) && !var.remapped_variable && type.pointer && var.storage == StorageClassOutput) + replace_fragment_output(var); + }); +} + +string CompilerGLSL::remap_swizzle(const SPIRType &out_type, uint32_t input_components, const string &expr) +{ + if (out_type.vecsize == input_components) + return expr; + else if (input_components == 1 && !backend.can_swizzle_scalar) + return join(type_to_glsl(out_type), "(", expr, ")"); + else + { + // FIXME: This will not work with packed expressions. + auto e = enclose_expression(expr) + "."; + // Just clamp the swizzle index if we have more outputs than inputs. + for (uint32_t c = 0; c < out_type.vecsize; c++) + e += index_to_swizzle(min(c, input_components - 1)); + if (backend.swizzle_is_function && out_type.vecsize > 1) + e += "()"; + + remove_duplicate_swizzle(e); + return e; + } +} + +void CompilerGLSL::emit_pls() +{ + auto &execution = get_entry_point(); + if (execution.model != ExecutionModelFragment) + SPIRV_CROSS_THROW("Pixel local storage only supported in fragment shaders."); + + if (!options.es) + SPIRV_CROSS_THROW("Pixel local storage only supported in OpenGL ES."); + + if (options.version < 300) + SPIRV_CROSS_THROW("Pixel local storage only supported in ESSL 3.0 and above."); + + if (!pls_inputs.empty()) + { + statement("__pixel_local_inEXT _PLSIn"); + begin_scope(); + for (auto &input : pls_inputs) + statement(pls_decl(input), ";"); + end_scope_decl(); + statement(""); + } + + if (!pls_outputs.empty()) + { + statement("__pixel_local_outEXT _PLSOut"); + begin_scope(); + for (auto &output : pls_outputs) + statement(pls_decl(output), ";"); + end_scope_decl(); + statement(""); + } +} + +void CompilerGLSL::fixup_image_load_store_access() +{ + if (!options.enable_storage_image_qualifier_deduction) + return; + + ir.for_each_typed_id([&](uint32_t var, const SPIRVariable &) { + auto &vartype = expression_type(var); + if (vartype.basetype == SPIRType::Image && vartype.image.sampled == 2) + { + // Very old glslangValidator and HLSL compilers do not emit required qualifiers here. + // Solve this by making the image access as restricted as possible and loosen up if we need to. + // If any no-read/no-write flags are actually set, assume that the compiler knows what it's doing. + + if (!has_decoration(var, DecorationNonWritable) && !has_decoration(var, DecorationNonReadable)) + { + set_decoration(var, DecorationNonWritable); + set_decoration(var, DecorationNonReadable); + } + } + }); +} + +static bool is_block_builtin(BuiltIn builtin) +{ + return builtin == BuiltInPosition || builtin == BuiltInPointSize || builtin == BuiltInClipDistance || + builtin == BuiltInCullDistance; +} + +bool CompilerGLSL::should_force_emit_builtin_block(StorageClass storage) +{ + // If the builtin block uses XFB, we need to force explicit redeclaration of the builtin block. + + if (storage != StorageClassOutput) + return false; + bool should_force = false; + + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + if (should_force) + return; + + auto &type = this->get(var.basetype); + bool block = has_decoration(type.self, DecorationBlock); + if (var.storage == storage && block && is_builtin_variable(var)) + { + uint32_t member_count = uint32_t(type.member_types.size()); + for (uint32_t i = 0; i < member_count; i++) + { + if (has_member_decoration(type.self, i, DecorationBuiltIn) && + is_block_builtin(BuiltIn(get_member_decoration(type.self, i, DecorationBuiltIn))) && + has_member_decoration(type.self, i, DecorationOffset)) + { + should_force = true; + } + } + } + else if (var.storage == storage && !block && is_builtin_variable(var)) + { + if (is_block_builtin(BuiltIn(get_decoration(type.self, DecorationBuiltIn))) && + has_decoration(var.self, DecorationOffset)) + { + should_force = true; + } + } + }); + + // If we're declaring clip/cull planes with control points we need to force block declaration. + if ((get_execution_model() == ExecutionModelTessellationControl || + get_execution_model() == ExecutionModelMeshEXT) && + (clip_distance_count || cull_distance_count)) + { + should_force = true; + } + + return should_force; +} + +void CompilerGLSL::fixup_implicit_builtin_block_names(ExecutionModel model) +{ + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + bool block = has_decoration(type.self, DecorationBlock); + if ((var.storage == StorageClassOutput || var.storage == StorageClassInput) && block && + is_builtin_variable(var)) + { + if (model != ExecutionModelMeshEXT) + { + // Make sure the array has a supported name in the code. + if (var.storage == StorageClassOutput) + set_name(var.self, "gl_out"); + else if (var.storage == StorageClassInput) + set_name(var.self, "gl_in"); + } + else + { + auto flags = get_buffer_block_flags(var.self); + if (flags.get(DecorationPerPrimitiveEXT)) + { + set_name(var.self, "gl_MeshPrimitivesEXT"); + set_name(type.self, "gl_MeshPerPrimitiveEXT"); + } + else + { + set_name(var.self, "gl_MeshVerticesEXT"); + set_name(type.self, "gl_MeshPerVertexEXT"); + } + } + } + + if (model == ExecutionModelMeshEXT && var.storage == StorageClassOutput && !block) + { + auto *m = ir.find_meta(var.self); + if (m && m->decoration.builtin) + { + auto builtin_type = m->decoration.builtin_type; + if (builtin_type == BuiltInPrimitivePointIndicesEXT) + set_name(var.self, "gl_PrimitivePointIndicesEXT"); + else if (builtin_type == BuiltInPrimitiveLineIndicesEXT) + set_name(var.self, "gl_PrimitiveLineIndicesEXT"); + else if (builtin_type == BuiltInPrimitiveTriangleIndicesEXT) + set_name(var.self, "gl_PrimitiveTriangleIndicesEXT"); + } + } + }); +} + +void CompilerGLSL::emit_declared_builtin_block(StorageClass storage, ExecutionModel model) +{ + Bitset emitted_builtins; + Bitset global_builtins; + const SPIRVariable *block_var = nullptr; + bool emitted_block = false; + + // Need to use declared size in the type. + // These variables might have been declared, but not statically used, so we haven't deduced their size yet. + uint32_t cull_distance_size = 0; + uint32_t clip_distance_size = 0; + + bool have_xfb_buffer_stride = false; + bool have_geom_stream = false; + bool have_any_xfb_offset = false; + uint32_t xfb_stride = 0, xfb_buffer = 0, geom_stream = 0; + std::unordered_map builtin_xfb_offsets; + + const auto builtin_is_per_vertex_set = [](BuiltIn builtin) -> bool { + return builtin == BuiltInPosition || builtin == BuiltInPointSize || + builtin == BuiltInClipDistance || builtin == BuiltInCullDistance; + }; + + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + bool block = has_decoration(type.self, DecorationBlock); + Bitset builtins; + + if (var.storage == storage && block && is_builtin_variable(var)) + { + uint32_t index = 0; + for (auto &m : ir.meta[type.self].members) + { + if (m.builtin && builtin_is_per_vertex_set(m.builtin_type)) + { + builtins.set(m.builtin_type); + if (m.builtin_type == BuiltInCullDistance) + cull_distance_size = to_array_size_literal(this->get(type.member_types[index])); + else if (m.builtin_type == BuiltInClipDistance) + clip_distance_size = to_array_size_literal(this->get(type.member_types[index])); + + if (is_block_builtin(m.builtin_type) && m.decoration_flags.get(DecorationOffset)) + { + have_any_xfb_offset = true; + builtin_xfb_offsets[m.builtin_type] = m.offset; + } + + if (is_block_builtin(m.builtin_type) && m.decoration_flags.get(DecorationStream)) + { + uint32_t stream = m.stream; + if (have_geom_stream && geom_stream != stream) + SPIRV_CROSS_THROW("IO block member Stream mismatch."); + have_geom_stream = true; + geom_stream = stream; + } + } + index++; + } + + if (storage == StorageClassOutput && has_decoration(var.self, DecorationXfbBuffer) && + has_decoration(var.self, DecorationXfbStride)) + { + uint32_t buffer_index = get_decoration(var.self, DecorationXfbBuffer); + uint32_t stride = get_decoration(var.self, DecorationXfbStride); + if (have_xfb_buffer_stride && buffer_index != xfb_buffer) + SPIRV_CROSS_THROW("IO block member XfbBuffer mismatch."); + if (have_xfb_buffer_stride && stride != xfb_stride) + SPIRV_CROSS_THROW("IO block member XfbBuffer mismatch."); + have_xfb_buffer_stride = true; + xfb_buffer = buffer_index; + xfb_stride = stride; + } + + if (storage == StorageClassOutput && has_decoration(var.self, DecorationStream)) + { + uint32_t stream = get_decoration(var.self, DecorationStream); + if (have_geom_stream && geom_stream != stream) + SPIRV_CROSS_THROW("IO block member Stream mismatch."); + have_geom_stream = true; + geom_stream = stream; + } + } + else if (var.storage == storage && !block && is_builtin_variable(var)) + { + // While we're at it, collect all declared global builtins (HLSL mostly ...). + auto &m = ir.meta[var.self].decoration; + if (m.builtin && builtin_is_per_vertex_set(m.builtin_type)) + { + global_builtins.set(m.builtin_type); + if (m.builtin_type == BuiltInCullDistance) + cull_distance_size = to_array_size_literal(type); + else if (m.builtin_type == BuiltInClipDistance) + clip_distance_size = to_array_size_literal(type); + + if (is_block_builtin(m.builtin_type) && m.decoration_flags.get(DecorationXfbStride) && + m.decoration_flags.get(DecorationXfbBuffer) && m.decoration_flags.get(DecorationOffset)) + { + have_any_xfb_offset = true; + builtin_xfb_offsets[m.builtin_type] = m.offset; + uint32_t buffer_index = m.xfb_buffer; + uint32_t stride = m.xfb_stride; + if (have_xfb_buffer_stride && buffer_index != xfb_buffer) + SPIRV_CROSS_THROW("IO block member XfbBuffer mismatch."); + if (have_xfb_buffer_stride && stride != xfb_stride) + SPIRV_CROSS_THROW("IO block member XfbBuffer mismatch."); + have_xfb_buffer_stride = true; + xfb_buffer = buffer_index; + xfb_stride = stride; + } + + if (is_block_builtin(m.builtin_type) && m.decoration_flags.get(DecorationStream)) + { + uint32_t stream = get_decoration(var.self, DecorationStream); + if (have_geom_stream && geom_stream != stream) + SPIRV_CROSS_THROW("IO block member Stream mismatch."); + have_geom_stream = true; + geom_stream = stream; + } + } + } + + if (builtins.empty()) + return; + + if (emitted_block) + SPIRV_CROSS_THROW("Cannot use more than one builtin I/O block."); + + emitted_builtins = builtins; + emitted_block = true; + block_var = &var; + }); + + global_builtins = + Bitset(global_builtins.get_lower() & ((1ull << BuiltInPosition) | (1ull << BuiltInPointSize) | + (1ull << BuiltInClipDistance) | (1ull << BuiltInCullDistance))); + + // Try to collect all other declared builtins. + if (!emitted_block) + emitted_builtins = global_builtins; + + // Can't declare an empty interface block. + if (emitted_builtins.empty()) + return; + + if (storage == StorageClassOutput) + { + SmallVector attr; + if (have_xfb_buffer_stride && have_any_xfb_offset) + { + if (!options.es) + { + if (options.version < 440 && options.version >= 140) + require_extension_internal("GL_ARB_enhanced_layouts"); + else if (options.version < 140) + SPIRV_CROSS_THROW("Component decoration is not supported in targets below GLSL 1.40."); + if (!options.es && options.version < 440) + require_extension_internal("GL_ARB_enhanced_layouts"); + } + else if (options.es) + SPIRV_CROSS_THROW("Need GL_ARB_enhanced_layouts for xfb_stride or xfb_buffer."); + attr.push_back(join("xfb_buffer = ", xfb_buffer, ", xfb_stride = ", xfb_stride)); + } + + if (have_geom_stream) + { + if (get_execution_model() != ExecutionModelGeometry) + SPIRV_CROSS_THROW("Geometry streams can only be used in geometry shaders."); + if (options.es) + SPIRV_CROSS_THROW("Multiple geometry streams not supported in ESSL."); + if (options.version < 400) + require_extension_internal("GL_ARB_transform_feedback3"); + attr.push_back(join("stream = ", geom_stream)); + } + + if (model == ExecutionModelMeshEXT) + statement("out gl_MeshPerVertexEXT"); + else if (!attr.empty()) + statement("layout(", merge(attr), ") out gl_PerVertex"); + else + statement("out gl_PerVertex"); + } + else + { + // If we have passthrough, there is no way PerVertex cannot be passthrough. + if (get_entry_point().geometry_passthrough) + statement("layout(passthrough) in gl_PerVertex"); + else + statement("in gl_PerVertex"); + } + + begin_scope(); + if (emitted_builtins.get(BuiltInPosition)) + { + auto itr = builtin_xfb_offsets.find(BuiltInPosition); + if (itr != end(builtin_xfb_offsets)) + statement("layout(xfb_offset = ", itr->second, ") vec4 gl_Position;"); + else + statement("vec4 gl_Position;"); + } + + if (emitted_builtins.get(BuiltInPointSize)) + { + auto itr = builtin_xfb_offsets.find(BuiltInPointSize); + if (itr != end(builtin_xfb_offsets)) + statement("layout(xfb_offset = ", itr->second, ") float gl_PointSize;"); + else + statement("float gl_PointSize;"); + } + + if (emitted_builtins.get(BuiltInClipDistance)) + { + auto itr = builtin_xfb_offsets.find(BuiltInClipDistance); + if (itr != end(builtin_xfb_offsets)) + statement("layout(xfb_offset = ", itr->second, ") float gl_ClipDistance[", clip_distance_size, "];"); + else + statement("float gl_ClipDistance[", clip_distance_size, "];"); + } + + if (emitted_builtins.get(BuiltInCullDistance)) + { + auto itr = builtin_xfb_offsets.find(BuiltInCullDistance); + if (itr != end(builtin_xfb_offsets)) + statement("layout(xfb_offset = ", itr->second, ") float gl_CullDistance[", cull_distance_size, "];"); + else + statement("float gl_CullDistance[", cull_distance_size, "];"); + } + + bool builtin_array = model == ExecutionModelTessellationControl || + (model == ExecutionModelMeshEXT && storage == StorageClassOutput) || + (model == ExecutionModelGeometry && storage == StorageClassInput) || + (model == ExecutionModelTessellationEvaluation && storage == StorageClassInput); + + if (builtin_array) + { + const char *instance_name; + if (model == ExecutionModelMeshEXT) + instance_name = "gl_MeshVerticesEXT"; // Per primitive is never synthesized. + else + instance_name = storage == StorageClassInput ? "gl_in" : "gl_out"; + + if (model == ExecutionModelTessellationControl && storage == StorageClassOutput) + end_scope_decl(join(instance_name, "[", get_entry_point().output_vertices, "]")); + else + end_scope_decl(join(instance_name, "[]")); + } + else + end_scope_decl(); + statement(""); +} + +bool CompilerGLSL::variable_is_lut(const SPIRVariable &var) const +{ + bool statically_assigned = var.statically_assigned && var.static_expression != ID(0) && var.remapped_variable; + + if (statically_assigned) + { + auto *constant = maybe_get(var.static_expression); + if (constant && constant->is_used_as_lut) + return true; + } + + return false; +} + +void CompilerGLSL::emit_resources() +{ + auto &execution = get_entry_point(); + + replace_illegal_names(); + + // Legacy GL uses gl_FragData[], redeclare all fragment outputs + // with builtins. + if (execution.model == ExecutionModelFragment && is_legacy()) + replace_fragment_outputs(); + + // Emit PLS blocks if we have such variables. + if (!pls_inputs.empty() || !pls_outputs.empty()) + emit_pls(); + + switch (execution.model) + { + case ExecutionModelGeometry: + case ExecutionModelTessellationControl: + case ExecutionModelTessellationEvaluation: + case ExecutionModelMeshEXT: + fixup_implicit_builtin_block_names(execution.model); + break; + + default: + break; + } + + // Emit custom gl_PerVertex for SSO compatibility. + if (options.separate_shader_objects && !options.es && execution.model != ExecutionModelFragment) + { + switch (execution.model) + { + case ExecutionModelGeometry: + case ExecutionModelTessellationControl: + case ExecutionModelTessellationEvaluation: + emit_declared_builtin_block(StorageClassInput, execution.model); + emit_declared_builtin_block(StorageClassOutput, execution.model); + break; + + case ExecutionModelVertex: + case ExecutionModelMeshEXT: + emit_declared_builtin_block(StorageClassOutput, execution.model); + break; + + default: + break; + } + } + else if (should_force_emit_builtin_block(StorageClassOutput)) + { + emit_declared_builtin_block(StorageClassOutput, execution.model); + } + else if (execution.geometry_passthrough) + { + // Need to declare gl_in with Passthrough. + // If we're doing passthrough, we cannot emit an output block, so the output block test above will never pass. + emit_declared_builtin_block(StorageClassInput, execution.model); + } + else + { + // Need to redeclare clip/cull distance with explicit size to use them. + // SPIR-V mandates these builtins have a size declared. + const char *storage = execution.model == ExecutionModelFragment ? "in" : "out"; + if (clip_distance_count != 0) + statement(storage, " float gl_ClipDistance[", clip_distance_count, "];"); + if (cull_distance_count != 0) + statement(storage, " float gl_CullDistance[", cull_distance_count, "];"); + if (clip_distance_count != 0 || cull_distance_count != 0) + statement(""); + } + + if (position_invariant && (options.es || options.version >= 120)) + { + statement("invariant gl_Position;"); + statement(""); + } + + bool emitted = false; + + // If emitted Vulkan GLSL, + // emit specialization constants as actual floats, + // spec op expressions will redirect to the constant name. + // + { + auto loop_lock = ir.create_loop_hard_lock(); + for (auto &id_ : ir.ids_for_constant_undef_or_type) + { + auto &id = ir.ids[id_]; + + if (id.get_type() == TypeConstant) + { + auto &c = id.get(); + + bool needs_declaration = c.specialization || c.is_used_as_lut; + + if (needs_declaration) + { + if (!options.vulkan_semantics && c.specialization) + { + c.specialization_constant_macro_name = + constant_value_macro_name(get_decoration(c.self, DecorationSpecId)); + } + emit_constant(c); + emitted = true; + } + } + else if (id.get_type() == TypeConstantOp) + { + emit_specialization_constant_op(id.get()); + emitted = true; + } + else if (id.get_type() == TypeType) + { + auto *type = &id.get(); + + bool is_natural_struct = type->basetype == SPIRType::Struct && type->array.empty() && !type->pointer && + (!has_decoration(type->self, DecorationBlock) && + !has_decoration(type->self, DecorationBufferBlock)); + + // Special case, ray payload and hit attribute blocks are not really blocks, just regular structs. + if (type->basetype == SPIRType::Struct && type->pointer && + has_decoration(type->self, DecorationBlock) && + (type->storage == StorageClassRayPayloadKHR || type->storage == StorageClassIncomingRayPayloadKHR || + type->storage == StorageClassHitAttributeKHR)) + { + type = &get(type->parent_type); + is_natural_struct = true; + } + + if (is_natural_struct) + { + if (emitted) + statement(""); + emitted = false; + + emit_struct(*type); + } + } + else if (id.get_type() == TypeUndef) + { + auto &undef = id.get(); + auto &type = this->get(undef.basetype); + // OpUndef can be void for some reason ... + if (type.basetype == SPIRType::Void) + return; + + string initializer; + if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + initializer = join(" = ", to_zero_initialized_expression(undef.basetype)); + + // FIXME: If used in a constant, we must declare it as one. + statement(variable_decl(type, to_name(undef.self), undef.self), initializer, ";"); + emitted = true; + } + } + } + + if (emitted) + statement(""); + + // If we needed to declare work group size late, check here. + // If the work group size depends on a specialization constant, we need to declare the layout() block + // after constants (and their macros) have been declared. + if (execution.model == ExecutionModelGLCompute && !options.vulkan_semantics && + (execution.workgroup_size.constant != 0 || execution.flags.get(ExecutionModeLocalSizeId))) + { + SpecializationConstant wg_x, wg_y, wg_z; + get_work_group_size_specialization_constants(wg_x, wg_y, wg_z); + + if ((wg_x.id != ConstantID(0)) || (wg_y.id != ConstantID(0)) || (wg_z.id != ConstantID(0))) + { + SmallVector inputs; + build_workgroup_size(inputs, wg_x, wg_y, wg_z); + statement("layout(", merge(inputs), ") in;"); + statement(""); + } + } + + emitted = false; + + if (ir.addressing_model == AddressingModelPhysicalStorageBuffer64EXT) + { + for (auto type : physical_storage_non_block_pointer_types) + { + emit_buffer_reference_block(type, false); + } + + // Output buffer reference blocks. + // Do this in two stages, one with forward declaration, + // and one without. Buffer reference blocks can reference themselves + // to support things like linked lists. + ir.for_each_typed_id([&](uint32_t self, SPIRType &type) { + if (type.basetype == SPIRType::Struct && type.pointer && + type.pointer_depth == 1 && !type_is_array_of_pointers(type) && + type.storage == StorageClassPhysicalStorageBufferEXT) + { + emit_buffer_reference_block(self, true); + } + }); + + ir.for_each_typed_id([&](uint32_t self, SPIRType &type) { + if (type.basetype == SPIRType::Struct && + type.pointer && type.pointer_depth == 1 && !type_is_array_of_pointers(type) && + type.storage == StorageClassPhysicalStorageBufferEXT) + { + emit_buffer_reference_block(self, false); + } + }); + } + + // Output UBOs and SSBOs + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + + bool is_block_storage = type.storage == StorageClassStorageBuffer || type.storage == StorageClassUniform || + type.storage == StorageClassShaderRecordBufferKHR; + bool has_block_flags = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) || + ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); + + if (var.storage != StorageClassFunction && type.pointer && is_block_storage && !is_hidden_variable(var) && + has_block_flags) + { + emit_buffer_block(var); + } + }); + + // Output push constant blocks + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + if (var.storage != StorageClassFunction && type.pointer && type.storage == StorageClassPushConstant && + !is_hidden_variable(var)) + { + emit_push_constant_block(var); + } + }); + + bool skip_separate_image_sampler = !combined_image_samplers.empty() || !options.vulkan_semantics; + + // Output Uniform Constants (values, samplers, images, etc). + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + + // If we're remapping separate samplers and images, only emit the combined samplers. + if (skip_separate_image_sampler) + { + // Sampler buffers are always used without a sampler, and they will also work in regular GL. + bool sampler_buffer = type.basetype == SPIRType::Image && type.image.dim == DimBuffer; + bool separate_image = type.basetype == SPIRType::Image && type.image.sampled == 1; + bool separate_sampler = type.basetype == SPIRType::Sampler; + if (!sampler_buffer && (separate_image || separate_sampler)) + return; + } + + if (var.storage != StorageClassFunction && type.pointer && + (type.storage == StorageClassUniformConstant || type.storage == StorageClassAtomicCounter || + type.storage == StorageClassRayPayloadKHR || type.storage == StorageClassIncomingRayPayloadKHR || + type.storage == StorageClassCallableDataKHR || type.storage == StorageClassIncomingCallableDataKHR || + type.storage == StorageClassHitAttributeKHR) && + !is_hidden_variable(var)) + { + emit_uniform(var); + emitted = true; + } + }); + + if (emitted) + statement(""); + emitted = false; + + bool emitted_base_instance = false; + + // Output in/out interfaces. + ir.for_each_typed_id([&](uint32_t, SPIRVariable &var) { + auto &type = this->get(var.basetype); + + bool is_hidden = is_hidden_variable(var); + + // Unused output I/O variables might still be required to implement framebuffer fetch. + if (var.storage == StorageClassOutput && !is_legacy() && + location_is_framebuffer_fetch(get_decoration(var.self, DecorationLocation)) != 0) + { + is_hidden = false; + } + + if (var.storage != StorageClassFunction && type.pointer && + (var.storage == StorageClassInput || var.storage == StorageClassOutput) && + interface_variable_exists_in_entry_point(var.self) && !is_hidden) + { + if (options.es && get_execution_model() == ExecutionModelVertex && var.storage == StorageClassInput && + type.array.size() == 1) + { + SPIRV_CROSS_THROW("OpenGL ES doesn't support array input variables in vertex shader."); + } + emit_interface_block(var); + emitted = true; + } + else if (is_builtin_variable(var)) + { + auto builtin = BuiltIn(get_decoration(var.self, DecorationBuiltIn)); + // For gl_InstanceIndex emulation on GLES, the API user needs to + // supply this uniform. + + // The draw parameter extension is soft-enabled on GL with some fallbacks. + if (!options.vulkan_semantics) + { + if (!emitted_base_instance && + ((options.vertex.support_nonzero_base_instance && builtin == BuiltInInstanceIndex) || + (builtin == BuiltInBaseInstance))) + { + statement("#ifdef GL_ARB_shader_draw_parameters"); + statement("#define SPIRV_Cross_BaseInstance gl_BaseInstanceARB"); + statement("#else"); + // A crude, but simple workaround which should be good enough for non-indirect draws. + statement("uniform int SPIRV_Cross_BaseInstance;"); + statement("#endif"); + emitted = true; + emitted_base_instance = true; + } + else if (builtin == BuiltInBaseVertex) + { + statement("#ifdef GL_ARB_shader_draw_parameters"); + statement("#define SPIRV_Cross_BaseVertex gl_BaseVertexARB"); + statement("#else"); + // A crude, but simple workaround which should be good enough for non-indirect draws. + statement("uniform int SPIRV_Cross_BaseVertex;"); + statement("#endif"); + } + else if (builtin == BuiltInDrawIndex) + { + statement("#ifndef GL_ARB_shader_draw_parameters"); + // Cannot really be worked around. + statement("#error GL_ARB_shader_draw_parameters is not supported."); + statement("#endif"); + } + } + } + }); + + // Global variables. + for (auto global : global_variables) + { + auto &var = get(global); + if (is_hidden_variable(var, true)) + continue; + + if (var.storage != StorageClassOutput) + { + if (!variable_is_lut(var)) + { + add_resource_name(var.self); + + string initializer; + if (options.force_zero_initialized_variables && var.storage == StorageClassPrivate && + !var.initializer && !var.static_expression && type_can_zero_initialize(get_variable_data_type(var))) + { + initializer = join(" = ", to_zero_initialized_expression(get_variable_data_type_id(var))); + } + + statement(variable_decl(var), initializer, ";"); + emitted = true; + } + } + else if (var.initializer && maybe_get(var.initializer) != nullptr) + { + emit_output_variable_initializer(var); + } + } + + if (emitted) + statement(""); +} + +void CompilerGLSL::emit_output_variable_initializer(const SPIRVariable &var) +{ + // If a StorageClassOutput variable has an initializer, we need to initialize it in main(). + auto &entry_func = this->get(ir.default_entry_point); + auto &type = get(var.basetype); + bool is_patch = has_decoration(var.self, DecorationPatch); + bool is_block = has_decoration(type.self, DecorationBlock); + bool is_control_point = get_execution_model() == ExecutionModelTessellationControl && !is_patch; + + if (is_block) + { + uint32_t member_count = uint32_t(type.member_types.size()); + bool type_is_array = type.array.size() == 1; + uint32_t array_size = 1; + if (type_is_array) + array_size = to_array_size_literal(type); + uint32_t iteration_count = is_control_point ? 1 : array_size; + + // If the initializer is a block, we must initialize each block member one at a time. + for (uint32_t i = 0; i < member_count; i++) + { + // These outputs might not have been properly declared, so don't initialize them in that case. + if (has_member_decoration(type.self, i, DecorationBuiltIn)) + { + if (get_member_decoration(type.self, i, DecorationBuiltIn) == BuiltInCullDistance && + !cull_distance_count) + continue; + + if (get_member_decoration(type.self, i, DecorationBuiltIn) == BuiltInClipDistance && + !clip_distance_count) + continue; + } + + // We need to build a per-member array first, essentially transposing from AoS to SoA. + // This code path hits when we have an array of blocks. + string lut_name; + if (type_is_array) + { + lut_name = join("_", var.self, "_", i, "_init"); + uint32_t member_type_id = get(var.basetype).member_types[i]; + auto &member_type = get(member_type_id); + auto array_type = member_type; + array_type.parent_type = member_type_id; + array_type.array.push_back(array_size); + array_type.array_size_literal.push_back(true); + + SmallVector exprs; + exprs.reserve(array_size); + auto &c = get(var.initializer); + for (uint32_t j = 0; j < array_size; j++) + exprs.push_back(to_expression(get(c.subconstants[j]).subconstants[i])); + statement("const ", type_to_glsl(array_type), " ", lut_name, type_to_array_glsl(array_type), " = ", + type_to_glsl_constructor(array_type), "(", merge(exprs, ", "), ");"); + } + + for (uint32_t j = 0; j < iteration_count; j++) + { + entry_func.fixup_hooks_in.push_back([=, &var]() { + AccessChainMeta meta; + auto &c = this->get(var.initializer); + + uint32_t invocation_id = 0; + uint32_t member_index_id = 0; + if (is_control_point) + { + uint32_t ids = ir.increase_bound_by(3); + SPIRType uint_type; + uint_type.basetype = SPIRType::UInt; + uint_type.width = 32; + set(ids, uint_type); + set(ids + 1, builtin_to_glsl(BuiltInInvocationId, StorageClassInput), ids, true); + set(ids + 2, ids, i, false); + invocation_id = ids + 1; + member_index_id = ids + 2; + } + + if (is_patch) + { + statement("if (gl_InvocationID == 0)"); + begin_scope(); + } + + if (type_is_array && !is_control_point) + { + uint32_t indices[2] = { j, i }; + auto chain = access_chain_internal(var.self, indices, 2, ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, &meta); + statement(chain, " = ", lut_name, "[", j, "];"); + } + else if (is_control_point) + { + uint32_t indices[2] = { invocation_id, member_index_id }; + auto chain = access_chain_internal(var.self, indices, 2, 0, &meta); + statement(chain, " = ", lut_name, "[", builtin_to_glsl(BuiltInInvocationId, StorageClassInput), "];"); + } + else + { + auto chain = + access_chain_internal(var.self, &i, 1, ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, &meta); + statement(chain, " = ", to_expression(c.subconstants[i]), ";"); + } + + if (is_patch) + end_scope(); + }); + } + } + } + else if (is_control_point) + { + auto lut_name = join("_", var.self, "_init"); + statement("const ", type_to_glsl(type), " ", lut_name, type_to_array_glsl(type), + " = ", to_expression(var.initializer), ";"); + entry_func.fixup_hooks_in.push_back([&, lut_name]() { + statement(to_expression(var.self), "[gl_InvocationID] = ", lut_name, "[gl_InvocationID];"); + }); + } + else if (has_decoration(var.self, DecorationBuiltIn) && + BuiltIn(get_decoration(var.self, DecorationBuiltIn)) == BuiltInSampleMask) + { + // We cannot copy the array since gl_SampleMask is unsized in GLSL. Unroll time! <_< + entry_func.fixup_hooks_in.push_back([&] { + auto &c = this->get(var.initializer); + uint32_t num_constants = uint32_t(c.subconstants.size()); + for (uint32_t i = 0; i < num_constants; i++) + { + // Don't use to_expression on constant since it might be uint, just fish out the raw int. + statement(to_expression(var.self), "[", i, "] = ", + convert_to_string(this->get(c.subconstants[i]).scalar_i32()), ";"); + } + }); + } + else + { + auto lut_name = join("_", var.self, "_init"); + statement("const ", type_to_glsl(type), " ", lut_name, + type_to_array_glsl(type), " = ", to_expression(var.initializer), ";"); + entry_func.fixup_hooks_in.push_back([&, lut_name, is_patch]() { + if (is_patch) + { + statement("if (gl_InvocationID == 0)"); + begin_scope(); + } + statement(to_expression(var.self), " = ", lut_name, ";"); + if (is_patch) + end_scope(); + }); + } +} + +void CompilerGLSL::emit_subgroup_arithmetic_workaround(const std::string &func, Op op, GroupOperation group_op) +{ + std::string result; + switch (group_op) + { + case GroupOperationReduce: + result = "reduction"; + break; + + case GroupOperationExclusiveScan: + result = "excl_scan"; + break; + + case GroupOperationInclusiveScan: + result = "incl_scan"; + break; + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + struct TypeInfo + { + std::string type; + std::string identity; + }; + + std::vector type_infos; + switch (op) + { + case OpGroupNonUniformIAdd: + { + type_infos.emplace_back(TypeInfo{ "uint", "0u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(0u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(0u)" }); + type_infos.emplace_back(TypeInfo{ "int", "0" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(0)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(0)" }); + break; + } + + case OpGroupNonUniformFAdd: + { + type_infos.emplace_back(TypeInfo{ "float", "0.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(0.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(0.0f)" }); + // ARB_gpu_shader_fp64 is required in GL4.0 which in turn is required by NV_thread_shuffle + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(0.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(0.0LF)" }); + break; + } + + case OpGroupNonUniformIMul: + { + type_infos.emplace_back(TypeInfo{ "uint", "1u" }); + type_infos.emplace_back(TypeInfo{ "uvec2", "uvec2(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec3", "uvec3(1u)" }); + type_infos.emplace_back(TypeInfo{ "uvec4", "uvec4(1u)" }); + type_infos.emplace_back(TypeInfo{ "int", "1" }); + type_infos.emplace_back(TypeInfo{ "ivec2", "ivec2(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec3", "ivec3(1)" }); + type_infos.emplace_back(TypeInfo{ "ivec4", "ivec4(1)" }); + break; + } + + case OpGroupNonUniformFMul: + { + type_infos.emplace_back(TypeInfo{ "float", "1.0f" }); + type_infos.emplace_back(TypeInfo{ "vec2", "vec2(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec3", "vec3(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "vec4", "vec4(1.0f)" }); + type_infos.emplace_back(TypeInfo{ "double", "0.0LF" }); + type_infos.emplace_back(TypeInfo{ "dvec2", "dvec2(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec3", "dvec3(1.0LF)" }); + type_infos.emplace_back(TypeInfo{ "dvec4", "dvec4(1.0LF)" }); + break; + } + + default: + SPIRV_CROSS_THROW("Unsupported workaround for arithmetic group operation"); + } + + const bool op_is_addition = op == OpGroupNonUniformIAdd || op == OpGroupNonUniformFAdd; + const bool op_is_multiplication = op == OpGroupNonUniformIMul || op == OpGroupNonUniformFMul; + std::string op_symbol; + if (op_is_addition) + { + op_symbol = "+="; + } + else if (op_is_multiplication) + { + op_symbol = "*="; + } + + for (const TypeInfo &t : type_infos) + { + statement(t.type, " ", func, "(", t.type, " v)"); + begin_scope(); + statement(t.type, " ", result, " = ", t.identity, ";"); + statement("uvec4 active_threads = subgroupBallot(true);"); + statement("if (subgroupBallotBitCount(active_threads) == gl_SubgroupSize)"); + begin_scope(); + statement("uint total = gl_SubgroupSize / 2u;"); + statement(result, " = v;"); + statement("for (uint i = 1u; i <= total; i <<= 1u)"); + begin_scope(); + statement("bool valid;"); + if (group_op == GroupOperationReduce) + { + statement(t.type, " s = shuffleXorNV(", result, ", i, gl_SubgroupSize, valid);"); + } + else if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement(t.type, " s = shuffleUpNV(", result, ", i, gl_SubgroupSize, valid);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement(result, " = shuffleUpNV(", result, ", 1u, gl_SubgroupSize);"); + statement("if (subgroupElect())"); + begin_scope(); + statement(result, " = ", t.identity, ";"); + end_scope(); + } + end_scope(); + statement("else"); + begin_scope(); + if (group_op == GroupOperationExclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLtMask);"); + } + else if (group_op == GroupOperationInclusiveScan) + { + statement("uint total = subgroupBallotBitCount(gl_SubgroupLeMask);"); + } + statement("for (uint i = 0u; i < gl_SubgroupSize; ++i)"); + begin_scope(); + statement("bool valid = subgroupBallotBitExtract(active_threads, i);"); + statement(t.type, " s = shuffleNV(v, i, gl_SubgroupSize);"); + if (group_op == GroupOperationExclusiveScan || group_op == GroupOperationInclusiveScan) + { + statement("valid = valid && (i < total);"); + } + if (op_is_addition || op_is_multiplication) + { + statement(result, " ", op_symbol, " valid ? s : ", t.identity, ";"); + } + end_scope(); + end_scope(); + statement("return ", result, ";"); + end_scope(); + } +} + +void CompilerGLSL::emit_extension_workarounds(spv::ExecutionModel model) +{ + static const char *workaround_types[] = { "int", "ivec2", "ivec3", "ivec4", "uint", "uvec2", "uvec3", "uvec4", + "float", "vec2", "vec3", "vec4", "double", "dvec2", "dvec3", "dvec4" }; + + if (!options.vulkan_semantics) + { + using Supp = ShaderSubgroupSupportHelper; + auto result = shader_subgroup_supporter.resolve(); + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupMask)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupMask, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("#define gl_SubgroupEqMask uvec4(gl_ThreadEqMaskNV, 0u, 0u, 0u)"); + statement("#define gl_SubgroupGeMask uvec4(gl_ThreadGeMaskNV, 0u, 0u, 0u)"); + statement("#define gl_SubgroupGtMask uvec4(gl_ThreadGtMaskNV, 0u, 0u, 0u)"); + statement("#define gl_SubgroupLeMask uvec4(gl_ThreadLeMaskNV, 0u, 0u, 0u)"); + statement("#define gl_SubgroupLtMask uvec4(gl_ThreadLtMaskNV, 0u, 0u, 0u)"); + break; + case Supp::ARB_shader_ballot: + statement("#define gl_SubgroupEqMask uvec4(unpackUint2x32(gl_SubGroupEqMaskARB), 0u, 0u)"); + statement("#define gl_SubgroupGeMask uvec4(unpackUint2x32(gl_SubGroupGeMaskARB), 0u, 0u)"); + statement("#define gl_SubgroupGtMask uvec4(unpackUint2x32(gl_SubGroupGtMaskARB), 0u, 0u)"); + statement("#define gl_SubgroupLeMask uvec4(unpackUint2x32(gl_SubGroupLeMaskARB), 0u, 0u)"); + statement("#define gl_SubgroupLtMask uvec4(unpackUint2x32(gl_SubGroupLtMaskARB), 0u, 0u)"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupSize)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupSize, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("#define gl_SubgroupSize gl_WarpSizeNV"); + break; + case Supp::ARB_shader_ballot: + statement("#define gl_SubgroupSize gl_SubGroupSizeARB"); + break; + case Supp::AMD_gcn_shader: + statement("#define gl_SubgroupSize uint(gl_SIMDGroupSizeAMD)"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupInvocationID)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupInvocationID, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("#define gl_SubgroupInvocationID gl_ThreadInWarpNV"); + break; + case Supp::ARB_shader_ballot: + statement("#define gl_SubgroupInvocationID gl_SubGroupInvocationARB"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupID)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupID, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("#define gl_SubgroupID gl_WarpIDNV"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::NumSubgroups)) + { + auto exts = Supp::get_candidates_for_feature(Supp::NumSubgroups, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("#define gl_NumSubgroups gl_WarpsPerSMNV"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBroadcast_First)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupBroadcast_First, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_shuffle: + for (const char *t : workaround_types) + { + statement(t, " subgroupBroadcastFirst(", t, + " value) { return shuffleNV(value, findLSB(ballotThreadNV(true)), gl_WarpSizeNV); }"); + } + for (const char *t : workaround_types) + { + statement(t, " subgroupBroadcast(", t, + " value, uint id) { return shuffleNV(value, id, gl_WarpSizeNV); }"); + } + break; + case Supp::ARB_shader_ballot: + for (const char *t : workaround_types) + { + statement(t, " subgroupBroadcastFirst(", t, + " value) { return readFirstInvocationARB(value); }"); + } + for (const char *t : workaround_types) + { + statement(t, " subgroupBroadcast(", t, + " value, uint id) { return readInvocationARB(value, id); }"); + } + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBallotFindLSB_MSB)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupBallotFindLSB_MSB, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("uint subgroupBallotFindLSB(uvec4 value) { return findLSB(value.x); }"); + statement("uint subgroupBallotFindMSB(uvec4 value) { return findMSB(value.x); }"); + break; + default: + break; + } + } + statement("#else"); + statement("uint subgroupBallotFindLSB(uvec4 value)"); + begin_scope(); + statement("int firstLive = findLSB(value.x);"); + statement("return uint(firstLive != -1 ? firstLive : (findLSB(value.y) + 32));"); + end_scope(); + statement("uint subgroupBallotFindMSB(uvec4 value)"); + begin_scope(); + statement("int firstLive = findMSB(value.y);"); + statement("return uint(firstLive != -1 ? (firstLive + 32) : findMSB(value.x));"); + end_scope(); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupAll_Any_AllEqualBool)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupAll_Any_AllEqualBool, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_gpu_shader_5: + statement("bool subgroupAll(bool value) { return allThreadsNV(value); }"); + statement("bool subgroupAny(bool value) { return anyThreadNV(value); }"); + statement("bool subgroupAllEqual(bool value) { return allThreadsEqualNV(value); }"); + break; + case Supp::ARB_shader_group_vote: + statement("bool subgroupAll(bool v) { return allInvocationsARB(v); }"); + statement("bool subgroupAny(bool v) { return anyInvocationARB(v); }"); + statement("bool subgroupAllEqual(bool v) { return allInvocationsEqualARB(v); }"); + break; + case Supp::AMD_gcn_shader: + statement("bool subgroupAll(bool value) { return ballotAMD(value) == ballotAMD(true); }"); + statement("bool subgroupAny(bool value) { return ballotAMD(value) != 0ull; }"); + statement("bool subgroupAllEqual(bool value) { uint64_t b = ballotAMD(value); return b == 0ull || " + "b == ballotAMD(true); }"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupAllEqualT)) + { + statement("#ifndef GL_KHR_shader_subgroup_vote"); + statement( + "#define _SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(type) bool subgroupAllEqual(type value) { return " + "subgroupAllEqual(subgroupBroadcastFirst(value) == value); }"); + for (const char *t : workaround_types) + statement("_SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND(", t, ")"); + statement("#undef _SPIRV_CROSS_SUBGROUP_ALL_EQUAL_WORKAROUND"); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBallot)) + { + auto exts = Supp::get_candidates_for_feature(Supp::SubgroupBallot, result); + + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_group: + statement("uvec4 subgroupBallot(bool v) { return uvec4(ballotThreadNV(v), 0u, 0u, 0u); }"); + break; + case Supp::ARB_shader_ballot: + statement("uvec4 subgroupBallot(bool v) { return uvec4(unpackUint2x32(ballotARB(v)), 0u, 0u); }"); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupElect)) + { + statement("#ifndef GL_KHR_shader_subgroup_basic"); + statement("bool subgroupElect()"); + begin_scope(); + statement("uvec4 activeMask = subgroupBallot(true);"); + statement("uint firstLive = subgroupBallotFindLSB(activeMask);"); + statement("return gl_SubgroupInvocationID == firstLive;"); + end_scope(); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBarrier)) + { + // Extensions we're using in place of GL_KHR_shader_subgroup_basic state + // that subgroup execute in lockstep so this barrier is implicit. + // However the GL 4.6 spec also states that `barrier` implies a shared memory barrier, + // and a specific test of optimizing scans by leveraging lock-step invocation execution, + // has shown that a `memoryBarrierShared` is needed in place of a `subgroupBarrier`. + // https://github.com/buildaworldnet/IrrlichtBAW/commit/d8536857991b89a30a6b65d29441e51b64c2c7ad#diff-9f898d27be1ea6fc79b03d9b361e299334c1a347b6e4dc344ee66110c6aa596aR19 + statement("#ifndef GL_KHR_shader_subgroup_basic"); + statement("void subgroupBarrier() { memoryBarrierShared(); }"); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupMemBarrier)) + { + if (model == spv::ExecutionModelGLCompute) + { + statement("#ifndef GL_KHR_shader_subgroup_basic"); + statement("void subgroupMemoryBarrier() { groupMemoryBarrier(); }"); + statement("void subgroupMemoryBarrierBuffer() { groupMemoryBarrier(); }"); + statement("void subgroupMemoryBarrierShared() { memoryBarrierShared(); }"); + statement("void subgroupMemoryBarrierImage() { groupMemoryBarrier(); }"); + statement("#endif"); + } + else + { + statement("#ifndef GL_KHR_shader_subgroup_basic"); + statement("void subgroupMemoryBarrier() { memoryBarrier(); }"); + statement("void subgroupMemoryBarrierBuffer() { memoryBarrierBuffer(); }"); + statement("void subgroupMemoryBarrierImage() { memoryBarrierImage(); }"); + statement("#endif"); + } + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupInverseBallot_InclBitCount_ExclBitCout)) + { + statement("#ifndef GL_KHR_shader_subgroup_ballot"); + statement("bool subgroupInverseBallot(uvec4 value)"); + begin_scope(); + statement("return any(notEqual(value.xy & gl_SubgroupEqMask.xy, uvec2(0u)));"); + end_scope(); + + statement("uint subgroupBallotInclusiveBitCount(uvec4 value)"); + begin_scope(); + statement("uvec2 v = value.xy & gl_SubgroupLeMask.xy;"); + statement("ivec2 c = bitCount(v);"); + statement_no_indent("#ifdef GL_NV_shader_thread_group"); + statement("return uint(c.x);"); + statement_no_indent("#else"); + statement("return uint(c.x + c.y);"); + statement_no_indent("#endif"); + end_scope(); + + statement("uint subgroupBallotExclusiveBitCount(uvec4 value)"); + begin_scope(); + statement("uvec2 v = value.xy & gl_SubgroupLtMask.xy;"); + statement("ivec2 c = bitCount(v);"); + statement_no_indent("#ifdef GL_NV_shader_thread_group"); + statement("return uint(c.x);"); + statement_no_indent("#else"); + statement("return uint(c.x + c.y);"); + statement_no_indent("#endif"); + end_scope(); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBallotBitCount)) + { + statement("#ifndef GL_KHR_shader_subgroup_ballot"); + statement("uint subgroupBallotBitCount(uvec4 value)"); + begin_scope(); + statement("ivec2 c = bitCount(value.xy);"); + statement_no_indent("#ifdef GL_NV_shader_thread_group"); + statement("return uint(c.x);"); + statement_no_indent("#else"); + statement("return uint(c.x + c.y);"); + statement_no_indent("#endif"); + end_scope(); + statement("#endif"); + statement(""); + } + + if (shader_subgroup_supporter.is_feature_requested(Supp::SubgroupBallotBitExtract)) + { + statement("#ifndef GL_KHR_shader_subgroup_ballot"); + statement("bool subgroupBallotBitExtract(uvec4 value, uint index)"); + begin_scope(); + statement_no_indent("#ifdef GL_NV_shader_thread_group"); + statement("uint shifted = value.x >> index;"); + statement_no_indent("#else"); + statement("uint shifted = value[index >> 5u] >> (index & 0x1fu);"); + statement_no_indent("#endif"); + statement("return (shifted & 1u) != 0u;"); + end_scope(); + statement("#endif"); + statement(""); + } + + auto arithmetic_feature_helper = + [&](Supp::Feature feat, std::string func_name, spv::Op op, spv::GroupOperation group_op) + { + if (shader_subgroup_supporter.is_feature_requested(feat)) + { + auto exts = Supp::get_candidates_for_feature(feat, result); + for (auto &e : exts) + { + const char *name = Supp::get_extension_name(e); + statement(&e == &exts.front() ? "#if" : "#elif", " defined(", name, ")"); + + switch (e) + { + case Supp::NV_shader_thread_shuffle: + emit_subgroup_arithmetic_workaround(func_name, op, group_op); + break; + default: + break; + } + } + statement("#endif"); + statement(""); + } + }; + + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddReduce, "subgroupAdd", OpGroupNonUniformIAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformIAdd, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddReduce, "subgroupAdd", OpGroupNonUniformFAdd, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddExclusiveScan, "subgroupExclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFAddInclusiveScan, "subgroupInclusiveAdd", + OpGroupNonUniformFAdd, GroupOperationInclusiveScan); + + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulReduce, "subgroupMul", OpGroupNonUniformIMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformIMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticIMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformIMul, GroupOperationInclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulReduce, "subgroupMul", OpGroupNonUniformFMul, + GroupOperationReduce); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulExclusiveScan, "subgroupExclusiveMul", + OpGroupNonUniformFMul, GroupOperationExclusiveScan); + arithmetic_feature_helper(Supp::SubgroupArithmeticFMulInclusiveScan, "subgroupInclusiveMul", + OpGroupNonUniformFMul, GroupOperationInclusiveScan); + } + + if (!workaround_ubo_load_overload_types.empty()) + { + for (auto &type_id : workaround_ubo_load_overload_types) + { + auto &type = get(type_id); + + if (options.es && is_matrix(type)) + { + // Need both variants. + // GLSL cannot overload on precision, so need to dispatch appropriately. + statement("highp ", type_to_glsl(type), " spvWorkaroundRowMajor(highp ", type_to_glsl(type), " wrap) { return wrap; }"); + statement("mediump ", type_to_glsl(type), " spvWorkaroundRowMajorMP(mediump ", type_to_glsl(type), " wrap) { return wrap; }"); + } + else + { + statement(type_to_glsl(type), " spvWorkaroundRowMajor(", type_to_glsl(type), " wrap) { return wrap; }"); + } + } + statement(""); + } +} + +void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed) +{ + const char *qual = ""; + const char *suffix = (options.es && relaxed) ? "MP" : ""; + if (options.es) + qual = relaxed ? "mediump " : "highp "; + + if (polyfills & PolyfillTranspose2x2) + { + statement(qual, "mat2 spvTranspose", suffix, "(", qual, "mat2 m)"); + begin_scope(); + statement("return mat2(m[0][0], m[1][0], m[0][1], m[1][1]);"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillTranspose3x3) + { + statement(qual, "mat3 spvTranspose", suffix, "(", qual, "mat3 m)"); + begin_scope(); + statement("return mat3(m[0][0], m[1][0], m[2][0], m[0][1], m[1][1], m[2][1], m[0][2], m[1][2], m[2][2]);"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillTranspose4x4) + { + statement(qual, "mat4 spvTranspose", suffix, "(", qual, "mat4 m)"); + begin_scope(); + statement("return mat4(m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], " + "m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]);"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillDeterminant2x2) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat2 m)"); + begin_scope(); + statement("return m[0][0] * m[1][1] - m[0][1] * m[1][0];"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillDeterminant3x3) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat3 m)"); + begin_scope(); + statement("return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], " + "m[1][2] * m[2][0] - m[1][0] * m[2][2], " + "m[1][0] * m[2][1] - m[1][1] * m[2][0]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillDeterminant4x4) + { + statement(qual, "float spvDeterminant", suffix, "(", qual, "mat4 m)"); + begin_scope(); + statement("return dot(m[0], vec4(" + "m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], " + "m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], " + "m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], " + "m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse2x2) + { + statement(qual, "mat2 spvInverse", suffix, "(", qual, "mat2 m)"); + begin_scope(); + statement("return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) " + "* (1.0 / (m[0][0] * m[1][1] - m[1][0] * m[0][1]));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse3x3) + { + statement(qual, "mat3 spvInverse", suffix, "(", qual, "mat3 m)"); + begin_scope(); + statement(qual, "vec3 t = vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]);"); + statement("return mat3(t[0], " + "m[0][2] * m[2][1] - m[0][1] * m[2][2], " + "m[0][1] * m[1][2] - m[0][2] * m[1][1], " + "t[1], " + "m[0][0] * m[2][2] - m[0][2] * m[2][0], " + "m[0][2] * m[1][0] - m[0][0] * m[1][2], " + "t[2], " + "m[0][1] * m[2][0] - m[0][0] * m[2][1], " + "m[0][0] * m[1][1] - m[0][1] * m[1][0]) " + "* (1.0 / dot(m[0], t));"); + end_scope(); + statement(""); + } + + if (polyfills & PolyfillMatrixInverse4x4) + { + statement(qual, "mat4 spvInverse", suffix, "(", qual, "mat4 m)"); + begin_scope(); + statement(qual, "vec4 t = vec4(" + "m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], " + "m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], " + "m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], " + "m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]);"); + statement("return mat4(" + "t[0], " + "m[3][1] * m[2][2] * m[0][3] - m[2][1] * m[3][2] * m[0][3] - m[3][1] * m[0][2] * m[2][3] + m[0][1] * m[3][2] * m[2][3] + m[2][1] * m[0][2] * m[3][3] - m[0][1] * m[2][2] * m[3][3], " + "m[1][1] * m[3][2] * m[0][3] - m[3][1] * m[1][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3] - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] + m[0][1] * m[1][2] * m[3][3], " + "m[2][1] * m[1][2] * m[0][3] - m[1][1] * m[2][2] * m[0][3] - m[2][1] * m[0][2] * m[1][3] + m[0][1] * m[2][2] * m[1][3] + m[1][1] * m[0][2] * m[2][3] - m[0][1] * m[1][2] * m[2][3], " + "t[1], " + "m[2][0] * m[3][2] * m[0][3] - m[3][0] * m[2][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3] - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] + m[0][0] * m[2][2] * m[3][3], " + "m[3][0] * m[1][2] * m[0][3] - m[1][0] * m[3][2] * m[0][3] - m[3][0] * m[0][2] * m[1][3] + m[0][0] * m[3][2] * m[1][3] + m[1][0] * m[0][2] * m[3][3] - m[0][0] * m[1][2] * m[3][3], " + "m[1][0] * m[2][2] * m[0][3] - m[2][0] * m[1][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3] - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] + m[0][0] * m[1][2] * m[2][3], " + "t[2], " + "m[3][0] * m[2][1] * m[0][3] - m[2][0] * m[3][1] * m[0][3] - m[3][0] * m[0][1] * m[2][3] + m[0][0] * m[3][1] * m[2][3] + m[2][0] * m[0][1] * m[3][3] - m[0][0] * m[2][1] * m[3][3], " + "m[1][0] * m[3][1] * m[0][3] - m[3][0] * m[1][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3] - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] + m[0][0] * m[1][1] * m[3][3], " + "m[2][0] * m[1][1] * m[0][3] - m[1][0] * m[2][1] * m[0][3] - m[2][0] * m[0][1] * m[1][3] + m[0][0] * m[2][1] * m[1][3] + m[1][0] * m[0][1] * m[2][3] - m[0][0] * m[1][1] * m[2][3], " + "t[3], " + "m[2][0] * m[3][1] * m[0][2] - m[3][0] * m[2][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2] - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] + m[0][0] * m[2][1] * m[3][2], " + "m[3][0] * m[1][1] * m[0][2] - m[1][0] * m[3][1] * m[0][2] - m[3][0] * m[0][1] * m[1][2] + m[0][0] * m[3][1] * m[1][2] + m[1][0] * m[0][1] * m[3][2] - m[0][0] * m[1][1] * m[3][2], " + "m[1][0] * m[2][1] * m[0][2] - m[2][0] * m[1][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2] - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] + m[0][0] * m[1][1] * m[2][2]) " + "* (1.0 / dot(m[0], t));"); + end_scope(); + statement(""); + } +} + +// Returns a string representation of the ID, usable as a function arg. +// Default is to simply return the expression representation fo the arg ID. +// Subclasses may override to modify the return value. +string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &, uint32_t id) +{ + // Make sure that we use the name of the original variable, and not the parameter alias. + uint32_t name_id = id; + auto *var = maybe_get(id); + if (var && var->basevariable) + name_id = var->basevariable; + return to_expression(name_id); +} + +void CompilerGLSL::force_temporary_and_recompile(uint32_t id) +{ + auto res = forced_temporaries.insert(id); + + // Forcing new temporaries guarantees forward progress. + if (res.second) + force_recompile_guarantee_forward_progress(); + else + force_recompile(); +} + +uint32_t CompilerGLSL::consume_temporary_in_precision_context(uint32_t type_id, uint32_t id, Options::Precision precision) +{ + // Constants do not have innate precision. + auto handle_type = ir.ids[id].get_type(); + if (handle_type == TypeConstant || handle_type == TypeConstantOp || handle_type == TypeUndef) + return id; + + // Ignore anything that isn't 32-bit values. + auto &type = get(type_id); + if (type.pointer) + return id; + if (type.basetype != SPIRType::Float && type.basetype != SPIRType::UInt && type.basetype != SPIRType::Int) + return id; + + if (precision == Options::DontCare) + { + // If precision is consumed as don't care (operations only consisting of constants), + // we need to bind the expression to a temporary, + // otherwise we have no way of controlling the precision later. + auto itr = forced_temporaries.insert(id); + if (itr.second) + force_recompile_guarantee_forward_progress(); + return id; + } + + auto current_precision = has_decoration(id, DecorationRelaxedPrecision) ? Options::Mediump : Options::Highp; + if (current_precision == precision) + return id; + + auto itr = temporary_to_mirror_precision_alias.find(id); + if (itr == temporary_to_mirror_precision_alias.end()) + { + uint32_t alias_id = ir.increase_bound_by(1); + auto &m = ir.meta[alias_id]; + if (auto *input_m = ir.find_meta(id)) + m = *input_m; + + const char *prefix; + if (precision == Options::Mediump) + { + set_decoration(alias_id, DecorationRelaxedPrecision); + prefix = "mp_copy_"; + } + else + { + unset_decoration(alias_id, DecorationRelaxedPrecision); + prefix = "hp_copy_"; + } + + auto alias_name = join(prefix, to_name(id)); + ParsedIR::sanitize_underscores(alias_name); + set_name(alias_id, alias_name); + + emit_op(type_id, alias_id, to_expression(id), true); + temporary_to_mirror_precision_alias[id] = alias_id; + forced_temporaries.insert(id); + forced_temporaries.insert(alias_id); + force_recompile_guarantee_forward_progress(); + id = alias_id; + } + else + { + id = itr->second; + } + + return id; +} + +void CompilerGLSL::handle_invalid_expression(uint32_t id) +{ + // We tried to read an invalidated expression. + // This means we need another pass at compilation, but next time, + // force temporary variables so that they cannot be invalidated. + force_temporary_and_recompile(id); + + // If the invalid expression happened as a result of a CompositeInsert + // overwrite, we must block this from happening next iteration. + if (composite_insert_overwritten.count(id)) + block_composite_insert_overwrite.insert(id); +} + +// Converts the format of the current expression from packed to unpacked, +// by wrapping the expression in a constructor of the appropriate type. +// GLSL does not support packed formats, so simply return the expression. +// Subclasses that do will override. +string CompilerGLSL::unpack_expression_type(string expr_str, const SPIRType &, uint32_t, bool, bool) +{ + return expr_str; +} + +// Sometimes we proactively enclosed an expression where it turns out we might have not needed it after all. +void CompilerGLSL::strip_enclosed_expression(string &expr) +{ + if (expr.size() < 2 || expr.front() != '(' || expr.back() != ')') + return; + + // Have to make sure that our first and last parens actually enclose everything inside it. + uint32_t paren_count = 0; + for (auto &c : expr) + { + if (c == '(') + paren_count++; + else if (c == ')') + { + paren_count--; + + // If we hit 0 and this is not the final char, our first and final parens actually don't + // enclose the expression, and we cannot strip, e.g.: (a + b) * (c + d). + if (paren_count == 0 && &c != &expr.back()) + return; + } + } + expr.erase(expr.size() - 1, 1); + expr.erase(begin(expr)); +} + +bool CompilerGLSL::needs_enclose_expression(const std::string &expr) +{ + bool need_parens = false; + + // If the expression starts with a unary we need to enclose to deal with cases where we have back-to-back + // unary expressions. + if (!expr.empty()) + { + auto c = expr.front(); + if (c == '-' || c == '+' || c == '!' || c == '~' || c == '&' || c == '*') + need_parens = true; + } + + if (!need_parens) + { + uint32_t paren_count = 0; + for (auto c : expr) + { + if (c == '(' || c == '[') + paren_count++; + else if (c == ')' || c == ']') + { + assert(paren_count); + paren_count--; + } + else if (c == ' ' && paren_count == 0) + { + need_parens = true; + break; + } + } + assert(paren_count == 0); + } + + return need_parens; +} + +string CompilerGLSL::enclose_expression(const string &expr) +{ + // If this expression contains any spaces which are not enclosed by parentheses, + // we need to enclose it so we can treat the whole string as an expression. + // This happens when two expressions have been part of a binary op earlier. + if (needs_enclose_expression(expr)) + return join('(', expr, ')'); + else + return expr; +} + +string CompilerGLSL::dereference_expression(const SPIRType &expr_type, const std::string &expr) +{ + // If this expression starts with an address-of operator ('&'), then + // just return the part after the operator. + // TODO: Strip parens if unnecessary? + if (expr.front() == '&') + return expr.substr(1); + else if (backend.native_pointers) + return join('*', expr); + else if (expr_type.storage == StorageClassPhysicalStorageBufferEXT && expr_type.basetype != SPIRType::Struct && + expr_type.pointer_depth == 1) + { + return join(enclose_expression(expr), ".value"); + } + else + return expr; +} + +string CompilerGLSL::address_of_expression(const std::string &expr) +{ + if (expr.size() > 3 && expr[0] == '(' && expr[1] == '*' && expr.back() == ')') + { + // If we have an expression which looks like (*foo), taking the address of it is the same as stripping + // the first two and last characters. We might have to enclose the expression. + // This doesn't work for cases like (*foo + 10), + // but this is an r-value expression which we cannot take the address of anyways. + return enclose_expression(expr.substr(2, expr.size() - 3)); + } + else if (expr.front() == '*') + { + // If this expression starts with a dereference operator ('*'), then + // just return the part after the operator. + return expr.substr(1); + } + else + return join('&', enclose_expression(expr)); +} + +// Just like to_expression except that we enclose the expression inside parentheses if needed. +string CompilerGLSL::to_enclosed_expression(uint32_t id, bool register_expression_read) +{ + return enclose_expression(to_expression(id, register_expression_read)); +} + +// Used explicitly when we want to read a row-major expression, but without any transpose shenanigans. +// need_transpose must be forced to false. +string CompilerGLSL::to_unpacked_row_major_matrix_expression(uint32_t id) +{ + return unpack_expression_type(to_expression(id), expression_type(id), + get_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID), + has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked), true); +} + +string CompilerGLSL::to_unpacked_expression(uint32_t id, bool register_expression_read) +{ + // If we need to transpose, it will also take care of unpacking rules. + auto *e = maybe_get(id); + bool need_transpose = e && e->need_transpose; + bool is_remapped = has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID); + bool is_packed = has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + + if (!need_transpose && (is_remapped || is_packed)) + { + return unpack_expression_type(to_expression(id, register_expression_read), + get_pointee_type(expression_type_id(id)), + get_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID), + has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked), false); + } + else + return to_expression(id, register_expression_read); +} + +string CompilerGLSL::to_enclosed_unpacked_expression(uint32_t id, bool register_expression_read) +{ + return enclose_expression(to_unpacked_expression(id, register_expression_read)); +} + +string CompilerGLSL::to_dereferenced_expression(uint32_t id, bool register_expression_read) +{ + auto &type = expression_type(id); + if (type.pointer && should_dereference(id)) + return dereference_expression(type, to_enclosed_expression(id, register_expression_read)); + else + return to_expression(id, register_expression_read); +} + +string CompilerGLSL::to_pointer_expression(uint32_t id, bool register_expression_read) +{ + auto &type = expression_type(id); + if (type.pointer && expression_is_lvalue(id) && !should_dereference(id)) + return address_of_expression(to_enclosed_expression(id, register_expression_read)); + else + return to_unpacked_expression(id, register_expression_read); +} + +string CompilerGLSL::to_enclosed_pointer_expression(uint32_t id, bool register_expression_read) +{ + auto &type = expression_type(id); + if (type.pointer && expression_is_lvalue(id) && !should_dereference(id)) + return address_of_expression(to_enclosed_expression(id, register_expression_read)); + else + return to_enclosed_unpacked_expression(id, register_expression_read); +} + +string CompilerGLSL::to_extract_component_expression(uint32_t id, uint32_t index) +{ + auto expr = to_enclosed_expression(id); + if (has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked)) + return join(expr, "[", index, "]"); + else + return join(expr, ".", index_to_swizzle(index)); +} + +string CompilerGLSL::to_extract_constant_composite_expression(uint32_t result_type, const SPIRConstant &c, + const uint32_t *chain, uint32_t length) +{ + // It is kinda silly if application actually enter this path since they know the constant up front. + // It is useful here to extract the plain constant directly. + SPIRConstant tmp; + tmp.constant_type = result_type; + auto &composite_type = get(c.constant_type); + assert(composite_type.basetype != SPIRType::Struct && composite_type.array.empty()); + assert(!c.specialization); + + if (is_matrix(composite_type)) + { + if (length == 2) + { + tmp.m.c[0].vecsize = 1; + tmp.m.columns = 1; + tmp.m.c[0].r[0] = c.m.c[chain[0]].r[chain[1]]; + } + else + { + assert(length == 1); + tmp.m.c[0].vecsize = composite_type.vecsize; + tmp.m.columns = 1; + tmp.m.c[0] = c.m.c[chain[0]]; + } + } + else + { + assert(length == 1); + tmp.m.c[0].vecsize = 1; + tmp.m.columns = 1; + tmp.m.c[0].r[0] = c.m.c[0].r[chain[0]]; + } + + return constant_expression(tmp); +} + +string CompilerGLSL::to_rerolled_array_expression(const SPIRType &parent_type, + const string &base_expr, const SPIRType &type) +{ + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + SPIRType tmp_type; + if (remapped_boolean) + { + tmp_type = get(type.parent_type); + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + } + else if (type.basetype == SPIRType::Boolean && backend.boolean_in_struct_remapped_type != SPIRType::Boolean) + { + // It's possible that we have an r-value expression that was OpLoaded from a struct. + // We have to reroll this and explicitly cast the input to bool, because the r-value is short. + tmp_type = get(type.parent_type); + remapped_boolean = true; + } + + uint32_t size = to_array_size_literal(type); + auto &parent = get(type.parent_type); + string expr = "{ "; + + for (uint32_t i = 0; i < size; i++) + { + auto subexpr = join(base_expr, "[", convert_to_string(i), "]"); + if (!type_is_top_level_array(parent)) + { + if (remapped_boolean) + subexpr = join(type_to_glsl(tmp_type), "(", subexpr, ")"); + expr += subexpr; + } + else + expr += to_rerolled_array_expression(parent_type, subexpr, parent); + + if (i + 1 < size) + expr += ", "; + } + + expr += " }"; + return expr; +} + +string CompilerGLSL::to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type) +{ + auto &type = expression_type(id); + + bool reroll_array = false; + bool remapped_boolean = parent_type.basetype == SPIRType::Struct && + type.basetype == SPIRType::Boolean && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean; + + if (type_is_top_level_array(type)) + { + reroll_array = !backend.array_is_value_type || + (block_like_type && !backend.array_is_value_type_in_buffer_blocks); + + if (remapped_boolean) + { + // Forced to reroll if we have to change bool[] to short[]. + reroll_array = true; + } + } + + if (reroll_array) + { + // For this case, we need to "re-roll" an array initializer from a temporary. + // We cannot simply pass the array directly, since it decays to a pointer and it cannot + // participate in a struct initializer. E.g. + // float arr[2] = { 1.0, 2.0 }; + // Foo foo = { arr }; must be transformed to + // Foo foo = { { arr[0], arr[1] } }; + // The array sizes cannot be deduced from specialization constants since we cannot use any loops. + + // We're only triggering one read of the array expression, but this is fine since arrays have to be declared + // as temporaries anyways. + return to_rerolled_array_expression(parent_type, to_enclosed_expression(id), type); + } + else + { + auto expr = to_unpacked_expression(id); + if (remapped_boolean) + { + auto tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + expr = join(type_to_glsl(tmp_type), "(", expr, ")"); + } + + return expr; + } +} + +string CompilerGLSL::to_non_uniform_aware_expression(uint32_t id) +{ + string expr = to_expression(id); + + if (has_decoration(id, DecorationNonUniform)) + convert_non_uniform_expression(expr, id); + + return expr; +} + +string CompilerGLSL::to_expression(uint32_t id, bool register_expression_read) +{ + auto itr = invalid_expressions.find(id); + if (itr != end(invalid_expressions)) + handle_invalid_expression(id); + + if (ir.ids[id].get_type() == TypeExpression) + { + // We might have a more complex chain of dependencies. + // A possible scenario is that we + // + // %1 = OpLoad + // %2 = OpDoSomething %1 %1. here %2 will have a dependency on %1. + // %3 = OpDoSomethingAgain %2 %2. Here %3 will lose the link to %1 since we don't propagate the dependencies like that. + // OpStore %1 %foo // Here we can invalidate %1, and hence all expressions which depend on %1. Only %2 will know since it's part of invalid_expressions. + // %4 = OpDoSomethingAnotherTime %3 %3 // If we forward all expressions we will see %1 expression after store, not before. + // + // However, we can propagate up a list of depended expressions when we used %2, so we can check if %2 is invalid when reading %3 after the store, + // and see that we should not forward reads of the original variable. + auto &expr = get(id); + for (uint32_t dep : expr.expression_dependencies) + if (invalid_expressions.find(dep) != end(invalid_expressions)) + handle_invalid_expression(dep); + } + + if (register_expression_read) + track_expression_read(id); + + switch (ir.ids[id].get_type()) + { + case TypeExpression: + { + auto &e = get(id); + if (e.base_expression) + return to_enclosed_expression(e.base_expression) + e.expression; + else if (e.need_transpose) + { + // This should not be reached for access chains, since we always deal explicitly with transpose state + // when consuming an access chain expression. + uint32_t physical_type_id = get_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID); + bool is_packed = has_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); + return convert_row_major_matrix(e.expression, get(e.expression_type), physical_type_id, + is_packed, relaxed); + } + else if (flattened_structs.count(id)) + { + return load_flattened_struct(e.expression, get(e.expression_type)); + } + else + { + if (is_forcing_recompilation()) + { + // During first compilation phase, certain expression patterns can trigger exponential growth of memory. + // Avoid this by returning dummy expressions during this phase. + // Do not use empty expressions here, because those are sentinels for other cases. + return "_"; + } + else + return e.expression; + } + } + + case TypeConstant: + { + auto &c = get(id); + auto &type = get(c.constant_type); + + // WorkGroupSize may be a constant. + if (has_decoration(c.self, DecorationBuiltIn)) + return builtin_to_glsl(BuiltIn(get_decoration(c.self, DecorationBuiltIn)), StorageClassGeneric); + else if (c.specialization) + { + if (backend.workgroup_size_is_hidden) + { + int wg_index = get_constant_mapping_to_workgroup_component(c); + if (wg_index >= 0) + { + auto wg_size = join(builtin_to_glsl(BuiltInWorkgroupSize, StorageClassInput), vector_swizzle(1, wg_index)); + if (type.basetype != SPIRType::UInt) + wg_size = bitcast_expression(type, SPIRType::UInt, wg_size); + return wg_size; + } + } + + if (expression_is_forwarded(id)) + return constant_expression(c); + + return to_name(id); + } + else if (c.is_used_as_lut) + return to_name(id); + else if (type.basetype == SPIRType::Struct && !backend.can_declare_struct_inline) + return to_name(id); + else if (!type.array.empty() && !backend.can_declare_arrays_inline) + return to_name(id); + else + return constant_expression(c); + } + + case TypeConstantOp: + return to_name(id); + + case TypeVariable: + { + auto &var = get(id); + // If we try to use a loop variable before the loop header, we have to redirect it to the static expression, + // the variable has not been declared yet. + if (var.statically_assigned || (var.loop_variable && !var.loop_variable_enable)) + { + // We might try to load from a loop variable before it has been initialized. + // Prefer static expression and fallback to initializer. + if (var.static_expression) + return to_expression(var.static_expression); + else if (var.initializer) + return to_expression(var.initializer); + else + { + // We cannot declare the variable yet, so have to fake it. + uint32_t undef_id = ir.increase_bound_by(1); + return emit_uninitialized_temporary_expression(get_variable_data_type_id(var), undef_id).expression; + } + } + else if (var.deferred_declaration) + { + var.deferred_declaration = false; + return variable_decl(var); + } + else if (flattened_structs.count(id)) + { + return load_flattened_struct(to_name(id), get(var.basetype)); + } + else + { + auto &dec = ir.meta[var.self].decoration; + if (dec.builtin) + return builtin_to_glsl(dec.builtin_type, var.storage); + else + return to_name(id); + } + } + + case TypeCombinedImageSampler: + // This type should never be taken the expression of directly. + // The intention is that texture sampling functions will extract the image and samplers + // separately and take their expressions as needed. + // GLSL does not use this type because OpSampledImage immediately creates a combined image sampler + // expression ala sampler2D(texture, sampler). + SPIRV_CROSS_THROW("Combined image samplers have no default expression representation."); + + case TypeAccessChain: + // We cannot express this type. They only have meaning in other OpAccessChains, OpStore or OpLoad. + SPIRV_CROSS_THROW("Access chains have no default expression representation."); + + default: + return to_name(id); + } +} + +SmallVector CompilerGLSL::get_composite_constant_ids(ConstantID const_id) +{ + if (auto *constant = maybe_get(const_id)) + { + const auto &type = get(constant->constant_type); + if (is_array(type) || type.basetype == SPIRType::Struct) + return constant->subconstants; + if (is_matrix(type)) + return SmallVector(constant->m.id); + if (is_vector(type)) + return SmallVector(constant->m.c[0].id); + SPIRV_CROSS_THROW("Unexpected scalar constant!"); + } + if (!const_composite_insert_ids.count(const_id)) + SPIRV_CROSS_THROW("Unimplemented for this OpSpecConstantOp!"); + return const_composite_insert_ids[const_id]; +} + +void CompilerGLSL::fill_composite_constant(SPIRConstant &constant, TypeID type_id, + const SmallVector &initializers) +{ + auto &type = get(type_id); + constant.specialization = true; + if (is_array(type) || type.basetype == SPIRType::Struct) + { + constant.subconstants = initializers; + } + else if (is_matrix(type)) + { + constant.m.columns = type.columns; + for (uint32_t i = 0; i < type.columns; ++i) + { + constant.m.id[i] = initializers[i]; + constant.m.c[i].vecsize = type.vecsize; + } + } + else if (is_vector(type)) + { + constant.m.c[0].vecsize = type.vecsize; + for (uint32_t i = 0; i < type.vecsize; ++i) + constant.m.c[0].id[i] = initializers[i]; + } + else + SPIRV_CROSS_THROW("Unexpected scalar in SpecConstantOp CompositeInsert!"); +} + +void CompilerGLSL::set_composite_constant(ConstantID const_id, TypeID type_id, + const SmallVector &initializers) +{ + if (maybe_get(const_id)) + { + const_composite_insert_ids[const_id] = initializers; + return; + } + + auto &constant = set(const_id, type_id); + fill_composite_constant(constant, type_id, initializers); + forwarded_temporaries.insert(const_id); +} + +TypeID CompilerGLSL::get_composite_member_type(TypeID type_id, uint32_t member_idx) +{ + auto &type = get(type_id); + if (is_array(type)) + return type.parent_type; + if (type.basetype == SPIRType::Struct) + return type.member_types[member_idx]; + if (is_matrix(type)) + return type.parent_type; + if (is_vector(type)) + return type.parent_type; + SPIRV_CROSS_THROW("Shouldn't reach lower than vector handling OpSpecConstantOp CompositeInsert!"); +} + +string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop) +{ + auto &type = get(cop.basetype); + bool binary = false; + bool unary = false; + string op; + + if (is_legacy() && is_unsigned_opcode(cop.opcode)) + SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy targets."); + + // TODO: Find a clean way to reuse emit_instruction. + switch (cop.opcode) + { + case OpSConvert: + case OpUConvert: + case OpFConvert: + op = type_to_glsl_constructor(type); + break; + +#define GLSL_BOP(opname, x) \ + case Op##opname: \ + binary = true; \ + op = x; \ + break + +#define GLSL_UOP(opname, x) \ + case Op##opname: \ + unary = true; \ + op = x; \ + break + + GLSL_UOP(SNegate, "-"); + GLSL_UOP(Not, "~"); + GLSL_BOP(IAdd, "+"); + GLSL_BOP(ISub, "-"); + GLSL_BOP(IMul, "*"); + GLSL_BOP(SDiv, "/"); + GLSL_BOP(UDiv, "/"); + GLSL_BOP(UMod, "%"); + GLSL_BOP(SMod, "%"); + GLSL_BOP(ShiftRightLogical, ">>"); + GLSL_BOP(ShiftRightArithmetic, ">>"); + GLSL_BOP(ShiftLeftLogical, "<<"); + GLSL_BOP(BitwiseOr, "|"); + GLSL_BOP(BitwiseXor, "^"); + GLSL_BOP(BitwiseAnd, "&"); + GLSL_BOP(LogicalOr, "||"); + GLSL_BOP(LogicalAnd, "&&"); + GLSL_UOP(LogicalNot, "!"); + GLSL_BOP(LogicalEqual, "=="); + GLSL_BOP(LogicalNotEqual, "!="); + GLSL_BOP(IEqual, "=="); + GLSL_BOP(INotEqual, "!="); + GLSL_BOP(ULessThan, "<"); + GLSL_BOP(SLessThan, "<"); + GLSL_BOP(ULessThanEqual, "<="); + GLSL_BOP(SLessThanEqual, "<="); + GLSL_BOP(UGreaterThan, ">"); + GLSL_BOP(SGreaterThan, ">"); + GLSL_BOP(UGreaterThanEqual, ">="); + GLSL_BOP(SGreaterThanEqual, ">="); + + case OpSRem: + { + uint32_t op0 = cop.arguments[0]; + uint32_t op1 = cop.arguments[1]; + return join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + } + + case OpSelect: + { + if (cop.arguments.size() < 3) + SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp."); + + // This one is pretty annoying. It's triggered from + // uint(bool), int(bool) from spec constants. + // In order to preserve its compile-time constness in Vulkan GLSL, + // we need to reduce the OpSelect expression back to this simplified model. + // If we cannot, fail. + if (to_trivial_mix_op(type, op, cop.arguments[2], cop.arguments[1], cop.arguments[0])) + { + // Implement as a simple cast down below. + } + else + { + // Implement a ternary and pray the compiler understands it :) + return to_ternary_expression(type, cop.arguments[0], cop.arguments[1], cop.arguments[2]); + } + break; + } + + case OpVectorShuffle: + { + string expr = type_to_glsl_constructor(type); + expr += "("; + + uint32_t left_components = expression_type(cop.arguments[0]).vecsize; + string left_arg = to_enclosed_expression(cop.arguments[0]); + string right_arg = to_enclosed_expression(cop.arguments[1]); + + for (uint32_t i = 2; i < uint32_t(cop.arguments.size()); i++) + { + uint32_t index = cop.arguments[i]; + if (index == 0xFFFFFFFF) + { + SPIRConstant c; + c.constant_type = type.parent_type; + assert(type.parent_type != ID(0)); + expr += constant_expression(c); + } + else if (index >= left_components) + { + expr += right_arg + "." + "xyzw"[index - left_components]; + } + else + { + expr += left_arg + "." + "xyzw"[index]; + } + + if (i + 1 < uint32_t(cop.arguments.size())) + expr += ", "; + } + + expr += ")"; + return expr; + } + + case OpCompositeExtract: + { + auto expr = access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + return expr; + } + + case OpCompositeInsert: + { + SmallVector new_init = get_composite_constant_ids(cop.arguments[1]); + uint32_t idx; + uint32_t target_id = cop.self; + uint32_t target_type_id = cop.basetype; + // We have to drill down to the part we want to modify, and create new + // constants for each containing part. + for (idx = 2; idx < cop.arguments.size() - 1; ++idx) + { + uint32_t new_const = ir.increase_bound_by(1); + uint32_t old_const = new_init[cop.arguments[idx]]; + new_init[cop.arguments[idx]] = new_const; + set_composite_constant(target_id, target_type_id, new_init); + new_init = get_composite_constant_ids(old_const); + target_id = new_const; + target_type_id = get_composite_member_type(target_type_id, cop.arguments[idx]); + } + // Now replace the initializer with the one from this instruction. + new_init[cop.arguments[idx]] = cop.arguments[0]; + set_composite_constant(target_id, target_type_id, new_init); + SPIRConstant tmp_const(cop.basetype); + fill_composite_constant(tmp_const, cop.basetype, const_composite_insert_ids[cop.self]); + return constant_expression(tmp_const); + } + + default: + // Some opcodes are unimplemented here, these are currently not possible to test from glslang. + SPIRV_CROSS_THROW("Unimplemented spec constant op."); + } + + uint32_t bit_width = 0; + if (unary || binary || cop.opcode == OpSConvert || cop.opcode == OpUConvert) + bit_width = expression_type(cop.arguments[0]).width; + + SPIRType::BaseType input_type; + bool skip_cast_if_equal_type = opcode_is_sign_invariant(cop.opcode); + + switch (cop.opcode) + { + case OpIEqual: + case OpINotEqual: + input_type = to_signed_basetype(bit_width); + break; + + case OpSLessThan: + case OpSLessThanEqual: + case OpSGreaterThan: + case OpSGreaterThanEqual: + case OpSMod: + case OpSDiv: + case OpShiftRightArithmetic: + case OpSConvert: + case OpSNegate: + input_type = to_signed_basetype(bit_width); + break; + + case OpULessThan: + case OpULessThanEqual: + case OpUGreaterThan: + case OpUGreaterThanEqual: + case OpUMod: + case OpUDiv: + case OpShiftRightLogical: + case OpUConvert: + input_type = to_unsigned_basetype(bit_width); + break; + + default: + input_type = type.basetype; + break; + } + +#undef GLSL_BOP +#undef GLSL_UOP + if (binary) + { + if (cop.arguments.size() < 2) + SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp."); + + string cast_op0; + string cast_op1; + auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, cop.arguments[0], + cop.arguments[1], skip_cast_if_equal_type); + + if (type.basetype != input_type && type.basetype != SPIRType::Boolean) + { + expected_type.basetype = input_type; + auto expr = bitcast_glsl_op(type, expected_type); + expr += '('; + expr += join(cast_op0, " ", op, " ", cast_op1); + expr += ')'; + return expr; + } + else + return join("(", cast_op0, " ", op, " ", cast_op1, ")"); + } + else if (unary) + { + if (cop.arguments.size() < 1) + SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp."); + + // Auto-bitcast to result type as needed. + // Works around various casting scenarios in glslang as there is no OpBitcast for specialization constants. + return join("(", op, bitcast_glsl(type, cop.arguments[0]), ")"); + } + else if (cop.opcode == OpSConvert || cop.opcode == OpUConvert) + { + if (cop.arguments.size() < 1) + SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp."); + + auto &arg_type = expression_type(cop.arguments[0]); + if (arg_type.width < type.width && input_type != arg_type.basetype) + { + auto expected = arg_type; + expected.basetype = input_type; + return join(op, "(", bitcast_glsl(expected, cop.arguments[0]), ")"); + } + else + return join(op, "(", to_expression(cop.arguments[0]), ")"); + } + else + { + if (cop.arguments.size() < 1) + SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp."); + return join(op, "(", to_expression(cop.arguments[0]), ")"); + } +} + +string CompilerGLSL::constant_expression(const SPIRConstant &c, + bool inside_block_like_struct_scope, + bool inside_struct_scope) +{ + auto &type = get(c.constant_type); + + if (type_is_top_level_pointer(type)) + { + return backend.null_pointer_literal; + } + else if (!c.subconstants.empty()) + { + // Handles Arrays and structures. + string res; + + // Only consider the decay if we are inside a struct scope where we are emitting a member with Offset decoration. + // Outside a block-like struct declaration, we can always bind to a constant array with templated type. + // Should look at ArrayStride here as well, but it's possible to declare a constant struct + // with Offset = 0, using no ArrayStride on the enclosed array type. + // A particular CTS test hits this scenario. + bool array_type_decays = inside_block_like_struct_scope && + type_is_top_level_array(type) && + !backend.array_is_value_type_in_buffer_blocks; + + // Allow Metal to use the array template to make arrays a value type + bool needs_trailing_tracket = false; + if (backend.use_initializer_list && backend.use_typed_initializer_list && type.basetype == SPIRType::Struct && + !type_is_top_level_array(type)) + { + res = type_to_glsl_constructor(type) + "{ "; + } + else if (backend.use_initializer_list && backend.use_typed_initializer_list && backend.array_is_value_type && + type_is_top_level_array(type) && !array_type_decays) + { + const auto *p_type = &type; + SPIRType tmp_type; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + p_type = &tmp_type; + } + + res = type_to_glsl_constructor(*p_type) + "({ "; + needs_trailing_tracket = true; + } + else if (backend.use_initializer_list) + { + res = "{ "; + } + else + { + res = type_to_glsl_constructor(type) + "("; + } + + uint32_t subconstant_index = 0; + for (auto &elem : c.subconstants) + { + if (auto *op = maybe_get(elem)) + { + res += constant_op_expression(*op); + } + else if (maybe_get(elem) != nullptr) + { + res += to_name(elem); + } + else + { + auto &subc = get(elem); + if (subc.specialization && !expression_is_forwarded(elem)) + res += to_name(elem); + else + { + if (!type_is_top_level_array(type) && type.basetype == SPIRType::Struct) + { + // When we get down to emitting struct members, override the block-like information. + // For constants, we can freely mix and match block-like state. + inside_block_like_struct_scope = + has_member_decoration(type.self, subconstant_index, DecorationOffset); + } + + if (type.basetype == SPIRType::Struct) + inside_struct_scope = true; + + res += constant_expression(subc, inside_block_like_struct_scope, inside_struct_scope); + } + } + + if (&elem != &c.subconstants.back()) + res += ", "; + + subconstant_index++; + } + + res += backend.use_initializer_list ? " }" : ")"; + if (needs_trailing_tracket) + res += ")"; + + return res; + } + else if (type.basetype == SPIRType::Struct && type.member_types.size() == 0) + { + // Metal tessellation likes empty structs which are then constant expressions. + if (backend.supports_empty_struct) + return "{ }"; + else if (backend.use_typed_initializer_list) + return join(type_to_glsl(type), "{ 0 }"); + else if (backend.use_initializer_list) + return "{ 0 }"; + else + return join(type_to_glsl(type), "(0)"); + } + else if (c.columns() == 1) + { + auto res = constant_expression_vector(c, 0); + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + + return res; + } + else + { + string res = type_to_glsl(type) + "("; + for (uint32_t col = 0; col < c.columns(); col++) + { + if (c.specialization_constant_id(col) != 0) + res += to_name(c.specialization_constant_id(col)); + else + res += constant_expression_vector(c, col); + + if (col + 1 < c.columns()) + res += ", "; + } + res += ")"; + + if (inside_struct_scope && + backend.boolean_in_struct_remapped_type != SPIRType::Boolean && + type.basetype == SPIRType::Boolean) + { + SPIRType tmp_type = type; + tmp_type.basetype = backend.boolean_in_struct_remapped_type; + res = join(type_to_glsl(tmp_type), "(", res, ")"); + } + + return res; + } +} + +#ifdef _MSC_VER +// snprintf does not exist or is buggy on older MSVC versions, some of them +// being used by MinGW. Use sprintf instead and disable corresponding warning. +#pragma warning(push) +#pragma warning(disable : 4996) +#endif + +string CompilerGLSL::convert_half_to_string(const SPIRConstant &c, uint32_t col, uint32_t row) +{ + string res; + float float_value = c.scalar_f16(col, row); + + // There is no literal "hf" in GL_NV_gpu_shader5, so to avoid lots + // of complicated workarounds, just value-cast to the half type always. + if (std::isnan(float_value) || std::isinf(float_value)) + { + SPIRType type; + type.basetype = SPIRType::Half; + type.vecsize = 1; + type.columns = 1; + + if (float_value == numeric_limits::infinity()) + res = join(type_to_glsl(type), "(1.0 / 0.0)"); + else if (float_value == -numeric_limits::infinity()) + res = join(type_to_glsl(type), "(-1.0 / 0.0)"); + else if (std::isnan(float_value)) + res = join(type_to_glsl(type), "(0.0 / 0.0)"); + else + SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant."); + } + else + { + SPIRType type; + type.basetype = SPIRType::Half; + type.vecsize = 1; + type.columns = 1; + res = join(type_to_glsl(type), "(", convert_to_string(float_value, current_locale_radix_character), ")"); + } + + return res; +} + +string CompilerGLSL::convert_float_to_string(const SPIRConstant &c, uint32_t col, uint32_t row) +{ + string res; + float float_value = c.scalar_f32(col, row); + + if (std::isnan(float_value) || std::isinf(float_value)) + { + // Use special representation. + if (!is_legacy()) + { + SPIRType out_type; + SPIRType in_type; + out_type.basetype = SPIRType::Float; + in_type.basetype = SPIRType::UInt; + out_type.vecsize = 1; + in_type.vecsize = 1; + out_type.width = 32; + in_type.width = 32; + + char print_buffer[32]; +#ifdef _WIN32 + sprintf(print_buffer, "0x%xu", c.scalar(col, row)); +#else + snprintf(print_buffer, sizeof(print_buffer), "0x%xu", c.scalar(col, row)); +#endif + + const char *comment = "inf"; + if (float_value == -numeric_limits::infinity()) + comment = "-inf"; + else if (std::isnan(float_value)) + comment = "nan"; + res = join(bitcast_glsl_op(out_type, in_type), "(", print_buffer, " /* ", comment, " */)"); + } + else + { + if (float_value == numeric_limits::infinity()) + { + if (backend.float_literal_suffix) + res = "(1.0f / 0.0f)"; + else + res = "(1.0 / 0.0)"; + } + else if (float_value == -numeric_limits::infinity()) + { + if (backend.float_literal_suffix) + res = "(-1.0f / 0.0f)"; + else + res = "(-1.0 / 0.0)"; + } + else if (std::isnan(float_value)) + { + if (backend.float_literal_suffix) + res = "(0.0f / 0.0f)"; + else + res = "(0.0 / 0.0)"; + } + else + SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant."); + } + } + else + { + res = convert_to_string(float_value, current_locale_radix_character); + if (backend.float_literal_suffix) + res += "f"; + } + + return res; +} + +std::string CompilerGLSL::convert_double_to_string(const SPIRConstant &c, uint32_t col, uint32_t row) +{ + string res; + double double_value = c.scalar_f64(col, row); + + if (std::isnan(double_value) || std::isinf(double_value)) + { + // Use special representation. + if (!is_legacy()) + { + SPIRType out_type; + SPIRType in_type; + out_type.basetype = SPIRType::Double; + in_type.basetype = SPIRType::UInt64; + out_type.vecsize = 1; + in_type.vecsize = 1; + out_type.width = 64; + in_type.width = 64; + + uint64_t u64_value = c.scalar_u64(col, row); + + if (options.es && options.version < 310) // GL_NV_gpu_shader5 fallback requires 310. + SPIRV_CROSS_THROW("64-bit integers not supported in ES profile before version 310."); + require_extension_internal("GL_ARB_gpu_shader_int64"); + + char print_buffer[64]; +#ifdef _WIN32 + sprintf(print_buffer, "0x%llx%s", static_cast(u64_value), + backend.long_long_literal_suffix ? "ull" : "ul"); +#else + snprintf(print_buffer, sizeof(print_buffer), "0x%llx%s", static_cast(u64_value), + backend.long_long_literal_suffix ? "ull" : "ul"); +#endif + + const char *comment = "inf"; + if (double_value == -numeric_limits::infinity()) + comment = "-inf"; + else if (std::isnan(double_value)) + comment = "nan"; + res = join(bitcast_glsl_op(out_type, in_type), "(", print_buffer, " /* ", comment, " */)"); + } + else + { + if (options.es) + SPIRV_CROSS_THROW("FP64 not supported in ES profile."); + if (options.version < 400) + require_extension_internal("GL_ARB_gpu_shader_fp64"); + + if (double_value == numeric_limits::infinity()) + { + if (backend.double_literal_suffix) + res = "(1.0lf / 0.0lf)"; + else + res = "(1.0 / 0.0)"; + } + else if (double_value == -numeric_limits::infinity()) + { + if (backend.double_literal_suffix) + res = "(-1.0lf / 0.0lf)"; + else + res = "(-1.0 / 0.0)"; + } + else if (std::isnan(double_value)) + { + if (backend.double_literal_suffix) + res = "(0.0lf / 0.0lf)"; + else + res = "(0.0 / 0.0)"; + } + else + SPIRV_CROSS_THROW("Cannot represent non-finite floating point constant."); + } + } + else + { + res = convert_to_string(double_value, current_locale_radix_character); + if (backend.double_literal_suffix) + res += "lf"; + } + + return res; +} + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +string CompilerGLSL::constant_expression_vector(const SPIRConstant &c, uint32_t vector) +{ + auto type = get(c.constant_type); + type.columns = 1; + + auto scalar_type = type; + scalar_type.vecsize = 1; + + string res; + bool splat = backend.use_constructor_splatting && c.vector_size() > 1; + bool swizzle_splat = backend.can_swizzle_scalar && c.vector_size() > 1; + + if (!type_is_floating_point(type)) + { + // Cannot swizzle literal integers as a special case. + swizzle_splat = false; + } + + if (splat || swizzle_splat) + { + // Cannot use constant splatting if we have specialization constants somewhere in the vector. + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.specialization_constant_id(vector, i) != 0) + { + splat = false; + swizzle_splat = false; + break; + } + } + } + + if (splat || swizzle_splat) + { + if (type.width == 64) + { + uint64_t ident = c.scalar_u64(vector, 0); + for (uint32_t i = 1; i < c.vector_size(); i++) + { + if (ident != c.scalar_u64(vector, i)) + { + splat = false; + swizzle_splat = false; + break; + } + } + } + else + { + uint32_t ident = c.scalar(vector, 0); + for (uint32_t i = 1; i < c.vector_size(); i++) + { + if (ident != c.scalar(vector, i)) + { + splat = false; + swizzle_splat = false; + } + } + } + } + + if (c.vector_size() > 1 && !swizzle_splat) + res += type_to_glsl(type) + "("; + + switch (type.basetype) + { + case SPIRType::Half: + if (splat || swizzle_splat) + { + res += convert_half_to_string(c, vector, 0); + if (swizzle_splat) + res = remap_swizzle(get(c.constant_type), 1, res); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += convert_half_to_string(c, vector, i); + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Float: + if (splat || swizzle_splat) + { + res += convert_float_to_string(c, vector, 0); + if (swizzle_splat) + res = remap_swizzle(get(c.constant_type), 1, res); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += convert_float_to_string(c, vector, i); + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Double: + if (splat || swizzle_splat) + { + res += convert_double_to_string(c, vector, 0); + if (swizzle_splat) + res = remap_swizzle(get(c.constant_type), 1, res); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += convert_double_to_string(c, vector, i); + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Int64: + { + auto tmp = type; + tmp.vecsize = 1; + tmp.columns = 1; + auto int64_type = type_to_glsl(tmp); + + if (splat) + { + res += convert_to_string(c.scalar_i64(vector, 0), int64_type, backend.long_long_literal_suffix); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += convert_to_string(c.scalar_i64(vector, i), int64_type, backend.long_long_literal_suffix); + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + } + + case SPIRType::UInt64: + if (splat) + { + res += convert_to_string(c.scalar_u64(vector, 0)); + if (backend.long_long_literal_suffix) + res += "ull"; + else + res += "ul"; + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + res += convert_to_string(c.scalar_u64(vector, i)); + if (backend.long_long_literal_suffix) + res += "ull"; + else + res += "ul"; + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::UInt: + if (splat) + { + res += convert_to_string(c.scalar(vector, 0)); + if (is_legacy()) + { + // Fake unsigned constant literals with signed ones if possible. + // Things like array sizes, etc, tend to be unsigned even though they could just as easily be signed. + if (c.scalar_i32(vector, 0) < 0) + SPIRV_CROSS_THROW("Tried to convert uint literal into int, but this made the literal negative."); + } + else if (backend.uint32_t_literal_suffix) + res += "u"; + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + res += convert_to_string(c.scalar(vector, i)); + if (is_legacy()) + { + // Fake unsigned constant literals with signed ones if possible. + // Things like array sizes, etc, tend to be unsigned even though they could just as easily be signed. + if (c.scalar_i32(vector, i) < 0) + SPIRV_CROSS_THROW("Tried to convert uint literal into int, but this made " + "the literal negative."); + } + else if (backend.uint32_t_literal_suffix) + res += "u"; + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Int: + if (splat) + res += convert_to_string(c.scalar_i32(vector, 0)); + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += convert_to_string(c.scalar_i32(vector, i)); + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::UShort: + if (splat) + { + res += convert_to_string(c.scalar(vector, 0)); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + if (*backend.uint16_t_literal_suffix) + { + res += convert_to_string(c.scalar_u16(vector, i)); + res += backend.uint16_t_literal_suffix; + } + else + { + // If backend doesn't have a literal suffix, we need to value cast. + res += type_to_glsl(scalar_type); + res += "("; + res += convert_to_string(c.scalar_u16(vector, i)); + res += ")"; + } + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Short: + if (splat) + { + res += convert_to_string(c.scalar_i16(vector, 0)); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + if (*backend.int16_t_literal_suffix) + { + res += convert_to_string(c.scalar_i16(vector, i)); + res += backend.int16_t_literal_suffix; + } + else + { + // If backend doesn't have a literal suffix, we need to value cast. + res += type_to_glsl(scalar_type); + res += "("; + res += convert_to_string(c.scalar_i16(vector, i)); + res += ")"; + } + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::UByte: + if (splat) + { + res += convert_to_string(c.scalar_u8(vector, 0)); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + res += type_to_glsl(scalar_type); + res += "("; + res += convert_to_string(c.scalar_u8(vector, i)); + res += ")"; + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::SByte: + if (splat) + { + res += convert_to_string(c.scalar_i8(vector, 0)); + } + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + { + res += type_to_glsl(scalar_type); + res += "("; + res += convert_to_string(c.scalar_i8(vector, i)); + res += ")"; + } + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + case SPIRType::Boolean: + if (splat) + res += c.scalar(vector, 0) ? "true" : "false"; + else + { + for (uint32_t i = 0; i < c.vector_size(); i++) + { + if (c.vector_size() > 1 && c.specialization_constant_id(vector, i) != 0) + res += to_expression(c.specialization_constant_id(vector, i)); + else + res += c.scalar(vector, i) ? "true" : "false"; + + if (i + 1 < c.vector_size()) + res += ", "; + } + } + break; + + default: + SPIRV_CROSS_THROW("Invalid constant expression basetype."); + } + + if (c.vector_size() > 1 && !swizzle_splat) + res += ")"; + + return res; +} + +SPIRExpression &CompilerGLSL::emit_uninitialized_temporary_expression(uint32_t type, uint32_t id) +{ + forced_temporaries.insert(id); + emit_uninitialized_temporary(type, id); + return set(id, to_name(id), type, true); +} + +void CompilerGLSL::emit_uninitialized_temporary(uint32_t result_type, uint32_t result_id) +{ + // If we're declaring temporaries inside continue blocks, + // we must declare the temporary in the loop header so that the continue block can avoid declaring new variables. + if (!block_temporary_hoisting && current_continue_block && !hoisted_temporaries.count(result_id)) + { + auto &header = get(current_continue_block->loop_dominator); + if (find_if(begin(header.declare_temporary), end(header.declare_temporary), + [result_type, result_id](const pair &tmp) { + return tmp.first == result_type && tmp.second == result_id; + }) == end(header.declare_temporary)) + { + header.declare_temporary.emplace_back(result_type, result_id); + hoisted_temporaries.insert(result_id); + force_recompile(); + } + } + else if (hoisted_temporaries.count(result_id) == 0) + { + auto &type = get(result_type); + auto &flags = get_decoration_bitset(result_id); + + // The result_id has not been made into an expression yet, so use flags interface. + add_local_variable_name(result_id); + + string initializer; + if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + initializer = join(" = ", to_zero_initialized_expression(result_type)); + + statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), initializer, ";"); + } +} + +string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id) +{ + auto &type = get(result_type); + + // If we're declaring temporaries inside continue blocks, + // we must declare the temporary in the loop header so that the continue block can avoid declaring new variables. + if (!block_temporary_hoisting && current_continue_block && !hoisted_temporaries.count(result_id)) + { + auto &header = get(current_continue_block->loop_dominator); + if (find_if(begin(header.declare_temporary), end(header.declare_temporary), + [result_type, result_id](const pair &tmp) { + return tmp.first == result_type && tmp.second == result_id; + }) == end(header.declare_temporary)) + { + header.declare_temporary.emplace_back(result_type, result_id); + hoisted_temporaries.insert(result_id); + force_recompile_guarantee_forward_progress(); + } + + return join(to_name(result_id), " = "); + } + else if (hoisted_temporaries.count(result_id)) + { + // The temporary has already been declared earlier, so just "declare" the temporary by writing to it. + return join(to_name(result_id), " = "); + } + else + { + // The result_id has not been made into an expression yet, so use flags interface. + add_local_variable_name(result_id); + auto &flags = get_decoration_bitset(result_id); + return join(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(result_id)), " = "); + } +} + +bool CompilerGLSL::expression_is_forwarded(uint32_t id) const +{ + return forwarded_temporaries.count(id) != 0; +} + +bool CompilerGLSL::expression_suppresses_usage_tracking(uint32_t id) const +{ + return suppressed_usage_tracking.count(id) != 0; +} + +bool CompilerGLSL::expression_read_implies_multiple_reads(uint32_t id) const +{ + auto *expr = maybe_get(id); + if (!expr) + return false; + + // If we're emitting code at a deeper loop level than when we emitted the expression, + // we're probably reading the same expression over and over. + return current_loop_level > expr->emitted_loop_level; +} + +SPIRExpression &CompilerGLSL::emit_op(uint32_t result_type, uint32_t result_id, const string &rhs, bool forwarding, + bool suppress_usage_tracking) +{ + if (forwarding && (forced_temporaries.find(result_id) == end(forced_temporaries))) + { + // Just forward it without temporary. + // If the forward is trivial, we do not force flushing to temporary for this expression. + forwarded_temporaries.insert(result_id); + if (suppress_usage_tracking) + suppressed_usage_tracking.insert(result_id); + + return set(result_id, rhs, result_type, true); + } + else + { + // If expression isn't immutable, bind it to a temporary and make the new temporary immutable (they always are). + statement(declare_temporary(result_type, result_id), rhs, ";"); + return set(result_id, to_name(result_id), result_type, true); + } +} + +void CompilerGLSL::emit_unary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) +{ + bool forward = should_forward(op0); + emit_op(result_type, result_id, join(op, to_enclosed_unpacked_expression(op0)), forward); + inherit_expression_dependencies(result_id, op0); +} + +void CompilerGLSL::emit_unary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) +{ + auto &type = get(result_type); + bool forward = should_forward(op0); + emit_op(result_type, result_id, join(type_to_glsl(type), "(", op, to_enclosed_unpacked_expression(op0), ")"), forward); + inherit_expression_dependencies(result_id, op0); +} + +void CompilerGLSL::emit_mesh_tasks(SPIRBlock &block) +{ + statement("EmitMeshTasksEXT(", + to_unpacked_expression(block.mesh.groups[0]), ", ", + to_unpacked_expression(block.mesh.groups[1]), ", ", + to_unpacked_expression(block.mesh.groups[2]), ");"); +} + +void CompilerGLSL::emit_binary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, const char *op) +{ + // Various FP arithmetic opcodes such as add, sub, mul will hit this. + bool force_temporary_precise = backend.support_precise_qualifier && + has_decoration(result_id, DecorationNoContraction) && + type_is_floating_point(get(result_type)); + bool forward = should_forward(op0) && should_forward(op1) && !force_temporary_precise; + + emit_op(result_type, result_id, + join(to_enclosed_unpacked_expression(op0), " ", op, " ", to_enclosed_unpacked_expression(op1)), forward); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); +} + +void CompilerGLSL::emit_unrolled_unary_op(uint32_t result_type, uint32_t result_id, uint32_t operand, const char *op) +{ + auto &type = get(result_type); + auto expr = type_to_glsl_constructor(type); + expr += '('; + for (uint32_t i = 0; i < type.vecsize; i++) + { + // Make sure to call to_expression multiple times to ensure + // that these expressions are properly flushed to temporaries if needed. + expr += op; + expr += to_extract_component_expression(operand, i); + + if (i + 1 < type.vecsize) + expr += ", "; + } + expr += ')'; + emit_op(result_type, result_id, expr, should_forward(operand)); + + inherit_expression_dependencies(result_id, operand); +} + +void CompilerGLSL::emit_unrolled_binary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + const char *op, bool negate, SPIRType::BaseType expected_type) +{ + auto &type0 = expression_type(op0); + auto &type1 = expression_type(op1); + + SPIRType target_type0 = type0; + SPIRType target_type1 = type1; + target_type0.basetype = expected_type; + target_type1.basetype = expected_type; + target_type0.vecsize = 1; + target_type1.vecsize = 1; + + auto &type = get(result_type); + auto expr = type_to_glsl_constructor(type); + expr += '('; + for (uint32_t i = 0; i < type.vecsize; i++) + { + // Make sure to call to_expression multiple times to ensure + // that these expressions are properly flushed to temporaries if needed. + if (negate) + expr += "!("; + + if (expected_type != SPIRType::Unknown && type0.basetype != expected_type) + expr += bitcast_expression(target_type0, type0.basetype, to_extract_component_expression(op0, i)); + else + expr += to_extract_component_expression(op0, i); + + expr += ' '; + expr += op; + expr += ' '; + + if (expected_type != SPIRType::Unknown && type1.basetype != expected_type) + expr += bitcast_expression(target_type1, type1.basetype, to_extract_component_expression(op1, i)); + else + expr += to_extract_component_expression(op1, i); + + if (negate) + expr += ")"; + + if (i + 1 < type.vecsize) + expr += ", "; + } + expr += ')'; + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1)); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); +} + +SPIRType CompilerGLSL::binary_op_bitcast_helper(string &cast_op0, string &cast_op1, SPIRType::BaseType &input_type, + uint32_t op0, uint32_t op1, bool skip_cast_if_equal_type) +{ + auto &type0 = expression_type(op0); + auto &type1 = expression_type(op1); + + // We have to bitcast if our inputs are of different type, or if our types are not equal to expected inputs. + // For some functions like OpIEqual and INotEqual, we don't care if inputs are of different types than expected + // since equality test is exactly the same. + bool cast = (type0.basetype != type1.basetype) || (!skip_cast_if_equal_type && type0.basetype != input_type); + + // Create a fake type so we can bitcast to it. + // We only deal with regular arithmetic types here like int, uints and so on. + SPIRType expected_type; + expected_type.basetype = input_type; + expected_type.vecsize = type0.vecsize; + expected_type.columns = type0.columns; + expected_type.width = type0.width; + + if (cast) + { + cast_op0 = bitcast_glsl(expected_type, op0); + cast_op1 = bitcast_glsl(expected_type, op1); + } + else + { + // If we don't cast, our actual input type is that of the first (or second) argument. + cast_op0 = to_enclosed_unpacked_expression(op0); + cast_op1 = to_enclosed_unpacked_expression(op1); + input_type = type0.basetype; + } + + return expected_type; +} + +bool CompilerGLSL::emit_complex_bitcast(uint32_t result_type, uint32_t id, uint32_t op0) +{ + // Some bitcasts may require complex casting sequences, and are implemented here. + // Otherwise a simply unary function will do with bitcast_glsl_op. + + auto &output_type = get(result_type); + auto &input_type = expression_type(op0); + string expr; + + if (output_type.basetype == SPIRType::Half && input_type.basetype == SPIRType::Float && input_type.vecsize == 1) + expr = join("unpackFloat2x16(floatBitsToUint(", to_unpacked_expression(op0), "))"); + else if (output_type.basetype == SPIRType::Float && input_type.basetype == SPIRType::Half && + input_type.vecsize == 2) + expr = join("uintBitsToFloat(packFloat2x16(", to_unpacked_expression(op0), "))"); + else + return false; + + emit_op(result_type, id, expr, should_forward(op0)); + return true; +} + +void CompilerGLSL::emit_binary_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + const char *op, SPIRType::BaseType input_type, + bool skip_cast_if_equal_type, + bool implicit_integer_promotion) +{ + string cast_op0, cast_op1; + auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, op0, op1, skip_cast_if_equal_type); + auto &out_type = get(result_type); + + // We might have casted away from the result type, so bitcast again. + // For example, arithmetic right shift with uint inputs. + // Special case boolean outputs since relational opcodes output booleans instead of int/uint. + auto bitop = join(cast_op0, " ", op, " ", cast_op1); + string expr; + + if (implicit_integer_promotion) + { + // Simple value cast. + expr = join(type_to_glsl(out_type), '(', bitop, ')'); + } + else if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) + { + expected_type.basetype = input_type; + expr = join(bitcast_glsl_op(out_type, expected_type), '(', bitop, ')'); + } + else + { + expr = std::move(bitop); + } + + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1)); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); +} + +void CompilerGLSL::emit_unary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op) +{ + bool forward = should_forward(op0); + emit_op(result_type, result_id, join(op, "(", to_unpacked_expression(op0), ")"), forward); + inherit_expression_dependencies(result_id, op0); +} + +void CompilerGLSL::emit_binary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + const char *op) +{ + // Opaque types (e.g. OpTypeSampledImage) must always be forwarded in GLSL + const auto &type = get_type(result_type); + bool must_forward = type_is_opaque_value(type); + bool forward = must_forward || (should_forward(op0) && should_forward(op1)); + emit_op(result_type, result_id, join(op, "(", to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), ")"), + forward); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); +} + +void CompilerGLSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + const char *op) +{ + auto &type = get(result_type); + if (type_is_floating_point(type)) + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Floating point atomics requires Vulkan semantics."); + if (options.es) + SPIRV_CROSS_THROW("Floating point atomics requires desktop GLSL."); + require_extension_internal("GL_EXT_shader_atomic_float"); + } + + forced_temporaries.insert(result_id); + emit_op(result_type, result_id, + join(op, "(", to_non_uniform_aware_expression(op0), ", ", + to_unpacked_expression(op1), ")"), false); + flush_all_atomic_capable_variables(); +} + +void CompilerGLSL::emit_atomic_func_op(uint32_t result_type, uint32_t result_id, + uint32_t op0, uint32_t op1, uint32_t op2, + const char *op) +{ + forced_temporaries.insert(result_id); + emit_op(result_type, result_id, + join(op, "(", to_non_uniform_aware_expression(op0), ", ", + to_unpacked_expression(op1), ", ", to_unpacked_expression(op2), ")"), false); + flush_all_atomic_capable_variables(); +} + +void CompilerGLSL::emit_unary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op, + SPIRType::BaseType input_type, SPIRType::BaseType expected_result_type) +{ + auto &out_type = get(result_type); + auto &expr_type = expression_type(op0); + auto expected_type = out_type; + + // Bit-widths might be different in unary cases because we use it for SConvert/UConvert and friends. + expected_type.basetype = input_type; + expected_type.width = expr_type.width; + + string cast_op; + if (expr_type.basetype != input_type) + { + if (expr_type.basetype == SPIRType::Boolean) + cast_op = join(type_to_glsl(expected_type), "(", to_unpacked_expression(op0), ")"); + else + cast_op = bitcast_glsl(expected_type, op0); + } + else + cast_op = to_unpacked_expression(op0); + + string expr; + if (out_type.basetype != expected_result_type) + { + expected_type.basetype = expected_result_type; + expected_type.width = out_type.width; + if (out_type.basetype == SPIRType::Boolean) + expr = type_to_glsl(out_type); + else + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op, ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op, ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0)); + inherit_expression_dependencies(result_id, op0); +} + +// Very special case. Handling bitfieldExtract requires us to deal with different bitcasts of different signs +// and different vector sizes all at once. Need a special purpose method here. +void CompilerGLSL::emit_trinary_func_op_bitextract(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, const char *op, + SPIRType::BaseType expected_result_type, + SPIRType::BaseType input_type0, SPIRType::BaseType input_type1, + SPIRType::BaseType input_type2) +{ + auto &out_type = get(result_type); + auto expected_type = out_type; + expected_type.basetype = input_type0; + + string cast_op0 = + expression_type(op0).basetype != input_type0 ? bitcast_glsl(expected_type, op0) : to_unpacked_expression(op0); + + auto op1_expr = to_unpacked_expression(op1); + auto op2_expr = to_unpacked_expression(op2); + + // Use value casts here instead. Input must be exactly int or uint, but SPIR-V might be 16-bit. + expected_type.basetype = input_type1; + expected_type.vecsize = 1; + string cast_op1 = expression_type(op1).basetype != input_type1 ? + join(type_to_glsl_constructor(expected_type), "(", op1_expr, ")") : + op1_expr; + + expected_type.basetype = input_type2; + expected_type.vecsize = 1; + string cast_op2 = expression_type(op2).basetype != input_type2 ? + join(type_to_glsl_constructor(expected_type), "(", op2_expr, ")") : + op2_expr; + + string expr; + if (out_type.basetype != expected_result_type) + { + expected_type.vecsize = out_type.vecsize; + expected_type.basetype = expected_result_type; + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1) && should_forward(op2)); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); +} + +void CompilerGLSL::emit_trinary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, const char *op, SPIRType::BaseType input_type) +{ + auto &out_type = get(result_type); + auto expected_type = out_type; + expected_type.basetype = input_type; + string cast_op0 = + expression_type(op0).basetype != input_type ? bitcast_glsl(expected_type, op0) : to_unpacked_expression(op0); + string cast_op1 = + expression_type(op1).basetype != input_type ? bitcast_glsl(expected_type, op1) : to_unpacked_expression(op1); + string cast_op2 = + expression_type(op2).basetype != input_type ? bitcast_glsl(expected_type, op2) : to_unpacked_expression(op2); + + string expr; + if (out_type.basetype != input_type) + { + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1) && should_forward(op2)); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); +} + +void CompilerGLSL::emit_binary_func_op_cast_clustered(uint32_t result_type, uint32_t result_id, uint32_t op0, + uint32_t op1, const char *op, SPIRType::BaseType input_type) +{ + // Special purpose method for implementing clustered subgroup opcodes. + // Main difference is that op1 does not participate in any casting, it needs to be a literal. + auto &out_type = get(result_type); + auto expected_type = out_type; + expected_type.basetype = input_type; + string cast_op0 = + expression_type(op0).basetype != input_type ? bitcast_glsl(expected_type, op0) : to_unpacked_expression(op0); + + string expr; + if (out_type.basetype != input_type) + { + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op0, ", ", to_expression(op1), ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op0, ", ", to_expression(op1), ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0)); + inherit_expression_dependencies(result_id, op0); +} + +void CompilerGLSL::emit_binary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + const char *op, SPIRType::BaseType input_type, bool skip_cast_if_equal_type) +{ + string cast_op0, cast_op1; + auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, op0, op1, skip_cast_if_equal_type); + auto &out_type = get(result_type); + + // Special case boolean outputs since relational opcodes output booleans instead of int/uint. + string expr; + if (out_type.basetype != input_type && out_type.basetype != SPIRType::Boolean) + { + expected_type.basetype = input_type; + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op0, ", ", cast_op1, ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op0, ", ", cast_op1, ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1)); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); +} + +void CompilerGLSL::emit_trinary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, const char *op) +{ + bool forward = should_forward(op0) && should_forward(op1) && should_forward(op2); + emit_op(result_type, result_id, + join(op, "(", to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), ", ", + to_unpacked_expression(op2), ")"), + forward); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); +} + +void CompilerGLSL::emit_quaternary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, uint32_t op3, const char *op) +{ + bool forward = should_forward(op0) && should_forward(op1) && should_forward(op2) && should_forward(op3); + emit_op(result_type, result_id, + join(op, "(", to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), ", ", + to_unpacked_expression(op2), ", ", to_unpacked_expression(op3), ")"), + forward); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); + inherit_expression_dependencies(result_id, op3); +} + +void CompilerGLSL::emit_bitfield_insert_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, uint32_t op3, const char *op, + SPIRType::BaseType offset_count_type) +{ + // Only need to cast offset/count arguments. Types of base/insert must be same as result type, + // and bitfieldInsert is sign invariant. + bool forward = should_forward(op0) && should_forward(op1) && should_forward(op2) && should_forward(op3); + + auto op0_expr = to_unpacked_expression(op0); + auto op1_expr = to_unpacked_expression(op1); + auto op2_expr = to_unpacked_expression(op2); + auto op3_expr = to_unpacked_expression(op3); + + SPIRType target_type; + target_type.vecsize = 1; + target_type.basetype = offset_count_type; + + if (expression_type(op2).basetype != offset_count_type) + { + // Value-cast here. Input might be 16-bit. GLSL requires int. + op2_expr = join(type_to_glsl_constructor(target_type), "(", op2_expr, ")"); + } + + if (expression_type(op3).basetype != offset_count_type) + { + // Value-cast here. Input might be 16-bit. GLSL requires int. + op3_expr = join(type_to_glsl_constructor(target_type), "(", op3_expr, ")"); + } + + emit_op(result_type, result_id, join(op, "(", op0_expr, ", ", op1_expr, ", ", op2_expr, ", ", op3_expr, ")"), + forward); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); + inherit_expression_dependencies(result_id, op3); +} + +string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtype, uint32_t tex) +{ + const char *type; + switch (imgtype.image.dim) + { + case spv::Dim1D: + // Force 2D path for ES. + if (options.es) + type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; + else + type = (imgtype.image.arrayed && !options.es) ? "1DArray" : "1D"; + break; + case spv::Dim2D: + type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D"; + break; + case spv::Dim3D: + type = "3D"; + break; + case spv::DimCube: + type = "Cube"; + break; + case spv::DimRect: + type = "2DRect"; + break; + case spv::DimBuffer: + type = "Buffer"; + break; + case spv::DimSubpassData: + type = "2D"; + break; + default: + type = ""; + break; + } + + // In legacy GLSL, an extension is required for textureLod in the fragment + // shader or textureGrad anywhere. + bool legacy_lod_ext = false; + auto &execution = get_entry_point(); + if (op == "textureGrad" || op == "textureProjGrad" || + ((op == "textureLod" || op == "textureProjLod") && execution.model != ExecutionModelVertex)) + { + if (is_legacy_es()) + { + legacy_lod_ext = true; + require_extension_internal("GL_EXT_shader_texture_lod"); + } + else if (is_legacy_desktop()) + require_extension_internal("GL_ARB_shader_texture_lod"); + } + + if (op == "textureLodOffset" || op == "textureProjLodOffset") + { + if (is_legacy_es()) + SPIRV_CROSS_THROW(join(op, " not allowed in legacy ES")); + + require_extension_internal("GL_EXT_gpu_shader4"); + } + + // GLES has very limited support for shadow samplers. + // Basically shadow2D and shadow2DProj work through EXT_shadow_samplers, + // everything else can just throw + bool is_comparison = is_depth_image(imgtype, tex); + if (is_comparison && is_legacy_es()) + { + if (op == "texture" || op == "textureProj") + require_extension_internal("GL_EXT_shadow_samplers"); + else + SPIRV_CROSS_THROW(join(op, " not allowed on depth samplers in legacy ES")); + + if (imgtype.image.dim == spv::DimCube) + return "shadowCubeNV"; + } + + if (op == "textureSize") + { + if (is_legacy_es()) + SPIRV_CROSS_THROW("textureSize not supported in legacy ES"); + if (is_comparison) + SPIRV_CROSS_THROW("textureSize not supported on shadow sampler in legacy GLSL"); + require_extension_internal("GL_EXT_gpu_shader4"); + } + + if (op == "texelFetch" && is_legacy_es()) + SPIRV_CROSS_THROW("texelFetch not supported in legacy ES"); + + bool is_es_and_depth = is_legacy_es() && is_comparison; + std::string type_prefix = is_comparison ? "shadow" : "texture"; + + if (op == "texture") + return is_es_and_depth ? join(type_prefix, type, "EXT") : join(type_prefix, type); + else if (op == "textureLod") + return join(type_prefix, type, legacy_lod_ext ? "LodEXT" : "Lod"); + else if (op == "textureProj") + return join(type_prefix, type, is_es_and_depth ? "ProjEXT" : "Proj"); + else if (op == "textureGrad") + return join(type_prefix, type, is_legacy_es() ? "GradEXT" : is_legacy_desktop() ? "GradARB" : "Grad"); + else if (op == "textureProjLod") + return join(type_prefix, type, legacy_lod_ext ? "ProjLodEXT" : "ProjLod"); + else if (op == "textureLodOffset") + return join(type_prefix, type, "LodOffset"); + else if (op == "textureProjGrad") + return join(type_prefix, type, + is_legacy_es() ? "ProjGradEXT" : is_legacy_desktop() ? "ProjGradARB" : "ProjGrad"); + else if (op == "textureProjLodOffset") + return join(type_prefix, type, "ProjLodOffset"); + else if (op == "textureSize") + return join("textureSize", type); + else if (op == "texelFetch") + return join("texelFetch", type); + else + { + SPIRV_CROSS_THROW(join("Unsupported legacy texture op: ", op)); + } +} + +bool CompilerGLSL::to_trivial_mix_op(const SPIRType &type, string &op, uint32_t left, uint32_t right, uint32_t lerp) +{ + auto *cleft = maybe_get(left); + auto *cright = maybe_get(right); + auto &lerptype = expression_type(lerp); + + // If our targets aren't constants, we cannot use construction. + if (!cleft || !cright) + return false; + + // If our targets are spec constants, we cannot use construction. + if (cleft->specialization || cright->specialization) + return false; + + auto &value_type = get(cleft->constant_type); + + if (lerptype.basetype != SPIRType::Boolean) + return false; + if (value_type.basetype == SPIRType::Struct || is_array(value_type)) + return false; + if (!backend.use_constructor_splatting && value_type.vecsize != lerptype.vecsize) + return false; + + // Only valid way in SPIR-V 1.4 to use matrices in select is a scalar select. + // matrix(scalar) constructor fills in diagnonals, so gets messy very quickly. + // Just avoid this case. + if (value_type.columns > 1) + return false; + + // If our bool selects between 0 and 1, we can cast from bool instead, making our trivial constructor. + bool ret = true; + for (uint32_t row = 0; ret && row < value_type.vecsize; row++) + { + switch (type.basetype) + { + case SPIRType::Short: + case SPIRType::UShort: + ret = cleft->scalar_u16(0, row) == 0 && cright->scalar_u16(0, row) == 1; + break; + + case SPIRType::Int: + case SPIRType::UInt: + ret = cleft->scalar(0, row) == 0 && cright->scalar(0, row) == 1; + break; + + case SPIRType::Half: + ret = cleft->scalar_f16(0, row) == 0.0f && cright->scalar_f16(0, row) == 1.0f; + break; + + case SPIRType::Float: + ret = cleft->scalar_f32(0, row) == 0.0f && cright->scalar_f32(0, row) == 1.0f; + break; + + case SPIRType::Double: + ret = cleft->scalar_f64(0, row) == 0.0 && cright->scalar_f64(0, row) == 1.0; + break; + + case SPIRType::Int64: + case SPIRType::UInt64: + ret = cleft->scalar_u64(0, row) == 0 && cright->scalar_u64(0, row) == 1; + break; + + default: + ret = false; + break; + } + } + + if (ret) + op = type_to_glsl_constructor(type); + return ret; +} + +string CompilerGLSL::to_ternary_expression(const SPIRType &restype, uint32_t select, uint32_t true_value, + uint32_t false_value) +{ + string expr; + auto &lerptype = expression_type(select); + + if (lerptype.vecsize == 1) + expr = join(to_enclosed_expression(select), " ? ", to_enclosed_pointer_expression(true_value), " : ", + to_enclosed_pointer_expression(false_value)); + else + { + auto swiz = [this](uint32_t expression, uint32_t i) { return to_extract_component_expression(expression, i); }; + + expr = type_to_glsl_constructor(restype); + expr += "("; + for (uint32_t i = 0; i < restype.vecsize; i++) + { + expr += swiz(select, i); + expr += " ? "; + expr += swiz(true_value, i); + expr += " : "; + expr += swiz(false_value, i); + if (i + 1 < restype.vecsize) + expr += ", "; + } + expr += ")"; + } + + return expr; +} + +void CompilerGLSL::emit_mix_op(uint32_t result_type, uint32_t id, uint32_t left, uint32_t right, uint32_t lerp) +{ + auto &lerptype = expression_type(lerp); + auto &restype = get(result_type); + + // If this results in a variable pointer, assume it may be written through. + if (restype.pointer) + { + register_write(left); + register_write(right); + } + + string mix_op; + bool has_boolean_mix = *backend.boolean_mix_function && + ((options.es && options.version >= 310) || (!options.es && options.version >= 450)); + bool trivial_mix = to_trivial_mix_op(restype, mix_op, left, right, lerp); + + // Cannot use boolean mix when the lerp argument is just one boolean, + // fall back to regular trinary statements. + if (lerptype.vecsize == 1) + has_boolean_mix = false; + + // If we can reduce the mix to a simple cast, do so. + // This helps for cases like int(bool), uint(bool) which is implemented with + // OpSelect bool 1 0. + if (trivial_mix) + { + emit_unary_func_op(result_type, id, lerp, mix_op.c_str()); + } + else if (!has_boolean_mix && lerptype.basetype == SPIRType::Boolean) + { + // Boolean mix not supported on desktop without extension. + // Was added in OpenGL 4.5 with ES 3.1 compat. + // + // Could use GL_EXT_shader_integer_mix on desktop at least, + // but Apple doesn't support it. :( + // Just implement it as ternary expressions. + auto expr = to_ternary_expression(get(result_type), lerp, right, left); + emit_op(result_type, id, expr, should_forward(left) && should_forward(right) && should_forward(lerp)); + inherit_expression_dependencies(id, left); + inherit_expression_dependencies(id, right); + inherit_expression_dependencies(id, lerp); + } + else if (lerptype.basetype == SPIRType::Boolean) + emit_trinary_func_op(result_type, id, left, right, lerp, backend.boolean_mix_function); + else + emit_trinary_func_op(result_type, id, left, right, lerp, "mix"); +} + +string CompilerGLSL::to_combined_image_sampler(VariableID image_id, VariableID samp_id) +{ + // Keep track of the array indices we have used to load the image. + // We'll need to use the same array index into the combined image sampler array. + auto image_expr = to_non_uniform_aware_expression(image_id); + string array_expr; + auto array_index = image_expr.find_first_of('['); + if (array_index != string::npos) + array_expr = image_expr.substr(array_index, string::npos); + + auto &args = current_function->arguments; + + // For GLSL and ESSL targets, we must enumerate all possible combinations for sampler2D(texture2D, sampler) and redirect + // all possible combinations into new sampler2D uniforms. + auto *image = maybe_get_backing_variable(image_id); + auto *samp = maybe_get_backing_variable(samp_id); + if (image) + image_id = image->self; + if (samp) + samp_id = samp->self; + + auto image_itr = find_if(begin(args), end(args), + [image_id](const SPIRFunction::Parameter ¶m) { return image_id == param.id; }); + + auto sampler_itr = find_if(begin(args), end(args), + [samp_id](const SPIRFunction::Parameter ¶m) { return samp_id == param.id; }); + + if (image_itr != end(args) || sampler_itr != end(args)) + { + // If any parameter originates from a parameter, we will find it in our argument list. + bool global_image = image_itr == end(args); + bool global_sampler = sampler_itr == end(args); + VariableID iid = global_image ? image_id : VariableID(uint32_t(image_itr - begin(args))); + VariableID sid = global_sampler ? samp_id : VariableID(uint32_t(sampler_itr - begin(args))); + + auto &combined = current_function->combined_parameters; + auto itr = find_if(begin(combined), end(combined), [=](const SPIRFunction::CombinedImageSamplerParameter &p) { + return p.global_image == global_image && p.global_sampler == global_sampler && p.image_id == iid && + p.sampler_id == sid; + }); + + if (itr != end(combined)) + return to_expression(itr->id) + array_expr; + else + { + SPIRV_CROSS_THROW("Cannot find mapping for combined sampler parameter, was " + "build_combined_image_samplers() used " + "before compile() was called?"); + } + } + else + { + // For global sampler2D, look directly at the global remapping table. + auto &mapping = combined_image_samplers; + auto itr = find_if(begin(mapping), end(mapping), [image_id, samp_id](const CombinedImageSampler &combined) { + return combined.image_id == image_id && combined.sampler_id == samp_id; + }); + + if (itr != end(combined_image_samplers)) + return to_expression(itr->combined_id) + array_expr; + else + { + SPIRV_CROSS_THROW("Cannot find mapping for combined sampler, was build_combined_image_samplers() used " + "before compile() was called?"); + } + } +} + +bool CompilerGLSL::is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops) +{ + switch (op) + { + case OpGroupNonUniformElect: + case OpGroupNonUniformBallot: + case OpGroupNonUniformBallotFindLSB: + case OpGroupNonUniformBallotFindMSB: + case OpGroupNonUniformBroadcast: + case OpGroupNonUniformBroadcastFirst: + case OpGroupNonUniformAll: + case OpGroupNonUniformAny: + case OpGroupNonUniformAllEqual: + case OpControlBarrier: + case OpMemoryBarrier: + case OpGroupNonUniformBallotBitCount: + case OpGroupNonUniformBallotBitExtract: + case OpGroupNonUniformInverseBallot: + return true; + case OpGroupNonUniformIAdd: + case OpGroupNonUniformFAdd: + case OpGroupNonUniformIMul: + case OpGroupNonUniformFMul: + { + const GroupOperation operation = static_cast(ops[3]); + if (operation == GroupOperationReduce || operation == GroupOperationInclusiveScan || + operation == GroupOperationExclusiveScan) + { + return true; + } + else + { + return false; + } + } + default: + return false; + } +} + +void CompilerGLSL::emit_sampled_image_op(uint32_t result_type, uint32_t result_id, uint32_t image_id, uint32_t samp_id) +{ + if (options.vulkan_semantics && combined_image_samplers.empty()) + { + emit_binary_func_op(result_type, result_id, image_id, samp_id, + type_to_glsl(get(result_type), result_id).c_str()); + } + else + { + // Make sure to suppress usage tracking. It is illegal to create temporaries of opaque types. + emit_op(result_type, result_id, to_combined_image_sampler(image_id, samp_id), true, true); + } + + // Make sure to suppress usage tracking and any expression invalidation. + // It is illegal to create temporaries of opaque types. + forwarded_temporaries.erase(result_id); +} + +static inline bool image_opcode_is_sample_no_dref(Op op) +{ + switch (op) + { + case OpImageSampleExplicitLod: + case OpImageSampleImplicitLod: + case OpImageSampleProjExplicitLod: + case OpImageSampleProjImplicitLod: + case OpImageFetch: + case OpImageRead: + case OpImageSparseSampleExplicitLod: + case OpImageSparseSampleImplicitLod: + case OpImageSparseSampleProjExplicitLod: + case OpImageSparseSampleProjImplicitLod: + case OpImageSparseFetch: + case OpImageSparseRead: + return true; + + default: + return false; + } +} + +void CompilerGLSL::emit_sparse_feedback_temporaries(uint32_t result_type_id, uint32_t id, uint32_t &feedback_id, + uint32_t &texel_id) +{ + // Need to allocate two temporaries. + if (options.es) + SPIRV_CROSS_THROW("Sparse texture feedback is not supported on ESSL."); + require_extension_internal("GL_ARB_sparse_texture2"); + + auto &temps = extra_sub_expressions[id]; + if (temps == 0) + temps = ir.increase_bound_by(2); + + feedback_id = temps + 0; + texel_id = temps + 1; + + auto &return_type = get(result_type_id); + if (return_type.basetype != SPIRType::Struct || return_type.member_types.size() != 2) + SPIRV_CROSS_THROW("Invalid return type for sparse feedback."); + emit_uninitialized_temporary(return_type.member_types[0], feedback_id); + emit_uninitialized_temporary(return_type.member_types[1], texel_id); +} + +uint32_t CompilerGLSL::get_sparse_feedback_texel_id(uint32_t id) const +{ + auto itr = extra_sub_expressions.find(id); + if (itr == extra_sub_expressions.end()) + return 0; + else + return itr->second + 1; +} + +void CompilerGLSL::emit_texture_op(const Instruction &i, bool sparse) +{ + auto *ops = stream(i); + auto op = static_cast(i.op); + + SmallVector inherited_expressions; + + uint32_t result_type_id = ops[0]; + uint32_t id = ops[1]; + auto &return_type = get(result_type_id); + + uint32_t sparse_code_id = 0; + uint32_t sparse_texel_id = 0; + if (sparse) + emit_sparse_feedback_temporaries(result_type_id, id, sparse_code_id, sparse_texel_id); + + bool forward = false; + string expr = to_texture_op(i, sparse, &forward, inherited_expressions); + + if (sparse) + { + statement(to_expression(sparse_code_id), " = ", expr, ";"); + expr = join(type_to_glsl(return_type), "(", to_expression(sparse_code_id), ", ", to_expression(sparse_texel_id), + ")"); + forward = true; + inherited_expressions.clear(); + } + + emit_op(result_type_id, id, expr, forward); + for (auto &inherit : inherited_expressions) + inherit_expression_dependencies(id, inherit); + + // Do not register sparse ops as control dependent as they are always lowered to a temporary. + switch (op) + { + case OpImageSampleDrefImplicitLod: + case OpImageSampleImplicitLod: + case OpImageSampleProjImplicitLod: + case OpImageSampleProjDrefImplicitLod: + register_control_dependent_expression(id); + break; + + default: + break; + } +} + +std::string CompilerGLSL::to_texture_op(const Instruction &i, bool sparse, bool *forward, + SmallVector &inherited_expressions) +{ + auto *ops = stream(i); + auto op = static_cast(i.op); + uint32_t length = i.length; + + uint32_t result_type_id = ops[0]; + VariableID img = ops[2]; + uint32_t coord = ops[3]; + uint32_t dref = 0; + uint32_t comp = 0; + bool gather = false; + bool proj = false; + bool fetch = false; + bool nonuniform_expression = false; + const uint32_t *opt = nullptr; + + auto &result_type = get(result_type_id); + + inherited_expressions.push_back(coord); + if (has_decoration(img, DecorationNonUniform) && !maybe_get_backing_variable(img)) + nonuniform_expression = true; + + switch (op) + { + case OpImageSampleDrefImplicitLod: + case OpImageSampleDrefExplicitLod: + case OpImageSparseSampleDrefImplicitLod: + case OpImageSparseSampleDrefExplicitLod: + dref = ops[4]; + opt = &ops[5]; + length -= 5; + break; + + case OpImageSampleProjDrefImplicitLod: + case OpImageSampleProjDrefExplicitLod: + case OpImageSparseSampleProjDrefImplicitLod: + case OpImageSparseSampleProjDrefExplicitLod: + dref = ops[4]; + opt = &ops[5]; + length -= 5; + proj = true; + break; + + case OpImageDrefGather: + case OpImageSparseDrefGather: + dref = ops[4]; + opt = &ops[5]; + length -= 5; + gather = true; + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("textureGather requires ESSL 310."); + else if (!options.es && options.version < 400) + SPIRV_CROSS_THROW("textureGather with depth compare requires GLSL 400."); + break; + + case OpImageGather: + case OpImageSparseGather: + comp = ops[4]; + opt = &ops[5]; + length -= 5; + gather = true; + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("textureGather requires ESSL 310."); + else if (!options.es && options.version < 400) + { + if (!expression_is_constant_null(comp)) + SPIRV_CROSS_THROW("textureGather with component requires GLSL 400."); + require_extension_internal("GL_ARB_texture_gather"); + } + break; + + case OpImageFetch: + case OpImageSparseFetch: + case OpImageRead: // Reads == fetches in Metal (other langs will not get here) + opt = &ops[4]; + length -= 4; + fetch = true; + break; + + case OpImageSampleProjImplicitLod: + case OpImageSampleProjExplicitLod: + case OpImageSparseSampleProjImplicitLod: + case OpImageSparseSampleProjExplicitLod: + opt = &ops[4]; + length -= 4; + proj = true; + break; + + default: + opt = &ops[4]; + length -= 4; + break; + } + + // Bypass pointers because we need the real image struct + auto &type = expression_type(img); + auto &imgtype = get(type.self); + + uint32_t coord_components = 0; + switch (imgtype.image.dim) + { + case spv::Dim1D: + coord_components = 1; + break; + case spv::Dim2D: + coord_components = 2; + break; + case spv::Dim3D: + coord_components = 3; + break; + case spv::DimCube: + coord_components = 3; + break; + case spv::DimBuffer: + coord_components = 1; + break; + default: + coord_components = 2; + break; + } + + if (dref) + inherited_expressions.push_back(dref); + + if (proj) + coord_components++; + if (imgtype.image.arrayed) + coord_components++; + + uint32_t bias = 0; + uint32_t lod = 0; + uint32_t grad_x = 0; + uint32_t grad_y = 0; + uint32_t coffset = 0; + uint32_t offset = 0; + uint32_t coffsets = 0; + uint32_t sample = 0; + uint32_t minlod = 0; + uint32_t flags = 0; + + if (length) + { + flags = *opt++; + length--; + } + + auto test = [&](uint32_t &v, uint32_t flag) { + if (length && (flags & flag)) + { + v = *opt++; + inherited_expressions.push_back(v); + length--; + } + }; + + test(bias, ImageOperandsBiasMask); + test(lod, ImageOperandsLodMask); + test(grad_x, ImageOperandsGradMask); + test(grad_y, ImageOperandsGradMask); + test(coffset, ImageOperandsConstOffsetMask); + test(offset, ImageOperandsOffsetMask); + test(coffsets, ImageOperandsConstOffsetsMask); + test(sample, ImageOperandsSampleMask); + test(minlod, ImageOperandsMinLodMask); + + TextureFunctionBaseArguments base_args = {}; + base_args.img = img; + base_args.imgtype = &imgtype; + base_args.is_fetch = fetch != 0; + base_args.is_gather = gather != 0; + base_args.is_proj = proj != 0; + + string expr; + TextureFunctionNameArguments name_args = {}; + + name_args.base = base_args; + name_args.has_array_offsets = coffsets != 0; + name_args.has_offset = coffset != 0 || offset != 0; + name_args.has_grad = grad_x != 0 || grad_y != 0; + name_args.has_dref = dref != 0; + name_args.is_sparse_feedback = sparse; + name_args.has_min_lod = minlod != 0; + name_args.lod = lod; + expr += to_function_name(name_args); + expr += "("; + + uint32_t sparse_texel_id = 0; + if (sparse) + sparse_texel_id = get_sparse_feedback_texel_id(ops[1]); + + TextureFunctionArguments args = {}; + args.base = base_args; + args.coord = coord; + args.coord_components = coord_components; + args.dref = dref; + args.grad_x = grad_x; + args.grad_y = grad_y; + args.lod = lod; + + if (coffsets) + args.offset = coffsets; + else if (coffset) + args.offset = coffset; + else + args.offset = offset; + + args.bias = bias; + args.component = comp; + args.sample = sample; + args.sparse_texel = sparse_texel_id; + args.min_lod = minlod; + args.nonuniform_expression = nonuniform_expression; + expr += to_function_args(args, forward); + expr += ")"; + + // texture(samplerXShadow) returns float. shadowX() returns vec4, but only in desktop GLSL. Swizzle here. + if (is_legacy() && !options.es && is_depth_image(imgtype, img)) + expr += ".r"; + + // Sampling from a texture which was deduced to be a depth image, might actually return 1 component here. + // Remap back to 4 components as sampling opcodes expect. + if (backend.comparison_image_samples_scalar && image_opcode_is_sample_no_dref(op)) + { + bool image_is_depth = false; + const auto *combined = maybe_get(img); + VariableID image_id = combined ? combined->image : img; + + if (combined && is_depth_image(imgtype, combined->image)) + image_is_depth = true; + else if (is_depth_image(imgtype, img)) + image_is_depth = true; + + // We must also check the backing variable for the image. + // We might have loaded an OpImage, and used that handle for two different purposes. + // Once with comparison, once without. + auto *image_variable = maybe_get_backing_variable(image_id); + if (image_variable && is_depth_image(get(image_variable->basetype), image_variable->self)) + image_is_depth = true; + + if (image_is_depth) + expr = remap_swizzle(result_type, 1, expr); + } + + if (!sparse && !backend.support_small_type_sampling_result && result_type.width < 32) + { + // Just value cast (narrowing) to expected type since we cannot rely on narrowing to work automatically. + // Hopefully compiler picks this up and converts the texturing instruction to the appropriate precision. + expr = join(type_to_glsl_constructor(result_type), "(", expr, ")"); + } + + // Deals with reads from MSL. We might need to downconvert to fewer components. + if (op == OpImageRead) + expr = remap_swizzle(result_type, 4, expr); + + return expr; +} + +bool CompilerGLSL::expression_is_constant_null(uint32_t id) const +{ + auto *c = maybe_get(id); + if (!c) + return false; + return c->constant_is_null(); +} + +bool CompilerGLSL::expression_is_non_value_type_array(uint32_t ptr) +{ + auto &type = expression_type(ptr); + if (!type_is_top_level_array(get_pointee_type(type))) + return false; + + if (!backend.array_is_value_type) + return true; + + auto *var = maybe_get_backing_variable(ptr); + if (!var) + return false; + + auto &backed_type = get(var->basetype); + return !backend.array_is_value_type_in_buffer_blocks && backed_type.basetype == SPIRType::Struct && + has_member_decoration(backed_type.self, 0, DecorationOffset); +} + +// Returns the function name for a texture sampling function for the specified image and sampling characteristics. +// For some subclasses, the function is a method on the specified image. +string CompilerGLSL::to_function_name(const TextureFunctionNameArguments &args) +{ + if (args.has_min_lod) + { + if (options.es) + SPIRV_CROSS_THROW("Sparse residency is not supported in ESSL."); + require_extension_internal("GL_ARB_sparse_texture_clamp"); + } + + string fname; + auto &imgtype = *args.base.imgtype; + VariableID tex = args.base.img; + + // textureLod on sampler2DArrayShadow and samplerCubeShadow does not exist in GLSL for some reason. + // To emulate this, we will have to use textureGrad with a constant gradient of 0. + // The workaround will assert that the LOD is in fact constant 0, or we cannot emit correct code. + // This happens for HLSL SampleCmpLevelZero on Texture2DArray and TextureCube. + bool workaround_lod_array_shadow_as_grad = false; + if (((imgtype.image.arrayed && imgtype.image.dim == Dim2D) || imgtype.image.dim == DimCube) && + is_depth_image(imgtype, tex) && args.lod && !args.base.is_fetch) + { + if (!expression_is_constant_null(args.lod)) + { + SPIRV_CROSS_THROW("textureLod on sampler2DArrayShadow is not constant 0.0. This cannot be " + "expressed in GLSL."); + } + workaround_lod_array_shadow_as_grad = true; + } + + if (args.is_sparse_feedback) + fname += "sparse"; + + if (args.base.is_fetch) + fname += args.is_sparse_feedback ? "TexelFetch" : "texelFetch"; + else + { + fname += args.is_sparse_feedback ? "Texture" : "texture"; + + if (args.base.is_gather) + fname += "Gather"; + if (args.has_array_offsets) + fname += "Offsets"; + if (args.base.is_proj) + fname += "Proj"; + if (args.has_grad || workaround_lod_array_shadow_as_grad) + fname += "Grad"; + if (args.lod != 0 && !workaround_lod_array_shadow_as_grad) + fname += "Lod"; + } + + if (args.has_offset) + fname += "Offset"; + + if (args.has_min_lod) + fname += "Clamp"; + + if (args.is_sparse_feedback || args.has_min_lod) + fname += "ARB"; + + return (is_legacy() && !args.base.is_gather) ? legacy_tex_op(fname, imgtype, tex) : fname; +} + +std::string CompilerGLSL::convert_separate_image_to_expression(uint32_t id) +{ + auto *var = maybe_get_backing_variable(id); + + // If we are fetching from a plain OpTypeImage, we must combine with a dummy sampler in GLSL. + // In Vulkan GLSL, we can make use of the newer GL_EXT_samplerless_texture_functions. + if (var) + { + auto &type = get(var->basetype); + if (type.basetype == SPIRType::Image && type.image.sampled == 1 && type.image.dim != DimBuffer) + { + if (options.vulkan_semantics) + { + if (dummy_sampler_id) + { + // Don't need to consider Shadow state since the dummy sampler is always non-shadow. + auto sampled_type = type; + sampled_type.basetype = SPIRType::SampledImage; + return join(type_to_glsl(sampled_type), "(", to_non_uniform_aware_expression(id), ", ", + to_expression(dummy_sampler_id), ")"); + } + else + { + // Newer glslang supports this extension to deal with texture2D as argument to texture functions. + require_extension_internal("GL_EXT_samplerless_texture_functions"); + } + } + else + { + if (!dummy_sampler_id) + SPIRV_CROSS_THROW("Cannot find dummy sampler ID. Was " + "build_dummy_sampler_for_combined_images() called?"); + + return to_combined_image_sampler(id, dummy_sampler_id); + } + } + } + + return to_non_uniform_aware_expression(id); +} + +// Returns the function args for a texture sampling function for the specified image and sampling characteristics. +string CompilerGLSL::to_function_args(const TextureFunctionArguments &args, bool *p_forward) +{ + VariableID img = args.base.img; + auto &imgtype = *args.base.imgtype; + + string farg_str; + if (args.base.is_fetch) + farg_str = convert_separate_image_to_expression(img); + else + farg_str = to_non_uniform_aware_expression(img); + + if (args.nonuniform_expression && farg_str.find_first_of('[') != string::npos) + { + // Only emit nonuniformEXT() wrapper if the underlying expression is arrayed in some way. + farg_str = join(backend.nonuniform_qualifier, "(", farg_str, ")"); + } + + bool swizz_func = backend.swizzle_is_function; + auto swizzle = [swizz_func](uint32_t comps, uint32_t in_comps) -> const char * { + if (comps == in_comps) + return ""; + + switch (comps) + { + case 1: + return ".x"; + case 2: + return swizz_func ? ".xy()" : ".xy"; + case 3: + return swizz_func ? ".xyz()" : ".xyz"; + default: + return ""; + } + }; + + bool forward = should_forward(args.coord); + + // The IR can give us more components than we need, so chop them off as needed. + auto swizzle_expr = swizzle(args.coord_components, expression_type(args.coord).vecsize); + // Only enclose the UV expression if needed. + auto coord_expr = + (*swizzle_expr == '\0') ? to_expression(args.coord) : (to_enclosed_expression(args.coord) + swizzle_expr); + + // texelFetch only takes int, not uint. + auto &coord_type = expression_type(args.coord); + if (coord_type.basetype == SPIRType::UInt) + { + auto expected_type = coord_type; + expected_type.vecsize = args.coord_components; + expected_type.basetype = SPIRType::Int; + coord_expr = bitcast_expression(expected_type, coord_type.basetype, coord_expr); + } + + // textureLod on sampler2DArrayShadow and samplerCubeShadow does not exist in GLSL for some reason. + // To emulate this, we will have to use textureGrad with a constant gradient of 0. + // The workaround will assert that the LOD is in fact constant 0, or we cannot emit correct code. + // This happens for HLSL SampleCmpLevelZero on Texture2DArray and TextureCube. + bool workaround_lod_array_shadow_as_grad = + ((imgtype.image.arrayed && imgtype.image.dim == Dim2D) || imgtype.image.dim == DimCube) && + is_depth_image(imgtype, img) && args.lod != 0 && !args.base.is_fetch; + + if (args.dref) + { + forward = forward && should_forward(args.dref); + + // SPIR-V splits dref and coordinate. + if (args.base.is_gather || + args.coord_components == 4) // GLSL also splits the arguments in two. Same for textureGather. + { + farg_str += ", "; + farg_str += to_expression(args.coord); + farg_str += ", "; + farg_str += to_expression(args.dref); + } + else if (args.base.is_proj) + { + // Have to reshuffle so we get vec4(coord, dref, proj), special case. + // Other shading languages splits up the arguments for coord and compare value like SPIR-V. + // The coordinate type for textureProj shadow is always vec4 even for sampler1DShadow. + farg_str += ", vec4("; + + if (imgtype.image.dim == Dim1D) + { + // Could reuse coord_expr, but we will mess up the temporary usage checking. + farg_str += to_enclosed_expression(args.coord) + ".x"; + farg_str += ", "; + farg_str += "0.0, "; + farg_str += to_expression(args.dref); + farg_str += ", "; + farg_str += to_enclosed_expression(args.coord) + ".y)"; + } + else if (imgtype.image.dim == Dim2D) + { + // Could reuse coord_expr, but we will mess up the temporary usage checking. + farg_str += to_enclosed_expression(args.coord) + (swizz_func ? ".xy()" : ".xy"); + farg_str += ", "; + farg_str += to_expression(args.dref); + farg_str += ", "; + farg_str += to_enclosed_expression(args.coord) + ".z)"; + } + else + SPIRV_CROSS_THROW("Invalid type for textureProj with shadow."); + } + else + { + // Create a composite which merges coord/dref into a single vector. + auto type = expression_type(args.coord); + type.vecsize = args.coord_components + 1; + if (imgtype.image.dim == Dim1D && options.es) + type.vecsize++; + farg_str += ", "; + farg_str += type_to_glsl_constructor(type); + farg_str += "("; + + if (imgtype.image.dim == Dim1D && options.es) + { + if (imgtype.image.arrayed) + { + farg_str += enclose_expression(coord_expr) + ".x"; + farg_str += ", 0.0, "; + farg_str += enclose_expression(coord_expr) + ".y"; + } + else + { + farg_str += coord_expr; + farg_str += ", 0.0"; + } + } + else + farg_str += coord_expr; + + farg_str += ", "; + farg_str += to_expression(args.dref); + farg_str += ")"; + } + } + else + { + if (imgtype.image.dim == Dim1D && options.es) + { + // Have to fake a second coordinate. + if (type_is_floating_point(coord_type)) + { + // Cannot mix proj and array. + if (imgtype.image.arrayed || args.base.is_proj) + { + coord_expr = join("vec3(", enclose_expression(coord_expr), ".x, 0.0, ", + enclose_expression(coord_expr), ".y)"); + } + else + coord_expr = join("vec2(", coord_expr, ", 0.0)"); + } + else + { + if (imgtype.image.arrayed) + { + coord_expr = join("ivec3(", enclose_expression(coord_expr), + ".x, 0, ", + enclose_expression(coord_expr), ".y)"); + } + else + coord_expr = join("ivec2(", coord_expr, ", 0)"); + } + } + + farg_str += ", "; + farg_str += coord_expr; + } + + if (args.grad_x || args.grad_y) + { + forward = forward && should_forward(args.grad_x); + forward = forward && should_forward(args.grad_y); + farg_str += ", "; + farg_str += to_expression(args.grad_x); + farg_str += ", "; + farg_str += to_expression(args.grad_y); + } + + if (args.lod) + { + if (workaround_lod_array_shadow_as_grad) + { + // Implement textureGrad() instead. LOD == 0.0 is implemented as gradient of 0.0. + // Implementing this as plain texture() is not safe on some implementations. + if (imgtype.image.dim == Dim2D) + farg_str += ", vec2(0.0), vec2(0.0)"; + else if (imgtype.image.dim == DimCube) + farg_str += ", vec3(0.0), vec3(0.0)"; + } + else + { + forward = forward && should_forward(args.lod); + farg_str += ", "; + + // Lod expression for TexelFetch in GLSL must be int, and only int. + if (args.base.is_fetch && imgtype.image.dim != DimBuffer && !imgtype.image.ms) + farg_str += bitcast_expression(SPIRType::Int, args.lod); + else + farg_str += to_expression(args.lod); + } + } + else if (args.base.is_fetch && imgtype.image.dim != DimBuffer && !imgtype.image.ms) + { + // Lod argument is optional in OpImageFetch, but we require a LOD value, pick 0 as the default. + farg_str += ", 0"; + } + + if (args.offset) + { + forward = forward && should_forward(args.offset); + farg_str += ", "; + farg_str += bitcast_expression(SPIRType::Int, args.offset); + } + + if (args.sample) + { + farg_str += ", "; + farg_str += bitcast_expression(SPIRType::Int, args.sample); + } + + if (args.min_lod) + { + farg_str += ", "; + farg_str += to_expression(args.min_lod); + } + + if (args.sparse_texel) + { + // Sparse texel output parameter comes after everything else, except it's before the optional, component/bias arguments. + farg_str += ", "; + farg_str += to_expression(args.sparse_texel); + } + + if (args.bias) + { + forward = forward && should_forward(args.bias); + farg_str += ", "; + farg_str += to_expression(args.bias); + } + + if (args.component && !expression_is_constant_null(args.component)) + { + forward = forward && should_forward(args.component); + farg_str += ", "; + farg_str += bitcast_expression(SPIRType::Int, args.component); + } + + *p_forward = forward; + + return farg_str; +} + +Op CompilerGLSL::get_remapped_spirv_op(Op op) const +{ + if (options.relax_nan_checks) + { + switch (op) + { + case OpFUnordLessThan: + op = OpFOrdLessThan; + break; + case OpFUnordLessThanEqual: + op = OpFOrdLessThanEqual; + break; + case OpFUnordGreaterThan: + op = OpFOrdGreaterThan; + break; + case OpFUnordGreaterThanEqual: + op = OpFOrdGreaterThanEqual; + break; + case OpFUnordEqual: + op = OpFOrdEqual; + break; + case OpFOrdNotEqual: + op = OpFUnordNotEqual; + break; + + default: + break; + } + } + + return op; +} + +GLSLstd450 CompilerGLSL::get_remapped_glsl_op(GLSLstd450 std450_op) const +{ + // Relax to non-NaN aware opcodes. + if (options.relax_nan_checks) + { + switch (std450_op) + { + case GLSLstd450NClamp: + std450_op = GLSLstd450FClamp; + break; + case GLSLstd450NMin: + std450_op = GLSLstd450FMin; + break; + case GLSLstd450NMax: + std450_op = GLSLstd450FMax; + break; + default: + break; + } + } + + return std450_op; +} + +void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t length) +{ + auto op = static_cast(eop); + + if (is_legacy() && is_unsigned_glsl_opcode(op)) + SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy GLSL targets."); + + // If we need to do implicit bitcasts, make sure we do it with the correct type. + uint32_t integer_width = get_integer_width_for_glsl_instruction(op, args, length); + auto int_type = to_signed_basetype(integer_width); + auto uint_type = to_unsigned_basetype(integer_width); + + op = get_remapped_glsl_op(op); + + switch (op) + { + // FP fiddling + case GLSLstd450Round: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "round"); + else + { + auto op0 = to_enclosed_expression(args[0]); + auto &op0_type = expression_type(args[0]); + auto expr = join("floor(", op0, " + ", type_to_glsl_constructor(op0_type), "(0.5))"); + bool forward = should_forward(args[0]); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } + break; + + case GLSLstd450RoundEven: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "roundEven"); + else if (!options.es) + { + // This extension provides round() with round-to-even semantics. + require_extension_internal("GL_EXT_gpu_shader4"); + emit_unary_func_op(result_type, id, args[0], "round"); + } + else + SPIRV_CROSS_THROW("roundEven supported only in ESSL 300."); + break; + + case GLSLstd450Trunc: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "trunc"); + else + { + // Implement by value-casting to int and back. + bool forward = should_forward(args[0]); + auto op0 = to_unpacked_expression(args[0]); + auto &op0_type = expression_type(args[0]); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + auto expr = join(type_to_glsl(op0_type), "(", type_to_glsl(via_type), "(", op0, "))"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } + break; + + case GLSLstd450SAbs: + emit_unary_func_op_cast(result_type, id, args[0], "abs", int_type, int_type); + break; + case GLSLstd450FAbs: + emit_unary_func_op(result_type, id, args[0], "abs"); + break; + case GLSLstd450SSign: + emit_unary_func_op_cast(result_type, id, args[0], "sign", int_type, int_type); + break; + case GLSLstd450FSign: + emit_unary_func_op(result_type, id, args[0], "sign"); + break; + case GLSLstd450Floor: + emit_unary_func_op(result_type, id, args[0], "floor"); + break; + case GLSLstd450Ceil: + emit_unary_func_op(result_type, id, args[0], "ceil"); + break; + case GLSLstd450Fract: + emit_unary_func_op(result_type, id, args[0], "fract"); + break; + case GLSLstd450Radians: + emit_unary_func_op(result_type, id, args[0], "radians"); + break; + case GLSLstd450Degrees: + emit_unary_func_op(result_type, id, args[0], "degrees"); + break; + case GLSLstd450Fma: + if ((!options.es && options.version < 400) || (options.es && options.version < 320)) + { + auto expr = join(to_enclosed_expression(args[0]), " * ", to_enclosed_expression(args[1]), " + ", + to_enclosed_expression(args[2])); + + emit_op(result_type, id, expr, + should_forward(args[0]) && should_forward(args[1]) && should_forward(args[2])); + for (uint32_t i = 0; i < 3; i++) + inherit_expression_dependencies(id, args[i]); + } + else + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "fma"); + break; + + case GLSLstd450Modf: + register_call_out_argument(args[1]); + if (!is_legacy()) + { + forced_temporaries.insert(id); + emit_binary_func_op(result_type, id, args[0], args[1], "modf"); + } + else + { + //NB. legacy GLSL doesn't have trunc() either, so we do a value cast + auto &op1_type = expression_type(args[1]); + auto via_type = op1_type; + via_type.basetype = SPIRType::Int; + statement(to_expression(args[1]), " = ", + type_to_glsl(op1_type), "(", type_to_glsl(via_type), + "(", to_expression(args[0]), "));"); + emit_binary_op(result_type, id, args[0], args[1], "-"); + } + break; + + case GLSLstd450ModfStruct: + { + auto &type = get(result_type); + emit_uninitialized_temporary_expression(result_type, id); + if (!is_legacy()) + { + statement(to_expression(id), ".", to_member_name(type, 0), " = ", "modf(", to_expression(args[0]), ", ", + to_expression(id), ".", to_member_name(type, 1), ");"); + } + else + { + //NB. legacy GLSL doesn't have trunc() either, so we do a value cast + auto &op0_type = expression_type(args[0]); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + statement(to_expression(id), ".", to_member_name(type, 1), " = ", type_to_glsl(op0_type), + "(", type_to_glsl(via_type), "(", to_expression(args[0]), "));"); + statement(to_expression(id), ".", to_member_name(type, 0), " = ", to_enclosed_expression(args[0]), " - ", + to_expression(id), ".", to_member_name(type, 1), ";"); + } + break; + } + + // Minmax + case GLSLstd450UMin: + emit_binary_func_op_cast(result_type, id, args[0], args[1], "min", uint_type, false); + break; + + case GLSLstd450SMin: + emit_binary_func_op_cast(result_type, id, args[0], args[1], "min", int_type, false); + break; + + case GLSLstd450FMin: + emit_binary_func_op(result_type, id, args[0], args[1], "min"); + break; + + case GLSLstd450FMax: + emit_binary_func_op(result_type, id, args[0], args[1], "max"); + break; + + case GLSLstd450UMax: + emit_binary_func_op_cast(result_type, id, args[0], args[1], "max", uint_type, false); + break; + + case GLSLstd450SMax: + emit_binary_func_op_cast(result_type, id, args[0], args[1], "max", int_type, false); + break; + + case GLSLstd450FClamp: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "clamp"); + break; + + case GLSLstd450UClamp: + emit_trinary_func_op_cast(result_type, id, args[0], args[1], args[2], "clamp", uint_type); + break; + + case GLSLstd450SClamp: + emit_trinary_func_op_cast(result_type, id, args[0], args[1], args[2], "clamp", int_type); + break; + + // Trig + case GLSLstd450Sin: + emit_unary_func_op(result_type, id, args[0], "sin"); + break; + case GLSLstd450Cos: + emit_unary_func_op(result_type, id, args[0], "cos"); + break; + case GLSLstd450Tan: + emit_unary_func_op(result_type, id, args[0], "tan"); + break; + case GLSLstd450Asin: + emit_unary_func_op(result_type, id, args[0], "asin"); + break; + case GLSLstd450Acos: + emit_unary_func_op(result_type, id, args[0], "acos"); + break; + case GLSLstd450Atan: + emit_unary_func_op(result_type, id, args[0], "atan"); + break; + case GLSLstd450Sinh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "sinh"); + else + { + bool forward = should_forward(args[0]); + auto expr = join("(exp(", to_expression(args[0]), ") - exp(-", to_enclosed_expression(args[0]), ")) * 0.5"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } + break; + case GLSLstd450Cosh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "cosh"); + else + { + bool forward = should_forward(args[0]); + auto expr = join("(exp(", to_expression(args[0]), ") + exp(-", to_enclosed_expression(args[0]), ")) * 0.5"); + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + } + break; + case GLSLstd450Tanh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "tanh"); + else + { + // Create temporaries to store the result of exp(arg) and exp(-arg). + uint32_t &ids = extra_sub_expressions[id]; + if (!ids) + { + ids = ir.increase_bound_by(2); + + // Inherit precision qualifier (legacy has no NoContraction). + if (has_decoration(id, DecorationRelaxedPrecision)) + { + set_decoration(ids, DecorationRelaxedPrecision); + set_decoration(ids + 1, DecorationRelaxedPrecision); + } + } + uint32_t epos_id = ids; + uint32_t eneg_id = ids + 1; + + emit_op(result_type, epos_id, join("exp(", to_expression(args[0]), ")"), false); + emit_op(result_type, eneg_id, join("exp(-", to_enclosed_expression(args[0]), ")"), false); + inherit_expression_dependencies(epos_id, args[0]); + inherit_expression_dependencies(eneg_id, args[0]); + + auto expr = join("(", to_enclosed_expression(epos_id), " - ", to_enclosed_expression(eneg_id), ") / " + "(", to_enclosed_expression(epos_id), " + ", to_enclosed_expression(eneg_id), ")"); + emit_op(result_type, id, expr, true); + inherit_expression_dependencies(id, epos_id); + inherit_expression_dependencies(id, eneg_id); + } + break; + case GLSLstd450Asinh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "asinh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Asinh); + break; + case GLSLstd450Acosh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "acosh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Acosh); + break; + case GLSLstd450Atanh: + if (!is_legacy()) + emit_unary_func_op(result_type, id, args[0], "atanh"); + else + emit_emulated_ahyper_op(result_type, id, args[0], GLSLstd450Atanh); + break; + case GLSLstd450Atan2: + emit_binary_func_op(result_type, id, args[0], args[1], "atan"); + break; + + // Exponentials + case GLSLstd450Pow: + emit_binary_func_op(result_type, id, args[0], args[1], "pow"); + break; + case GLSLstd450Exp: + emit_unary_func_op(result_type, id, args[0], "exp"); + break; + case GLSLstd450Log: + emit_unary_func_op(result_type, id, args[0], "log"); + break; + case GLSLstd450Exp2: + emit_unary_func_op(result_type, id, args[0], "exp2"); + break; + case GLSLstd450Log2: + emit_unary_func_op(result_type, id, args[0], "log2"); + break; + case GLSLstd450Sqrt: + emit_unary_func_op(result_type, id, args[0], "sqrt"); + break; + case GLSLstd450InverseSqrt: + emit_unary_func_op(result_type, id, args[0], "inversesqrt"); + break; + + // Matrix math + case GLSLstd450Determinant: + { + // No need to transpose - it doesn't affect the determinant + auto *e = maybe_get(args[0]); + bool old_transpose = e && e->need_transpose; + if (old_transpose) + e->need_transpose = false; + + if (options.version < 150) // also matches ES 100 + { + auto &type = expression_type(args[0]); + assert(type.vecsize >= 2 && type.vecsize <= 4); + assert(type.vecsize == type.columns); + + // ARB_gpu_shader_fp64 needs GLSL 150, other types are not valid + if (type.basetype != SPIRType::Float) + SPIRV_CROSS_THROW("Unsupported type for matrix determinant"); + + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); + require_polyfill(static_cast(PolyfillDeterminant2x2 << (type.vecsize - 2)), + relaxed); + emit_unary_func_op(result_type, id, args[0], + (options.es && relaxed) ? "spvDeterminantMP" : "spvDeterminant"); + } + else + emit_unary_func_op(result_type, id, args[0], "determinant"); + + if (old_transpose) + e->need_transpose = true; + break; + } + + case GLSLstd450MatrixInverse: + { + // The inverse of the transpose is the same as the transpose of + // the inverse, so we can just flip need_transpose of the result. + auto *a = maybe_get(args[0]); + bool old_transpose = a && a->need_transpose; + if (old_transpose) + a->need_transpose = false; + + const char *func = "inverse"; + if (options.version < 140) // also matches ES 100 + { + auto &type = get(result_type); + assert(type.vecsize >= 2 && type.vecsize <= 4); + assert(type.vecsize == type.columns); + + // ARB_gpu_shader_fp64 needs GLSL 150, other types are invalid + if (type.basetype != SPIRType::Float) + SPIRV_CROSS_THROW("Unsupported type for matrix inverse"); + + bool relaxed = has_decoration(id, DecorationRelaxedPrecision); + require_polyfill(static_cast(PolyfillMatrixInverse2x2 << (type.vecsize - 2)), + relaxed); + func = (options.es && relaxed) ? "spvInverseMP" : "spvInverse"; + } + + bool forward = should_forward(args[0]); + auto &e = emit_op(result_type, id, join(func, "(", to_unpacked_expression(args[0]), ")"), forward); + inherit_expression_dependencies(id, args[0]); + + if (old_transpose) + { + e.need_transpose = true; + a->need_transpose = true; + } + break; + } + + // Lerping + case GLSLstd450FMix: + case GLSLstd450IMix: + { + emit_mix_op(result_type, id, args[0], args[1], args[2]); + break; + } + case GLSLstd450Step: + emit_binary_func_op(result_type, id, args[0], args[1], "step"); + break; + case GLSLstd450SmoothStep: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "smoothstep"); + break; + + // Packing + case GLSLstd450Frexp: + register_call_out_argument(args[1]); + forced_temporaries.insert(id); + emit_binary_func_op(result_type, id, args[0], args[1], "frexp"); + break; + + case GLSLstd450FrexpStruct: + { + auto &type = get(result_type); + emit_uninitialized_temporary_expression(result_type, id); + statement(to_expression(id), ".", to_member_name(type, 0), " = ", "frexp(", to_expression(args[0]), ", ", + to_expression(id), ".", to_member_name(type, 1), ");"); + break; + } + + case GLSLstd450Ldexp: + { + bool forward = should_forward(args[0]) && should_forward(args[1]); + + auto op0 = to_unpacked_expression(args[0]); + auto op1 = to_unpacked_expression(args[1]); + auto &op1_type = expression_type(args[1]); + if (op1_type.basetype != SPIRType::Int) + { + // Need a value cast here. + auto target_type = op1_type; + target_type.basetype = SPIRType::Int; + op1 = join(type_to_glsl_constructor(target_type), "(", op1, ")"); + } + + auto expr = join("ldexp(", op0, ", ", op1, ")"); + + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + inherit_expression_dependencies(id, args[1]); + break; + } + + case GLSLstd450PackSnorm4x8: + emit_unary_func_op(result_type, id, args[0], "packSnorm4x8"); + break; + case GLSLstd450PackUnorm4x8: + emit_unary_func_op(result_type, id, args[0], "packUnorm4x8"); + break; + case GLSLstd450PackSnorm2x16: + emit_unary_func_op(result_type, id, args[0], "packSnorm2x16"); + break; + case GLSLstd450PackUnorm2x16: + emit_unary_func_op(result_type, id, args[0], "packUnorm2x16"); + break; + case GLSLstd450PackHalf2x16: + emit_unary_func_op(result_type, id, args[0], "packHalf2x16"); + break; + case GLSLstd450UnpackSnorm4x8: + emit_unary_func_op(result_type, id, args[0], "unpackSnorm4x8"); + break; + case GLSLstd450UnpackUnorm4x8: + emit_unary_func_op(result_type, id, args[0], "unpackUnorm4x8"); + break; + case GLSLstd450UnpackSnorm2x16: + emit_unary_func_op(result_type, id, args[0], "unpackSnorm2x16"); + break; + case GLSLstd450UnpackUnorm2x16: + emit_unary_func_op(result_type, id, args[0], "unpackUnorm2x16"); + break; + case GLSLstd450UnpackHalf2x16: + emit_unary_func_op(result_type, id, args[0], "unpackHalf2x16"); + break; + + case GLSLstd450PackDouble2x32: + emit_unary_func_op(result_type, id, args[0], "packDouble2x32"); + break; + case GLSLstd450UnpackDouble2x32: + emit_unary_func_op(result_type, id, args[0], "unpackDouble2x32"); + break; + + // Vector math + case GLSLstd450Length: + emit_unary_func_op(result_type, id, args[0], "length"); + break; + case GLSLstd450Distance: + emit_binary_func_op(result_type, id, args[0], args[1], "distance"); + break; + case GLSLstd450Cross: + emit_binary_func_op(result_type, id, args[0], args[1], "cross"); + break; + case GLSLstd450Normalize: + emit_unary_func_op(result_type, id, args[0], "normalize"); + break; + case GLSLstd450FaceForward: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "faceforward"); + break; + case GLSLstd450Reflect: + emit_binary_func_op(result_type, id, args[0], args[1], "reflect"); + break; + case GLSLstd450Refract: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "refract"); + break; + + // Bit-fiddling + case GLSLstd450FindILsb: + // findLSB always returns int. + emit_unary_func_op_cast(result_type, id, args[0], "findLSB", expression_type(args[0]).basetype, int_type); + break; + + case GLSLstd450FindSMsb: + emit_unary_func_op_cast(result_type, id, args[0], "findMSB", int_type, int_type); + break; + + case GLSLstd450FindUMsb: + emit_unary_func_op_cast(result_type, id, args[0], "findMSB", uint_type, + int_type); // findMSB always returns int. + break; + + // Multisampled varying + case GLSLstd450InterpolateAtCentroid: + emit_unary_func_op(result_type, id, args[0], "interpolateAtCentroid"); + break; + case GLSLstd450InterpolateAtSample: + emit_binary_func_op(result_type, id, args[0], args[1], "interpolateAtSample"); + break; + case GLSLstd450InterpolateAtOffset: + emit_binary_func_op(result_type, id, args[0], args[1], "interpolateAtOffset"); + break; + + case GLSLstd450NMin: + case GLSLstd450NMax: + { + emit_nminmax_op(result_type, id, args[0], args[1], op); + break; + } + + case GLSLstd450NClamp: + { + // Make sure we have a unique ID here to avoid aliasing the extra sub-expressions between clamp and NMin sub-op. + // IDs cannot exceed 24 bits, so we can make use of the higher bits for some unique flags. + uint32_t &max_id = extra_sub_expressions[id | EXTRA_SUB_EXPRESSION_TYPE_AUX]; + if (!max_id) + max_id = ir.increase_bound_by(1); + + // Inherit precision qualifiers. + ir.meta[max_id] = ir.meta[id]; + + emit_nminmax_op(result_type, max_id, args[0], args[1], GLSLstd450NMax); + emit_nminmax_op(result_type, id, max_id, args[2], GLSLstd450NMin); + break; + } + + default: + statement("// unimplemented GLSL op ", eop); + break; + } +} + +void CompilerGLSL::emit_nminmax_op(uint32_t result_type, uint32_t id, uint32_t op0, uint32_t op1, GLSLstd450 op) +{ + // Need to emulate this call. + uint32_t &ids = extra_sub_expressions[id]; + if (!ids) + { + ids = ir.increase_bound_by(5); + auto btype = get(result_type); + btype.basetype = SPIRType::Boolean; + set(ids, btype); + } + + uint32_t btype_id = ids + 0; + uint32_t left_nan_id = ids + 1; + uint32_t right_nan_id = ids + 2; + uint32_t tmp_id = ids + 3; + uint32_t mixed_first_id = ids + 4; + + // Inherit precision qualifiers. + ir.meta[tmp_id] = ir.meta[id]; + ir.meta[mixed_first_id] = ir.meta[id]; + + if (!is_legacy()) + { + emit_unary_func_op(btype_id, left_nan_id, op0, "isnan"); + emit_unary_func_op(btype_id, right_nan_id, op1, "isnan"); + } + else if (expression_type(op0).vecsize > 1) + { + // If the number doesn't equal itself, it must be NaN + emit_binary_func_op(btype_id, left_nan_id, op0, op0, "notEqual"); + emit_binary_func_op(btype_id, right_nan_id, op1, op1, "notEqual"); + } + else + { + emit_binary_op(btype_id, left_nan_id, op0, op0, "!="); + emit_binary_op(btype_id, right_nan_id, op1, op1, "!="); + } + emit_binary_func_op(result_type, tmp_id, op0, op1, op == GLSLstd450NMin ? "min" : "max"); + emit_mix_op(result_type, mixed_first_id, tmp_id, op1, left_nan_id); + emit_mix_op(result_type, id, mixed_first_id, op0, right_nan_id); +} + +void CompilerGLSL::emit_emulated_ahyper_op(uint32_t result_type, uint32_t id, uint32_t op0, GLSLstd450 op) +{ + const char *one = backend.float_literal_suffix ? "1.0f" : "1.0"; + std::string expr; + bool forward = should_forward(op0); + + switch (op) + { + case GLSLstd450Asinh: + expr = join("log(", to_enclosed_expression(op0), " + sqrt(", + to_enclosed_expression(op0), " * ", to_enclosed_expression(op0), " + ", one, "))"); + emit_op(result_type, id, expr, forward); + break; + + case GLSLstd450Acosh: + expr = join("log(", to_enclosed_expression(op0), " + sqrt(", + to_enclosed_expression(op0), " * ", to_enclosed_expression(op0), " - ", one, "))"); + break; + + case GLSLstd450Atanh: + expr = join("log((", one, " + ", to_enclosed_expression(op0), ") / " + "(", one, " - ", to_enclosed_expression(op0), ")) * 0.5", + backend.float_literal_suffix ? "f" : ""); + break; + + default: + SPIRV_CROSS_THROW("Invalid op."); + } + + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, op0); +} + +void CompilerGLSL::emit_spv_amd_shader_ballot_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, + uint32_t) +{ + require_extension_internal("GL_AMD_shader_ballot"); + + enum AMDShaderBallot + { + SwizzleInvocationsAMD = 1, + SwizzleInvocationsMaskedAMD = 2, + WriteInvocationAMD = 3, + MbcntAMD = 4 + }; + + auto op = static_cast(eop); + + switch (op) + { + case SwizzleInvocationsAMD: + emit_binary_func_op(result_type, id, args[0], args[1], "swizzleInvocationsAMD"); + register_control_dependent_expression(id); + break; + + case SwizzleInvocationsMaskedAMD: + emit_binary_func_op(result_type, id, args[0], args[1], "swizzleInvocationsMaskedAMD"); + register_control_dependent_expression(id); + break; + + case WriteInvocationAMD: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "writeInvocationAMD"); + register_control_dependent_expression(id); + break; + + case MbcntAMD: + emit_unary_func_op(result_type, id, args[0], "mbcntAMD"); + register_control_dependent_expression(id); + break; + + default: + statement("// unimplemented SPV AMD shader ballot op ", eop); + break; + } +} + +void CompilerGLSL::emit_spv_amd_shader_explicit_vertex_parameter_op(uint32_t result_type, uint32_t id, uint32_t eop, + const uint32_t *args, uint32_t) +{ + require_extension_internal("GL_AMD_shader_explicit_vertex_parameter"); + + enum AMDShaderExplicitVertexParameter + { + InterpolateAtVertexAMD = 1 + }; + + auto op = static_cast(eop); + + switch (op) + { + case InterpolateAtVertexAMD: + emit_binary_func_op(result_type, id, args[0], args[1], "interpolateAtVertexAMD"); + break; + + default: + statement("// unimplemented SPV AMD shader explicit vertex parameter op ", eop); + break; + } +} + +void CompilerGLSL::emit_spv_amd_shader_trinary_minmax_op(uint32_t result_type, uint32_t id, uint32_t eop, + const uint32_t *args, uint32_t) +{ + require_extension_internal("GL_AMD_shader_trinary_minmax"); + + enum AMDShaderTrinaryMinMax + { + FMin3AMD = 1, + UMin3AMD = 2, + SMin3AMD = 3, + FMax3AMD = 4, + UMax3AMD = 5, + SMax3AMD = 6, + FMid3AMD = 7, + UMid3AMD = 8, + SMid3AMD = 9 + }; + + auto op = static_cast(eop); + + switch (op) + { + case FMin3AMD: + case UMin3AMD: + case SMin3AMD: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "min3"); + break; + + case FMax3AMD: + case UMax3AMD: + case SMax3AMD: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "max3"); + break; + + case FMid3AMD: + case UMid3AMD: + case SMid3AMD: + emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "mid3"); + break; + + default: + statement("// unimplemented SPV AMD shader trinary minmax op ", eop); + break; + } +} + +void CompilerGLSL::emit_spv_amd_gcn_shader_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, + uint32_t) +{ + require_extension_internal("GL_AMD_gcn_shader"); + + enum AMDGCNShader + { + CubeFaceIndexAMD = 1, + CubeFaceCoordAMD = 2, + TimeAMD = 3 + }; + + auto op = static_cast(eop); + + switch (op) + { + case CubeFaceIndexAMD: + emit_unary_func_op(result_type, id, args[0], "cubeFaceIndexAMD"); + break; + case CubeFaceCoordAMD: + emit_unary_func_op(result_type, id, args[0], "cubeFaceCoordAMD"); + break; + case TimeAMD: + { + string expr = "timeAMD()"; + emit_op(result_type, id, expr, true); + register_control_dependent_expression(id); + break; + } + + default: + statement("// unimplemented SPV AMD gcn shader op ", eop); + break; + } +} + +void CompilerGLSL::emit_subgroup_op(const Instruction &i) +{ + const uint32_t *ops = stream(i); + auto op = static_cast(i.op); + + if (!options.vulkan_semantics && !is_supported_subgroup_op_in_opengl(op, ops)) + SPIRV_CROSS_THROW("This subgroup operation is only supported in Vulkan semantics."); + + // If we need to do implicit bitcasts, make sure we do it with the correct type. + uint32_t integer_width = get_integer_width_for_instruction(i); + auto int_type = to_signed_basetype(integer_width); + auto uint_type = to_unsigned_basetype(integer_width); + + switch (op) + { + case OpGroupNonUniformElect: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupElect); + break; + + case OpGroupNonUniformBallotBitCount: + { + const GroupOperation operation = static_cast(ops[3]); + if (operation == GroupOperationReduce) + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBallotBitCount); + else if (operation == GroupOperationInclusiveScan || operation == GroupOperationExclusiveScan) + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupInverseBallot_InclBitCount_ExclBitCout); + } + break; + + case OpGroupNonUniformBallotBitExtract: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBallotBitExtract); + break; + + case OpGroupNonUniformInverseBallot: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupInverseBallot_InclBitCount_ExclBitCout); + break; + + case OpGroupNonUniformBallot: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBallot); + break; + + case OpGroupNonUniformBallotFindLSB: + case OpGroupNonUniformBallotFindMSB: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBallotFindLSB_MSB); + break; + + case OpGroupNonUniformBroadcast: + case OpGroupNonUniformBroadcastFirst: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBroadcast_First); + break; + + case OpGroupNonUniformShuffle: + case OpGroupNonUniformShuffleXor: + require_extension_internal("GL_KHR_shader_subgroup_shuffle"); + break; + + case OpGroupNonUniformShuffleUp: + case OpGroupNonUniformShuffleDown: + require_extension_internal("GL_KHR_shader_subgroup_shuffle_relative"); + break; + + case OpGroupNonUniformAll: + case OpGroupNonUniformAny: + case OpGroupNonUniformAllEqual: + { + const SPIRType &type = expression_type(ops[3]); + if (type.basetype == SPIRType::BaseType::Boolean && type.vecsize == 1u) + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupAll_Any_AllEqualBool); + else + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupAllEqualT); + } + break; + + // clang-format off +#define GLSL_GROUP_OP(OP)\ + case OpGroupNonUniform##OP:\ + {\ + auto operation = static_cast(ops[3]);\ + if (operation == GroupOperationClusteredReduce)\ + require_extension_internal("GL_KHR_shader_subgroup_clustered");\ + else if (operation == GroupOperationReduce)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##Reduce);\ + else if (operation == GroupOperationExclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##ExclusiveScan);\ + else if (operation == GroupOperationInclusiveScan)\ + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupArithmetic##OP##InclusiveScan);\ + else\ + SPIRV_CROSS_THROW("Invalid group operation.");\ + break;\ + } + + GLSL_GROUP_OP(IAdd) + GLSL_GROUP_OP(FAdd) + GLSL_GROUP_OP(IMul) + GLSL_GROUP_OP(FMul) + +#undef GLSL_GROUP_OP + // clang-format on + + case OpGroupNonUniformFMin: + case OpGroupNonUniformFMax: + case OpGroupNonUniformSMin: + case OpGroupNonUniformSMax: + case OpGroupNonUniformUMin: + case OpGroupNonUniformUMax: + case OpGroupNonUniformBitwiseAnd: + case OpGroupNonUniformBitwiseOr: + case OpGroupNonUniformBitwiseXor: + case OpGroupNonUniformLogicalAnd: + case OpGroupNonUniformLogicalOr: + case OpGroupNonUniformLogicalXor: + { + auto operation = static_cast(ops[3]); + if (operation == GroupOperationClusteredReduce) + { + require_extension_internal("GL_KHR_shader_subgroup_clustered"); + } + else if (operation == GroupOperationExclusiveScan || operation == GroupOperationInclusiveScan || + operation == GroupOperationReduce) + { + require_extension_internal("GL_KHR_shader_subgroup_arithmetic"); + } + else + SPIRV_CROSS_THROW("Invalid group operation."); + break; + } + + case OpGroupNonUniformQuadSwap: + case OpGroupNonUniformQuadBroadcast: + require_extension_internal("GL_KHR_shader_subgroup_quad"); + break; + + default: + SPIRV_CROSS_THROW("Invalid opcode for subgroup."); + } + + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + auto scope = static_cast(evaluate_constant_u32(ops[2])); + if (scope != ScopeSubgroup) + SPIRV_CROSS_THROW("Only subgroup scope is supported."); + + switch (op) + { + case OpGroupNonUniformElect: + emit_op(result_type, id, "subgroupElect()", true); + break; + + case OpGroupNonUniformBroadcast: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupBroadcast"); + break; + + case OpGroupNonUniformBroadcastFirst: + emit_unary_func_op(result_type, id, ops[3], "subgroupBroadcastFirst"); + break; + + case OpGroupNonUniformBallot: + emit_unary_func_op(result_type, id, ops[3], "subgroupBallot"); + break; + + case OpGroupNonUniformInverseBallot: + emit_unary_func_op(result_type, id, ops[3], "subgroupInverseBallot"); + break; + + case OpGroupNonUniformBallotBitExtract: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupBallotBitExtract"); + break; + + case OpGroupNonUniformBallotFindLSB: + emit_unary_func_op(result_type, id, ops[3], "subgroupBallotFindLSB"); + break; + + case OpGroupNonUniformBallotFindMSB: + emit_unary_func_op(result_type, id, ops[3], "subgroupBallotFindMSB"); + break; + + case OpGroupNonUniformBallotBitCount: + { + auto operation = static_cast(ops[3]); + if (operation == GroupOperationReduce) + emit_unary_func_op(result_type, id, ops[4], "subgroupBallotBitCount"); + else if (operation == GroupOperationInclusiveScan) + emit_unary_func_op(result_type, id, ops[4], "subgroupBallotInclusiveBitCount"); + else if (operation == GroupOperationExclusiveScan) + emit_unary_func_op(result_type, id, ops[4], "subgroupBallotExclusiveBitCount"); + else + SPIRV_CROSS_THROW("Invalid BitCount operation."); + break; + } + + case OpGroupNonUniformShuffle: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupShuffle"); + break; + + case OpGroupNonUniformShuffleXor: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupShuffleXor"); + break; + + case OpGroupNonUniformShuffleUp: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupShuffleUp"); + break; + + case OpGroupNonUniformShuffleDown: + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupShuffleDown"); + break; + + case OpGroupNonUniformAll: + emit_unary_func_op(result_type, id, ops[3], "subgroupAll"); + break; + + case OpGroupNonUniformAny: + emit_unary_func_op(result_type, id, ops[3], "subgroupAny"); + break; + + case OpGroupNonUniformAllEqual: + emit_unary_func_op(result_type, id, ops[3], "subgroupAllEqual"); + break; + + // clang-format off +#define GLSL_GROUP_OP(op, glsl_op) \ +case OpGroupNonUniform##op: \ + { \ + auto operation = static_cast(ops[3]); \ + if (operation == GroupOperationReduce) \ + emit_unary_func_op(result_type, id, ops[4], "subgroup" #glsl_op); \ + else if (operation == GroupOperationInclusiveScan) \ + emit_unary_func_op(result_type, id, ops[4], "subgroupInclusive" #glsl_op); \ + else if (operation == GroupOperationExclusiveScan) \ + emit_unary_func_op(result_type, id, ops[4], "subgroupExclusive" #glsl_op); \ + else if (operation == GroupOperationClusteredReduce) \ + emit_binary_func_op(result_type, id, ops[4], ops[5], "subgroupClustered" #glsl_op); \ + else \ + SPIRV_CROSS_THROW("Invalid group operation."); \ + break; \ + } + +#define GLSL_GROUP_OP_CAST(op, glsl_op, type) \ +case OpGroupNonUniform##op: \ + { \ + auto operation = static_cast(ops[3]); \ + if (operation == GroupOperationReduce) \ + emit_unary_func_op_cast(result_type, id, ops[4], "subgroup" #glsl_op, type, type); \ + else if (operation == GroupOperationInclusiveScan) \ + emit_unary_func_op_cast(result_type, id, ops[4], "subgroupInclusive" #glsl_op, type, type); \ + else if (operation == GroupOperationExclusiveScan) \ + emit_unary_func_op_cast(result_type, id, ops[4], "subgroupExclusive" #glsl_op, type, type); \ + else if (operation == GroupOperationClusteredReduce) \ + emit_binary_func_op_cast_clustered(result_type, id, ops[4], ops[5], "subgroupClustered" #glsl_op, type); \ + else \ + SPIRV_CROSS_THROW("Invalid group operation."); \ + break; \ + } + + GLSL_GROUP_OP(FAdd, Add) + GLSL_GROUP_OP(FMul, Mul) + GLSL_GROUP_OP(FMin, Min) + GLSL_GROUP_OP(FMax, Max) + GLSL_GROUP_OP(IAdd, Add) + GLSL_GROUP_OP(IMul, Mul) + GLSL_GROUP_OP_CAST(SMin, Min, int_type) + GLSL_GROUP_OP_CAST(SMax, Max, int_type) + GLSL_GROUP_OP_CAST(UMin, Min, uint_type) + GLSL_GROUP_OP_CAST(UMax, Max, uint_type) + GLSL_GROUP_OP(BitwiseAnd, And) + GLSL_GROUP_OP(BitwiseOr, Or) + GLSL_GROUP_OP(BitwiseXor, Xor) + GLSL_GROUP_OP(LogicalAnd, And) + GLSL_GROUP_OP(LogicalOr, Or) + GLSL_GROUP_OP(LogicalXor, Xor) +#undef GLSL_GROUP_OP +#undef GLSL_GROUP_OP_CAST + // clang-format on + + case OpGroupNonUniformQuadSwap: + { + uint32_t direction = evaluate_constant_u32(ops[4]); + if (direction == 0) + emit_unary_func_op(result_type, id, ops[3], "subgroupQuadSwapHorizontal"); + else if (direction == 1) + emit_unary_func_op(result_type, id, ops[3], "subgroupQuadSwapVertical"); + else if (direction == 2) + emit_unary_func_op(result_type, id, ops[3], "subgroupQuadSwapDiagonal"); + else + SPIRV_CROSS_THROW("Invalid quad swap direction."); + break; + } + + case OpGroupNonUniformQuadBroadcast: + { + emit_binary_func_op(result_type, id, ops[3], ops[4], "subgroupQuadBroadcast"); + break; + } + + default: + SPIRV_CROSS_THROW("Invalid opcode for subgroup."); + } + + register_control_dependent_expression(id); +} + +string CompilerGLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &in_type) +{ + // OpBitcast can deal with pointers. + if (out_type.pointer || in_type.pointer) + { + if (out_type.vecsize == 2 || in_type.vecsize == 2) + require_extension_internal("GL_EXT_buffer_reference_uvec2"); + return type_to_glsl(out_type); + } + + if (out_type.basetype == in_type.basetype) + return ""; + + assert(out_type.basetype != SPIRType::Boolean); + assert(in_type.basetype != SPIRType::Boolean); + + bool integral_cast = type_is_integral(out_type) && type_is_integral(in_type); + bool same_size_cast = out_type.width == in_type.width; + + // Trivial bitcast case, casts between integers. + if (integral_cast && same_size_cast) + return type_to_glsl(out_type); + + // Catch-all 8-bit arithmetic casts (GL_EXT_shader_explicit_arithmetic_types). + if (out_type.width == 8 && in_type.width >= 16 && integral_cast && in_type.vecsize == 1) + return "unpack8"; + else if (in_type.width == 8 && out_type.width == 16 && integral_cast && out_type.vecsize == 1) + return "pack16"; + else if (in_type.width == 8 && out_type.width == 32 && integral_cast && out_type.vecsize == 1) + return "pack32"; + + // Floating <-> Integer special casts. Just have to enumerate all cases. :( + // 16-bit, 32-bit and 64-bit floats. + if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Float) + { + if (is_legacy_es()) + SPIRV_CROSS_THROW("Float -> Uint bitcast not supported on legacy ESSL."); + else if (!options.es && options.version < 330) + require_extension_internal("GL_ARB_shader_bit_encoding"); + return "floatBitsToUint"; + } + else if (out_type.basetype == SPIRType::Int && in_type.basetype == SPIRType::Float) + { + if (is_legacy_es()) + SPIRV_CROSS_THROW("Float -> Int bitcast not supported on legacy ESSL."); + else if (!options.es && options.version < 330) + require_extension_internal("GL_ARB_shader_bit_encoding"); + return "floatBitsToInt"; + } + else if (out_type.basetype == SPIRType::Float && in_type.basetype == SPIRType::UInt) + { + if (is_legacy_es()) + SPIRV_CROSS_THROW("Uint -> Float bitcast not supported on legacy ESSL."); + else if (!options.es && options.version < 330) + require_extension_internal("GL_ARB_shader_bit_encoding"); + return "uintBitsToFloat"; + } + else if (out_type.basetype == SPIRType::Float && in_type.basetype == SPIRType::Int) + { + if (is_legacy_es()) + SPIRV_CROSS_THROW("Int -> Float bitcast not supported on legacy ESSL."); + else if (!options.es && options.version < 330) + require_extension_internal("GL_ARB_shader_bit_encoding"); + return "intBitsToFloat"; + } + + else if (out_type.basetype == SPIRType::Int64 && in_type.basetype == SPIRType::Double) + return "doubleBitsToInt64"; + else if (out_type.basetype == SPIRType::UInt64 && in_type.basetype == SPIRType::Double) + return "doubleBitsToUint64"; + else if (out_type.basetype == SPIRType::Double && in_type.basetype == SPIRType::Int64) + return "int64BitsToDouble"; + else if (out_type.basetype == SPIRType::Double && in_type.basetype == SPIRType::UInt64) + return "uint64BitsToDouble"; + else if (out_type.basetype == SPIRType::Short && in_type.basetype == SPIRType::Half) + return "float16BitsToInt16"; + else if (out_type.basetype == SPIRType::UShort && in_type.basetype == SPIRType::Half) + return "float16BitsToUint16"; + else if (out_type.basetype == SPIRType::Half && in_type.basetype == SPIRType::Short) + return "int16BitsToFloat16"; + else if (out_type.basetype == SPIRType::Half && in_type.basetype == SPIRType::UShort) + return "uint16BitsToFloat16"; + + // And finally, some even more special purpose casts. + if (out_type.basetype == SPIRType::UInt64 && in_type.basetype == SPIRType::UInt && in_type.vecsize == 2) + return "packUint2x32"; + else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::UInt64 && out_type.vecsize == 2) + return "unpackUint2x32"; + else if (out_type.basetype == SPIRType::Half && in_type.basetype == SPIRType::UInt && in_type.vecsize == 1) + return "unpackFloat2x16"; + else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Half && in_type.vecsize == 2) + return "packFloat2x16"; + else if (out_type.basetype == SPIRType::Int && in_type.basetype == SPIRType::Short && in_type.vecsize == 2) + return "packInt2x16"; + else if (out_type.basetype == SPIRType::Short && in_type.basetype == SPIRType::Int && in_type.vecsize == 1) + return "unpackInt2x16"; + else if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::UShort && in_type.vecsize == 2) + return "packUint2x16"; + else if (out_type.basetype == SPIRType::UShort && in_type.basetype == SPIRType::UInt && in_type.vecsize == 1) + return "unpackUint2x16"; + else if (out_type.basetype == SPIRType::Int64 && in_type.basetype == SPIRType::Short && in_type.vecsize == 4) + return "packInt4x16"; + else if (out_type.basetype == SPIRType::Short && in_type.basetype == SPIRType::Int64 && in_type.vecsize == 1) + return "unpackInt4x16"; + else if (out_type.basetype == SPIRType::UInt64 && in_type.basetype == SPIRType::UShort && in_type.vecsize == 4) + return "packUint4x16"; + else if (out_type.basetype == SPIRType::UShort && in_type.basetype == SPIRType::UInt64 && in_type.vecsize == 1) + return "unpackUint4x16"; + + return ""; +} + +string CompilerGLSL::bitcast_glsl(const SPIRType &result_type, uint32_t argument) +{ + auto op = bitcast_glsl_op(result_type, expression_type(argument)); + if (op.empty()) + return to_enclosed_unpacked_expression(argument); + else + return join(op, "(", to_unpacked_expression(argument), ")"); +} + +std::string CompilerGLSL::bitcast_expression(SPIRType::BaseType target_type, uint32_t arg) +{ + auto expr = to_expression(arg); + auto &src_type = expression_type(arg); + if (src_type.basetype != target_type) + { + auto target = src_type; + target.basetype = target_type; + expr = join(bitcast_glsl_op(target, src_type), "(", expr, ")"); + } + + return expr; +} + +std::string CompilerGLSL::bitcast_expression(const SPIRType &target_type, SPIRType::BaseType expr_type, + const std::string &expr) +{ + if (target_type.basetype == expr_type) + return expr; + + auto src_type = target_type; + src_type.basetype = expr_type; + return join(bitcast_glsl_op(target_type, src_type), "(", expr, ")"); +} + +string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage) +{ + switch (builtin) + { + case BuiltInPosition: + return "gl_Position"; + case BuiltInPointSize: + return "gl_PointSize"; + case BuiltInClipDistance: + { + if (options.es) + require_extension_internal("GL_EXT_clip_cull_distance"); + return "gl_ClipDistance"; + } + case BuiltInCullDistance: + { + if (options.es) + require_extension_internal("GL_EXT_clip_cull_distance"); + return "gl_CullDistance"; + } + case BuiltInVertexId: + if (options.vulkan_semantics) + SPIRV_CROSS_THROW("Cannot implement gl_VertexID in Vulkan GLSL. This shader was created " + "with GL semantics."); + return "gl_VertexID"; + case BuiltInInstanceId: + if (options.vulkan_semantics) + { + auto model = get_entry_point().model; + switch (model) + { + case spv::ExecutionModelIntersectionKHR: + case spv::ExecutionModelAnyHitKHR: + case spv::ExecutionModelClosestHitKHR: + // gl_InstanceID is allowed in these shaders. + break; + + default: + SPIRV_CROSS_THROW("Cannot implement gl_InstanceID in Vulkan GLSL. This shader was " + "created with GL semantics."); + } + } + if (!options.es && options.version < 140) + { + require_extension_internal("GL_ARB_draw_instanced"); + } + return "gl_InstanceID"; + case BuiltInVertexIndex: + if (options.vulkan_semantics) + return "gl_VertexIndex"; + else + return "gl_VertexID"; // gl_VertexID already has the base offset applied. + case BuiltInInstanceIndex: + if (options.vulkan_semantics) + return "gl_InstanceIndex"; + + if (!options.es && options.version < 140) + { + require_extension_internal("GL_ARB_draw_instanced"); + } + + if (options.vertex.support_nonzero_base_instance) + { + if (!options.vulkan_semantics) + { + // This is a soft-enable. We will opt-in to using gl_BaseInstanceARB if supported. + require_extension_internal("GL_ARB_shader_draw_parameters"); + } + return "(gl_InstanceID + SPIRV_Cross_BaseInstance)"; // ... but not gl_InstanceID. + } + else + return "gl_InstanceID"; + case BuiltInPrimitiveId: + if (storage == StorageClassInput && get_entry_point().model == ExecutionModelGeometry) + return "gl_PrimitiveIDIn"; + else + return "gl_PrimitiveID"; + case BuiltInInvocationId: + return "gl_InvocationID"; + case BuiltInLayer: + return "gl_Layer"; + case BuiltInViewportIndex: + return "gl_ViewportIndex"; + case BuiltInTessLevelOuter: + return "gl_TessLevelOuter"; + case BuiltInTessLevelInner: + return "gl_TessLevelInner"; + case BuiltInTessCoord: + return "gl_TessCoord"; + case BuiltInFragCoord: + return "gl_FragCoord"; + case BuiltInPointCoord: + return "gl_PointCoord"; + case BuiltInFrontFacing: + return "gl_FrontFacing"; + case BuiltInFragDepth: + return "gl_FragDepth"; + case BuiltInNumWorkgroups: + return "gl_NumWorkGroups"; + case BuiltInWorkgroupSize: + return "gl_WorkGroupSize"; + case BuiltInWorkgroupId: + return "gl_WorkGroupID"; + case BuiltInLocalInvocationId: + return "gl_LocalInvocationID"; + case BuiltInGlobalInvocationId: + return "gl_GlobalInvocationID"; + case BuiltInLocalInvocationIndex: + return "gl_LocalInvocationIndex"; + case BuiltInHelperInvocation: + return "gl_HelperInvocation"; + + case BuiltInBaseVertex: + if (options.es) + SPIRV_CROSS_THROW("BaseVertex not supported in ES profile."); + + if (options.vulkan_semantics) + { + if (options.version < 460) + { + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "gl_BaseVertexARB"; + } + return "gl_BaseVertex"; + } + // On regular GL, this is soft-enabled and we emit ifdefs in code. + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "SPIRV_Cross_BaseVertex"; + + case BuiltInBaseInstance: + if (options.es) + SPIRV_CROSS_THROW("BaseInstance not supported in ES profile."); + + if (options.vulkan_semantics) + { + if (options.version < 460) + { + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "gl_BaseInstanceARB"; + } + return "gl_BaseInstance"; + } + // On regular GL, this is soft-enabled and we emit ifdefs in code. + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "SPIRV_Cross_BaseInstance"; + + case BuiltInDrawIndex: + if (options.es) + SPIRV_CROSS_THROW("DrawIndex not supported in ES profile."); + + if (options.vulkan_semantics) + { + if (options.version < 460) + { + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "gl_DrawIDARB"; + } + return "gl_DrawID"; + } + // On regular GL, this is soft-enabled and we emit ifdefs in code. + require_extension_internal("GL_ARB_shader_draw_parameters"); + return "gl_DrawIDARB"; + + case BuiltInSampleId: + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) + require_extension_internal("GL_OES_sample_variables"); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); + return "gl_SampleID"; + + case BuiltInSampleMask: + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) + require_extension_internal("GL_OES_sample_variables"); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); + + if (storage == StorageClassInput) + return "gl_SampleMaskIn"; + else + return "gl_SampleMask"; + + case BuiltInSamplePosition: + if (is_legacy()) + SPIRV_CROSS_THROW("Sample variables not supported in legacy GLSL."); + else if (options.es && options.version < 320) + require_extension_internal("GL_OES_sample_variables"); + else if (!options.es && options.version < 400) + require_extension_internal("GL_ARB_sample_shading"); + return "gl_SamplePosition"; + + case BuiltInViewIndex: + if (options.vulkan_semantics) + return "gl_ViewIndex"; + else + return "gl_ViewID_OVR"; + + case BuiltInNumSubgroups: + request_subgroup_feature(ShaderSubgroupSupportHelper::NumSubgroups); + return "gl_NumSubgroups"; + + case BuiltInSubgroupId: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupID); + return "gl_SubgroupID"; + + case BuiltInSubgroupSize: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupSize); + return "gl_SubgroupSize"; + + case BuiltInSubgroupLocalInvocationId: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupInvocationID); + return "gl_SubgroupInvocationID"; + + case BuiltInSubgroupEqMask: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); + return "gl_SubgroupEqMask"; + + case BuiltInSubgroupGeMask: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); + return "gl_SubgroupGeMask"; + + case BuiltInSubgroupGtMask: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); + return "gl_SubgroupGtMask"; + + case BuiltInSubgroupLeMask: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); + return "gl_SubgroupLeMask"; + + case BuiltInSubgroupLtMask: + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMask); + return "gl_SubgroupLtMask"; + + case BuiltInLaunchIdKHR: + return ray_tracing_is_khr ? "gl_LaunchIDEXT" : "gl_LaunchIDNV"; + case BuiltInLaunchSizeKHR: + return ray_tracing_is_khr ? "gl_LaunchSizeEXT" : "gl_LaunchSizeNV"; + case BuiltInWorldRayOriginKHR: + return ray_tracing_is_khr ? "gl_WorldRayOriginEXT" : "gl_WorldRayOriginNV"; + case BuiltInWorldRayDirectionKHR: + return ray_tracing_is_khr ? "gl_WorldRayDirectionEXT" : "gl_WorldRayDirectionNV"; + case BuiltInObjectRayOriginKHR: + return ray_tracing_is_khr ? "gl_ObjectRayOriginEXT" : "gl_ObjectRayOriginNV"; + case BuiltInObjectRayDirectionKHR: + return ray_tracing_is_khr ? "gl_ObjectRayDirectionEXT" : "gl_ObjectRayDirectionNV"; + case BuiltInRayTminKHR: + return ray_tracing_is_khr ? "gl_RayTminEXT" : "gl_RayTminNV"; + case BuiltInRayTmaxKHR: + return ray_tracing_is_khr ? "gl_RayTmaxEXT" : "gl_RayTmaxNV"; + case BuiltInInstanceCustomIndexKHR: + return ray_tracing_is_khr ? "gl_InstanceCustomIndexEXT" : "gl_InstanceCustomIndexNV"; + case BuiltInObjectToWorldKHR: + return ray_tracing_is_khr ? "gl_ObjectToWorldEXT" : "gl_ObjectToWorldNV"; + case BuiltInWorldToObjectKHR: + return ray_tracing_is_khr ? "gl_WorldToObjectEXT" : "gl_WorldToObjectNV"; + case BuiltInHitTNV: + // gl_HitTEXT is an alias of RayTMax in KHR. + return "gl_HitTNV"; + case BuiltInHitKindKHR: + return ray_tracing_is_khr ? "gl_HitKindEXT" : "gl_HitKindNV"; + case BuiltInIncomingRayFlagsKHR: + return ray_tracing_is_khr ? "gl_IncomingRayFlagsEXT" : "gl_IncomingRayFlagsNV"; + + case BuiltInBaryCoordKHR: + { + if (options.es && options.version < 320) + SPIRV_CROSS_THROW("gl_BaryCoordEXT requires ESSL 320."); + else if (!options.es && options.version < 450) + SPIRV_CROSS_THROW("gl_BaryCoordEXT requires GLSL 450."); + + if (barycentric_is_nv) + { + require_extension_internal("GL_NV_fragment_shader_barycentric"); + return "gl_BaryCoordNV"; + } + else + { + require_extension_internal("GL_EXT_fragment_shader_barycentric"); + return "gl_BaryCoordEXT"; + } + } + + case BuiltInBaryCoordNoPerspNV: + { + if (options.es && options.version < 320) + SPIRV_CROSS_THROW("gl_BaryCoordNoPerspEXT requires ESSL 320."); + else if (!options.es && options.version < 450) + SPIRV_CROSS_THROW("gl_BaryCoordNoPerspEXT requires GLSL 450."); + + if (barycentric_is_nv) + { + require_extension_internal("GL_NV_fragment_shader_barycentric"); + return "gl_BaryCoordNoPerspNV"; + } + else + { + require_extension_internal("GL_EXT_fragment_shader_barycentric"); + return "gl_BaryCoordNoPerspEXT"; + } + } + + case BuiltInFragStencilRefEXT: + { + if (!options.es) + { + require_extension_internal("GL_ARB_shader_stencil_export"); + return "gl_FragStencilRefARB"; + } + else + SPIRV_CROSS_THROW("Stencil export not supported in GLES."); + } + + case BuiltInPrimitiveShadingRateKHR: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Can only use PrimitiveShadingRateKHR in Vulkan GLSL."); + require_extension_internal("GL_EXT_fragment_shading_rate"); + return "gl_PrimitiveShadingRateEXT"; + } + + case BuiltInShadingRateKHR: + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Can only use ShadingRateKHR in Vulkan GLSL."); + require_extension_internal("GL_EXT_fragment_shading_rate"); + return "gl_ShadingRateEXT"; + } + + case BuiltInDeviceIndex: + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Need Vulkan semantics for device group support."); + require_extension_internal("GL_EXT_device_group"); + return "gl_DeviceIndex"; + + case BuiltInFullyCoveredEXT: + if (!options.es) + require_extension_internal("GL_NV_conservative_raster_underestimation"); + else + SPIRV_CROSS_THROW("Need desktop GL to use GL_NV_conservative_raster_underestimation."); + return "gl_FragFullyCoveredNV"; + + case BuiltInPrimitiveTriangleIndicesEXT: + return "gl_PrimitiveTriangleIndicesEXT"; + case BuiltInPrimitiveLineIndicesEXT: + return "gl_PrimitiveLineIndicesEXT"; + case BuiltInPrimitivePointIndicesEXT: + return "gl_PrimitivePointIndicesEXT"; + case BuiltInCullPrimitiveEXT: + return "gl_CullPrimitiveEXT"; + + default: + return join("gl_BuiltIn_", convert_to_string(builtin)); + } +} + +const char *CompilerGLSL::index_to_swizzle(uint32_t index) +{ + switch (index) + { + case 0: + return "x"; + case 1: + return "y"; + case 2: + return "z"; + case 3: + return "w"; + default: + return "x"; // Don't crash, but engage the "undefined behavior" described for out-of-bounds logical addressing in spec. + } +} + +void CompilerGLSL::access_chain_internal_append_index(std::string &expr, uint32_t /*base*/, const SPIRType * /*type*/, + AccessChainFlags flags, bool &access_chain_is_arrayed, + uint32_t index) +{ + bool index_is_literal = (flags & ACCESS_CHAIN_INDEX_IS_LITERAL_BIT) != 0; + bool ptr_chain = (flags & ACCESS_CHAIN_PTR_CHAIN_BIT) != 0; + bool register_expression_read = (flags & ACCESS_CHAIN_SKIP_REGISTER_EXPRESSION_READ_BIT) == 0; + + string idx_expr = index_is_literal ? convert_to_string(index) : to_unpacked_expression(index, register_expression_read); + + // For the case where the base of an OpPtrAccessChain already ends in [n], + // we need to use the index as an offset to the existing index, otherwise, + // we can just use the index directly. + if (ptr_chain && access_chain_is_arrayed) + { + size_t split_pos = expr.find_last_of(']'); + string expr_front = expr.substr(0, split_pos); + string expr_back = expr.substr(split_pos); + expr = expr_front + " + " + enclose_expression(idx_expr) + expr_back; + } + else + { + expr += "["; + expr += idx_expr; + expr += "]"; + } +} + +bool CompilerGLSL::access_chain_needs_stage_io_builtin_translation(uint32_t) +{ + return true; +} + +string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indices, uint32_t count, + AccessChainFlags flags, AccessChainMeta *meta) +{ + string expr; + + bool index_is_literal = (flags & ACCESS_CHAIN_INDEX_IS_LITERAL_BIT) != 0; + bool msb_is_id = (flags & ACCESS_CHAIN_LITERAL_MSB_FORCE_ID) != 0; + bool chain_only = (flags & ACCESS_CHAIN_CHAIN_ONLY_BIT) != 0; + bool ptr_chain = (flags & ACCESS_CHAIN_PTR_CHAIN_BIT) != 0; + bool register_expression_read = (flags & ACCESS_CHAIN_SKIP_REGISTER_EXPRESSION_READ_BIT) == 0; + bool flatten_member_reference = (flags & ACCESS_CHAIN_FLATTEN_ALL_MEMBERS_BIT) != 0; + + if (!chain_only) + { + // We handle transpose explicitly, so don't resolve that here. + auto *e = maybe_get(base); + bool old_transpose = e && e->need_transpose; + if (e) + e->need_transpose = false; + expr = to_enclosed_expression(base, register_expression_read); + if (e) + e->need_transpose = old_transpose; + } + + // Start traversing type hierarchy at the proper non-pointer types, + // but keep type_id referencing the original pointer for use below. + uint32_t type_id = expression_type_id(base); + + if (!backend.native_pointers) + { + if (ptr_chain) + SPIRV_CROSS_THROW("Backend does not support native pointers and does not support OpPtrAccessChain."); + + // Wrapped buffer reference pointer types will need to poke into the internal "value" member before + // continuing the access chain. + if (should_dereference(base)) + { + auto &type = get(type_id); + expr = dereference_expression(type, expr); + } + } + + const auto *type = &get_pointee_type(type_id); + + bool access_chain_is_arrayed = expr.find_first_of('[') != string::npos; + bool row_major_matrix_needs_conversion = is_non_native_row_major_matrix(base); + bool is_packed = has_extended_decoration(base, SPIRVCrossDecorationPhysicalTypePacked); + uint32_t physical_type = get_extended_decoration(base, SPIRVCrossDecorationPhysicalTypeID); + bool is_invariant = has_decoration(base, DecorationInvariant); + bool relaxed_precision = has_decoration(base, DecorationRelaxedPrecision); + bool pending_array_enclose = false; + bool dimension_flatten = false; + + // If we are translating access to a structured buffer, the first subscript '._m0' must be hidden + bool hide_first_subscript = count > 1 && is_user_type_structured(base); + + const auto append_index = [&](uint32_t index, bool is_literal, bool is_ptr_chain = false) { + AccessChainFlags mod_flags = flags; + if (!is_literal) + mod_flags &= ~ACCESS_CHAIN_INDEX_IS_LITERAL_BIT; + if (!is_ptr_chain) + mod_flags &= ~ACCESS_CHAIN_PTR_CHAIN_BIT; + access_chain_internal_append_index(expr, base, type, mod_flags, access_chain_is_arrayed, index); + check_physical_type_cast(expr, type, physical_type); + }; + + for (uint32_t i = 0; i < count; i++) + { + uint32_t index = indices[i]; + + bool is_literal = index_is_literal; + if (is_literal && msb_is_id && (index >> 31u) != 0u) + { + is_literal = false; + index &= 0x7fffffffu; + } + + // Pointer chains + if (ptr_chain && i == 0) + { + // If we are flattening multidimensional arrays, only create opening bracket on first + // array index. + if (options.flatten_multidimensional_arrays) + { + dimension_flatten = type->array.size() >= 1; + pending_array_enclose = dimension_flatten; + if (pending_array_enclose) + expr += "["; + } + + if (options.flatten_multidimensional_arrays && dimension_flatten) + { + // If we are flattening multidimensional arrays, do manual stride computation. + if (is_literal) + expr += convert_to_string(index); + else + expr += to_enclosed_expression(index, register_expression_read); + + for (auto j = uint32_t(type->array.size()); j; j--) + { + expr += " * "; + expr += enclose_expression(to_array_size(*type, j - 1)); + } + + if (type->array.empty()) + pending_array_enclose = false; + else + expr += " + "; + + if (!pending_array_enclose) + expr += "]"; + } + else + { + append_index(index, is_literal, true); + } + + if (type->basetype == SPIRType::ControlPointArray) + { + type_id = type->parent_type; + type = &get(type_id); + } + + access_chain_is_arrayed = true; + } + // Arrays + else if (!type->array.empty()) + { + // If we are flattening multidimensional arrays, only create opening bracket on first + // array index. + if (options.flatten_multidimensional_arrays && !pending_array_enclose) + { + dimension_flatten = type->array.size() > 1; + pending_array_enclose = dimension_flatten; + if (pending_array_enclose) + expr += "["; + } + + assert(type->parent_type); + + auto *var = maybe_get(base); + if (backend.force_gl_in_out_block && i == 0 && var && is_builtin_variable(*var) && + !has_decoration(type->self, DecorationBlock)) + { + // This deals with scenarios for tesc/geom where arrays of gl_Position[] are declared. + // Normally, these variables live in blocks when compiled from GLSL, + // but HLSL seems to just emit straight arrays here. + // We must pretend this access goes through gl_in/gl_out arrays + // to be able to access certain builtins as arrays. + // Similar concerns apply for mesh shaders where we have to redirect to gl_MeshVerticesEXT or MeshPrimitivesEXT. + auto builtin = ir.meta[base].decoration.builtin_type; + bool mesh_shader = get_execution_model() == ExecutionModelMeshEXT; + + switch (builtin) + { + // case BuiltInCullDistance: // These are already arrays, need to figure out rules for these in tess/geom. + // case BuiltInClipDistance: + case BuiltInPosition: + case BuiltInPointSize: + if (mesh_shader) + expr = join("gl_MeshVerticesEXT[", to_expression(index, register_expression_read), "].", expr); + else if (var->storage == StorageClassInput) + expr = join("gl_in[", to_expression(index, register_expression_read), "].", expr); + else if (var->storage == StorageClassOutput) + expr = join("gl_out[", to_expression(index, register_expression_read), "].", expr); + else + append_index(index, is_literal); + break; + + case BuiltInPrimitiveId: + case BuiltInLayer: + case BuiltInViewportIndex: + case BuiltInCullPrimitiveEXT: + case BuiltInPrimitiveShadingRateKHR: + if (mesh_shader) + expr = join("gl_MeshPrimitivesEXT[", to_expression(index, register_expression_read), "].", expr); + else + append_index(index, is_literal); + break; + + default: + append_index(index, is_literal); + break; + } + } + else if (backend.force_merged_mesh_block && i == 0 && var && + !is_builtin_variable(*var) && var->storage == StorageClassOutput) + { + if (is_per_primitive_variable(*var)) + expr = join("gl_MeshPrimitivesEXT[", to_expression(index, register_expression_read), "].", expr); + else + expr = join("gl_MeshVerticesEXT[", to_expression(index, register_expression_read), "].", expr); + } + else if (options.flatten_multidimensional_arrays && dimension_flatten) + { + // If we are flattening multidimensional arrays, do manual stride computation. + auto &parent_type = get(type->parent_type); + + if (is_literal) + expr += convert_to_string(index); + else + expr += to_enclosed_expression(index, register_expression_read); + + for (auto j = uint32_t(parent_type.array.size()); j; j--) + { + expr += " * "; + expr += enclose_expression(to_array_size(parent_type, j - 1)); + } + + if (parent_type.array.empty()) + pending_array_enclose = false; + else + expr += " + "; + + if (!pending_array_enclose) + expr += "]"; + } + // Some builtins are arrays in SPIR-V but not in other languages, e.g. gl_SampleMask[] is an array in SPIR-V but not in Metal. + // By throwing away the index, we imply the index was 0, which it must be for gl_SampleMask. + else if (!builtin_translates_to_nonarray(BuiltIn(get_decoration(base, DecorationBuiltIn)))) + { + append_index(index, is_literal); + } + + type_id = type->parent_type; + type = &get(type_id); + + access_chain_is_arrayed = true; + } + // For structs, the index refers to a constant, which indexes into the members, possibly through a redirection mapping. + // We also check if this member is a builtin, since we then replace the entire expression with the builtin one. + else if (type->basetype == SPIRType::Struct) + { + if (!is_literal) + index = evaluate_constant_u32(index); + + if (index < uint32_t(type->member_type_index_redirection.size())) + index = type->member_type_index_redirection[index]; + + if (index >= type->member_types.size()) + SPIRV_CROSS_THROW("Member index is out of bounds!"); + + if (hide_first_subscript) + { + // First "._m0" subscript has been hidden, subsequent fields must be emitted even for structured buffers + hide_first_subscript = false; + } + else + { + BuiltIn builtin = BuiltInMax; + if (is_member_builtin(*type, index, &builtin) && access_chain_needs_stage_io_builtin_translation(base)) + { + if (access_chain_is_arrayed) + { + expr += "."; + expr += builtin_to_glsl(builtin, type->storage); + } + else + expr = builtin_to_glsl(builtin, type->storage); + } + else + { + // If the member has a qualified name, use it as the entire chain + string qual_mbr_name = get_member_qualified_name(type_id, index); + if (!qual_mbr_name.empty()) + expr = qual_mbr_name; + else if (flatten_member_reference) + expr += join("_", to_member_name(*type, index)); + else + { + // Any pointer de-refences for values are handled in the first access chain. + // For pointer chains, the pointer-ness is resolved through an array access. + // The only time this is not true is when accessing array of SSBO/UBO. + // This case is explicitly handled. + expr += to_member_reference(base, *type, index, ptr_chain || i != 0); + } + } + } + + if (has_member_decoration(type->self, index, DecorationInvariant)) + is_invariant = true; + if (has_member_decoration(type->self, index, DecorationRelaxedPrecision)) + relaxed_precision = true; + + is_packed = member_is_packed_physical_type(*type, index); + if (member_is_remapped_physical_type(*type, index)) + physical_type = get_extended_member_decoration(type->self, index, SPIRVCrossDecorationPhysicalTypeID); + else + physical_type = 0; + + row_major_matrix_needs_conversion = member_is_non_native_row_major_matrix(*type, index); + type = &get(type->member_types[index]); + } + // Matrix -> Vector + else if (type->columns > 1) + { + // If we have a row-major matrix here, we need to defer any transpose in case this access chain + // is used to store a column. We can resolve it right here and now if we access a scalar directly, + // by flipping indexing order of the matrix. + + expr += "["; + if (is_literal) + expr += convert_to_string(index); + else + expr += to_unpacked_expression(index, register_expression_read); + expr += "]"; + + type_id = type->parent_type; + type = &get(type_id); + } + // Vector -> Scalar + else if (type->vecsize > 1) + { + string deferred_index; + if (row_major_matrix_needs_conversion) + { + // Flip indexing order. + auto column_index = expr.find_last_of('['); + if (column_index != string::npos) + { + deferred_index = expr.substr(column_index); + expr.resize(column_index); + } + } + + // Internally, access chain implementation can also be used on composites, + // ignore scalar access workarounds in this case. + StorageClass effective_storage = StorageClassGeneric; + bool ignore_potential_sliced_writes = false; + if ((flags & ACCESS_CHAIN_FORCE_COMPOSITE_BIT) == 0) + { + if (expression_type(base).pointer) + effective_storage = get_expression_effective_storage_class(base); + + // Special consideration for control points. + // Control points can only be written by InvocationID, so there is no need + // to consider scalar access chains here. + // Cleans up some cases where it's very painful to determine the accurate storage class + // since blocks can be partially masked ... + auto *var = maybe_get_backing_variable(base); + if (var && var->storage == StorageClassOutput && + get_execution_model() == ExecutionModelTessellationControl && + !has_decoration(var->self, DecorationPatch)) + { + ignore_potential_sliced_writes = true; + } + } + else + ignore_potential_sliced_writes = true; + + if (!row_major_matrix_needs_conversion && !ignore_potential_sliced_writes) + { + // On some backends, we might not be able to safely access individual scalars in a vector. + // To work around this, we might have to cast the access chain reference to something which can, + // like a pointer to scalar, which we can then index into. + prepare_access_chain_for_scalar_access(expr, get(type->parent_type), effective_storage, + is_packed); + } + + if (is_literal) + { + bool out_of_bounds = (index >= type->vecsize); + + if (!is_packed && !row_major_matrix_needs_conversion) + { + expr += "."; + expr += index_to_swizzle(out_of_bounds ? 0 : index); + } + else + { + // For packed vectors, we can only access them as an array, not by swizzle. + expr += join("[", out_of_bounds ? 0 : index, "]"); + } + } + else if (ir.ids[index].get_type() == TypeConstant && !is_packed && !row_major_matrix_needs_conversion) + { + auto &c = get(index); + bool out_of_bounds = (c.scalar() >= type->vecsize); + + if (c.specialization) + { + // If the index is a spec constant, we cannot turn extract into a swizzle. + expr += join("[", out_of_bounds ? "0" : to_expression(index), "]"); + } + else + { + expr += "."; + expr += index_to_swizzle(out_of_bounds ? 0 : c.scalar()); + } + } + else + { + expr += "["; + expr += to_unpacked_expression(index, register_expression_read); + expr += "]"; + } + + if (row_major_matrix_needs_conversion && !ignore_potential_sliced_writes) + { + prepare_access_chain_for_scalar_access(expr, get(type->parent_type), effective_storage, + is_packed); + } + + expr += deferred_index; + row_major_matrix_needs_conversion = false; + + is_packed = false; + physical_type = 0; + type_id = type->parent_type; + type = &get(type_id); + } + else if (!backend.allow_truncated_access_chain) + SPIRV_CROSS_THROW("Cannot subdivide a scalar value!"); + } + + if (pending_array_enclose) + { + SPIRV_CROSS_THROW("Flattening of multidimensional arrays were enabled, " + "but the access chain was terminated in the middle of a multidimensional array. " + "This is not supported."); + } + + if (meta) + { + meta->need_transpose = row_major_matrix_needs_conversion; + meta->storage_is_packed = is_packed; + meta->storage_is_invariant = is_invariant; + meta->storage_physical_type = physical_type; + meta->relaxed_precision = relaxed_precision; + } + + return expr; +} + +void CompilerGLSL::check_physical_type_cast(std::string &, const SPIRType *, uint32_t) +{ +} + +void CompilerGLSL::prepare_access_chain_for_scalar_access(std::string &, const SPIRType &, spv::StorageClass, bool &) +{ +} + +string CompilerGLSL::to_flattened_struct_member(const string &basename, const SPIRType &type, uint32_t index) +{ + auto ret = join(basename, "_", to_member_name(type, index)); + ParsedIR::sanitize_underscores(ret); + return ret; +} + +string CompilerGLSL::access_chain(uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type, + AccessChainMeta *meta, bool ptr_chain) +{ + if (flattened_buffer_blocks.count(base)) + { + uint32_t matrix_stride = 0; + uint32_t array_stride = 0; + bool need_transpose = false; + flattened_access_chain_offset(expression_type(base), indices, count, 0, 16, &need_transpose, &matrix_stride, + &array_stride, ptr_chain); + + if (meta) + { + meta->need_transpose = target_type.columns > 1 && need_transpose; + meta->storage_is_packed = false; + } + + return flattened_access_chain(base, indices, count, target_type, 0, matrix_stride, array_stride, + need_transpose); + } + else if (flattened_structs.count(base) && count > 0) + { + AccessChainFlags flags = ACCESS_CHAIN_CHAIN_ONLY_BIT | ACCESS_CHAIN_SKIP_REGISTER_EXPRESSION_READ_BIT; + if (ptr_chain) + flags |= ACCESS_CHAIN_PTR_CHAIN_BIT; + + if (flattened_structs[base]) + { + flags |= ACCESS_CHAIN_FLATTEN_ALL_MEMBERS_BIT; + if (meta) + meta->flattened_struct = target_type.basetype == SPIRType::Struct; + } + + auto chain = access_chain_internal(base, indices, count, flags, nullptr).substr(1); + if (meta) + { + meta->need_transpose = false; + meta->storage_is_packed = false; + } + + auto basename = to_flattened_access_chain_expression(base); + auto ret = join(basename, "_", chain); + ParsedIR::sanitize_underscores(ret); + return ret; + } + else + { + AccessChainFlags flags = ACCESS_CHAIN_SKIP_REGISTER_EXPRESSION_READ_BIT; + if (ptr_chain) + flags |= ACCESS_CHAIN_PTR_CHAIN_BIT; + return access_chain_internal(base, indices, count, flags, meta); + } +} + +string CompilerGLSL::load_flattened_struct(const string &basename, const SPIRType &type) +{ + auto expr = type_to_glsl_constructor(type); + expr += '('; + + for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++) + { + if (i) + expr += ", "; + + auto &member_type = get(type.member_types[i]); + if (member_type.basetype == SPIRType::Struct) + expr += load_flattened_struct(to_flattened_struct_member(basename, type, i), member_type); + else + expr += to_flattened_struct_member(basename, type, i); + } + expr += ')'; + return expr; +} + +std::string CompilerGLSL::to_flattened_access_chain_expression(uint32_t id) +{ + // Do not use to_expression as that will unflatten access chains. + string basename; + if (const auto *var = maybe_get(id)) + basename = to_name(var->self); + else if (const auto *expr = maybe_get(id)) + basename = expr->expression; + else + basename = to_expression(id); + + return basename; +} + +void CompilerGLSL::store_flattened_struct(const string &basename, uint32_t rhs_id, const SPIRType &type, + const SmallVector &indices) +{ + SmallVector sub_indices = indices; + sub_indices.push_back(0); + + auto *member_type = &type; + for (auto &index : indices) + member_type = &get(member_type->member_types[index]); + + for (uint32_t i = 0; i < uint32_t(member_type->member_types.size()); i++) + { + sub_indices.back() = i; + auto lhs = join(basename, "_", to_member_name(*member_type, i)); + ParsedIR::sanitize_underscores(lhs); + + if (get(member_type->member_types[i]).basetype == SPIRType::Struct) + { + store_flattened_struct(lhs, rhs_id, type, sub_indices); + } + else + { + auto rhs = to_expression(rhs_id) + to_multi_member_reference(type, sub_indices); + statement(lhs, " = ", rhs, ";"); + } + } +} + +void CompilerGLSL::store_flattened_struct(uint32_t lhs_id, uint32_t value) +{ + auto &type = expression_type(lhs_id); + auto basename = to_flattened_access_chain_expression(lhs_id); + store_flattened_struct(basename, value, type, {}); +} + +std::string CompilerGLSL::flattened_access_chain(uint32_t base, const uint32_t *indices, uint32_t count, + const SPIRType &target_type, uint32_t offset, uint32_t matrix_stride, + uint32_t /* array_stride */, bool need_transpose) +{ + if (!target_type.array.empty()) + SPIRV_CROSS_THROW("Access chains that result in an array can not be flattened"); + else if (target_type.basetype == SPIRType::Struct) + return flattened_access_chain_struct(base, indices, count, target_type, offset); + else if (target_type.columns > 1) + return flattened_access_chain_matrix(base, indices, count, target_type, offset, matrix_stride, need_transpose); + else + return flattened_access_chain_vector(base, indices, count, target_type, offset, matrix_stride, need_transpose); +} + +std::string CompilerGLSL::flattened_access_chain_struct(uint32_t base, const uint32_t *indices, uint32_t count, + const SPIRType &target_type, uint32_t offset) +{ + std::string expr; + + if (backend.can_declare_struct_inline) + { + expr += type_to_glsl_constructor(target_type); + expr += "("; + } + else + expr += "{"; + + for (uint32_t i = 0; i < uint32_t(target_type.member_types.size()); ++i) + { + if (i != 0) + expr += ", "; + + const SPIRType &member_type = get(target_type.member_types[i]); + uint32_t member_offset = type_struct_member_offset(target_type, i); + + // The access chain terminates at the struct, so we need to find matrix strides and row-major information + // ahead of time. + bool need_transpose = false; + bool relaxed = false; + uint32_t matrix_stride = 0; + if (member_type.columns > 1) + { + auto decorations = combined_decoration_for_member(target_type, i); + need_transpose = decorations.get(DecorationRowMajor); + relaxed = decorations.get(DecorationRelaxedPrecision); + matrix_stride = type_struct_member_matrix_stride(target_type, i); + } + + auto tmp = flattened_access_chain(base, indices, count, member_type, offset + member_offset, matrix_stride, + 0 /* array_stride */, need_transpose); + + // Cannot forward transpositions, so resolve them here. + if (need_transpose) + expr += convert_row_major_matrix(tmp, member_type, 0, false, relaxed); + else + expr += tmp; + } + + expr += backend.can_declare_struct_inline ? ")" : "}"; + + return expr; +} + +std::string CompilerGLSL::flattened_access_chain_matrix(uint32_t base, const uint32_t *indices, uint32_t count, + const SPIRType &target_type, uint32_t offset, + uint32_t matrix_stride, bool need_transpose) +{ + assert(matrix_stride); + SPIRType tmp_type = target_type; + if (need_transpose) + swap(tmp_type.vecsize, tmp_type.columns); + + std::string expr; + + expr += type_to_glsl_constructor(tmp_type); + expr += "("; + + for (uint32_t i = 0; i < tmp_type.columns; i++) + { + if (i != 0) + expr += ", "; + + expr += flattened_access_chain_vector(base, indices, count, tmp_type, offset + i * matrix_stride, matrix_stride, + /* need_transpose= */ false); + } + + expr += ")"; + + return expr; +} + +std::string CompilerGLSL::flattened_access_chain_vector(uint32_t base, const uint32_t *indices, uint32_t count, + const SPIRType &target_type, uint32_t offset, + uint32_t matrix_stride, bool need_transpose) +{ + auto result = flattened_access_chain_offset(expression_type(base), indices, count, offset, 16); + + auto buffer_name = to_name(expression_type(base).self); + + if (need_transpose) + { + std::string expr; + + if (target_type.vecsize > 1) + { + expr += type_to_glsl_constructor(target_type); + expr += "("; + } + + for (uint32_t i = 0; i < target_type.vecsize; ++i) + { + if (i != 0) + expr += ", "; + + uint32_t component_offset = result.second + i * matrix_stride; + + assert(component_offset % (target_type.width / 8) == 0); + uint32_t index = component_offset / (target_type.width / 8); + + expr += buffer_name; + expr += "["; + expr += result.first; // this is a series of N1 * k1 + N2 * k2 + ... that is either empty or ends with a + + expr += convert_to_string(index / 4); + expr += "]"; + + expr += vector_swizzle(1, index % 4); + } + + if (target_type.vecsize > 1) + { + expr += ")"; + } + + return expr; + } + else + { + assert(result.second % (target_type.width / 8) == 0); + uint32_t index = result.second / (target_type.width / 8); + + std::string expr; + + expr += buffer_name; + expr += "["; + expr += result.first; // this is a series of N1 * k1 + N2 * k2 + ... that is either empty or ends with a + + expr += convert_to_string(index / 4); + expr += "]"; + + expr += vector_swizzle(target_type.vecsize, index % 4); + + return expr; + } +} + +std::pair CompilerGLSL::flattened_access_chain_offset( + const SPIRType &basetype, const uint32_t *indices, uint32_t count, uint32_t offset, uint32_t word_stride, + bool *need_transpose, uint32_t *out_matrix_stride, uint32_t *out_array_stride, bool ptr_chain) +{ + // Start traversing type hierarchy at the proper non-pointer types. + const auto *type = &get_pointee_type(basetype); + + std::string expr; + + // Inherit matrix information in case we are access chaining a vector which might have come from a row major layout. + bool row_major_matrix_needs_conversion = need_transpose ? *need_transpose : false; + uint32_t matrix_stride = out_matrix_stride ? *out_matrix_stride : 0; + uint32_t array_stride = out_array_stride ? *out_array_stride : 0; + + for (uint32_t i = 0; i < count; i++) + { + uint32_t index = indices[i]; + + // Pointers + if (ptr_chain && i == 0) + { + // Here, the pointer type will be decorated with an array stride. + array_stride = get_decoration(basetype.self, DecorationArrayStride); + if (!array_stride) + SPIRV_CROSS_THROW("SPIR-V does not define ArrayStride for buffer block."); + + auto *constant = maybe_get(index); + if (constant) + { + // Constant array access. + offset += constant->scalar() * array_stride; + } + else + { + // Dynamic array access. + if (array_stride % word_stride) + { + SPIRV_CROSS_THROW("Array stride for dynamic indexing must be divisible by the size " + "of a 4-component vector. " + "Likely culprit here is a float or vec2 array inside a push " + "constant block which is std430. " + "This cannot be flattened. Try using std140 layout instead."); + } + + expr += to_enclosed_expression(index); + expr += " * "; + expr += convert_to_string(array_stride / word_stride); + expr += " + "; + } + } + // Arrays + else if (!type->array.empty()) + { + auto *constant = maybe_get(index); + if (constant) + { + // Constant array access. + offset += constant->scalar() * array_stride; + } + else + { + // Dynamic array access. + if (array_stride % word_stride) + { + SPIRV_CROSS_THROW("Array stride for dynamic indexing must be divisible by the size " + "of a 4-component vector. " + "Likely culprit here is a float or vec2 array inside a push " + "constant block which is std430. " + "This cannot be flattened. Try using std140 layout instead."); + } + + expr += to_enclosed_expression(index, false); + expr += " * "; + expr += convert_to_string(array_stride / word_stride); + expr += " + "; + } + + uint32_t parent_type = type->parent_type; + type = &get(parent_type); + + if (!type->array.empty()) + array_stride = get_decoration(parent_type, DecorationArrayStride); + } + // For structs, the index refers to a constant, which indexes into the members. + // We also check if this member is a builtin, since we then replace the entire expression with the builtin one. + else if (type->basetype == SPIRType::Struct) + { + index = evaluate_constant_u32(index); + + if (index >= type->member_types.size()) + SPIRV_CROSS_THROW("Member index is out of bounds!"); + + offset += type_struct_member_offset(*type, index); + + auto &struct_type = *type; + type = &get(type->member_types[index]); + + if (type->columns > 1) + { + matrix_stride = type_struct_member_matrix_stride(struct_type, index); + row_major_matrix_needs_conversion = + combined_decoration_for_member(struct_type, index).get(DecorationRowMajor); + } + else + row_major_matrix_needs_conversion = false; + + if (!type->array.empty()) + array_stride = type_struct_member_array_stride(struct_type, index); + } + // Matrix -> Vector + else if (type->columns > 1) + { + auto *constant = maybe_get(index); + if (constant) + { + index = evaluate_constant_u32(index); + offset += index * (row_major_matrix_needs_conversion ? (type->width / 8) : matrix_stride); + } + else + { + uint32_t indexing_stride = row_major_matrix_needs_conversion ? (type->width / 8) : matrix_stride; + // Dynamic array access. + if (indexing_stride % word_stride) + { + SPIRV_CROSS_THROW("Matrix stride for dynamic indexing must be divisible by the size of a " + "4-component vector. " + "Likely culprit here is a row-major matrix being accessed dynamically. " + "This cannot be flattened. Try using std140 layout instead."); + } + + expr += to_enclosed_expression(index, false); + expr += " * "; + expr += convert_to_string(indexing_stride / word_stride); + expr += " + "; + } + + type = &get(type->parent_type); + } + // Vector -> Scalar + else if (type->vecsize > 1) + { + auto *constant = maybe_get(index); + if (constant) + { + index = evaluate_constant_u32(index); + offset += index * (row_major_matrix_needs_conversion ? matrix_stride : (type->width / 8)); + } + else + { + uint32_t indexing_stride = row_major_matrix_needs_conversion ? matrix_stride : (type->width / 8); + + // Dynamic array access. + if (indexing_stride % word_stride) + { + SPIRV_CROSS_THROW("Stride for dynamic vector indexing must be divisible by the " + "size of a 4-component vector. " + "This cannot be flattened in legacy targets."); + } + + expr += to_enclosed_expression(index, false); + expr += " * "; + expr += convert_to_string(indexing_stride / word_stride); + expr += " + "; + } + + type = &get(type->parent_type); + } + else + SPIRV_CROSS_THROW("Cannot subdivide a scalar value!"); + } + + if (need_transpose) + *need_transpose = row_major_matrix_needs_conversion; + if (out_matrix_stride) + *out_matrix_stride = matrix_stride; + if (out_array_stride) + *out_array_stride = array_stride; + + return std::make_pair(expr, offset); +} + +bool CompilerGLSL::should_dereference(uint32_t id) +{ + const auto &type = expression_type(id); + // Non-pointer expressions don't need to be dereferenced. + if (!type.pointer) + return false; + + // Handles shouldn't be dereferenced either. + if (!expression_is_lvalue(id)) + return false; + + // If id is a variable but not a phi variable, we should not dereference it. + if (auto *var = maybe_get(id)) + return var->phi_variable; + + if (auto *expr = maybe_get(id)) + { + // If id is an access chain, we should not dereference it. + if (expr->access_chain) + return false; + + // If id is a forwarded copy of a variable pointer, we should not dereference it. + SPIRVariable *var = nullptr; + while (expr->loaded_from && expression_is_forwarded(expr->self)) + { + auto &src_type = expression_type(expr->loaded_from); + // To be a copy, the pointer and its source expression must be the + // same type. Can't check type.self, because for some reason that's + // usually the base type with pointers stripped off. This check is + // complex enough that I've hoisted it out of the while condition. + if (src_type.pointer != type.pointer || src_type.pointer_depth != type.pointer_depth || + src_type.parent_type != type.parent_type) + break; + if ((var = maybe_get(expr->loaded_from))) + break; + if (!(expr = maybe_get(expr->loaded_from))) + break; + } + + return !var || var->phi_variable; + } + + // Otherwise, we should dereference this pointer expression. + return true; +} + +bool CompilerGLSL::should_forward(uint32_t id) const +{ + // If id is a variable we will try to forward it regardless of force_temporary check below + // This is important because otherwise we'll get local sampler copies (highp sampler2D foo = bar) that are invalid in OpenGL GLSL + + auto *var = maybe_get(id); + if (var) + { + // Never forward volatile builtin variables, e.g. SPIR-V 1.6 HelperInvocation. + return !(has_decoration(id, DecorationBuiltIn) && has_decoration(id, DecorationVolatile)); + } + + // For debugging emit temporary variables for all expressions + if (options.force_temporary) + return false; + + // If an expression carries enough dependencies we need to stop forwarding at some point, + // or we explode compilers. There are usually limits to how much we can nest expressions. + auto *expr = maybe_get(id); + const uint32_t max_expression_dependencies = 64; + if (expr && expr->expression_dependencies.size() >= max_expression_dependencies) + return false; + + if (expr && expr->loaded_from + && has_decoration(expr->loaded_from, DecorationBuiltIn) + && has_decoration(expr->loaded_from, DecorationVolatile)) + { + // Never forward volatile builtin variables, e.g. SPIR-V 1.6 HelperInvocation. + return false; + } + + // Immutable expression can always be forwarded. + if (is_immutable(id)) + return true; + + return false; +} + +bool CompilerGLSL::should_suppress_usage_tracking(uint32_t id) const +{ + // Used only by opcodes which don't do any real "work", they just swizzle data in some fashion. + return !expression_is_forwarded(id) || expression_suppresses_usage_tracking(id); +} + +void CompilerGLSL::track_expression_read(uint32_t id) +{ + switch (ir.ids[id].get_type()) + { + case TypeExpression: + { + auto &e = get(id); + for (auto implied_read : e.implied_read_expressions) + track_expression_read(implied_read); + break; + } + + case TypeAccessChain: + { + auto &e = get(id); + for (auto implied_read : e.implied_read_expressions) + track_expression_read(implied_read); + break; + } + + default: + break; + } + + // If we try to read a forwarded temporary more than once we will stamp out possibly complex code twice. + // In this case, it's better to just bind the complex expression to the temporary and read that temporary twice. + if (expression_is_forwarded(id) && !expression_suppresses_usage_tracking(id)) + { + auto &v = expression_usage_counts[id]; + v++; + + // If we create an expression outside a loop, + // but access it inside a loop, we're implicitly reading it multiple times. + // If the expression in question is expensive, we should hoist it out to avoid relying on loop-invariant code motion + // working inside the backend compiler. + if (expression_read_implies_multiple_reads(id)) + v++; + + if (v >= 2) + { + //if (v == 2) + // fprintf(stderr, "ID %u was forced to temporary due to more than 1 expression use!\n", id); + + // Force a recompile after this pass to avoid forwarding this variable. + force_temporary_and_recompile(id); + } + } +} + +bool CompilerGLSL::args_will_forward(uint32_t id, const uint32_t *args, uint32_t num_args, bool pure) +{ + if (forced_temporaries.find(id) != end(forced_temporaries)) + return false; + + for (uint32_t i = 0; i < num_args; i++) + if (!should_forward(args[i])) + return false; + + // We need to forward globals as well. + if (!pure) + { + for (auto global : global_variables) + if (!should_forward(global)) + return false; + for (auto aliased : aliased_variables) + if (!should_forward(aliased)) + return false; + } + + return true; +} + +void CompilerGLSL::register_impure_function_call() +{ + // Impure functions can modify globals and aliased variables, so invalidate them as well. + for (auto global : global_variables) + flush_dependees(get(global)); + for (auto aliased : aliased_variables) + flush_dependees(get(aliased)); +} + +void CompilerGLSL::register_call_out_argument(uint32_t id) +{ + register_write(id); + + auto *var = maybe_get(id); + if (var) + flush_variable_declaration(var->self); +} + +string CompilerGLSL::variable_decl_function_local(SPIRVariable &var) +{ + // These variables are always function local, + // so make sure we emit the variable without storage qualifiers. + // Some backends will inject custom variables locally in a function + // with a storage qualifier which is not function-local. + auto old_storage = var.storage; + var.storage = StorageClassFunction; + auto expr = variable_decl(var); + var.storage = old_storage; + return expr; +} + +void CompilerGLSL::emit_variable_temporary_copies(const SPIRVariable &var) +{ + // Ensure that we declare phi-variable copies even if the original declaration isn't deferred + if (var.allocate_temporary_copy && !flushed_phi_variables.count(var.self)) + { + auto &type = get(var.basetype); + auto &flags = get_decoration_bitset(var.self); + statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, join("_", var.self, "_copy")), ";"); + flushed_phi_variables.insert(var.self); + } +} + +void CompilerGLSL::flush_variable_declaration(uint32_t id) +{ + // Ensure that we declare phi-variable copies even if the original declaration isn't deferred + auto *var = maybe_get(id); + if (var && var->deferred_declaration) + { + string initializer; + if (options.force_zero_initialized_variables && + (var->storage == StorageClassFunction || var->storage == StorageClassGeneric || + var->storage == StorageClassPrivate) && + !var->initializer && type_can_zero_initialize(get_variable_data_type(*var))) + { + initializer = join(" = ", to_zero_initialized_expression(get_variable_data_type_id(*var))); + } + + statement(variable_decl_function_local(*var), initializer, ";"); + var->deferred_declaration = false; + } + if (var) + { + emit_variable_temporary_copies(*var); + } +} + +bool CompilerGLSL::remove_duplicate_swizzle(string &op) +{ + auto pos = op.find_last_of('.'); + if (pos == string::npos || pos == 0) + return false; + + string final_swiz = op.substr(pos + 1, string::npos); + + if (backend.swizzle_is_function) + { + if (final_swiz.size() < 2) + return false; + + if (final_swiz.substr(final_swiz.size() - 2, string::npos) == "()") + final_swiz.erase(final_swiz.size() - 2, string::npos); + else + return false; + } + + // Check if final swizzle is of form .x, .xy, .xyz, .xyzw or similar. + // If so, and previous swizzle is of same length, + // we can drop the final swizzle altogether. + for (uint32_t i = 0; i < final_swiz.size(); i++) + { + static const char expected[] = { 'x', 'y', 'z', 'w' }; + if (i >= 4 || final_swiz[i] != expected[i]) + return false; + } + + auto prevpos = op.find_last_of('.', pos - 1); + if (prevpos == string::npos) + return false; + + prevpos++; + + // Make sure there are only swizzles here ... + for (auto i = prevpos; i < pos; i++) + { + if (op[i] < 'w' || op[i] > 'z') + { + // If swizzles are foo.xyz() like in C++ backend for example, check for that. + if (backend.swizzle_is_function && i + 2 == pos && op[i] == '(' && op[i + 1] == ')') + break; + return false; + } + } + + // If original swizzle is large enough, just carve out the components we need. + // E.g. foobar.wyx.xy will turn into foobar.wy. + if (pos - prevpos >= final_swiz.size()) + { + op.erase(prevpos + final_swiz.size(), string::npos); + + // Add back the function call ... + if (backend.swizzle_is_function) + op += "()"; + } + return true; +} + +// Optimizes away vector swizzles where we have something like +// vec3 foo; +// foo.xyz <-- swizzle expression does nothing. +// This is a very common pattern after OpCompositeCombine. +bool CompilerGLSL::remove_unity_swizzle(uint32_t base, string &op) +{ + auto pos = op.find_last_of('.'); + if (pos == string::npos || pos == 0) + return false; + + string final_swiz = op.substr(pos + 1, string::npos); + + if (backend.swizzle_is_function) + { + if (final_swiz.size() < 2) + return false; + + if (final_swiz.substr(final_swiz.size() - 2, string::npos) == "()") + final_swiz.erase(final_swiz.size() - 2, string::npos); + else + return false; + } + + // Check if final swizzle is of form .x, .xy, .xyz, .xyzw or similar. + // If so, and previous swizzle is of same length, + // we can drop the final swizzle altogether. + for (uint32_t i = 0; i < final_swiz.size(); i++) + { + static const char expected[] = { 'x', 'y', 'z', 'w' }; + if (i >= 4 || final_swiz[i] != expected[i]) + return false; + } + + auto &type = expression_type(base); + + // Sanity checking ... + assert(type.columns == 1 && type.array.empty()); + + if (type.vecsize == final_swiz.size()) + op.erase(pos, string::npos); + return true; +} + +string CompilerGLSL::build_composite_combiner(uint32_t return_type, const uint32_t *elems, uint32_t length) +{ + ID base = 0; + string op; + string subop; + + // Can only merge swizzles for vectors. + auto &type = get(return_type); + bool can_apply_swizzle_opt = type.basetype != SPIRType::Struct && type.array.empty() && type.columns == 1; + bool swizzle_optimization = false; + + for (uint32_t i = 0; i < length; i++) + { + auto *e = maybe_get(elems[i]); + + // If we're merging another scalar which belongs to the same base + // object, just merge the swizzles to avoid triggering more than 1 expression read as much as possible! + if (can_apply_swizzle_opt && e && e->base_expression && e->base_expression == base) + { + // Only supposed to be used for vector swizzle -> scalar. + assert(!e->expression.empty() && e->expression.front() == '.'); + subop += e->expression.substr(1, string::npos); + swizzle_optimization = true; + } + else + { + // We'll likely end up with duplicated swizzles, e.g. + // foobar.xyz.xyz from patterns like + // OpVectorShuffle + // OpCompositeExtract x 3 + // OpCompositeConstruct 3x + other scalar. + // Just modify op in-place. + if (swizzle_optimization) + { + if (backend.swizzle_is_function) + subop += "()"; + + // Don't attempt to remove unity swizzling if we managed to remove duplicate swizzles. + // The base "foo" might be vec4, while foo.xyz is vec3 (OpVectorShuffle) and looks like a vec3 due to the .xyz tacked on. + // We only want to remove the swizzles if we're certain that the resulting base will be the same vecsize. + // Essentially, we can only remove one set of swizzles, since that's what we have control over ... + // Case 1: + // foo.yxz.xyz: Duplicate swizzle kicks in, giving foo.yxz, we are done. + // foo.yxz was the result of OpVectorShuffle and we don't know the type of foo. + // Case 2: + // foo.xyz: Duplicate swizzle won't kick in. + // If foo is vec3, we can remove xyz, giving just foo. + if (!remove_duplicate_swizzle(subop)) + remove_unity_swizzle(base, subop); + + // Strips away redundant parens if we created them during component extraction. + strip_enclosed_expression(subop); + swizzle_optimization = false; + op += subop; + } + else + op += subop; + + if (i) + op += ", "; + + bool uses_buffer_offset = + type.basetype == SPIRType::Struct && has_member_decoration(type.self, i, DecorationOffset); + subop = to_composite_constructor_expression(type, elems[i], uses_buffer_offset); + } + + base = e ? e->base_expression : ID(0); + } + + if (swizzle_optimization) + { + if (backend.swizzle_is_function) + subop += "()"; + + if (!remove_duplicate_swizzle(subop)) + remove_unity_swizzle(base, subop); + // Strips away redundant parens if we created them during component extraction. + strip_enclosed_expression(subop); + } + + op += subop; + return op; +} + +bool CompilerGLSL::skip_argument(uint32_t id) const +{ + if (!combined_image_samplers.empty() || !options.vulkan_semantics) + { + auto &type = expression_type(id); + if (type.basetype == SPIRType::Sampler || (type.basetype == SPIRType::Image && type.image.sampled == 1)) + return true; + } + return false; +} + +bool CompilerGLSL::optimize_read_modify_write(const SPIRType &type, const string &lhs, const string &rhs) +{ + // Do this with strings because we have a very clear pattern we can check for and it avoids + // adding lots of special cases to the code emission. + if (rhs.size() < lhs.size() + 3) + return false; + + // Do not optimize matrices. They are a bit awkward to reason about in general + // (in which order does operation happen?), and it does not work on MSL anyways. + if (type.vecsize > 1 && type.columns > 1) + return false; + + auto index = rhs.find(lhs); + if (index != 0) + return false; + + // TODO: Shift operators, but it's not important for now. + auto op = rhs.find_first_of("+-/*%|&^", lhs.size() + 1); + if (op != lhs.size() + 1) + return false; + + // Check that the op is followed by space. This excludes && and ||. + if (rhs[op + 1] != ' ') + return false; + + char bop = rhs[op]; + auto expr = rhs.substr(lhs.size() + 3); + + // Avoids false positives where we get a = a * b + c. + // Normally, these expressions are always enclosed, but unexpected code paths may end up hitting this. + if (needs_enclose_expression(expr)) + return false; + + // Try to find increments and decrements. Makes it look neater as += 1, -= 1 is fairly rare to see in real code. + // Find some common patterns which are equivalent. + if ((bop == '+' || bop == '-') && (expr == "1" || expr == "uint(1)" || expr == "1u" || expr == "int(1u)")) + statement(lhs, bop, bop, ";"); + else + statement(lhs, " ", bop, "= ", expr, ";"); + return true; +} + +void CompilerGLSL::register_control_dependent_expression(uint32_t expr) +{ + if (forwarded_temporaries.find(expr) == end(forwarded_temporaries)) + return; + + assert(current_emitting_block); + current_emitting_block->invalidate_expressions.push_back(expr); +} + +void CompilerGLSL::emit_block_instructions(SPIRBlock &block) +{ + current_emitting_block = █ + + if (backend.requires_relaxed_precision_analysis) + { + // If PHI variables are consumed in unexpected precision contexts, copy them here. + for (size_t i = 0, n = block.phi_variables.size(); i < n; i++) + { + auto &phi = block.phi_variables[i]; + + // Ensure we only copy once. We know a-priori that this array will lay out + // the same function variables together. + if (i && block.phi_variables[i - 1].function_variable == phi.function_variable) + continue; + + auto itr = temporary_to_mirror_precision_alias.find(phi.function_variable); + if (itr != temporary_to_mirror_precision_alias.end()) + { + // Explicitly, we don't want to inherit RelaxedPrecision state in this CopyObject, + // so it helps to have handle_instruction_precision() on the outside of emit_instruction(). + EmbeddedInstruction inst; + inst.op = OpCopyObject; + inst.length = 3; + inst.ops.push_back(expression_type_id(itr->first)); + inst.ops.push_back(itr->second); + inst.ops.push_back(itr->first); + emit_instruction(inst); + } + } + } + + for (auto &op : block.ops) + { + auto temporary_copy = handle_instruction_precision(op); + emit_instruction(op); + if (temporary_copy.dst_id) + { + // Explicitly, we don't want to inherit RelaxedPrecision state in this CopyObject, + // so it helps to have handle_instruction_precision() on the outside of emit_instruction(). + EmbeddedInstruction inst; + inst.op = OpCopyObject; + inst.length = 3; + inst.ops.push_back(expression_type_id(temporary_copy.src_id)); + inst.ops.push_back(temporary_copy.dst_id); + inst.ops.push_back(temporary_copy.src_id); + + // Never attempt to hoist mirrored temporaries. + // They are hoisted in lock-step with their parents. + block_temporary_hoisting = true; + emit_instruction(inst); + block_temporary_hoisting = false; + } + } + + current_emitting_block = nullptr; +} + +void CompilerGLSL::disallow_forwarding_in_expression_chain(const SPIRExpression &expr) +{ + // Allow trivially forwarded expressions like OpLoad or trivial shuffles, + // these will be marked as having suppressed usage tracking. + // Our only concern is to make sure arithmetic operations are done in similar ways. + if (expression_is_forwarded(expr.self) && !expression_suppresses_usage_tracking(expr.self) && + forced_invariant_temporaries.count(expr.self) == 0) + { + force_temporary_and_recompile(expr.self); + forced_invariant_temporaries.insert(expr.self); + + for (auto &dependent : expr.expression_dependencies) + disallow_forwarding_in_expression_chain(get(dependent)); + } +} + +void CompilerGLSL::handle_store_to_invariant_variable(uint32_t store_id, uint32_t value_id) +{ + // Variables or access chains marked invariant are complicated. We will need to make sure the code-gen leading up to + // this variable is consistent. The failure case for SPIRV-Cross is when an expression is forced to a temporary + // in one translation unit, but not another, e.g. due to multiple use of an expression. + // This causes variance despite the output variable being marked invariant, so the solution here is to force all dependent + // expressions to be temporaries. + // It is uncertain if this is enough to support invariant in all possible cases, but it should be good enough + // for all reasonable uses of invariant. + if (!has_decoration(store_id, DecorationInvariant)) + return; + + auto *expr = maybe_get(value_id); + if (!expr) + return; + + disallow_forwarding_in_expression_chain(*expr); +} + +void CompilerGLSL::emit_store_statement(uint32_t lhs_expression, uint32_t rhs_expression) +{ + auto rhs = to_pointer_expression(rhs_expression); + + // Statements to OpStore may be empty if it is a struct with zero members. Just forward the store to /dev/null. + if (!rhs.empty()) + { + handle_store_to_invariant_variable(lhs_expression, rhs_expression); + + if (!unroll_array_to_complex_store(lhs_expression, rhs_expression)) + { + auto lhs = to_dereferenced_expression(lhs_expression); + if (has_decoration(lhs_expression, DecorationNonUniform)) + convert_non_uniform_expression(lhs, lhs_expression); + + // We might need to cast in order to store to a builtin. + cast_to_variable_store(lhs_expression, rhs, expression_type(rhs_expression)); + + // Tries to optimize assignments like " = op expr". + // While this is purely cosmetic, this is important for legacy ESSL where loop + // variable increments must be in either i++ or i += const-expr. + // Without this, we end up with i = i + 1, which is correct GLSL, but not correct GLES 2.0. + if (!optimize_read_modify_write(expression_type(rhs_expression), lhs, rhs)) + statement(lhs, " = ", rhs, ";"); + } + register_write(lhs_expression); + } +} + +uint32_t CompilerGLSL::get_integer_width_for_instruction(const Instruction &instr) const +{ + if (instr.length < 3) + return 32; + + auto *ops = stream(instr); + + switch (instr.op) + { + case OpSConvert: + case OpConvertSToF: + case OpUConvert: + case OpConvertUToF: + case OpIEqual: + case OpINotEqual: + case OpSLessThan: + case OpSLessThanEqual: + case OpSGreaterThan: + case OpSGreaterThanEqual: + case OpULessThan: + case OpULessThanEqual: + case OpUGreaterThan: + case OpUGreaterThanEqual: + return expression_type(ops[2]).width; + + default: + { + // We can look at result type which is more robust. + auto *type = maybe_get(ops[0]); + if (type && type_is_integral(*type)) + return type->width; + else + return 32; + } + } +} + +uint32_t CompilerGLSL::get_integer_width_for_glsl_instruction(GLSLstd450 op, const uint32_t *ops, uint32_t length) const +{ + if (length < 1) + return 32; + + switch (op) + { + case GLSLstd450SAbs: + case GLSLstd450SSign: + case GLSLstd450UMin: + case GLSLstd450SMin: + case GLSLstd450UMax: + case GLSLstd450SMax: + case GLSLstd450UClamp: + case GLSLstd450SClamp: + case GLSLstd450FindSMsb: + case GLSLstd450FindUMsb: + return expression_type(ops[0]).width; + + default: + { + // We don't need to care about other opcodes, just return 32. + return 32; + } + } +} + +void CompilerGLSL::forward_relaxed_precision(uint32_t dst_id, const uint32_t *args, uint32_t length) +{ + // Only GLSL supports RelaxedPrecision directly. + // We cannot implement this in HLSL or MSL because it is tied to the type system. + // In SPIR-V, everything must masquerade as 32-bit. + if (!backend.requires_relaxed_precision_analysis) + return; + + auto input_precision = analyze_expression_precision(args, length); + + // For expressions which are loaded or directly forwarded, we inherit mediump implicitly. + // For dst_id to be analyzed properly, it must inherit any relaxed precision decoration from src_id. + if (input_precision == Options::Mediump) + set_decoration(dst_id, DecorationRelaxedPrecision); +} + +CompilerGLSL::Options::Precision CompilerGLSL::analyze_expression_precision(const uint32_t *args, uint32_t length) const +{ + // Now, analyze the precision at which the arguments would run. + // GLSL rules are such that the precision used to evaluate an expression is equal to the highest precision + // for the inputs. Constants do not have inherent precision and do not contribute to this decision. + // If all inputs are constants, they inherit precision from outer expressions, including an l-value. + // In this case, we'll have to force a temporary for dst_id so that we can bind the constant expression with + // correct precision. + bool expression_has_highp = false; + bool expression_has_mediump = false; + + for (uint32_t i = 0; i < length; i++) + { + uint32_t arg = args[i]; + + auto handle_type = ir.ids[arg].get_type(); + if (handle_type == TypeConstant || handle_type == TypeConstantOp || handle_type == TypeUndef) + continue; + + if (has_decoration(arg, DecorationRelaxedPrecision)) + expression_has_mediump = true; + else + expression_has_highp = true; + } + + if (expression_has_highp) + return Options::Highp; + else if (expression_has_mediump) + return Options::Mediump; + else + return Options::DontCare; +} + +void CompilerGLSL::analyze_precision_requirements(uint32_t type_id, uint32_t dst_id, uint32_t *args, uint32_t length) +{ + if (!backend.requires_relaxed_precision_analysis) + return; + + auto &type = get(type_id); + + // RelaxedPrecision only applies to 32-bit values. + if (type.basetype != SPIRType::Float && type.basetype != SPIRType::Int && type.basetype != SPIRType::UInt) + return; + + bool operation_is_highp = !has_decoration(dst_id, DecorationRelaxedPrecision); + + auto input_precision = analyze_expression_precision(args, length); + if (input_precision == Options::DontCare) + { + consume_temporary_in_precision_context(type_id, dst_id, input_precision); + return; + } + + // In SPIR-V and GLSL, the semantics are flipped for how relaxed precision is determined. + // In SPIR-V, the operation itself marks RelaxedPrecision, meaning that inputs can be truncated to 16-bit. + // However, if the expression is not, inputs must be expanded to 32-bit first, + // since the operation must run at high precision. + // This is the awkward part, because if we have mediump inputs, or expressions which derived from mediump, + // we might have to forcefully bind the source IDs to highp temporaries. This is done by clearing decorations + // and forcing temporaries. Similarly for mediump operations. We bind highp expressions to mediump variables. + if ((operation_is_highp && input_precision == Options::Mediump) || + (!operation_is_highp && input_precision == Options::Highp)) + { + auto precision = operation_is_highp ? Options::Highp : Options::Mediump; + for (uint32_t i = 0; i < length; i++) + { + // Rewrites the opcode so that we consume an ID in correct precision context. + // This is pretty hacky, but it's the most straight forward way of implementing this without adding + // lots of extra passes to rewrite all code blocks. + args[i] = consume_temporary_in_precision_context(expression_type_id(args[i]), args[i], precision); + } + } +} + +// This is probably not exhaustive ... +static bool opcode_is_precision_sensitive_operation(Op op) +{ + switch (op) + { + case OpFAdd: + case OpFSub: + case OpFMul: + case OpFNegate: + case OpIAdd: + case OpISub: + case OpIMul: + case OpSNegate: + case OpFMod: + case OpFDiv: + case OpFRem: + case OpSMod: + case OpSDiv: + case OpSRem: + case OpUMod: + case OpUDiv: + case OpVectorTimesMatrix: + case OpMatrixTimesVector: + case OpMatrixTimesMatrix: + case OpDPdx: + case OpDPdy: + case OpDPdxCoarse: + case OpDPdyCoarse: + case OpDPdxFine: + case OpDPdyFine: + case OpFwidth: + case OpFwidthCoarse: + case OpFwidthFine: + case OpVectorTimesScalar: + case OpMatrixTimesScalar: + case OpOuterProduct: + case OpFConvert: + case OpSConvert: + case OpUConvert: + case OpConvertSToF: + case OpConvertUToF: + case OpConvertFToU: + case OpConvertFToS: + return true; + + default: + return false; + } +} + +// Instructions which just load data but don't do any arithmetic operation should just inherit the decoration. +// SPIR-V doesn't require this, but it's somewhat implied it has to work this way, relaxed precision is only +// relevant when operating on the IDs, not when shuffling things around. +static bool opcode_is_precision_forwarding_instruction(Op op, uint32_t &arg_count) +{ + switch (op) + { + case OpLoad: + case OpAccessChain: + case OpInBoundsAccessChain: + case OpCompositeExtract: + case OpVectorExtractDynamic: + case OpSampledImage: + case OpImage: + case OpCopyObject: + + case OpImageRead: + case OpImageFetch: + case OpImageSampleImplicitLod: + case OpImageSampleProjImplicitLod: + case OpImageSampleDrefImplicitLod: + case OpImageSampleProjDrefImplicitLod: + case OpImageSampleExplicitLod: + case OpImageSampleProjExplicitLod: + case OpImageSampleDrefExplicitLod: + case OpImageSampleProjDrefExplicitLod: + case OpImageGather: + case OpImageDrefGather: + case OpImageSparseRead: + case OpImageSparseFetch: + case OpImageSparseSampleImplicitLod: + case OpImageSparseSampleProjImplicitLod: + case OpImageSparseSampleDrefImplicitLod: + case OpImageSparseSampleProjDrefImplicitLod: + case OpImageSparseSampleExplicitLod: + case OpImageSparseSampleProjExplicitLod: + case OpImageSparseSampleDrefExplicitLod: + case OpImageSparseSampleProjDrefExplicitLod: + case OpImageSparseGather: + case OpImageSparseDrefGather: + arg_count = 1; + return true; + + case OpVectorShuffle: + arg_count = 2; + return true; + + case OpCompositeConstruct: + return true; + + default: + break; + } + + return false; +} + +CompilerGLSL::TemporaryCopy CompilerGLSL::handle_instruction_precision(const Instruction &instruction) +{ + auto ops = stream_mutable(instruction); + auto opcode = static_cast(instruction.op); + uint32_t length = instruction.length; + + if (backend.requires_relaxed_precision_analysis) + { + if (length > 2) + { + uint32_t forwarding_length = length - 2; + + if (opcode_is_precision_sensitive_operation(opcode)) + analyze_precision_requirements(ops[0], ops[1], &ops[2], forwarding_length); + else if (opcode == OpExtInst && length >= 5 && get(ops[2]).ext == SPIRExtension::GLSL) + analyze_precision_requirements(ops[0], ops[1], &ops[4], forwarding_length - 2); + else if (opcode_is_precision_forwarding_instruction(opcode, forwarding_length)) + forward_relaxed_precision(ops[1], &ops[2], forwarding_length); + } + + uint32_t result_type = 0, result_id = 0; + if (instruction_to_result_type(result_type, result_id, opcode, ops, length)) + { + auto itr = temporary_to_mirror_precision_alias.find(ops[1]); + if (itr != temporary_to_mirror_precision_alias.end()) + return { itr->second, itr->first }; + } + } + + return {}; +} + +void CompilerGLSL::emit_instruction(const Instruction &instruction) +{ + auto ops = stream(instruction); + auto opcode = static_cast(instruction.op); + uint32_t length = instruction.length; + +#define GLSL_BOP(op) emit_binary_op(ops[0], ops[1], ops[2], ops[3], #op) +#define GLSL_BOP_CAST(op, type) \ + emit_binary_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, \ + opcode_is_sign_invariant(opcode), implicit_integer_promotion) +#define GLSL_UOP(op) emit_unary_op(ops[0], ops[1], ops[2], #op) +#define GLSL_UOP_CAST(op) emit_unary_op_cast(ops[0], ops[1], ops[2], #op) +#define GLSL_QFOP(op) emit_quaternary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], #op) +#define GLSL_TFOP(op) emit_trinary_func_op(ops[0], ops[1], ops[2], ops[3], ops[4], #op) +#define GLSL_BFOP(op) emit_binary_func_op(ops[0], ops[1], ops[2], ops[3], #op) +#define GLSL_BFOP_CAST(op, type) \ + emit_binary_func_op_cast(ops[0], ops[1], ops[2], ops[3], #op, type, opcode_is_sign_invariant(opcode)) +#define GLSL_BFOP(op) emit_binary_func_op(ops[0], ops[1], ops[2], ops[3], #op) +#define GLSL_UFOP(op) emit_unary_func_op(ops[0], ops[1], ops[2], #op) + + // If we need to do implicit bitcasts, make sure we do it with the correct type. + uint32_t integer_width = get_integer_width_for_instruction(instruction); + auto int_type = to_signed_basetype(integer_width); + auto uint_type = to_unsigned_basetype(integer_width); + + // Handle C implicit integer promotion rules. + // If we get implicit promotion to int, need to make sure we cast by value to intended return type, + // otherwise, future sign-dependent operations and bitcasts will break. + bool implicit_integer_promotion = integer_width < 32 && backend.implicit_c_integer_promotion_rules && + opcode_can_promote_integer_implicitly(opcode) && + get(ops[0]).vecsize == 1; + + opcode = get_remapped_spirv_op(opcode); + + switch (opcode) + { + // Dealing with memory + case OpLoad: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t ptr = ops[2]; + + flush_variable_declaration(ptr); + + // If we're loading from memory that cannot be changed by the shader, + // just forward the expression directly to avoid needless temporaries. + // If an expression is mutable and forwardable, we speculate that it is immutable. + bool forward = should_forward(ptr) && forced_temporaries.find(id) == end(forced_temporaries); + + // If loading a non-native row-major matrix, mark the expression as need_transpose. + bool need_transpose = false; + bool old_need_transpose = false; + + auto *ptr_expression = maybe_get(ptr); + + if (forward) + { + // If we're forwarding the load, we're also going to forward transpose state, so don't transpose while + // taking the expression. + if (ptr_expression && ptr_expression->need_transpose) + { + old_need_transpose = true; + ptr_expression->need_transpose = false; + need_transpose = true; + } + else if (is_non_native_row_major_matrix(ptr)) + need_transpose = true; + } + + // If we are forwarding this load, + // don't register the read to access chain here, defer that to when we actually use the expression, + // using the add_implied_read_expression mechanism. + string expr; + + bool is_packed = has_extended_decoration(ptr, SPIRVCrossDecorationPhysicalTypePacked); + bool is_remapped = has_extended_decoration(ptr, SPIRVCrossDecorationPhysicalTypeID); + if (forward || (!is_packed && !is_remapped)) + { + // For the simple case, we do not need to deal with repacking. + expr = to_dereferenced_expression(ptr, false); + } + else + { + // If we are not forwarding the expression, we need to unpack and resolve any physical type remapping here before + // storing the expression to a temporary. + expr = to_unpacked_expression(ptr); + } + + auto &type = get(result_type); + auto &expr_type = expression_type(ptr); + + // If the expression has more vector components than the result type, insert + // a swizzle. This shouldn't happen normally on valid SPIR-V, but it might + // happen with e.g. the MSL backend replacing the type of an input variable. + if (expr_type.vecsize > type.vecsize) + expr = enclose_expression(expr + vector_swizzle(type.vecsize, 0)); + + if (forward && ptr_expression) + ptr_expression->need_transpose = old_need_transpose; + + // We might need to cast in order to load from a builtin. + cast_from_variable_load(ptr, expr, type); + + if (forward && ptr_expression) + ptr_expression->need_transpose = false; + + // We might be trying to load a gl_Position[N], where we should be + // doing float4[](gl_in[i].gl_Position, ...) instead. + // Similar workarounds are required for input arrays in tessellation. + // Also, loading from gl_SampleMask array needs special unroll. + unroll_array_from_complex_load(id, ptr, expr); + + if (!type_is_opaque_value(type) && has_decoration(ptr, DecorationNonUniform)) + { + // If we're loading something non-opaque, we need to handle non-uniform descriptor access. + convert_non_uniform_expression(expr, ptr); + } + + if (forward && ptr_expression) + ptr_expression->need_transpose = old_need_transpose; + + bool flattened = ptr_expression && flattened_buffer_blocks.count(ptr_expression->loaded_from) != 0; + + if (backend.needs_row_major_load_workaround && !is_non_native_row_major_matrix(ptr) && !flattened) + rewrite_load_for_wrapped_row_major(expr, result_type, ptr); + + // By default, suppress usage tracking since using same expression multiple times does not imply any extra work. + // However, if we try to load a complex, composite object from a flattened buffer, + // we should avoid emitting the same code over and over and lower the result to a temporary. + bool usage_tracking = flattened && (type.basetype == SPIRType::Struct || (type.columns > 1)); + + SPIRExpression *e = nullptr; + if (!forward && expression_is_non_value_type_array(ptr)) + { + // Complicated load case where we need to make a copy of ptr, but we cannot, because + // it is an array, and our backend does not support arrays as value types. + // Emit the temporary, and copy it explicitly. + e = &emit_uninitialized_temporary_expression(result_type, id); + emit_array_copy(nullptr, id, ptr, StorageClassFunction, get_expression_effective_storage_class(ptr)); + } + else + e = &emit_op(result_type, id, expr, forward, !usage_tracking); + + e->need_transpose = need_transpose; + register_read(id, ptr, forward); + + if (forward) + { + // Pass through whether the result is of a packed type and the physical type ID. + if (has_extended_decoration(ptr, SPIRVCrossDecorationPhysicalTypePacked)) + set_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + if (has_extended_decoration(ptr, SPIRVCrossDecorationPhysicalTypeID)) + { + set_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID, + get_extended_decoration(ptr, SPIRVCrossDecorationPhysicalTypeID)); + } + } + else + { + // This might have been set on an earlier compilation iteration, force it to be unset. + unset_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + unset_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID); + } + + inherit_expression_dependencies(id, ptr); + if (forward) + add_implied_read_expression(*e, ptr); + break; + } + + case OpInBoundsAccessChain: + case OpAccessChain: + case OpPtrAccessChain: + { + auto *var = maybe_get(ops[2]); + if (var) + flush_variable_declaration(var->self); + + // If the base is immutable, the access chain pointer must also be. + // If an expression is mutable and forwardable, we speculate that it is immutable. + AccessChainMeta meta; + bool ptr_chain = opcode == OpPtrAccessChain; + auto &target_type = get(ops[0]); + auto e = access_chain(ops[2], &ops[3], length - 3, target_type, &meta, ptr_chain); + + // If the base is flattened UBO of struct type, the expression has to be a composite. + // In that case, backends which do not support inline syntax need it to be bound to a temporary. + // Otherwise, invalid expressions like ({UBO[0].xyz, UBO[0].w, UBO[1]}).member are emitted. + bool requires_temporary = false; + if (flattened_buffer_blocks.count(ops[2]) && target_type.basetype == SPIRType::Struct) + requires_temporary = !backend.can_declare_struct_inline; + + auto &expr = requires_temporary ? + emit_op(ops[0], ops[1], std::move(e), false) : + set(ops[1], std::move(e), ops[0], should_forward(ops[2])); + + auto *backing_variable = maybe_get_backing_variable(ops[2]); + expr.loaded_from = backing_variable ? backing_variable->self : ID(ops[2]); + expr.need_transpose = meta.need_transpose; + expr.access_chain = true; + + // Mark the result as being packed. Some platforms handled packed vectors differently than non-packed. + if (meta.storage_is_packed) + set_extended_decoration(ops[1], SPIRVCrossDecorationPhysicalTypePacked); + if (meta.storage_physical_type != 0) + set_extended_decoration(ops[1], SPIRVCrossDecorationPhysicalTypeID, meta.storage_physical_type); + if (meta.storage_is_invariant) + set_decoration(ops[1], DecorationInvariant); + if (meta.flattened_struct) + flattened_structs[ops[1]] = true; + if (meta.relaxed_precision && backend.requires_relaxed_precision_analysis) + set_decoration(ops[1], DecorationRelaxedPrecision); + + // If we have some expression dependencies in our access chain, this access chain is technically a forwarded + // temporary which could be subject to invalidation. + // Need to assume we're forwarded while calling inherit_expression_depdendencies. + forwarded_temporaries.insert(ops[1]); + // The access chain itself is never forced to a temporary, but its dependencies might. + suppressed_usage_tracking.insert(ops[1]); + + for (uint32_t i = 2; i < length; i++) + { + inherit_expression_dependencies(ops[1], ops[i]); + add_implied_read_expression(expr, ops[i]); + } + + // If we have no dependencies after all, i.e., all indices in the access chain are immutable temporaries, + // we're not forwarded after all. + if (expr.expression_dependencies.empty()) + forwarded_temporaries.erase(ops[1]); + + break; + } + + case OpStore: + { + auto *var = maybe_get(ops[0]); + + if (var && var->statically_assigned) + var->static_expression = ops[1]; + else if (var && var->loop_variable && !var->loop_variable_enable) + var->static_expression = ops[1]; + else if (var && var->remapped_variable && var->static_expression) + { + // Skip the write. + } + else if (flattened_structs.count(ops[0])) + { + store_flattened_struct(ops[0], ops[1]); + register_write(ops[0]); + } + else + { + emit_store_statement(ops[0], ops[1]); + } + + // Storing a pointer results in a variable pointer, so we must conservatively assume + // we can write through it. + if (expression_type(ops[1]).pointer) + register_write(ops[1]); + break; + } + + case OpArrayLength: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + auto e = access_chain_internal(ops[2], &ops[3], length - 3, ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + if (has_decoration(ops[2], DecorationNonUniform)) + convert_non_uniform_expression(e, ops[2]); + set(id, join(type_to_glsl(get(result_type)), "(", e, ".length())"), result_type, + true); + break; + } + + // Function calls + case OpFunctionCall: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t func = ops[2]; + const auto *arg = &ops[3]; + length -= 3; + + auto &callee = get(func); + auto &return_type = get(callee.return_type); + bool pure = function_is_pure(callee); + + bool callee_has_out_variables = false; + bool emit_return_value_as_argument = false; + + // Invalidate out variables passed to functions since they can be OpStore'd to. + for (uint32_t i = 0; i < length; i++) + { + if (callee.arguments[i].write_count) + { + register_call_out_argument(arg[i]); + callee_has_out_variables = true; + } + + flush_variable_declaration(arg[i]); + } + + if (!return_type.array.empty() && !backend.can_return_array) + { + callee_has_out_variables = true; + emit_return_value_as_argument = true; + } + + if (!pure) + register_impure_function_call(); + + string funexpr; + SmallVector arglist; + funexpr += to_name(func) + "("; + + if (emit_return_value_as_argument) + { + statement(type_to_glsl(return_type), " ", to_name(id), type_to_array_glsl(return_type), ";"); + arglist.push_back(to_name(id)); + } + + for (uint32_t i = 0; i < length; i++) + { + // Do not pass in separate images or samplers if we're remapping + // to combined image samplers. + if (skip_argument(arg[i])) + continue; + + arglist.push_back(to_func_call_arg(callee.arguments[i], arg[i])); + } + + for (auto &combined : callee.combined_parameters) + { + auto image_id = combined.global_image ? combined.image_id : VariableID(arg[combined.image_id]); + auto sampler_id = combined.global_sampler ? combined.sampler_id : VariableID(arg[combined.sampler_id]); + arglist.push_back(to_combined_image_sampler(image_id, sampler_id)); + } + + append_global_func_args(callee, length, arglist); + + funexpr += merge(arglist); + funexpr += ")"; + + // Check for function call constraints. + check_function_call_constraints(arg, length); + + if (return_type.basetype != SPIRType::Void) + { + // If the function actually writes to an out variable, + // take the conservative route and do not forward. + // The problem is that we might not read the function + // result (and emit the function) before an out variable + // is read (common case when return value is ignored! + // In order to avoid start tracking invalid variables, + // just avoid the forwarding problem altogether. + bool forward = args_will_forward(id, arg, length, pure) && !callee_has_out_variables && pure && + (forced_temporaries.find(id) == end(forced_temporaries)); + + if (emit_return_value_as_argument) + { + statement(funexpr, ";"); + set(id, to_name(id), result_type, true); + } + else + emit_op(result_type, id, funexpr, forward); + + // Function calls are implicit loads from all variables in question. + // Set dependencies for them. + for (uint32_t i = 0; i < length; i++) + register_read(id, arg[i], forward); + + // If we're going to forward the temporary result, + // put dependencies on every variable that must not change. + if (forward) + register_global_read_dependencies(callee, id); + } + else + statement(funexpr, ";"); + + break; + } + + // Composite munging + case OpCompositeConstruct: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + const auto *const elems = &ops[2]; + length -= 2; + + bool forward = true; + for (uint32_t i = 0; i < length; i++) + forward = forward && should_forward(elems[i]); + + auto &out_type = get(result_type); + auto *in_type = length > 0 ? &expression_type(elems[0]) : nullptr; + + // Only splat if we have vector constructors. + // Arrays and structs must be initialized properly in full. + bool composite = !out_type.array.empty() || out_type.basetype == SPIRType::Struct; + + bool splat = false; + bool swizzle_splat = false; + + if (in_type) + { + splat = in_type->vecsize == 1 && in_type->columns == 1 && !composite && backend.use_constructor_splatting; + swizzle_splat = in_type->vecsize == 1 && in_type->columns == 1 && backend.can_swizzle_scalar; + + if (ir.ids[elems[0]].get_type() == TypeConstant && !type_is_floating_point(*in_type)) + { + // Cannot swizzle literal integers as a special case. + swizzle_splat = false; + } + } + + if (splat || swizzle_splat) + { + uint32_t input = elems[0]; + for (uint32_t i = 0; i < length; i++) + { + if (input != elems[i]) + { + splat = false; + swizzle_splat = false; + } + } + } + + if (out_type.basetype == SPIRType::Struct && !backend.can_declare_struct_inline) + forward = false; + if (!out_type.array.empty() && !backend.can_declare_arrays_inline) + forward = false; + if (type_is_empty(out_type) && !backend.supports_empty_struct) + forward = false; + + string constructor_op; + if (backend.use_initializer_list && composite) + { + bool needs_trailing_tracket = false; + // Only use this path if we are building composites. + // This path cannot be used for arithmetic. + if (backend.use_typed_initializer_list && out_type.basetype == SPIRType::Struct && out_type.array.empty()) + constructor_op += type_to_glsl_constructor(get(result_type)); + else if (backend.use_typed_initializer_list && backend.array_is_value_type && !out_type.array.empty()) + { + // MSL path. Array constructor is baked into type here, do not use _constructor variant. + constructor_op += type_to_glsl_constructor(get(result_type)) + "("; + needs_trailing_tracket = true; + } + constructor_op += "{ "; + + if (type_is_empty(out_type) && !backend.supports_empty_struct) + constructor_op += "0"; + else if (splat) + constructor_op += to_unpacked_expression(elems[0]); + else + constructor_op += build_composite_combiner(result_type, elems, length); + constructor_op += " }"; + if (needs_trailing_tracket) + constructor_op += ")"; + } + else if (swizzle_splat && !composite) + { + constructor_op = remap_swizzle(get(result_type), 1, to_unpacked_expression(elems[0])); + } + else + { + constructor_op = type_to_glsl_constructor(get(result_type)) + "("; + if (type_is_empty(out_type) && !backend.supports_empty_struct) + constructor_op += "0"; + else if (splat) + constructor_op += to_unpacked_expression(elems[0]); + else + constructor_op += build_composite_combiner(result_type, elems, length); + constructor_op += ")"; + } + + if (!constructor_op.empty()) + { + emit_op(result_type, id, constructor_op, forward); + for (uint32_t i = 0; i < length; i++) + inherit_expression_dependencies(id, elems[i]); + } + break; + } + + case OpVectorInsertDynamic: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t vec = ops[2]; + uint32_t comp = ops[3]; + uint32_t index = ops[4]; + + flush_variable_declaration(vec); + + // Make a copy, then use access chain to store the variable. + statement(declare_temporary(result_type, id), to_expression(vec), ";"); + set(id, to_name(id), result_type, true); + auto chain = access_chain_internal(id, &index, 1, 0, nullptr); + statement(chain, " = ", to_unpacked_expression(comp), ";"); + break; + } + + case OpVectorExtractDynamic: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + auto expr = access_chain_internal(ops[2], &ops[3], 1, 0, nullptr); + emit_op(result_type, id, expr, should_forward(ops[2])); + inherit_expression_dependencies(id, ops[2]); + inherit_expression_dependencies(id, ops[3]); + break; + } + + case OpCompositeExtract: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + length -= 3; + + auto &type = get(result_type); + + // We can only split the expression here if our expression is forwarded as a temporary. + bool allow_base_expression = forced_temporaries.find(id) == end(forced_temporaries); + + // Do not allow base expression for struct members. We risk doing "swizzle" optimizations in this case. + auto &composite_type = expression_type(ops[2]); + bool composite_type_is_complex = composite_type.basetype == SPIRType::Struct || !composite_type.array.empty(); + if (composite_type_is_complex) + allow_base_expression = false; + + // Packed expressions or physical ID mapped expressions cannot be split up. + if (has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypePacked) || + has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypeID)) + allow_base_expression = false; + + // Cannot use base expression for row-major matrix row-extraction since we need to interleave access pattern + // into the base expression. + if (is_non_native_row_major_matrix(ops[2])) + allow_base_expression = false; + + AccessChainMeta meta; + SPIRExpression *e = nullptr; + auto *c = maybe_get(ops[2]); + + if (c && !c->specialization && !composite_type_is_complex) + { + auto expr = to_extract_constant_composite_expression(result_type, *c, ops + 3, length); + e = &emit_op(result_type, id, expr, true, true); + } + else if (allow_base_expression && should_forward(ops[2]) && type.vecsize == 1 && type.columns == 1 && length == 1) + { + // Only apply this optimization if result is scalar. + + // We want to split the access chain from the base. + // This is so we can later combine different CompositeExtract results + // with CompositeConstruct without emitting code like + // + // vec3 temp = texture(...).xyz + // vec4(temp.x, temp.y, temp.z, 1.0). + // + // when we actually wanted to emit this + // vec4(texture(...).xyz, 1.0). + // + // Including the base will prevent this and would trigger multiple reads + // from expression causing it to be forced to an actual temporary in GLSL. + auto expr = access_chain_internal(ops[2], &ops[3], length, + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT | ACCESS_CHAIN_CHAIN_ONLY_BIT | + ACCESS_CHAIN_FORCE_COMPOSITE_BIT, &meta); + e = &emit_op(result_type, id, expr, true, should_suppress_usage_tracking(ops[2])); + inherit_expression_dependencies(id, ops[2]); + e->base_expression = ops[2]; + + if (meta.relaxed_precision && backend.requires_relaxed_precision_analysis) + set_decoration(ops[1], DecorationRelaxedPrecision); + } + else + { + auto expr = access_chain_internal(ops[2], &ops[3], length, + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT | ACCESS_CHAIN_FORCE_COMPOSITE_BIT, &meta); + e = &emit_op(result_type, id, expr, should_forward(ops[2]), should_suppress_usage_tracking(ops[2])); + inherit_expression_dependencies(id, ops[2]); + } + + // Pass through some meta information to the loaded expression. + // We can still end up loading a buffer type to a variable, then CompositeExtract from it + // instead of loading everything through an access chain. + e->need_transpose = meta.need_transpose; + if (meta.storage_is_packed) + set_extended_decoration(id, SPIRVCrossDecorationPhysicalTypePacked); + if (meta.storage_physical_type != 0) + set_extended_decoration(id, SPIRVCrossDecorationPhysicalTypeID, meta.storage_physical_type); + if (meta.storage_is_invariant) + set_decoration(id, DecorationInvariant); + + break; + } + + case OpCompositeInsert: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t obj = ops[2]; + uint32_t composite = ops[3]; + const auto *elems = &ops[4]; + length -= 4; + + flush_variable_declaration(composite); + + // CompositeInsert requires a copy + modification, but this is very awkward code in HLL. + // Speculate that the input composite is no longer used, and we can modify it in-place. + // There are various scenarios where this is not possible to satisfy. + bool can_modify_in_place = true; + forced_temporaries.insert(id); + + // Cannot safely RMW PHI variables since they have no way to be invalidated, + // forcing temporaries is not going to help. + // This is similar for Constant and Undef inputs. + // The only safe thing to RMW is SPIRExpression. + // If the expression has already been used (i.e. used in a continue block), we have to keep using + // that loop variable, since we won't be able to override the expression after the fact. + // If the composite is hoisted, we might never be able to properly invalidate any usage + // of that composite in a subsequent loop iteration. + if (invalid_expressions.count(composite) || + block_composite_insert_overwrite.count(composite) || + hoisted_temporaries.count(id) || hoisted_temporaries.count(composite) || + maybe_get(composite) == nullptr) + { + can_modify_in_place = false; + } + else if (backend.requires_relaxed_precision_analysis && + has_decoration(composite, DecorationRelaxedPrecision) != + has_decoration(id, DecorationRelaxedPrecision) && + get(result_type).basetype != SPIRType::Struct) + { + // Similarly, if precision does not match for input and output, + // we cannot alias them. If we write a composite into a relaxed precision + // ID, we might get a false truncation. + can_modify_in_place = false; + } + + if (can_modify_in_place) + { + // Have to make sure the modified SSA value is bound to a temporary so we can modify it in-place. + if (!forced_temporaries.count(composite)) + force_temporary_and_recompile(composite); + + auto chain = access_chain_internal(composite, elems, length, ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + statement(chain, " = ", to_unpacked_expression(obj), ";"); + set(id, to_expression(composite), result_type, true); + invalid_expressions.insert(composite); + composite_insert_overwritten.insert(composite); + } + else + { + if (maybe_get(composite) != nullptr) + { + emit_uninitialized_temporary_expression(result_type, id); + } + else + { + // Make a copy, then use access chain to store the variable. + statement(declare_temporary(result_type, id), to_expression(composite), ";"); + set(id, to_name(id), result_type, true); + } + + auto chain = access_chain_internal(id, elems, length, ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, nullptr); + statement(chain, " = ", to_unpacked_expression(obj), ";"); + } + + break; + } + + case OpCopyMemory: + { + uint32_t lhs = ops[0]; + uint32_t rhs = ops[1]; + if (lhs != rhs) + { + uint32_t &tmp_id = extra_sub_expressions[instruction.offset | EXTRA_SUB_EXPRESSION_TYPE_STREAM_OFFSET]; + if (!tmp_id) + tmp_id = ir.increase_bound_by(1); + uint32_t tmp_type_id = expression_type(rhs).parent_type; + + EmbeddedInstruction fake_load, fake_store; + fake_load.op = OpLoad; + fake_load.length = 3; + fake_load.ops.push_back(tmp_type_id); + fake_load.ops.push_back(tmp_id); + fake_load.ops.push_back(rhs); + + fake_store.op = OpStore; + fake_store.length = 2; + fake_store.ops.push_back(lhs); + fake_store.ops.push_back(tmp_id); + + // Load and Store do a *lot* of workarounds, and we'd like to reuse them as much as possible. + // Synthesize a fake Load and Store pair for CopyMemory. + emit_instruction(fake_load); + emit_instruction(fake_store); + } + break; + } + + case OpCopyLogical: + { + // This is used for copying object of different types, arrays and structs. + // We need to unroll the copy, element-by-element. + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t rhs = ops[2]; + + emit_uninitialized_temporary_expression(result_type, id); + emit_copy_logical_type(id, result_type, rhs, expression_type_id(rhs), {}); + break; + } + + case OpCopyObject: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t rhs = ops[2]; + bool pointer = get(result_type).pointer; + + auto *chain = maybe_get(rhs); + auto *imgsamp = maybe_get(rhs); + if (chain) + { + // Cannot lower to a SPIRExpression, just copy the object. + auto &e = set(id, *chain); + e.self = id; + } + else if (imgsamp) + { + // Cannot lower to a SPIRExpression, just copy the object. + // GLSL does not currently use this type and will never get here, but MSL does. + // Handled here instead of CompilerMSL for better integration and general handling, + // and in case GLSL or other subclasses require it in the future. + auto &e = set(id, *imgsamp); + e.self = id; + } + else if (expression_is_lvalue(rhs) && !pointer) + { + // Need a copy. + // For pointer types, we copy the pointer itself. + emit_op(result_type, id, to_unpacked_expression(rhs), false); + } + else + { + // RHS expression is immutable, so just forward it. + // Copying these things really make no sense, but + // seems to be allowed anyways. + auto &e = emit_op(result_type, id, to_expression(rhs), true, true); + if (pointer) + { + auto *var = maybe_get_backing_variable(rhs); + e.loaded_from = var ? var->self : ID(0); + } + + // If we're copying an access chain, need to inherit the read expressions. + auto *rhs_expr = maybe_get(rhs); + if (rhs_expr) + { + e.implied_read_expressions = rhs_expr->implied_read_expressions; + e.expression_dependencies = rhs_expr->expression_dependencies; + } + } + break; + } + + case OpVectorShuffle: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t vec0 = ops[2]; + uint32_t vec1 = ops[3]; + const auto *elems = &ops[4]; + length -= 4; + + auto &type0 = expression_type(vec0); + + // If we have the undefined swizzle index -1, we need to swizzle in undefined data, + // or in our case, T(0). + bool shuffle = false; + for (uint32_t i = 0; i < length; i++) + if (elems[i] >= type0.vecsize || elems[i] == 0xffffffffu) + shuffle = true; + + // Cannot use swizzles with packed expressions, force shuffle path. + if (!shuffle && has_extended_decoration(vec0, SPIRVCrossDecorationPhysicalTypePacked)) + shuffle = true; + + string expr; + bool should_fwd, trivial_forward; + + if (shuffle) + { + should_fwd = should_forward(vec0) && should_forward(vec1); + trivial_forward = should_suppress_usage_tracking(vec0) && should_suppress_usage_tracking(vec1); + + // Constructor style and shuffling from two different vectors. + SmallVector args; + for (uint32_t i = 0; i < length; i++) + { + if (elems[i] == 0xffffffffu) + { + // Use a constant 0 here. + // We could use the first component or similar, but then we risk propagating + // a value we might not need, and bog down codegen. + SPIRConstant c; + c.constant_type = type0.parent_type; + assert(type0.parent_type != ID(0)); + args.push_back(constant_expression(c)); + } + else if (elems[i] >= type0.vecsize) + args.push_back(to_extract_component_expression(vec1, elems[i] - type0.vecsize)); + else + args.push_back(to_extract_component_expression(vec0, elems[i])); + } + expr += join(type_to_glsl_constructor(get(result_type)), "(", merge(args), ")"); + } + else + { + should_fwd = should_forward(vec0); + trivial_forward = should_suppress_usage_tracking(vec0); + + // We only source from first vector, so can use swizzle. + // If the vector is packed, unpack it before applying a swizzle (needed for MSL) + expr += to_enclosed_unpacked_expression(vec0); + expr += "."; + for (uint32_t i = 0; i < length; i++) + { + assert(elems[i] != 0xffffffffu); + expr += index_to_swizzle(elems[i]); + } + + if (backend.swizzle_is_function && length > 1) + expr += "()"; + } + + // A shuffle is trivial in that it doesn't actually *do* anything. + // We inherit the forwardedness from our arguments to avoid flushing out to temporaries when it's not really needed. + + emit_op(result_type, id, expr, should_fwd, trivial_forward); + + inherit_expression_dependencies(id, vec0); + if (vec0 != vec1) + inherit_expression_dependencies(id, vec1); + break; + } + + // ALU + case OpIsNan: + if (!is_legacy()) + GLSL_UFOP(isnan); + else + { + // Check if the number doesn't equal itself + auto &type = get(ops[0]); + if (type.vecsize > 1) + emit_binary_func_op(ops[0], ops[1], ops[2], ops[2], "notEqual"); + else + emit_binary_op(ops[0], ops[1], ops[2], ops[2], "!="); + } + break; + + case OpIsInf: + if (!is_legacy()) + GLSL_UFOP(isinf); + else + { + // inf * 2 == inf by IEEE 754 rules, note this also applies to 0.0 + // This is more reliable than checking if product with zero is NaN + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t operand = ops[2]; + + auto &type = get(result_type); + std::string expr; + if (type.vecsize > 1) + { + expr = type_to_glsl_constructor(type); + expr += '('; + for (uint32_t i = 0; i < type.vecsize; i++) + { + auto comp = to_extract_component_expression(operand, i); + expr += join(comp, " != 0.0 && 2.0 * ", comp, " == ", comp); + + if (i + 1 < type.vecsize) + expr += ", "; + } + expr += ')'; + } + else + { + // Register an extra read to force writing out a temporary + auto oper = to_enclosed_expression(operand); + track_expression_read(operand); + expr += join(oper, " != 0.0 && 2.0 * ", oper, " == ", oper); + } + emit_op(result_type, result_id, expr, should_forward(operand)); + + inherit_expression_dependencies(result_id, operand); + } + break; + + case OpSNegate: + if (implicit_integer_promotion || expression_type_id(ops[2]) != ops[0]) + GLSL_UOP_CAST(-); + else + GLSL_UOP(-); + break; + + case OpFNegate: + GLSL_UOP(-); + break; + + case OpIAdd: + { + // For simple arith ops, prefer the output type if there's a mismatch to avoid extra bitcasts. + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(+, type); + break; + } + + case OpFAdd: + GLSL_BOP(+); + break; + + case OpISub: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(-, type); + break; + } + + case OpFSub: + GLSL_BOP(-); + break; + + case OpIMul: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(*, type); + break; + } + + case OpVectorTimesMatrix: + case OpMatrixTimesVector: + { + // If the matrix needs transpose, just flip the multiply order. + auto *e = maybe_get(ops[opcode == OpMatrixTimesVector ? 2 : 3]); + if (e && e->need_transpose) + { + e->need_transpose = false; + string expr; + + if (opcode == OpMatrixTimesVector) + expr = join(to_enclosed_unpacked_expression(ops[3]), " * ", + enclose_expression(to_unpacked_row_major_matrix_expression(ops[2]))); + else + expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[3])), " * ", + to_enclosed_unpacked_expression(ops[2])); + + bool forward = should_forward(ops[2]) && should_forward(ops[3]); + emit_op(ops[0], ops[1], expr, forward); + e->need_transpose = true; + inherit_expression_dependencies(ops[1], ops[2]); + inherit_expression_dependencies(ops[1], ops[3]); + } + else + GLSL_BOP(*); + break; + } + + case OpMatrixTimesMatrix: + { + auto *a = maybe_get(ops[2]); + auto *b = maybe_get(ops[3]); + + // If both matrices need transpose, we can multiply in flipped order and tag the expression as transposed. + // a^T * b^T = (b * a)^T. + if (a && b && a->need_transpose && b->need_transpose) + { + a->need_transpose = false; + b->need_transpose = false; + auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[3])), " * ", + enclose_expression(to_unpacked_row_major_matrix_expression(ops[2]))); + bool forward = should_forward(ops[2]) && should_forward(ops[3]); + auto &e = emit_op(ops[0], ops[1], expr, forward); + e.need_transpose = true; + a->need_transpose = true; + b->need_transpose = true; + inherit_expression_dependencies(ops[1], ops[2]); + inherit_expression_dependencies(ops[1], ops[3]); + } + else + GLSL_BOP(*); + + break; + } + + case OpMatrixTimesScalar: + { + auto *a = maybe_get(ops[2]); + + // If the matrix need transpose, just mark the result as needing so. + if (a && a->need_transpose) + { + a->need_transpose = false; + auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), " * ", + to_enclosed_unpacked_expression(ops[3])); + bool forward = should_forward(ops[2]) && should_forward(ops[3]); + auto &e = emit_op(ops[0], ops[1], expr, forward); + e.need_transpose = true; + a->need_transpose = true; + inherit_expression_dependencies(ops[1], ops[2]); + inherit_expression_dependencies(ops[1], ops[3]); + } + else + GLSL_BOP(*); + break; + } + + case OpFMul: + case OpVectorTimesScalar: + GLSL_BOP(*); + break; + + case OpOuterProduct: + if (options.version < 120) // Matches GLSL 1.10 / ESSL 1.00 + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t a = ops[2]; + uint32_t b = ops[3]; + + auto &type = get(result_type); + string expr = type_to_glsl_constructor(type); + expr += "("; + for (uint32_t col = 0; col < type.columns; col++) + { + expr += to_enclosed_expression(a); + expr += " * "; + expr += to_extract_component_expression(b, col); + if (col + 1 < type.columns) + expr += ", "; + } + expr += ")"; + emit_op(result_type, id, expr, should_forward(a) && should_forward(b)); + inherit_expression_dependencies(id, a); + inherit_expression_dependencies(id, b); + } + else + GLSL_BFOP(outerProduct); + break; + + case OpDot: + GLSL_BFOP(dot); + break; + + case OpTranspose: + if (options.version < 120) // Matches GLSL 1.10 / ESSL 1.00 + { + // transpose() is not available, so instead, flip need_transpose, + // which can later be turned into an emulated transpose op by + // convert_row_major_matrix(), if necessary. + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t input = ops[2]; + + // Force need_transpose to false temporarily to prevent + // to_expression() from doing the transpose. + bool need_transpose = false; + auto *input_e = maybe_get(input); + if (input_e) + swap(need_transpose, input_e->need_transpose); + + bool forward = should_forward(input); + auto &e = emit_op(result_type, result_id, to_expression(input), forward); + e.need_transpose = !need_transpose; + + // Restore the old need_transpose flag. + if (input_e) + input_e->need_transpose = need_transpose; + } + else + GLSL_UFOP(transpose); + break; + + case OpSRem: + { + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t op0 = ops[2]; + uint32_t op1 = ops[3]; + + // Needs special handling. + bool forward = should_forward(op0) && should_forward(op1); + auto expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + + if (implicit_integer_promotion) + expr = join(type_to_glsl(get(result_type)), '(', expr, ')'); + + emit_op(result_type, result_id, expr, forward); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + break; + } + + case OpSDiv: + GLSL_BOP_CAST(/, int_type); + break; + + case OpUDiv: + GLSL_BOP_CAST(/, uint_type); + break; + + case OpIAddCarry: + case OpISubBorrow: + { + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("Extended arithmetic is only available from ESSL 310."); + else if (!options.es && options.version < 400) + SPIRV_CROSS_THROW("Extended arithmetic is only available from GLSL 400."); + + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t op0 = ops[2]; + uint32_t op1 = ops[3]; + auto &type = get(result_type); + emit_uninitialized_temporary_expression(result_type, result_id); + const char *op = opcode == OpIAddCarry ? "uaddCarry" : "usubBorrow"; + + statement(to_expression(result_id), ".", to_member_name(type, 0), " = ", op, "(", to_expression(op0), ", ", + to_expression(op1), ", ", to_expression(result_id), ".", to_member_name(type, 1), ");"); + break; + } + + case OpUMulExtended: + case OpSMulExtended: + { + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("Extended arithmetic is only available from ESSL 310."); + else if (!options.es && options.version < 400) + SPIRV_CROSS_THROW("Extended arithmetic is only available from GLSL 4000."); + + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t op0 = ops[2]; + uint32_t op1 = ops[3]; + auto &type = get(result_type); + emit_uninitialized_temporary_expression(result_type, result_id); + const char *op = opcode == OpUMulExtended ? "umulExtended" : "imulExtended"; + + statement(op, "(", to_expression(op0), ", ", to_expression(op1), ", ", to_expression(result_id), ".", + to_member_name(type, 1), ", ", to_expression(result_id), ".", to_member_name(type, 0), ");"); + break; + } + + case OpFDiv: + GLSL_BOP(/); + break; + + case OpShiftRightLogical: + GLSL_BOP_CAST(>>, uint_type); + break; + + case OpShiftRightArithmetic: + GLSL_BOP_CAST(>>, int_type); + break; + + case OpShiftLeftLogical: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(<<, type); + break; + } + + case OpBitwiseOr: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(|, type); + break; + } + + case OpBitwiseXor: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(^, type); + break; + } + + case OpBitwiseAnd: + { + auto type = get(ops[0]).basetype; + GLSL_BOP_CAST(&, type); + break; + } + + case OpNot: + if (implicit_integer_promotion || expression_type_id(ops[2]) != ops[0]) + GLSL_UOP_CAST(~); + else + GLSL_UOP(~); + break; + + case OpUMod: + GLSL_BOP_CAST(%, uint_type); + break; + + case OpSMod: + GLSL_BOP_CAST(%, int_type); + break; + + case OpFMod: + GLSL_BFOP(mod); + break; + + case OpFRem: + { + uint32_t result_type = ops[0]; + uint32_t result_id = ops[1]; + uint32_t op0 = ops[2]; + uint32_t op1 = ops[3]; + + // Needs special handling. + bool forward = should_forward(op0) && should_forward(op1); + std::string expr; + if (!is_legacy()) + { + expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", "trunc(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), ")"); + } + else + { + // Legacy GLSL has no trunc, emulate by casting to int and back + auto &op0_type = expression_type(op0); + auto via_type = op0_type; + via_type.basetype = SPIRType::Int; + expr = join(to_enclosed_expression(op0), " - ", to_enclosed_expression(op1), " * ", + type_to_glsl(op0_type), "(", type_to_glsl(via_type), "(", + to_enclosed_expression(op0), " / ", to_enclosed_expression(op1), "))"); + } + + emit_op(result_type, result_id, expr, forward); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + break; + } + + // Relational + case OpAny: + GLSL_UFOP(any); + break; + + case OpAll: + GLSL_UFOP(all); + break; + + case OpSelect: + emit_mix_op(ops[0], ops[1], ops[4], ops[3], ops[2]); + break; + + case OpLogicalOr: + { + // No vector variant in GLSL for logical OR. + auto result_type = ops[0]; + auto id = ops[1]; + auto &type = get(result_type); + + if (type.vecsize > 1) + emit_unrolled_binary_op(result_type, id, ops[2], ops[3], "||", false, SPIRType::Unknown); + else + GLSL_BOP(||); + break; + } + + case OpLogicalAnd: + { + // No vector variant in GLSL for logical AND. + auto result_type = ops[0]; + auto id = ops[1]; + auto &type = get(result_type); + + if (type.vecsize > 1) + emit_unrolled_binary_op(result_type, id, ops[2], ops[3], "&&", false, SPIRType::Unknown); + else + GLSL_BOP(&&); + break; + } + + case OpLogicalNot: + { + auto &type = get(ops[0]); + if (type.vecsize > 1) + GLSL_UFOP(not ); + else + GLSL_UOP(!); + break; + } + + case OpIEqual: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(equal, int_type); + else + GLSL_BOP_CAST(==, int_type); + break; + } + + case OpLogicalEqual: + case OpFOrdEqual: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(equal); + else + GLSL_BOP(==); + break; + } + + case OpINotEqual: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(notEqual, int_type); + else + GLSL_BOP_CAST(!=, int_type); + break; + } + + case OpLogicalNotEqual: + case OpFOrdNotEqual: + case OpFUnordNotEqual: + { + // GLSL is fuzzy on what to do with ordered vs unordered not equal. + // glslang started emitting UnorderedNotEqual some time ago to harmonize with IEEE, + // but this means we have no easy way of implementing ordered not equal. + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(notEqual); + else + GLSL_BOP(!=); + break; + } + + case OpUGreaterThan: + case OpSGreaterThan: + { + auto type = opcode == OpUGreaterThan ? uint_type : int_type; + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(greaterThan, type); + else + GLSL_BOP_CAST(>, type); + break; + } + + case OpFOrdGreaterThan: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(greaterThan); + else + GLSL_BOP(>); + break; + } + + case OpUGreaterThanEqual: + case OpSGreaterThanEqual: + { + auto type = opcode == OpUGreaterThanEqual ? uint_type : int_type; + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(greaterThanEqual, type); + else + GLSL_BOP_CAST(>=, type); + break; + } + + case OpFOrdGreaterThanEqual: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(greaterThanEqual); + else + GLSL_BOP(>=); + break; + } + + case OpULessThan: + case OpSLessThan: + { + auto type = opcode == OpULessThan ? uint_type : int_type; + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(lessThan, type); + else + GLSL_BOP_CAST(<, type); + break; + } + + case OpFOrdLessThan: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(lessThan); + else + GLSL_BOP(<); + break; + } + + case OpULessThanEqual: + case OpSLessThanEqual: + { + auto type = opcode == OpULessThanEqual ? uint_type : int_type; + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP_CAST(lessThanEqual, type); + else + GLSL_BOP_CAST(<=, type); + break; + } + + case OpFOrdLessThanEqual: + { + if (expression_type(ops[2]).vecsize > 1) + GLSL_BFOP(lessThanEqual); + else + GLSL_BOP(<=); + break; + } + + // Conversion + case OpSConvert: + case OpConvertSToF: + case OpUConvert: + case OpConvertUToF: + { + auto input_type = opcode == OpSConvert || opcode == OpConvertSToF ? int_type : uint_type; + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + auto &type = get(result_type); + auto &arg_type = expression_type(ops[2]); + auto func = type_to_glsl_constructor(type); + + if (arg_type.width < type.width || type_is_floating_point(type)) + emit_unary_func_op_cast(result_type, id, ops[2], func.c_str(), input_type, type.basetype); + else + emit_unary_func_op(result_type, id, ops[2], func.c_str()); + break; + } + + case OpConvertFToU: + case OpConvertFToS: + { + // Cast to expected arithmetic type, then potentially bitcast away to desired signedness. + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + auto &type = get(result_type); + auto expected_type = type; + auto &float_type = expression_type(ops[2]); + expected_type.basetype = + opcode == OpConvertFToS ? to_signed_basetype(type.width) : to_unsigned_basetype(type.width); + + auto func = type_to_glsl_constructor(expected_type); + emit_unary_func_op_cast(result_type, id, ops[2], func.c_str(), float_type.basetype, expected_type.basetype); + break; + } + + case OpFConvert: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + auto func = type_to_glsl_constructor(get(result_type)); + emit_unary_func_op(result_type, id, ops[2], func.c_str()); + break; + } + + case OpBitcast: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t arg = ops[2]; + + if (!emit_complex_bitcast(result_type, id, arg)) + { + auto op = bitcast_glsl_op(get(result_type), expression_type(arg)); + emit_unary_func_op(result_type, id, arg, op.c_str()); + } + break; + } + + case OpQuantizeToF16: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t arg = ops[2]; + + string op; + auto &type = get(result_type); + + switch (type.vecsize) + { + case 1: + op = join("unpackHalf2x16(packHalf2x16(vec2(", to_expression(arg), "))).x"); + break; + case 2: + op = join("unpackHalf2x16(packHalf2x16(", to_expression(arg), "))"); + break; + case 3: + { + auto op0 = join("unpackHalf2x16(packHalf2x16(", to_expression(arg), ".xy))"); + auto op1 = join("unpackHalf2x16(packHalf2x16(", to_expression(arg), ".zz)).x"); + op = join("vec3(", op0, ", ", op1, ")"); + break; + } + case 4: + { + auto op0 = join("unpackHalf2x16(packHalf2x16(", to_expression(arg), ".xy))"); + auto op1 = join("unpackHalf2x16(packHalf2x16(", to_expression(arg), ".zw))"); + op = join("vec4(", op0, ", ", op1, ")"); + break; + } + default: + SPIRV_CROSS_THROW("Illegal argument to OpQuantizeToF16."); + } + + emit_op(result_type, id, op, should_forward(arg)); + inherit_expression_dependencies(id, arg); + break; + } + + // Derivatives + case OpDPdx: + GLSL_UFOP(dFdx); + if (is_legacy_es()) + require_extension_internal("GL_OES_standard_derivatives"); + register_control_dependent_expression(ops[1]); + break; + + case OpDPdy: + GLSL_UFOP(dFdy); + if (is_legacy_es()) + require_extension_internal("GL_OES_standard_derivatives"); + register_control_dependent_expression(ops[1]); + break; + + case OpDPdxFine: + GLSL_UFOP(dFdxFine); + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + case OpDPdyFine: + GLSL_UFOP(dFdyFine); + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + case OpDPdxCoarse: + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + GLSL_UFOP(dFdxCoarse); + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + case OpDPdyCoarse: + GLSL_UFOP(dFdyCoarse); + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + case OpFwidth: + GLSL_UFOP(fwidth); + if (is_legacy_es()) + require_extension_internal("GL_OES_standard_derivatives"); + register_control_dependent_expression(ops[1]); + break; + + case OpFwidthCoarse: + GLSL_UFOP(fwidthCoarse); + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + case OpFwidthFine: + GLSL_UFOP(fwidthFine); + if (options.es) + { + SPIRV_CROSS_THROW("GL_ARB_derivative_control is unavailable in OpenGL ES."); + } + if (options.version < 450) + require_extension_internal("GL_ARB_derivative_control"); + register_control_dependent_expression(ops[1]); + break; + + // Bitfield + case OpBitFieldInsert: + { + emit_bitfield_insert_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], "bitfieldInsert", SPIRType::Int); + break; + } + + case OpBitFieldSExtract: + { + emit_trinary_func_op_bitextract(ops[0], ops[1], ops[2], ops[3], ops[4], "bitfieldExtract", int_type, int_type, + SPIRType::Int, SPIRType::Int); + break; + } + + case OpBitFieldUExtract: + { + emit_trinary_func_op_bitextract(ops[0], ops[1], ops[2], ops[3], ops[4], "bitfieldExtract", uint_type, uint_type, + SPIRType::Int, SPIRType::Int); + break; + } + + case OpBitReverse: + // BitReverse does not have issues with sign since result type must match input type. + GLSL_UFOP(bitfieldReverse); + break; + + case OpBitCount: + { + auto basetype = expression_type(ops[2]).basetype; + emit_unary_func_op_cast(ops[0], ops[1], ops[2], "bitCount", basetype, int_type); + break; + } + + // Atomics + case OpAtomicExchange: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t ptr = ops[2]; + // Ignore semantics for now, probably only relevant to CL. + uint32_t val = ops[5]; + const char *op = check_atomic_image(ptr) ? "imageAtomicExchange" : "atomicExchange"; + + emit_atomic_func_op(result_type, id, ptr, val, op); + break; + } + + case OpAtomicCompareExchange: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t ptr = ops[2]; + uint32_t val = ops[6]; + uint32_t comp = ops[7]; + const char *op = check_atomic_image(ptr) ? "imageAtomicCompSwap" : "atomicCompSwap"; + + emit_atomic_func_op(result_type, id, ptr, comp, val, op); + break; + } + + case OpAtomicLoad: + { + // In plain GLSL, we have no atomic loads, so emulate this by fetch adding by 0 and hope compiler figures it out. + // Alternatively, we could rely on KHR_memory_model, but that's not very helpful for GL. + auto &type = expression_type(ops[2]); + forced_temporaries.insert(ops[1]); + bool atomic_image = check_atomic_image(ops[2]); + bool unsigned_type = (type.basetype == SPIRType::UInt) || + (atomic_image && get(type.image.type).basetype == SPIRType::UInt); + const char *op = atomic_image ? "imageAtomicAdd" : "atomicAdd"; + const char *increment = unsigned_type ? "0u" : "0"; + emit_op(ops[0], ops[1], + join(op, "(", + to_non_uniform_aware_expression(ops[2]), ", ", increment, ")"), false); + flush_all_atomic_capable_variables(); + break; + } + + case OpAtomicStore: + { + // In plain GLSL, we have no atomic stores, so emulate this with an atomic exchange where we don't consume the result. + // Alternatively, we could rely on KHR_memory_model, but that's not very helpful for GL. + uint32_t ptr = ops[0]; + // Ignore semantics for now, probably only relevant to CL. + uint32_t val = ops[3]; + const char *op = check_atomic_image(ptr) ? "imageAtomicExchange" : "atomicExchange"; + statement(op, "(", to_non_uniform_aware_expression(ptr), ", ", to_expression(val), ");"); + flush_all_atomic_capable_variables(); + break; + } + + case OpAtomicIIncrement: + case OpAtomicIDecrement: + { + forced_temporaries.insert(ops[1]); + auto &type = expression_type(ops[2]); + if (type.storage == StorageClassAtomicCounter) + { + // Legacy GLSL stuff, not sure if this is relevant to support. + if (opcode == OpAtomicIIncrement) + GLSL_UFOP(atomicCounterIncrement); + else + GLSL_UFOP(atomicCounterDecrement); + } + else + { + bool atomic_image = check_atomic_image(ops[2]); + bool unsigned_type = (type.basetype == SPIRType::UInt) || + (atomic_image && get(type.image.type).basetype == SPIRType::UInt); + const char *op = atomic_image ? "imageAtomicAdd" : "atomicAdd"; + + const char *increment = nullptr; + if (opcode == OpAtomicIIncrement && unsigned_type) + increment = "1u"; + else if (opcode == OpAtomicIIncrement) + increment = "1"; + else if (unsigned_type) + increment = "uint(-1)"; + else + increment = "-1"; + + emit_op(ops[0], ops[1], + join(op, "(", to_non_uniform_aware_expression(ops[2]), ", ", increment, ")"), false); + } + + flush_all_atomic_capable_variables(); + break; + } + + case OpAtomicIAdd: + case OpAtomicFAddEXT: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicAdd" : "atomicAdd"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + case OpAtomicISub: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicAdd" : "atomicAdd"; + forced_temporaries.insert(ops[1]); + auto expr = join(op, "(", to_non_uniform_aware_expression(ops[2]), ", -", to_enclosed_expression(ops[5]), ")"); + emit_op(ops[0], ops[1], expr, should_forward(ops[2]) && should_forward(ops[5])); + flush_all_atomic_capable_variables(); + break; + } + + case OpAtomicSMin: + case OpAtomicUMin: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicMin" : "atomicMin"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + case OpAtomicSMax: + case OpAtomicUMax: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicMax" : "atomicMax"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + case OpAtomicAnd: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicAnd" : "atomicAnd"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + case OpAtomicOr: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicOr" : "atomicOr"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + case OpAtomicXor: + { + const char *op = check_atomic_image(ops[2]) ? "imageAtomicXor" : "atomicXor"; + emit_atomic_func_op(ops[0], ops[1], ops[2], ops[5], op); + break; + } + + // Geometry shaders + case OpEmitVertex: + statement("EmitVertex();"); + break; + + case OpEndPrimitive: + statement("EndPrimitive();"); + break; + + case OpEmitStreamVertex: + { + if (options.es) + SPIRV_CROSS_THROW("Multi-stream geometry shaders not supported in ES."); + else if (!options.es && options.version < 400) + SPIRV_CROSS_THROW("Multi-stream geometry shaders only supported in GLSL 400."); + + auto stream_expr = to_expression(ops[0]); + if (expression_type(ops[0]).basetype != SPIRType::Int) + stream_expr = join("int(", stream_expr, ")"); + statement("EmitStreamVertex(", stream_expr, ");"); + break; + } + + case OpEndStreamPrimitive: + { + if (options.es) + SPIRV_CROSS_THROW("Multi-stream geometry shaders not supported in ES."); + else if (!options.es && options.version < 400) + SPIRV_CROSS_THROW("Multi-stream geometry shaders only supported in GLSL 400."); + + auto stream_expr = to_expression(ops[0]); + if (expression_type(ops[0]).basetype != SPIRType::Int) + stream_expr = join("int(", stream_expr, ")"); + statement("EndStreamPrimitive(", stream_expr, ");"); + break; + } + + // Textures + case OpImageSampleExplicitLod: + case OpImageSampleProjExplicitLod: + case OpImageSampleDrefExplicitLod: + case OpImageSampleProjDrefExplicitLod: + case OpImageSampleImplicitLod: + case OpImageSampleProjImplicitLod: + case OpImageSampleDrefImplicitLod: + case OpImageSampleProjDrefImplicitLod: + case OpImageFetch: + case OpImageGather: + case OpImageDrefGather: + // Gets a bit hairy, so move this to a separate instruction. + emit_texture_op(instruction, false); + break; + + case OpImageSparseSampleExplicitLod: + case OpImageSparseSampleProjExplicitLod: + case OpImageSparseSampleDrefExplicitLod: + case OpImageSparseSampleProjDrefExplicitLod: + case OpImageSparseSampleImplicitLod: + case OpImageSparseSampleProjImplicitLod: + case OpImageSparseSampleDrefImplicitLod: + case OpImageSparseSampleProjDrefImplicitLod: + case OpImageSparseFetch: + case OpImageSparseGather: + case OpImageSparseDrefGather: + // Gets a bit hairy, so move this to a separate instruction. + emit_texture_op(instruction, true); + break; + + case OpImageSparseTexelsResident: + if (options.es) + SPIRV_CROSS_THROW("Sparse feedback is not supported in GLSL."); + require_extension_internal("GL_ARB_sparse_texture2"); + emit_unary_func_op_cast(ops[0], ops[1], ops[2], "sparseTexelsResidentARB", int_type, SPIRType::Boolean); + break; + + case OpImage: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + // Suppress usage tracking. + auto &e = emit_op(result_type, id, to_expression(ops[2]), true, true); + + // When using the image, we need to know which variable it is actually loaded from. + auto *var = maybe_get_backing_variable(ops[2]); + e.loaded_from = var ? var->self : ID(0); + break; + } + + case OpImageQueryLod: + { + const char *op = nullptr; + if (!options.es && options.version < 400) + { + require_extension_internal("GL_ARB_texture_query_lod"); + // For some reason, the ARB spec is all-caps. + op = "textureQueryLOD"; + } + else if (options.es) + { + if (options.version < 300) + SPIRV_CROSS_THROW("textureQueryLod not supported in legacy ES"); + require_extension_internal("GL_EXT_texture_query_lod"); + op = "textureQueryLOD"; + } + else + op = "textureQueryLod"; + + auto sampler_expr = to_expression(ops[2]); + if (has_decoration(ops[2], DecorationNonUniform)) + { + if (maybe_get_backing_variable(ops[2])) + convert_non_uniform_expression(sampler_expr, ops[2]); + else if (*backend.nonuniform_qualifier != '\0') + sampler_expr = join(backend.nonuniform_qualifier, "(", sampler_expr, ")"); + } + + bool forward = should_forward(ops[3]); + emit_op(ops[0], ops[1], + join(op, "(", sampler_expr, ", ", to_unpacked_expression(ops[3]), ")"), + forward); + inherit_expression_dependencies(ops[1], ops[2]); + inherit_expression_dependencies(ops[1], ops[3]); + register_control_dependent_expression(ops[1]); + break; + } + + case OpImageQueryLevels: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + if (!options.es && options.version < 430) + require_extension_internal("GL_ARB_texture_query_levels"); + if (options.es) + SPIRV_CROSS_THROW("textureQueryLevels not supported in ES profile."); + + auto expr = join("textureQueryLevels(", convert_separate_image_to_expression(ops[2]), ")"); + auto &restype = get(ops[0]); + expr = bitcast_expression(restype, SPIRType::Int, expr); + emit_op(result_type, id, expr, true); + break; + } + + case OpImageQuerySamples: + { + auto &type = expression_type(ops[2]); + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + if (options.es) + SPIRV_CROSS_THROW("textureSamples and imageSamples not supported in ES profile."); + else if (options.version < 450) + require_extension_internal("GL_ARB_texture_query_samples"); + + string expr; + if (type.image.sampled == 2) + expr = join("imageSamples(", to_non_uniform_aware_expression(ops[2]), ")"); + else + expr = join("textureSamples(", convert_separate_image_to_expression(ops[2]), ")"); + + auto &restype = get(ops[0]); + expr = bitcast_expression(restype, SPIRType::Int, expr); + emit_op(result_type, id, expr, true); + break; + } + + case OpSampledImage: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_sampled_image_op(result_type, id, ops[2], ops[3]); + inherit_expression_dependencies(id, ops[2]); + inherit_expression_dependencies(id, ops[3]); + break; + } + + case OpImageQuerySizeLod: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + uint32_t img = ops[2]; + auto &type = expression_type(img); + auto &imgtype = get(type.self); + + std::string fname = "textureSize"; + if (is_legacy_desktop()) + { + fname = legacy_tex_op(fname, imgtype, img); + } + else if (is_legacy_es()) + SPIRV_CROSS_THROW("textureSize is not supported in ESSL 100."); + + auto expr = join(fname, "(", convert_separate_image_to_expression(img), ", ", + bitcast_expression(SPIRType::Int, ops[3]), ")"); + + // ES needs to emulate 1D images as 2D. + if (type.image.dim == Dim1D && options.es) + expr = join(expr, ".x"); + + auto &restype = get(ops[0]); + expr = bitcast_expression(restype, SPIRType::Int, expr); + emit_op(result_type, id, expr, true); + break; + } + + // Image load/store + case OpImageRead: + case OpImageSparseRead: + { + // We added Nonreadable speculatively to the OpImage variable due to glslangValidator + // not adding the proper qualifiers. + // If it turns out we need to read the image after all, remove the qualifier and recompile. + auto *var = maybe_get_backing_variable(ops[2]); + if (var) + { + auto &flags = get_decoration_bitset(var->self); + if (flags.get(DecorationNonReadable)) + { + unset_decoration(var->self, DecorationNonReadable); + force_recompile(); + } + } + + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + bool pure; + string imgexpr; + auto &type = expression_type(ops[2]); + + if (var && var->remapped_variable) // Remapped input, just read as-is without any op-code + { + if (type.image.ms) + SPIRV_CROSS_THROW("Trying to remap multisampled image to variable, this is not possible."); + + auto itr = + find_if(begin(pls_inputs), end(pls_inputs), [var](const PlsRemap &pls) { return pls.id == var->self; }); + + if (itr == end(pls_inputs)) + { + // For non-PLS inputs, we rely on subpass type remapping information to get it right + // since ImageRead always returns 4-component vectors and the backing type is opaque. + if (!var->remapped_components) + SPIRV_CROSS_THROW("subpassInput was remapped, but remap_components is not set correctly."); + imgexpr = remap_swizzle(get(result_type), var->remapped_components, to_expression(ops[2])); + } + else + { + // PLS input could have different number of components than what the SPIR expects, swizzle to + // the appropriate vector size. + uint32_t components = pls_format_to_components(itr->format); + imgexpr = remap_swizzle(get(result_type), components, to_expression(ops[2])); + } + pure = true; + } + else if (type.image.dim == DimSubpassData) + { + if (var && subpass_input_is_framebuffer_fetch(var->self)) + { + imgexpr = to_expression(var->self); + } + else if (options.vulkan_semantics) + { + // With Vulkan semantics, use the proper Vulkan GLSL construct. + if (type.image.ms) + { + uint32_t operands = ops[4]; + if (operands != ImageOperandsSampleMask || length != 6) + SPIRV_CROSS_THROW("Multisampled image used in OpImageRead, but unexpected " + "operand mask was used."); + + uint32_t samples = ops[5]; + imgexpr = join("subpassLoad(", to_non_uniform_aware_expression(ops[2]), ", ", to_expression(samples), ")"); + } + else + imgexpr = join("subpassLoad(", to_non_uniform_aware_expression(ops[2]), ")"); + } + else + { + if (type.image.ms) + { + uint32_t operands = ops[4]; + if (operands != ImageOperandsSampleMask || length != 6) + SPIRV_CROSS_THROW("Multisampled image used in OpImageRead, but unexpected " + "operand mask was used."); + + uint32_t samples = ops[5]; + imgexpr = join("texelFetch(", to_non_uniform_aware_expression(ops[2]), ", ivec2(gl_FragCoord.xy), ", + to_expression(samples), ")"); + } + else + { + // Implement subpass loads via texture barrier style sampling. + imgexpr = join("texelFetch(", to_non_uniform_aware_expression(ops[2]), ", ivec2(gl_FragCoord.xy), 0)"); + } + } + imgexpr = remap_swizzle(get(result_type), 4, imgexpr); + pure = true; + } + else + { + bool sparse = opcode == OpImageSparseRead; + uint32_t sparse_code_id = 0; + uint32_t sparse_texel_id = 0; + if (sparse) + emit_sparse_feedback_temporaries(ops[0], ops[1], sparse_code_id, sparse_texel_id); + + // imageLoad only accepts int coords, not uint. + auto coord_expr = to_expression(ops[3]); + auto target_coord_type = expression_type(ops[3]); + target_coord_type.basetype = SPIRType::Int; + coord_expr = bitcast_expression(target_coord_type, expression_type(ops[3]).basetype, coord_expr); + + // ES needs to emulate 1D images as 2D. + if (type.image.dim == Dim1D && options.es) + coord_expr = join("ivec2(", coord_expr, ", 0)"); + + // Plain image load/store. + if (sparse) + { + if (type.image.ms) + { + uint32_t operands = ops[4]; + if (operands != ImageOperandsSampleMask || length != 6) + SPIRV_CROSS_THROW("Multisampled image used in OpImageRead, but unexpected " + "operand mask was used."); + + uint32_t samples = ops[5]; + statement(to_expression(sparse_code_id), " = sparseImageLoadARB(", to_non_uniform_aware_expression(ops[2]), ", ", + coord_expr, ", ", to_expression(samples), ", ", to_expression(sparse_texel_id), ");"); + } + else + { + statement(to_expression(sparse_code_id), " = sparseImageLoadARB(", to_non_uniform_aware_expression(ops[2]), ", ", + coord_expr, ", ", to_expression(sparse_texel_id), ");"); + } + imgexpr = join(type_to_glsl(get(result_type)), "(", to_expression(sparse_code_id), ", ", + to_expression(sparse_texel_id), ")"); + } + else + { + if (type.image.ms) + { + uint32_t operands = ops[4]; + if (operands != ImageOperandsSampleMask || length != 6) + SPIRV_CROSS_THROW("Multisampled image used in OpImageRead, but unexpected " + "operand mask was used."); + + uint32_t samples = ops[5]; + imgexpr = + join("imageLoad(", to_non_uniform_aware_expression(ops[2]), ", ", coord_expr, ", ", to_expression(samples), ")"); + } + else + imgexpr = join("imageLoad(", to_non_uniform_aware_expression(ops[2]), ", ", coord_expr, ")"); + } + + if (!sparse) + imgexpr = remap_swizzle(get(result_type), 4, imgexpr); + pure = false; + } + + if (var) + { + bool forward = forced_temporaries.find(id) == end(forced_temporaries); + auto &e = emit_op(result_type, id, imgexpr, forward); + + // We only need to track dependencies if we're reading from image load/store. + if (!pure) + { + e.loaded_from = var->self; + if (forward) + var->dependees.push_back(id); + } + } + else + emit_op(result_type, id, imgexpr, false); + + inherit_expression_dependencies(id, ops[2]); + if (type.image.ms) + inherit_expression_dependencies(id, ops[5]); + break; + } + + case OpImageTexelPointer: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + auto coord_expr = to_expression(ops[3]); + auto target_coord_type = expression_type(ops[3]); + target_coord_type.basetype = SPIRType::Int; + coord_expr = bitcast_expression(target_coord_type, expression_type(ops[3]).basetype, coord_expr); + + auto expr = join(to_expression(ops[2]), ", ", coord_expr); + auto &e = set(id, expr, result_type, true); + + // When using the pointer, we need to know which variable it is actually loaded from. + auto *var = maybe_get_backing_variable(ops[2]); + e.loaded_from = var ? var->self : ID(0); + inherit_expression_dependencies(id, ops[3]); + break; + } + + case OpImageWrite: + { + // We added Nonwritable speculatively to the OpImage variable due to glslangValidator + // not adding the proper qualifiers. + // If it turns out we need to write to the image after all, remove the qualifier and recompile. + auto *var = maybe_get_backing_variable(ops[0]); + if (var) + { + if (has_decoration(var->self, DecorationNonWritable)) + { + unset_decoration(var->self, DecorationNonWritable); + force_recompile(); + } + } + + auto &type = expression_type(ops[0]); + auto &value_type = expression_type(ops[2]); + auto store_type = value_type; + store_type.vecsize = 4; + + // imageStore only accepts int coords, not uint. + auto coord_expr = to_expression(ops[1]); + auto target_coord_type = expression_type(ops[1]); + target_coord_type.basetype = SPIRType::Int; + coord_expr = bitcast_expression(target_coord_type, expression_type(ops[1]).basetype, coord_expr); + + // ES needs to emulate 1D images as 2D. + if (type.image.dim == Dim1D && options.es) + coord_expr = join("ivec2(", coord_expr, ", 0)"); + + if (type.image.ms) + { + uint32_t operands = ops[3]; + if (operands != ImageOperandsSampleMask || length != 5) + SPIRV_CROSS_THROW("Multisampled image used in OpImageWrite, but unexpected operand mask was used."); + uint32_t samples = ops[4]; + statement("imageStore(", to_non_uniform_aware_expression(ops[0]), ", ", coord_expr, ", ", to_expression(samples), ", ", + remap_swizzle(store_type, value_type.vecsize, to_expression(ops[2])), ");"); + } + else + statement("imageStore(", to_non_uniform_aware_expression(ops[0]), ", ", coord_expr, ", ", + remap_swizzle(store_type, value_type.vecsize, to_expression(ops[2])), ");"); + + if (var && variable_storage_is_aliased(*var)) + flush_all_aliased_variables(); + break; + } + + case OpImageQuerySize: + { + auto &type = expression_type(ops[2]); + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + if (type.basetype == SPIRType::Image) + { + string expr; + if (type.image.sampled == 2) + { + if (!options.es && options.version < 430) + require_extension_internal("GL_ARB_shader_image_size"); + else if (options.es && options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for imageSize."); + + // The size of an image is always constant. + expr = join("imageSize(", to_non_uniform_aware_expression(ops[2]), ")"); + } + else + { + // This path is hit for samplerBuffers and multisampled images which do not have LOD. + std::string fname = "textureSize"; + if (is_legacy()) + { + auto &imgtype = get(type.self); + fname = legacy_tex_op(fname, imgtype, ops[2]); + } + expr = join(fname, "(", convert_separate_image_to_expression(ops[2]), ")"); + } + + auto &restype = get(ops[0]); + expr = bitcast_expression(restype, SPIRType::Int, expr); + emit_op(result_type, id, expr, true); + } + else + SPIRV_CROSS_THROW("Invalid type for OpImageQuerySize."); + break; + } + + // Compute + case OpControlBarrier: + case OpMemoryBarrier: + { + uint32_t execution_scope = 0; + uint32_t memory; + uint32_t semantics; + + if (opcode == OpMemoryBarrier) + { + memory = evaluate_constant_u32(ops[0]); + semantics = evaluate_constant_u32(ops[1]); + } + else + { + execution_scope = evaluate_constant_u32(ops[0]); + memory = evaluate_constant_u32(ops[1]); + semantics = evaluate_constant_u32(ops[2]); + } + + if (execution_scope == ScopeSubgroup || memory == ScopeSubgroup) + { + // OpControlBarrier with ScopeSubgroup is subgroupBarrier() + if (opcode != OpControlBarrier) + { + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupMemBarrier); + } + else + { + request_subgroup_feature(ShaderSubgroupSupportHelper::SubgroupBarrier); + } + } + + if (execution_scope != ScopeSubgroup && get_entry_point().model == ExecutionModelTessellationControl) + { + // Control shaders only have barriers, and it implies memory barriers. + if (opcode == OpControlBarrier) + statement("barrier();"); + break; + } + + // We only care about these flags, acquire/release and friends are not relevant to GLSL. + semantics = mask_relevant_memory_semantics(semantics); + + if (opcode == OpMemoryBarrier) + { + // If we are a memory barrier, and the next instruction is a control barrier, check if that memory barrier + // does what we need, so we avoid redundant barriers. + const Instruction *next = get_next_instruction_in_block(instruction); + if (next && next->op == OpControlBarrier) + { + auto *next_ops = stream(*next); + uint32_t next_memory = evaluate_constant_u32(next_ops[1]); + uint32_t next_semantics = evaluate_constant_u32(next_ops[2]); + next_semantics = mask_relevant_memory_semantics(next_semantics); + + bool memory_scope_covered = false; + if (next_memory == memory) + memory_scope_covered = true; + else if (next_semantics == MemorySemanticsWorkgroupMemoryMask) + { + // If we only care about workgroup memory, either Device or Workgroup scope is fine, + // scope does not have to match. + if ((next_memory == ScopeDevice || next_memory == ScopeWorkgroup) && + (memory == ScopeDevice || memory == ScopeWorkgroup)) + { + memory_scope_covered = true; + } + } + else if (memory == ScopeWorkgroup && next_memory == ScopeDevice) + { + // The control barrier has device scope, but the memory barrier just has workgroup scope. + memory_scope_covered = true; + } + + // If we have the same memory scope, and all memory types are covered, we're good. + if (memory_scope_covered && (semantics & next_semantics) == semantics) + break; + } + } + + // We are synchronizing some memory or syncing execution, + // so we cannot forward any loads beyond the memory barrier. + if (semantics || opcode == OpControlBarrier) + { + assert(current_emitting_block); + flush_control_dependent_expressions(current_emitting_block->self); + flush_all_active_variables(); + } + + if (memory == ScopeWorkgroup) // Only need to consider memory within a group + { + if (semantics == MemorySemanticsWorkgroupMemoryMask) + { + // OpControlBarrier implies a memory barrier for shared memory as well. + bool implies_shared_barrier = opcode == OpControlBarrier && execution_scope == ScopeWorkgroup; + if (!implies_shared_barrier) + statement("memoryBarrierShared();"); + } + else if (semantics != 0) + statement("groupMemoryBarrier();"); + } + else if (memory == ScopeSubgroup) + { + const uint32_t all_barriers = + MemorySemanticsWorkgroupMemoryMask | MemorySemanticsUniformMemoryMask | MemorySemanticsImageMemoryMask; + + if (semantics & (MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask)) + { + // These are not relevant for GLSL, but assume it means memoryBarrier(). + // memoryBarrier() does everything, so no need to test anything else. + statement("subgroupMemoryBarrier();"); + } + else if ((semantics & all_barriers) == all_barriers) + { + // Short-hand instead of emitting 3 barriers. + statement("subgroupMemoryBarrier();"); + } + else + { + // Pick out individual barriers. + if (semantics & MemorySemanticsWorkgroupMemoryMask) + statement("subgroupMemoryBarrierShared();"); + if (semantics & MemorySemanticsUniformMemoryMask) + statement("subgroupMemoryBarrierBuffer();"); + if (semantics & MemorySemanticsImageMemoryMask) + statement("subgroupMemoryBarrierImage();"); + } + } + else + { + const uint32_t all_barriers = + MemorySemanticsWorkgroupMemoryMask | MemorySemanticsUniformMemoryMask | MemorySemanticsImageMemoryMask; + + if (semantics & (MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask)) + { + // These are not relevant for GLSL, but assume it means memoryBarrier(). + // memoryBarrier() does everything, so no need to test anything else. + statement("memoryBarrier();"); + } + else if ((semantics & all_barriers) == all_barriers) + { + // Short-hand instead of emitting 4 barriers. + statement("memoryBarrier();"); + } + else + { + // Pick out individual barriers. + if (semantics & MemorySemanticsWorkgroupMemoryMask) + statement("memoryBarrierShared();"); + if (semantics & MemorySemanticsUniformMemoryMask) + statement("memoryBarrierBuffer();"); + if (semantics & MemorySemanticsImageMemoryMask) + statement("memoryBarrierImage();"); + } + } + + if (opcode == OpControlBarrier) + { + if (execution_scope == ScopeSubgroup) + statement("subgroupBarrier();"); + else + statement("barrier();"); + } + break; + } + + case OpExtInst: + { + uint32_t extension_set = ops[2]; + auto ext = get(extension_set).ext; + + if (ext == SPIRExtension::GLSL) + { + emit_glsl_op(ops[0], ops[1], ops[3], &ops[4], length - 4); + } + else if (ext == SPIRExtension::SPV_AMD_shader_ballot) + { + emit_spv_amd_shader_ballot_op(ops[0], ops[1], ops[3], &ops[4], length - 4); + } + else if (ext == SPIRExtension::SPV_AMD_shader_explicit_vertex_parameter) + { + emit_spv_amd_shader_explicit_vertex_parameter_op(ops[0], ops[1], ops[3], &ops[4], length - 4); + } + else if (ext == SPIRExtension::SPV_AMD_shader_trinary_minmax) + { + emit_spv_amd_shader_trinary_minmax_op(ops[0], ops[1], ops[3], &ops[4], length - 4); + } + else if (ext == SPIRExtension::SPV_AMD_gcn_shader) + { + emit_spv_amd_gcn_shader_op(ops[0], ops[1], ops[3], &ops[4], length - 4); + } + else if (ext == SPIRExtension::SPV_debug_info || + ext == SPIRExtension::NonSemanticShaderDebugInfo || + ext == SPIRExtension::NonSemanticGeneric) + { + break; // Ignore SPIR-V debug information extended instructions. + } + else if (ext == SPIRExtension::NonSemanticDebugPrintf) + { + // Operation 1 is printf. + if (ops[3] == 1) + { + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("Debug printf is only supported in Vulkan GLSL.\n"); + require_extension_internal("GL_EXT_debug_printf"); + auto &format_string = get(ops[4]).str; + string expr = join("debugPrintfEXT(\"", format_string, "\""); + for (uint32_t i = 5; i < length; i++) + { + expr += ", "; + expr += to_expression(ops[i]); + } + statement(expr, ");"); + } + } + else + { + statement("// unimplemented ext op ", instruction.op); + break; + } + + break; + } + + // Legacy sub-group stuff ... + case OpSubgroupBallotKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + string expr; + expr = join("uvec4(unpackUint2x32(ballotARB(" + to_expression(ops[2]) + ")), 0u, 0u)"); + emit_op(result_type, id, expr, should_forward(ops[2])); + + require_extension_internal("GL_ARB_shader_ballot"); + inherit_expression_dependencies(id, ops[2]); + register_control_dependent_expression(ops[1]); + break; + } + + case OpSubgroupFirstInvocationKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[2], "readFirstInvocationARB"); + + require_extension_internal("GL_ARB_shader_ballot"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpSubgroupReadInvocationKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_binary_func_op(result_type, id, ops[2], ops[3], "readInvocationARB"); + + require_extension_internal("GL_ARB_shader_ballot"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpSubgroupAllKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[2], "allInvocationsARB"); + + require_extension_internal("GL_ARB_shader_group_vote"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpSubgroupAnyKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[2], "anyInvocationARB"); + + require_extension_internal("GL_ARB_shader_group_vote"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpSubgroupAllEqualKHR: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[2], "allInvocationsEqualARB"); + + require_extension_internal("GL_ARB_shader_group_vote"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpGroupIAddNonUniformAMD: + case OpGroupFAddNonUniformAMD: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[4], "addInvocationsNonUniformAMD"); + + require_extension_internal("GL_AMD_shader_ballot"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpGroupFMinNonUniformAMD: + case OpGroupUMinNonUniformAMD: + case OpGroupSMinNonUniformAMD: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[4], "minInvocationsNonUniformAMD"); + + require_extension_internal("GL_AMD_shader_ballot"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpGroupFMaxNonUniformAMD: + case OpGroupUMaxNonUniformAMD: + case OpGroupSMaxNonUniformAMD: + { + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + emit_unary_func_op(result_type, id, ops[4], "maxInvocationsNonUniformAMD"); + + require_extension_internal("GL_AMD_shader_ballot"); + register_control_dependent_expression(ops[1]); + break; + } + + case OpFragmentMaskFetchAMD: + { + auto &type = expression_type(ops[2]); + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + if (type.image.dim == spv::DimSubpassData) + { + emit_unary_func_op(result_type, id, ops[2], "fragmentMaskFetchAMD"); + } + else + { + emit_binary_func_op(result_type, id, ops[2], ops[3], "fragmentMaskFetchAMD"); + } + + require_extension_internal("GL_AMD_shader_fragment_mask"); + break; + } + + case OpFragmentFetchAMD: + { + auto &type = expression_type(ops[2]); + uint32_t result_type = ops[0]; + uint32_t id = ops[1]; + + if (type.image.dim == spv::DimSubpassData) + { + emit_binary_func_op(result_type, id, ops[2], ops[4], "fragmentFetchAMD"); + } + else + { + emit_trinary_func_op(result_type, id, ops[2], ops[3], ops[4], "fragmentFetchAMD"); + } + + require_extension_internal("GL_AMD_shader_fragment_mask"); + break; + } + + // Vulkan 1.1 sub-group stuff ... + case OpGroupNonUniformElect: + case OpGroupNonUniformBroadcast: + case OpGroupNonUniformBroadcastFirst: + case OpGroupNonUniformBallot: + case OpGroupNonUniformInverseBallot: + case OpGroupNonUniformBallotBitExtract: + case OpGroupNonUniformBallotBitCount: + case OpGroupNonUniformBallotFindLSB: + case OpGroupNonUniformBallotFindMSB: + case OpGroupNonUniformShuffle: + case OpGroupNonUniformShuffleXor: + case OpGroupNonUniformShuffleUp: + case OpGroupNonUniformShuffleDown: + case OpGroupNonUniformAll: + case OpGroupNonUniformAny: + case OpGroupNonUniformAllEqual: + case OpGroupNonUniformFAdd: + case OpGroupNonUniformIAdd: + case OpGroupNonUniformFMul: + case OpGroupNonUniformIMul: + case OpGroupNonUniformFMin: + case OpGroupNonUniformFMax: + case OpGroupNonUniformSMin: + case OpGroupNonUniformSMax: + case OpGroupNonUniformUMin: + case OpGroupNonUniformUMax: + case OpGroupNonUniformBitwiseAnd: + case OpGroupNonUniformBitwiseOr: + case OpGroupNonUniformBitwiseXor: + case OpGroupNonUniformLogicalAnd: + case OpGroupNonUniformLogicalOr: + case OpGroupNonUniformLogicalXor: + case OpGroupNonUniformQuadSwap: + case OpGroupNonUniformQuadBroadcast: + emit_subgroup_op(instruction); + break; + + case OpFUnordEqual: + case OpFUnordLessThan: + case OpFUnordGreaterThan: + case OpFUnordLessThanEqual: + case OpFUnordGreaterThanEqual: + { + // GLSL doesn't specify if floating point comparisons are ordered or unordered, + // but glslang always emits ordered floating point compares for GLSL. + // To get unordered compares, we can test the opposite thing and invert the result. + // This way, we force true when there is any NaN present. + uint32_t op0 = ops[2]; + uint32_t op1 = ops[3]; + + string expr; + if (expression_type(op0).vecsize > 1) + { + const char *comp_op = nullptr; + switch (opcode) + { + case OpFUnordEqual: + comp_op = "notEqual"; + break; + + case OpFUnordLessThan: + comp_op = "greaterThanEqual"; + break; + + case OpFUnordLessThanEqual: + comp_op = "greaterThan"; + break; + + case OpFUnordGreaterThan: + comp_op = "lessThanEqual"; + break; + + case OpFUnordGreaterThanEqual: + comp_op = "lessThan"; + break; + + default: + assert(0); + break; + } + + expr = join("not(", comp_op, "(", to_unpacked_expression(op0), ", ", to_unpacked_expression(op1), "))"); + } + else + { + const char *comp_op = nullptr; + switch (opcode) + { + case OpFUnordEqual: + comp_op = " != "; + break; + + case OpFUnordLessThan: + comp_op = " >= "; + break; + + case OpFUnordLessThanEqual: + comp_op = " > "; + break; + + case OpFUnordGreaterThan: + comp_op = " <= "; + break; + + case OpFUnordGreaterThanEqual: + comp_op = " < "; + break; + + default: + assert(0); + break; + } + + expr = join("!(", to_enclosed_unpacked_expression(op0), comp_op, to_enclosed_unpacked_expression(op1), ")"); + } + + emit_op(ops[0], ops[1], expr, should_forward(op0) && should_forward(op1)); + inherit_expression_dependencies(ops[1], op0); + inherit_expression_dependencies(ops[1], op1); + break; + } + + case OpReportIntersectionKHR: + // NV is same opcode. + forced_temporaries.insert(ops[1]); + if (ray_tracing_is_khr) + GLSL_BFOP(reportIntersectionEXT); + else + GLSL_BFOP(reportIntersectionNV); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpIgnoreIntersectionNV: + // KHR variant is a terminator. + statement("ignoreIntersectionNV();"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpTerminateRayNV: + // KHR variant is a terminator. + statement("terminateRayNV();"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpTraceNV: + statement("traceNV(", to_non_uniform_aware_expression(ops[0]), ", ", to_expression(ops[1]), ", ", to_expression(ops[2]), ", ", + to_expression(ops[3]), ", ", to_expression(ops[4]), ", ", to_expression(ops[5]), ", ", + to_expression(ops[6]), ", ", to_expression(ops[7]), ", ", to_expression(ops[8]), ", ", + to_expression(ops[9]), ", ", to_expression(ops[10]), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpTraceRayKHR: + if (!has_decoration(ops[10], DecorationLocation)) + SPIRV_CROSS_THROW("A memory declaration object must be used in TraceRayKHR."); + statement("traceRayEXT(", to_non_uniform_aware_expression(ops[0]), ", ", to_expression(ops[1]), ", ", to_expression(ops[2]), ", ", + to_expression(ops[3]), ", ", to_expression(ops[4]), ", ", to_expression(ops[5]), ", ", + to_expression(ops[6]), ", ", to_expression(ops[7]), ", ", to_expression(ops[8]), ", ", + to_expression(ops[9]), ", ", get_decoration(ops[10], DecorationLocation), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpExecuteCallableNV: + statement("executeCallableNV(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + case OpExecuteCallableKHR: + if (!has_decoration(ops[1], DecorationLocation)) + SPIRV_CROSS_THROW("A memory declaration object must be used in ExecuteCallableKHR."); + statement("executeCallableEXT(", to_expression(ops[0]), ", ", get_decoration(ops[1], DecorationLocation), ");"); + flush_control_dependent_expressions(current_emitting_block->self); + break; + + // Don't bother forwarding temporaries. Avoids having to test expression invalidation with ray query objects. + case OpRayQueryInitializeKHR: + flush_variable_declaration(ops[0]); + statement("rayQueryInitializeEXT(", + to_expression(ops[0]), ", ", to_expression(ops[1]), ", ", + to_expression(ops[2]), ", ", to_expression(ops[3]), ", ", + to_expression(ops[4]), ", ", to_expression(ops[5]), ", ", + to_expression(ops[6]), ", ", to_expression(ops[7]), ");"); + break; + case OpRayQueryProceedKHR: + flush_variable_declaration(ops[0]); + emit_op(ops[0], ops[1], join("rayQueryProceedEXT(", to_expression(ops[2]), ")"), false); + break; + case OpRayQueryTerminateKHR: + flush_variable_declaration(ops[0]); + statement("rayQueryTerminateEXT(", to_expression(ops[0]), ");"); + break; + case OpRayQueryGenerateIntersectionKHR: + flush_variable_declaration(ops[0]); + statement("rayQueryGenerateIntersectionEXT(", to_expression(ops[0]), ", ", to_expression(ops[1]), ");"); + break; + case OpRayQueryConfirmIntersectionKHR: + flush_variable_declaration(ops[0]); + statement("rayQueryConfirmIntersectionEXT(", to_expression(ops[0]), ");"); + break; +#define GLSL_RAY_QUERY_GET_OP(op) \ + case OpRayQueryGet##op##KHR: \ + flush_variable_declaration(ops[2]); \ + emit_op(ops[0], ops[1], join("rayQueryGet" #op "EXT(", to_expression(ops[2]), ")"), false); \ + break +#define GLSL_RAY_QUERY_GET_OP2(op) \ + case OpRayQueryGet##op##KHR: \ + flush_variable_declaration(ops[2]); \ + emit_op(ops[0], ops[1], join("rayQueryGet" #op "EXT(", to_expression(ops[2]), ", ", "bool(", to_expression(ops[3]), "))"), false); \ + break + GLSL_RAY_QUERY_GET_OP(RayTMin); + GLSL_RAY_QUERY_GET_OP(RayFlags); + GLSL_RAY_QUERY_GET_OP(WorldRayOrigin); + GLSL_RAY_QUERY_GET_OP(WorldRayDirection); + GLSL_RAY_QUERY_GET_OP(IntersectionCandidateAABBOpaque); + GLSL_RAY_QUERY_GET_OP2(IntersectionType); + GLSL_RAY_QUERY_GET_OP2(IntersectionT); + GLSL_RAY_QUERY_GET_OP2(IntersectionInstanceCustomIndex); + GLSL_RAY_QUERY_GET_OP2(IntersectionInstanceId); + GLSL_RAY_QUERY_GET_OP2(IntersectionInstanceShaderBindingTableRecordOffset); + GLSL_RAY_QUERY_GET_OP2(IntersectionGeometryIndex); + GLSL_RAY_QUERY_GET_OP2(IntersectionPrimitiveIndex); + GLSL_RAY_QUERY_GET_OP2(IntersectionBarycentrics); + GLSL_RAY_QUERY_GET_OP2(IntersectionFrontFace); + GLSL_RAY_QUERY_GET_OP2(IntersectionObjectRayDirection); + GLSL_RAY_QUERY_GET_OP2(IntersectionObjectRayOrigin); + GLSL_RAY_QUERY_GET_OP2(IntersectionObjectToWorld); + GLSL_RAY_QUERY_GET_OP2(IntersectionWorldToObject); +#undef GLSL_RAY_QUERY_GET_OP +#undef GLSL_RAY_QUERY_GET_OP2 + + case OpConvertUToAccelerationStructureKHR: + { + require_extension_internal("GL_EXT_ray_tracing"); + + bool elide_temporary = should_forward(ops[2]) && forced_temporaries.count(ops[1]) == 0 && + !hoisted_temporaries.count(ops[1]); + + if (elide_temporary) + { + GLSL_UFOP(accelerationStructureEXT); + } + else + { + // Force this path in subsequent iterations. + forced_temporaries.insert(ops[1]); + + // We cannot declare a temporary acceleration structure in GLSL. + // If we get to this point, we'll have to emit a temporary uvec2, + // and cast to RTAS on demand. + statement(declare_temporary(expression_type_id(ops[2]), ops[1]), to_unpacked_expression(ops[2]), ";"); + // Use raw SPIRExpression interface to block all usage tracking. + set(ops[1], join("accelerationStructureEXT(", to_name(ops[1]), ")"), ops[0], true); + } + break; + } + + case OpConvertUToPtr: + { + auto &type = get(ops[0]); + if (type.storage != StorageClassPhysicalStorageBufferEXT) + SPIRV_CROSS_THROW("Only StorageClassPhysicalStorageBufferEXT is supported by OpConvertUToPtr."); + + auto &in_type = expression_type(ops[2]); + if (in_type.vecsize == 2) + require_extension_internal("GL_EXT_buffer_reference_uvec2"); + + auto op = type_to_glsl(type); + emit_unary_func_op(ops[0], ops[1], ops[2], op.c_str()); + break; + } + + case OpConvertPtrToU: + { + auto &type = get(ops[0]); + auto &ptr_type = expression_type(ops[2]); + if (ptr_type.storage != StorageClassPhysicalStorageBufferEXT) + SPIRV_CROSS_THROW("Only StorageClassPhysicalStorageBufferEXT is supported by OpConvertPtrToU."); + + if (type.vecsize == 2) + require_extension_internal("GL_EXT_buffer_reference_uvec2"); + + auto op = type_to_glsl(type); + emit_unary_func_op(ops[0], ops[1], ops[2], op.c_str()); + break; + } + + case OpUndef: + // Undefined value has been declared. + break; + + case OpLine: + { + emit_line_directive(ops[0], ops[1]); + break; + } + + case OpNoLine: + break; + + case OpDemoteToHelperInvocationEXT: + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("GL_EXT_demote_to_helper_invocation is only supported in Vulkan GLSL."); + require_extension_internal("GL_EXT_demote_to_helper_invocation"); + statement(backend.demote_literal, ";"); + break; + + case OpIsHelperInvocationEXT: + if (!options.vulkan_semantics) + SPIRV_CROSS_THROW("GL_EXT_demote_to_helper_invocation is only supported in Vulkan GLSL."); + require_extension_internal("GL_EXT_demote_to_helper_invocation"); + // Helper lane state with demote is volatile by nature. + // Do not forward this. + emit_op(ops[0], ops[1], "helperInvocationEXT()", false); + break; + + case OpBeginInvocationInterlockEXT: + // If the interlock is complex, we emit this elsewhere. + if (!interlocked_is_complex) + { + statement("SPIRV_Cross_beginInvocationInterlock();"); + flush_all_active_variables(); + // Make sure forwarding doesn't propagate outside interlock region. + } + break; + + case OpEndInvocationInterlockEXT: + // If the interlock is complex, we emit this elsewhere. + if (!interlocked_is_complex) + { + statement("SPIRV_Cross_endInvocationInterlock();"); + flush_all_active_variables(); + // Make sure forwarding doesn't propagate outside interlock region. + } + break; + + case OpSetMeshOutputsEXT: + statement("SetMeshOutputsEXT(", to_unpacked_expression(ops[0]), ", ", to_unpacked_expression(ops[1]), ");"); + break; + + case OpReadClockKHR: + { + auto &type = get(ops[0]); + auto scope = static_cast(evaluate_constant_u32(ops[2])); + const char *op = nullptr; + // Forwarding clock statements leads to a scenario where an SSA value can take on different + // values every time it's evaluated. Block any forwarding attempt. + // We also might want to invalidate all expressions to function as a sort of optimization + // barrier, but might be overkill for now. + if (scope == ScopeDevice) + { + require_extension_internal("GL_EXT_shader_realtime_clock"); + if (type.basetype == SPIRType::BaseType::UInt64) + op = "clockRealtimeEXT()"; + else if (type.basetype == SPIRType::BaseType::UInt && type.vecsize == 2) + op = "clockRealtime2x32EXT()"; + else + SPIRV_CROSS_THROW("Unsupported result type for OpReadClockKHR opcode."); + } + else if (scope == ScopeSubgroup) + { + require_extension_internal("GL_ARB_shader_clock"); + if (type.basetype == SPIRType::BaseType::UInt64) + op = "clockARB()"; + else if (type.basetype == SPIRType::BaseType::UInt && type.vecsize == 2) + op = "clock2x32ARB()"; + else + SPIRV_CROSS_THROW("Unsupported result type for OpReadClockKHR opcode."); + } + else + SPIRV_CROSS_THROW("Unsupported scope for OpReadClockKHR opcode."); + + emit_op(ops[0], ops[1], op, false); + break; + } + + default: + statement("// unimplemented op ", instruction.op); + break; + } +} + +// Appends function arguments, mapped from global variables, beyond the specified arg index. +// This is used when a function call uses fewer arguments than the function defines. +// This situation may occur if the function signature has been dynamically modified to +// extract global variables referenced from within the function, and convert them to +// function arguments. This is necessary for shader languages that do not support global +// access to shader input content from within a function (eg. Metal). Each additional +// function args uses the name of the global variable. Function nesting will modify the +// functions and function calls all the way up the nesting chain. +void CompilerGLSL::append_global_func_args(const SPIRFunction &func, uint32_t index, SmallVector &arglist) +{ + auto &args = func.arguments; + uint32_t arg_cnt = uint32_t(args.size()); + for (uint32_t arg_idx = index; arg_idx < arg_cnt; arg_idx++) + { + auto &arg = args[arg_idx]; + assert(arg.alias_global_variable); + + // If the underlying variable needs to be declared + // (ie. a local variable with deferred declaration), do so now. + uint32_t var_id = get(arg.id).basevariable; + if (var_id) + flush_variable_declaration(var_id); + + arglist.push_back(to_func_call_arg(arg, arg.id)); + } +} + +string CompilerGLSL::to_member_name(const SPIRType &type, uint32_t index) +{ + if (type.type_alias != TypeID(0) && + !has_extended_decoration(type.type_alias, SPIRVCrossDecorationBufferBlockRepacked)) + { + return to_member_name(get(type.type_alias), index); + } + + auto &memb = ir.meta[type.self].members; + if (index < memb.size() && !memb[index].alias.empty()) + return memb[index].alias; + else + return join("_m", index); +} + +string CompilerGLSL::to_member_reference(uint32_t, const SPIRType &type, uint32_t index, bool) +{ + return join(".", to_member_name(type, index)); +} + +string CompilerGLSL::to_multi_member_reference(const SPIRType &type, const SmallVector &indices) +{ + string ret; + auto *member_type = &type; + for (auto &index : indices) + { + ret += join(".", to_member_name(*member_type, index)); + member_type = &get(member_type->member_types[index]); + } + return ret; +} + +void CompilerGLSL::add_member_name(SPIRType &type, uint32_t index) +{ + auto &memb = ir.meta[type.self].members; + if (index < memb.size() && !memb[index].alias.empty()) + { + auto &name = memb[index].alias; + if (name.empty()) + return; + + ParsedIR::sanitize_identifier(name, true, true); + update_name_cache(type.member_name_cache, name); + } +} + +// Checks whether the ID is a row_major matrix that requires conversion before use +bool CompilerGLSL::is_non_native_row_major_matrix(uint32_t id) +{ + // Natively supported row-major matrices do not need to be converted. + // Legacy targets do not support row major. + if (backend.native_row_major_matrix && !is_legacy()) + return false; + + auto *e = maybe_get(id); + if (e) + return e->need_transpose; + else + return has_decoration(id, DecorationRowMajor); +} + +// Checks whether the member is a row_major matrix that requires conversion before use +bool CompilerGLSL::member_is_non_native_row_major_matrix(const SPIRType &type, uint32_t index) +{ + // Natively supported row-major matrices do not need to be converted. + if (backend.native_row_major_matrix && !is_legacy()) + return false; + + // Non-matrix or column-major matrix types do not need to be converted. + if (!has_member_decoration(type.self, index, DecorationRowMajor)) + return false; + + // Only square row-major matrices can be converted at this time. + // Converting non-square matrices will require defining custom GLSL function that + // swaps matrix elements while retaining the original dimensional form of the matrix. + const auto mbr_type = get(type.member_types[index]); + if (mbr_type.columns != mbr_type.vecsize) + SPIRV_CROSS_THROW("Row-major matrices must be square on this platform."); + + return true; +} + +// Checks if we need to remap physical type IDs when declaring the type in a buffer. +bool CompilerGLSL::member_is_remapped_physical_type(const SPIRType &type, uint32_t index) const +{ + return has_extended_member_decoration(type.self, index, SPIRVCrossDecorationPhysicalTypeID); +} + +// Checks whether the member is in packed data type, that might need to be unpacked. +bool CompilerGLSL::member_is_packed_physical_type(const SPIRType &type, uint32_t index) const +{ + return has_extended_member_decoration(type.self, index, SPIRVCrossDecorationPhysicalTypePacked); +} + +// Wraps the expression string in a function call that converts the +// row_major matrix result of the expression to a column_major matrix. +// Base implementation uses the standard library transpose() function. +// Subclasses may override to use a different function. +string CompilerGLSL::convert_row_major_matrix(string exp_str, const SPIRType &exp_type, uint32_t /* physical_type_id */, + bool /*is_packed*/, bool relaxed) +{ + strip_enclosed_expression(exp_str); + if (!is_matrix(exp_type)) + { + auto column_index = exp_str.find_last_of('['); + if (column_index == string::npos) + return exp_str; + + auto column_expr = exp_str.substr(column_index); + exp_str.resize(column_index); + + auto transposed_expr = type_to_glsl_constructor(exp_type) + "("; + + // Loading a column from a row-major matrix. Unroll the load. + for (uint32_t c = 0; c < exp_type.vecsize; c++) + { + transposed_expr += join(exp_str, '[', c, ']', column_expr); + if (c + 1 < exp_type.vecsize) + transposed_expr += ", "; + } + + transposed_expr += ")"; + return transposed_expr; + } + else if (options.version < 120) + { + // GLSL 110, ES 100 do not have transpose(), so emulate it. Note that + // these GLSL versions do not support non-square matrices. + if (exp_type.vecsize == 2 && exp_type.columns == 2) + require_polyfill(PolyfillTranspose2x2, relaxed); + else if (exp_type.vecsize == 3 && exp_type.columns == 3) + require_polyfill(PolyfillTranspose3x3, relaxed); + else if (exp_type.vecsize == 4 && exp_type.columns == 4) + require_polyfill(PolyfillTranspose4x4, relaxed); + else + SPIRV_CROSS_THROW("Non-square matrices are not supported in legacy GLSL, cannot transpose."); + return join("spvTranspose", (options.es && relaxed) ? "MP" : "", "(", exp_str, ")"); + } + else + return join("transpose(", exp_str, ")"); +} + +string CompilerGLSL::variable_decl(const SPIRType &type, const string &name, uint32_t id) +{ + string type_name = type_to_glsl(type, id); + remap_variable_type_name(type, name, type_name); + return join(type_name, " ", name, type_to_array_glsl(type)); +} + +bool CompilerGLSL::variable_decl_is_remapped_storage(const SPIRVariable &var, StorageClass storage) const +{ + return var.storage == storage; +} + +// Emit a structure member. Subclasses may override to modify output, +// or to dynamically add a padding member if needed. +void CompilerGLSL::emit_struct_member(const SPIRType &type, uint32_t member_type_id, uint32_t index, + const string &qualifier, uint32_t) +{ + auto &membertype = get(member_type_id); + + Bitset memberflags; + auto &memb = ir.meta[type.self].members; + if (index < memb.size()) + memberflags = memb[index].decoration_flags; + + string qualifiers; + bool is_block = ir.meta[type.self].decoration.decoration_flags.get(DecorationBlock) || + ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock); + + if (is_block) + qualifiers = to_interpolation_qualifiers(memberflags); + + statement(layout_for_member(type, index), qualifiers, qualifier, flags_to_qualifiers_glsl(membertype, memberflags), + variable_decl(membertype, to_member_name(type, index)), ";"); +} + +void CompilerGLSL::emit_struct_padding_target(const SPIRType &) +{ +} + +string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset &flags) +{ + // GL_EXT_buffer_reference variables can be marked as restrict. + if (flags.get(DecorationRestrictPointerEXT)) + return "restrict "; + + string qual; + + if (type_is_floating_point(type) && flags.get(DecorationNoContraction) && backend.support_precise_qualifier) + qual = "precise "; + + // Structs do not have precision qualifiers, neither do doubles (desktop only anyways, so no mediump/highp). + bool type_supports_precision = + type.basetype == SPIRType::Float || type.basetype == SPIRType::Int || type.basetype == SPIRType::UInt || + type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage || + type.basetype == SPIRType::Sampler; + + if (!type_supports_precision) + return qual; + + if (options.es) + { + auto &execution = get_entry_point(); + + if (flags.get(DecorationRelaxedPrecision)) + { + bool implied_fmediump = type.basetype == SPIRType::Float && + options.fragment.default_float_precision == Options::Mediump && + execution.model == ExecutionModelFragment; + + bool implied_imediump = (type.basetype == SPIRType::Int || type.basetype == SPIRType::UInt) && + options.fragment.default_int_precision == Options::Mediump && + execution.model == ExecutionModelFragment; + + qual += (implied_fmediump || implied_imediump) ? "" : "mediump "; + } + else + { + bool implied_fhighp = + type.basetype == SPIRType::Float && ((options.fragment.default_float_precision == Options::Highp && + execution.model == ExecutionModelFragment) || + (execution.model != ExecutionModelFragment)); + + bool implied_ihighp = (type.basetype == SPIRType::Int || type.basetype == SPIRType::UInt) && + ((options.fragment.default_int_precision == Options::Highp && + execution.model == ExecutionModelFragment) || + (execution.model != ExecutionModelFragment)); + + qual += (implied_fhighp || implied_ihighp) ? "" : "highp "; + } + } + else if (backend.allow_precision_qualifiers) + { + // Vulkan GLSL supports precision qualifiers, even in desktop profiles, which is convenient. + // The default is highp however, so only emit mediump in the rare case that a shader has these. + if (flags.get(DecorationRelaxedPrecision)) + qual += "mediump "; + } + + return qual; +} + +string CompilerGLSL::to_precision_qualifiers_glsl(uint32_t id) +{ + auto &type = expression_type(id); + bool use_precision_qualifiers = backend.allow_precision_qualifiers; + if (use_precision_qualifiers && (type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage)) + { + // Force mediump for the sampler type. We cannot declare 16-bit or smaller image types. + auto &result_type = get(type.image.type); + if (result_type.width < 32) + return "mediump "; + } + return flags_to_qualifiers_glsl(type, ir.meta[id].decoration.decoration_flags); +} + +void CompilerGLSL::fixup_io_block_patch_primitive_qualifiers(const SPIRVariable &var) +{ + // Works around weird behavior in glslangValidator where + // a patch out block is translated to just block members getting the decoration. + // To make glslang not complain when we compile again, we have to transform this back to a case where + // the variable itself has Patch decoration, and not members. + // Same for perprimitiveEXT. + auto &type = get(var.basetype); + if (has_decoration(type.self, DecorationBlock)) + { + uint32_t member_count = uint32_t(type.member_types.size()); + Decoration promoted_decoration = {}; + bool do_promote_decoration = false; + for (uint32_t i = 0; i < member_count; i++) + { + if (has_member_decoration(type.self, i, DecorationPatch)) + { + promoted_decoration = DecorationPatch; + do_promote_decoration = true; + break; + } + else if (has_member_decoration(type.self, i, DecorationPerPrimitiveEXT)) + { + promoted_decoration = DecorationPerPrimitiveEXT; + do_promote_decoration = true; + break; + } + } + + if (do_promote_decoration) + { + set_decoration(var.self, promoted_decoration); + for (uint32_t i = 0; i < member_count; i++) + unset_member_decoration(type.self, i, promoted_decoration); + } + } +} + +string CompilerGLSL::to_qualifiers_glsl(uint32_t id) +{ + auto &flags = get_decoration_bitset(id); + string res; + + auto *var = maybe_get(id); + + if (var && var->storage == StorageClassWorkgroup && !backend.shared_is_implied) + res += "shared "; + else if (var && var->storage == StorageClassTaskPayloadWorkgroupEXT && !backend.shared_is_implied) + res += "taskPayloadSharedEXT "; + + res += to_interpolation_qualifiers(flags); + if (var) + res += to_storage_qualifiers_glsl(*var); + + auto &type = expression_type(id); + if (type.image.dim != DimSubpassData && type.image.sampled == 2) + { + if (flags.get(DecorationCoherent)) + res += "coherent "; + if (flags.get(DecorationRestrict)) + res += "restrict "; + + if (flags.get(DecorationNonWritable)) + res += "readonly "; + + bool formatted_load = type.image.format == ImageFormatUnknown; + if (flags.get(DecorationNonReadable)) + { + res += "writeonly "; + formatted_load = false; + } + + if (formatted_load) + { + if (!options.es) + require_extension_internal("GL_EXT_shader_image_load_formatted"); + else + SPIRV_CROSS_THROW("Cannot use GL_EXT_shader_image_load_formatted in ESSL."); + } + } + + res += to_precision_qualifiers_glsl(id); + + return res; +} + +string CompilerGLSL::argument_decl(const SPIRFunction::Parameter &arg) +{ + // glslangValidator seems to make all arguments pointer no matter what which is rather bizarre ... + auto &type = expression_type(arg.id); + const char *direction = ""; + + if (type.pointer) + { + if (arg.write_count && arg.read_count) + direction = "inout "; + else if (arg.write_count) + direction = "out "; + } + + return join(direction, to_qualifiers_glsl(arg.id), variable_decl(type, to_name(arg.id), arg.id)); +} + +string CompilerGLSL::to_initializer_expression(const SPIRVariable &var) +{ + return to_unpacked_expression(var.initializer); +} + +string CompilerGLSL::to_zero_initialized_expression(uint32_t type_id) +{ +#ifndef NDEBUG + auto &type = get(type_id); + assert(type.storage == StorageClassPrivate || type.storage == StorageClassFunction || + type.storage == StorageClassGeneric); +#endif + uint32_t id = ir.increase_bound_by(1); + ir.make_constant_null(id, type_id, false); + return constant_expression(get(id)); +} + +bool CompilerGLSL::type_can_zero_initialize(const SPIRType &type) const +{ + if (type.pointer) + return false; + + if (!type.array.empty() && options.flatten_multidimensional_arrays) + return false; + + for (auto &literal : type.array_size_literal) + if (!literal) + return false; + + for (auto &memb : type.member_types) + if (!type_can_zero_initialize(get(memb))) + return false; + + return true; +} + +string CompilerGLSL::variable_decl(const SPIRVariable &variable) +{ + // Ignore the pointer type since GLSL doesn't have pointers. + auto &type = get_variable_data_type(variable); + + if (type.pointer_depth > 1 && !backend.support_pointer_to_pointer) + SPIRV_CROSS_THROW("Cannot declare pointer-to-pointer types."); + + auto res = join(to_qualifiers_glsl(variable.self), variable_decl(type, to_name(variable.self), variable.self)); + + if (variable.loop_variable && variable.static_expression) + { + uint32_t expr = variable.static_expression; + if (ir.ids[expr].get_type() != TypeUndef) + res += join(" = ", to_unpacked_expression(variable.static_expression)); + else if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + res += join(" = ", to_zero_initialized_expression(get_variable_data_type_id(variable))); + } + else if (variable.initializer && !variable_decl_is_remapped_storage(variable, StorageClassWorkgroup)) + { + uint32_t expr = variable.initializer; + if (ir.ids[expr].get_type() != TypeUndef) + res += join(" = ", to_initializer_expression(variable)); + else if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + res += join(" = ", to_zero_initialized_expression(get_variable_data_type_id(variable))); + } + + return res; +} + +const char *CompilerGLSL::to_pls_qualifiers_glsl(const SPIRVariable &variable) +{ + auto &flags = get_decoration_bitset(variable.self); + if (flags.get(DecorationRelaxedPrecision)) + return "mediump "; + else + return "highp "; +} + +string CompilerGLSL::pls_decl(const PlsRemap &var) +{ + auto &variable = get(var.id); + + SPIRType type; + type.vecsize = pls_format_to_components(var.format); + type.basetype = pls_format_to_basetype(var.format); + + return join(to_pls_layout(var.format), to_pls_qualifiers_glsl(variable), type_to_glsl(type), " ", + to_name(variable.self)); +} + +uint32_t CompilerGLSL::to_array_size_literal(const SPIRType &type) const +{ + return to_array_size_literal(type, uint32_t(type.array.size() - 1)); +} + +uint32_t CompilerGLSL::to_array_size_literal(const SPIRType &type, uint32_t index) const +{ + assert(type.array.size() == type.array_size_literal.size()); + + if (type.array_size_literal[index]) + { + return type.array[index]; + } + else + { + // Use the default spec constant value. + // This is the best we can do. + return evaluate_constant_u32(type.array[index]); + } +} + +string CompilerGLSL::to_array_size(const SPIRType &type, uint32_t index) +{ + assert(type.array.size() == type.array_size_literal.size()); + + auto &size = type.array[index]; + if (!type.array_size_literal[index]) + return to_expression(size); + else if (size) + return convert_to_string(size); + else if (!backend.unsized_array_supported) + { + // For runtime-sized arrays, we can work around + // lack of standard support for this by simply having + // a single element array. + // + // Runtime length arrays must always be the last element + // in an interface block. + return "1"; + } + else + return ""; +} + +string CompilerGLSL::type_to_array_glsl(const SPIRType &type) +{ + if (type.pointer && type.storage == StorageClassPhysicalStorageBufferEXT && type.basetype != SPIRType::Struct) + { + // We are using a wrapped pointer type, and we should not emit any array declarations here. + return ""; + } + + if (type.array.empty()) + return ""; + + if (options.flatten_multidimensional_arrays) + { + string res; + res += "["; + for (auto i = uint32_t(type.array.size()); i; i--) + { + res += enclose_expression(to_array_size(type, i - 1)); + if (i > 1) + res += " * "; + } + res += "]"; + return res; + } + else + { + if (type.array.size() > 1) + { + if (!options.es && options.version < 430) + require_extension_internal("GL_ARB_arrays_of_arrays"); + else if (options.es && options.version < 310) + SPIRV_CROSS_THROW("Arrays of arrays not supported before ESSL version 310. " + "Try using --flatten-multidimensional-arrays or set " + "options.flatten_multidimensional_arrays to true."); + } + + string res; + for (auto i = uint32_t(type.array.size()); i; i--) + { + res += "["; + res += to_array_size(type, i - 1); + res += "]"; + } + return res; + } +} + +string CompilerGLSL::image_type_glsl(const SPIRType &type, uint32_t id) +{ + auto &imagetype = get(type.image.type); + string res; + + switch (imagetype.basetype) + { + case SPIRType::Int: + case SPIRType::Short: + case SPIRType::SByte: + res = "i"; + break; + case SPIRType::UInt: + case SPIRType::UShort: + case SPIRType::UByte: + res = "u"; + break; + default: + break; + } + + // For half image types, we will force mediump for the sampler, and cast to f16 after any sampling operation. + // We cannot express a true half texture type in GLSL. Neither for short integer formats for that matter. + + if (type.basetype == SPIRType::Image && type.image.dim == DimSubpassData && options.vulkan_semantics) + return res + "subpassInput" + (type.image.ms ? "MS" : ""); + else if (type.basetype == SPIRType::Image && type.image.dim == DimSubpassData && + subpass_input_is_framebuffer_fetch(id)) + { + SPIRType sampled_type = get(type.image.type); + sampled_type.vecsize = 4; + return type_to_glsl(sampled_type); + } + + // If we're emulating subpassInput with samplers, force sampler2D + // so we don't have to specify format. + if (type.basetype == SPIRType::Image && type.image.dim != DimSubpassData) + { + // Sampler buffers are always declared as samplerBuffer even though they might be separate images in the SPIR-V. + if (type.image.dim == DimBuffer && type.image.sampled == 1) + res += "sampler"; + else + res += type.image.sampled == 2 ? "image" : "texture"; + } + else + res += "sampler"; + + switch (type.image.dim) + { + case Dim1D: + // ES doesn't support 1D. Fake it with 2D. + res += options.es ? "2D" : "1D"; + break; + case Dim2D: + res += "2D"; + break; + case Dim3D: + res += "3D"; + break; + case DimCube: + res += "Cube"; + break; + case DimRect: + if (options.es) + SPIRV_CROSS_THROW("Rectangle textures are not supported on OpenGL ES."); + + if (is_legacy_desktop()) + require_extension_internal("GL_ARB_texture_rectangle"); + + res += "2DRect"; + break; + + case DimBuffer: + if (options.es && options.version < 320) + require_extension_internal("GL_EXT_texture_buffer"); + else if (!options.es && options.version < 300) + require_extension_internal("GL_EXT_texture_buffer_object"); + res += "Buffer"; + break; + + case DimSubpassData: + res += "2D"; + break; + default: + SPIRV_CROSS_THROW("Only 1D, 2D, 2DRect, 3D, Buffer, InputTarget and Cube textures supported."); + } + + if (type.image.ms) + res += "MS"; + if (type.image.arrayed) + { + if (is_legacy_desktop()) + require_extension_internal("GL_EXT_texture_array"); + res += "Array"; + } + + // "Shadow" state in GLSL only exists for samplers and combined image samplers. + if (((type.basetype == SPIRType::SampledImage) || (type.basetype == SPIRType::Sampler)) && + is_depth_image(type, id)) + { + res += "Shadow"; + + if (type.image.dim == DimCube && is_legacy()) + { + if (!options.es) + require_extension_internal("GL_EXT_gpu_shader4"); + else + { + require_extension_internal("GL_NV_shadow_samplers_cube"); + res += "NV"; + } + } + } + + return res; +} + +string CompilerGLSL::type_to_glsl_constructor(const SPIRType &type) +{ + if (backend.use_array_constructor && type.array.size() > 1) + { + if (options.flatten_multidimensional_arrays) + SPIRV_CROSS_THROW("Cannot flatten constructors of multidimensional array constructors, " + "e.g. float[][]()."); + else if (!options.es && options.version < 430) + require_extension_internal("GL_ARB_arrays_of_arrays"); + else if (options.es && options.version < 310) + SPIRV_CROSS_THROW("Arrays of arrays not supported before ESSL version 310."); + } + + auto e = type_to_glsl(type); + if (backend.use_array_constructor) + { + for (uint32_t i = 0; i < type.array.size(); i++) + e += "[]"; + } + return e; +} + +// The optional id parameter indicates the object whose type we are trying +// to find the description for. It is optional. Most type descriptions do not +// depend on a specific object's use of that type. +string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id) +{ + if (type.pointer && type.storage == StorageClassPhysicalStorageBufferEXT && type.basetype != SPIRType::Struct) + { + // Need to create a magic type name which compacts the entire type information. + string name = type_to_glsl(get_pointee_type(type)); + for (size_t i = 0; i < type.array.size(); i++) + { + if (type.array_size_literal[i]) + name += join(type.array[i], "_"); + else + name += join("id", type.array[i], "_"); + } + name += "Pointer"; + return name; + } + + switch (type.basetype) + { + case SPIRType::Struct: + // Need OpName lookup here to get a "sensible" name for a struct. + if (backend.explicit_struct_type) + return join("struct ", to_name(type.self)); + else + return to_name(type.self); + + case SPIRType::Image: + case SPIRType::SampledImage: + return image_type_glsl(type, id); + + case SPIRType::Sampler: + // The depth field is set by calling code based on the variable ID of the sampler, effectively reintroducing + // this distinction into the type system. + return comparison_ids.count(id) ? "samplerShadow" : "sampler"; + + case SPIRType::AccelerationStructure: + return ray_tracing_is_khr ? "accelerationStructureEXT" : "accelerationStructureNV"; + + case SPIRType::RayQuery: + return "rayQueryEXT"; + + case SPIRType::Void: + return "void"; + + default: + break; + } + + if (type.basetype == SPIRType::UInt && is_legacy()) + { + if (options.es) + SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy ESSL."); + else + require_extension_internal("GL_EXT_gpu_shader4"); + } + + if (type.basetype == SPIRType::AtomicCounter) + { + if (options.es && options.version < 310) + SPIRV_CROSS_THROW("At least ESSL 3.10 required for atomic counters."); + else if (!options.es && options.version < 420) + require_extension_internal("GL_ARB_shader_atomic_counters"); + } + + if (type.vecsize == 1 && type.columns == 1) // Scalar builtin + { + switch (type.basetype) + { + case SPIRType::Boolean: + return "bool"; + case SPIRType::SByte: + return backend.basic_int8_type; + case SPIRType::UByte: + return backend.basic_uint8_type; + case SPIRType::Short: + return backend.basic_int16_type; + case SPIRType::UShort: + return backend.basic_uint16_type; + case SPIRType::Int: + return backend.basic_int_type; + case SPIRType::UInt: + return backend.basic_uint_type; + case SPIRType::AtomicCounter: + return "atomic_uint"; + case SPIRType::Half: + return "float16_t"; + case SPIRType::Float: + return "float"; + case SPIRType::Double: + return "double"; + case SPIRType::Int64: + return "int64_t"; + case SPIRType::UInt64: + return "uint64_t"; + default: + return "???"; + } + } + else if (type.vecsize > 1 && type.columns == 1) // Vector builtin + { + switch (type.basetype) + { + case SPIRType::Boolean: + return join("bvec", type.vecsize); + case SPIRType::SByte: + return join("i8vec", type.vecsize); + case SPIRType::UByte: + return join("u8vec", type.vecsize); + case SPIRType::Short: + return join("i16vec", type.vecsize); + case SPIRType::UShort: + return join("u16vec", type.vecsize); + case SPIRType::Int: + return join("ivec", type.vecsize); + case SPIRType::UInt: + return join("uvec", type.vecsize); + case SPIRType::Half: + return join("f16vec", type.vecsize); + case SPIRType::Float: + return join("vec", type.vecsize); + case SPIRType::Double: + return join("dvec", type.vecsize); + case SPIRType::Int64: + return join("i64vec", type.vecsize); + case SPIRType::UInt64: + return join("u64vec", type.vecsize); + default: + return "???"; + } + } + else if (type.vecsize == type.columns) // Simple Matrix builtin + { + switch (type.basetype) + { + case SPIRType::Boolean: + return join("bmat", type.vecsize); + case SPIRType::Int: + return join("imat", type.vecsize); + case SPIRType::UInt: + return join("umat", type.vecsize); + case SPIRType::Half: + return join("f16mat", type.vecsize); + case SPIRType::Float: + return join("mat", type.vecsize); + case SPIRType::Double: + return join("dmat", type.vecsize); + // Matrix types not supported for int64/uint64. + default: + return "???"; + } + } + else + { + switch (type.basetype) + { + case SPIRType::Boolean: + return join("bmat", type.columns, "x", type.vecsize); + case SPIRType::Int: + return join("imat", type.columns, "x", type.vecsize); + case SPIRType::UInt: + return join("umat", type.columns, "x", type.vecsize); + case SPIRType::Half: + return join("f16mat", type.columns, "x", type.vecsize); + case SPIRType::Float: + return join("mat", type.columns, "x", type.vecsize); + case SPIRType::Double: + return join("dmat", type.columns, "x", type.vecsize); + // Matrix types not supported for int64/uint64. + default: + return "???"; + } + } +} + +void CompilerGLSL::add_variable(unordered_set &variables_primary, + const unordered_set &variables_secondary, string &name) +{ + if (name.empty()) + return; + + ParsedIR::sanitize_underscores(name); + if (ParsedIR::is_globally_reserved_identifier(name, true)) + { + name.clear(); + return; + } + + update_name_cache(variables_primary, variables_secondary, name); +} + +void CompilerGLSL::add_local_variable_name(uint32_t id) +{ + add_variable(local_variable_names, block_names, ir.meta[id].decoration.alias); +} + +void CompilerGLSL::add_resource_name(uint32_t id) +{ + add_variable(resource_names, block_names, ir.meta[id].decoration.alias); +} + +void CompilerGLSL::add_header_line(const std::string &line) +{ + header_lines.push_back(line); +} + +bool CompilerGLSL::has_extension(const std::string &ext) const +{ + auto itr = find(begin(forced_extensions), end(forced_extensions), ext); + return itr != end(forced_extensions); +} + +void CompilerGLSL::require_extension(const std::string &ext) +{ + if (!has_extension(ext)) + forced_extensions.push_back(ext); +} + +const SmallVector &CompilerGLSL::get_required_extensions() const +{ + return forced_extensions; +} + +void CompilerGLSL::require_extension_internal(const string &ext) +{ + if (backend.supports_extensions && !has_extension(ext)) + { + forced_extensions.push_back(ext); + force_recompile(); + } +} + +void CompilerGLSL::flatten_buffer_block(VariableID id) +{ + auto &var = get(id); + auto &type = get(var.basetype); + auto name = to_name(type.self, false); + auto &flags = get_decoration_bitset(type.self); + + if (!type.array.empty()) + SPIRV_CROSS_THROW(name + " is an array of UBOs."); + if (type.basetype != SPIRType::Struct) + SPIRV_CROSS_THROW(name + " is not a struct."); + if (!flags.get(DecorationBlock)) + SPIRV_CROSS_THROW(name + " is not a block."); + if (type.member_types.empty()) + SPIRV_CROSS_THROW(name + " is an empty struct."); + + flattened_buffer_blocks.insert(id); +} + +bool CompilerGLSL::builtin_translates_to_nonarray(spv::BuiltIn /*builtin*/) const +{ + return false; // GLSL itself does not need to translate array builtin types to non-array builtin types +} + +bool CompilerGLSL::is_user_type_structured(uint32_t /*id*/) const +{ + return false; // GLSL itself does not have structured user type, but HLSL does with StructuredBuffer and RWStructuredBuffer resources. +} + +bool CompilerGLSL::check_atomic_image(uint32_t id) +{ + auto &type = expression_type(id); + if (type.storage == StorageClassImage) + { + if (options.es && options.version < 320) + require_extension_internal("GL_OES_shader_image_atomic"); + + auto *var = maybe_get_backing_variable(id); + if (var) + { + if (has_decoration(var->self, DecorationNonWritable) || has_decoration(var->self, DecorationNonReadable)) + { + unset_decoration(var->self, DecorationNonWritable); + unset_decoration(var->self, DecorationNonReadable); + force_recompile(); + } + } + return true; + } + else + return false; +} + +void CompilerGLSL::add_function_overload(const SPIRFunction &func) +{ + Hasher hasher; + for (auto &arg : func.arguments) + { + // Parameters can vary with pointer type or not, + // but that will not change the signature in GLSL/HLSL, + // so strip the pointer type before hashing. + uint32_t type_id = get_pointee_type_id(arg.type); + auto &type = get(type_id); + + if (!combined_image_samplers.empty()) + { + // If we have combined image samplers, we cannot really trust the image and sampler arguments + // we pass down to callees, because they may be shuffled around. + // Ignore these arguments, to make sure that functions need to differ in some other way + // to be considered different overloads. + if (type.basetype == SPIRType::SampledImage || + (type.basetype == SPIRType::Image && type.image.sampled == 1) || type.basetype == SPIRType::Sampler) + { + continue; + } + } + + hasher.u32(type_id); + } + uint64_t types_hash = hasher.get(); + + auto function_name = to_name(func.self); + auto itr = function_overloads.find(function_name); + if (itr != end(function_overloads)) + { + // There exists a function with this name already. + auto &overloads = itr->second; + if (overloads.count(types_hash) != 0) + { + // Overload conflict, assign a new name. + add_resource_name(func.self); + function_overloads[to_name(func.self)].insert(types_hash); + } + else + { + // Can reuse the name. + overloads.insert(types_hash); + } + } + else + { + // First time we see this function name. + add_resource_name(func.self); + function_overloads[to_name(func.self)].insert(types_hash); + } +} + +void CompilerGLSL::emit_function_prototype(SPIRFunction &func, const Bitset &return_flags) +{ + if (func.self != ir.default_entry_point) + add_function_overload(func); + + // Avoid shadow declarations. + local_variable_names = resource_names; + + string decl; + + auto &type = get(func.return_type); + decl += flags_to_qualifiers_glsl(type, return_flags); + decl += type_to_glsl(type); + decl += type_to_array_glsl(type); + decl += " "; + + if (func.self == ir.default_entry_point) + { + // If we need complex fallback in GLSL, we just wrap main() in a function + // and interlock the entire shader ... + if (interlocked_is_complex) + decl += "spvMainInterlockedBody"; + else + decl += "main"; + + processing_entry_point = true; + } + else + decl += to_name(func.self); + + decl += "("; + SmallVector arglist; + for (auto &arg : func.arguments) + { + // Do not pass in separate images or samplers if we're remapping + // to combined image samplers. + if (skip_argument(arg.id)) + continue; + + // Might change the variable name if it already exists in this function. + // SPIRV OpName doesn't have any semantic effect, so it's valid for an implementation + // to use same name for variables. + // Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates. + add_local_variable_name(arg.id); + + arglist.push_back(argument_decl(arg)); + + // Hold a pointer to the parameter so we can invalidate the readonly field if needed. + auto *var = maybe_get(arg.id); + if (var) + var->parameter = &arg; + } + + for (auto &arg : func.shadow_arguments) + { + // Might change the variable name if it already exists in this function. + // SPIRV OpName doesn't have any semantic effect, so it's valid for an implementation + // to use same name for variables. + // Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates. + add_local_variable_name(arg.id); + + arglist.push_back(argument_decl(arg)); + + // Hold a pointer to the parameter so we can invalidate the readonly field if needed. + auto *var = maybe_get(arg.id); + if (var) + var->parameter = &arg; + } + + decl += merge(arglist); + decl += ")"; + statement(decl); +} + +void CompilerGLSL::emit_function(SPIRFunction &func, const Bitset &return_flags) +{ + // Avoid potential cycles. + if (func.active) + return; + func.active = true; + + // If we depend on a function, emit that function before we emit our own function. + for (auto block : func.blocks) + { + auto &b = get(block); + for (auto &i : b.ops) + { + auto ops = stream(i); + auto op = static_cast(i.op); + + if (op == OpFunctionCall) + { + // Recursively emit functions which are called. + uint32_t id = ops[2]; + emit_function(get(id), ir.meta[ops[1]].decoration.decoration_flags); + } + } + } + + if (func.entry_line.file_id != 0) + emit_line_directive(func.entry_line.file_id, func.entry_line.line_literal); + emit_function_prototype(func, return_flags); + begin_scope(); + + if (func.self == ir.default_entry_point) + emit_entry_point_declarations(); + + current_function = &func; + auto &entry_block = get(func.entry_block); + + sort(begin(func.constant_arrays_needed_on_stack), end(func.constant_arrays_needed_on_stack)); + for (auto &array : func.constant_arrays_needed_on_stack) + { + auto &c = get(array); + auto &type = get(c.constant_type); + statement(variable_decl(type, join("_", array, "_array_copy")), " = ", constant_expression(c), ";"); + } + + for (auto &v : func.local_variables) + { + auto &var = get(v); + var.deferred_declaration = false; + + if (variable_decl_is_remapped_storage(var, StorageClassWorkgroup)) + { + // Special variable type which cannot have initializer, + // need to be declared as standalone variables. + // Comes from MSL which can push global variables as local variables in main function. + add_local_variable_name(var.self); + statement(variable_decl(var), ";"); + var.deferred_declaration = false; + } + else if (var.storage == StorageClassPrivate) + { + // These variables will not have had their CFG usage analyzed, so move it to the entry block. + // Comes from MSL which can push global variables as local variables in main function. + // We could just declare them right now, but we would miss out on an important initialization case which is + // LUT declaration in MSL. + // If we don't declare the variable when it is assigned we're forced to go through a helper function + // which copies elements one by one. + add_local_variable_name(var.self); + + if (var.initializer) + { + statement(variable_decl(var), ";"); + var.deferred_declaration = false; + } + else + { + auto &dominated = entry_block.dominated_variables; + if (find(begin(dominated), end(dominated), var.self) == end(dominated)) + entry_block.dominated_variables.push_back(var.self); + var.deferred_declaration = true; + } + } + else if (var.storage == StorageClassFunction && var.remapped_variable && var.static_expression) + { + // No need to declare this variable, it has a static expression. + var.deferred_declaration = false; + } + else if (expression_is_lvalue(v)) + { + add_local_variable_name(var.self); + + // Loop variables should never be declared early, they are explicitly emitted in a loop. + if (var.initializer && !var.loop_variable) + statement(variable_decl_function_local(var), ";"); + else + { + // Don't declare variable until first use to declutter the GLSL output quite a lot. + // If we don't touch the variable before first branch, + // declare it then since we need variable declaration to be in top scope. + var.deferred_declaration = true; + } + } + else + { + // HACK: SPIR-V in older glslang output likes to use samplers and images as local variables, but GLSL does not allow this. + // For these types (non-lvalue), we enforce forwarding through a shadowed variable. + // This means that when we OpStore to these variables, we just write in the expression ID directly. + // This breaks any kind of branching, since the variable must be statically assigned. + // Branching on samplers and images would be pretty much impossible to fake in GLSL. + var.statically_assigned = true; + } + + var.loop_variable_enable = false; + + // Loop variables are never declared outside their for-loop, so block any implicit declaration. + if (var.loop_variable) + { + var.deferred_declaration = false; + // Need to reset the static expression so we can fallback to initializer if need be. + var.static_expression = 0; + } + } + + // Enforce declaration order for regression testing purposes. + for (auto &block_id : func.blocks) + { + auto &block = get(block_id); + sort(begin(block.dominated_variables), end(block.dominated_variables)); + } + + for (auto &line : current_function->fixup_hooks_in) + line(); + + emit_block_chain(entry_block); + + end_scope(); + processing_entry_point = false; + statement(""); + + // Make sure deferred declaration state for local variables is cleared when we are done with function. + // We risk declaring Private/Workgroup variables in places we are not supposed to otherwise. + for (auto &v : func.local_variables) + { + auto &var = get(v); + var.deferred_declaration = false; + } +} + +void CompilerGLSL::emit_fixup() +{ + if (is_vertex_like_shader()) + { + if (options.vertex.fixup_clipspace) + { + const char *suffix = backend.float_literal_suffix ? "f" : ""; + statement("gl_Position.z = 2.0", suffix, " * gl_Position.z - gl_Position.w;"); + } + + if (options.vertex.flip_vert_y) + statement("gl_Position.y = -gl_Position.y;"); + } +} + +void CompilerGLSL::flush_phi(BlockID from, BlockID to) +{ + auto &child = get(to); + if (child.ignore_phi_from_block == from) + return; + + unordered_set temporary_phi_variables; + + for (auto itr = begin(child.phi_variables); itr != end(child.phi_variables); ++itr) + { + auto &phi = *itr; + + if (phi.parent == from) + { + auto &var = get(phi.function_variable); + + // A Phi variable might be a loop variable, so flush to static expression. + if (var.loop_variable && !var.loop_variable_enable) + var.static_expression = phi.local_variable; + else + { + flush_variable_declaration(phi.function_variable); + + // Check if we are going to write to a Phi variable that another statement will read from + // as part of another Phi node in our target block. + // For this case, we will need to copy phi.function_variable to a temporary, and use that for future reads. + // This is judged to be extremely rare, so deal with it here using a simple, but suboptimal algorithm. + bool need_saved_temporary = + find_if(itr + 1, end(child.phi_variables), [&](const SPIRBlock::Phi &future_phi) -> bool { + return future_phi.local_variable == ID(phi.function_variable) && future_phi.parent == from; + }) != end(child.phi_variables); + + if (need_saved_temporary) + { + // Need to make sure we declare the phi variable with a copy at the right scope. + // We cannot safely declare a temporary here since we might be inside a continue block. + if (!var.allocate_temporary_copy) + { + var.allocate_temporary_copy = true; + force_recompile(); + } + statement("_", phi.function_variable, "_copy", " = ", to_name(phi.function_variable), ";"); + temporary_phi_variables.insert(phi.function_variable); + } + + // This might be called in continue block, so make sure we + // use this to emit ESSL 1.0 compliant increments/decrements. + auto lhs = to_expression(phi.function_variable); + + string rhs; + if (temporary_phi_variables.count(phi.local_variable)) + rhs = join("_", phi.local_variable, "_copy"); + else + rhs = to_pointer_expression(phi.local_variable); + + if (!optimize_read_modify_write(get(var.basetype), lhs, rhs)) + statement(lhs, " = ", rhs, ";"); + } + + register_write(phi.function_variable); + } + } +} + +void CompilerGLSL::branch_to_continue(BlockID from, BlockID to) +{ + auto &to_block = get(to); + if (from == to) + return; + + assert(is_continue(to)); + if (to_block.complex_continue) + { + // Just emit the whole block chain as is. + auto usage_counts = expression_usage_counts; + + emit_block_chain(to_block); + + // Expression usage counts are moot after returning from the continue block. + expression_usage_counts = usage_counts; + } + else + { + auto &from_block = get(from); + bool outside_control_flow = false; + uint32_t loop_dominator = 0; + + // FIXME: Refactor this to not use the old loop_dominator tracking. + if (from_block.merge_block) + { + // If we are a loop header, we don't set the loop dominator, + // so just use "self" here. + loop_dominator = from; + } + else if (from_block.loop_dominator != BlockID(SPIRBlock::NoDominator)) + { + loop_dominator = from_block.loop_dominator; + } + + if (loop_dominator != 0) + { + auto &cfg = get_cfg_for_current_function(); + + // For non-complex continue blocks, we implicitly branch to the continue block + // by having the continue block be part of the loop header in for (; ; continue-block). + outside_control_flow = cfg.node_terminates_control_flow_in_sub_graph(loop_dominator, from); + } + + // Some simplification for for-loops. We always end up with a useless continue; + // statement since we branch to a loop block. + // Walk the CFG, if we unconditionally execute the block calling continue assuming we're in the loop block, + // we can avoid writing out an explicit continue statement. + // Similar optimization to return statements if we know we're outside flow control. + if (!outside_control_flow) + statement("continue;"); + } +} + +void CompilerGLSL::branch(BlockID from, BlockID to) +{ + flush_phi(from, to); + flush_control_dependent_expressions(from); + + bool to_is_continue = is_continue(to); + + // This is only a continue if we branch to our loop dominator. + if ((ir.block_meta[to] & ParsedIR::BLOCK_META_LOOP_HEADER_BIT) != 0 && get(from).loop_dominator == to) + { + // This can happen if we had a complex continue block which was emitted. + // Once the continue block tries to branch to the loop header, just emit continue; + // and end the chain here. + statement("continue;"); + } + else if (from != to && is_break(to)) + { + // We cannot break to ourselves, so check explicitly for from != to. + // This case can trigger if a loop header is all three of these things: + // - Continue block + // - Loop header + // - Break merge target all at once ... + + // Very dirty workaround. + // Switch constructs are able to break, but they cannot break out of a loop at the same time, + // yet SPIR-V allows it. + // Only sensible solution is to make a ladder variable, which we declare at the top of the switch block, + // write to the ladder here, and defer the break. + // The loop we're breaking out of must dominate the switch block, or there is no ladder breaking case. + if (is_loop_break(to)) + { + for (size_t n = current_emitting_switch_stack.size(); n; n--) + { + auto *current_emitting_switch = current_emitting_switch_stack[n - 1]; + + if (current_emitting_switch && + current_emitting_switch->loop_dominator != BlockID(SPIRBlock::NoDominator) && + get(current_emitting_switch->loop_dominator).merge_block == to) + { + if (!current_emitting_switch->need_ladder_break) + { + force_recompile(); + current_emitting_switch->need_ladder_break = true; + } + + statement("_", current_emitting_switch->self, "_ladder_break = true;"); + } + else + break; + } + } + statement("break;"); + } + else if (to_is_continue || from == to) + { + // For from == to case can happen for a do-while loop which branches into itself. + // We don't mark these cases as continue blocks, but the only possible way to branch into + // ourselves is through means of continue blocks. + + // If we are merging to a continue block, there is no need to emit the block chain for continue here. + // We can branch to the continue block after we merge execution. + + // Here we make use of structured control flow rules from spec: + // 2.11: - the merge block declared by a header block cannot be a merge block declared by any other header block + // - each header block must strictly dominate its merge block, unless the merge block is unreachable in the CFG + // If we are branching to a merge block, we must be inside a construct which dominates the merge block. + auto &block_meta = ir.block_meta[to]; + bool branching_to_merge = + (block_meta & (ParsedIR::BLOCK_META_SELECTION_MERGE_BIT | ParsedIR::BLOCK_META_MULTISELECT_MERGE_BIT | + ParsedIR::BLOCK_META_LOOP_MERGE_BIT)) != 0; + if (!to_is_continue || !branching_to_merge) + branch_to_continue(from, to); + } + else if (!is_conditional(to)) + emit_block_chain(get(to)); + + // It is important that we check for break before continue. + // A block might serve two purposes, a break block for the inner scope, and + // a continue block in the outer scope. + // Inner scope always takes precedence. +} + +void CompilerGLSL::branch(BlockID from, uint32_t cond, BlockID true_block, BlockID false_block) +{ + auto &from_block = get(from); + BlockID merge_block = from_block.merge == SPIRBlock::MergeSelection ? from_block.next_block : BlockID(0); + + // If we branch directly to our selection merge target, we don't need a code path. + bool true_block_needs_code = true_block != merge_block || flush_phi_required(from, true_block); + bool false_block_needs_code = false_block != merge_block || flush_phi_required(from, false_block); + + if (!true_block_needs_code && !false_block_needs_code) + return; + + // We might have a loop merge here. Only consider selection flattening constructs. + // Loop hints are handled explicitly elsewhere. + if (from_block.hint == SPIRBlock::HintFlatten || from_block.hint == SPIRBlock::HintDontFlatten) + emit_block_hints(from_block); + + if (true_block_needs_code) + { + statement("if (", to_expression(cond), ")"); + begin_scope(); + branch(from, true_block); + end_scope(); + + if (false_block_needs_code) + { + statement("else"); + begin_scope(); + branch(from, false_block); + end_scope(); + } + } + else if (false_block_needs_code) + { + // Only need false path, use negative conditional. + statement("if (!", to_enclosed_expression(cond), ")"); + begin_scope(); + branch(from, false_block); + end_scope(); + } +} + +// FIXME: This currently cannot handle complex continue blocks +// as in do-while. +// This should be seen as a "trivial" continue block. +string CompilerGLSL::emit_continue_block(uint32_t continue_block, bool follow_true_block, bool follow_false_block) +{ + auto *block = &get(continue_block); + + // While emitting the continue block, declare_temporary will check this + // if we have to emit temporaries. + current_continue_block = block; + + SmallVector statements; + + // Capture all statements into our list. + auto *old = redirect_statement; + redirect_statement = &statements; + + // Stamp out all blocks one after each other. + while ((ir.block_meta[block->self] & ParsedIR::BLOCK_META_LOOP_HEADER_BIT) == 0) + { + // Write out all instructions we have in this block. + emit_block_instructions(*block); + + // For plain branchless for/while continue blocks. + if (block->next_block) + { + flush_phi(continue_block, block->next_block); + block = &get(block->next_block); + } + // For do while blocks. The last block will be a select block. + else if (block->true_block && follow_true_block) + { + flush_phi(continue_block, block->true_block); + block = &get(block->true_block); + } + else if (block->false_block && follow_false_block) + { + flush_phi(continue_block, block->false_block); + block = &get(block->false_block); + } + else + { + SPIRV_CROSS_THROW("Invalid continue block detected!"); + } + } + + // Restore old pointer. + redirect_statement = old; + + // Somewhat ugly, strip off the last ';' since we use ',' instead. + // Ideally, we should select this behavior in statement(). + for (auto &s : statements) + { + if (!s.empty() && s.back() == ';') + s.erase(s.size() - 1, 1); + } + + current_continue_block = nullptr; + return merge(statements); +} + +void CompilerGLSL::emit_while_loop_initializers(const SPIRBlock &block) +{ + // While loops do not take initializers, so declare all of them outside. + for (auto &loop_var : block.loop_variables) + { + auto &var = get(loop_var); + statement(variable_decl(var), ";"); + } +} + +string CompilerGLSL::emit_for_loop_initializers(const SPIRBlock &block) +{ + if (block.loop_variables.empty()) + return ""; + + bool same_types = for_loop_initializers_are_same_type(block); + // We can only declare for loop initializers if all variables are of same type. + // If we cannot do this, declare individual variables before the loop header. + + // We might have a loop variable candidate which was not assigned to for some reason. + uint32_t missing_initializers = 0; + for (auto &variable : block.loop_variables) + { + uint32_t expr = get(variable).static_expression; + + // Sometimes loop variables are initialized with OpUndef, but we can just declare + // a plain variable without initializer in this case. + if (expr == 0 || ir.ids[expr].get_type() == TypeUndef) + missing_initializers++; + } + + if (block.loop_variables.size() == 1 && missing_initializers == 0) + { + return variable_decl(get(block.loop_variables.front())); + } + else if (!same_types || missing_initializers == uint32_t(block.loop_variables.size())) + { + for (auto &loop_var : block.loop_variables) + statement(variable_decl(get(loop_var)), ";"); + return ""; + } + else + { + // We have a mix of loop variables, either ones with a clear initializer, or ones without. + // Separate the two streams. + string expr; + + for (auto &loop_var : block.loop_variables) + { + uint32_t static_expr = get(loop_var).static_expression; + if (static_expr == 0 || ir.ids[static_expr].get_type() == TypeUndef) + { + statement(variable_decl(get(loop_var)), ";"); + } + else + { + auto &var = get(loop_var); + auto &type = get_variable_data_type(var); + if (expr.empty()) + { + // For loop initializers are of the form (block.true_block), get(block.merge_block))) + condition = join("!", enclose_expression(condition)); + + statement("while (", condition, ")"); + break; + } + + default: + block.disable_block_optimization = true; + force_recompile(); + begin_scope(); // We'll see an end_scope() later. + return false; + } + + begin_scope(); + return true; + } + else + { + block.disable_block_optimization = true; + force_recompile(); + begin_scope(); // We'll see an end_scope() later. + return false; + } + } + else if (method == SPIRBlock::MergeToDirectForLoop) + { + auto &child = get(block.next_block); + + // This block may be a dominating block, so make sure we flush undeclared variables before building the for loop header. + flush_undeclared_variables(child); + + uint32_t current_count = statement_count; + + // If we're trying to create a true for loop, + // we need to make sure that all opcodes before branch statement do not actually emit any code. + // We can then take the condition expression and create a for (; cond ; ) { body; } structure instead. + emit_block_instructions(child); + + bool condition_is_temporary = forced_temporaries.find(child.condition) == end(forced_temporaries); + + if (current_count == statement_count && condition_is_temporary) + { + uint32_t target_block = child.true_block; + + switch (continue_type) + { + case SPIRBlock::ForLoop: + { + // Important that we do this in this order because + // emitting the continue block can invalidate the condition expression. + auto initializer = emit_for_loop_initializers(block); + auto condition = to_expression(child.condition); + + // Condition might have to be inverted. + if (execution_is_noop(get(child.true_block), get(block.merge_block))) + { + condition = join("!", enclose_expression(condition)); + target_block = child.false_block; + } + + auto continue_block = emit_continue_block(block.continue_block, false, false); + emit_block_hints(block); + statement("for (", initializer, "; ", condition, "; ", continue_block, ")"); + break; + } + + case SPIRBlock::WhileLoop: + { + emit_while_loop_initializers(block); + emit_block_hints(block); + + auto condition = to_expression(child.condition); + // Condition might have to be inverted. + if (execution_is_noop(get(child.true_block), get(block.merge_block))) + { + condition = join("!", enclose_expression(condition)); + target_block = child.false_block; + } + + statement("while (", condition, ")"); + break; + } + + default: + block.disable_block_optimization = true; + force_recompile(); + begin_scope(); // We'll see an end_scope() later. + return false; + } + + begin_scope(); + branch(child.self, target_block); + return true; + } + else + { + block.disable_block_optimization = true; + force_recompile(); + begin_scope(); // We'll see an end_scope() later. + return false; + } + } + else + return false; +} + +void CompilerGLSL::flush_undeclared_variables(SPIRBlock &block) +{ + for (auto &v : block.dominated_variables) + flush_variable_declaration(v); +} + +void CompilerGLSL::emit_hoisted_temporaries(SmallVector> &temporaries) +{ + // If we need to force temporaries for certain IDs due to continue blocks, do it before starting loop header. + // Need to sort these to ensure that reference output is stable. + sort(begin(temporaries), end(temporaries), + [](const pair &a, const pair &b) { return a.second < b.second; }); + + for (auto &tmp : temporaries) + { + auto &type = get(tmp.first); + + // There are some rare scenarios where we are asked to declare pointer types as hoisted temporaries. + // This should be ignored unless we're doing actual variable pointers and backend supports it. + // Access chains cannot normally be lowered to temporaries in GLSL and HLSL. + if (type.pointer && !backend.native_pointers) + continue; + + add_local_variable_name(tmp.second); + auto &flags = get_decoration_bitset(tmp.second); + + // Not all targets support pointer literals, so don't bother with that case. + string initializer; + if (options.force_zero_initialized_variables && type_can_zero_initialize(type)) + initializer = join(" = ", to_zero_initialized_expression(tmp.first)); + + statement(flags_to_qualifiers_glsl(type, flags), variable_decl(type, to_name(tmp.second)), initializer, ";"); + + hoisted_temporaries.insert(tmp.second); + forced_temporaries.insert(tmp.second); + + // The temporary might be read from before it's assigned, set up the expression now. + set(tmp.second, to_name(tmp.second), tmp.first, true); + + // If we have hoisted temporaries in multi-precision contexts, emit that here too ... + // We will not be able to analyze hoisted-ness for dependent temporaries that we hallucinate here. + auto mirrored_precision_itr = temporary_to_mirror_precision_alias.find(tmp.second); + if (mirrored_precision_itr != temporary_to_mirror_precision_alias.end()) + { + uint32_t mirror_id = mirrored_precision_itr->second; + auto &mirror_flags = get_decoration_bitset(mirror_id); + statement(flags_to_qualifiers_glsl(type, mirror_flags), + variable_decl(type, to_name(mirror_id)), + initializer, ";"); + // The temporary might be read from before it's assigned, set up the expression now. + set(mirror_id, to_name(mirror_id), tmp.first, true); + hoisted_temporaries.insert(mirror_id); + } + } +} + +void CompilerGLSL::emit_block_chain(SPIRBlock &block) +{ + bool select_branch_to_true_block = false; + bool select_branch_to_false_block = false; + bool skip_direct_branch = false; + bool emitted_loop_header_variables = false; + bool force_complex_continue_block = false; + ValueSaver loop_level_saver(current_loop_level); + + if (block.merge == SPIRBlock::MergeLoop) + add_loop_level(); + + // If we're emitting PHI variables with precision aliases, we have to emit them as hoisted temporaries. + for (auto var_id : block.dominated_variables) + { + auto &var = get(var_id); + if (var.phi_variable) + { + auto mirrored_precision_itr = temporary_to_mirror_precision_alias.find(var_id); + if (mirrored_precision_itr != temporary_to_mirror_precision_alias.end() && + find_if(block.declare_temporary.begin(), block.declare_temporary.end(), + [mirrored_precision_itr](const std::pair &p) { + return p.second == mirrored_precision_itr->second; + }) == block.declare_temporary.end()) + { + block.declare_temporary.push_back({ var.basetype, mirrored_precision_itr->second }); + } + } + } + + emit_hoisted_temporaries(block.declare_temporary); + + SPIRBlock::ContinueBlockType continue_type = SPIRBlock::ContinueNone; + if (block.continue_block) + { + continue_type = continue_block_type(get(block.continue_block)); + // If we know we cannot emit a loop, mark the block early as a complex loop so we don't force unnecessary recompiles. + if (continue_type == SPIRBlock::ComplexLoop) + block.complex_continue = true; + } + + // If we have loop variables, stop masking out access to the variable now. + for (auto var_id : block.loop_variables) + { + auto &var = get(var_id); + var.loop_variable_enable = true; + // We're not going to declare the variable directly, so emit a copy here. + emit_variable_temporary_copies(var); + } + + // Remember deferred declaration state. We will restore it before returning. + SmallVector rearm_dominated_variables(block.dominated_variables.size()); + for (size_t i = 0; i < block.dominated_variables.size(); i++) + { + uint32_t var_id = block.dominated_variables[i]; + auto &var = get(var_id); + rearm_dominated_variables[i] = var.deferred_declaration; + } + + // This is the method often used by spirv-opt to implement loops. + // The loop header goes straight into the continue block. + // However, don't attempt this on ESSL 1.0, because if a loop variable is used in a continue block, + // it *MUST* be used in the continue block. This loop method will not work. + if (!is_legacy_es() && block_is_loop_candidate(block, SPIRBlock::MergeToSelectContinueForLoop)) + { + flush_undeclared_variables(block); + if (attempt_emit_loop_header(block, SPIRBlock::MergeToSelectContinueForLoop)) + { + if (execution_is_noop(get(block.true_block), get(block.merge_block))) + select_branch_to_false_block = true; + else + select_branch_to_true_block = true; + + emitted_loop_header_variables = true; + force_complex_continue_block = true; + } + } + // This is the older loop behavior in glslang which branches to loop body directly from the loop header. + else if (block_is_loop_candidate(block, SPIRBlock::MergeToSelectForLoop)) + { + flush_undeclared_variables(block); + if (attempt_emit_loop_header(block, SPIRBlock::MergeToSelectForLoop)) + { + // The body of while, is actually just the true (or false) block, so always branch there unconditionally. + if (execution_is_noop(get(block.true_block), get(block.merge_block))) + select_branch_to_false_block = true; + else + select_branch_to_true_block = true; + + emitted_loop_header_variables = true; + } + } + // This is the newer loop behavior in glslang which branches from Loop header directly to + // a new block, which in turn has a OpBranchSelection without a selection merge. + else if (block_is_loop_candidate(block, SPIRBlock::MergeToDirectForLoop)) + { + flush_undeclared_variables(block); + if (attempt_emit_loop_header(block, SPIRBlock::MergeToDirectForLoop)) + { + skip_direct_branch = true; + emitted_loop_header_variables = true; + } + } + else if (continue_type == SPIRBlock::DoWhileLoop) + { + flush_undeclared_variables(block); + emit_while_loop_initializers(block); + emitted_loop_header_variables = true; + // We have some temporaries where the loop header is the dominator. + // We risk a case where we have code like: + // for (;;) { create-temporary; break; } consume-temporary; + // so force-declare temporaries here. + emit_hoisted_temporaries(block.potential_declare_temporary); + statement("do"); + begin_scope(); + + emit_block_instructions(block); + } + else if (block.merge == SPIRBlock::MergeLoop) + { + flush_undeclared_variables(block); + emit_while_loop_initializers(block); + emitted_loop_header_variables = true; + + // We have a generic loop without any distinguishable pattern like for, while or do while. + get(block.continue_block).complex_continue = true; + continue_type = SPIRBlock::ComplexLoop; + + // We have some temporaries where the loop header is the dominator. + // We risk a case where we have code like: + // for (;;) { create-temporary; break; } consume-temporary; + // so force-declare temporaries here. + emit_hoisted_temporaries(block.potential_declare_temporary); + emit_block_hints(block); + statement("for (;;)"); + begin_scope(); + + emit_block_instructions(block); + } + else + { + emit_block_instructions(block); + } + + // If we didn't successfully emit a loop header and we had loop variable candidates, we have a problem + // as writes to said loop variables might have been masked out, we need a recompile. + if (!emitted_loop_header_variables && !block.loop_variables.empty()) + { + force_recompile_guarantee_forward_progress(); + for (auto var : block.loop_variables) + get(var).loop_variable = false; + block.loop_variables.clear(); + } + + flush_undeclared_variables(block); + bool emit_next_block = true; + + // Handle end of block. + switch (block.terminator) + { + case SPIRBlock::Direct: + // True when emitting complex continue block. + if (block.loop_dominator == block.next_block) + { + branch(block.self, block.next_block); + emit_next_block = false; + } + // True if MergeToDirectForLoop succeeded. + else if (skip_direct_branch) + emit_next_block = false; + else if (is_continue(block.next_block) || is_break(block.next_block) || is_conditional(block.next_block)) + { + branch(block.self, block.next_block); + emit_next_block = false; + } + break; + + case SPIRBlock::Select: + // True if MergeToSelectForLoop or MergeToSelectContinueForLoop succeeded. + if (select_branch_to_true_block) + { + if (force_complex_continue_block) + { + assert(block.true_block == block.continue_block); + + // We're going to emit a continue block directly here, so make sure it's marked as complex. + auto &complex_continue = get(block.continue_block).complex_continue; + bool old_complex = complex_continue; + complex_continue = true; + branch(block.self, block.true_block); + complex_continue = old_complex; + } + else + branch(block.self, block.true_block); + } + else if (select_branch_to_false_block) + { + if (force_complex_continue_block) + { + assert(block.false_block == block.continue_block); + + // We're going to emit a continue block directly here, so make sure it's marked as complex. + auto &complex_continue = get(block.continue_block).complex_continue; + bool old_complex = complex_continue; + complex_continue = true; + branch(block.self, block.false_block); + complex_continue = old_complex; + } + else + branch(block.self, block.false_block); + } + else + branch(block.self, block.condition, block.true_block, block.false_block); + break; + + case SPIRBlock::MultiSelect: + { + auto &type = expression_type(block.condition); + bool unsigned_case = type.basetype == SPIRType::UInt || type.basetype == SPIRType::UShort || + type.basetype == SPIRType::UByte || type.basetype == SPIRType::UInt64; + + if (block.merge == SPIRBlock::MergeNone) + SPIRV_CROSS_THROW("Switch statement is not structured"); + + if (!backend.support_64bit_switch && (type.basetype == SPIRType::UInt64 || type.basetype == SPIRType::Int64)) + { + // SPIR-V spec suggests this is allowed, but we cannot support it in higher level languages. + SPIRV_CROSS_THROW("Cannot use 64-bit switch selectors."); + } + + const char *label_suffix = ""; + if (type.basetype == SPIRType::UInt && backend.uint32_t_literal_suffix) + label_suffix = "u"; + else if (type.basetype == SPIRType::Int64 && backend.support_64bit_switch) + label_suffix = "l"; + else if (type.basetype == SPIRType::UInt64 && backend.support_64bit_switch) + label_suffix = "ul"; + else if (type.basetype == SPIRType::UShort) + label_suffix = backend.uint16_t_literal_suffix; + else if (type.basetype == SPIRType::Short) + label_suffix = backend.int16_t_literal_suffix; + + current_emitting_switch_stack.push_back(&block); + + if (block.need_ladder_break) + statement("bool _", block.self, "_ladder_break = false;"); + + // Find all unique case constructs. + unordered_map> case_constructs; + SmallVector block_declaration_order; + SmallVector literals_to_merge; + + // If a switch case branches to the default block for some reason, we can just remove that literal from consideration + // and let the default: block handle it. + // 2.11 in SPIR-V spec states that for fall-through cases, there is a very strict declaration order which we can take advantage of here. + // We only need to consider possible fallthrough if order[i] branches to order[i + 1]. + auto &cases = get_case_list(block); + for (auto &c : cases) + { + if (c.block != block.next_block && c.block != block.default_block) + { + if (!case_constructs.count(c.block)) + block_declaration_order.push_back(c.block); + case_constructs[c.block].push_back(c.value); + } + else if (c.block == block.next_block && block.default_block != block.next_block) + { + // We might have to flush phi inside specific case labels. + // If we can piggyback on default:, do so instead. + literals_to_merge.push_back(c.value); + } + } + + // Empty literal array -> default. + if (block.default_block != block.next_block) + { + auto &default_block = get(block.default_block); + + // We need to slide in the default block somewhere in this chain + // if there are fall-through scenarios since the default is declared separately in OpSwitch. + // Only consider trivial fall-through cases here. + size_t num_blocks = block_declaration_order.size(); + bool injected_block = false; + + for (size_t i = 0; i < num_blocks; i++) + { + auto &case_block = get(block_declaration_order[i]); + if (execution_is_direct_branch(case_block, default_block)) + { + // Fallthrough to default block, we must inject the default block here. + block_declaration_order.insert(begin(block_declaration_order) + i + 1, block.default_block); + injected_block = true; + break; + } + else if (execution_is_direct_branch(default_block, case_block)) + { + // Default case is falling through to another case label, we must inject the default block here. + block_declaration_order.insert(begin(block_declaration_order) + i, block.default_block); + injected_block = true; + break; + } + } + + // Order does not matter. + if (!injected_block) + block_declaration_order.push_back(block.default_block); + else if (is_legacy_es()) + SPIRV_CROSS_THROW("Default case label fallthrough to other case label is not supported in ESSL 1.0."); + + case_constructs[block.default_block] = {}; + } + + size_t num_blocks = block_declaration_order.size(); + + const auto to_case_label = [](uint64_t literal, uint32_t width, bool is_unsigned_case) -> string + { + if (is_unsigned_case) + return convert_to_string(literal); + + // For smaller cases, the literals are compiled as 32 bit wide + // literals so we don't need to care for all sizes specifically. + if (width <= 32) + { + return convert_to_string(int64_t(int32_t(literal))); + } + + return convert_to_string(int64_t(literal)); + }; + + const auto to_legacy_case_label = [&](uint32_t condition, const SmallVector &labels, + const char *suffix) -> string { + string ret; + size_t count = labels.size(); + for (size_t i = 0; i < count; i++) + { + if (i) + ret += " || "; + ret += join(count > 1 ? "(" : "", to_enclosed_expression(condition), " == ", labels[i], suffix, + count > 1 ? ")" : ""); + } + return ret; + }; + + // We need to deal with a complex scenario for OpPhi. If we have case-fallthrough and Phi in the picture, + // we need to flush phi nodes outside the switch block in a branch, + // and skip any Phi handling inside the case label to make fall-through work as expected. + // This kind of code-gen is super awkward and it's a last resort. Normally we would want to handle this + // inside the case label if at all possible. + for (size_t i = 1; backend.support_case_fallthrough && i < num_blocks; i++) + { + if (flush_phi_required(block.self, block_declaration_order[i]) && + flush_phi_required(block_declaration_order[i - 1], block_declaration_order[i])) + { + uint32_t target_block = block_declaration_order[i]; + + // Make sure we flush Phi, it might have been marked to be ignored earlier. + get(target_block).ignore_phi_from_block = 0; + + auto &literals = case_constructs[target_block]; + + if (literals.empty()) + { + // Oh boy, gotta make a complete negative test instead! o.o + // Find all possible literals that would *not* make us enter the default block. + // If none of those literals match, we flush Phi ... + SmallVector conditions; + for (size_t j = 0; j < num_blocks; j++) + { + auto &negative_literals = case_constructs[block_declaration_order[j]]; + for (auto &case_label : negative_literals) + conditions.push_back(join(to_enclosed_expression(block.condition), + " != ", to_case_label(case_label, type.width, unsigned_case))); + } + + statement("if (", merge(conditions, " && "), ")"); + begin_scope(); + flush_phi(block.self, target_block); + end_scope(); + } + else + { + SmallVector conditions; + conditions.reserve(literals.size()); + for (auto &case_label : literals) + conditions.push_back(join(to_enclosed_expression(block.condition), + " == ", to_case_label(case_label, type.width, unsigned_case))); + statement("if (", merge(conditions, " || "), ")"); + begin_scope(); + flush_phi(block.self, target_block); + end_scope(); + } + + // Mark the block so that we don't flush Phi from header to case label. + get(target_block).ignore_phi_from_block = block.self; + } + } + + // If there is only one default block, and no cases, this is a case where SPIRV-opt decided to emulate + // non-structured exits with the help of a switch block. + // This is buggy on FXC, so just emit the logical equivalent of a do { } while(false), which is more idiomatic. + bool block_like_switch = cases.empty(); + + // If this is true, the switch is completely meaningless, and we should just avoid it. + bool collapsed_switch = block_like_switch && block.default_block == block.next_block; + + if (!collapsed_switch) + { + if (block_like_switch || is_legacy_es()) + { + // ESSL 1.0 is not guaranteed to support do/while. + if (is_legacy_es()) + { + uint32_t counter = statement_count; + statement("for (int spvDummy", counter, " = 0; spvDummy", counter, " < 1; spvDummy", counter, + "++)"); + } + else + statement("do"); + } + else + { + emit_block_hints(block); + statement("switch (", to_unpacked_expression(block.condition), ")"); + } + begin_scope(); + } + + for (size_t i = 0; i < num_blocks; i++) + { + uint32_t target_block = block_declaration_order[i]; + auto &literals = case_constructs[target_block]; + + if (literals.empty()) + { + // Default case. + if (!block_like_switch) + { + if (is_legacy_es()) + statement("else"); + else + statement("default:"); + } + } + else + { + if (is_legacy_es()) + { + statement((i ? "else " : ""), "if (", to_legacy_case_label(block.condition, literals, label_suffix), + ")"); + } + else + { + for (auto &case_literal : literals) + { + // The case label value must be sign-extended properly in SPIR-V, so we can assume 32-bit values here. + statement("case ", to_case_label(case_literal, type.width, unsigned_case), label_suffix, ":"); + } + } + } + + auto &case_block = get(target_block); + if (backend.support_case_fallthrough && i + 1 < num_blocks && + execution_is_direct_branch(case_block, get(block_declaration_order[i + 1]))) + { + // We will fall through here, so just terminate the block chain early. + // We still need to deal with Phi potentially. + // No need for a stack-like thing here since we only do fall-through when there is a + // single trivial branch to fall-through target.. + current_emitting_switch_fallthrough = true; + } + else + current_emitting_switch_fallthrough = false; + + if (!block_like_switch) + begin_scope(); + branch(block.self, target_block); + if (!block_like_switch) + end_scope(); + + current_emitting_switch_fallthrough = false; + } + + // Might still have to flush phi variables if we branch from loop header directly to merge target. + // This is supposed to emit all cases where we branch from header to merge block directly. + // There are two main scenarios where cannot rely on default fallthrough. + // - There is an explicit default: label already. + // In this case, literals_to_merge need to form their own "default" case, so that we avoid executing that block. + // - Header -> Merge requires flushing PHI. In this case, we need to collect all cases and flush PHI there. + bool header_merge_requires_phi = flush_phi_required(block.self, block.next_block); + bool need_fallthrough_block = block.default_block == block.next_block || !literals_to_merge.empty(); + if (!collapsed_switch && ((header_merge_requires_phi && need_fallthrough_block) || !literals_to_merge.empty())) + { + for (auto &case_literal : literals_to_merge) + statement("case ", to_case_label(case_literal, type.width, unsigned_case), label_suffix, ":"); + + if (block.default_block == block.next_block) + { + if (is_legacy_es()) + statement("else"); + else + statement("default:"); + } + + begin_scope(); + flush_phi(block.self, block.next_block); + statement("break;"); + end_scope(); + } + + if (!collapsed_switch) + { + if (block_like_switch && !is_legacy_es()) + end_scope_decl("while(false)"); + else + end_scope(); + } + else + flush_phi(block.self, block.next_block); + + if (block.need_ladder_break) + { + statement("if (_", block.self, "_ladder_break)"); + begin_scope(); + statement("break;"); + end_scope(); + } + + current_emitting_switch_stack.pop_back(); + break; + } + + case SPIRBlock::Return: + { + for (auto &line : current_function->fixup_hooks_out) + line(); + + if (processing_entry_point) + emit_fixup(); + + auto &cfg = get_cfg_for_current_function(); + + if (block.return_value) + { + auto &type = expression_type(block.return_value); + if (!type.array.empty() && !backend.can_return_array) + { + // If we cannot return arrays, we will have a special out argument we can write to instead. + // The backend is responsible for setting this up, and redirection the return values as appropriate. + if (ir.ids[block.return_value].get_type() != TypeUndef) + { + emit_array_copy("spvReturnValue", 0, block.return_value, StorageClassFunction, + get_expression_effective_storage_class(block.return_value)); + } + + if (!cfg.node_terminates_control_flow_in_sub_graph(current_function->entry_block, block.self) || + block.loop_dominator != BlockID(SPIRBlock::NoDominator)) + { + statement("return;"); + } + } + else + { + // OpReturnValue can return Undef, so don't emit anything for this case. + if (ir.ids[block.return_value].get_type() != TypeUndef) + statement("return ", to_unpacked_expression(block.return_value), ";"); + } + } + else if (!cfg.node_terminates_control_flow_in_sub_graph(current_function->entry_block, block.self) || + block.loop_dominator != BlockID(SPIRBlock::NoDominator)) + { + // If this block is the very final block and not called from control flow, + // we do not need an explicit return which looks out of place. Just end the function here. + // In the very weird case of for(;;) { return; } executing return is unconditional, + // but we actually need a return here ... + statement("return;"); + } + break; + } + + // If the Kill is terminating a block with a (probably synthetic) return value, emit a return value statement. + case SPIRBlock::Kill: + statement(backend.discard_literal, ";"); + if (block.return_value) + statement("return ", to_unpacked_expression(block.return_value), ";"); + break; + + case SPIRBlock::Unreachable: + { + // Avoid emitting false fallthrough, which can happen for + // if (cond) break; else discard; inside a case label. + // Discard is not always implementable as a terminator. + + auto &cfg = get_cfg_for_current_function(); + bool inner_dominator_is_switch = false; + ID id = block.self; + + while (id) + { + auto &iter_block = get(id); + if (iter_block.terminator == SPIRBlock::MultiSelect || + iter_block.merge == SPIRBlock::MergeLoop) + { + ID next_block = iter_block.merge == SPIRBlock::MergeLoop ? + iter_block.merge_block : iter_block.next_block; + bool outside_construct = next_block && cfg.find_common_dominator(next_block, block.self) == next_block; + if (!outside_construct) + { + inner_dominator_is_switch = iter_block.terminator == SPIRBlock::MultiSelect; + break; + } + } + + if (cfg.get_preceding_edges(id).empty()) + break; + + id = cfg.get_immediate_dominator(id); + } + + if (inner_dominator_is_switch) + statement("break; // unreachable workaround"); + + emit_next_block = false; + break; + } + + case SPIRBlock::IgnoreIntersection: + statement("ignoreIntersectionEXT;"); + break; + + case SPIRBlock::TerminateRay: + statement("terminateRayEXT;"); + break; + + case SPIRBlock::EmitMeshTasks: + emit_mesh_tasks(block); + break; + + default: + SPIRV_CROSS_THROW("Unimplemented block terminator."); + } + + if (block.next_block && emit_next_block) + { + // If we hit this case, we're dealing with an unconditional branch, which means we will output + // that block after this. If we had selection merge, we already flushed phi variables. + if (block.merge != SPIRBlock::MergeSelection) + { + flush_phi(block.self, block.next_block); + // For a direct branch, need to remember to invalidate expressions in the next linear block instead. + get(block.next_block).invalidate_expressions = block.invalidate_expressions; + } + + // For switch fallthrough cases, we terminate the chain here, but we still need to handle Phi. + if (!current_emitting_switch_fallthrough) + { + // For merge selects we might have ignored the fact that a merge target + // could have been a break; or continue; + // We will need to deal with it here. + if (is_loop_break(block.next_block)) + { + // Cannot check for just break, because switch statements will also use break. + assert(block.merge == SPIRBlock::MergeSelection); + statement("break;"); + } + else if (is_continue(block.next_block)) + { + assert(block.merge == SPIRBlock::MergeSelection); + branch_to_continue(block.self, block.next_block); + } + else if (BlockID(block.self) != block.next_block) + emit_block_chain(get(block.next_block)); + } + } + + if (block.merge == SPIRBlock::MergeLoop) + { + if (continue_type == SPIRBlock::DoWhileLoop) + { + // Make sure that we run the continue block to get the expressions set, but this + // should become an empty string. + // We have no fallbacks if we cannot forward everything to temporaries ... + const auto &continue_block = get(block.continue_block); + bool positive_test = execution_is_noop(get(continue_block.true_block), + get(continue_block.loop_dominator)); + + uint32_t current_count = statement_count; + auto statements = emit_continue_block(block.continue_block, positive_test, !positive_test); + if (statement_count != current_count) + { + // The DoWhile block has side effects, force ComplexLoop pattern next pass. + get(block.continue_block).complex_continue = true; + force_recompile(); + } + + // Might have to invert the do-while test here. + auto condition = to_expression(continue_block.condition); + if (!positive_test) + condition = join("!", enclose_expression(condition)); + + end_scope_decl(join("while (", condition, ")")); + } + else + end_scope(); + + loop_level_saver.release(); + + // We cannot break out of two loops at once, so don't check for break; here. + // Using block.self as the "from" block isn't quite right, but it has the same scope + // and dominance structure, so it's fine. + if (is_continue(block.merge_block)) + branch_to_continue(block.self, block.merge_block); + else + emit_block_chain(get(block.merge_block)); + } + + // Forget about control dependent expressions now. + block.invalidate_expressions.clear(); + + // After we return, we must be out of scope, so if we somehow have to re-emit this function, + // re-declare variables if necessary. + assert(rearm_dominated_variables.size() == block.dominated_variables.size()); + for (size_t i = 0; i < block.dominated_variables.size(); i++) + { + uint32_t var = block.dominated_variables[i]; + get(var).deferred_declaration = rearm_dominated_variables[i]; + } + + // Just like for deferred declaration, we need to forget about loop variable enable + // if our block chain is reinstantiated later. + for (auto &var_id : block.loop_variables) + get(var_id).loop_variable_enable = false; +} + +void CompilerGLSL::begin_scope() +{ + statement("{"); + indent++; +} + +void CompilerGLSL::end_scope() +{ + if (!indent) + SPIRV_CROSS_THROW("Popping empty indent stack."); + indent--; + statement("}"); +} + +void CompilerGLSL::end_scope(const string &trailer) +{ + if (!indent) + SPIRV_CROSS_THROW("Popping empty indent stack."); + indent--; + statement("}", trailer); +} + +void CompilerGLSL::end_scope_decl() +{ + if (!indent) + SPIRV_CROSS_THROW("Popping empty indent stack."); + indent--; + statement("};"); +} + +void CompilerGLSL::end_scope_decl(const string &decl) +{ + if (!indent) + SPIRV_CROSS_THROW("Popping empty indent stack."); + indent--; + statement("} ", decl, ";"); +} + +void CompilerGLSL::check_function_call_constraints(const uint32_t *args, uint32_t length) +{ + // If our variable is remapped, and we rely on type-remapping information as + // well, then we cannot pass the variable as a function parameter. + // Fixing this is non-trivial without stamping out variants of the same function, + // so for now warn about this and suggest workarounds instead. + for (uint32_t i = 0; i < length; i++) + { + auto *var = maybe_get(args[i]); + if (!var || !var->remapped_variable) + continue; + + auto &type = get(var->basetype); + if (type.basetype == SPIRType::Image && type.image.dim == DimSubpassData) + { + SPIRV_CROSS_THROW("Tried passing a remapped subpassInput variable to a function. " + "This will not work correctly because type-remapping information is lost. " + "To workaround, please consider not passing the subpass input as a function parameter, " + "or use in/out variables instead which do not need type remapping information."); + } + } +} + +const Instruction *CompilerGLSL::get_next_instruction_in_block(const Instruction &instr) +{ + // FIXME: This is kind of hacky. There should be a cleaner way. + auto offset = uint32_t(&instr - current_emitting_block->ops.data()); + if ((offset + 1) < current_emitting_block->ops.size()) + return ¤t_emitting_block->ops[offset + 1]; + else + return nullptr; +} + +uint32_t CompilerGLSL::mask_relevant_memory_semantics(uint32_t semantics) +{ + return semantics & (MemorySemanticsAtomicCounterMemoryMask | MemorySemanticsImageMemoryMask | + MemorySemanticsWorkgroupMemoryMask | MemorySemanticsUniformMemoryMask | + MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask); +} + +bool CompilerGLSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass, StorageClass) +{ + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + + statement(lhs, " = ", to_expression(rhs_id), ";"); + return true; +} + +bool CompilerGLSL::unroll_array_to_complex_store(uint32_t target_id, uint32_t source_id) +{ + if (!backend.force_gl_in_out_block) + return false; + // This path is only relevant for GL backends. + + auto *var = maybe_get(target_id); + if (!var || var->storage != StorageClassOutput) + return false; + + if (!is_builtin_variable(*var) || BuiltIn(get_decoration(var->self, DecorationBuiltIn)) != BuiltInSampleMask) + return false; + + auto &type = expression_type(source_id); + string array_expr; + if (type.array_size_literal.back()) + { + array_expr = convert_to_string(type.array.back()); + if (type.array.back() == 0) + SPIRV_CROSS_THROW("Cannot unroll an array copy from unsized array."); + } + else + array_expr = to_expression(type.array.back()); + + SPIRType target_type; + target_type.basetype = SPIRType::Int; + + statement("for (int i = 0; i < int(", array_expr, "); i++)"); + begin_scope(); + statement(to_expression(target_id), "[i] = ", + bitcast_expression(target_type, type.basetype, join(to_expression(source_id), "[i]")), + ";"); + end_scope(); + + return true; +} + +void CompilerGLSL::unroll_array_from_complex_load(uint32_t target_id, uint32_t source_id, std::string &expr) +{ + if (!backend.force_gl_in_out_block) + return; + // This path is only relevant for GL backends. + + auto *var = maybe_get(source_id); + if (!var) + return; + + if (var->storage != StorageClassInput && var->storage != StorageClassOutput) + return; + + auto &type = get_variable_data_type(*var); + if (type.array.empty()) + return; + + auto builtin = BuiltIn(get_decoration(var->self, DecorationBuiltIn)); + bool is_builtin = is_builtin_variable(*var) && + (builtin == BuiltInPointSize || + builtin == BuiltInPosition || + builtin == BuiltInSampleMask); + bool is_tess = is_tessellation_shader(); + bool is_patch = has_decoration(var->self, DecorationPatch); + bool is_sample_mask = is_builtin && builtin == BuiltInSampleMask; + + // Tessellation input arrays are special in that they are unsized, so we cannot directly copy from it. + // We must unroll the array load. + // For builtins, we couldn't catch this case normally, + // because this is resolved in the OpAccessChain in most cases. + // If we load the entire array, we have no choice but to unroll here. + if (!is_patch && (is_builtin || is_tess)) + { + auto new_expr = join("_", target_id, "_unrolled"); + statement(variable_decl(type, new_expr, target_id), ";"); + string array_expr; + if (type.array_size_literal.back()) + { + array_expr = convert_to_string(type.array.back()); + if (type.array.back() == 0) + SPIRV_CROSS_THROW("Cannot unroll an array copy from unsized array."); + } + else + array_expr = to_expression(type.array.back()); + + // The array size might be a specialization constant, so use a for-loop instead. + statement("for (int i = 0; i < int(", array_expr, "); i++)"); + begin_scope(); + if (is_builtin && !is_sample_mask) + statement(new_expr, "[i] = gl_in[i].", expr, ";"); + else if (is_sample_mask) + { + SPIRType target_type; + target_type.basetype = SPIRType::Int; + statement(new_expr, "[i] = ", bitcast_expression(target_type, type.basetype, join(expr, "[i]")), ";"); + } + else + statement(new_expr, "[i] = ", expr, "[i];"); + end_scope(); + + expr = std::move(new_expr); + } +} + +void CompilerGLSL::cast_from_variable_load(uint32_t source_id, std::string &expr, const SPIRType &expr_type) +{ + // We will handle array cases elsewhere. + if (!expr_type.array.empty()) + return; + + auto *var = maybe_get_backing_variable(source_id); + if (var) + source_id = var->self; + + // Only interested in standalone builtin variables. + if (!has_decoration(source_id, DecorationBuiltIn)) + { + // Except for int attributes in legacy GLSL, which are cast from float. + if (is_legacy() && expr_type.basetype == SPIRType::Int && var && var->storage == StorageClassInput) + expr = join(type_to_glsl(expr_type), "(", expr, ")"); + return; + } + + auto builtin = static_cast(get_decoration(source_id, DecorationBuiltIn)); + auto expected_type = expr_type.basetype; + + // TODO: Fill in for more builtins. + switch (builtin) + { + case BuiltInLayer: + case BuiltInPrimitiveId: + case BuiltInViewportIndex: + case BuiltInInstanceId: + case BuiltInInstanceIndex: + case BuiltInVertexId: + case BuiltInVertexIndex: + case BuiltInSampleId: + case BuiltInBaseVertex: + case BuiltInBaseInstance: + case BuiltInDrawIndex: + case BuiltInFragStencilRefEXT: + case BuiltInInstanceCustomIndexNV: + case BuiltInSampleMask: + case BuiltInPrimitiveShadingRateKHR: + case BuiltInShadingRateKHR: + expected_type = SPIRType::Int; + break; + + case BuiltInGlobalInvocationId: + case BuiltInLocalInvocationId: + case BuiltInWorkgroupId: + case BuiltInLocalInvocationIndex: + case BuiltInWorkgroupSize: + case BuiltInNumWorkgroups: + case BuiltInIncomingRayFlagsNV: + case BuiltInLaunchIdNV: + case BuiltInLaunchSizeNV: + case BuiltInPrimitiveTriangleIndicesEXT: + case BuiltInPrimitiveLineIndicesEXT: + case BuiltInPrimitivePointIndicesEXT: + expected_type = SPIRType::UInt; + break; + + default: + break; + } + + if (expected_type != expr_type.basetype) + expr = bitcast_expression(expr_type, expected_type, expr); +} + +void CompilerGLSL::cast_to_variable_store(uint32_t target_id, std::string &expr, const SPIRType &expr_type) +{ + auto *var = maybe_get_backing_variable(target_id); + if (var) + target_id = var->self; + + // Only interested in standalone builtin variables. + if (!has_decoration(target_id, DecorationBuiltIn)) + return; + + auto builtin = static_cast(get_decoration(target_id, DecorationBuiltIn)); + auto expected_type = expr_type.basetype; + + // TODO: Fill in for more builtins. + switch (builtin) + { + case BuiltInLayer: + case BuiltInPrimitiveId: + case BuiltInViewportIndex: + case BuiltInFragStencilRefEXT: + case BuiltInSampleMask: + case BuiltInPrimitiveShadingRateKHR: + case BuiltInShadingRateKHR: + expected_type = SPIRType::Int; + break; + + default: + break; + } + + if (expected_type != expr_type.basetype) + { + auto type = expr_type; + type.basetype = expected_type; + expr = bitcast_expression(type, expr_type.basetype, expr); + } +} + +void CompilerGLSL::convert_non_uniform_expression(string &expr, uint32_t ptr_id) +{ + if (*backend.nonuniform_qualifier == '\0') + return; + + auto *var = maybe_get_backing_variable(ptr_id); + if (!var) + return; + + if (var->storage != StorageClassUniformConstant && + var->storage != StorageClassStorageBuffer && + var->storage != StorageClassUniform) + return; + + auto &backing_type = get(var->basetype); + if (backing_type.array.empty()) + return; + + // If we get here, we know we're accessing an arrayed resource which + // might require nonuniform qualifier. + + auto start_array_index = expr.find_first_of('['); + + if (start_array_index == string::npos) + return; + + // We've opened a bracket, track expressions until we can close the bracket. + // This must be our resource index. + size_t end_array_index = string::npos; + unsigned bracket_count = 1; + for (size_t index = start_array_index + 1; index < expr.size(); index++) + { + if (expr[index] == ']') + { + if (--bracket_count == 0) + { + end_array_index = index; + break; + } + } + else if (expr[index] == '[') + bracket_count++; + } + + assert(bracket_count == 0); + + // Doesn't really make sense to declare a non-arrayed image with nonuniformEXT, but there's + // nothing we can do here to express that. + if (start_array_index == string::npos || end_array_index == string::npos || end_array_index < start_array_index) + return; + + start_array_index++; + + expr = join(expr.substr(0, start_array_index), backend.nonuniform_qualifier, "(", + expr.substr(start_array_index, end_array_index - start_array_index), ")", + expr.substr(end_array_index, string::npos)); +} + +void CompilerGLSL::emit_block_hints(const SPIRBlock &block) +{ + if ((options.es && options.version < 310) || (!options.es && options.version < 140)) + return; + + switch (block.hint) + { + case SPIRBlock::HintFlatten: + require_extension_internal("GL_EXT_control_flow_attributes"); + statement("SPIRV_CROSS_FLATTEN"); + break; + case SPIRBlock::HintDontFlatten: + require_extension_internal("GL_EXT_control_flow_attributes"); + statement("SPIRV_CROSS_BRANCH"); + break; + case SPIRBlock::HintUnroll: + require_extension_internal("GL_EXT_control_flow_attributes"); + statement("SPIRV_CROSS_UNROLL"); + break; + case SPIRBlock::HintDontUnroll: + require_extension_internal("GL_EXT_control_flow_attributes"); + statement("SPIRV_CROSS_LOOP"); + break; + default: + break; + } +} + +void CompilerGLSL::preserve_alias_on_reset(uint32_t id) +{ + preserved_aliases[id] = get_name(id); +} + +void CompilerGLSL::reset_name_caches() +{ + for (auto &preserved : preserved_aliases) + set_name(preserved.first, preserved.second); + + preserved_aliases.clear(); + resource_names.clear(); + block_input_names.clear(); + block_output_names.clear(); + block_ubo_names.clear(); + block_ssbo_names.clear(); + block_names.clear(); + function_overloads.clear(); +} + +void CompilerGLSL::fixup_anonymous_struct_names(std::unordered_set &visited, const SPIRType &type) +{ + if (visited.count(type.self)) + return; + visited.insert(type.self); + + for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++) + { + auto &mbr_type = get(type.member_types[i]); + + if (mbr_type.basetype == SPIRType::Struct) + { + // If there are multiple aliases, the output might be somewhat unpredictable, + // but the only real alternative in that case is to do nothing, which isn't any better. + // This check should be fine in practice. + if (get_name(mbr_type.self).empty() && !get_member_name(type.self, i).empty()) + { + auto anon_name = join("anon_", get_member_name(type.self, i)); + ParsedIR::sanitize_underscores(anon_name); + set_name(mbr_type.self, anon_name); + } + + fixup_anonymous_struct_names(visited, mbr_type); + } + } +} + +void CompilerGLSL::fixup_anonymous_struct_names() +{ + // HLSL codegen can often end up emitting anonymous structs inside blocks, which + // breaks GL linking since all names must match ... + // Try to emit sensible code, so attempt to find such structs and emit anon_$member. + + // Breaks exponential explosion with weird type trees. + std::unordered_set visited; + + ir.for_each_typed_id([&](uint32_t, SPIRType &type) { + if (type.basetype == SPIRType::Struct && + (has_decoration(type.self, DecorationBlock) || + has_decoration(type.self, DecorationBufferBlock))) + { + fixup_anonymous_struct_names(visited, type); + } + }); +} + +void CompilerGLSL::fixup_type_alias() +{ + // Due to how some backends work, the "master" type of type_alias must be a block-like type if it exists. + ir.for_each_typed_id([&](uint32_t self, SPIRType &type) { + if (!type.type_alias) + return; + + if (has_decoration(type.self, DecorationBlock) || has_decoration(type.self, DecorationBufferBlock)) + { + // Top-level block types should never alias anything else. + type.type_alias = 0; + } + else if (type_is_block_like(type) && type.self == ID(self)) + { + // A block-like type is any type which contains Offset decoration, but not top-level blocks, + // i.e. blocks which are placed inside buffers. + // Become the master. + ir.for_each_typed_id([&](uint32_t other_id, SPIRType &other_type) { + if (other_id == self) + return; + + if (other_type.type_alias == type.type_alias) + other_type.type_alias = self; + }); + + this->get(type.type_alias).type_alias = self; + type.type_alias = 0; + } + }); +} + +void CompilerGLSL::reorder_type_alias() +{ + // Reorder declaration of types so that the master of the type alias is always emitted first. + // We need this in case a type B depends on type A (A must come before in the vector), but A is an alias of a type Abuffer, which + // means declaration of A doesn't happen (yet), and order would be B, ABuffer and not ABuffer, B. Fix this up here. + auto loop_lock = ir.create_loop_hard_lock(); + + auto &type_ids = ir.ids_for_type[TypeType]; + for (auto alias_itr = begin(type_ids); alias_itr != end(type_ids); ++alias_itr) + { + auto &type = get(*alias_itr); + if (type.type_alias != TypeID(0) && + !has_extended_decoration(type.type_alias, SPIRVCrossDecorationBufferBlockRepacked)) + { + // We will skip declaring this type, so make sure the type_alias type comes before. + auto master_itr = find(begin(type_ids), end(type_ids), ID(type.type_alias)); + assert(master_itr != end(type_ids)); + + if (alias_itr < master_itr) + { + // Must also swap the type order for the constant-type joined array. + auto &joined_types = ir.ids_for_constant_undef_or_type; + auto alt_alias_itr = find(begin(joined_types), end(joined_types), *alias_itr); + auto alt_master_itr = find(begin(joined_types), end(joined_types), *master_itr); + assert(alt_alias_itr != end(joined_types)); + assert(alt_master_itr != end(joined_types)); + + swap(*alias_itr, *master_itr); + swap(*alt_alias_itr, *alt_master_itr); + } + } + } +} + +void CompilerGLSL::emit_line_directive(uint32_t file_id, uint32_t line_literal) +{ + // If we are redirecting statements, ignore the line directive. + // Common case here is continue blocks. + if (redirect_statement) + return; + + if (options.emit_line_directives) + { + require_extension_internal("GL_GOOGLE_cpp_style_line_directive"); + statement_no_indent("#line ", line_literal, " \"", get(file_id).str, "\""); + } +} + +void CompilerGLSL::emit_copy_logical_type(uint32_t lhs_id, uint32_t lhs_type_id, uint32_t rhs_id, uint32_t rhs_type_id, + SmallVector chain) +{ + // Fully unroll all member/array indices one by one. + + auto &lhs_type = get(lhs_type_id); + auto &rhs_type = get(rhs_type_id); + + if (!lhs_type.array.empty()) + { + // Could use a loop here to support specialization constants, but it gets rather complicated with nested array types, + // and this is a rather obscure opcode anyways, keep it simple unless we are forced to. + uint32_t array_size = to_array_size_literal(lhs_type); + chain.push_back(0); + + for (uint32_t i = 0; i < array_size; i++) + { + chain.back() = i; + emit_copy_logical_type(lhs_id, lhs_type.parent_type, rhs_id, rhs_type.parent_type, chain); + } + } + else if (lhs_type.basetype == SPIRType::Struct) + { + chain.push_back(0); + uint32_t member_count = uint32_t(lhs_type.member_types.size()); + for (uint32_t i = 0; i < member_count; i++) + { + chain.back() = i; + emit_copy_logical_type(lhs_id, lhs_type.member_types[i], rhs_id, rhs_type.member_types[i], chain); + } + } + else + { + // Need to handle unpack/packing fixups since this can differ wildly between the logical types, + // particularly in MSL. + // To deal with this, we emit access chains and go through emit_store_statement + // to deal with all the special cases we can encounter. + + AccessChainMeta lhs_meta, rhs_meta; + auto lhs = access_chain_internal(lhs_id, chain.data(), uint32_t(chain.size()), + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, &lhs_meta); + auto rhs = access_chain_internal(rhs_id, chain.data(), uint32_t(chain.size()), + ACCESS_CHAIN_INDEX_IS_LITERAL_BIT, &rhs_meta); + + uint32_t id = ir.increase_bound_by(2); + lhs_id = id; + rhs_id = id + 1; + + { + auto &lhs_expr = set(lhs_id, std::move(lhs), lhs_type_id, true); + lhs_expr.need_transpose = lhs_meta.need_transpose; + + if (lhs_meta.storage_is_packed) + set_extended_decoration(lhs_id, SPIRVCrossDecorationPhysicalTypePacked); + if (lhs_meta.storage_physical_type != 0) + set_extended_decoration(lhs_id, SPIRVCrossDecorationPhysicalTypeID, lhs_meta.storage_physical_type); + + forwarded_temporaries.insert(lhs_id); + suppressed_usage_tracking.insert(lhs_id); + } + + { + auto &rhs_expr = set(rhs_id, std::move(rhs), rhs_type_id, true); + rhs_expr.need_transpose = rhs_meta.need_transpose; + + if (rhs_meta.storage_is_packed) + set_extended_decoration(rhs_id, SPIRVCrossDecorationPhysicalTypePacked); + if (rhs_meta.storage_physical_type != 0) + set_extended_decoration(rhs_id, SPIRVCrossDecorationPhysicalTypeID, rhs_meta.storage_physical_type); + + forwarded_temporaries.insert(rhs_id); + suppressed_usage_tracking.insert(rhs_id); + } + + emit_store_statement(lhs_id, rhs_id); + } +} + +bool CompilerGLSL::subpass_input_is_framebuffer_fetch(uint32_t id) const +{ + if (!has_decoration(id, DecorationInputAttachmentIndex)) + return false; + + uint32_t input_attachment_index = get_decoration(id, DecorationInputAttachmentIndex); + for (auto &remap : subpass_to_framebuffer_fetch_attachment) + if (remap.first == input_attachment_index) + return true; + + return false; +} + +const SPIRVariable *CompilerGLSL::find_subpass_input_by_attachment_index(uint32_t index) const +{ + const SPIRVariable *ret = nullptr; + ir.for_each_typed_id([&](uint32_t, const SPIRVariable &var) { + if (has_decoration(var.self, DecorationInputAttachmentIndex) && + get_decoration(var.self, DecorationInputAttachmentIndex) == index) + { + ret = &var; + } + }); + return ret; +} + +const SPIRVariable *CompilerGLSL::find_color_output_by_location(uint32_t location) const +{ + const SPIRVariable *ret = nullptr; + ir.for_each_typed_id([&](uint32_t, const SPIRVariable &var) { + if (var.storage == StorageClassOutput && get_decoration(var.self, DecorationLocation) == location) + ret = &var; + }); + return ret; +} + +void CompilerGLSL::emit_inout_fragment_outputs_copy_to_subpass_inputs() +{ + for (auto &remap : subpass_to_framebuffer_fetch_attachment) + { + auto *subpass_var = find_subpass_input_by_attachment_index(remap.first); + auto *output_var = find_color_output_by_location(remap.second); + if (!subpass_var) + continue; + if (!output_var) + SPIRV_CROSS_THROW("Need to declare the corresponding fragment output variable to be able " + "to read from it."); + if (is_array(get(output_var->basetype))) + SPIRV_CROSS_THROW("Cannot use GL_EXT_shader_framebuffer_fetch with arrays of color outputs."); + + auto &func = get(get_entry_point().self); + func.fixup_hooks_in.push_back([=]() { + if (is_legacy()) + { + statement(to_expression(subpass_var->self), " = ", "gl_LastFragData[", + get_decoration(output_var->self, DecorationLocation), "];"); + } + else + { + uint32_t num_rt_components = this->get(output_var->basetype).vecsize; + statement(to_expression(subpass_var->self), vector_swizzle(num_rt_components, 0), " = ", + to_expression(output_var->self), ";"); + } + }); + } +} + +bool CompilerGLSL::variable_is_depth_or_compare(VariableID id) const +{ + return is_depth_image(get(get(id).basetype), id); +} + +const char *CompilerGLSL::ShaderSubgroupSupportHelper::get_extension_name(Candidate c) +{ + static const char *const retval[CandidateCount] = { "GL_KHR_shader_subgroup_ballot", + "GL_KHR_shader_subgroup_basic", + "GL_KHR_shader_subgroup_vote", + "GL_KHR_shader_subgroup_arithmetic", + "GL_NV_gpu_shader_5", + "GL_NV_shader_thread_group", + "GL_NV_shader_thread_shuffle", + "GL_ARB_shader_ballot", + "GL_ARB_shader_group_vote", + "GL_AMD_gcn_shader" }; + return retval[c]; +} + +SmallVector CompilerGLSL::ShaderSubgroupSupportHelper::get_extra_required_extension_names(Candidate c) +{ + switch (c) + { + case ARB_shader_ballot: + return { "GL_ARB_shader_int64" }; + case AMD_gcn_shader: + return { "GL_AMD_gpu_shader_int64", "GL_NV_gpu_shader5" }; + default: + return {}; + } +} + +const char *CompilerGLSL::ShaderSubgroupSupportHelper::get_extra_required_extension_predicate(Candidate c) +{ + switch (c) + { + case ARB_shader_ballot: + return "defined(GL_ARB_shader_int64)"; + case AMD_gcn_shader: + return "(defined(GL_AMD_gpu_shader_int64) || defined(GL_NV_gpu_shader5))"; + default: + return ""; + } +} + +CompilerGLSL::ShaderSubgroupSupportHelper::FeatureVector CompilerGLSL::ShaderSubgroupSupportHelper:: + get_feature_dependencies(Feature feature) +{ + switch (feature) + { + case SubgroupAllEqualT: + return { SubgroupBroadcast_First, SubgroupAll_Any_AllEqualBool }; + case SubgroupElect: + return { SubgroupBallotFindLSB_MSB, SubgroupBallot, SubgroupInvocationID }; + case SubgroupInverseBallot_InclBitCount_ExclBitCout: + return { SubgroupMask }; + case SubgroupBallotBitCount: + return { SubgroupBallot }; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulInclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, SubgroupMask, SubgroupBallotBitExtract }; + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticFMulExclusiveScan: + return { SubgroupSize, SubgroupBallot, SubgroupBallotBitCount, + SubgroupMask, SubgroupElect, SubgroupBallotBitExtract }; + default: + return {}; + } +} + +CompilerGLSL::ShaderSubgroupSupportHelper::FeatureMask CompilerGLSL::ShaderSubgroupSupportHelper:: + get_feature_dependency_mask(Feature feature) +{ + return build_mask(get_feature_dependencies(feature)); +} + +bool CompilerGLSL::ShaderSubgroupSupportHelper::can_feature_be_implemented_without_extensions(Feature feature) +{ + static const bool retval[FeatureCount] = { + false, false, false, false, false, false, + true, // SubgroupBalloFindLSB_MSB + false, false, false, false, + true, // SubgroupMemBarrier - replaced with workgroup memory barriers + false, false, true, false, + false, false, false, false, false, false, // iadd, fadd + false, false, false, false, false, false, // imul , fmul + }; + + return retval[feature]; +} + +CompilerGLSL::ShaderSubgroupSupportHelper::Candidate CompilerGLSL::ShaderSubgroupSupportHelper:: + get_KHR_extension_for_feature(Feature feature) +{ + static const Candidate extensions[FeatureCount] = { + KHR_shader_subgroup_ballot, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, + KHR_shader_subgroup_basic, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_vote, + KHR_shader_subgroup_vote, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, KHR_shader_subgroup_basic, + KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, KHR_shader_subgroup_ballot, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, KHR_shader_subgroup_arithmetic, + }; + + return extensions[feature]; +} + +void CompilerGLSL::ShaderSubgroupSupportHelper::request_feature(Feature feature) +{ + feature_mask |= (FeatureMask(1) << feature) | get_feature_dependency_mask(feature); +} + +bool CompilerGLSL::ShaderSubgroupSupportHelper::is_feature_requested(Feature feature) const +{ + return (feature_mask & (1u << feature)) != 0; +} + +CompilerGLSL::ShaderSubgroupSupportHelper::Result CompilerGLSL::ShaderSubgroupSupportHelper::resolve() const +{ + Result res; + + for (uint32_t i = 0u; i < FeatureCount; ++i) + { + if (feature_mask & (1u << i)) + { + auto feature = static_cast(i); + std::unordered_set unique_candidates; + + auto candidates = get_candidates_for_feature(feature); + unique_candidates.insert(candidates.begin(), candidates.end()); + + auto deps = get_feature_dependencies(feature); + for (Feature d : deps) + { + candidates = get_candidates_for_feature(d); + if (!candidates.empty()) + unique_candidates.insert(candidates.begin(), candidates.end()); + } + + for (uint32_t c : unique_candidates) + ++res.weights[static_cast(c)]; + } + } + + return res; +} + +CompilerGLSL::ShaderSubgroupSupportHelper::CandidateVector CompilerGLSL::ShaderSubgroupSupportHelper:: + get_candidates_for_feature(Feature ft, const Result &r) +{ + auto c = get_candidates_for_feature(ft); + auto cmp = [&r](Candidate a, Candidate b) { + if (r.weights[a] == r.weights[b]) + return a < b; // Prefer candidates with lower enum value + return r.weights[a] > r.weights[b]; + }; + std::sort(c.begin(), c.end(), cmp); + return c; +} + +CompilerGLSL::ShaderSubgroupSupportHelper::CandidateVector CompilerGLSL::ShaderSubgroupSupportHelper:: + get_candidates_for_feature(Feature feature) +{ + switch (feature) + { + case SubgroupMask: + return { KHR_shader_subgroup_ballot, NV_shader_thread_group, ARB_shader_ballot }; + case SubgroupSize: + return { KHR_shader_subgroup_basic, NV_shader_thread_group, AMD_gcn_shader, ARB_shader_ballot }; + case SubgroupInvocationID: + return { KHR_shader_subgroup_basic, NV_shader_thread_group, ARB_shader_ballot }; + case SubgroupID: + return { KHR_shader_subgroup_basic, NV_shader_thread_group }; + case NumSubgroups: + return { KHR_shader_subgroup_basic, NV_shader_thread_group }; + case SubgroupBroadcast_First: + return { KHR_shader_subgroup_ballot, NV_shader_thread_shuffle, ARB_shader_ballot }; + case SubgroupBallotFindLSB_MSB: + return { KHR_shader_subgroup_ballot, NV_shader_thread_group }; + case SubgroupAll_Any_AllEqualBool: + return { KHR_shader_subgroup_vote, NV_gpu_shader_5, ARB_shader_group_vote, AMD_gcn_shader }; + case SubgroupAllEqualT: + return {}; // depends on other features only + case SubgroupElect: + return {}; // depends on other features only + case SubgroupBallot: + return { KHR_shader_subgroup_ballot, NV_shader_thread_group, ARB_shader_ballot }; + case SubgroupBarrier: + return { KHR_shader_subgroup_basic, NV_shader_thread_group, ARB_shader_ballot, AMD_gcn_shader }; + case SubgroupMemBarrier: + return { KHR_shader_subgroup_basic }; + case SubgroupInverseBallot_InclBitCount_ExclBitCout: + return {}; + case SubgroupBallotBitExtract: + return { NV_shader_thread_group }; + case SubgroupBallotBitCount: + return {}; + case SubgroupArithmeticIAddReduce: + case SubgroupArithmeticIAddExclusiveScan: + case SubgroupArithmeticIAddInclusiveScan: + case SubgroupArithmeticFAddReduce: + case SubgroupArithmeticFAddExclusiveScan: + case SubgroupArithmeticFAddInclusiveScan: + case SubgroupArithmeticIMulReduce: + case SubgroupArithmeticIMulExclusiveScan: + case SubgroupArithmeticIMulInclusiveScan: + case SubgroupArithmeticFMulReduce: + case SubgroupArithmeticFMulExclusiveScan: + case SubgroupArithmeticFMulInclusiveScan: + return { KHR_shader_subgroup_arithmetic, NV_shader_thread_shuffle }; + default: + return {}; + } +} + +CompilerGLSL::ShaderSubgroupSupportHelper::FeatureMask CompilerGLSL::ShaderSubgroupSupportHelper::build_mask( + const SmallVector &features) +{ + FeatureMask mask = 0; + for (Feature f : features) + mask |= FeatureMask(1) << f; + return mask; +} + +CompilerGLSL::ShaderSubgroupSupportHelper::Result::Result() +{ + for (auto &weight : weights) + weight = 0; + + // Make sure KHR_shader_subgroup extensions are always prefered. + const uint32_t big_num = FeatureCount; + weights[KHR_shader_subgroup_ballot] = big_num; + weights[KHR_shader_subgroup_basic] = big_num; + weights[KHR_shader_subgroup_vote] = big_num; + weights[KHR_shader_subgroup_arithmetic] = big_num; +} + +void CompilerGLSL::request_workaround_wrapper_overload(TypeID id) +{ + // Must be ordered to maintain deterministic output, so vector is appropriate. + if (find(begin(workaround_ubo_load_overload_types), end(workaround_ubo_load_overload_types), id) == + end(workaround_ubo_load_overload_types)) + { + force_recompile(); + workaround_ubo_load_overload_types.push_back(id); + } +} + +void CompilerGLSL::rewrite_load_for_wrapped_row_major(std::string &expr, TypeID loaded_type, ID ptr) +{ + // Loading row-major matrices from UBOs on older AMD Windows OpenGL drivers is problematic. + // To load these types correctly, we must first wrap them in a dummy function which only purpose is to + // ensure row_major decoration is actually respected. + auto *var = maybe_get_backing_variable(ptr); + if (!var) + return; + + auto &backing_type = get(var->basetype); + bool is_ubo = backing_type.basetype == SPIRType::Struct && backing_type.storage == StorageClassUniform && + has_decoration(backing_type.self, DecorationBlock); + if (!is_ubo) + return; + + auto *type = &get(loaded_type); + bool rewrite = false; + bool relaxed = options.es; + + if (is_matrix(*type)) + { + // To avoid adding a lot of unnecessary meta tracking to forward the row_major state, + // we will simply look at the base struct itself. It is exceptionally rare to mix and match row-major/col-major state. + // If there is any row-major action going on, we apply the workaround. + // It is harmless to apply the workaround to column-major matrices, so this is still a valid solution. + // If an access chain occurred, the workaround is not required, so loading vectors or scalars don't need workaround. + type = &backing_type; + } + else + { + // If we're loading a composite, we don't have overloads like these. + relaxed = false; + } + + if (type->basetype == SPIRType::Struct) + { + // If we're loading a struct where any member is a row-major matrix, apply the workaround. + for (uint32_t i = 0; i < uint32_t(type->member_types.size()); i++) + { + auto decorations = combined_decoration_for_member(*type, i); + if (decorations.get(DecorationRowMajor)) + rewrite = true; + + // Since we decide on a per-struct basis, only use mediump wrapper if all candidates are mediump. + if (!decorations.get(DecorationRelaxedPrecision)) + relaxed = false; + } + } + + if (rewrite) + { + request_workaround_wrapper_overload(loaded_type); + expr = join("spvWorkaroundRowMajor", (relaxed ? "MP" : ""), "(", expr, ")"); + } +} + +void CompilerGLSL::mask_stage_output_by_location(uint32_t location, uint32_t component) +{ + masked_output_locations.insert({ location, component }); +} + +void CompilerGLSL::mask_stage_output_by_builtin(BuiltIn builtin) +{ + masked_output_builtins.insert(builtin); +} + +bool CompilerGLSL::is_stage_output_variable_masked(const SPIRVariable &var) const +{ + auto &type = get(var.basetype); + bool is_block = has_decoration(type.self, DecorationBlock); + // Blocks by themselves are never masked. Must be masked per-member. + if (is_block) + return false; + + bool is_builtin = has_decoration(var.self, DecorationBuiltIn); + + if (is_builtin) + { + return is_stage_output_builtin_masked(BuiltIn(get_decoration(var.self, DecorationBuiltIn))); + } + else + { + if (!has_decoration(var.self, DecorationLocation)) + return false; + + return is_stage_output_location_masked( + get_decoration(var.self, DecorationLocation), + get_decoration(var.self, DecorationComponent)); + } +} + +bool CompilerGLSL::is_stage_output_block_member_masked(const SPIRVariable &var, uint32_t index, bool strip_array) const +{ + auto &type = get(var.basetype); + bool is_block = has_decoration(type.self, DecorationBlock); + if (!is_block) + return false; + + BuiltIn builtin = BuiltInMax; + if (is_member_builtin(type, index, &builtin)) + { + return is_stage_output_builtin_masked(builtin); + } + else + { + uint32_t location = get_declared_member_location(var, index, strip_array); + uint32_t component = get_member_decoration(type.self, index, DecorationComponent); + return is_stage_output_location_masked(location, component); + } +} + +bool CompilerGLSL::is_per_primitive_variable(const SPIRVariable &var) const +{ + if (has_decoration(var.self, DecorationPerPrimitiveEXT)) + return true; + + auto &type = get(var.basetype); + if (!has_decoration(type.self, DecorationBlock)) + return false; + + for (uint32_t i = 0, n = uint32_t(type.member_types.size()); i < n; i++) + if (!has_member_decoration(type.self, i, DecorationPerPrimitiveEXT)) + return false; + + return true; +} + +bool CompilerGLSL::is_stage_output_location_masked(uint32_t location, uint32_t component) const +{ + return masked_output_locations.count({ location, component }) != 0; +} + +bool CompilerGLSL::is_stage_output_builtin_masked(spv::BuiltIn builtin) const +{ + return masked_output_builtins.count(builtin) != 0; +} + +uint32_t CompilerGLSL::get_declared_member_location(const SPIRVariable &var, uint32_t mbr_idx, bool strip_array) const +{ + auto &block_type = get(var.basetype); + if (has_member_decoration(block_type.self, mbr_idx, DecorationLocation)) + return get_member_decoration(block_type.self, mbr_idx, DecorationLocation); + else + return get_accumulated_member_location(var, mbr_idx, strip_array); +} + +uint32_t CompilerGLSL::get_accumulated_member_location(const SPIRVariable &var, uint32_t mbr_idx, bool strip_array) const +{ + auto &type = strip_array ? get_variable_element_type(var) : get_variable_data_type(var); + uint32_t location = get_decoration(var.self, DecorationLocation); + + for (uint32_t i = 0; i < mbr_idx; i++) + { + auto &mbr_type = get(type.member_types[i]); + + // Start counting from any place we have a new location decoration. + if (has_member_decoration(type.self, mbr_idx, DecorationLocation)) + location = get_member_decoration(type.self, mbr_idx, DecorationLocation); + + uint32_t location_count = type_to_location_count(mbr_type); + location += location_count; + } + + return location; +} + +StorageClass CompilerGLSL::get_expression_effective_storage_class(uint32_t ptr) +{ + auto *var = maybe_get_backing_variable(ptr); + + // If the expression has been lowered to a temporary, we need to use the Generic storage class. + // We're looking for the effective storage class of a given expression. + // An access chain or forwarded OpLoads from such access chains + // will generally have the storage class of the underlying variable, but if the load was not forwarded + // we have lost any address space qualifiers. + bool forced_temporary = ir.ids[ptr].get_type() == TypeExpression && !get(ptr).access_chain && + (forced_temporaries.count(ptr) != 0 || forwarded_temporaries.count(ptr) == 0); + + if (var && !forced_temporary) + { + if (variable_decl_is_remapped_storage(*var, StorageClassWorkgroup)) + return StorageClassWorkgroup; + if (variable_decl_is_remapped_storage(*var, StorageClassStorageBuffer)) + return StorageClassStorageBuffer; + + // Normalize SSBOs to StorageBuffer here. + if (var->storage == StorageClassUniform && + has_decoration(get(var->basetype).self, DecorationBufferBlock)) + return StorageClassStorageBuffer; + else + return var->storage; + } + else + return expression_type(ptr).storage; +} + +uint32_t CompilerGLSL::type_to_location_count(const SPIRType &type) const +{ + uint32_t count; + if (type.basetype == SPIRType::Struct) + { + uint32_t mbr_count = uint32_t(type.member_types.size()); + count = 0; + for (uint32_t i = 0; i < mbr_count; i++) + count += type_to_location_count(get(type.member_types[i])); + } + else + { + count = type.columns > 1 ? type.columns : 1; + } + + uint32_t dim_count = uint32_t(type.array.size()); + for (uint32_t i = 0; i < dim_count; i++) + count *= to_array_size_literal(type, i); + + return count; +} diff --git a/third_party/spirv-cross/spirv_glsl.hpp b/third_party/spirv-cross/spirv_glsl.hpp index 0b40ed801e..66b23cbeab 100644 --- a/third_party/spirv-cross/spirv_glsl.hpp +++ b/third_party/spirv-cross/spirv_glsl.hpp @@ -258,6 +258,10 @@ public: // require_extension("GL_KHR_my_extension"); void require_extension(const std::string &ext); + // Returns the list of required extensions. After compilation this will contains any other + // extensions that the compiler used automatically, in addition to the user specified ones. + const SmallVector &get_required_extensions() const; + // Legacy GLSL compatibility method. // Takes a uniform or push constant variable and flattens it into a (i|u)vec4 array[N]; array instead. // For this to work, all types in the block must be the same basic type, e.g. mixing vec2 and vec4 is fine, but @@ -292,6 +296,7 @@ protected: KHR_shader_subgroup_ballot, KHR_shader_subgroup_basic, KHR_shader_subgroup_vote, + KHR_shader_subgroup_arithmetic, NV_gpu_shader_5, NV_shader_thread_group, NV_shader_thread_shuffle, @@ -324,7 +329,18 @@ protected: SubgroupInverseBallot_InclBitCount_ExclBitCout = 13, SubgroupBallotBitExtract = 14, SubgroupBallotBitCount = 15, - + SubgroupArithmeticIAddReduce = 16, + SubgroupArithmeticIAddExclusiveScan = 17, + SubgroupArithmeticIAddInclusiveScan = 18, + SubgroupArithmeticFAddReduce = 19, + SubgroupArithmeticFAddExclusiveScan = 20, + SubgroupArithmeticFAddInclusiveScan = 21, + SubgroupArithmeticIMulReduce = 22, + SubgroupArithmeticIMulExclusiveScan = 23, + SubgroupArithmeticIMulInclusiveScan = 24, + SubgroupArithmeticFMulReduce = 25, + SubgroupArithmeticFMulExclusiveScan = 26, + SubgroupArithmeticFMulInclusiveScan = 27, FeatureCount }; @@ -358,7 +374,7 @@ protected: }; // TODO remove this function when all subgroup ops are supported (or make it always return true) - static bool is_supported_subgroup_op_in_opengl(spv::Op op); + static bool is_supported_subgroup_op_in_opengl(spv::Op op, const uint32_t *ops); void reset(uint32_t iteration_count); void emit_function(SPIRFunction &func, const Bitset &return_flags); @@ -414,7 +430,9 @@ protected: const std::string &qualifier = "", uint32_t base_offset = 0); virtual void emit_struct_padding_target(const SPIRType &type); virtual std::string image_type_glsl(const SPIRType &type, uint32_t id = 0); - std::string constant_expression(const SPIRConstant &c, bool inside_block_like_struct_scope = false); + std::string constant_expression(const SPIRConstant &c, + bool inside_block_like_struct_scope = false, + bool inside_struct_scope = false); virtual std::string constant_op_expression(const SPIRConstantOp &cop); virtual std::string constant_expression_vector(const SPIRConstant &c, uint32_t vector); virtual void emit_fixup(); @@ -465,6 +483,8 @@ protected: virtual bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const; + virtual bool is_user_type_structured(uint32_t id) const; + void emit_copy_logical_type(uint32_t lhs_id, uint32_t lhs_type_id, uint32_t rhs_id, uint32_t rhs_type_id, SmallVector chain); @@ -590,6 +610,7 @@ protected: const char *uint16_t_literal_suffix = "us"; const char *nonuniform_qualifier = "nonuniformEXT"; const char *boolean_mix_function = "mix"; + SPIRType::BaseType boolean_in_struct_remapped_type = SPIRType::Boolean; bool swizzle_is_function = false; bool shared_is_implied = false; bool unsized_array_supported = true; @@ -627,6 +648,7 @@ protected: void emit_struct(SPIRType &type); void emit_resources(); void emit_extension_workarounds(spv::ExecutionModel model); + void emit_subgroup_arithmetic_workaround(const std::string &func, spv::Op op, spv::GroupOperation group_op); void emit_polyfills(uint32_t polyfills, bool relaxed); void emit_buffer_block_native(const SPIRVariable &var); void emit_buffer_reference_block(uint32_t type_id, bool forward_declaration); @@ -757,8 +779,8 @@ protected: void append_global_func_args(const SPIRFunction &func, uint32_t index, SmallVector &arglist); std::string to_non_uniform_aware_expression(uint32_t id); std::string to_expression(uint32_t id, bool register_expression_read = true); - std::string to_composite_constructor_expression(uint32_t id, bool block_like_type); - std::string to_rerolled_array_expression(const std::string &expr, const SPIRType &type); + std::string to_composite_constructor_expression(const SPIRType &parent_type, uint32_t id, bool block_like_type); + std::string to_rerolled_array_expression(const SPIRType &parent_type, const std::string &expr, const SPIRType &type); std::string to_enclosed_expression(uint32_t id, bool register_expression_read = true); std::string to_unpacked_expression(uint32_t id, bool register_expression_read = true); std::string to_unpacked_row_major_matrix_expression(uint32_t id); @@ -791,7 +813,7 @@ protected: std::string layout_for_variable(const SPIRVariable &variable); std::string to_combined_image_sampler(VariableID image_id, VariableID samp_id); virtual bool skip_argument(uint32_t id) const; - virtual void emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + virtual bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage); virtual void emit_block_hints(const SPIRBlock &block); virtual std::string to_initializer_expression(const SPIRVariable &var); diff --git a/third_party/spirv-cross/spirv_hlsl.cpp b/third_party/spirv-cross/spirv_hlsl.cpp index 5763b5ffac..d702197813 100644 --- a/third_party/spirv-cross/spirv_hlsl.cpp +++ b/third_party/spirv-cross/spirv_hlsl.cpp @@ -724,10 +724,8 @@ void CompilerHLSL::emit_builtin_primitive_outputs_in_struct() { case BuiltInLayer: { - const ExecutionModel model = get_entry_point().model; - if (hlsl_options.shader_model < 50 || - (model != ExecutionModelGeometry && model != ExecutionModelMeshEXT)) - SPIRV_CROSS_THROW("Render target array index output is only supported in GS/MS 5.0 or higher."); + if (hlsl_options.shader_model < 50) + SPIRV_CROSS_THROW("Render target array index output is only supported in SM 5.0 or higher."); type = "uint"; semantic = "SV_RenderTargetArrayIndex"; break; @@ -2605,11 +2603,30 @@ void CompilerHLSL::emit_buffer_block(const SPIRVariable &var) bool is_readonly = flags.get(DecorationNonWritable) && !is_hlsl_force_storage_buffer_as_uav(var.self); bool is_coherent = flags.get(DecorationCoherent) && !is_readonly; bool is_interlocked = interlocked_resources.count(var.self) > 0; - const char *type_name = "ByteAddressBuffer "; - if (!is_readonly) - type_name = is_interlocked ? "RasterizerOrderedByteAddressBuffer " : "RWByteAddressBuffer "; + + auto to_structuredbuffer_subtype_name = [this](const SPIRType &parent_type) -> std::string + { + if (parent_type.basetype == SPIRType::Struct && parent_type.member_types.size() == 1) + { + // Use type of first struct member as a StructuredBuffer will have only one '._m0' field in SPIR-V + const auto &member0_type = this->get(parent_type.member_types.front()); + return this->type_to_glsl(member0_type); + } + else + { + // Otherwise, this StructuredBuffer only has a basic subtype, e.g. StructuredBuffer + return this->type_to_glsl(parent_type); + } + }; + + std::string type_name; + if (is_user_type_structured(var.self)) + type_name = join(is_readonly ? "" : is_interlocked ? "RasterizerOrdered" : "RW", "StructuredBuffer<", to_structuredbuffer_subtype_name(type), ">"); + else + type_name = is_readonly ? "ByteAddressBuffer" : is_interlocked ? "RasterizerOrderedByteAddressBuffer" : "RWByteAddressBuffer"; + add_resource_name(var.self); - statement(is_coherent ? "globallycoherent " : "", type_name, to_name(var.self), type_to_array_glsl(type), + statement(is_coherent ? "globallycoherent " : "", type_name, " ", to_name(var.self), type_to_array_glsl(type), to_resource_binding(var), ";"); } else @@ -3526,7 +3543,7 @@ void CompilerHLSL::emit_texture_op(const Instruction &i, bool sparse) { if (gather) { - SPIRV_CROSS_THROW("GatherCmp does not exist in HLSL."); + texop += ".GatherCmp"; } else if (lod || grad_x || grad_y) { @@ -4971,6 +4988,12 @@ void CompilerHLSL::emit_access_chain(const Instruction &instruction) auto *backing_variable = maybe_get_backing_variable(ops[2]); + if (backing_variable != nullptr && is_user_type_structured(backing_variable->self)) + { + CompilerGLSL::emit_instruction(instruction); + return; + } + string base; if (to_plain_buffer_length != 0) base = access_chain(ops[2], &ops[3], to_plain_buffer_length, get(ops[0])); @@ -6695,3 +6718,17 @@ bool CompilerHLSL::builtin_translates_to_nonarray(spv::BuiltIn builtin) const { return (builtin == BuiltInSampleMask); } + +bool CompilerHLSL::is_user_type_structured(uint32_t id) const +{ + if (hlsl_options.preserve_structured_buffers) + { + // Compare left hand side of string only as these user types can contain more meta data such as their subtypes, + // e.g. "structuredbuffer:int" + const std::string &user_type = get_decoration_string(id, DecorationUserTypeGOOGLE); + return user_type.compare(0, 16, "structuredbuffer") == 0 || + user_type.compare(0, 18, "rwstructuredbuffer") == 0 || + user_type.compare(0, 33, "rasterizerorderedstructuredbuffer") == 0; + } + return false; +} diff --git a/third_party/spirv-cross/spirv_hlsl.hpp b/third_party/spirv-cross/spirv_hlsl.hpp index 51af5bf07d..a5d30b1b2a 100644 --- a/third_party/spirv-cross/spirv_hlsl.hpp +++ b/third_party/spirv-cross/spirv_hlsl.hpp @@ -145,6 +145,11 @@ public: // Rather than emitting main() for the entry point, use the name in SPIR-V. bool use_entry_point_name = false; + + // Preserve (RW)StructuredBuffer types if the input source was HLSL. + // This relies on UserTypeGOOGLE to encode the buffer type either as "structuredbuffer" or "rwstructuredbuffer" + // whereas the type can be extended with an optional subtype, e.g. "structuredbuffer:int". + bool preserve_structured_buffers = false; }; explicit CompilerHLSL(std::vector spirv_) @@ -398,6 +403,9 @@ private: // Returns true for BuiltInSampleMask because gl_SampleMask[] is an array in SPIR-V, but SV_Coverage is a scalar in HLSL. bool builtin_translates_to_nonarray(spv::BuiltIn builtin) const override; + // Returns true if the specified ID has a UserTypeGOOGLE decoration for StructuredBuffer or RWStructuredBuffer resources. + bool is_user_type_structured(uint32_t id) const override; + std::vector composite_selection_workaround_types; std::string get_inner_entry_point_name() const; diff --git a/third_party/spirv-cross/spirv_msl.cpp b/third_party/spirv-cross/spirv_msl.cpp index 1d1ae0a193..8d83d7e031 100644 --- a/third_party/spirv-cross/spirv_msl.cpp +++ b/third_party/spirv-cross/spirv_msl.cpp @@ -1467,6 +1467,7 @@ string CompilerMSL::compile() backend.support_small_type_sampling_result = true; backend.supports_empty_struct = true; backend.support_64bit_switch = true; + backend.boolean_in_struct_remapped_type = SPIRType::Short; // Allow Metal to use the array template unless we force it off. backend.can_return_array = !msl_options.force_native_arrays; @@ -2142,8 +2143,7 @@ void CompilerMSL::extract_global_variables_from_function(uint32_t func_id, std:: func.add_parameter(type_id, next_id, true); set(next_id, type_id, StorageClassFunction, 0, arg_id); - // Ensure the existing variable has a valid name and the new variable has all the same meta info - set_name(arg_id, ensure_valid_name(to_name(arg_id), "v")); + // Ensure the new variable has all the same meta info ir.meta[next_id] = ir.meta[arg_id]; } } @@ -7235,7 +7235,7 @@ void CompilerMSL::declare_constant_arrays() // FIXME: However, hoisting constants to main() means we need to pass down constant arrays to leaf functions if they are used there. // If there are multiple functions in the module, drop this case to avoid breaking use cases which do not need to // link into Metal libraries. This is hacky. - if (!type.array.empty() && (!fully_inlined || is_scalar(type) || is_vector(type))) + if (type_is_top_level_array(type) && (!fully_inlined || is_scalar(type) || is_vector(type))) { add_resource_name(c.self); auto name = to_name(c.self); @@ -7267,7 +7267,7 @@ void CompilerMSL::declare_complex_constant_arrays() return; auto &type = this->get(c.constant_type); - if (!type.array.empty() && !(is_scalar(type) || is_vector(type))) + if (type_is_top_level_array(type) && !(is_scalar(type) || is_vector(type))) { add_resource_name(c.self); auto name = to_name(c.self); @@ -7377,11 +7377,6 @@ void CompilerMSL::emit_specialization_constants_and_structs() string sc_type_name = type_to_glsl(type); add_resource_name(c.self); string sc_name = to_name(c.self); - uint32_t constant_id = get_decoration(c.self, DecorationSpecId); - if (!unique_func_constants.count(constant_id)) - unique_func_constants.insert(make_pair(constant_id, c.self)); - SPIRType::BaseType sc_tmp_type = expression_type(unique_func_constants[constant_id]).basetype; - string sc_tmp_name = to_name(unique_func_constants[constant_id]) + "_tmp"; // Function constants are only supported in MSL 1.2 and later. // If we don't support it just declare the "default" directly. @@ -7392,6 +7387,11 @@ void CompilerMSL::emit_specialization_constants_and_structs() !c.is_used_as_array_length) { // Only scalar, non-composite values can be function constants. + uint32_t constant_id = get_decoration(c.self, DecorationSpecId); + if (!unique_func_constants.count(constant_id)) + unique_func_constants.insert(make_pair(constant_id, c.self)); + SPIRType::BaseType sc_tmp_type = expression_type(unique_func_constants[constant_id]).basetype; + string sc_tmp_name = to_name(unique_func_constants[constant_id]) + "_tmp"; if (unique_func_constants[constant_id] == c.self) statement("constant ", sc_type_name, " ", sc_tmp_name, " [[function_constant(", constant_id, ")]];"); @@ -9470,7 +9470,7 @@ static bool storage_class_array_is_thread(StorageClass storage) } } -void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t rhs_id, +bool CompilerMSL::emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, StorageClass lhs_storage, StorageClass rhs_storage) { // Allow Metal to use the array template to make arrays a value type. @@ -9509,10 +9509,21 @@ void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t r // Avoid spvCopy* wrapper functions; Otherwise, spvUnsafeArray<> template cannot be used with that storage qualifier. if (lhs_is_array_template && rhs_is_array_template && !using_builtin_array()) { - statement(lhs, " = ", to_expression(rhs_id), ";"); + // Fall back to normal copy path. + return false; } else { + // Ensure the LHS variable has been declared + if (lhs_var) + flush_variable_declaration(lhs_var->self); + + string lhs; + if (expr) + lhs = expr; + else + lhs = to_expression(lhs_id); + // Assignment from an array initializer is fine. auto &type = expression_type(rhs_id); auto *var = maybe_get_backing_variable(rhs_id); @@ -9586,6 +9597,8 @@ void CompilerMSL::emit_array_copy(const string &lhs, uint32_t lhs_id, uint32_t r else statement("spvArrayCopy", tag, type.array.size(), "(", lhs, ", ", to_expression(rhs_id), ");"); } + + return true; } uint32_t CompilerMSL::get_physical_tess_level_array_size(spv::BuiltIn builtin) const @@ -9604,7 +9617,7 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) { // We only care about assignments of an entire array auto &type = expression_type(id_rhs); - if (type.array.size() == 0) + if (!type_is_top_level_array(get_pointee_type(type))) return false; auto *var = maybe_get(id_lhs); @@ -9642,14 +9655,11 @@ bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs) } } - // Ensure the LHS variable has been declared - auto *p_v_lhs = maybe_get_backing_variable(id_lhs); - if (p_v_lhs) - flush_variable_declaration(p_v_lhs->self); - auto lhs_storage = get_expression_effective_storage_class(id_lhs); auto rhs_storage = get_expression_effective_storage_class(id_rhs); - emit_array_copy(to_expression(id_lhs), id_lhs, id_rhs, lhs_storage, rhs_storage); + if (!emit_array_copy(nullptr, id_lhs, id_rhs, lhs_storage, rhs_storage)) + return false; + register_write(id_lhs); return true; @@ -10332,7 +10342,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) { if (arg_type.array.empty()) { - decl += join(", ", sampler_type(arg_type, arg.id), " ", to_sampler_expression(arg.id)); + decl += join(", ", sampler_type(arg_type, arg.id), " ", to_sampler_expression(name_id)); } else { @@ -10340,7 +10350,8 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) descriptor_address_space(name_id, StorageClassUniformConstant, "thread const"); - decl += join(", ", sampler_address_space, " ", sampler_type(arg_type, arg.id), "& ", to_sampler_expression(arg.id)); + decl += join(", ", sampler_address_space, " ", sampler_type(arg_type, name_id), "& ", + to_sampler_expression(name_id)); } } } @@ -10350,7 +10361,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) !is_dynamic_img_sampler) { bool arg_is_array = !arg_type.array.empty(); - decl += join(", constant uint", arg_is_array ? "* " : "& ", to_swizzle_expression(arg.id)); + decl += join(", constant uint", arg_is_array ? "* " : "& ", to_swizzle_expression(name_id)); } if (buffer_requires_array_length(name_id)) @@ -10902,26 +10913,29 @@ string CompilerMSL::to_function_args(const TextureFunctionArguments &args, bool // Therefore, dP/dx = dP/dy = exp2(lod)/extent. // (Subtracting 0.5 before exponentiation gives better results.) string grad_opt, extent; + VariableID base_img = img; + if (auto *combined = maybe_get(img)) + base_img = combined->image; switch (imgtype.image.dim) { case Dim1D: grad_opt = "2d"; - extent = join("float2(", to_expression(img), ".get_width(), 1.0)"); + extent = join("float2(", to_expression(base_img), ".get_width(), 1.0)"); break; case Dim2D: grad_opt = "2d"; - extent = join("float2(", to_expression(img), ".get_width(), ", to_expression(img), ".get_height())"); + extent = join("float2(", to_expression(base_img), ".get_width(), ", to_expression(base_img), ".get_height())"); break; case DimCube: if (imgtype.image.arrayed && msl_options.emulate_cube_array) { grad_opt = "2d"; - extent = join("float2(", to_expression(img), ".get_width())"); + extent = join("float2(", to_expression(base_img), ".get_width())"); } else { grad_opt = "cube"; - extent = join("float3(", to_expression(img), ".get_width())"); + extent = join("float3(", to_expression(base_img), ".get_width())"); } break; default: @@ -14550,7 +14564,7 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) string type_name; // Pointer? - if (type.pointer) + if (type_is_top_level_pointer(type) || type_is_array_of_pointers(type)) { assert(type.pointer_depth > 0); @@ -14573,7 +14587,17 @@ string CompilerMSL::type_to_glsl(const SPIRType &type, uint32_t id, bool member) while (type_is_pointer(*p_parent_type)) p_parent_type = &get(p_parent_type->parent_type); + // If we're emitting BDA, just use the templated type. + // Emitting builtin arrays need a lot of cooperation with other code to ensure + // the C-style nesting works right. + // FIXME: This is somewhat of a hack. + bool old_is_using_builtin_array = is_using_builtin_array; + if (type_is_top_level_physical_pointer(type)) + is_using_builtin_array = false; + type_name = join(type_address_space, " ", type_to_glsl(*p_parent_type, id)); + + is_using_builtin_array = old_is_using_builtin_array; } switch (type.basetype) @@ -16771,20 +16795,31 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr, auto *source_expr = maybe_get(source_id); auto *var = maybe_get_backing_variable(source_id); const SPIRType *var_type = nullptr, *phys_type = nullptr; + if (uint32_t phys_id = get_extended_decoration(source_id, SPIRVCrossDecorationPhysicalTypeID)) phys_type = &get(phys_id); else phys_type = &expr_type; + if (var) { source_id = var->self; var_type = &get_variable_data_type(*var); } + bool rewrite_boolean_load = + expr_type.basetype == SPIRType::Boolean && + (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct)); + // Type fixups for workgroup variables if they are booleans. - if (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct) && - expr_type.basetype == SPIRType::Boolean) - expr = join(type_to_glsl(expr_type), "(", expr, ")"); + if (rewrite_boolean_load) + { + if (type_is_top_level_array(expr_type)) + expr = to_rerolled_array_expression(expr_type, expr, expr_type); + else + expr = join(type_to_glsl(expr_type), "(", expr, ")"); + } + // Type fixups for workgroup variables if they are matrices. // Don't do fixup for packed types; those are handled specially. // FIXME: Maybe use a type like spvStorageMatrix for packed matrices? @@ -16897,24 +16932,37 @@ void CompilerMSL::cast_to_variable_store(uint32_t target_id, std::string &expr, auto *target_expr = maybe_get(target_id); auto *var = maybe_get_backing_variable(target_id); const SPIRType *var_type = nullptr, *phys_type = nullptr; + if (uint32_t phys_id = get_extended_decoration(target_id, SPIRVCrossDecorationPhysicalTypeID)) phys_type = &get(phys_id); else phys_type = &expr_type; + if (var) { target_id = var->self; var_type = &get_variable_data_type(*var); } - // Type fixups for workgroup variables if they are booleans. - if (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct) && - expr_type.basetype == SPIRType::Boolean) + bool rewrite_boolean_store = + expr_type.basetype == SPIRType::Boolean && + (var && (var->storage == StorageClassWorkgroup || var_type->basetype == SPIRType::Struct)); + + // Type fixups for workgroup variables or struct members if they are booleans. + if (rewrite_boolean_store) { - auto short_type = expr_type; - short_type.basetype = SPIRType::Short; - expr = join(type_to_glsl(short_type), "(", expr, ")"); + if (type_is_top_level_array(expr_type)) + { + expr = to_rerolled_array_expression(*var_type, expr, expr_type); + } + else + { + auto short_type = expr_type; + short_type.basetype = SPIRType::Short; + expr = join(type_to_glsl(short_type), "(", expr, ")"); + } } + // Type fixups for workgroup variables if they are matrices. // Don't do fixup for packed types; those are handled specially. // FIXME: Maybe use a type like spvStorageMatrix for packed matrices? diff --git a/third_party/spirv-cross/spirv_msl.hpp b/third_party/spirv-cross/spirv_msl.hpp index 2bc17b1227..4c5c753db7 100644 --- a/third_party/spirv-cross/spirv_msl.hpp +++ b/third_party/spirv-cross/spirv_msl.hpp @@ -1032,7 +1032,7 @@ protected: void add_pragma_line(const std::string &line); void add_typedef_line(const std::string &line); void emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem); - void emit_array_copy(const std::string &lhs, uint32_t lhs_id, uint32_t rhs_id, + bool emit_array_copy(const char *expr, uint32_t lhs_id, uint32_t rhs_id, spv::StorageClass lhs_storage, spv::StorageClass rhs_storage) override; void build_implicit_builtins(); uint32_t build_constant_uint_array_pointer(); diff --git a/third_party/spirv-cross/spirv_reflect.cpp b/third_party/spirv-cross/spirv_reflect.cpp index 0bd224e6c2..9fcd3bc09b 100644 --- a/third_party/spirv-cross/spirv_reflect.cpp +++ b/third_party/spirv-cross/spirv_reflect.cpp @@ -292,7 +292,7 @@ bool CompilerReflection::type_is_reference(const SPIRType &type) const { // Physical pointers and arrays of physical pointers need to refer to the pointee's type. return type_is_top_level_physical_pointer(type) || - (!type.array.empty() && type_is_top_level_physical_pointer(get(type.parent_type))); + (type_is_array_of_pointers(type) && type.storage == StorageClassPhysicalStorageBuffer); } void CompilerReflection::emit_types() diff --git a/third_party/spirv-cross/test_shaders.py b/third_party/spirv-cross/test_shaders.py index 1e8af62abe..6ae9c94afd 100755 --- a/third_party/spirv-cross/test_shaders.py +++ b/third_party/spirv-cross/test_shaders.py @@ -515,6 +515,8 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati hlsl_args.append('--hlsl-flatten-matrix-vertex-input-semantics') if '.relax-nan.' in shader: hlsl_args.append('--relax-nan-checks') + if '.structured.' in shader: + hlsl_args.append('--hlsl-preserve-structured-buffers') subprocess.check_call(hlsl_args) diff --git a/third_party/spirv-cross/tests-other/c_api_test.c b/third_party/spirv-cross/tests-other/c_api_test.c new file mode 100644 index 0000000000..74a1883ab4 --- /dev/null +++ b/third_party/spirv-cross/tests-other/c_api_test.c @@ -0,0 +1,223 @@ +/* Smoke test for the C API. */ + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) +#define SPVC_CHECKED_CALL_NEGATIVE(x) do { \ + g_fail_on_error = SPVC_FALSE; \ + if ((x) == SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ + g_fail_on_error = SPVC_TRUE; \ +} while(0) + +static int read_file(const char *path, SpvId **buffer, size_t *word_count) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return -1; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + *buffer = malloc(len); + if (fread(*buffer, 1, len, file) != (size_t)len) + { + fclose(file); + free(*buffer); + return -1; + } + + fclose(file); + *word_count = len / sizeof(SpvId); + return 0; +} + +static spvc_bool g_fail_on_error = SPVC_TRUE; + +static void error_callback(void *userdata, const char *error) +{ + (void)userdata; + if (g_fail_on_error) + { + fprintf(stderr, "Error: %s\n", error); + exit(1); + } + else + printf("Expected error hit: %s.\n", error); +} + +static void dump_resource_list(spvc_compiler compiler, spvc_resources resources, spvc_resource_type type, const char *tag) +{ + const spvc_reflected_resource *list = NULL; + size_t count = 0; + size_t i; + SPVC_CHECKED_CALL(spvc_resources_get_resource_list_for_type(resources, type, &list, &count)); + printf("%s\n", tag); + for (i = 0; i < count; i++) + { + printf("ID: %u, BaseTypeID: %u, TypeID: %u, Name: %s\n", list[i].id, list[i].base_type_id, list[i].type_id, + list[i].name); + printf(" Set: %u, Binding: %u\n", + spvc_compiler_get_decoration(compiler, list[i].id, SpvDecorationDescriptorSet), + spvc_compiler_get_decoration(compiler, list[i].id, SpvDecorationBinding)); + } +} + +static void dump_resources(spvc_compiler compiler, spvc_resources resources) +{ + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_UNIFORM_BUFFER, "UBO"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_STORAGE_BUFFER, "SSBO"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_PUSH_CONSTANT, "Push"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_SEPARATE_SAMPLERS, "Samplers"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_SEPARATE_IMAGE, "Image"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_SAMPLED_IMAGE, "Combined image samplers"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_STAGE_INPUT, "Stage input"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_STAGE_OUTPUT, "Stage output"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_STORAGE_IMAGE, "Storage image"); + dump_resource_list(compiler, resources, SPVC_RESOURCE_TYPE_SUBPASS_INPUT, "Subpass input"); +} + +static void compile(spvc_compiler compiler, const char *tag) +{ + const char *result = NULL; + SPVC_CHECKED_CALL(spvc_compiler_compile(compiler, &result)); + printf("\n%s\n=======\n", tag); + printf("%s\n=======\n", result); +} + +int main(int argc, char **argv) +{ + const char *rev = NULL; + + spvc_context context = NULL; + spvc_parsed_ir ir = NULL; + spvc_compiler compiler_glsl = NULL; + spvc_compiler compiler_hlsl = NULL; + spvc_compiler compiler_msl = NULL; + spvc_compiler compiler_cpp = NULL; + spvc_compiler compiler_json = NULL; + spvc_compiler compiler_none = NULL; + spvc_compiler_options options = NULL; + spvc_resources resources = NULL; + SpvId *buffer = NULL; + size_t word_count = 0; + + rev = spvc_get_commit_revision_and_timestamp(); + if (!rev || *rev == '\0') + return 1; + + printf("Revision: %s\n", rev); + + if (argc != 5) + return 1; + + if (read_file(argv[1], &buffer, &word_count) < 0) + return 1; + + unsigned abi_major, abi_minor, abi_patch; + spvc_get_version(&abi_major, &abi_minor, &abi_patch); + if (abi_major != strtoul(argv[2], NULL, 0)) + { + fprintf(stderr, "VERSION_MAJOR mismatch!\n"); + return 1; + } + + if (abi_minor != strtoul(argv[3], NULL, 0)) + { + fprintf(stderr, "VERSION_MINOR mismatch!\n"); + return 1; + } + + if (abi_patch != strtoul(argv[4], NULL, 0)) + { + fprintf(stderr, "VERSION_PATCH mismatch!\n"); + return 1; + } + + SPVC_CHECKED_CALL(spvc_context_create(&context)); + spvc_context_set_error_callback(context, error_callback, NULL); + SPVC_CHECKED_CALL(spvc_context_parse_spirv(context, buffer, word_count, &ir)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_GLSL, ir, SPVC_CAPTURE_MODE_COPY, &compiler_glsl)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_HLSL, ir, SPVC_CAPTURE_MODE_COPY, &compiler_hlsl)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_MSL, ir, SPVC_CAPTURE_MODE_COPY, &compiler_msl)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_CPP, ir, SPVC_CAPTURE_MODE_COPY, &compiler_cpp)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_JSON, ir, SPVC_CAPTURE_MODE_COPY, &compiler_json)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(context, SPVC_BACKEND_NONE, ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler_none)); + + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_none, &options)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_none, options)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_json, &options)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_json, options)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_cpp, &options)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_cpp, options)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_msl, &options)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_msl, options)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_hlsl, &options)); + SPVC_CHECKED_CALL(spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL, 50)); + SPVC_CHECKED_CALL_NEGATIVE(spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_MSL_PLATFORM, 1)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_hlsl, options)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler_glsl, &options)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler_glsl, options)); + +#define NUM_EXTS 2 + const char *expected_exts[NUM_EXTS] = + { + "EXT_first", + "EXT_second" + }; + + int ext_idx = 0; + while (ext_idx < NUM_EXTS) + { + SPVC_CHECKED_CALL(spvc_compiler_require_extension(compiler_glsl, expected_exts[ext_idx])); + ext_idx += 1; + } + + SPVC_CHECKED_CALL(spvc_compiler_create_shader_resources(compiler_none, &resources)); + dump_resources(compiler_none, resources); + compile(compiler_glsl, "GLSL"); + compile(compiler_hlsl, "HLSL"); + compile(compiler_msl, "MSL"); + compile(compiler_json, "JSON"); + compile(compiler_cpp, "CPP"); + + int num_exts = spvc_compiler_get_num_required_extensions(compiler_glsl); + if (num_exts != NUM_EXTS) + { + fprintf(stderr, "num_exts mismatch!\n"); + return 1; + } + + ext_idx = 0; + while (ext_idx < num_exts) + { + const char *ext = spvc_compiler_get_required_extension(compiler_glsl, ext_idx); + if (strcmp(ext, expected_exts[ext_idx]) != 0) + { + fprintf(stderr, "extension mismatch (%s != %s)!\n", ext, expected_exts[ext_idx]); + return 1; + } + ext_idx += 1; + } + + spvc_context_destroy(context); + free(buffer); + return 0; +} diff --git a/third_party/spirv-cross/tests-other/c_api_test.spv b/third_party/spirv-cross/tests-other/c_api_test.spv new file mode 100644 index 0000000000000000000000000000000000000000..488680046dab7db539dc5b1ded393bb9f49fa8f9 GIT binary patch literal 1268 zcmZvcTT2{45QS@J95otmF&Zz48869;AU;G11OxiA3POa9KVX7`5nPp-UC66{Ex*c_ zfamLrw33pt>r|an(_P(co^6hqb!^PW?X!8CvrHMYNgH)*_q2Dq(+)0nzU=M7n6}&z z;mlZ}KeG{ezq-1iFe@E+P7Wt}E?p-4SBXN5R0GyVtk*mGp~ZCoW0joxE3Iw&>y})h zUaz&Di_X`GG0)AlN3)@*=-wzk8@9ix!v$lWTi9F0O?`RQ4(g^=%!xi|9saEU42Dgu z(Df% z*A;i<=;IkvJvn9ypEIX=FnSDqJa?)m7xkPu)q~N;dikObrtbHj8+cjHUg(qdB8JPI zQ)fPD9ZbED&+Chs!@L;({Y6Eiic9&LV&>-Yh+eMeko%_IVBQKn7KA6Xmhz5#JK#yh z7`>Qb>@}qr9XWb|nIpMUcqYW~(K5fNomb3v$)N@Fw#cDf2r>L+WmmKkv#-=5URD29 z72u(NA4ufr59W?A`mJgGUqAMa(c_~J9hV;9GUTYQhnR0t2X8#(GWT}jZG{|f2_Bd` z#P)TIe3QGzxWfl!xZ6YhXNI$K=E^-Bh{?YBy&w;VSuM($U&?tG^7rDPS(2k8AA9o# RnK`=e`Z^fiKTZ0p{1MZ#J$3*9 literal 0 HcmV?d00001 diff --git a/third_party/spirv-cross/tests-other/hlsl_resource_binding.spv b/third_party/spirv-cross/tests-other/hlsl_resource_binding.spv new file mode 100644 index 0000000000000000000000000000000000000000..c48dc49ea00c0d7753a027d29dcbc8f66247a7d4 GIT binary patch literal 796 zcmYk2%}PRH5Qe`r&9c;f%*qPQWe_bYf+&a}TeM25wUmgU6-Vn1y0NaRP0;fkk8noD znR(AUGw*!aOlu*8xlrJ@7pArvG9V!oLq3k}`_BE*c=CF5a(XPI6tXc5wmvJ0q#w+x=F51Ywwxy?^1hO;947P z?)JuY{*BG}>M6EKo(F5-HRkyy*3NJ6Um*Ib;ulG+MzL+wE)nIcFKx5B4ztJydCpr- zNMg>j_D0S9Wuo)cDZfH=mbiRtZx-8UwzsKGZk4DuF}c>hu~?P5Mr`2r9wzk`xn}=1 zQLgjOcuO_-4x0D=g5-#opz1H-YPVM38m_iySk73-<%nN{Ie!ONlY8xxSI5P_lfGSY Pd&RHVtR}HPl%M1OI}s?= literal 0 HcmV?d00001 diff --git a/third_party/spirv-cross/tests-other/hlsl_resource_bindings.cpp b/third_party/spirv-cross/tests-other/hlsl_resource_bindings.cpp new file mode 100644 index 0000000000..1a938dac33 --- /dev/null +++ b/third_party/spirv-cross/tests-other/hlsl_resource_bindings.cpp @@ -0,0 +1,89 @@ +// Testbench for HLSL resource binding APIs. +// It does not validate output at the moment, but it's useful for ad-hoc testing. + +#include +#include +#include +#include + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(SpvId)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spvc_context ctx; + spvc_parsed_ir parsed_ir; + spvc_compiler compiler; + + SPVC_CHECKED_CALL(spvc_context_create(&ctx)); + SPVC_CHECKED_CALL(spvc_context_parse_spirv(ctx, buffer.data(), buffer.size(), &parsed_ir)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(ctx, SPVC_BACKEND_HLSL, parsed_ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler)); + + spvc_compiler_options opts; + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler, &opts)); + SPVC_CHECKED_CALL(spvc_compiler_options_set_uint(opts, SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL, 51)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler, opts)); + + spvc_hlsl_resource_binding binding; + spvc_hlsl_resource_binding_init(&binding); + binding.stage = SpvExecutionModelFragment; + binding.desc_set = 1; + binding.binding = 4; + binding.srv.register_space = 2; + binding.srv.register_binding = 3; + binding.sampler.register_space = 4; + binding.sampler.register_binding = 5; + SPVC_CHECKED_CALL(spvc_compiler_hlsl_add_resource_binding(compiler, &binding)); + + binding.desc_set = SPVC_HLSL_PUSH_CONSTANT_DESC_SET; + binding.binding = SPVC_HLSL_PUSH_CONSTANT_BINDING; + binding.cbv.register_space = 0; + binding.cbv.register_binding = 4; + SPVC_CHECKED_CALL(spvc_compiler_hlsl_add_resource_binding(compiler, &binding)); + + const char *str; + SPVC_CHECKED_CALL(spvc_compiler_compile(compiler, &str)); + + fprintf(stderr, "Output:\n%s\n", str); + + if (!spvc_compiler_hlsl_is_resource_used(compiler, SpvExecutionModelFragment, 1, 4)) + return EXIT_FAILURE; + + if (!spvc_compiler_hlsl_is_resource_used(compiler, SpvExecutionModelFragment, SPVC_HLSL_PUSH_CONSTANT_DESC_SET, SPVC_HLSL_PUSH_CONSTANT_BINDING)) + return EXIT_FAILURE; +} + diff --git a/third_party/spirv-cross/tests-other/hlsl_wave_mask.cpp b/third_party/spirv-cross/tests-other/hlsl_wave_mask.cpp new file mode 100644 index 0000000000..de11dd9fe0 --- /dev/null +++ b/third_party/spirv-cross/tests-other/hlsl_wave_mask.cpp @@ -0,0 +1,73 @@ +// Ad-hoc test that the wave op masks work as expected. +#include +#include + +using namespace glm; + +static uvec4 gl_SubgroupEqMask; +static uvec4 gl_SubgroupGeMask; +static uvec4 gl_SubgroupGtMask; +static uvec4 gl_SubgroupLeMask; +static uvec4 gl_SubgroupLtMask; +using uint4 = uvec4; + +static void test_main(unsigned wave_index) +{ + const auto WaveGetLaneIndex = [&]() { return wave_index; }; + + gl_SubgroupEqMask = 1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96)); + if (WaveGetLaneIndex() >= 32) gl_SubgroupEqMask.x = 0; + if (WaveGetLaneIndex() >= 64 || WaveGetLaneIndex() < 32) gl_SubgroupEqMask.y = 0; + if (WaveGetLaneIndex() >= 96 || WaveGetLaneIndex() < 64) gl_SubgroupEqMask.z = 0; + if (WaveGetLaneIndex() < 96) gl_SubgroupEqMask.w = 0; + gl_SubgroupGeMask = ~((1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u); + if (WaveGetLaneIndex() >= 32) gl_SubgroupGeMask.x = 0u; + if (WaveGetLaneIndex() >= 64) gl_SubgroupGeMask.y = 0u; + if (WaveGetLaneIndex() >= 96) gl_SubgroupGeMask.z = 0u; + if (WaveGetLaneIndex() < 32) gl_SubgroupGeMask.y = ~0u; + if (WaveGetLaneIndex() < 64) gl_SubgroupGeMask.z = ~0u; + if (WaveGetLaneIndex() < 96) gl_SubgroupGeMask.w = ~0u; + uint gt_lane_index = WaveGetLaneIndex() + 1; + gl_SubgroupGtMask = ~((1u << (gt_lane_index - uint4(0, 32, 64, 96))) - 1u); + if (gt_lane_index >= 32) gl_SubgroupGtMask.x = 0u; + if (gt_lane_index >= 64) gl_SubgroupGtMask.y = 0u; + if (gt_lane_index >= 96) gl_SubgroupGtMask.z = 0u; + if (gt_lane_index >= 128) gl_SubgroupGtMask.w = 0u; + if (gt_lane_index < 32) gl_SubgroupGtMask.y = ~0u; + if (gt_lane_index < 64) gl_SubgroupGtMask.z = ~0u; + if (gt_lane_index < 96) gl_SubgroupGtMask.w = ~0u; + uint le_lane_index = WaveGetLaneIndex() + 1; + gl_SubgroupLeMask = (1u << (le_lane_index - uint4(0, 32, 64, 96))) - 1u; + if (le_lane_index >= 32) gl_SubgroupLeMask.x = ~0u; + if (le_lane_index >= 64) gl_SubgroupLeMask.y = ~0u; + if (le_lane_index >= 96) gl_SubgroupLeMask.z = ~0u; + if (le_lane_index >= 128) gl_SubgroupLeMask.w = ~0u; + if (le_lane_index < 32) gl_SubgroupLeMask.y = 0u; + if (le_lane_index < 64) gl_SubgroupLeMask.z = 0u; + if (le_lane_index < 96) gl_SubgroupLeMask.w = 0u; + gl_SubgroupLtMask = (1u << (WaveGetLaneIndex() - uint4(0, 32, 64, 96))) - 1u; + if (WaveGetLaneIndex() >= 32) gl_SubgroupLtMask.x = ~0u; + if (WaveGetLaneIndex() >= 64) gl_SubgroupLtMask.y = ~0u; + if (WaveGetLaneIndex() >= 96) gl_SubgroupLtMask.z = ~0u; + if (WaveGetLaneIndex() < 32) gl_SubgroupLtMask.y = 0u; + if (WaveGetLaneIndex() < 64) gl_SubgroupLtMask.z = 0u; + if (WaveGetLaneIndex() < 96) gl_SubgroupLtMask.w = 0u; +} + +int main() +{ + for (unsigned subgroup_id = 0; subgroup_id < 128; subgroup_id++) + { + test_main(subgroup_id); + + for (unsigned bit = 0; bit < 128; bit++) + { + assert(bool(gl_SubgroupEqMask[bit / 32] & (1u << (bit & 31))) == (bit == subgroup_id)); + assert(bool(gl_SubgroupGtMask[bit / 32] & (1u << (bit & 31))) == (bit > subgroup_id)); + assert(bool(gl_SubgroupGeMask[bit / 32] & (1u << (bit & 31))) == (bit >= subgroup_id)); + assert(bool(gl_SubgroupLtMask[bit / 32] & (1u << (bit & 31))) == (bit < subgroup_id)); + assert(bool(gl_SubgroupLeMask[bit / 32] & (1u << (bit & 31))) == (bit <= subgroup_id)); + } + } +} + diff --git a/third_party/spirv-cross/tests-other/msl_constexpr_test.cpp b/third_party/spirv-cross/tests-other/msl_constexpr_test.cpp new file mode 100644 index 0000000000..d0378eef55 --- /dev/null +++ b/third_party/spirv-cross/tests-other/msl_constexpr_test.cpp @@ -0,0 +1,133 @@ +// Testbench for MSL constexpr samplers. +// It does not validate output, but it's useful for ad-hoc testing. + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) +#define SPVC_CHECKED_CALL_NEGATIVE(x) do { \ + g_fail_on_error = SPVC_FALSE; \ + if ((x) == SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ + g_fail_on_error = SPVC_TRUE; \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(SpvId)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spvc_context ctx; + spvc_parsed_ir parsed_ir; + spvc_compiler compiler; + + SPVC_CHECKED_CALL(spvc_context_create(&ctx)); + SPVC_CHECKED_CALL(spvc_context_parse_spirv(ctx, buffer.data(), buffer.size(), &parsed_ir)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(ctx, SPVC_BACKEND_MSL, parsed_ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler)); + + spvc_msl_resource_binding binding; + spvc_msl_resource_binding_init(&binding); + binding.desc_set = 1; + binding.binding = 2; + binding.stage = SpvExecutionModelFragment; + binding.msl_texture = 0; + binding.msl_sampler = 0; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + binding.binding = 3; + binding.msl_texture = 1; + binding.msl_sampler = 1000; // Will be remapped anyways, sanity check. + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + binding.desc_set = 2; + binding.binding = 2; + binding.msl_texture = 2; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + binding.binding = 3; + binding.msl_texture = 3; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + spvc_msl_constexpr_sampler samp; + spvc_msl_constexpr_sampler_init(&samp); + samp.s_address = SPVC_MSL_SAMPLER_ADDRESS_REPEAT; + samp.t_address = SPVC_MSL_SAMPLER_ADDRESS_REPEAT; + samp.r_address = SPVC_MSL_SAMPLER_ADDRESS_REPEAT; + SPVC_CHECKED_CALL(spvc_compiler_msl_remap_constexpr_sampler_by_binding(compiler, 1, 3, &samp)); + + samp.s_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + samp.t_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + samp.r_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + SPVC_CHECKED_CALL(spvc_compiler_msl_remap_constexpr_sampler_by_binding(compiler, 2, 4, &samp)); + + samp.compare_enable = SPVC_TRUE; + samp.compare_func = SPVC_MSL_SAMPLER_COMPARE_FUNC_LESS; + samp.s_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + samp.t_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + samp.r_address = SPVC_MSL_SAMPLER_ADDRESS_CLAMP_TO_EDGE; + SPVC_CHECKED_CALL(spvc_compiler_msl_remap_constexpr_sampler_by_binding(compiler, 2, 5, &samp)); + + const char *str; + SPVC_CHECKED_CALL(spvc_compiler_compile(compiler, &str)); + + // Should not be marked as used. + if (spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 2, 4)) + return EXIT_FAILURE; + + // Should not be marked as used. + if (spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 2, 5)) + return EXIT_FAILURE; + + // Should be marked, as a sanity check. + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 1, 2)) + return EXIT_FAILURE; + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 1, 3)) + return EXIT_FAILURE; + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 2, 2)) + return EXIT_FAILURE; + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 2, 3)) + return EXIT_FAILURE; + + fprintf(stderr, "Output:\n%s\n", str); +} + diff --git a/third_party/spirv-cross/tests-other/msl_constexpr_test.spv b/third_party/spirv-cross/tests-other/msl_constexpr_test.spv new file mode 100644 index 0000000000000000000000000000000000000000..5201d5106b38dc92f6a437201a791622b427f344 GIT binary patch literal 1656 zcmYk6+fGzL5Jj80fudYQK)}n4ctO!o5fDW1!9-$0V$4L1j}t*O0mh7?&;FWU<%@}H zojGN?NTqx4+Fe~$r-y1~aX6)+G@M4#^E9x@RDnrpG&PEKcdxV8{`P&py}I^L#aOBq zLN()@tg-6H-7hBw&f>H91Uh*xU{@t;O20W&ht2ik2C+}4Cm)ws>-?GHWxsp)qIcBm z7hEl!XFYv&+&w&4DKwMfPWSlh(LsNu&{T_if4qH1ypeAF*LOa5_j^AFnnt>nor{Qf z+FaygTjY3>aRY5iyVPraR~2DmYrBryW8hYXtu>E}jXMYR&MVJn?YUm8-pQ-ChdeGe zUN7VJVtgpW#w#VZuRJb}{8OmZwTiDcI5We31g=?lEuCSt7P&3z5jzvPInXGpG4IbU zaFa9V%79vPh@GQ0PX*(w>Lv=tw>Hp;ou9VAjZ>`Vm_<9y>b=(C*%?;vl=lv?vzAkT ziB-M*iWf@kcbNuXVQu2ta*5+R*{3s%KFt{xduv!MNwwA>_Iqk#`|J zF?&=i_S66%;Fp;8=v<+esSXzu}RFKljj9g6bo#{UXAuXygc}HFrx0FKTRIK z*x@V2n;Mvo^WGT&%UUdVfL_7-~=>eV{)(5_@&POaE`2(9x7?UfV0)r#xPt?;*9 zrFI^EbGZVq^6qPFsPhchvq;W&i#Iaod~Z_Q&u>wGi)=4>^Tl4 z$ +#include +#include +#include + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(SpvId)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spvc_context ctx; + spvc_parsed_ir parsed_ir; + spvc_compiler compiler; + + SPVC_CHECKED_CALL(spvc_context_create(&ctx)); + SPVC_CHECKED_CALL(spvc_context_parse_spirv(ctx, buffer.data(), buffer.size(), &parsed_ir)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(ctx, SPVC_BACKEND_MSL, parsed_ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler)); + SPVC_CHECKED_CALL(spvc_compiler_msl_add_discrete_descriptor_set(compiler, 3)); + + spvc_compiler_options opts; + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler, &opts)); + SPVC_CHECKED_CALL(spvc_compiler_options_set_bool(opts, SPVC_COMPILER_OPTION_MSL_ARGUMENT_BUFFERS, SPVC_TRUE)); + SPVC_CHECKED_CALL(spvc_compiler_options_set_uint(opts, SPVC_COMPILER_OPTION_MSL_VERSION, 20000)); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler, opts)); + + spvc_msl_resource_binding binding; + spvc_msl_resource_binding_init(&binding); + binding.binding = SPVC_MSL_ARGUMENT_BUFFER_BINDING; + binding.stage = SpvExecutionModelFragment; + binding.desc_set = 0; + binding.msl_buffer = 2; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + binding.desc_set = 1; + binding.msl_buffer = 3; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + const char *str; + SPVC_CHECKED_CALL(spvc_compiler_compile(compiler, &str)); + + fprintf(stderr, "Output:\n%s\n", str); + + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 0, SPVC_MSL_ARGUMENT_BUFFER_BINDING)) + return EXIT_FAILURE; + + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 1, SPVC_MSL_ARGUMENT_BUFFER_BINDING)) + return EXIT_FAILURE; +} + diff --git a/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.cpp b/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.cpp new file mode 100644 index 0000000000..deab27bec2 --- /dev/null +++ b/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.cpp @@ -0,0 +1,103 @@ +// Testbench for MSL constexpr samplers, with Y'CbCr conversion. +// It does not validate output, but it's useful for ad-hoc testing. + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include + +#define SPVC_CHECKED_CALL(x) do { \ + if ((x) != SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ +} while(0) +#define SPVC_CHECKED_CALL_NEGATIVE(x) do { \ + g_fail_on_error = SPVC_FALSE; \ + if ((x) == SPVC_SUCCESS) { \ + fprintf(stderr, "Failed at line %d.\n", __LINE__); \ + exit(1); \ + } \ + g_fail_on_error = SPVC_TRUE; \ +} while(0) + +static std::vector read_file(const char *path) +{ + long len; + FILE *file = fopen(path, "rb"); + + if (!file) + return {}; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + std::vector buffer(len / sizeof(SpvId)); + if (fread(buffer.data(), 1, len, file) != (size_t)len) + { + fclose(file); + return {}; + } + + fclose(file); + return buffer; +} + +int main(int argc, char **argv) +{ + if (argc != 2) + return EXIT_FAILURE; + + auto buffer = read_file(argv[1]); + if (buffer.empty()) + return EXIT_FAILURE; + + spvc_context ctx; + spvc_parsed_ir parsed_ir; + spvc_compiler compiler; + spvc_compiler_options options; + + SPVC_CHECKED_CALL(spvc_context_create(&ctx)); + SPVC_CHECKED_CALL(spvc_context_parse_spirv(ctx, buffer.data(), buffer.size(), &parsed_ir)); + SPVC_CHECKED_CALL(spvc_context_create_compiler(ctx, SPVC_BACKEND_MSL, parsed_ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler)); + SPVC_CHECKED_CALL(spvc_compiler_create_compiler_options(compiler, &options)); + SPVC_CHECKED_CALL(spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_MSL_VERSION, SPVC_MAKE_MSL_VERSION(2, 0, 0))); + SPVC_CHECKED_CALL(spvc_compiler_install_compiler_options(compiler, options)); + + spvc_msl_resource_binding binding; + spvc_msl_resource_binding_init(&binding); + binding.desc_set = 1; + binding.binding = 2; + binding.stage = SpvExecutionModelFragment; + binding.msl_texture = 0; + binding.msl_sampler = 0; + SPVC_CHECKED_CALL(spvc_compiler_msl_add_resource_binding(compiler, &binding)); + + spvc_msl_constexpr_sampler samp; + spvc_msl_sampler_ycbcr_conversion conv; + spvc_msl_constexpr_sampler_init(&samp); + spvc_msl_sampler_ycbcr_conversion_init(&conv); + conv.planes = 3; + conv.resolution = SPVC_MSL_FORMAT_RESOLUTION_422; + conv.chroma_filter = SPVC_MSL_SAMPLER_FILTER_LINEAR; + conv.x_chroma_offset = SPVC_MSL_CHROMA_LOCATION_MIDPOINT; + conv.ycbcr_model = SPVC_MSL_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_BT_2020; + conv.ycbcr_range = SPVC_MSL_SAMPLER_YCBCR_RANGE_ITU_NARROW; + conv.bpc = 8; + SPVC_CHECKED_CALL(spvc_compiler_msl_remap_constexpr_sampler_by_binding_ycbcr(compiler, 1, 2, &samp, &conv)); + + const char *str; + SPVC_CHECKED_CALL(spvc_compiler_compile(compiler, &str)); + + // Should be marked, as a sanity check. + if (!spvc_compiler_msl_is_resource_used(compiler, SpvExecutionModelFragment, 1, 2)) + return EXIT_FAILURE; + + fprintf(stderr, "Output:\n%s\n", str); +} + diff --git a/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.spv b/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test.spv new file mode 100644 index 0000000000000000000000000000000000000000..62372d5c652d451a87af8389c634f934b8acd3f0 GIT binary patch literal 728 zcmYk3%Syvw5QWF2Y1C>j)>_-Dq`DD=;zC6c-3WG55Gm?9c%#sZROLN^58?qCH{{Z2a4wN!GUt#7SrcL*+4&f+|J|oo7s3acbxBfem^|Acv0M97*9UN zuY|3yC^dTk378r3n3{blyAcO>rOZ;-mpQxYvMh_gC4WUWa$2xeS>AxVRDFiwT4GCS zjQ)Aaa9eMzDbP`uby@P8>Qk1bCw(H}iYztoyaQ$zIP$BqdCnm$L>2)c;s4_<92Y_O#hADApZaW literal 0 HcmV?d00001 diff --git a/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test_2.spv b/third_party/spirv-cross/tests-other/msl_ycbcr_conversion_test_2.spv new file mode 100644 index 0000000000000000000000000000000000000000..10fa7690d0dbc416e42af9b2e65ace610c182950 GIT binary patch literal 840 zcmZ9KNlyYn5QPhdVQ~df5OD#$a3X5l2+@m)T(}YSJjNv^;22O3{ycw`7Zcyt%$SiP z#p`;tcaN9e%bAz5oaL=yQz=>6Qaa9C)?u$d=(i_t_wA$OeIl03bAiMxD>EZRN5S(8 zjx}jbT2vf-PU`8G7Jezo7n_Xt#VpA87>2FM;XzkNF`oLHP2Aa6AG5n){LjDi=g(Nl z`9E6%<@#=ht8wsj84km-<2*Oh$Muc#Z;5*!1f$pC18(bSBIe%4kYKYz(k5qD%HH^~ zn^N{F>mO{oO{ZK%=d8Gfv}Of&57^`7C4W(Pu6%Z^L_9V#ZAh8tR$bVsE+q#3LUq^;Znhua3X<%{w?e<7 euoLaFsWY?To2|hfNWABY&T$^!1U + +using namespace spirv_cross; + +// Test the tricky bits of the implementation. +// Running the entire test suite on this implementation should find all other potential issues. + +static int allocations = 0; +static int deallocations = 0; + +#define SPVC_ASSERT(x) do { \ + if (!(x)) SPIRV_CROSS_THROW("Assert: " #x " failed!"); \ +} while(0) + +struct RAIIInt +{ + RAIIInt(int v_) : v(v_) { allocations++; } + ~RAIIInt() { deallocations++; } + RAIIInt() { allocations++; } + RAIIInt(const RAIIInt &other) { v = other.v; allocations++; } + RAIIInt(RAIIInt &&other) SPIRV_CROSS_NOEXCEPT { v = other.v; allocations++; } + RAIIInt &operator=(RAIIInt &&) = default; + RAIIInt &operator=(const RAIIInt &) = default; + + int v = 0; +}; + +static void propagate_stack_to_heap() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + auto *old_data = ints.data(); + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 2); + ints.emplace_back(3); + SPVC_ASSERT(old_data != ints.data()); + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 2); + SPVC_ASSERT(ints[2].v == 3); + SPVC_ASSERT(ints.size() == 3); +} + +static void insert_end() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + + const RAIIInt new_ints[3] = { 10, 20, 30 }; + ints.insert(ints.end(), new_ints, new_ints + 3); + SPVC_ASSERT(ints.size() == 5); + + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 2); + SPVC_ASSERT(ints[2].v == 10); + SPVC_ASSERT(ints[3].v == 20); + SPVC_ASSERT(ints[4].v == 30); +} + +static void insert_begin_realloc() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + + const RAIIInt new_ints[3] = { 10, 20, 30 }; + ints.insert(ints.begin(), new_ints, new_ints + 3); + SPVC_ASSERT(ints.size() == 5); + + SPVC_ASSERT(ints[0].v == 10); + SPVC_ASSERT(ints[1].v == 20); + SPVC_ASSERT(ints[2].v == 30); + SPVC_ASSERT(ints[3].v == 1); + SPVC_ASSERT(ints[4].v == 2); +} + +static void insert_middle_realloc() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + + const RAIIInt new_ints[3] = { 10, 20, 30 }; + ints.insert(ints.begin() + 1, new_ints, new_ints + 3); + SPVC_ASSERT(ints.size() == 5); + + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 10); + SPVC_ASSERT(ints[2].v == 20); + SPVC_ASSERT(ints[3].v == 30); + SPVC_ASSERT(ints[4].v == 2); +} + +static void insert_begin_no_realloc() +{ + SmallVector ints; + ints.reserve(10); + ints.emplace_back(1); + ints.emplace_back(2); + + const RAIIInt new_ints[3] = { 10, 20, 30 }; + ints.insert(ints.begin(), new_ints, new_ints + 3); + SPVC_ASSERT(ints.size() == 5); + + SPVC_ASSERT(ints[0].v == 10); + SPVC_ASSERT(ints[1].v == 20); + SPVC_ASSERT(ints[2].v == 30); + SPVC_ASSERT(ints[3].v == 1); + SPVC_ASSERT(ints[4].v == 2); +} + +static void insert_middle_no_realloc() +{ + SmallVector ints; + ints.reserve(10); + ints.emplace_back(1); + ints.emplace_back(2); + + const RAIIInt new_ints[3] = { 10, 20, 30 }; + ints.insert(ints.begin() + 1, new_ints, new_ints + 3); + SPVC_ASSERT(ints.size() == 5); + + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 10); + SPVC_ASSERT(ints[2].v == 20); + SPVC_ASSERT(ints[3].v == 30); + SPVC_ASSERT(ints[4].v == 2); +} + +static void erase_end() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + ints.emplace_back(3); + ints.emplace_back(4); + ints.erase(ints.begin() + 1, ints.end()); + + SPVC_ASSERT(ints.size() == 1); + SPVC_ASSERT(ints[0].v == 1); +} + +static void erase_middle() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + ints.emplace_back(3); + ints.emplace_back(4); + ints.erase(ints.begin() + 1, ints.end() - 1); + + SPVC_ASSERT(ints.size() == 2); + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 4); +} + +static void erase_start() +{ + SmallVector ints; + ints.emplace_back(1); + ints.emplace_back(2); + ints.emplace_back(3); + ints.emplace_back(4); + ints.erase(ints.begin(), ints.end() - 2); + + SPVC_ASSERT(ints.size() == 2); + SPVC_ASSERT(ints[0].v == 3); + SPVC_ASSERT(ints[1].v == 4); +} + +static void convert_to_std_vector() +{ + SmallVector foo; + foo.push_back(1); + foo.push_back(2); + std::vector ints(foo); + SPVC_ASSERT(ints.size() == 2); + SPVC_ASSERT(foo.size() == 2); + SPVC_ASSERT(ints[0].v == 1); + SPVC_ASSERT(ints[1].v == 2); + + // This doesn't work on MSVC 2013. Ignore it. +#if !(defined(_MSC_VER) && _MSC_VER < 1900) + SmallVector> move_only_buffer; + move_only_buffer.emplace_back(new RAIIInt(40)); + std::vector> move_only_vector(std::move(move_only_buffer)); + SPVC_ASSERT(move_only_vector.size() == 1); + SPVC_ASSERT(move_only_vector[0]->v == 40); +#endif +} + +int main() +{ + propagate_stack_to_heap(); + insert_end(); + insert_begin_realloc(); + insert_begin_no_realloc(); + insert_middle_realloc(); + insert_middle_no_realloc(); + erase_end(); + erase_middle(); + erase_start(); + + convert_to_std_vector(); + + SPVC_ASSERT(allocations > 0 && deallocations > 0 && deallocations == allocations); +} + diff --git a/third_party/spirv-cross/tests-other/typed_id_test.cpp b/third_party/spirv-cross/tests-other/typed_id_test.cpp new file mode 100644 index 0000000000..e8ecb16cc6 --- /dev/null +++ b/third_party/spirv-cross/tests-other/typed_id_test.cpp @@ -0,0 +1,49 @@ +#include "spirv_common.hpp" + +using namespace SPIRV_CROSS_NAMESPACE; + +int main() +{ + // Construct from uint32_t. + VariableID var_id = 10; + TypeID type_id = 20; + ConstantID constant_id = 30; + + // Assign from uint32_t. + var_id = 100; + type_id = 40; + constant_id = 60; + + // Construct generic ID. + ID generic_var_id = var_id; + ID generic_type_id = type_id; + ID generic_constant_id = constant_id; + + // Assign generic id. + generic_var_id = var_id; + generic_type_id = type_id; + generic_constant_id = constant_id; + + // Assign generic ID to typed ID + var_id = generic_var_id; + type_id = generic_type_id; + constant_id = generic_constant_id; + + // Implicit conversion to uint32_t. + uint32_t a; + a = var_id; + a = type_id; + a = constant_id; + a = generic_var_id; + a = generic_type_id; + a = generic_constant_id; + + // Copy assignment. + var_id = VariableID(10); + type_id = TypeID(10); + constant_id = ConstantID(10); + + // These operations are blocked, assign or construction from mismatched types. + //var_id = type_id; + //var_id = TypeID(100); +} \ No newline at end of file From 032cbab7b08916ad3fab28d1c8a30075056caed4 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Mon, 12 Jun 2023 09:30:10 -0700 Subject: [PATCH 07/22] vulkan: fix missing sampler texture (#6885) --- filament/src/PostProcessManager.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/filament/src/PostProcessManager.cpp b/filament/src/PostProcessManager.cpp index 847c380d9e..92dba087e3 100644 --- a/filament/src/PostProcessManager.cpp +++ b/filament/src/PostProcessManager.cpp @@ -1085,18 +1085,29 @@ FrameGraphId PostProcessManager::gaussianBlurPass(FrameGraph& default: materialName = is2dArray ? "separableGaussianBlur4L"sv : "separableGaussianBlur4"sv; break; } - std::string_view sourceParameterName = is2dArray ? "sourceArray"sv : "source"sv; - auto const& separableGaussianBlur = getPostProcessMaterial(materialName); FMaterialInstance* const mi = separableGaussianBlur.getMaterialInstance(mEngine); const size_t kernelStorageSize = mi->getMaterial()->reflect("kernel")->size; + + // Initialize the samplers with dummy textures because vulkan requires a sampler to + // be bound to a texture even if sampler might be unused. + mi->setParameter("sourceArray"sv, getZeroTextureArray(), { + .filterMag = SamplerMagFilter::LINEAR, + .filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST + }); + mi->setParameter("source"sv, getZeroTexture(), { + .filterMag = SamplerMagFilter::LINEAR, + .filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST + }); + + float2 kernel[64]; size_t const m = computeGaussianCoefficients(kernel, std::min(sizeof(kernel) / sizeof(*kernel), kernelStorageSize)); + std::string_view sourceParameterName = is2dArray ? "sourceArray"sv : "source"sv; // horizontal pass - mi->setParameter(sourceParameterName, hwIn, { .filterMag = SamplerMagFilter::LINEAR, .filterMin = SamplerMinFilter::LINEAR_MIPMAP_NEAREST From e14cbf216389de5a80a33c42a4577baf6bc96edb Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Mon, 12 Jun 2023 23:43:38 -0500 Subject: [PATCH 08/22] Add query instead of relying on CONFIG_MAX_INSTANCES (#6891) --- NEW_RELEASE_NOTES.md | 3 ++- filament/include/filament/Engine.h | 15 +++++++++++++++ filament/include/filament/InstanceBuffer.h | 3 ++- filament/include/filament/RenderableManager.h | 10 +++++----- filament/src/Engine.cpp | 4 ++++ filament/src/components/RenderableManager.cpp | 14 +++++++------- filament/src/details/Engine.h | 4 ++++ filament/src/details/InstanceBuffer.cpp | 8 ++++---- 8 files changed, 43 insertions(+), 18 deletions(-) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index 82ba62a10f..925848d1df 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -9,4 +9,5 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut - matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] -- vulkan: support sRGB swap chain \ No newline at end of file +- vulkan: support sRGB swap chain +- Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances. diff --git a/filament/include/filament/Engine.h b/filament/include/filament/Engine.h index cc1fa96f99..3795b89fb5 100644 --- a/filament/include/filament/Engine.h +++ b/filament/include/filament/Engine.h @@ -497,6 +497,21 @@ public: */ FeatureLevel getActiveFeatureLevel() const noexcept; + /** + * Queries the maximum number of GPU instances that Filament creates when automatic instancing + * is enabled. This value is also the limit for the number of transforms that can be stored in + * an InstanceBuffer. This value may depend on the device and platform, but will remain constant + * during the lifetime of this Engine. + * + * This value does not apply when using the instances(size_t) method on + * RenderableManager::Builder. + * + * @return the number of max automatic instances + * @see setAutomaticInstancingEnabled + * @see RenderableManager::Builder::instances(size_t) + * @see RenderableManager::Builder::instances(size_t, InstanceBuffer*) + */ + size_t getMaxAutomaticInstances() const noexcept; /** * @return EntityManager used by filament diff --git a/filament/include/filament/InstanceBuffer.h b/filament/include/filament/InstanceBuffer.h index 3694f0180e..d1ad29a908 100644 --- a/filament/include/filament/InstanceBuffer.h +++ b/filament/include/filament/InstanceBuffer.h @@ -42,7 +42,8 @@ public: /** * @param instanceCount the number of instances this InstanceBuffer will support, must be - * >= 1 and <= \c CONFIG_MAX_INSTANCES + * >= 1 and <= \c Engine::getMaxAutomaticInstances() + * @see Engine::getMaxAutomaticInstances */ Builder(size_t instanceCount) noexcept; diff --git a/filament/include/filament/RenderableManager.h b/filament/include/filament/RenderableManager.h index 0f5cf929eb..868375bac0 100644 --- a/filament/include/filament/RenderableManager.h +++ b/filament/include/filament/RenderableManager.h @@ -435,9 +435,9 @@ public: /** * Specifies the number of draw instances of this renderable and an \c InstanceBuffer * containing their local transforms. The default is 1 instance and the maximum number of - * instances allowed when supplying transforms is \c CONFIG_MAX_INSTANCES (64 on most - * platforms). 0 is invalid. The \c InstanceBuffer must not be destroyed before this - * renderable. + * instances allowed when supplying transforms is given by + * \c Engine::getMaxAutomaticInstances (64 on most platforms). 0 is invalid. The + * \c InstanceBuffer must not be destroyed before this renderable. * * All instances are culled using the same bounding box, so care must be taken to make * sure all instances render inside the specified bounding box. @@ -448,12 +448,12 @@ public: * Only the \c VERTEX_DOMAIN_OBJECT vertex domain is supported. * * The local transforms of each instance can be updated with - * InstanceBuffer::setLocalTransforms. + * \c InstanceBuffer::setLocalTransforms. * * \see InstanceBuffer * \see instances(size_t, * math::mat4f const*) * @param instanceCount the number of instances, silently clamped between 1 and - * CONFIG_MAX_INSTANCES. + * the result of Engine::getMaxAutomaticInstances(). * @param instanceBuffer an InstanceBuffer containing at least instanceCount transforms */ Builder& instances(size_t instanceCount, InstanceBuffer* instanceBuffer) noexcept; diff --git a/filament/src/Engine.cpp b/filament/src/Engine.cpp index cdceb3c9e9..ccb1748047 100644 --- a/filament/src/Engine.cpp +++ b/filament/src/Engine.cpp @@ -268,6 +268,10 @@ FeatureLevel Engine::getActiveFeatureLevel() const noexcept { return downcast(this)->getActiveFeatureLevel(); } +size_t Engine::getMaxAutomaticInstances() const noexcept { + return downcast(this)->getMaxAutomaticInstances(); +} + #if defined(__EMSCRIPTEN__) void Engine::resetBackendState() noexcept { downcast(this)->resetBackendState(); diff --git a/filament/src/components/RenderableManager.cpp b/filament/src/components/RenderableManager.cpp index 40213a534e..513c126785 100644 --- a/filament/src/components/RenderableManager.cpp +++ b/filament/src/components/RenderableManager.cpp @@ -248,17 +248,17 @@ RenderableManager::Builder::Result RenderableManager::Builder::build(Engine& eng ASSERT_PRECONDITION(mImpl->mSkinningBoneCount <= CONFIG_MAX_BONE_COUNT, "bone count > %u", CONFIG_MAX_BONE_COUNT); - ASSERT_PRECONDITION(mImpl->mInstanceCount <= CONFIG_MAX_INSTANCES || !mImpl->mInstanceBuffer, - "instance count is %zu, but instance count is limited to CONFIG_MAX_INSTANCES (%zu) " - "instances when supplying transforms via an InstanceBuffer.", - mImpl->mInstanceCount, - CONFIG_MAX_INSTANCES); + ASSERT_PRECONDITION( + mImpl->mInstanceCount <= engine.getMaxAutomaticInstances() || !mImpl->mInstanceBuffer, + "instance count is %zu, but instance count is limited to " + "Engine::getMaxAutomaticInstances() (%zu) instances when supplying transforms via an " + "InstanceBuffer.", + mImpl->mInstanceCount, engine.getMaxAutomaticInstances()); if (mImpl->mInstanceBuffer) { size_t bufferInstanceCount = mImpl->mInstanceBuffer->mInstanceCount; ASSERT_PRECONDITION(mImpl->mInstanceCount <= bufferInstanceCount, "instance count (%zu) must be less than or equal to the InstanceBuffer's instance " - "count " - "(%zu).", + "count (%zu).", mImpl->mInstanceCount, bufferInstanceCount); } diff --git a/filament/src/details/Engine.h b/filament/src/details/Engine.h index 8724950aa0..fdb4d3a3a7 100644 --- a/filament/src/details/Engine.h +++ b/filament/src/details/Engine.h @@ -178,6 +178,10 @@ public: return mActiveFeatureLevel; } + size_t getMaxAutomaticInstances() const noexcept { + return CONFIG_MAX_INSTANCES; + } + PostProcessManager const& getPostProcessManager() const noexcept { return mPostProcessManager; } diff --git a/filament/src/details/InstanceBuffer.cpp b/filament/src/details/InstanceBuffer.cpp index 2aef373d01..eba97fa539 100644 --- a/filament/src/details/InstanceBuffer.cpp +++ b/filament/src/details/InstanceBuffer.cpp @@ -52,11 +52,11 @@ InstanceBuffer::Builder& InstanceBuffer::Builder::localTransforms( InstanceBuffer* InstanceBuffer::Builder::build(Engine& engine) { ASSERT_PRECONDITION(mImpl->mInstanceCount >= 1, "instanceCount must be >= 1."); - ASSERT_PRECONDITION(mImpl->mInstanceCount <= CONFIG_MAX_INSTANCES, - "instanceCount is %zu, but instance count is limited to CONFIG_MAX_INSTANCES (%zu) " - "instances when supplying transforms.", + ASSERT_PRECONDITION(mImpl->mInstanceCount <= engine.getMaxAutomaticInstances(), + "instanceCount is %zu, but instance count is limited to " + "Engine::getMaxAutomaticInstances() (%zu) instances when supplying transforms.", mImpl->mInstanceCount, - CONFIG_MAX_INSTANCES); + engine.getMaxAutomaticInstances()); return downcast(engine).createInstanceBuffer(*this); } From f4b97028b0e2f69f290fe14e8ff73c4c84c88b18 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 12 Jun 2023 19:33:18 -0700 Subject: [PATCH 09/22] align uniform buffer to 16 bytes this is needed on armv7 because we use alignas to get strcture-alignment, but that also implies (to the compiler) that the structure itself is aligned properly. --- filament/src/PerShadowMapUniforms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filament/src/PerShadowMapUniforms.cpp b/filament/src/PerShadowMapUniforms.cpp index 465e5920fe..bcb4858be4 100644 --- a/filament/src/PerShadowMapUniforms.cpp +++ b/filament/src/PerShadowMapUniforms.cpp @@ -107,7 +107,7 @@ void PerShadowMapUniforms::prepareShadowMapping(Transaction const& transaction, PerShadowMapUniforms::Transaction PerShadowMapUniforms::open(backend::DriverApi& driver) noexcept { Transaction transaction; // TODO: use out-of-line buffer if too large - transaction.uniforms = (PerViewUib *)driver.allocate(sizeof(PerViewUib)); + transaction.uniforms = (PerViewUib *)driver.allocate(sizeof(PerViewUib), 16); assert_invariant(transaction.uniforms); return transaction; } From 094abdc194759ee3af7a086db02578f356bcb56f Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 12 Jun 2023 23:09:47 -0700 Subject: [PATCH 10/22] helpers to fix jank when resizing a TextureView (#6889) There was two related issues: - we need to "latch" the new TextureView size when its resized. That can only be done by recreating the EGLSurface (i.e. recreating the SwapChain). UiHelper now calls onNativeWindowChanged in the case of the TextureView resize, so clients can recreate their SwapChain. - we also needed to make sure that all current filament frames have finished to render (i.e. the last eglSwapBuffers has been called) so that they don't pick-up a new size (this happens after eglSwapBuffers) that doesn't match the viewport. Fixes b/282220665 --- NEW_RELEASE_NOTES.md | 1 + .../filament/android/FilamentHelper.java | 30 +++++++++++++++---- .../android/filament/android/UiHelper.java | 12 ++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index 925848d1df..a629390438 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -11,3 +11,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). - matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] - vulkan: support sRGB swap chain - Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances. +- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665) diff --git a/android/filament-android/src/main/java/com/google/android/filament/android/FilamentHelper.java b/android/filament-android/src/main/java/com/google/android/filament/android/FilamentHelper.java index 3517de9b34..6cb738e7df 100644 --- a/android/filament-android/src/main/java/com/google/android/filament/android/FilamentHelper.java +++ b/android/filament-android/src/main/java/com/google/android/filament/android/FilamentHelper.java @@ -22,17 +22,35 @@ import com.google.android.filament.Fence; public class FilamentHelper { /** - * Wait for all pending frames to be processed before returning. This is to - * avoid a race between the surface being resized before pending frames are - * rendered into it. This is typically called from {@link UiHelper.RendererCallback#onResized}, - * {@link android.view.SurfaceHolder.Callback#surfaceChanged} or - * {@link android.view.TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged}. + * Wait for all pending frames to be processed before returning. This is to avoid a race + * between the surface being resized before pending frames are rendered into it. + *

+ * For {@link android.view.TextureView} this must be called before the texture's size is + * reconfigured, which unfortunately is done by the Android framework before + * {@link UiHelper} listeners are invoked. Therefore synchronizePendingFrames + * cannot be called from + * {@link android.view.TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged}; instead + * a subclass of {@link android.view.TextureView} must be used in order to call it from + * {@link android.view.TextureView#onSizeChanged}: + *

+ *
+     * public class MyTextureView extends TextureView {
+     *     private Engine engine;
+     *     protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+     *         FilamentHelper.synchronizePendingFrames(engine);
+     *         super.onSizeChanged(w, h, oldw, oldh);
+     *     }
+     * }
+     * 
+ * + * Otherwise, this is typically called from {@link UiHelper.RendererCallback#onResized}, + * {@link android.view.SurfaceHolder.Callback#surfaceChanged}. * * @param engine Filament engine to synchronize * * @see UiHelper.RendererCallback#onResized * @see android.view.SurfaceHolder.Callback#surfaceChanged - * @see android.view.TextureView.SurfaceTextureListener#onSurfaceTextureSizeChanged + * @see android.view.TextureView#onSizeChanged */ static public void synchronizePendingFrames(Engine engine) { Fence fence = engine.createFence(); diff --git a/android/filament-android/src/main/java/com/google/android/filament/android/UiHelper.java b/android/filament-android/src/main/java/com/google/android/filament/android/UiHelper.java index ad913e4ca7..0b0ff80746 100644 --- a/android/filament-android/src/main/java/com/google/android/filament/android/UiHelper.java +++ b/android/filament-android/src/main/java/com/google/android/filament/android/UiHelper.java @@ -244,6 +244,10 @@ public class UiHelper { } mSurface = surface; } + + public Surface getSurface() { + return mSurface; + } } /** @@ -489,6 +493,14 @@ public class UiHelper { } else { mRenderCallback.onResized(width, height); } + // We must recreate the SwapChain to guarantee that it sees the new size. + // More precisely, for an EGL client, the EGLSurface must be recreated. For + // a Vulkan client, the SwapChain must be recreated. Calling + // onNativeWindowChanged() will accomplish that. + // This requirement comes from SurfaceTexture.setDefaultBufferSize() + // documentation. + TextureViewHandler textureViewHandler = (TextureViewHandler) mRenderSurface; + mRenderCallback.onNativeWindowChanged(textureViewHandler.getSurface()); } @Override From 09aeeccfa7f38fd038c36126fd78142893721494 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Tue, 13 Jun 2023 16:22:53 -0700 Subject: [PATCH 11/22] vulkan: fix present layout warning on mac (#6896) Fixing validation warning of the form: (UNASSIGNED-BestPractices-ImageBarrierAccessLayout) Validation Warning: [ UNASSIGNED-BestPractices-ImageBarrierAccessLayout ] Object 0: handle = 0x7f824f057218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x849fcec7 | vkCmdPipelineBarrier: accessMask is VK_ACCESS_2_TRANSFER_READ_BIT, but for layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR expected accessMask are VkAccessFlags2(0). --- filament/backend/src/vulkan/VulkanImageUtility.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/filament/backend/src/vulkan/VulkanImageUtility.cpp b/filament/backend/src/vulkan/VulkanImageUtility.cpp index 5d2f1fb74c..5615b889e7 100644 --- a/filament/backend/src/vulkan/VulkanImageUtility.cpp +++ b/filament/backend/src/vulkan/VulkanImageUtility.cpp @@ -101,11 +101,14 @@ getVkTransition(const VulkanLayoutTransition& transition) { srcAccessMask = VK_ACCESS_MEMORY_READ_BIT; srcStage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; break; - case VulkanLayout::PRESENT: case VulkanLayout::COLOR_ATTACHMENT_RESOLVE: srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; srcStage = VK_PIPELINE_STAGE_TRANSFER_BIT; break; + case VulkanLayout::PRESENT: + srcAccessMask = VK_ACCESS_NONE; + srcStage = VK_PIPELINE_STAGE_TRANSFER_BIT; + break; } switch (transition.newLayout) { From 74f5d8a0668fdd7cf0cb81c21990447bab9b2fbf Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 14 Jun 2023 10:51:02 -0700 Subject: [PATCH 12/22] the ShaderCompilerService handles async shader compilation (#6848) It supports KHR_parallel_shader_compile as well as a thread pool of GL contexts. - we have a new 2-priorities queue for shader compilation - use this feature in gltfio in the ubershader case --- NEW_RELEASE_NOTES.md | 1 + filament/backend/CMakeLists.txt | 2 + .../backend/include/backend/DriverEnums.h | 8 + filament/backend/include/backend/Program.h | 5 + .../backend/platforms/OpenGLPlatform.h | 21 + .../backend/platforms/PlatformCocoaGL.h | 3 + .../backend/platforms/PlatformCocoaTouchGL.h | 3 + .../include/backend/platforms/PlatformEGL.h | 4 + .../include/backend/platforms/PlatformWGL.h | 8 +- filament/backend/src/Program.cpp | 5 + filament/backend/src/metal/MetalDriver.mm | 4 +- filament/backend/src/noop/NoopDriver.cpp | 4 +- .../backend/src/opengl/OpenGLBlobCache.cpp | 18 + filament/backend/src/opengl/OpenGLBlobCache.h | 3 + filament/backend/src/opengl/OpenGLContext.cpp | 7 + filament/backend/src/opengl/OpenGLContext.h | 2 + filament/backend/src/opengl/OpenGLDriver.cpp | 86 +- filament/backend/src/opengl/OpenGLDriver.h | 15 +- .../backend/src/opengl/OpenGLPlatform.cpp | 7 + filament/backend/src/opengl/OpenGLProgram.cpp | 430 +-------- filament/backend/src/opengl/OpenGLProgram.h | 74 +- .../src/opengl/ShaderCompilerService.cpp | 900 ++++++++++++++++++ .../src/opengl/ShaderCompilerService.h | 154 +++ filament/backend/src/opengl/gl_headers.h | 14 + .../src/opengl/platforms/PlatformCocoaGL.mm | 21 + .../opengl/platforms/PlatformCocoaTouchGL.mm | 15 + .../src/opengl/platforms/PlatformEGL.cpp | 28 +- .../src/opengl/platforms/PlatformWGL.cpp | 22 +- filament/backend/src/vulkan/VulkanDriver.cpp | 4 +- filament/include/filament/Material.h | 35 +- filament/src/Material.cpp | 8 +- filament/src/MaterialParser.h | 9 +- filament/src/PostProcessManager.cpp | 6 +- filament/src/details/Material.cpp | 64 +- filament/src/details/Material.h | 29 +- filament/src/details/Renderer.cpp | 3 +- .../include/filament/MaterialEnums.h | 11 +- .../filaflat/include/filaflat/MaterialChunk.h | 2 + libs/filaflat/src/MaterialChunk.cpp | 8 + libs/gltfio/src/ArchiveCache.cpp | 10 + libs/utils/include/utils/BitmaskEnum.h | 1 - 41 files changed, 1487 insertions(+), 567 deletions(-) create mode 100644 filament/backend/src/opengl/ShaderCompilerService.cpp create mode 100644 filament/backend/src/opengl/ShaderCompilerService.h diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index a629390438..c690c6a623 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -12,3 +12,4 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). - vulkan: support sRGB swap chain - Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances. - UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665) +- backend: parallel shader compilation support. This breaks and improves the recent `Material::compile` API. diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt index de86153b06..c11bbc4ed7 100644 --- a/filament/backend/CMakeLists.txt +++ b/filament/backend/CMakeLists.txt @@ -82,6 +82,8 @@ if (FILAMENT_SUPPORTS_OPENGL AND NOT FILAMENT_USE_EXTERNAL_GLES3 AND NOT FILAMEN src/opengl/OpenGLPlatform.cpp src/opengl/OpenGLTimerQuery.cpp src/opengl/OpenGLTimerQuery.h + src/opengl/ShaderCompilerService.cpp + src/opengl/ShaderCompilerService.h ) if (EGL) list(APPEND SRCS src/opengl/platforms/PlatformEGL.cpp) diff --git a/filament/backend/include/backend/DriverEnums.h b/filament/backend/include/backend/DriverEnums.h index 302525ad7c..6e5a142e3f 100644 --- a/filament/backend/include/backend/DriverEnums.h +++ b/filament/backend/include/backend/DriverEnums.h @@ -296,6 +296,14 @@ enum class Precision : uint8_t { DEFAULT }; +/** + * Shader compiler priority queue + */ +enum class CompilerPriorityQueue : uint8_t { + HIGH, + LOW +}; + //! Texture sampler type enum class SamplerType : uint8_t { SAMPLER_2D, //!< 2D texture diff --git a/filament/backend/include/backend/Program.h b/filament/backend/include/backend/Program.h index 1d700d3d98..2a491959e9 100644 --- a/filament/backend/include/backend/Program.h +++ b/filament/backend/include/backend/Program.h @@ -71,6 +71,8 @@ public: ~Program() noexcept; + Program& priorityQueue(CompilerPriorityQueue priorityQueue) noexcept; + // sets the material name and variant for diagnostic purposes only Program& diagnostics(utils::CString const& name, utils::Invocable&& logger); @@ -138,6 +140,8 @@ public: uint64_t getCacheId() const noexcept { return mCacheId; } + CompilerPriorityQueue getPriorityQueue() const noexcept { return mPriorityQueue; } + private: friend utils::io::ostream& operator<<(utils::io::ostream& out, const Program& builder); @@ -150,6 +154,7 @@ private: utils::FixedCapacityVector mSpecializationConstants; utils::FixedCapacityVector> mAttributes; std::array mBindingUniformInfo; + CompilerPriorityQueue mPriorityQueue = CompilerPriorityQueue::HIGH; }; } // namespace filament::backend diff --git a/filament/backend/include/backend/platforms/OpenGLPlatform.h b/filament/backend/include/backend/platforms/OpenGLPlatform.h index 29994cda50..c41dce4360 100644 --- a/filament/backend/include/backend/platforms/OpenGLPlatform.h +++ b/filament/backend/include/backend/platforms/OpenGLPlatform.h @@ -267,6 +267,27 @@ public: * @return Transformed image. */ virtual AcquiredImage transformAcquiredImage(AcquiredImage source) noexcept; + + // -------------------------------------------------------------------------------------------- + + /** + * Returns true if additional OpenGL contexts can be created. Default: false. + * @return true if additional OpenGL contexts can be created. + * @see createContext + */ + virtual bool isExtraContextSupported() const noexcept; + + /** + * Creates an OpenGL context with the same configuration than the main context and makes it + * current to the current thread. Must not be called from the main driver thread. + * createContext() is only supported if isExtraContextSupported() returns true. + * These additional contexts will be automatically terminated in terminate. + * + * @param shared whether the new context is shared with the main context. + * @see isExtraContextSupported() + * @see terminate() + */ + virtual void createContext(bool shared); }; } // namespace filament diff --git a/filament/backend/include/backend/platforms/PlatformCocoaGL.h b/filament/backend/include/backend/platforms/PlatformCocoaGL.h index 97188852a3..df03bcbf29 100644 --- a/filament/backend/include/backend/platforms/PlatformCocoaGL.h +++ b/filament/backend/include/backend/platforms/PlatformCocoaGL.h @@ -50,6 +50,9 @@ protected: // -------------------------------------------------------------------------------------------- // OpenGLPlatform Interface + bool isExtraContextSupported() const noexcept override; + void createContext(bool shared) override; + void terminate() noexcept override; SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override; diff --git a/filament/backend/include/backend/platforms/PlatformCocoaTouchGL.h b/filament/backend/include/backend/platforms/PlatformCocoaTouchGL.h index 5eb3b63b06..cbdd6a066a 100644 --- a/filament/backend/include/backend/platforms/PlatformCocoaTouchGL.h +++ b/filament/backend/include/backend/platforms/PlatformCocoaTouchGL.h @@ -47,6 +47,9 @@ public: uint32_t createDefaultRenderTarget() noexcept override; + bool isExtraContextSupported() const noexcept override; + void createContext(bool shared) override; + SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override; SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override; void destroySwapChain(SwapChain* swapChain) noexcept override; diff --git a/filament/backend/include/backend/platforms/PlatformEGL.h b/filament/backend/include/backend/platforms/PlatformEGL.h index 36d287c3e4..3a507c66fa 100644 --- a/filament/backend/include/backend/platforms/PlatformEGL.h +++ b/filament/backend/include/backend/platforms/PlatformEGL.h @@ -38,6 +38,8 @@ class PlatformEGL : public OpenGLPlatform { public: PlatformEGL() noexcept; + bool isExtraContextSupported() const noexcept override; + void createContext(bool shared) override; protected: @@ -124,6 +126,8 @@ protected: EGLSurface mCurrentReadSurface = EGL_NO_SURFACE; EGLSurface mEGLDummySurface = EGL_NO_SURFACE; EGLConfig mEGLConfig = EGL_NO_CONFIG_KHR; + Config mContextAttribs; + std::vector mAdditionalContexts; // supported extensions detected at runtime struct { diff --git a/filament/backend/include/backend/platforms/PlatformWGL.h b/filament/backend/include/backend/platforms/PlatformWGL.h index d18a20b2cd..6c16c30518 100644 --- a/filament/backend/include/backend/platforms/PlatformWGL.h +++ b/filament/backend/include/backend/platforms/PlatformWGL.h @@ -23,9 +23,10 @@ #include "utils/unwindows.h" #include - #include +#include + namespace filament::backend { /** @@ -46,6 +47,9 @@ protected: void terminate() noexcept override; + bool isExtraContextSupported() const noexcept override; + void createContext(bool shared) override; + SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override; SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override; void destroySwapChain(SwapChain* swapChain) noexcept override; @@ -57,6 +61,8 @@ protected: HWND mHWnd = NULL; HDC mWhdc = NULL; PIXELFORMATDESCRIPTOR mPfd = {}; + std::vector mAdditionalContexts; + std::vector mAttribs; }; } // namespace filament::backend diff --git a/filament/backend/src/Program.cpp b/filament/backend/src/Program.cpp index 5e7a944a00..8fd03f3e83 100644 --- a/filament/backend/src/Program.cpp +++ b/filament/backend/src/Program.cpp @@ -39,6 +39,11 @@ Program& Program::operator=(Program&& rhs) noexcept { Program::~Program() noexcept = default; +Program& Program::priorityQueue(CompilerPriorityQueue priorityQueue) noexcept { + mPriorityQueue = priorityQueue; + return *this; +} + Program& Program::diagnostics(CString const& name, Invocable&& logger) { mName = name; diff --git a/filament/backend/src/metal/MetalDriver.mm b/filament/backend/src/metal/MetalDriver.mm index ba30cff170..813e210095 100644 --- a/filament/backend/src/metal/MetalDriver.mm +++ b/filament/backend/src/metal/MetalDriver.mm @@ -977,7 +977,9 @@ void MetalDriver::updateSamplerGroup(Handle sbh, BufferDescripto void MetalDriver::compilePrograms(CallbackHandler* handler, CallbackHandler::Callback callback, void* user) { - scheduleCallback(handler, user, callback); + if (callback) { + scheduleCallback(handler, user, callback); + } } void MetalDriver::beginRenderPass(Handle rth, diff --git a/filament/backend/src/noop/NoopDriver.cpp b/filament/backend/src/noop/NoopDriver.cpp index ff83d9a1a2..5e0eee835c 100644 --- a/filament/backend/src/noop/NoopDriver.cpp +++ b/filament/backend/src/noop/NoopDriver.cpp @@ -262,7 +262,9 @@ void NoopDriver::updateSamplerGroup(Handle sbh, void NoopDriver::compilePrograms(CallbackHandler* handler, CallbackHandler::Callback callback, void* user) { - scheduleCallback(handler, user, callback); + if (callback) { + scheduleCallback(handler, user, callback); + } } void NoopDriver::beginRenderPass(Handle rth, const RenderPassParams& params) { diff --git a/filament/backend/src/opengl/OpenGLBlobCache.cpp b/filament/backend/src/opengl/OpenGLBlobCache.cpp index 8720639f54..48155dc23f 100644 --- a/filament/backend/src/opengl/OpenGLBlobCache.cpp +++ b/filament/backend/src/opengl/OpenGLBlobCache.cpp @@ -41,6 +41,7 @@ GLuint OpenGLBlobCache::retrieve(BlobCacheKey* outKey, Platform& platform, GLuint programId = 0; +#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2 BlobCacheKey key{ program.getCacheId(), program.getSpecializationConstants() }; // FIXME: use a static buffer to avoid systematic allocation @@ -77,12 +78,14 @@ GLuint OpenGLBlobCache::retrieve(BlobCacheKey* outKey, Platform& platform, using std::swap; swap(*outKey, key); } +#endif return programId; } void OpenGLBlobCache::insert(Platform& platform, BlobCacheKey const& key, GLuint program) noexcept { +#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2 SYSTRACE_CALL(); if (platform.hasBlobFunc()) { SYSTRACE_CONTEXT(); @@ -102,6 +105,21 @@ void OpenGLBlobCache::insert(Platform& platform, } } } +#endif +} + +void OpenGLBlobCache::insert(Platform& platform, BlobCacheKey const& key, + GLenum format, void* data, GLsizei programBinarySize) noexcept { + SYSTRACE_CALL(); + if (platform.hasBlobFunc()) { + if (programBinarySize) { + size_t const size = sizeof(Blob) + programBinarySize; + std::unique_ptr blob{ (Blob*)malloc(size), &::free }; + blob->format = format; + memcpy(blob->data, data, programBinarySize); + platform.insertBlob(key.data(), key.size(), blob.get(), size); + } + } } } // namespace filament::backend diff --git a/filament/backend/src/opengl/OpenGLBlobCache.h b/filament/backend/src/opengl/OpenGLBlobCache.h index cc78c429b9..5569fa2034 100644 --- a/filament/backend/src/opengl/OpenGLBlobCache.h +++ b/filament/backend/src/opengl/OpenGLBlobCache.h @@ -34,6 +34,9 @@ public: static void insert(Platform& platform, BlobCacheKey const& key, GLuint program) noexcept; + static void insert(Platform& platform, BlobCacheKey const& key, + GLenum format, void* data, GLsizei programBinarySize) noexcept; + private: struct Blob; }; diff --git a/filament/backend/src/opengl/OpenGLContext.cpp b/filament/backend/src/opengl/OpenGLContext.cpp index bf92dbb3d9..7e8a8f9f15 100644 --- a/filament/backend/src/opengl/OpenGLContext.cpp +++ b/filament/backend/src/opengl/OpenGLContext.cpp @@ -115,6 +115,9 @@ OpenGLContext::OpenGLContext() noexcept { procs.invalidateFramebuffer = glInvalidateFramebuffer; #endif // BACKEND_OPENGL_LEVEL_GLES30 + // no-op if not supported + procs.maxShaderCompilerThreadsKHR = +[](GLuint) {}; + #ifdef BACKEND_OPENGL_VERSION_GLES initExtensionsGLES(); if (state.major == 3) { @@ -173,6 +176,8 @@ OpenGLContext::OpenGLContext() noexcept { procs.invalidateFramebuffer = glDiscardFramebufferEXT; + procs.maxShaderCompilerThreadsKHR = glMaxShaderCompilerThreadsKHR; + mFeatureLevel = FeatureLevel::FEATURE_LEVEL_0; } #endif // IOS @@ -197,6 +202,8 @@ OpenGLContext::OpenGLContext() noexcept { bugs.allow_read_only_ancillary_feedback_loop = true; assert_invariant(gets.max_texture_image_units >= 16); assert_invariant(gets.max_combined_texture_image_units >= 32); + + procs.maxShaderCompilerThreadsKHR = glMaxShaderCompilerThreadsARB; #endif #ifdef GL_EXT_texture_filter_anisotropic diff --git a/filament/backend/src/opengl/OpenGLContext.h b/filament/backend/src/opengl/OpenGLContext.h index 2ba722e6fe..0e1e587b25 100644 --- a/filament/backend/src/opengl/OpenGLContext.h +++ b/filament/backend/src/opengl/OpenGLContext.h @@ -415,6 +415,8 @@ public: void (* getQueryObjectui64v)(GLuint id, GLenum pname, GLuint64* params); void (* invalidateFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments); + + void (* maxShaderCompilerThreadsKHR)(GLuint count); } procs{}; private: diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp index 05e5c4ecab..0fb3b9430b 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp @@ -50,13 +50,15 @@ #define HAS_MAPBUFFERS 1 #endif -#define DEBUG_MARKER_NONE 0 -#define DEBUG_MARKER_OPENGL 1 +#define DEBUG_MARKER_NONE 0x00 // no debug marker +#define DEBUG_MARKER_OPENGL 0x01 // markers in the gl command queue (req. driver support) +#define DEBUG_MARKER_BACKEND 0x02 // markers on the backend side (systrace) +#define DEBUG_MARKER_ALL 0x03 // all markers // set to the desired debug marker level #define DEBUG_MARKER_LEVEL DEBUG_MARKER_NONE -#if DEBUG_MARKER_LEVEL == DEBUG_MARKER_OPENGL +#if DEBUG_MARKER_LEVEL > DEBUG_MARKER_NONE # define DEBUG_MARKER() \ DebugMarker _debug_marker(*this, __func__); #else @@ -165,9 +167,11 @@ OpenGLDriver::DebugMarker::~DebugMarker() noexcept { // ------------------------------------------------------------------------------------------------ OpenGLDriver::OpenGLDriver(OpenGLPlatform* platform, const Platform::DriverConfig& driverConfig) noexcept - : mHandleAllocator("Handles", driverConfig.handleArenaSize), - mSamplerMap(32), - mPlatform(*platform) { + : mPlatform(*platform), + mContext(), + mShaderCompilerService(*this), + mHandleAllocator("Handles", driverConfig.handleArenaSize), + mSamplerMap(32) { std::fill(mSamplerBindings.begin(), mSamplerBindings.end(), nullptr); @@ -208,6 +212,8 @@ OpenGLDriver::OpenGLDriver(OpenGLPlatform* platform, const Platform::DriverConfi mTimerQueryImpl = new TimerQueryFallback(); mFrameTimeSupported = false; } + + mShaderCompilerService.init(); } OpenGLDriver::~OpenGLDriver() noexcept { // NOLINT(modernize-use-equals-default) @@ -243,6 +249,8 @@ void OpenGLDriver::terminate() { delete mTimerQueryImpl; + mShaderCompilerService.terminate(); + mPlatform.terminate(); } @@ -1455,7 +1463,6 @@ void OpenGLDriver::destroyProgram(Handle ph) { DEBUG_MARKER() if (ph) { OpenGLProgram* p = handle_cast(ph); - cancelRunAtNextPassOp(p); destruct(ph, p); } } @@ -2602,18 +2609,16 @@ SyncStatus OpenGLDriver::getSyncStatus(Handle sh) { void OpenGLDriver::compilePrograms(CallbackHandler* handler, CallbackHandler::Callback callback, void* user) { - // TODO: this works because currently `executeRenderPassOps` is only used for compiling - // materials. If that changed, we'd have to only execute the callbacks related to - // material compilation. - executeRenderPassOps(); - scheduleCallback(handler, user, callback); + if (callback) { + getShaderCompilerService().notifyWhenAllProgramsAreReady(handler, callback, user); + } } void OpenGLDriver::beginRenderPass(Handle rth, const RenderPassParams& params) { DEBUG_MARKER() - executeRenderPassOps(); + getShaderCompilerService().tick(); auto& gl = mContext; @@ -2954,29 +2959,34 @@ void OpenGLDriver::insertEventMarker(char const* string, uint32_t len) { } void OpenGLDriver::pushGroupMarker(char const* string, uint32_t len) { + #ifdef GL_EXT_debug_marker - auto& gl = mContext; - if (UTILS_LIKELY(gl.ext.EXT_debug_marker)) { +#if DEBUG_MARKER_LEVEL & DEBUG_MARKER_OPENGL + if (UTILS_LIKELY(mContext.ext.EXT_debug_marker)) { glPushGroupMarkerEXT(GLsizei(len ? len : strlen(string)), string); - } else -#endif - { - SYSTRACE_CONTEXT(); - SYSTRACE_NAME_BEGIN(string); } +#endif +#endif + +#if DEBUG_MARKER_LEVEL & DEBUG_MARKER_BACKEND + SYSTRACE_CONTEXT(); + SYSTRACE_NAME_BEGIN(string); +#endif } void OpenGLDriver::popGroupMarker(int) { #ifdef GL_EXT_debug_marker - auto& gl = mContext; - if (UTILS_LIKELY(gl.ext.EXT_debug_marker)) { +#if DEBUG_MARKER_LEVEL & DEBUG_MARKER_OPENGL + if (UTILS_LIKELY(mContext.ext.EXT_debug_marker)) { glPopGroupMarkerEXT(); - } else -#endif - { - SYSTRACE_CONTEXT(); - SYSTRACE_NAME_END(); } +#endif +#endif + +#if DEBUG_MARKER_LEVEL & DEBUG_MARKER_BACKEND + SYSTRACE_CONTEXT(); + SYSTRACE_NAME_END(); +#endif } void OpenGLDriver::startCapture(int) { @@ -3213,25 +3223,6 @@ void OpenGLDriver::executeEveryNowAndThenOps() noexcept { } } -void OpenGLDriver::runAtNextRenderPass(void* token, std::function fn) noexcept { - assert_invariant(mRunAtNextRenderPassOps.find(token) == mRunAtNextRenderPassOps.end()); - mRunAtNextRenderPassOps[token] = std::move(fn); -} - -void OpenGLDriver::cancelRunAtNextPassOp(void* token) noexcept { - mRunAtNextRenderPassOps.erase(token); -} - -void OpenGLDriver::executeRenderPassOps() noexcept { - auto& ops = mRunAtNextRenderPassOps; - if (!ops.empty()) { - for (auto& item: ops) { - item.second(); - } - ops.clear(); - } -} - // ------------------------------------------------------------------------------------------------ // Rendering ops // ------------------------------------------------------------------------------------------------ @@ -3240,6 +3231,7 @@ void OpenGLDriver::tick(int) { DEBUG_MARKER() executeGpuCommandsCompleteOps(); executeEveryNowAndThenOps(); + getShaderCompilerService().tick(); } void OpenGLDriver::beginFrame( @@ -3549,7 +3541,7 @@ void OpenGLDriver::draw(PipelineState state, Handle rph, uint } void OpenGLDriver::dispatchCompute(Handle program, math::uint3 workGroupCount) { - executeRenderPassOps(); + getShaderCompilerService().tick(); OpenGLProgram* p = handle_cast(program); diff --git a/filament/backend/src/opengl/OpenGLDriver.h b/filament/backend/src/opengl/OpenGLDriver.h index 24f3cb7180..efb512b526 100644 --- a/filament/backend/src/opengl/OpenGLDriver.h +++ b/filament/backend/src/opengl/OpenGLDriver.h @@ -20,6 +20,7 @@ #include "DriverBase.h" #include "GLUtils.h" #include "OpenGLContext.h" +#include "ShaderCompilerService.h" #include "private/backend/Driver.h" #include "private/backend/HandleAllocator.h" @@ -209,10 +210,16 @@ public: OpenGLDriver& operator=(OpenGLDriver const&) = delete; private: + OpenGLPlatform& mPlatform; OpenGLContext mContext; + ShaderCompilerService mShaderCompilerService; OpenGLContext& getContext() noexcept { return mContext; } + ShaderCompilerService& getShaderCompilerService() noexcept { + return mShaderCompilerService; + } + ShaderModel getShaderModel() const noexcept final; /* @@ -273,6 +280,7 @@ private: } friend class OpenGLProgram; + friend class ShaderCompilerService; /* Extension management... */ @@ -373,8 +381,6 @@ private: void detachStream(GLTexture* t) noexcept; void replaceStream(GLTexture* t, GLStream* stream) noexcept; - OpenGLPlatform& mPlatform; - void updateTextureLodRange(GLTexture* texture, int8_t targetLevel) noexcept; // tasks executed on the main thread after the fence signaled @@ -387,11 +393,6 @@ private: void executeEveryNowAndThenOps() noexcept; std::vector> mEveryNowAndThenOps; - void runAtNextRenderPass(void* token, std::function fn) noexcept; - void executeRenderPassOps() noexcept; - void cancelRunAtNextPassOp(void* token) noexcept; - tsl::robin_map> mRunAtNextRenderPassOps; - // timer query implementation OpenGLTimerQueryInterface* mTimerQueryImpl = nullptr; bool mFrameTimeSupported = false; diff --git a/filament/backend/src/opengl/OpenGLPlatform.cpp b/filament/backend/src/opengl/OpenGLPlatform.cpp index e44566d05f..4297479d97 100644 --- a/filament/backend/src/opengl/OpenGLPlatform.cpp +++ b/filament/backend/src/opengl/OpenGLPlatform.cpp @@ -109,4 +109,11 @@ TargetBufferFlags OpenGLPlatform::getPreservedFlags(UTILS_UNUSED SwapChain* swap return TargetBufferFlags::NONE; } +bool OpenGLPlatform::isExtraContextSupported() const noexcept { + return false; +} + +void OpenGLPlatform::createContext(bool) { +} + } // namespace filament::backend diff --git a/filament/backend/src/opengl/OpenGLProgram.cpp b/filament/backend/src/opengl/OpenGLProgram.cpp index 69d0f85f16..69ba1b6a3e 100644 --- a/filament/backend/src/opengl/OpenGLProgram.cpp +++ b/filament/backend/src/opengl/OpenGLProgram.cpp @@ -16,377 +16,88 @@ #include "OpenGLProgram.h" -#include "OpenGLBlobCache.h" -#include "OpenGLDriver.h" - #include "BlobCacheKey.h" +#include "OpenGLDriver.h" +#include "ShaderCompilerService.h" #include #include #include -#include #include #include -#include - namespace filament::backend { using namespace filament::math; using namespace utils; using namespace backend; -static void logCompilationError(utils::io::ostream& out, - ShaderStage shaderType, const char* name, - GLuint shaderId, CString const& sourceCode) noexcept; +struct OpenGLProgram::LazyInitializationData { + Program::UniformBlockInfo uniformBlockInfo; + Program::SamplerGroupInfo samplerGroupInfo; + std::array bindingUniformInfo; +}; -static void logProgramLinkError(utils::io::ostream& out, - const char* name, GLuint program) noexcept; -static inline std::string to_string(bool b) noexcept { - return b ? "true" : "false"; -} - -static inline std::string to_string(int i) noexcept { - return std::to_string(i); -} - -static inline std::string to_string(float f) noexcept { - return "float(" + std::to_string(f) + ")"; -} - -OpenGLProgram::OpenGLProgram() noexcept - : mInitialized(false), mValid(true), mLazyInitializationData(nullptr) { -} +OpenGLProgram::OpenGLProgram() noexcept = default; OpenGLProgram::OpenGLProgram(OpenGLDriver& gld, Program&& program) noexcept - : HwProgram(std::move(program.getName())), - mInitialized(false), mValid(true), - mLazyInitializationData{ new(LazyInitializationData) } { + : HwProgram(std::move(program.getName())) { - OpenGLContext& context = gld.getContext(); - - mLazyInitializationData->samplerGroupInfo = std::move(program.getSamplerGroupInfo()); + auto* const lazyInitializationData = new(std::nothrow) LazyInitializationData(); + lazyInitializationData->samplerGroupInfo = std::move(program.getSamplerGroupInfo()); if (UTILS_UNLIKELY(gld.getContext().isES2())) { - mLazyInitializationData->bindingUniformInfo = std::move(program.getBindingUniformInfo()); - mLazyInitializationData->attributes = std::move(program.getAttributes()); + lazyInitializationData->bindingUniformInfo = std::move(program.getBindingUniformInfo()); } else { - mLazyInitializationData->uniformBlockInfo = std::move(program.getUniformBlockBindings()); + lazyInitializationData->uniformBlockInfo = std::move(program.getUniformBlockBindings()); } - BlobCacheKey key; - gl.program = OpenGLBlobCache::retrieve(&key, gld.mPlatform, program); - if (!gl.program) { - // this cannot fail because we check compilation status after linking the program - // shaders[] is filled with id of shader stages present. - OpenGLProgram::compileShaders(context, - std::move(program.getShadersSource()), - program.getSpecializationConstants(), - gl.shaders, - mLazyInitializationData->shaderSourceCode); + ShaderCompilerService& compiler = gld.getShaderCompilerService(); + mToken = compiler.createProgram(name, std::move(program)); - gld.runAtNextRenderPass(this, [this, &gld, &context, key = std::move(key)]() { - // by this point we must not have a GL program - assert_invariant(!gl.program); - // we also can't be in the initialized state - assert_invariant(!mInitialized); - // we must have our lazy initialization data - assert_invariant(mLazyInitializationData); - // link the program, this also cannot fail because status is checked later. - gl.program = OpenGLProgram::linkProgram(context, - mLazyInitializationData, gl.shaders); - - if (key) { - // attempt to cache - OpenGLBlobCache::insert(gld.mPlatform, key, gl.program); - } - }); - } + ShaderCompilerService::setUserData(mToken, lazyInitializationData); } OpenGLProgram::~OpenGLProgram() noexcept { - if (!mInitialized) { - // mLazyInitializationData is aliased with mIndicesRuns - delete mLazyInitializationData; + if (mToken) { + // if the token is non-nullptr it means the program has not been used, and + // we need to clean-up. + assert_invariant(gl.program == 0); + + LazyInitializationData* const lazyInitializationData = + (LazyInitializationData *)ShaderCompilerService::getUserData(mToken); + delete lazyInitializationData; + + ShaderCompilerService::terminate(mToken); } + delete [] mUniformsRecords; const GLuint program = gl.program; - UTILS_NOUNROLL - for (GLuint const shader: gl.shaders) { - if (shader) { - if (program) { - glDetachShader(program, shader); - } - glDeleteShader(shader); - } - } if (program) { glDeleteProgram(program); } } -/* - * Compile shaders in the ShaderSource. This cannot fail because compilation failures are not - * checked until after the program is linked. - * This always returns the GL shader IDs or zero a shader stage is not present. - */ -void OpenGLProgram::compileShaders(OpenGLContext& context, - Program::ShaderSource shadersSource, - utils::FixedCapacityVector const& specializationConstants, - GLuint shaderIds[Program::SHADER_TYPE_COUNT], - UTILS_UNUSED_IN_RELEASE std::array& outShaderSourceCode) noexcept { +void OpenGLProgram::initialize(OpenGLDriver& gld) { SYSTRACE_CALL(); - auto appendSpecConstantString = +[](std::string& s, Program::SpecializationConstant const& sc) { - s += "#define SPIRV_CROSS_CONSTANT_ID_" + std::to_string(sc.id) + ' '; - s += std::visit([](auto&& arg) { return to_string(arg); }, sc.value); - s += '\n'; - return s; - }; + assert_invariant(gl.program == 0); + assert_invariant(mToken); - std::string specializationConstantString; - for (auto const& sc : specializationConstants) { - appendSpecConstantString(specializationConstantString, sc); + LazyInitializationData* const lazyInitializationData = + (LazyInitializationData *)ShaderCompilerService::getUserData(mToken); + + ShaderCompilerService& compiler = gld.getShaderCompilerService(); + gl.program = compiler.getProgram(mToken); + + assert_invariant(mToken == nullptr); + if (gl.program) { + assert_invariant(lazyInitializationData); + initializeProgramState(gld.getContext(), gl.program, *lazyInitializationData); + delete lazyInitializationData; } - if (!specializationConstantString.empty()) { - specializationConstantString += '\n'; - } - - // build all shaders - UTILS_NOUNROLL - for (size_t i = 0; i < Program::SHADER_TYPE_COUNT; i++) { - const ShaderStage stage = static_cast(i); - GLenum glShaderType{}; - switch (stage) { - case ShaderStage::VERTEX: - glShaderType = GL_VERTEX_SHADER; - break; - case ShaderStage::FRAGMENT: - glShaderType = GL_FRAGMENT_SHADER; - break; - case ShaderStage::COMPUTE: -#if defined(BACKEND_OPENGL_LEVEL_GLES31) - glShaderType = GL_COMPUTE_SHADER; -#else - continue; -#endif - break; - } - - if (UTILS_LIKELY(!shadersSource[i].empty())) { - Program::ShaderBlob& shader = shadersSource[i]; - - // remove GOOGLE_cpp_style_line_directive - std::string_view const source = process_GOOGLE_cpp_style_line_directive(context, - reinterpret_cast(shader.data()), shader.size()); - - // add support for ARB_shading_language_packing if needed - auto const packingFunctions = process_ARB_shading_language_packing(context); - - // split shader source, so we can insert the specification constants and the packing functions - auto const [prolog, body] = splitShaderSource(source); - - const std::array sources = { - prolog.data(), - specializationConstantString.c_str(), - packingFunctions.data(), - body.data() - }; - - const std::array lengths = { - (GLint)prolog.length(), - (GLint)specializationConstantString.length(), - (GLint)packingFunctions.length(), - (GLint)body.length() - 1 // null terminated - }; - - GLuint const shaderId = glCreateShader(glShaderType); - glShaderSource(shaderId, sources.size(), sources.data(), lengths.data()); - glCompileShader(shaderId); - -#ifndef NDEBUG - // for debugging we return the original shader source (without the modifications we - // made here), otherwise the line numbers wouldn't match. - outShaderSourceCode[i] = { source.data(), source.length() }; -#endif - - shaderIds[i] = shaderId; - } - } -} - -// If usages of the Google-style line directive are present, remove them, as some -// drivers don't allow the quotation marks. This happens in-place. -std::string_view OpenGLProgram::process_GOOGLE_cpp_style_line_directive(OpenGLContext& context, - char* source, size_t len) noexcept { - if (!context.ext.GOOGLE_cpp_style_line_directive) { - if (UTILS_UNLIKELY(requestsGoogleLineDirectivesExtension({ source, len }))) { - removeGoogleLineDirectives(source, len); // length is unaffected - } - } - return { source, len }; -} - -// Tragically, OpenGL 4.1 doesn't support unpackHalf2x16 (appeared in 4.2) and -// macOS doesn't support GL_ARB_shading_language_packing -std::string_view OpenGLProgram::process_ARB_shading_language_packing(OpenGLContext& context) noexcept { - using namespace std::literals; -#ifdef BACKEND_OPENGL_VERSION_GL - if (!context.isAtLeastGL<4, 2>() && !context.ext.ARB_shading_language_packing) { - return R"( - -// these don't handle denormals, NaNs or inf -float u16tofp32(highp uint v) { - v <<= 16u; - highp uint s = v & 0x80000000u; - highp uint n = v & 0x7FFFFFFFu; - highp uint nz = n == 0u ? 0u : 0xFFFFFFFF; - return uintBitsToFloat(s | ((((n >> 3u) + (0x70u << 23))) & nz)); -} -vec2 unpackHalf2x16(highp uint v) { - return vec2(u16tofp32(v&0xFFFFu), u16tofp32(v>>16u)); -} -uint fp32tou16(float val) { - uint f32 = floatBitsToUint(val); - uint f16 = 0u; - uint sign = (f32 >> 16) & 0x8000u; - int exponent = int((f32 >> 23) & 0xFFu) - 127; - uint mantissa = f32 & 0x007FFFFFu; - if (exponent > 15) { - f16 = sign | (0x1Fu << 10); - } else if (exponent > -15) { - exponent += 15; - mantissa >>= 13; - f16 = sign | uint(exponent << 10) | mantissa; - } else { - f16 = sign; - } - return f16; -} -highp uint packHalf2x16(vec2 v) { - highp uint x = fp32tou16(v.x); - highp uint y = fp32tou16(v.y); - return (y << 16) | x; -} -)"sv; - } -#endif // BACKEND_OPENGL_VERSION_GL - return ""sv; -} - -// split shader source code in two, the first section goes from the start to the line after the -// last #extension, and the 2nd part goes from there to the end. -std::array OpenGLProgram::splitShaderSource(std::string_view source) noexcept { - auto start = source.find("#version"); - assert_invariant(start != std::string_view::npos); - - auto pos = source.rfind("\n#extension"); - if (pos == std::string_view::npos) { - pos = start; - } else { - ++pos; - } - - auto eol = source.find('\n', pos) + 1; - assert_invariant(eol != std::string_view::npos); - - std::string_view const version = source.substr(start, eol - start); - std::string_view const body = source.substr(version.length(), source.length() - version.length()); - return { version, body }; -} - -/* - * Create a program from the given shader IDs and links it. This cannot fail because errors - * are checked later. This always returns a valid GL program ID (which doesn't mean the - * program itself is valid). - */ -GLuint OpenGLProgram::linkProgram(OpenGLContext& context, - LazyInitializationData* const lazyInitializationData, - const GLuint shaderIds[Program::SHADER_TYPE_COUNT]) noexcept { - - SYSTRACE_CALL(); - - GLuint const program = glCreateProgram(); - for (size_t i = 0; i < Program::SHADER_TYPE_COUNT; i++) { - if (shaderIds[i]) { - glAttachShader(program, shaderIds[i]); - } - } - - if (UTILS_UNLIKELY(context.isES2())) { - for (auto const& [ name, loc ] : lazyInitializationData->attributes) { - glBindAttribLocation(program, loc, name.c_str()); - } - } - - glLinkProgram(program); - return program; -} - -/* - * Checks a program link status and logs errors and frees resources on failure. - * Returns true on success. - */ -bool OpenGLProgram::checkProgramStatus(const char* name, - GLuint& program, GLuint shaderIds[Program::SHADER_TYPE_COUNT], - std::array const& shaderSourceCode) noexcept { - - SYSTRACE_CALL(); - - GLint status; - glGetProgramiv(program, GL_LINK_STATUS, &status); - if (UTILS_LIKELY(status == GL_TRUE)) { - return true; - } - - // only if the link fails, we check the compilation status - UTILS_NOUNROLL - for (size_t i = 0; i < Program::SHADER_TYPE_COUNT; i++) { - const ShaderStage type = static_cast(i); - const GLuint shader = shaderIds[i]; - if (shader) { - glGetShaderiv(shader, GL_COMPILE_STATUS, &status); - if (status != GL_TRUE) { - logCompilationError(slog.e, type, name, shader, shaderSourceCode[i]); - } - glDetachShader(program, shader); - glDeleteShader(shader); - shaderIds[i] = 0; - } - } - // log the link error as well - logProgramLinkError(slog.e, name, program); - glDeleteProgram(program); - program = 0; - return false; -} - -void OpenGLProgram::initialize(OpenGLContext& context) { - // by this point we must have a GL program - assert_invariant(gl.program); - // we also can't be in the initialized state - assert_invariant(!mInitialized); - // we must have our lazy initialization data - assert_invariant(mLazyInitializationData); - - // we must copy mLazyInitializationData locally because it is aliased with mIndicesRuns - auto* const pInitializationData = mLazyInitializationData; - - // check status of program linking and shader compilation, logs error and free all resources - // in case of error. - mValid = OpenGLProgram::checkProgramStatus(name.c_str_safe(), - gl.program, gl.shaders, pInitializationData->shaderSourceCode); - - if (UTILS_LIKELY(mValid)) { - initializeProgramState(context, gl.program, *pInitializationData); - } - - // and destroy all temporary init data - delete pInitializationData; - // mInitialized means mLazyInitializationData is no more valid - mInitialized = true; } /* @@ -592,64 +303,5 @@ void OpenGLProgram::setRec709ColorSpace(bool rec709) const noexcept { glUniform1i(mRec709Location, rec709); } -UTILS_NOINLINE -void logCompilationError(io::ostream& out, ShaderStage shaderType, - const char* name, GLuint shaderId, - UTILS_UNUSED_IN_RELEASE CString const& sourceCode) noexcept { - - auto to_string = [](ShaderStage type) -> const char* { - switch (type) { - case ShaderStage::VERTEX: return "vertex"; - case ShaderStage::FRAGMENT: return "fragment"; - case ShaderStage::COMPUTE: return "compute"; - } - }; - - { // scope for the temporary string storage - GLint length = 0; - glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &length); - - CString infoLog(length); - glGetShaderInfoLog(shaderId, length, nullptr, infoLog.data()); - - out << "Compilation error in " << to_string(shaderType) << " shader \"" << name << "\":\n" - << "\"" << infoLog.c_str() << "\"" - << io::endl; - } - -#ifndef NDEBUG - std::string_view const shader{ sourceCode.data(), sourceCode.size() }; - size_t lc = 1; - size_t start = 0; - std::string line; - while (true) { - size_t const end = shader.find('\n', start); - if (end == std::string::npos) { - line = shader.substr(start); - } else { - line = shader.substr(start, end - start); - } - out << lc++ << ": " << line.c_str() << '\n'; - if (end == std::string::npos) { - break; - } - start = end + 1; - } - out << io::endl; -#endif -} - -UTILS_NOINLINE -void logProgramLinkError(io::ostream& out, char const* name, GLuint program) noexcept { - GLint length = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length); - - CString infoLog(length); - glGetProgramInfoLog(program, length, nullptr, infoLog.data()); - - out << "Link error in \"" << name << "\":\n" - << "\"" << infoLog.c_str() << "\"" - << io::endl; -} } // namespace filament::backend diff --git a/filament/backend/src/opengl/OpenGLProgram.h b/filament/backend/src/opengl/OpenGLProgram.h index a89005b974..5d183f6da1 100644 --- a/filament/backend/src/opengl/OpenGLProgram.h +++ b/filament/backend/src/opengl/OpenGLProgram.h @@ -18,22 +18,23 @@ #define TNT_FILAMENT_BACKEND_OPENGL_OPENGLPROGRAM_H #include "DriverBase.h" -#include "OpenGLDriver.h" -#include "private/backend/Driver.h" -#include "backend/Program.h" +#include "OpenGLContext.h" +#include "ShaderCompilerService.h" + +#include +#include #include -#include - -#include +#include #include #include - namespace filament::backend { +class OpenGLDriver; + class OpenGLProgram : public HwProgram { public: @@ -41,11 +42,11 @@ public: OpenGLProgram(OpenGLDriver& gld, Program&& program) noexcept; ~OpenGLProgram() noexcept; - bool isValid() const noexcept { return mValid; } + bool isValid() const noexcept { return mToken || gl.program != 0; } void use(OpenGLDriver* const gld, OpenGLContext& context) noexcept { - if (UTILS_UNLIKELY(!mInitialized)) { - initialize(context); + if (UTILS_UNLIKELY(!gl.program)) { + initialize(*gld); } context.useProgram(gl.program); @@ -67,7 +68,6 @@ public: } struct { - GLuint shaders[Program::SHADER_TYPE_COUNT] = {}; GLuint program = 0; } gl; // 12 bytes @@ -77,69 +77,29 @@ public: private: // keep these away from of other class attributes - struct LazyInitializationData { - Program::UniformBlockInfo uniformBlockInfo; - Program::SamplerGroupInfo samplerGroupInfo; - std::array bindingUniformInfo; - utils::FixedCapacityVector> attributes; - std::array shaderSourceCode; - }; + struct LazyInitializationData; - static void compileShaders(OpenGLContext& context, - Program::ShaderSource shadersSource, - utils::FixedCapacityVector const& specializationConstants, - GLuint shaderIds[Program::SHADER_TYPE_COUNT], - std::array& outShaderSourceCode) noexcept; - - static std::string_view process_GOOGLE_cpp_style_line_directive(OpenGLContext& context, - char* source, size_t len) noexcept; - - static std::string_view process_ARB_shading_language_packing(OpenGLContext& context) noexcept; - - static std::array splitShaderSource(std::string_view source) noexcept; - - static GLuint linkProgram(OpenGLContext& context, - LazyInitializationData* lazyInitializationData, - const GLuint shaderIds[Program::SHADER_TYPE_COUNT]) noexcept; - - static bool checkProgramStatus(const char* name, - GLuint& program, GLuint shaderIds[Program::SHADER_TYPE_COUNT], - std::array const& shaderSourceCode) noexcept; - - void initialize(OpenGLContext& context); + void initialize(OpenGLDriver& gld); void initializeProgramState(OpenGLContext& context, GLuint program, LazyInitializationData& lazyInitializationData) noexcept; void updateSamplers(OpenGLDriver* gld) const noexcept; + ShaderCompilerService::program_token_t mToken{}; // number of bindings actually used by this program uint8_t mUsedBindingsCount = 0u; - // whether lazy initialization has been performed - bool mInitialized : 1; - // whether lazy initialization was successful - bool mValid : 1; - UTILS_UNUSED uint8_t padding[2] = {}; + UTILS_UNUSED uint8_t padding[3] = {}; + std::array mUsedSamplerBindingPoints; // 4 bytes - // only for ES2 + // only needed for ES2 using LocationInfo = utils::FixedCapacityVector; struct UniformsRecord { Program::UniformInfo uniforms; LocationInfo locations; mutable uint16_t age = std::numeric_limits::max(); }; - - union { - // when mInitialized == true: - // information about each USED sampler buffer per binding (no gaps) - std::array mUsedSamplerBindingPoints; // 4 bytes - // when mInitialized == false: - // lazy initialization data pointer - LazyInitializationData* mLazyInitializationData; - }; - - // only needed for ES2 UniformsRecord const* mUniformsRecords = nullptr; GLint mRec709Location = -1; }; diff --git a/filament/backend/src/opengl/ShaderCompilerService.cpp b/filament/backend/src/opengl/ShaderCompilerService.cpp new file mode 100644 index 0000000000..7f052d3b06 --- /dev/null +++ b/filament/backend/src/opengl/ShaderCompilerService.cpp @@ -0,0 +1,900 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ShaderCompilerService.h" + +#include "BlobCacheKey.h" +#include "OpenGLBlobCache.h" +#include "OpenGLDriver.h" + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace filament::backend { + +using namespace utils; + +// ------------------------------------------------------------------------------------------------ + +static void logCompilationError(utils::io::ostream& out, + ShaderStage shaderType, const char* name, + GLuint shaderId, CString const& sourceCode) noexcept; + +static void logProgramLinkError(utils::io::ostream& out, + const char* name, GLuint program) noexcept; + +static inline std::string to_string(bool b) noexcept { + return b ? "true" : "false"; +} + +static inline std::string to_string(int i) noexcept { + return std::to_string(i); +} + +static inline std::string to_string(float f) noexcept { + return "float(" + std::to_string(f) + ")"; +} + +// ------------------------------------------------------------------------------------------------ + +struct ShaderCompilerService::ProgramToken { + struct ProgramBinary { + GLenum format{}; + GLuint program{}; + std::vector blob; + }; + + ProgramToken(ShaderCompilerService& compiler, utils::CString const& name) noexcept + : compiler(compiler), name(name) { + } + ShaderCompilerService& compiler; + utils::CString const& name; + utils::FixedCapacityVector> attributes; + std::array shaderSourceCode; + void* user = nullptr; + struct { + std::array shaders{}; + GLuint program = 0; + } gl; // 12 bytes + + BlobCacheKey key; + std::future binary; + CompilerPriorityQueue priorityQueue = CompilerPriorityQueue::HIGH; + bool canceled = false; +}; + +void ShaderCompilerService::setUserData(const program_token_t& token, void* user) noexcept { + token->user = user; +} + +void* ShaderCompilerService::getUserData(const program_token_t& token) noexcept { + return token->user; +} + +// ------------------------------------------------------------------------------------------------ + +void ShaderCompilerService::CompilerThreadPool::init( + bool useSharedContexts, uint32_t threadCount, OpenGLPlatform& platform) noexcept { + + for (size_t i = 0; i < threadCount; i++) { + mCompilerThreads.emplace_back([this, useSharedContexts, &platform]() { + // give the thread a name + JobSystem::setThreadName("CompilerThreadPool"); + + // create a gl context current to this thread + platform.createContext(useSharedContexts); + + // process jobs from the queue until we're asked to exit + while (!mExitRequested) { + std::unique_lock lock(mQueueLock); + mQueueCondition.wait(lock, [this]() { + return mExitRequested || + mUrgentJob || + (!std::all_of( std::begin(mQueues), std::end(mQueues), + [](auto&& q) { return q.empty(); })); + }); + if (!mExitRequested) { + Job job{ std::move(mUrgentJob) }; + if (!job) { + // use the first queue that's not empty + auto& queue = [this]() -> auto& { + for (auto& q: mQueues) { + if (!q.empty()) { + return q; + } + } + return mQueues[0]; // we should never end-up here. + }(); + assert_invariant(!queue.empty()); + std::swap(job, queue.front().second); + queue.pop_front(); + } + + // execute the job without holding any locks + lock.unlock(); + job(); + } + } + }); + + } +} + +auto ShaderCompilerService::CompilerThreadPool::dequeue(program_token_t const& token) -> Job { + auto& q = mQueues[size_t(token->priorityQueue)]; + auto pos = std::find_if(q.begin(), q.end(), [&token](auto&& item) { + return item.first == token; + }); + Job job; + if (pos != q.end()) { + std::swap(job, pos->second); + q.erase(pos); + } + return job; +} + +void ShaderCompilerService::CompilerThreadPool::makeUrgent(program_token_t const& token) { + std::unique_lock const lock(mQueueLock); + assert_invariant(!mUrgentJob); + Job job{ dequeue(token) }; + std::swap(job, mUrgentJob); + mQueueCondition.notify_one(); +} + +void ShaderCompilerService::CompilerThreadPool::queue(program_token_t const& token, Job&& job) { + std::unique_lock const lock(mQueueLock); + mQueues[size_t(token->priorityQueue)].emplace_back(token, std::move(job)); + mQueueCondition.notify_one(); +} + +void ShaderCompilerService::CompilerThreadPool::exit() noexcept { + std::unique_lock lock(mQueueLock); + mExitRequested = true; + mQueueCondition.notify_all(); + lock.unlock(); + for (auto& thread: mCompilerThreads) { + if (thread.joinable()) { + thread.join(); + } + } +} + +// ------------------------------------------------------------------------------------------------ + +ShaderCompilerService::ShaderCompilerService(OpenGLDriver& driver) + : mDriver(driver), + KHR_parallel_shader_compile(driver.getContext().ext.KHR_parallel_shader_compile) { +} + +ShaderCompilerService::~ShaderCompilerService() noexcept = default; + +void ShaderCompilerService::init() noexcept { + // If we have KHR_parallel_shader_compile, we always use it, it should be more resource + // friendly. + if (!KHR_parallel_shader_compile) { + // - on Adreno there is a single compiler object. We can't use a pool > 1 + // also glProgramBinary blocks if other threads are compiling. + // - on Mali shader compilation can be multithreaded, but program linking happens on + // a single service thread, so we don't bother using more than one thread either. + // - on desktop we could use more threads, tbd. + if (mDriver.mPlatform.isExtraContextSupported()) { + mShaderCompilerThreadCount = 1; + mCompilerThreadPool.init(mUseSharedContext, + mShaderCompilerThreadCount, mDriver.mPlatform); + } + } +} + +void ShaderCompilerService::terminate() noexcept { + // FIXME: could we have some user callbacks pending here? + mCompilerThreadPool.exit(); +} + +ShaderCompilerService::program_token_t ShaderCompilerService::createProgram( + utils::CString const& name, Program&& program) { + auto& gl = mDriver.getContext(); + + auto token = std::make_shared(*this, name); + + if (UTILS_UNLIKELY(gl.isES2())) { + token->attributes = std::move(program.getAttributes()); + } + + token->gl.program = OpenGLBlobCache::retrieve(&token->key, mDriver.mPlatform, program); + if (!token->gl.program) { + if (mShaderCompilerThreadCount) { + // set the future in the token and pass the promise to the worker thread + std::promise promise; + token->binary = promise.get_future(); + token->priorityQueue = program.getPriorityQueue(); + // queue a compile job + mCompilerThreadPool.queue(token, + [this, &gl, promise = std::move(promise), + program = std::move(program), token]() mutable { + + // compile the shaders + std::array shaders{}; + std::array shaderSourceCode; + compileShaders(gl, + std::move(program.getShadersSource()), + program.getSpecializationConstants(), + shaders, + shaderSourceCode); + + // link the program + GLuint const glProgram = linkProgram(gl, shaders, token->attributes); + + // immediately destroy the shaders + for (GLuint const shader: shaders) { + if (shader) { + glDetachShader(glProgram, shader); + glDeleteShader(shader); + } + } + + ProgramToken::ProgramBinary binary; + if (UTILS_LIKELY(mUseSharedContext)) { + // We need to query the link status here to guarantee that the + // program is compiled and linked now (we don't want this to be + // deferred to later). We don't care about the result at this point. + GLint status; + glGetProgramiv(glProgram, GL_LINK_STATUS, &status); + binary.program = glProgram; + if (token->key) { + // Attempt to cache. This calls glGetProgramBinary. + OpenGLBlobCache::insert(mDriver.mPlatform, + token->key, token->gl.program); + } + } +#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2 + else { + // retrieve the program binary + GLsizei programBinarySize = 0; + glGetProgramiv(glProgram, GL_PROGRAM_BINARY_LENGTH, &programBinarySize); + assert_invariant(programBinarySize); + if (programBinarySize) { + binary.blob.resize(programBinarySize); + glGetProgramBinary(glProgram, programBinarySize, + &programBinarySize, &binary.format, binary.blob.data()); + } + // and we can destroy the program + glDeleteProgram(glProgram); + if (token->key) { + // attempt to cache + OpenGLBlobCache::insert(mDriver.mPlatform, token->key, + binary.format, + binary.blob.data(), GLsizei(binary.blob.size())); + } + } +#endif + // we don't need to check for success here, it'll be done on the + // main thread side. + promise.set_value(binary); + }); + } else + { + // this cannot fail because we check compilation status after linking the program + // shaders[] is filled with id of shader stages present. + compileShaders(gl, + std::move(program.getShadersSource()), + program.getSpecializationConstants(), + token->gl.shaders, + token->shaderSourceCode); + + } + + runAtNextTick(token, [this, token]() { + if (mShaderCompilerThreadCount) { + if (!token->gl.program) { + // TODO: see if we could completely eliminate this callback here + // and instead just rely on token->gl.program being atomically + // set by the compiler thread. + assert_invariant(token->binary.valid()); + // we're using the compiler thread, check if the program is ready, no-op if not. + using namespace std::chrono_literals; + if (token->binary.wait_for(0s) != std::future_status::ready) { + return false; + } + // program binary is ready, retrieve it without blocking + getProgramFromCompilerPool(const_cast(token)); + } + } else { + if (KHR_parallel_shader_compile) { + // don't attempt to link this program if all shaders are not done compiling + GLint status; + if (token->gl.program) { + glGetProgramiv(token->gl.program, GL_COMPLETION_STATUS, &status); + if (status == GL_FALSE) { + return false; + } + } else { + for (auto shader: token->gl.shaders) { + if (shader) { + glGetShaderiv(shader, GL_COMPLETION_STATUS, &status); + if (status == GL_FALSE) { + return false; + } + } + } + } + } + + if (!token->gl.program) { + // link the program, this also cannot fail because status is checked later. + token->gl.program = linkProgram(mDriver.getContext(), + token->gl.shaders, token->attributes); + if (KHR_parallel_shader_compile) { + // wait until the link finishes... + return false; + } + } + } + + assert_invariant(token->gl.program); + + if (token->key && !mShaderCompilerThreadCount) { + // TODO: technically we don't have to cache right now. Is it advantageous to + // do this later, maybe depending on CPU usage? + // attempt to cache if we don't have a thread pool (otherwise it's done + // by the pool). + OpenGLBlobCache::insert(mDriver.mPlatform, token->key, token->gl.program); + } + + return true; + }); + } + + return token; +} + +bool ShaderCompilerService::isProgramReady( + const ShaderCompilerService::program_token_t& token) const noexcept { + + assert_invariant(token); + + if (!token->gl.program) { + return false; + } + + if (KHR_parallel_shader_compile) { + GLint status = GL_FALSE; + glGetProgramiv(token->gl.program, GL_COMPLETION_STATUS, &status); + return (bool)status; + } + + // If gl.program is set, this means the program was linked. Some drivers may defer the link + // in which case we might block in getProgram() when we check the program status. + // Unfortunately, this is nothing we can do about that. + return bool(token->gl.program); +} + +GLuint ShaderCompilerService::getProgram(ShaderCompilerService::program_token_t& token) { + GLuint const program = initialize(token); + assert_invariant(token == nullptr); + assert_invariant(program); + return program; +} + +/* static*/ void ShaderCompilerService::terminate(program_token_t& token) { + assert_invariant(token); + + token->canceled = true; + + token->compiler.cancelTickOp(token); + + for (GLuint& shader: token->gl.shaders) { + if (shader) { + if (token->gl.program) { + glDetachShader(token->gl.program, shader); + } + glDeleteShader(shader); + shader = 0; + } + } + if (token->gl.program) { + glDeleteProgram(token->gl.program); + } + + token = nullptr; +} + +void ShaderCompilerService::tick() { + executeTickOps(); +} + +void ShaderCompilerService::notifyWhenAllProgramsAreReady(CallbackHandler* handler, + CallbackHandler::Callback callback, void* user) { + + if (KHR_parallel_shader_compile || mShaderCompilerThreadCount) { + // list all programs up to this point + utils::FixedCapacityVector, false> tokens; + tokens.reserve(mRunAtNextTickOps.size()); + for (auto& [token, _] : mRunAtNextTickOps) { + if (token) { + tokens.push_back(token); + } + } + + runAtNextTick(nullptr, [this, tokens = std::move(tokens), handler, user, callback]() { + for (auto const& token : tokens) { + assert_invariant(token); + if (!isProgramReady(token)) { + // one of the program is not ready, try next time + return false; + } + } + if (callback) { + // all programs are ready, we can call the callbacks + mDriver.scheduleCallback(handler, user, callback); + } + // and we're done + return true; + }); + + return; + } + + // we don't have KHR_parallel_shader_compile + + runAtNextTick(nullptr, [this, handler, user, callback]() { + mDriver.scheduleCallback(handler, user, callback); + return true; + }); + + // TODO: we could spread the compiles over several frames, the tick() below then is not + // needed here. We keep it for now as to not change the current behavior too much. + // this will block until all programs are linked + tick(); +} + +// ------------------------------------------------------------------------------------------------ + +void ShaderCompilerService::getProgramFromCompilerPool(program_token_t& token) noexcept { + ProgramToken::ProgramBinary const binary{ token->binary.get() }; + if (!token->canceled) { + if (UTILS_LIKELY(mUseSharedContext)) { + token->gl.program = binary.program; + } +#ifndef FILAMENT_SILENCE_NOT_SUPPORTED_BY_ES2 + else { + token->gl.program = glCreateProgram(); + glProgramBinary(token->gl.program, binary.format, + binary.blob.data(), GLsizei(binary.blob.size())); + } +#endif + } +} + +GLuint ShaderCompilerService::initialize(program_token_t& token) noexcept { + SYSTRACE_CALL(); + if (!token->gl.program) { + if (mShaderCompilerThreadCount) { + // Block until the program is ready. This could take a very long time. + assert_invariant(token->binary.valid()); + + // we need this program right now, so move it to the head of the queue. + mCompilerThreadPool.makeUrgent(token); + + if (!token->canceled) { + token->compiler.cancelTickOp(token); + } + + // block until we get the program from the pool + getProgramFromCompilerPool(token); + } else if (KHR_parallel_shader_compile) { + // we force the program link -- which might stall, either here or below in + // checkProgramStatus(), but we don't have a choice, we need to use the program now. + token->compiler.cancelTickOp(token); + token->gl.program = linkProgram(mDriver.getContext(), + token->gl.shaders, token->attributes); + } else { + // if we don't have a program yet, block until we get it. + tick(); + } + } + + // by this point we must have a GL program + assert_invariant(token->gl.program); + + GLuint program = 0; + + // check status of program linking and shader compilation, logs error and free all resources + // in case of error. + bool const success = checkProgramStatus(token); + if (UTILS_LIKELY(success)) { + program = token->gl.program; + // no need to keep the shaders around + UTILS_NOUNROLL + for (GLuint& shader: token->gl.shaders) { + if (shader) { + glDetachShader(program, shader); + glDeleteShader(shader); + shader = 0; + } + } + } + + // and destroy all temporary init data + token = nullptr; + + return program; +} + + +/* + * Compile shaders in the ShaderSource. This cannot fail because compilation failures are not + * checked until after the program is linked. + * This always returns the GL shader IDs or zero a shader stage is not present. + */ +void ShaderCompilerService::compileShaders(OpenGLContext& context, + Program::ShaderSource shadersSource, + utils::FixedCapacityVector const& specializationConstants, + std::array& outShaders, + UTILS_UNUSED_IN_RELEASE std::array& outShaderSourceCode) noexcept { + + SYSTRACE_CALL(); + + auto appendSpecConstantString = +[](std::string& s, Program::SpecializationConstant const& sc) { + s += "#define SPIRV_CROSS_CONSTANT_ID_" + std::to_string(sc.id) + ' '; + s += std::visit([](auto&& arg) { return to_string(arg); }, sc.value); + s += '\n'; + return s; + }; + + std::string specializationConstantString; + for (auto const& sc : specializationConstants) { + appendSpecConstantString(specializationConstantString, sc); + } + if (!specializationConstantString.empty()) { + specializationConstantString += '\n'; + } + + // build all shaders + UTILS_NOUNROLL + for (size_t i = 0; i < Program::SHADER_TYPE_COUNT; i++) { + const ShaderStage stage = static_cast(i); + GLenum glShaderType{}; + switch (stage) { + case ShaderStage::VERTEX: + glShaderType = GL_VERTEX_SHADER; + break; + case ShaderStage::FRAGMENT: + glShaderType = GL_FRAGMENT_SHADER; + break; + case ShaderStage::COMPUTE: +#if defined(BACKEND_OPENGL_LEVEL_GLES31) + glShaderType = GL_COMPUTE_SHADER; +#else + continue; +#endif + break; + } + + if (UTILS_LIKELY(!shadersSource[i].empty())) { + Program::ShaderBlob& shader = shadersSource[i]; + + // remove GOOGLE_cpp_style_line_directive + std::string_view const source = process_GOOGLE_cpp_style_line_directive(context, + reinterpret_cast(shader.data()), shader.size()); + + // add support for ARB_shading_language_packing if needed + auto const packingFunctions = process_ARB_shading_language_packing(context); + + // split shader source, so we can insert the specification constants and the packing functions + auto const [prolog, body] = splitShaderSource(source); + + const std::array sources = { + prolog.data(), + specializationConstantString.c_str(), + packingFunctions.data(), + body.data() + }; + + const std::array lengths = { + (GLint)prolog.length(), + (GLint)specializationConstantString.length(), + (GLint)packingFunctions.length(), + (GLint)body.length() - 1 // null terminated + }; + + GLuint const shaderId = glCreateShader(glShaderType); + glShaderSource(shaderId, sources.size(), sources.data(), lengths.data()); + glCompileShader(shaderId); + +#ifndef NDEBUG + // for debugging we return the original shader source (without the modifications we + // made here), otherwise the line numbers wouldn't match. + outShaderSourceCode[i] = { source.data(), source.length() }; +#endif + + outShaders[i] = shaderId; + } + } +} + +// If usages of the Google-style line directive are present, remove them, as some +// drivers don't allow the quotation marks. This happens in-place. +std::string_view ShaderCompilerService::process_GOOGLE_cpp_style_line_directive(OpenGLContext& context, + char* source, size_t len) noexcept { + if (!context.ext.GOOGLE_cpp_style_line_directive) { + if (UTILS_UNLIKELY(requestsGoogleLineDirectivesExtension({ source, len }))) { + removeGoogleLineDirectives(source, len); // length is unaffected + } + } + return { source, len }; +} + +// Tragically, OpenGL 4.1 doesn't support unpackHalf2x16 (appeared in 4.2) and +// macOS doesn't support GL_ARB_shading_language_packing +std::string_view ShaderCompilerService::process_ARB_shading_language_packing(OpenGLContext& context) noexcept { + using namespace std::literals; +#ifdef BACKEND_OPENGL_VERSION_GL + if (!context.isAtLeastGL<4, 2>() && !context.ext.ARB_shading_language_packing) { + return R"( + +// these don't handle denormals, NaNs or inf +float u16tofp32(highp uint v) { + v <<= 16u; + highp uint s = v & 0x80000000u; + highp uint n = v & 0x7FFFFFFFu; + highp uint nz = n == 0u ? 0u : 0xFFFFFFFF; + return uintBitsToFloat(s | ((((n >> 3u) + (0x70u << 23))) & nz)); +} +vec2 unpackHalf2x16(highp uint v) { + return vec2(u16tofp32(v&0xFFFFu), u16tofp32(v>>16u)); +} +uint fp32tou16(float val) { + uint f32 = floatBitsToUint(val); + uint f16 = 0u; + uint sign = (f32 >> 16) & 0x8000u; + int exponent = int((f32 >> 23) & 0xFFu) - 127; + uint mantissa = f32 & 0x007FFFFFu; + if (exponent > 15) { + f16 = sign | (0x1Fu << 10); + } else if (exponent > -15) { + exponent += 15; + mantissa >>= 13; + f16 = sign | uint(exponent << 10) | mantissa; + } else { + f16 = sign; + } + return f16; +} +highp uint packHalf2x16(vec2 v) { + highp uint x = fp32tou16(v.x); + highp uint y = fp32tou16(v.y); + return (y << 16) | x; +} +)"sv; + } +#endif // BACKEND_OPENGL_VERSION_GL + return ""sv; +} + +// split shader source code in two, the first section goes from the start to the line after the +// last #extension, and the 2nd part goes from there to the end. +std::array ShaderCompilerService::splitShaderSource(std::string_view source) noexcept { + auto start = source.find("#version"); + assert_invariant(start != std::string_view::npos); + + auto pos = source.rfind("\n#extension"); + if (pos == std::string_view::npos) { + pos = start; + } else { + ++pos; + } + + auto eol = source.find('\n', pos) + 1; + assert_invariant(eol != std::string_view::npos); + + std::string_view const version = source.substr(start, eol - start); + std::string_view const body = source.substr(version.length(), source.length() - version.length()); + return { version, body }; +} + +/* + * Create a program from the given shader IDs and links it. This cannot fail because errors + * are checked later. This always returns a valid GL program ID (which doesn't mean the + * program itself is valid). + */ +GLuint ShaderCompilerService::linkProgram(OpenGLContext& context, + std::array shaders, + utils::FixedCapacityVector> const& attributes) noexcept { + + SYSTRACE_CALL(); + + GLuint const program = glCreateProgram(); + for (auto shader : shaders) { + if (shader) { + glAttachShader(program, shader); + } + } + + if (UTILS_UNLIKELY(context.isES2())) { + for (auto const& [ name, loc ] : attributes) { + glBindAttribLocation(program, loc, name.c_str()); + } + } + + glLinkProgram(program); + + return program; +} + +// ------------------------------------------------------------------------------------------------ + +void ShaderCompilerService::runAtNextTick( + const program_token_t& token, std::function fn) noexcept { + // insert items in order of priority and at the end of the range + auto& ops = mRunAtNextTickOps; + using ContainerType = std::pair>; + auto const pos = std::lower_bound(ops.begin(), ops.end(), + token->priorityQueue, + [](ContainerType const& lhs, CompilerPriorityQueue priorityQueue) { + return lhs.first->priorityQueue < priorityQueue; + }); + ops.emplace(pos, token, std::move(fn)); + + SYSTRACE_CONTEXT(); + SYSTRACE_VALUE32("ShaderCompilerService Jobs", mRunAtNextTickOps.size()); +} + +void ShaderCompilerService::cancelTickOp(program_token_t token) noexcept { + // We do a linear search here, but this is rare, and we know the list is pretty small. + auto& ops = mRunAtNextTickOps; + auto pos = std::find_if(ops.begin(), ops.end(), + [&](const auto& item) { + return item.first == token; + }); + if (pos != ops.end()) { + ops.erase(pos); + } + SYSTRACE_CONTEXT(); + SYSTRACE_VALUE32("ShaderCompilerService Jobs", ops.size()); +} + +void ShaderCompilerService::executeTickOps() noexcept { + auto& ops = mRunAtNextTickOps; + auto it = ops.begin(); + while (it != ops.end()) { + bool const remove = it->second(); + if (remove) { + it = ops.erase(it); + } else { + ++it; + } + } + SYSTRACE_CONTEXT(); + SYSTRACE_VALUE32("ShaderCompilerService Jobs", ops.size()); +} + +// ------------------------------------------------------------------------------------------------ + +/* + * Checks a program link status and logs errors and frees resources on failure. + * Returns true on success. + */ +bool ShaderCompilerService::checkProgramStatus(program_token_t const& token) noexcept { + + SYSTRACE_CALL(); + + assert_invariant(token->gl.program); + + GLint status; + glGetProgramiv(token->gl.program, GL_LINK_STATUS, &status); + if (UTILS_LIKELY(status == GL_TRUE)) { + return true; + } + + // only if the link fails, we check the compilation status + UTILS_NOUNROLL + for (size_t i = 0; i < Program::SHADER_TYPE_COUNT; i++) { + const ShaderStage type = static_cast(i); + const GLuint shader = token->gl.shaders[i]; + if (shader) { + glGetShaderiv(shader, GL_COMPILE_STATUS, &status); + if (status != GL_TRUE) { + logCompilationError(slog.e, type, + token->name.c_str_safe(), shader, token->shaderSourceCode[i]); + } + glDetachShader(token->gl.program, shader); + glDeleteShader(shader); + token->gl.shaders[i] = 0; + } + } + // log the link error as well + logProgramLinkError(slog.e, token->name.c_str_safe(), token->gl.program); + glDeleteProgram(token->gl.program); + token->gl.program = 0; + return false; +} + +UTILS_NOINLINE +void logCompilationError(io::ostream& out, ShaderStage shaderType, + const char* name, GLuint shaderId, + UTILS_UNUSED_IN_RELEASE CString const& sourceCode) noexcept { + + auto to_string = [](ShaderStage type) -> const char* { + switch (type) { + case ShaderStage::VERTEX: return "vertex"; + case ShaderStage::FRAGMENT: return "fragment"; + case ShaderStage::COMPUTE: return "compute"; + } + }; + + { // scope for the temporary string storage + GLint length = 0; + glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &length); + + CString infoLog(length); + glGetShaderInfoLog(shaderId, length, nullptr, infoLog.data()); + + out << "Compilation error in " << to_string(shaderType) << " shader \"" << name << "\":\n" + << "\"" << infoLog.c_str() << "\"" + << io::endl; + } + +#ifndef NDEBUG + std::string_view const shader{ sourceCode.data(), sourceCode.size() }; + size_t lc = 1; + size_t start = 0; + std::string line; + while (true) { + size_t const end = shader.find('\n', start); + if (end == std::string::npos) { + line = shader.substr(start); + } else { + line = shader.substr(start, end - start); + } + out << lc++ << ": " << line.c_str() << '\n'; + if (end == std::string::npos) { + break; + } + start = end + 1; + } + out << io::endl; +#endif +} + +UTILS_NOINLINE +void logProgramLinkError(io::ostream& out, char const* name, GLuint program) noexcept { + GLint length = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length); + + CString infoLog(length); + glGetProgramInfoLog(program, length, nullptr, infoLog.data()); + + out << "Link error in \"" << name << "\":\n" + << "\"" << infoLog.c_str() << "\"" + << io::endl; +} + + +} // namespace filament::backend diff --git a/filament/backend/src/opengl/ShaderCompilerService.h b/filament/backend/src/opengl/ShaderCompilerService.h new file mode 100644 index 0000000000..0fccf7525c --- /dev/null +++ b/filament/backend/src/opengl/ShaderCompilerService.h @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 TNT_FILAMENT_BACKEND_OPENGL_SHADERCOMPILERSERVICE_H +#define TNT_FILAMENT_BACKEND_OPENGL_SHADERCOMPILERSERVICE_H + +#include "gl_headers.h" + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace filament::backend { + +class OpenGLDriver; +class OpenGLContext; +class OpenGLPlatform; +class Program; +class CallbackHandler; + +/* + * A class handling shader compilation that supports asynchronous compilation. + */ +class ShaderCompilerService { + struct ProgramToken; + +public: + using program_token_t = std::shared_ptr; + + explicit ShaderCompilerService(OpenGLDriver& driver); + + ShaderCompilerService(ShaderCompilerService const& rhs) = delete; + ShaderCompilerService(ShaderCompilerService&& rhs) = delete; + ShaderCompilerService& operator=(ShaderCompilerService const& rhs) = delete; + ShaderCompilerService& operator=(ShaderCompilerService&& rhs) = delete; + + ~ShaderCompilerService() noexcept; + + void init() noexcept; + void terminate() noexcept; + + // creates a program (compile + link) asynchronously if supported + program_token_t createProgram(utils::CString const& name, Program&& program); + + // Returns true if the program is linked (successfully or not). Guarantees that + // getProgram() won't block. Does not block. + bool isProgramReady(const program_token_t& token) const noexcept; + + // Return the GL program, blocks if necessary. The Token is destroyed and becomes invalid. + GLuint getProgram(program_token_t& token); + + // Must be called at least once per frame. + void tick(); + + // Destroys a valid token and all associated resources. Used to "cancel" a program compilation. + static void terminate(program_token_t& token); + + // stores a user data pointer in the token + static void setUserData(const program_token_t& token, void* user) noexcept; + + // retrieves the user data pointer stored in the token + static void* getUserData(const program_token_t& token) noexcept; + + // call the callback when all active programs are ready + void notifyWhenAllProgramsAreReady(CallbackHandler* handler, + CallbackHandler::Callback callback, void* user); + +private: + class CompilerThreadPool { + public: + using Job = utils::Invocable; + void init(bool useSharedContexts, uint32_t threadCount, OpenGLPlatform& platform) noexcept; + void exit() noexcept; + void queue(program_token_t const& token, Job&& job); + void makeUrgent(program_token_t const& token); + + private: + std::vector mCompilerThreads; + std::atomic_bool mExitRequested{ false }; + std::mutex mQueueLock; + std::condition_variable mQueueCondition; + std::array>, 2> mQueues; + Job mUrgentJob; + Job dequeue(program_token_t const& token); // lock must be held + }; + + OpenGLDriver& mDriver; + CompilerThreadPool mCompilerThreadPool; + + const bool KHR_parallel_shader_compile; + uint32_t mShaderCompilerThreadCount = 0u; + + // For now, we assume shared contexts are supported everywhere. If they are not, + // we don't use the shader compiler pool. However, the code supports it. + static constexpr bool mUseSharedContext = true; + + GLuint initialize(ShaderCompilerService::program_token_t& token) noexcept; + + void getProgramFromCompilerPool(program_token_t& token) noexcept; + + static void compileShaders( + OpenGLContext& context, + Program::ShaderSource shadersSource, + utils::FixedCapacityVector const& specializationConstants, + std::array& outShaders, + std::array& outShaderSourceCode) noexcept; + + static std::string_view process_GOOGLE_cpp_style_line_directive(OpenGLContext& context, + char* source, size_t len) noexcept; + + static std::string_view process_ARB_shading_language_packing(OpenGLContext& context) noexcept; + + static std::array splitShaderSource(std::string_view source) noexcept; + + static GLuint linkProgram(OpenGLContext& context, + std::array shaders, + utils::FixedCapacityVector> const& attributes) noexcept; + + static bool checkProgramStatus(program_token_t const& token) noexcept; + + void runAtNextTick(const program_token_t& token, std::function fn) noexcept; + void executeTickOps() noexcept; + void cancelTickOp(program_token_t token) noexcept; + // order of insertion is important + std::vector>> mRunAtNextTickOps; +}; + +} // namespace filament::backend + +#endif // TNT_FILAMENT_BACKEND_OPENGL_SHADERCOMPILERSERVICE_H diff --git a/filament/backend/src/opengl/gl_headers.h b/filament/backend/src/opengl/gl_headers.h index f00351fcb0..9bcb8ffdcc 100644 --- a/filament/backend/src/opengl/gl_headers.h +++ b/filament/backend/src/opengl/gl_headers.h @@ -174,6 +174,12 @@ using namespace glext; # define GL_ZERO_TO_ONE GL_ZERO_TO_ONE_EXT #endif +#ifdef GL_KHR_parallel_shader_compile +# define GL_COMPLETION_STATUS GL_COMPLETION_STATUS_KHR +#else +# define GL_COMPLETION_STATUS 0x91B1 +#endif + // we need GL_TEXTURE_CUBE_MAP_ARRAY defined, but we won't use it if the extension/feature // is not available. #if defined(GL_EXT_texture_cube_map_array) @@ -223,6 +229,14 @@ using namespace glext; # endif #endif +#else // All version OpenGL below + +#ifdef GL_ARB_parallel_shader_compile +# define GL_COMPLETION_STATUS GL_COMPLETION_STATUS_ARB +#else +# define GL_COMPLETION_STATUS 0x91B1 +#endif + #endif // GL_ES_VERSION_2_0 // This is just to simplify the implementation (i.e. so we don't have to have #ifdefs everywhere) diff --git a/filament/backend/src/opengl/platforms/PlatformCocoaGL.mm b/filament/backend/src/opengl/platforms/PlatformCocoaGL.mm index 34a76078ae..195d8d17e7 100644 --- a/filament/backend/src/opengl/platforms/PlatformCocoaGL.mm +++ b/filament/backend/src/opengl/platforms/PlatformCocoaGL.mm @@ -50,6 +50,7 @@ struct PlatformCocoaGLImpl { NSOpenGLContext* mGLContext = nullptr; CocoaGLSwapChain* mCurrentSwapChain = nullptr; std::vector mHeadlessSwapChains; + std::vector mAdditionalContexts; CVOpenGLTextureCacheRef mTextureCache = nullptr; std::unique_ptr mExternalImageSharedGl; void updateOpenGLContext(NSView *nsView, bool resetView, bool clearView); @@ -171,6 +172,23 @@ Driver* PlatformCocoaGL::createDriver(void* sharedContext, const Platform::Drive return OpenGLPlatform::createDefaultDriver(this, sharedContext, driverConfig); } +bool PlatformCocoaGL::isExtraContextSupported() const noexcept { + return true; +} + +void PlatformCocoaGL::createContext(bool shared) { + NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = { + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, + NSOpenGLPFAAccelerated, (NSOpenGLPixelFormatAttribute) true, + 0, 0, + }; + NSOpenGLContext* const sharedContext = shared ? pImpl->mGLContext : nil; + NSOpenGLPixelFormat* const pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes]; + NSOpenGLContext* const nsOpenGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:sharedContext]; + [nsOpenGLContext makeCurrentContext]; + pImpl->mAdditionalContexts.push_back(nsOpenGLContext); +} + int PlatformCocoaGL::getOSVersion() const noexcept { return 0; } @@ -179,6 +197,9 @@ void PlatformCocoaGL::terminate() noexcept { CFRelease(pImpl->mTextureCache); pImpl->mExternalImageSharedGl.reset(); pImpl->mGLContext = nil; + for (auto& context : pImpl->mAdditionalContexts) { + context = nil; + } bluegl::unbind(); } diff --git a/filament/backend/src/opengl/platforms/PlatformCocoaTouchGL.mm b/filament/backend/src/opengl/platforms/PlatformCocoaTouchGL.mm index 0fc33c1369..0d375df103 100644 --- a/filament/backend/src/opengl/platforms/PlatformCocoaTouchGL.mm +++ b/filament/backend/src/opengl/platforms/PlatformCocoaTouchGL.mm @@ -40,6 +40,7 @@ struct PlatformCocoaTouchGLImpl { EAGLContext* mGLContext = nullptr; CAEAGLLayer* mCurrentGlLayer = nullptr; std::vector mHeadlessGlLayers; + std::vector mAdditionalContexts; CGRect mCurrentGlLayerRect; GLuint mDefaultFramebuffer = 0; GLuint mDefaultColorbuffer = 0; @@ -93,6 +94,20 @@ Driver* PlatformCocoaTouchGL::createDriver(void* const sharedGLContext, const Pl return OpenGLPlatform::createDefaultDriver(this, sharedGLContext, driverConfig); } +bool PlatformCocoaTouchGL::isExtraContextSupported() const noexcept { + return true; +} + +void PlatformCocoaTouchGL::createContext(bool shared) { + EAGLSharegroup* const sharegroup = shared ? pImpl->mGLContext.sharegroup : nil; + EAGLContext* const context = [[EAGLContext alloc] + initWithAPI:kEAGLRenderingAPIOpenGLES3 + sharegroup:sharegroup]; + ASSERT_POSTCONDITION(context, "Unable to create extra OpenGL ES context."); + [EAGLContext setCurrentContext:context]; + pImpl->mAdditionalContexts.push_back(context); +} + void PlatformCocoaTouchGL::terminate() noexcept { CFRelease(pImpl->mTextureCache); pImpl->mGLContext = nil; diff --git a/filament/backend/src/opengl/platforms/PlatformEGL.cpp b/filament/backend/src/opengl/platforms/PlatformEGL.cpp index f52cb83c5e..a674bccb80 100644 --- a/filament/backend/src/opengl/platforms/PlatformEGL.cpp +++ b/filament/backend/src/opengl/platforms/PlatformEGL.cpp @@ -27,6 +27,7 @@ #include #include +#include #ifndef EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE # define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE 0x3483 @@ -225,6 +226,8 @@ Driver* PlatformEGL::createDriver(void* sharedContext, const Platform::DriverCon goto error; } + mContextAttribs = std::move(contextAttribs); + initializeGlExtensions(); // this is needed with older emulators/API levels on Android @@ -251,6 +254,26 @@ error: return nullptr; } +bool PlatformEGL::isExtraContextSupported() const noexcept { + return ext.egl.KHR_no_config_context; +} + +void PlatformEGL::createContext(bool shared) { + EGLContext context = eglCreateContext(mEGLDisplay, EGL_NO_CONFIG_KHR, + shared ? mEGLContext : EGL_NO_CONTEXT, mContextAttribs.data()); + + if (UTILS_UNLIKELY(context == EGL_NO_CONTEXT)) { + // eglCreateContext failed + logEglError("eglCreateContext"); + } + + assert_invariant(context != EGL_NO_CONTEXT); + + eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, context); + + mAdditionalContexts.push_back(context); +} + EGLBoolean PlatformEGL::makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) noexcept { if (UTILS_UNLIKELY((drawSurface != mCurrentDrawSurface || readSurface != mCurrentReadSurface))) { mCurrentDrawSurface = drawSurface; @@ -264,6 +287,9 @@ void PlatformEGL::terminate() noexcept { eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroySurface(mEGLDisplay, mEGLDummySurface); eglDestroyContext(mEGLDisplay, mEGLContext); + for (auto context : mAdditionalContexts) { + eglDestroyContext(mEGLDisplay, context); + } eglTerminate(mEGLDisplay); eglReleaseThread(); } @@ -441,7 +467,7 @@ FenceStatus PlatformEGL::waitFence( #ifdef EGL_KHR_reusable_sync EGLSyncKHR sync = (EGLSyncKHR) fence; if (sync != EGL_NO_SYNC_KHR) { - EGLint status = eglClientWaitSyncKHR(mEGLDisplay, sync, 0, (EGLTimeKHR)timeout); + EGLint const status = eglClientWaitSyncKHR(mEGLDisplay, sync, 0, (EGLTimeKHR)timeout); if (status == EGL_CONDITION_SATISFIED_KHR) { return FenceStatus::CONDITION_SATISFIED; } diff --git a/filament/backend/src/opengl/platforms/PlatformWGL.cpp b/filament/backend/src/opengl/platforms/PlatformWGL.cpp index 4ff4a4fc0a..f2943ee091 100644 --- a/filament/backend/src/opengl/platforms/PlatformWGL.cpp +++ b/filament/backend/src/opengl/platforms/PlatformWGL.cpp @@ -74,10 +74,11 @@ struct WGLSwapChain { bool isHeadless = false; }; +static PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs = nullptr; + Driver* PlatformWGL::createDriver(void* const sharedGLContext, const Platform::DriverConfig& driverConfig) noexcept { int result = 0; - PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs = nullptr; int pixelFormat = 0; mPfd = { @@ -123,13 +124,15 @@ Driver* PlatformWGL::createDriver(void* const sharedGLContext, (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB"); // try all versions down, from GL 4.5 to 4.1 + + for (int minor = 5; minor >= 1; minor--) { - int const attribs[] = { + mAttribs = { WGL_CONTEXT_MAJOR_VERSION_ARB, 4, WGL_CONTEXT_MINOR_VERSION_ARB, minor, 0 }; - mContext = wglCreateContextAttribs(whdc, (HGLRC)sharedGLContext, attribs); + mContext = wglCreateContextAttribs(whdc, (HGLRC)sharedGLContext, mAttribs.data()); if (mContext) { break; } @@ -164,12 +167,25 @@ error: return NULL; } +bool PlatformWGL::isExtraContextSupported() const noexcept { + return true; +} + +void PlatformWGL::createContext(bool shared) { + HGLRC context = wglCreateContextAttribs(mWhdc, shared ? mContext : nullptr, mAttribs.data()); + wglMakeCurrent(mWhdc, context); + mAdditionalContexts.push_back(context); +} + void PlatformWGL::terminate() noexcept { wglMakeCurrent(NULL, NULL); if (mContext) { wglDeleteContext(mContext); mContext = NULL; } + for (auto& context : mAdditionalContexts) { + wglDeleteContext(mContext); + } if (mHWnd && mWhdc) { ReleaseDC(mHWnd, mWhdc); DestroyWindow(mHWnd); diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 132609672c..b37a15117f 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -980,7 +980,9 @@ void VulkanDriver::updateSamplerGroup(Handle sbh, void VulkanDriver::compilePrograms(CallbackHandler* handler, CallbackHandler::Callback callback, void* user) { - scheduleCallback(handler, user, callback); + if (callback) { + scheduleCallback(handler, user, callback); + } } void VulkanDriver::beginRenderPass(Handle rth, const RenderPassParams& params) { diff --git a/filament/include/filament/Material.h b/filament/include/filament/Material.h index 1262059ca0..5b9314a042 100644 --- a/filament/include/filament/Material.h +++ b/filament/include/filament/Material.h @@ -152,11 +152,13 @@ public: friend class FMaterial; }; + using CompilerPriorityQueue = backend:: CompilerPriorityQueue; + /** * Asynchronously ensures that a subset of this Material's variants are compiled. After issuing * several Material::compile() calls in a row, it is recommended to call Engine::flush() * such that the backend can start the compilation work as soon as possible. - * The provided callback is guaranteed to be called on the main thread after all unfiltered + * The provided callback is guaranteed to be called on the main thread after all specified * variants of the material are compiled. This can take hundreds of milliseconds. * * If all the material's variants are already compiled, the callback will be scheduled as @@ -164,14 +166,31 @@ public: * many previous frames are enqueued in the backend. This also varies by backend. Therefore, * it is recommended to only call this method once per material shortly after creation. * - * @param handler Handler to dispatch the callback or nullptr for the default handler - * @param callback callback called on the main thread when the compilation is done on - * by backend. - * @param variantFilter Variants to filter-out from the compile command. + * @param priority Which priority queue to use, LOW or HIGH. + * @param variants Variants to include to the compile command. + * @param handler Handler to dispatch the callback or nullptr for the default handler + * @param callback callback called on the main thread when the compilation is done on + * by backend. */ - void compile(backend::CallbackHandler* handler, - utils::Invocable&& callback, - UserVariantFilterMask variantFilter) noexcept; + void compile(CompilerPriorityQueue priority, + UserVariantFilterMask variants, + backend::CallbackHandler* handler = nullptr, + utils::Invocable&& callback = {}) noexcept; + + inline void compile(CompilerPriorityQueue priority, + UserVariantFilterBit variants, + backend::CallbackHandler* handler = nullptr, + utils::Invocable&& callback = {}) noexcept { + compile(priority, UserVariantFilterMask(variants), handler, + std::forward>(callback)); + } + + inline void compile(CompilerPriorityQueue priority, + backend::CallbackHandler* handler = nullptr, + utils::Invocable&& callback = {}) noexcept { + compile(priority, UserVariantFilterBit::ALL, handler, + std::forward>(callback)); + } /** * Creates a new instance of this material. Material instances should be freed using diff --git a/filament/src/Material.cpp b/filament/src/Material.cpp index 19568947e9..fc4e198f4d 100644 --- a/filament/src/Material.cpp +++ b/filament/src/Material.cpp @@ -136,10 +136,10 @@ MaterialInstance const* Material::getDefaultInstance() const noexcept { return downcast(this)->getDefaultInstance(); } -void Material::compile(backend::CallbackHandler* handler, - utils::Invocable&& callback, - UserVariantFilterMask variantFilter) noexcept { - downcast(this)->compile(handler, std::move(callback), variantFilter); +void Material::compile(CompilerPriorityQueue priority, UserVariantFilterMask variantFilter, + backend::CallbackHandler* handler, utils::Invocable&& callback) noexcept { + downcast(this)->compile(priority, variantFilter, handler, std::move(callback)); } + } // namespace filament diff --git a/filament/src/MaterialParser.h b/filament/src/MaterialParser.h index 74dd59294d..61c8932249 100644 --- a/filament/src/MaterialParser.h +++ b/filament/src/MaterialParser.h @@ -117,7 +117,14 @@ public: bool getShader(filaflat::ShaderContent& shader, backend::ShaderModel shaderModel, Variant variant, backend::ShaderStage stage) noexcept; - filaflat::MaterialChunk const& getMaterialChunk() const noexcept { return mImpl.mMaterialChunk; } + bool hasShader(backend::ShaderModel model, + Variant variant, backend::ShaderStage stage) const noexcept { + return getMaterialChunk().hasShader(model, variant, stage); + } + + filaflat::MaterialChunk const& getMaterialChunk() const noexcept { + return mImpl.mMaterialChunk; + } private: struct MaterialParserDetails { diff --git a/filament/src/PostProcessManager.cpp b/filament/src/PostProcessManager.cpp index 92dba087e3..f2664d4502 100644 --- a/filament/src/PostProcessManager.cpp +++ b/filament/src/PostProcessManager.cpp @@ -2213,8 +2213,10 @@ void PostProcessManager::colorGradingPrepareSubpass(DriverApi& driver, mi->commit(driver); // load both variants - material.getMaterial(mEngine)->prepareProgram(Variant{Variant::type_t(PostProcessVariant::TRANSLUCENT)}); - material.getMaterial(mEngine)->prepareProgram(Variant{Variant::type_t(PostProcessVariant::OPAQUE)}); + material.getMaterial(mEngine)->prepareProgram( + Variant{ Variant::type_t(PostProcessVariant::TRANSLUCENT) }); + material.getMaterial(mEngine)->prepareProgram( + Variant{ Variant::type_t(PostProcessVariant::OPAQUE) }); } void PostProcessManager::colorGradingSubpass(DriverApi& driver, diff --git a/filament/src/details/Material.cpp b/filament/src/details/Material.cpp index 98b8b655d0..8b9b67412a 100644 --- a/filament/src/details/Material.cpp +++ b/filament/src/details/Material.cpp @@ -403,7 +403,7 @@ FMaterial::FMaterial(FEngine& engine, const Material::Builder& builder) filaflat::MaterialChunk const& materialChunk{ mMaterialParser->getMaterialChunk() }; auto variants = FixedCapacityVector::with_capacity(materialChunk.getShaderCount()); materialChunk.visitShaders([&variants]( - ShaderModel model, Variant variant, ShaderStage stage) { + ShaderModel, Variant variant, ShaderStage) { if (Variant::isValidDepthVariant(variant)) { variants.push_back(variant); } @@ -418,7 +418,7 @@ FMaterial::FMaterial(FEngine& engine, const Material::Builder& builder) if (UTILS_UNLIKELY(!mIsDefaultMaterial && !mHasCustomDepthShader)) { FMaterial const* const pDefaultMaterial = engine.getDefaultMaterial(); auto& cachedPrograms = mCachedPrograms; - for (Variant variant : pDefaultMaterial->mDepthVariants) { + for (Variant const variant : pDefaultMaterial->mDepthVariants) { pDefaultMaterial->prepareProgram(variant); cachedPrograms[variant.key] = pDefaultMaterial->getProgram(variant); } @@ -467,31 +467,39 @@ void FMaterial::terminate(FEngine& engine) { mDefaultInstance.terminate(engine); } -void FMaterial::compile(backend::CallbackHandler* handler, - utils::Invocable&& callback, - UserVariantFilterMask variantFilter) noexcept { +void FMaterial::compile(CompilerPriorityQueue priority, + UserVariantFilterMask variantSpec, + backend::CallbackHandler* handler, + utils::Invocable&& callback) noexcept { + + UserVariantFilterMask const variantFilter = + ~variantSpec & UserVariantFilterMask(UserVariantFilterBit::ALL); + auto const& variants = isVariantLit() ? VariantUtils::getLitVariants() : VariantUtils::getUnlitVariants(); for (auto const variant : variants) { if (!variantFilter || variant == Variant::filterUserVariant(variant, variantFilter)) { if (hasVariant(variant)) { - prepareProgram(variant); + prepareProgram(variant, priority); } } } - struct Callback { - Invocable f; - Material* m; - static void func(void* user) { - auto* const c = reinterpret_cast(user); - c->f(c->m); - delete c; - } - }; - - auto* const user = new Callback{ std::move(callback), this }; - mEngine.getDriverApi().compilePrograms(handler, &Callback::func, static_cast(user)); + if (callback) { + struct Callback { + Invocable f; + Material* m; + static void func(void* user) { + auto* const c = reinterpret_cast(user); + c->f(c->m); + delete c; + } + }; + auto* const user = new(std::nothrow) Callback{ std::move(callback), this }; + mEngine.getDriverApi().compilePrograms(handler, &Callback::func, static_cast(user)); + } else { + mEngine.getDriverApi().compilePrograms(nullptr, nullptr, nullptr); + } } FMaterialInstance* FMaterial::createInstance(const char* name) const noexcept { @@ -527,25 +535,25 @@ bool FMaterial::hasVariant(Variant variant) const noexcept { // TODO: implement MaterialDomain::COMPUTE return false; } - ShaderContent& vsBuilder = mEngine.getVertexShaderContent(); const ShaderModel sm = mEngine.getShaderModel(); - if (!mMaterialParser->getShader(vsBuilder, sm, vertexVariant, ShaderStage::VERTEX)) { + if (!mMaterialParser->hasShader(sm, vertexVariant, ShaderStage::VERTEX)) { return false; } - if (!mMaterialParser->getShader(vsBuilder, sm, fragmentVariant, ShaderStage::FRAGMENT)) { + if (!mMaterialParser->hasShader(sm, fragmentVariant, ShaderStage::FRAGMENT)) { return false; } return true; } -void FMaterial::prepareProgramSlow(Variant variant) const noexcept { +void FMaterial::prepareProgramSlow(Variant variant, + backend::CompilerPriorityQueue priorityQueue) const noexcept { assert_invariant(mEngine.hasFeatureLevel(mFeatureLevel)); switch (getMaterialDomain()) { case MaterialDomain::SURFACE: - getSurfaceProgramSlow(variant); + getSurfaceProgramSlow(variant, priorityQueue); break; case MaterialDomain::POST_PROCESS: - getPostProcessProgramSlow(variant); + getPostProcessProgramSlow(variant, priorityQueue); break; case MaterialDomain::COMPUTE: // TODO: implement MaterialDomain::COMPUTE @@ -553,7 +561,8 @@ void FMaterial::prepareProgramSlow(Variant variant) const noexcept { } } -void FMaterial::getSurfaceProgramSlow(Variant variant) const noexcept { +void FMaterial::getSurfaceProgramSlow(Variant variant, + CompilerPriorityQueue priorityQueue) const noexcept { // filterVariant() has already been applied in generateCommands(), shouldn't be needed here // if we're unlit, we don't have any bits that correspond to lit materials assert_invariant(variant == Variant::filterVariant(variant, isVariantLit()) ); @@ -564,11 +573,14 @@ void FMaterial::getSurfaceProgramSlow(Variant variant) const noexcept { Variant const fragmentVariant = Variant::filterVariantFragment(variant); Program pb{ getProgramWithVariants(variant, vertexVariant, fragmentVariant) }; + pb.priorityQueue(priorityQueue); createAndCacheProgram(std::move(pb), variant); } -void FMaterial::getPostProcessProgramSlow(Variant variant) const noexcept { +void FMaterial::getPostProcessProgramSlow(Variant variant, + CompilerPriorityQueue priorityQueue) const noexcept { Program pb{ getProgramWithVariants(variant, variant, variant) }; + pb.priorityQueue(priorityQueue); createAndCacheProgram(std::move(pb), variant); } diff --git a/filament/src/details/Material.h b/filament/src/details/Material.h index cf1bf9fe84..a537224906 100644 --- a/filament/src/details/Material.h +++ b/filament/src/details/Material.h @@ -63,9 +63,10 @@ public: return mSamplerInterfaceBlock; } - void compile(backend::CallbackHandler* handler, - utils::Invocable&& callback, - UserVariantFilterMask variantFilter) noexcept; + void compile(CompilerPriorityQueue priority, + UserVariantFilterMask variantFilter, + backend::CallbackHandler* handler, + utils::Invocable&& callback) noexcept; // Create an instance of this material FMaterialInstance* createInstance(const char* name) const noexcept; @@ -88,10 +89,11 @@ public: // prepareProgram creates the program for the material's given variant at the backend level. // Must be called outside of backend render pass. // Must be called before getProgram() below. - void prepareProgram(Variant variant) const noexcept { + void prepareProgram(Variant variant, + backend::CompilerPriorityQueue priorityQueue = CompilerPriorityQueue::HIGH) const noexcept { // prepareProgram() is called for each RenderPrimitive in the scene, so it must be efficient. if (UTILS_UNLIKELY(!isCached(variant))) { - prepareProgramSlow(variant); + prepareProgramSlow(variant, priorityQueue); } } @@ -191,15 +193,16 @@ public: private: bool hasVariant(Variant variant) const noexcept; - void prepareProgramSlow(Variant variant) const noexcept; - void getSurfaceProgramSlow(Variant variant) const noexcept; - void getPostProcessProgramSlow(Variant variant) const noexcept; - backend::Program getProgramWithVariants(Variant variant, Variant vertexVariant, - Variant fragmentVariant) const noexcept; + void prepareProgramSlow(Variant variant, + CompilerPriorityQueue priorityQueue) const noexcept; + void getSurfaceProgramSlow(Variant variant, + CompilerPriorityQueue priorityQueue) const noexcept; + void getPostProcessProgramSlow(Variant variant, + CompilerPriorityQueue priorityQueue) const noexcept; + backend::Program getProgramWithVariants(Variant variant, + Variant vertexVariant, Variant fragmentVariant) const noexcept; - - void createAndCacheProgram(backend::Program&& p, - Variant variant) const noexcept; + void createAndCacheProgram(backend::Program&& p, Variant variant) const noexcept; // try to order by frequency of use mutable std::array, VARIANT_COUNT> mCachedPrograms; diff --git a/filament/src/details/Renderer.cpp b/filament/src/details/Renderer.cpp index 89f2b0b0f4..ec09b44bc4 100644 --- a/filament/src/details/Renderer.cpp +++ b/filament/src/details/Renderer.cpp @@ -227,7 +227,8 @@ bool FRenderer::beginFrame(FSwapChain* swapChain, uint64_t vsyncSteadyClockTimeN // NOTE: this makes synchronous calls to the driver driver.updateStreams(&driver); - // gives the backend a chance to execute periodic tasks + // Gives the backend a chance to execute periodic tasks. This must be called before + // the frame skipper. driver.tick(); /* diff --git a/libs/filabridge/include/filament/MaterialEnums.h b/libs/filabridge/include/filament/MaterialEnums.h index 7dfb48dd45..f87a8ef6bc 100644 --- a/libs/filabridge/include/filament/MaterialEnums.h +++ b/libs/filabridge/include/filament/MaterialEnums.h @@ -20,6 +20,7 @@ #define TNT_FILAMENT_MATERIAL_ENUM_H #include +#include #include #include @@ -232,7 +233,9 @@ enum class Property : uint8_t { // when adding new Properties, make sure to update MATERIAL_PROPERTIES_COUNT }; -enum class UserVariantFilterBit : uint32_t { +using UserVariantFilterMask = uint32_t; + +enum class UserVariantFilterBit : UserVariantFilterMask { DIRECTIONAL_LIGHTING = 0x01, DYNAMIC_LIGHTING = 0x02, SHADOW_RECEIVER = 0x04, @@ -240,10 +243,12 @@ enum class UserVariantFilterBit : uint32_t { FOG = 0x10, VSM = 0x20, SSR = 0x40, + ALL = 0x7F, }; -using UserVariantFilterMask = uint32_t; - } // namespace filament +template<> struct utils::EnableBitMaskOperators + : public std::true_type {}; + #endif diff --git a/libs/filaflat/include/filaflat/MaterialChunk.h b/libs/filaflat/include/filaflat/MaterialChunk.h index aa15fa5b2f..2b7ceda7fa 100644 --- a/libs/filaflat/include/filaflat/MaterialChunk.h +++ b/libs/filaflat/include/filaflat/MaterialChunk.h @@ -54,6 +54,8 @@ public: void visitShaders(utils::Invocable&& visitor) const; + bool hasShader(ShaderModel model, Variant variant, ShaderStage stage) const noexcept; + // These methods are for debugging purposes only (matdbg) // @{ static void decodeKey(uint32_t key, diff --git a/libs/filaflat/src/MaterialChunk.cpp b/libs/filaflat/src/MaterialChunk.cpp index 2d73970f5c..2cedfbf117 100644 --- a/libs/filaflat/src/MaterialChunk.cpp +++ b/libs/filaflat/src/MaterialChunk.cpp @@ -170,6 +170,14 @@ bool MaterialChunk::getSpirvShader(BlobDictionary const& dictionary, return true; } +bool MaterialChunk::hasShader(ShaderModel model, Variant variant, ShaderStage stage) const noexcept { + if (mBase == nullptr) { + return false; + } + auto pos = mOffsets.find(makeKey(model, variant, stage)); + return pos != mOffsets.end(); +} + bool MaterialChunk::getShader(ShaderContent& shaderContent, BlobDictionary const& dictionary, ShaderModel shaderModel, filament::Variant variant, ShaderStage stage) { switch (mMaterialTag) { diff --git a/libs/gltfio/src/ArchiveCache.cpp b/libs/gltfio/src/ArchiveCache.cpp index 152b0fc94c..07a08e428b 100644 --- a/libs/gltfio/src/ArchiveCache.cpp +++ b/libs/gltfio/src/ArchiveCache.cpp @@ -119,6 +119,16 @@ Material* ArchiveCache::getMaterial(const ArchiveRequirements& reqs) { .package(spec.package, spec.packageByteCount) .build(mEngine); } + + // compile everything at low priority + mMaterials[i]->compile(Material::CompilerPriorityQueue::LOW); + + // promote variants we care about to high priority + mMaterials[i]->compile(Material::CompilerPriorityQueue::HIGH, + UserVariantFilterBit::DIRECTIONAL_LIGHTING | + UserVariantFilterBit::DYNAMIC_LIGHTING | + UserVariantFilterBit::SHADOW_RECEIVER); + return mMaterials[i]; } } diff --git a/libs/utils/include/utils/BitmaskEnum.h b/libs/utils/include/utils/BitmaskEnum.h index 1efa394195..56354956c5 100644 --- a/libs/utils/include/utils/BitmaskEnum.h +++ b/libs/utils/include/utils/BitmaskEnum.h @@ -141,5 +141,4 @@ inline constexpr bool any(Enum lhs) noexcept { return !none(lhs); } - #endif // TNT_UTILS_BITMASKENUM_H From b8b1fadfa196f08388ac9d9e7765d84292abf8b9 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Wed, 14 Jun 2023 22:17:10 -0700 Subject: [PATCH 13/22] vulkan: fix timer query (#6905) - Timer query stashed a pointer to VulkanCommandBuffer, but this points to an object that can be reused. - We use the shared_ptr'd fence object instead to track whether the query request has been completed. --- filament/backend/src/vulkan/VulkanContext.cpp | 4 ++-- filament/backend/src/vulkan/VulkanHandles.cpp | 13 +++++++++---- filament/backend/src/vulkan/VulkanHandles.h | 4 +--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanContext.cpp b/filament/backend/src/vulkan/VulkanContext.cpp index 5dba7d7123..14726274b9 100644 --- a/filament/backend/src/vulkan/VulkanContext.cpp +++ b/filament/backend/src/vulkan/VulkanContext.cpp @@ -118,8 +118,8 @@ void VulkanTimestamps::beginQuery(VulkanCommandBuffer const* commands, vkCmdResetQueryPool(commands->cmdbuffer, mPool, index, 2); vkCmdWriteTimestamp(commands->cmdbuffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, mPool, index); - // We stash this because getResult might come before beginquery. - query->cmdbuffer.store(commands); + // We stash this because getResult might come before the query is actually processed. + query->fence = commands->fence; } void VulkanTimestamps::endQuery(VulkanCommandBuffer const* commands, diff --git a/filament/backend/src/vulkan/VulkanHandles.cpp b/filament/backend/src/vulkan/VulkanHandles.cpp index e68183d068..af8a5ce69a 100644 --- a/filament/backend/src/vulkan/VulkanHandles.cpp +++ b/filament/backend/src/vulkan/VulkanHandles.cpp @@ -305,11 +305,16 @@ bool VulkanTimerQuery::isCompleted() const noexcept { // into the command buffer, which is an error according to the validation layer that ships in // the Android NDK. Even when AVAILABILITY_BIT is set, validation seems to require that the // timestamp has at least been written into a processed command buffer. - VulkanCommandBuffer const* cmdbuf = cmdbuffer.load(); - if (!cmdbuf || !cmdbuf->fence) { return false; } - VkResult status = cmdbuf->fence->status.load(std::memory_order_relaxed); - if (status != VK_SUCCESS) { return false; } + // This fence indicates that the corresponding buffer has been completed. + if (!fence) { + return false; + } + + VkResult status = fence->status.load(std::memory_order_relaxed); + if (status != VK_SUCCESS) { + return false; + } return true; } diff --git a/filament/backend/src/vulkan/VulkanHandles.h b/filament/backend/src/vulkan/VulkanHandles.h index 751c4a2c91..e7ae830c51 100644 --- a/filament/backend/src/vulkan/VulkanHandles.h +++ b/filament/backend/src/vulkan/VulkanHandles.h @@ -147,9 +147,7 @@ private: uint32_t startingQueryIndex; uint32_t stoppingQueryIndex; - // TODO: should be safe to hold this reference (since VulkanCommanBuffers is a ring). - // But explore better options. - std::atomic cmdbuffer = nullptr; + std::shared_ptr fence; friend class VulkanTimestamps; }; From 432b5d0427bea5de663fa0e5d2df7bf7dda28417 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Thu, 15 Jun 2023 09:20:08 -0700 Subject: [PATCH 14/22] vulkan: fix taa validations (#6903) - Validation failing due to incorrect layout wrt Blitter render pass. - Clear colors are also not needed for blitter renderpass. - SAMPLEABLE + DEPTH_ATTACHMENT needs to have the correct layout. --- filament/backend/src/vulkan/VulkanBlitter.cpp | 41 +++++++++++-------- filament/backend/src/vulkan/VulkanBlitter.h | 5 +-- filament/backend/src/vulkan/VulkanDriver.cpp | 2 +- filament/backend/src/vulkan/VulkanHandles.cpp | 5 +-- .../backend/src/vulkan/VulkanImageUtility.h | 20 ++++++++- filament/backend/src/vulkan/VulkanTexture.cpp | 8 +++- 6 files changed, 55 insertions(+), 26 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanBlitter.cpp b/filament/backend/src/vulkan/VulkanBlitter.cpp index a67c75a86c..23e80821fb 100644 --- a/filament/backend/src/vulkan/VulkanBlitter.cpp +++ b/filament/backend/src/vulkan/VulkanBlitter.cpp @@ -171,7 +171,7 @@ void VulkanBlitter::blitDepth(BlitArgs args) { assert_invariant(src.texture && dst.texture); if (src.texture->samples > 1 && dst.texture->samples == 1) { - blitSlowDepth(aspect, args.filter, args.srcTarget->getExtent(), src, dst, args.srcRectPair, + blitSlowDepth(args.filter, args.srcTarget->getExtent(), src, dst, args.srcRectPair, args.dstRectPair); return; } @@ -259,27 +259,30 @@ void VulkanBlitter::lazyInit() noexcept { // 2. Begin render pass // 3. Draw a big triangle // 4. End render pass. -void VulkanBlitter::blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter, - const VkExtent2D srcExtent, VulkanAttachment src, VulkanAttachment dst, - const VkOffset3D srcRect[2], const VkOffset3D dstRect[2]) { +void VulkanBlitter::blitSlowDepth(VkFilter filter, const VkExtent2D srcExtent, VulkanAttachment src, + VulkanAttachment dst, const VkOffset3D srcRect[2], const VkOffset3D dstRect[2]) { lazyInit(); - const BlitterUniforms uniforms = { + BlitterUniforms const uniforms = { .sampleCount = src.texture->samples, .inverseSampleCount = 1.0f / float(src.texture->samples), }; mParamsBuffer->loadFromCpu(&uniforms, 0, sizeof(uniforms)); + VkImageAspectFlags const aspect = VK_IMAGE_ASPECT_DEPTH_BIT; + + // We will transition the src into sampler layout and also keep it in sampler layout for + // consistency. + VulkanLayout const samplerLayout = VulkanLayout::DEPTH_SAMPLER; + // BEGIN RENDER PASS // ----------------- - VulkanLayout const layout = VulkanLayout::DEPTH_ATTACHMENT; - const VulkanFboCache::RenderPassKey rpkey = { .initialColorLayoutMask = 0, .initialDepthLayout = VulkanLayout::UNDEFINED, - .renderPassDepthLayout = layout, - .finalDepthLayout = layout, + .renderPassDepthLayout = samplerLayout, + .finalDepthLayout = samplerLayout, .depthFormat = dst.getFormat(), .clear = {}, .discardStart = TargetBufferFlags::DEPTH, @@ -297,7 +300,7 @@ void VulkanBlitter::blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter, .samples = rpkey.samples, .color = {}, .resolve = {}, - .depth = dst.getImageView(VK_IMAGE_ASPECT_DEPTH_BIT), + .depth = dst.getImageView(aspect), }; const VkFramebuffer vkfb = mFramebufferCache.getFramebuffer(fbkey); @@ -311,12 +314,18 @@ void VulkanBlitter::blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter, renderPassInfo.renderArea.extent.width = dstRect[1].x - dstRect[0].x; renderPassInfo.renderArea.extent.height = dstRect[1].y - dstRect[0].y; - // Even though we don't clear anything, we have to provide a clear value. - VkClearValue clearValues[1] = {}; - renderPassInfo.clearValueCount = 1; - renderPassInfo.pClearValues = clearValues; - const VkCommandBuffer cmdbuffer = mCommands->get().cmdbuffer; + + // We need to transition the source into a sampler since it'll be sampled in the shader. + const VkImageSubresourceRange srcRange = { + .aspectMask = aspect, + .baseMipLevel = src.level, + .levelCount = 1, + .baseArrayLayer = src.layer, + .layerCount = 1, + }; + src.texture->transitionLayout(cmdbuffer, srcRange, samplerLayout); + vkCmdBeginRenderPass(cmdbuffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE); VkViewport viewport = { @@ -378,7 +387,7 @@ void VulkanBlitter::blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter, samplers[0] = { .sampler = vksampler, .imageView = src.getImageView(VK_IMAGE_ASPECT_DEPTH_BIT), - .imageLayout = ImgUtil::getVkLayout(VulkanLayout::DEPTH_ATTACHMENT), + .imageLayout = ImgUtil::getVkLayout(samplerLayout), }; mPipelineCache.bindSamplers(samplers, diff --git a/filament/backend/src/vulkan/VulkanBlitter.h b/filament/backend/src/vulkan/VulkanBlitter.h index 2c2b70bc68..2a53d286f5 100644 --- a/filament/backend/src/vulkan/VulkanBlitter.h +++ b/filament/backend/src/vulkan/VulkanBlitter.h @@ -55,9 +55,8 @@ public: private: void lazyInit() noexcept; - void blitSlowDepth(VkImageAspectFlags aspect, VkFilter filter, const VkExtent2D srcExtent, - VulkanAttachment src, VulkanAttachment dst, const VkOffset3D srcRect[2], - const VkOffset3D dstRect[2]); + void blitSlowDepth(VkFilter filter, const VkExtent2D srcExtent, VulkanAttachment src, + VulkanAttachment dst, const VkOffset3D srcRect[2], const VkOffset3D dstRect[2]); VulkanBuffer* mTriangleBuffer = nullptr; VulkanBuffer* mParamsBuffer = nullptr; diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index b37a15117f..5598ef7b79 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -1181,7 +1181,7 @@ void VulkanDriver::beginRenderPass(Handle rth, const RenderPassP VkClearValue clearValues[ MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 1] = {}; - if (params.flags.clear != TargetBufferFlags::NONE) { + if (clearVal != TargetBufferFlags::NONE) { // NOTE: clearValues must be populated in the same order as the attachments array in // VulkanFboCache::getFramebuffer. Values must be provided regardless of whether Vulkan is diff --git a/filament/backend/src/vulkan/VulkanHandles.cpp b/filament/backend/src/vulkan/VulkanHandles.cpp index af8a5ce69a..53bd59baef 100644 --- a/filament/backend/src/vulkan/VulkanHandles.cpp +++ b/filament/backend/src/vulkan/VulkanHandles.cpp @@ -108,9 +108,8 @@ VulkanProgram::VulkanProgram(VkDevice device, const Program& builder) noexcept : // Make a copy of the binding map samplerGroupInfo = builder.getSamplerGroupInfo(); if constexpr (FILAMENT_VULKAN_VERBOSE) { - utils::slog.d << "Created VulkanProgram " << builder - << ", shaders = (" << bundle.vertex << ", " << bundle.fragment << ")" - << utils::io::endl; + utils::slog.d << "Created VulkanProgram " << builder << ", shaders = (" << bundle.vertex + << ", " << bundle.fragment << ")" << utils::io::endl; } } diff --git a/filament/backend/src/vulkan/VulkanImageUtility.h b/filament/backend/src/vulkan/VulkanImageUtility.h index 9ec4188db1..efb3506471 100644 --- a/filament/backend/src/vulkan/VulkanImageUtility.h +++ b/filament/backend/src/vulkan/VulkanImageUtility.h @@ -65,7 +65,11 @@ public: inline static VulkanLayout getDefaultLayout(TextureUsage usage) { if (any(usage & TextureUsage::DEPTH_ATTACHMENT)) { - return VulkanLayout::DEPTH_ATTACHMENT; + if (any(usage & TextureUsage::SAMPLEABLE)) { + return VulkanLayout::DEPTH_SAMPLER; + } else { + return VulkanLayout::DEPTH_ATTACHMENT; + } } if (any(usage & TextureUsage::COLOR_ATTACHMENT)) { @@ -75,6 +79,20 @@ public: return VulkanLayout::READ_ONLY; } + inline static VulkanLayout getDefaultLayout(VkImageUsageFlags vkusage) { + TextureUsage usage {}; + if (vkusage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) { + usage = usage | TextureUsage::DEPTH_ATTACHMENT; + } + if (vkusage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { + usage = usage | TextureUsage::COLOR_ATTACHMENT; + } + if (vkusage & VK_IMAGE_USAGE_SAMPLED_BIT) { + usage = usage | TextureUsage::SAMPLEABLE; + } + return getDefaultLayout(usage); + } + static VkImageLayout getVkLayout(VulkanLayout layout); static void transitionLayout(VkCommandBuffer cmdbuffer, VulkanLayoutTransition transition); diff --git a/filament/backend/src/vulkan/VulkanTexture.cpp b/filament/backend/src/vulkan/VulkanTexture.cpp index 98ec6d739f..6b86def4e8 100644 --- a/filament/backend/src/vulkan/VulkanTexture.cpp +++ b/filament/backend/src/vulkan/VulkanTexture.cpp @@ -154,10 +154,12 @@ VulkanTexture::VulkanTexture(VkDevice device, VkPhysicalDevice physicalDevice, << "handle = " << utils::io::hex << mTextureImage << utils::io::dec << ", " << "extent = " << w << "x" << h << "x"<< depth << ", " << "mipLevels = " << int(levels) << ", " + << "TextureUsage = " << static_cast(usage) << ", " << "usage = " << imageInfo.usage << ", " << "samples = " << imageInfo.samples << ", " << "type = " << imageInfo.imageType << ", " << "flags = " << imageInfo.flags << ", " + << "target = " << static_cast(target) <<", " << "format = " << mVkFormat << utils::io::endl; } ASSERT_POSTCONDITION(!error, "Unable to create image."); @@ -199,11 +201,13 @@ VulkanTexture::VulkanTexture(VkDevice device, VkPhysicalDevice physicalDevice, // Transition the layout of each image slice that might be used as a render target. // We do not transition images that are merely SAMPLEABLE, this is deferred until upload time // because we do not know how many layers and levels will actually be used. - if (any(usage & (TextureUsage::COLOR_ATTACHMENT | TextureUsage::DEPTH_ATTACHMENT))) { + if (imageInfo.usage + & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT + | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) { const uint32_t layers = mPrimaryViewRange.layerCount; VkImageSubresourceRange range = { getImageAspect(), 0, levels, 0, layers }; VkCommandBuffer cmdbuf = mCommands->get().cmdbuffer; - transitionLayout(cmdbuf, range, ImgUtil::getDefaultLayout(usage)); + transitionLayout(cmdbuf, range, ImgUtil::getDefaultLayout(imageInfo.usage)); } } From 5c11b237f3dc8a3d2a6e3671dd89e89dd75ddfe7 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Thu, 15 Jun 2023 11:27:48 -0700 Subject: [PATCH 15/22] vulkan: address debugUtils bug (#6904) vkCmdEndDebugUtilsLabelEXT expects that a label was "pushed" onto the command queue (as described in the spec). It is possible to push labels across command buffers, but the pushed label must still be in the queue (unexecuted) when End is called. This implies that we need to make sure the labels are in a good state (all popped) when vkQueueSubmit is called. - We add a stack to carry the labels across vkQueueSubmit. - Also add CPU time durations between push and pop to provide rough CPU execution times (in debug). - Add systrace markers for Android systrace --- .../backend/src/vulkan/VulkanCommands.cpp | 160 +++++++++++++++++- filament/backend/src/vulkan/VulkanCommands.h | 45 ++++- filament/backend/src/vulkan/VulkanContext.cpp | 2 + filament/backend/src/vulkan/VulkanContext.h | 2 +- filament/backend/src/vulkan/VulkanDriver.cpp | 101 +++-------- filament/backend/src/vulkan/VulkanDriver.h | 1 - 6 files changed, 226 insertions(+), 85 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanCommands.cpp b/filament/backend/src/vulkan/VulkanCommands.cpp index abd1b5612d..324de0ae0d 100644 --- a/filament/backend/src/vulkan/VulkanCommands.cpp +++ b/filament/backend/src/vulkan/VulkanCommands.cpp @@ -22,6 +22,8 @@ #include "VulkanCommands.h" #include "VulkanConstants.h" +#include "VulkanContext.h" +#include "VulkanDriver.h" #include #include @@ -32,6 +34,8 @@ using namespace utils; namespace filament::backend { +using Timestamp = VulkanGroupMarkers::Timestamp; + VulkanCmdFence::VulkanCmdFence(VkDevice device, bool signaled) : device(device) { VkFenceCreateInfo fenceCreateInfo { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; if (signaled) { @@ -64,10 +68,51 @@ static VkCommandPool createPool(VkDevice device, uint32_t queueFamilyIndex) { } -VulkanCommands::VulkanCommands(VkDevice device, VkQueue queue, uint32_t queueFamilyIndex) : mDevice(device), - mQueue(queue), mPool(createPool(mDevice, queueFamilyIndex)) { - VkSemaphoreCreateInfo sci { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO }; - for (auto& semaphore : mSubmissionSignals) { +void VulkanGroupMarkers::push(std::string const& marker, Timestamp start) noexcept { + mMarkers.push(marker); +#if FILAMENT_VULKAN_VERBOSE + mTimestamps.push(start.time_since_epoch().count() > 0.0 + ? start + : std::chrono::high_resolution_clock::now()); +#endif +} + +std::pair VulkanGroupMarkers::pop() noexcept { + auto const marker = mMarkers.top(); + mMarkers.pop(); + +#if FILAMENT_VULKAN_VERBOSE + auto const topTimestamp = mTimestamps.top(); + mTimestamps.pop(); + return std::make_pair(marker, topTimestamp); +#else + return std::make_pair(marker, Timestamp{}); +#endif +} + +std::pair VulkanGroupMarkers::top() const { + assert_invariant(!empty()); + auto const marker = mMarkers.top(); +#if FILAMENT_VULKAN_VERBOSE + auto const topTimestamp = mTimestamps.top(); + return std::make_pair(marker, topTimestamp); +#else + return std::make_pair(marker, Timestamp{}); +#endif +} + +bool VulkanGroupMarkers::empty() const noexcept { + return mMarkers.empty(); +} + +VulkanCommands::VulkanCommands(VkDevice device, VkQueue queue, uint32_t queueFamilyIndex, + VulkanContext* context) + : mDevice(device), + mQueue(queue), + mPool(createPool(mDevice, queueFamilyIndex)), + mContext(context) { + VkSemaphoreCreateInfo sci{.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; + for (auto& semaphore: mSubmissionSignals) { vkCreateSemaphore(mDevice, &sci, nullptr, &semaphore); } } @@ -139,6 +184,13 @@ VulkanCommandBuffer const& VulkanCommands::get(bool blockOnGC) { mObserver->onCommandBuffer(*mCurrent); } + // We push the current markers onto a temporary stack. This must be placed after mCurrent is set + // to the new command buffer since pushGroupMarker also calls get(). + while (mCarriedOverMarkers && !mCarriedOverMarkers->empty()) { + auto [marker, time] = mCarriedOverMarkers->pop(); + pushGroupMarker(marker.c_str(), time); + } + return *mCurrent; } @@ -195,6 +247,17 @@ bool VulkanCommands::flush() { << io::endl; } + // Before actually submitting, we need to pop any leftover group markers. + while (mGroupMarkers && !mGroupMarkers->empty()) { + if (!mCarriedOverMarkers) { + mCarriedOverMarkers = std::make_unique(); + } + auto const [marker, time] = mGroupMarkers->top(); + mCarriedOverMarkers->push(marker, time); + // We still need to call through to vkCmdEndDebugUtilsLabelEXT. + popGroupMarker(); + } + auto& cmdfence = mCurrent->fence; std::unique_lock lock(cmdfence->mutex); cmdfence->status.store(VK_NOT_READY); @@ -270,7 +333,94 @@ void VulkanCommands::updateFences() { } } -} // namespace filament::backend +void VulkanCommands::pushGroupMarker(char const* str, VulkanGroupMarkers::Timestamp timestamp) { +#if FILAMENT_VULKAN_VERBOSE + // If the timestamp is not 0, then we are carrying over a marker across buffer submits. + // If it is 0, then this is a normal marker push and we should just print debug line as usual. + if (timestamp.time_since_epoch().count() == 0.0) { + utils::slog.d << "----> " << str << utils::io::endl; + } +#endif + + // TODO: Add group marker color to the Driver API + const VkCommandBuffer cmdbuffer = get().cmdbuffer; + + if (!mGroupMarkers) { + mGroupMarkers = std::make_unique(); + } + mGroupMarkers->push(str, timestamp); + + if (mContext->isDebugUtilsSupported()) { + VkDebugUtilsLabelEXT labelInfo = { + .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, + .pLabelName = str, + .color = {0, 1, 0, 1}, + }; + vkCmdBeginDebugUtilsLabelEXT(cmdbuffer, &labelInfo); + } else if (mContext->isDebugMarkersSupported()) { + VkDebugMarkerMarkerInfoEXT markerInfo = { + .sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT, + .pMarkerName = str, + .color = {0.0f, 1.0f, 0.0f, 1.0f}, + }; + vkCmdDebugMarkerBeginEXT(cmdbuffer, &markerInfo); + } +} + +void VulkanCommands::popGroupMarker() { + assert_invariant(mGroupMarkers); + + if (!mGroupMarkers->empty()) { + const VkCommandBuffer cmdbuffer = get().cmdbuffer; + #if FILAMENT_VULKAN_VERBOSE + auto const [marker, startTime] = mGroupMarkers->pop(); + auto const endTime = std::chrono::high_resolution_clock::now(); + std::chrono::duration diff = endTime - startTime; + utils::slog.d << "<---- " << marker << " elapsed: " << (diff.count() * 1000) << " ms\n" + << utils::io::flush; + #else + mGroupMarkers->pop(); + #endif + + if (mContext->isDebugUtilsSupported()) { + vkCmdEndDebugUtilsLabelEXT(cmdbuffer); + } else if (mContext->isDebugMarkersSupported()) { + vkCmdDebugMarkerEndEXT(cmdbuffer); + } + } else if (mCarriedOverMarkers && !mCarriedOverMarkers->empty()) { + // It could be that pop is called between flush() and get() (new command buffer), in which + // case the marker is in "carried over" state. We'd just remove that + mCarriedOverMarkers->pop(); + } +} + +void VulkanCommands::insertEventMarker(char const* string, uint32_t len) { + VkCommandBuffer const cmdbuffer = get().cmdbuffer; + if (mContext->isDebugUtilsSupported()) { + VkDebugUtilsLabelEXT labelInfo = { + .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, + .pLabelName = string, + .color = {1, 1, 0, 1}, + }; + vkCmdInsertDebugUtilsLabelEXT(cmdbuffer, &labelInfo); + } else if (mContext->isDebugMarkersSupported()) { + VkDebugMarkerMarkerInfoEXT markerInfo = { + .sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT, + .pMarkerName = string, + .color = {0.0f, 1.0f, 0.0f, 1.0f}, + }; + vkCmdDebugMarkerInsertEXT(cmdbuffer, &markerInfo); + } +} + +std::string VulkanCommands::getTopGroupMarker() const { + if (!mGroupMarkers || mGroupMarkers->empty()) { + return ""; + } + return std::get<0>(mGroupMarkers->top()); +} + +}// namespace filament::backend #if defined(_MSC_VER) #pragma warning( pop ) diff --git a/filament/backend/src/vulkan/VulkanCommands.h b/filament/backend/src/vulkan/VulkanCommands.h index 7ab07b57b1..811796c31d 100644 --- a/filament/backend/src/vulkan/VulkanCommands.h +++ b/filament/backend/src/vulkan/VulkanCommands.h @@ -26,8 +26,31 @@ #include +#include +#include +#include +#include + namespace filament::backend { +struct VulkanContext; + +class VulkanGroupMarkers { +public: + using Timestamp = std::chrono::time_point; + + void push(std::string const& marker, Timestamp start = {}) noexcept; + std::pair pop() noexcept; + std::pair top() const; + bool empty() const noexcept; + +private: + std::stack mMarkers; +#if FILAMENT_VULKAN_VERBOSE + std::stack mTimestamps; +#endif +}; + // Wrapper to enable use of shared_ptr for implementing shared ownership of low-level Vulkan fences. struct VulkanCmdFence { VulkanCmdFence(VkDevice device, bool signaled = false); @@ -86,7 +109,8 @@ public: // class VulkanCommands { public: - VulkanCommands(VkDevice device, VkQueue queue, uint32_t queueFamilyIndex); + VulkanCommands(VkDevice device, VkQueue queue, uint32_t queueFamilyIndex, + VulkanContext* context); ~VulkanCommands(); // Creates a "current" command buffer if none exists, otherwise returns the current one. @@ -121,11 +145,21 @@ class VulkanCommands { // The observer's event handler can only be called during get(). void setObserver(CommandBufferObserver* observer) { mObserver = observer; } + void pushGroupMarker(char const* str, VulkanGroupMarkers::Timestamp timestamp = {}); + + void popGroupMarker(); + + void insertEventMarker(char const* string, uint32_t len); + + std::string getTopGroupMarker() const; + private: static constexpr int CAPACITY = VK_MAX_COMMAND_BUFFERS; - const VkDevice mDevice; - const VkQueue mQueue; - const VkCommandPool mPool; + VkDevice const mDevice; + VkQueue const mQueue; + VkCommandPool const mPool; + VulkanContext const* mContext; + VulkanCommandBuffer* mCurrent = nullptr; VkSemaphore mSubmissionSignal = {}; VkSemaphore mInjectedSignal = {}; @@ -133,6 +167,9 @@ class VulkanCommands { VkSemaphore mSubmissionSignals[CAPACITY] = {}; size_t mAvailableCount = CAPACITY; CommandBufferObserver* mObserver = nullptr; + + std::unique_ptr mGroupMarkers; + std::unique_ptr mCarriedOverMarkers; }; } // namespace filament::backend diff --git a/filament/backend/src/vulkan/VulkanContext.cpp b/filament/backend/src/vulkan/VulkanContext.cpp index 14726274b9..84f456f571 100644 --- a/filament/backend/src/vulkan/VulkanContext.cpp +++ b/filament/backend/src/vulkan/VulkanContext.cpp @@ -15,6 +15,8 @@ */ #include "VulkanContext.h" + +#include "VulkanCommands.h" #include "VulkanHandles.h" #include "VulkanMemory.h" #include "VulkanTexture.h" diff --git a/filament/backend/src/vulkan/VulkanContext.h b/filament/backend/src/vulkan/VulkanContext.h index 0355ed4c4e..a22951deb6 100644 --- a/filament/backend/src/vulkan/VulkanContext.h +++ b/filament/backend/src/vulkan/VulkanContext.h @@ -17,7 +17,6 @@ #ifndef TNT_FILAMENT_BACKEND_VULKANCONTEXT_H #define TNT_FILAMENT_BACKEND_VULKANCONTEXT_H -#include "VulkanCommands.h" #include "VulkanConstants.h" #include "VulkanImageUtility.h" #include "VulkanPipelineCache.h" @@ -38,6 +37,7 @@ struct VulkanSwapChain; struct VulkanTexture; class VulkanStagePool; struct VulkanTimerQuery; +struct VulkanCommandBuffer; struct VulkanAttachment { VulkanTexture* texture; diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 5598ef7b79..d956385e61 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -30,16 +30,12 @@ #include #include #include +#include #ifndef NDEBUG #include #endif -#if FILAMENT_VULKAN_VERBOSE -#include -static std::stack renderPassMarkers; -#endif - using namespace bluevk; using utils::FixedCapacityVector; @@ -186,7 +182,7 @@ VulkanDriver::VulkanDriver(VulkanPlatform* platform, VulkanContext const& contex #endif mTimestamps = std::make_unique(mPlatform->getDevice()); mCommands = std::make_unique(mPlatform->getDevice(), - mPlatform->getGraphicsQueue(), mPlatform->getGraphicsQueueFamilyIndex()); + mPlatform->getGraphicsQueue(), mPlatform->getGraphicsQueueFamilyIndex(), &mContext); mCommands->setObserver(&mPipelineCache); mPipelineCache.setDevice(mPlatform->getDevice(), mAllocator); @@ -1146,15 +1142,18 @@ void VulkanDriver::beginRenderPass(Handle rth, const RenderPassP VkFramebuffer vkfb = mFramebufferCache.getFramebuffer(fbkey); // Assign a label to the framebuffer for debugging purposes. - if (UTILS_UNLIKELY(mContext.isDebugUtilsSupported()) && !mCurrentDebugMarker.empty()) { - const VkDebugUtilsObjectNameInfoEXT info = { - VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, - nullptr, - VK_OBJECT_TYPE_FRAMEBUFFER, - reinterpret_cast(vkfb), - mCurrentDebugMarker.c_str(), - }; - vkSetDebugUtilsObjectNameEXT(mPlatform->getDevice(), &info); + if (UTILS_UNLIKELY(mContext.isDebugUtilsSupported())) { + auto const topMarker = mCommands->getTopGroupMarker(); + if (!topMarker.empty()) { + const VkDebugUtilsObjectNameInfoEXT info = { + VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, + nullptr, + VK_OBJECT_TYPE_FRAMEBUFFER, + reinterpret_cast(vkfb), + topMarker.c_str(), + }; + vkSetDebugUtilsObjectNameEXT(mPlatform->getDevice(), &info); + } } // The current command buffer now owns a reference to the render target and its attachments. @@ -1375,75 +1374,29 @@ void VulkanDriver::bindSamplers(uint32_t index, Handle sbh) { } void VulkanDriver::insertEventMarker(char const* string, uint32_t len) { - constexpr float MARKER_COLOR[] = { 0.0f, 1.0f, 0.0f, 1.0f }; - VkCommandBuffer const cmdbuffer = mCommands->get().cmdbuffer; - if (mContext.isDebugUtilsSupported()) { - VkDebugUtilsLabelEXT labelInfo = { - .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, - .pLabelName = string, - .color = {1, 1, 0, 1}, - }; - vkCmdInsertDebugUtilsLabelEXT(cmdbuffer, &labelInfo); - } else if (mContext.isDebugMarkersSupported()) { - VkDebugMarkerMarkerInfoEXT markerInfo = {}; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - memcpy(markerInfo.color, &MARKER_COLOR[0], sizeof(MARKER_COLOR)); - markerInfo.pMarkerName = string; - vkCmdDebugMarkerInsertEXT(cmdbuffer, &markerInfo); - } + mCommands->insertEventMarker(string, len); } -void VulkanDriver::pushGroupMarker(char const* string, uint32_t len) { - -#if FILAMENT_VULKAN_VERBOSE - renderPassMarkers.push(std::string(string)); - utils::slog.d << "----> " << string << utils::io::endl; -#endif - - // TODO: Add group marker color to the Driver API - constexpr float MARKER_COLOR[] = { 0.0f, 1.0f, 0.0f, 1.0f }; - const VkCommandBuffer cmdbuffer = mCommands->get().cmdbuffer; - if (mContext.isDebugUtilsSupported()) { - VkDebugUtilsLabelEXT labelInfo = { - .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, - .pLabelName = string, - .color = {0, 1, 0, 1}, - }; - vkCmdBeginDebugUtilsLabelEXT(cmdbuffer, &labelInfo); - mCurrentDebugMarker = string; - } else if (mContext.isDebugMarkersSupported()) { - VkDebugMarkerMarkerInfoEXT markerInfo = {}; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - memcpy(markerInfo.color, &MARKER_COLOR[0], sizeof(MARKER_COLOR)); - markerInfo.pMarkerName = string; - vkCmdDebugMarkerBeginEXT(cmdbuffer, &markerInfo); +void VulkanDriver::pushGroupMarker(char const* string, uint32_t) { + // Turns out all the markers are 0-terminated, so we can just pass it without len. + mCommands->pushGroupMarker(string); + { + SYSTRACE_CONTEXT(); + SYSTRACE_NAME_BEGIN(string); } } void VulkanDriver::popGroupMarker(int) { - -#if FILAMENT_VULKAN_VERBOSE - std::string const& marker = renderPassMarkers.top(); - renderPassMarkers.pop(); - utils::slog.d << "<---- " << marker << utils::io::endl; -#endif - - const VkCommandBuffer cmdbuffer = mCommands->get().cmdbuffer; - if (mContext.isDebugUtilsSupported()) { - vkCmdEndDebugUtilsLabelEXT(cmdbuffer); - mCurrentDebugMarker.clear(); - } else if (mContext.isDebugMarkersSupported()) { - vkCmdDebugMarkerEndEXT(cmdbuffer); + mCommands->popGroupMarker(); + { + SYSTRACE_CONTEXT(); + SYSTRACE_NAME_END(); } } -void VulkanDriver::startCapture(int) { +void VulkanDriver::startCapture(int) {} -} - -void VulkanDriver::stopCapture(int) { - -} +void VulkanDriver::stopCapture(int) {} void VulkanDriver::readPixels(Handle src, uint32_t x, uint32_t y, uint32_t width, uint32_t height, PixelBufferDescriptor&& pbd) { diff --git a/filament/backend/src/vulkan/VulkanDriver.h b/filament/backend/src/vulkan/VulkanDriver.h index f6dae95e4b..a98218e194 100644 --- a/filament/backend/src/vulkan/VulkanDriver.h +++ b/filament/backend/src/vulkan/VulkanDriver.h @@ -148,7 +148,6 @@ private: VmaAllocator mAllocator = VK_NULL_HANDLE; VkDebugReportCallbackEXT mDebugCallback = VK_NULL_HANDLE; VkDebugUtilsMessengerEXT mDebugMessenger = VK_NULL_HANDLE; - std::string mCurrentDebugMarker; VulkanContext mContext = {}; HandleAllocatorVK mHandleAllocator; From 35c91827af1208f07aa0052c5ec9977fa0830059 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 15 Jun 2023 15:24:52 -0700 Subject: [PATCH 16/22] fix error reporting with ShaderCompilerService when using the thread pool we were destroying the shaders immediately, we need to defer this until we query the program link status, so that in case of failure we can query each shader compile status. we make the shader handles part of the promise/future so they can be transferred to the main thread, just like the program id is. --- .../src/opengl/ShaderCompilerService.cpp | 17 +++++++---------- .../backend/src/opengl/ShaderCompilerService.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/filament/backend/src/opengl/ShaderCompilerService.cpp b/filament/backend/src/opengl/ShaderCompilerService.cpp index 7f052d3b06..085a453c26 100644 --- a/filament/backend/src/opengl/ShaderCompilerService.cpp +++ b/filament/backend/src/opengl/ShaderCompilerService.cpp @@ -68,6 +68,7 @@ struct ShaderCompilerService::ProgramToken { struct ProgramBinary { GLenum format{}; GLuint program{}; + std::array shaders{}; std::vector blob; }; @@ -251,15 +252,9 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram( // link the program GLuint const glProgram = linkProgram(gl, shaders, token->attributes); - // immediately destroy the shaders - for (GLuint const shader: shaders) { - if (shader) { - glDetachShader(glProgram, shader); - glDeleteShader(shader); - } - } - ProgramToken::ProgramBinary binary; + binary.shaders = shaders; + if (UTILS_LIKELY(mUseSharedContext)) { // We need to query the link status here to guarantee that the // program is compiled and linked now (we don't want this to be @@ -323,7 +318,8 @@ ShaderCompilerService::program_token_t ShaderCompilerService::createProgram( return false; } // program binary is ready, retrieve it without blocking - getProgramFromCompilerPool(const_cast(token)); + ShaderCompilerService::getProgramFromCompilerPool( + const_cast(token)); } } else { if (KHR_parallel_shader_compile) { @@ -479,6 +475,7 @@ void ShaderCompilerService::notifyWhenAllProgramsAreReady(CallbackHandler* handl void ShaderCompilerService::getProgramFromCompilerPool(program_token_t& token) noexcept { ProgramToken::ProgramBinary const binary{ token->binary.get() }; if (!token->canceled) { + token->gl.shaders = binary.shaders; if (UTILS_LIKELY(mUseSharedContext)) { token->gl.program = binary.program; } @@ -507,7 +504,7 @@ GLuint ShaderCompilerService::initialize(program_token_t& token) noexcept { } // block until we get the program from the pool - getProgramFromCompilerPool(token); + ShaderCompilerService::getProgramFromCompilerPool(token); } else if (KHR_parallel_shader_compile) { // we force the program link -- which might stall, either here or below in // checkProgramStatus(), but we don't have a choice, we need to use the program now. diff --git a/filament/backend/src/opengl/ShaderCompilerService.h b/filament/backend/src/opengl/ShaderCompilerService.h index 0fccf7525c..2ff64a48ec 100644 --- a/filament/backend/src/opengl/ShaderCompilerService.h +++ b/filament/backend/src/opengl/ShaderCompilerService.h @@ -120,7 +120,7 @@ private: GLuint initialize(ShaderCompilerService::program_token_t& token) noexcept; - void getProgramFromCompilerPool(program_token_t& token) noexcept; + static void getProgramFromCompilerPool(program_token_t& token) noexcept; static void compileShaders( OpenGLContext& context, From 6e99a4dcfccbb4cf0b016a33f2164e5de916b3db Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Tue, 20 Jun 2023 14:59:10 +0800 Subject: [PATCH 17/22] Turn off iOS exceptions in debug builds (#6912) --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8f99ad338..976c3e4dab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,6 +372,12 @@ if (ANDROID OR IOS OR WEBGL) endif() endif() +# Turn off exceptions on iOS debug as well. This fixes an availability error we see when using +# std::visit, which is not supported on iOS 11.0 when exceptions are enabled. +if (IOS) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-exceptions") +endif() + # With WebGL, we disable RTTI even for debug builds because we pass emscripten::val back and forth # between C++ and JavaScript in order to efficiently access typed arrays, which are unbound. # NOTE: This is not documented in emscripten so we should consider a different approach. From 85ab9d211d3f21a0bc58722215750b4b10d86691 Mon Sep 17 00:00:00 2001 From: Benjamin Doherty Date: Tue, 20 Jun 2023 23:42:35 +0800 Subject: [PATCH 18/22] Release Filament 1.39.0 --- NEW_RELEASE_NOTES.md | 5 ----- README.md | 4 ++-- RELEASE_NOTES.md | 8 ++++++++ android/gradle.properties | 2 +- ios/CocoaPods/Filament.podspec | 4 ++-- web/filament-js/package.json | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/NEW_RELEASE_NOTES.md b/NEW_RELEASE_NOTES.md index c690c6a623..c3161a7700 100644 --- a/NEW_RELEASE_NOTES.md +++ b/NEW_RELEASE_NOTES.md @@ -8,8 +8,3 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md). ## Release notes for next branch cut -- matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] -- vulkan: support sRGB swap chain -- Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances. -- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665) -- backend: parallel shader compilation support. This breaks and improves the recent `Material::compile` API. diff --git a/README.md b/README.md index 68c7e0a737..470a6360ee 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.38.0' + implementation 'com.google.android.filament:filament-android:1.39.0' } ``` @@ -50,7 +50,7 @@ Here are all the libraries available in the group `com.google.android.filament`: iOS projects can use CocoaPods to install the latest release: ``` -pod 'Filament', '~> 1.38.0' +pod 'Filament', '~> 1.39.0' ``` ### Snapshots diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 000e876d4c..24709bbf55 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,6 +7,14 @@ A new header is inserted each time a *tag* is created. Instead, if you are authoring a PR for the main branch, add your release note to [NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md). +## v1.40.0 + +- matc: fix VSM high precision option on mobile [⚠️ **Recompile materials**] +- vulkan: support sRGB swap chain +- Add new `getMaxAutomaticInstances()` API on `Engine` to get max supported automatic instances. +- UiHelper: fix jank when a `TextureView` is resized (fixes b\282220665) +- backend: parallel shader compilation support. This breaks and improves the recent `Material::compile` API. + ## v1.39.0 - matc: workaround a bug in spirv-tools causing vsm to fail [⚠️ **Recompile materials**] diff --git a/android/gradle.properties b/android/gradle.properties index 6237b322dc..4083a0dbc1 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.38.0 +VERSION_NAME=1.39.0 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 6fdae3e7db..3542d963fa 100644 --- a/ios/CocoaPods/Filament.podspec +++ b/ios/CocoaPods/Filament.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |spec| spec.name = "Filament" - spec.version = "1.38.0" + spec.version = "1.39.0" spec.license = { :type => "Apache 2.0", :file => "LICENSE" } spec.homepage = "https://google.github.io/filament" spec.authors = "Google LLC." spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL." spec.platform = :ios, "11.0" - spec.source = { :http => "https://github.com/google/filament/releases/download/v1.38.0/filament-v1.38.0-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.39.0/filament-v1.39.0-ios.tgz" } # Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon. spec.pod_target_xcconfig = { diff --git a/web/filament-js/package.json b/web/filament-js/package.json index cd36263014..0f55bceed7 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.38.0", + "version": "1.39.0", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js", From 1d988182fc6ba0376b0daa5b717185b8a601fa13 Mon Sep 17 00:00:00 2001 From: Benjamin Doherty Date: Tue, 20 Jun 2023 23:55:00 +0800 Subject: [PATCH 19/22] Bump version to 1.40.0 --- README.md | 4 ++-- android/gradle.properties | 2 +- ios/CocoaPods/Filament.podspec | 4 ++-- web/filament-js/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 470a6360ee..6906056ee5 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation 'com.google.android.filament:filament-android:1.39.0' + implementation 'com.google.android.filament:filament-android:1.40.0' } ``` @@ -50,7 +50,7 @@ Here are all the libraries available in the group `com.google.android.filament`: iOS projects can use CocoaPods to install the latest release: ``` -pod 'Filament', '~> 1.39.0' +pod 'Filament', '~> 1.40.0' ``` ### Snapshots diff --git a/android/gradle.properties b/android/gradle.properties index 4083a0dbc1..d9d0cd89b9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.google.android.filament -VERSION_NAME=1.39.0 +VERSION_NAME=1.40.0 POM_DESCRIPTION=Real-time physically based rendering engine for Android. diff --git a/ios/CocoaPods/Filament.podspec b/ios/CocoaPods/Filament.podspec index 3542d963fa..5116d40eb3 100644 --- a/ios/CocoaPods/Filament.podspec +++ b/ios/CocoaPods/Filament.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |spec| spec.name = "Filament" - spec.version = "1.39.0" + spec.version = "1.40.0" spec.license = { :type => "Apache 2.0", :file => "LICENSE" } spec.homepage = "https://google.github.io/filament" spec.authors = "Google LLC." spec.summary = "Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WASM/WebGL." spec.platform = :ios, "11.0" - spec.source = { :http => "https://github.com/google/filament/releases/download/v1.39.0/filament-v1.39.0-ios.tgz" } + spec.source = { :http => "https://github.com/google/filament/releases/download/v1.40.0/filament-v1.40.0-ios.tgz" } # Fix linking error with Xcode 12; we do not yet support the simulator on Apple silicon. spec.pod_target_xcconfig = { diff --git a/web/filament-js/package.json b/web/filament-js/package.json index 0f55bceed7..bd2cf1b73f 100644 --- a/web/filament-js/package.json +++ b/web/filament-js/package.json @@ -1,6 +1,6 @@ { "name": "filament", - "version": "1.39.0", + "version": "1.40.0", "description": "Real-time physically based rendering engine", "main": "filament.js", "module": "filament.js", From 8cd70454c3b7794ef652ed9a714eae121b6b85bb Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Tue, 20 Jun 2023 11:48:07 -0700 Subject: [PATCH 20/22] Update MaterialEnums.h to v39 --- libs/filabridge/include/filament/MaterialEnums.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/filabridge/include/filament/MaterialEnums.h b/libs/filabridge/include/filament/MaterialEnums.h index f87a8ef6bc..f58ffe2e6b 100644 --- a/libs/filabridge/include/filament/MaterialEnums.h +++ b/libs/filabridge/include/filament/MaterialEnums.h @@ -28,7 +28,7 @@ namespace filament { // update this when a new version of filament wouldn't work with older materials -static constexpr size_t MATERIAL_VERSION = 38; +static constexpr size_t MATERIAL_VERSION = 39; /** * Supported shading models From 7c8a0d1967466ebe67537f3d0af12da5fd7a31ab Mon Sep 17 00:00:00 2001 From: Benjamin Doherty Date: Mon, 26 Jun 2023 10:33:02 +0800 Subject: [PATCH 21/22] Bump MATERIAL_VERSION to 40 --- libs/filabridge/include/filament/MaterialEnums.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/filabridge/include/filament/MaterialEnums.h b/libs/filabridge/include/filament/MaterialEnums.h index f58ffe2e6b..9ade8a98a4 100644 --- a/libs/filabridge/include/filament/MaterialEnums.h +++ b/libs/filabridge/include/filament/MaterialEnums.h @@ -28,7 +28,7 @@ namespace filament { // update this when a new version of filament wouldn't work with older materials -static constexpr size_t MATERIAL_VERSION = 39; +static constexpr size_t MATERIAL_VERSION = 40; /** * Supported shading models From 1432c59499b624193ef24d7bfcfd69ee46162730 Mon Sep 17 00:00:00 2001 From: Benjamin Doherty Date: Mon, 26 Jun 2023 11:47:29 +0800 Subject: [PATCH 22/22] Add missing atomic header --- filament/backend/src/opengl/ShaderCompilerService.h | 1 + 1 file changed, 1 insertion(+) diff --git a/filament/backend/src/opengl/ShaderCompilerService.h b/filament/backend/src/opengl/ShaderCompilerService.h index 2ff64a48ec..eefd75aa9d 100644 --- a/filament/backend/src/opengl/ShaderCompilerService.h +++ b/filament/backend/src/opengl/ShaderCompilerService.h @@ -26,6 +26,7 @@ #include #include +#include #include #include #include